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

Method CreateNewTableFile

editor/TableFileFilterMng.cpp:1381–1613  ·  view source on GitHub ↗

Creates the new table file by filtering out any pages that are not in the current page data list

Source from the content-addressed store, hash-verified

1379// Creates the new table file by filtering out any pages that
1380// are not in the current page data list
1381bool PageDataList::CreateNewTableFile(char *new_table_filename, char *src_table_filename) {
1382 CFILE *infile, *outfile;
1383 uint8_t pagetype, replaced = 0;
1384 int done = 0, len;
1385 int pages_written;
1386 PageDataNode *node;
1387 CString summary_msg;
1388 bool unwritten_page_found;
1389 char ext[12];
1390
1391 mngs_texture_page texpage;
1392 //@@mngs_power_page powpage;
1393 mngs_door_page doorpage;
1394 //@@mngs_robot_page robotpage;
1395 mngs_generic_page genericpage;
1396 mngs_gamefile_page gamefilepage;
1397 mngs_sound_page soundpage;
1398 mngs_ship_page shippage;
1399 mngs_weapon_page weaponpage;
1400 mngs_megacell_page megacellpage;
1401
1402 CWaitCursor wc;
1403
1404 if (new_table_filename == NULL || src_table_filename == NULL)
1405 return FALSE;
1406
1407 if (m_StatusText)
1408 m_StatusText->Format("Creating new table file - %s...", new_table_filename);
1409 if (m_Dlg)
1410 m_Dlg->UpdateData(FALSE);
1411 DeferMessages();
1412 wc.Restore();
1413
1414 // First make sure we can open the table file and the temp table file
1415 infile = cfopen(src_table_filename, "rb");
1416 if (!infile) {
1417 mprintf(0, "Couldn't open input table file!\n");
1418 return FALSE;
1419 }
1420
1421 outfile = cfopen(new_table_filename, "wb");
1422 if (!outfile) {
1423 mprintf(0, "Couldn't open output table file!\n");
1424 cfclose(infile);
1425 return FALSE;
1426 }
1427
1428 // Mark all pages in data list as not having been written out
1429 for (node = m_head; node != NULL; node = node->next)
1430 node->flags &= ~PAGE_WRITTEN_FLAG;
1431
1432 OpenFilterLogFiles();
1433
1434 // Read in every page from the source table file, but only write
1435 // out a page to the new table file if the same page name (and type)
1436 // are found in the current page data list
1437 pages_written = 0;
1438 while (!done) {

Callers 1

Calls 15

cfopenFunction · 0.85
cfcloseFunction · 0.85
OpenFilterLogFilesFunction · 0.85
cfeofFunction · 0.85
cf_ReadByteFunction · 0.85
cf_ReadIntFunction · 0.85
mng_ReadNewTexturePageFunction · 0.85
WriteToRemainingLogFunction · 0.85
mng_WriteNewTexturePageFunction · 0.85
WriteToRemovedLogFunction · 0.85
mng_ReadNewDoorPageFunction · 0.85
mng_WriteNewDoorPageFunction · 0.85

Tested by

no test coverage detected