MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / LoadLevelGoalInfo

Method LoadLevelGoalInfo

Descent3/levelgoal.cpp:826–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

824}
825
826bool levelgoals::LoadLevelGoalInfo(CFILE *fptr) {
827 CleanupAfterLevel();
828
829 int i;
830 int16_t version = cf_ReadShort(fptr);
831 int num_goals = cf_ReadShort(fptr);
832
833 for (i = 0; i < num_goals; i++) {
834 char name[256];
835 char iname[256];
836 char desc[2560];
837 char message[2560];
838 int len;
839 int num_items;
840 int j;
841 int priority;
842 char g_list;
843 int status;
844
845 int gi = AddGoal(false);
846 ASSERT(gi == i);
847
848 status = cf_ReadInt(fptr);
849 m_goal[i].GetStatus(i, LO_SET_SPECIFIED, &status, true);
850
851 priority = cf_ReadInt(fptr);
852 Level_goals.GoalPriority(i, LO_SET_SPECIFIED, &priority);
853
854 if (version < 4) {
855 g_list = 0;
856 } else {
857 g_list = cf_ReadByte(fptr);
858 }
859 Level_goals.GoalGoalList(i, LO_SET_SPECIFIED, &g_list);
860
861 len = cf_ReadShort(fptr);
862 if (len) {
863 cf_ReadBytes((uint8_t *)name, len, fptr);
864 }
865 name[len] = '\0';
866
867 len = cf_ReadShort(fptr);
868 if (len) {
869 cf_ReadBytes((uint8_t *)iname, len, fptr);
870 }
871 iname[len] = '\0';
872
873 len = cf_ReadShort(fptr);
874 if (len) {
875 cf_ReadBytes((uint8_t *)desc, len, fptr);
876 }
877 desc[len] = '\0';
878
879 if (version < 3) {
880 message[0] = '\0';
881 } else {
882 len = cf_ReadShort(fptr);
883 if (len) {

Callers 2

LoadGameStateFunction · 0.80
ReadLevelGoalsChunkFunction · 0.80

Calls 12

cf_ReadShortFunction · 0.85
cf_ReadIntFunction · 0.85
cf_ReadByteFunction · 0.85
cf_ReadBytesFunction · 0.85
GoalPriorityMethod · 0.80
GoalGoalListMethod · 0.80
GoalSetNameMethod · 0.80
GoalSetItemNameMethod · 0.80
GoalSetDescMethod · 0.80
GoalItemInfoMethod · 0.80
GetStatusMethod · 0.45

Tested by

no test coverage detected