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

Method SaveLevelGoalInfo

Descent3/levelgoal.cpp:730–802  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728int levelgoals::GetNumGoals() { return m_num_goals; }
729
730bool levelgoals::SaveLevelGoalInfo(CFILE *fptr) {
731 int i;
732 cf_WriteShort(fptr, LEVEL_GOAL_VERSION);
733
734 cf_WriteShort(fptr, m_num_goals);
735 for (i = 0; i < m_num_goals; i++) {
736 char name[256];
737 char iname[256];
738 char desc[2560];
739 char message[2560];
740 int len;
741 int num_items;
742 int j;
743 int priority = 0;
744 char g_list = 0;
745 int status = 0;
746
747 Level_goals.GoalStatus(i, LO_GET_SPECIFIED, &status);
748 cf_WriteInt(fptr, status);
749
750 Level_goals.GoalPriority(i, LO_GET_SPECIFIED, &priority);
751 cf_WriteInt(fptr, priority);
752
753 Level_goals.GoalGoalList(i, LO_GET_SPECIFIED, &g_list);
754 cf_WriteByte(fptr, g_list);
755
756 Level_goals.GoalGetName(i, name, 256);
757 Level_goals.GoalGetItemName(i, iname, 256);
758 Level_goals.GoalGetDesc(i, desc, 2560);
759 Level_goals.GoalGetCompletionMessage(i, message, 2560);
760
761 len = strlen(name);
762 cf_WriteShort(fptr, len);
763 if (len) {
764 cf_WriteBytes((uint8_t *)name, len, fptr);
765 }
766
767 len = strlen(iname);
768 cf_WriteShort(fptr, len);
769 if (len) {
770 cf_WriteBytes((uint8_t *)iname, len, fptr);
771 }
772
773 len = strlen(desc);
774 cf_WriteShort(fptr, len);
775 if (len) {
776 cf_WriteBytes((uint8_t *)desc, len, fptr);
777 }
778
779 len = strlen(message);
780 cf_WriteShort(fptr, len);
781 if (len) {
782 cf_WriteBytes((uint8_t *)message, len, fptr);
783 }
784
785 num_items = Level_goals.GoalGetNumItems(i);
786 cf_WriteShort(fptr, num_items);
787 for (j = 0; j < num_items; j++) {

Callers 2

SaveGameStateFunction · 0.80
WriteLevelGoalsChunkFunction · 0.80

Calls 13

cf_WriteShortFunction · 0.85
cf_WriteIntFunction · 0.85
cf_WriteByteFunction · 0.85
cf_WriteBytesFunction · 0.85
GoalStatusMethod · 0.80
GoalPriorityMethod · 0.80
GoalGoalListMethod · 0.80
GoalGetNameMethod · 0.80
GoalGetItemNameMethod · 0.80
GoalGetDescMethod · 0.80
GoalGetNumItemsMethod · 0.80

Tested by

no test coverage detected