players
| 777 | |
| 778 | // players |
| 779 | int LGSPlayers(CFILE *fp) { |
| 780 | player *plr = &Players[0]; |
| 781 | int16_t size; |
| 782 | |
| 783 | // must do this if we read player struct as whole. |
| 784 | plr->inventory.Reset(false, INVRESET_ALL); |
| 785 | plr->counter_measures.Reset(false, INVRESET_ALL); |
| 786 | |
| 787 | gs_ReadShort(fp, size); |
| 788 | if (size != sizeof(player)) { |
| 789 | Int3(); |
| 790 | return LGS_OUTDATEDVER; |
| 791 | } else { |
| 792 | int guided_handle; |
| 793 | cf_ReadBytes((uint8_t *)plr, sizeof(player), fp); |
| 794 | if (plr->guided_obj) { |
| 795 | gs_ReadInt(fp, guided_handle); |
| 796 | plr->guided_obj = &Objects[guided_handle & HANDLE_OBJNUM_MASK]; |
| 797 | } |
| 798 | // save inventory and countermeasures |
| 799 | // must do this if we read player struct as whole. |
| 800 | plr->inventory.ReadInventory(fp); |
| 801 | plr->counter_measures.ReadInventory(fp); |
| 802 | } |
| 803 | |
| 804 | int ship_index = Players[Player_num].ship_index; |
| 805 | |
| 806 | if (ship_index < 0) |
| 807 | ship_index = 0; |
| 808 | |
| 809 | FreeCockpit(); |
| 810 | CloseShipHUD(); |
| 811 | InitShipHUD(ship_index); |
| 812 | InitCockpit(ship_index); |
| 813 | |
| 814 | return LGS_OK; |
| 815 | } |
| 816 | |
| 817 | extern int Physics_NumLinked; |
| 818 | extern int PhysicsLinkList[MAX_OBJECTS]; |
no test coverage detected