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

Function ListObjectsInAllLevels

editor/Erooms.cpp:3211–3254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3209#define NUM_LEVELS 15
3210
3211void ListObjectsInAllLevels() {
3212 int object_counts[NUM_LEVELS + 1][MAX_OBJECT_IDS];
3213 char levelname[25];
3214 int i, l;
3215
3216 error_buf_offset = 0;
3217
3218 // Clear totals
3219 for (i = 0; i < MAX_OBJECT_IDS; i++)
3220 object_counts[0][i] = 0;
3221
3222 // Get totals for each level
3223 for (l = 1; l < NUM_LEVELS + 1; l++) {
3224
3225 sprintf(levelname, "Level%d.d3l", l);
3226
3227 LoadLevel(levelname);
3228
3229 CheckError("\n\nLevel: %s\n", levelname);
3230
3231 ListObjectsInLevel(&object_counts[l][0]);
3232
3233 // Accumulate totals
3234 for (i = 0; i < MAX_OBJECT_IDS; i++)
3235 object_counts[0][i] += object_counts[l][i];
3236 }
3237
3238 // Print headers
3239 CheckError("\n\nName\tType\tTotal");
3240 for (l = 1; l < NUM_LEVELS + 1; l++)
3241 CheckError("\t%d", l + 1);
3242
3243 // Print table
3244 for (i = 0; i < MAX_OBJECT_IDS; i++) {
3245 if (Object_info[i].type != OBJ_NONE) {
3246 CheckError("\n%s\t%c", Object_info[i].name, Object_type_names[Object_info[i].type][0]);
3247 for (int l = 0; l < NUM_LEVELS + 1; l++) {
3248 CheckError("\t%d", object_counts[l][i]);
3249 }
3250 }
3251 }
3252
3253 DumpTextToClipboard(error_buf);
3254}

Callers 1

ListAllObjectsFunction · 0.85

Calls 4

LoadLevelFunction · 0.85
CheckErrorFunction · 0.85
ListObjectsInLevelFunction · 0.85
DumpTextToClipboardFunction · 0.85

Tested by

no test coverage detected