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

Function LoadLevelText

Descent3/Mission.cpp:1254–1271  ·  view source on GitHub ↗

Load the text (goal strings) for a level

Source from the content-addressed store, hash-verified

1252#include "levelgoal.h"
1253// Load the text (goal strings) for a level
1254void LoadLevelText(const char *level_filename) {
1255 char pathname[_MAX_FNAME], filename[_MAX_FNAME];
1256 int n_strings;
1257 ddio_SplitPath(level_filename, pathname, filename, NULL);
1258 strcat(pathname, filename);
1259 strcat(pathname, ".str");
1260 char **goal_strings;
1261 if (CreateStringTable(pathname, &goal_strings, &n_strings)) {
1262 int n_goals = Level_goals.GetNumGoals();
1263 ASSERT(n_strings == (n_goals * 3));
1264 for (int i = 0; i < n_goals; i++) {
1265 Level_goals.GoalSetName(i, goal_strings[i * 3]);
1266 Level_goals.GoalSetItemName(i, goal_strings[i * 3 + 1]);
1267 Level_goals.GoalSetDesc(i, goal_strings[i * 3 + 2]);
1268 }
1269 DestroyStringTable(goal_strings, n_strings);
1270 }
1271}
1272
1273/* loads a level and sets it as current level in mission
1274 */

Callers 2

StartLevelFunction · 0.85
LoadMissionLevelFunction · 0.85

Calls 7

CreateStringTableFunction · 0.85
DestroyStringTableFunction · 0.85
GetNumGoalsMethod · 0.80
GoalSetNameMethod · 0.80
GoalSetItemNameMethod · 0.80
GoalSetDescMethod · 0.80
ddio_SplitPathFunction · 0.50

Tested by

no test coverage detected