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

Function mng_LoadLocalGenericPage

manage/generic.cpp:2220–2318  ·  view source on GitHub ↗

Reads a generic page from a local table file. It then allocs a generic and loads any images/models associated with that generic

Source from the content-addressed store, hash-verified

2218// Reads a generic page from a local table file. It then allocs a generic and
2219// loads any images/models associated with that generic
2220void mng_LoadLocalGenericPage(CFILE *infile) {
2221 mngs_generic_page genericpage;
2222 int ok = 0;
2223 memset(&genericpage, 0, sizeof(mngs_generic_page));
2224
2225 if (mng_ReadNewGenericPage(infile, &genericpage)) {
2226 // Check to see if this is a local copy that is supposed
2227 // to go over a network copy (supersede the net copy)
2228
2229 int i = FindObjectIDName(genericpage.objinfo_struct.name);
2230 if (i != -1) {
2231 // Make sure we really have this page checked out
2232 mngs_Pagelock pl;
2233
2234 strcpy(pl.name, genericpage.objinfo_struct.name);
2235 pl.pagetype = PAGETYPE_GENERIC;
2236
2237 /*if (Network_up && Stand_alone==0)
2238 {
2239 int locked=mng_CheckIfPageOwned(&pl,TableUser);
2240 if (locked!=1)
2241 Int3(); // Your local vs net copies of the lock file do not match
2242 }*/
2243
2244 ok = 1;
2245 bool need_to_load_page = true;
2246
2247 if (Loading_addon_table != -1) {
2248 AddOnTablefile *addon;
2249 int tidx;
2250
2251 // see if we really need to load this page
2252 // check to see if we already have loaded this page (because it was
2253 // a dependancy of another)
2254 addon = &AddOnDataTables[Loading_addon_table];
2255 for (tidx = 0; tidx < addon->Num_addon_tracklocks; tidx++) {
2256 if (addon->Addon_tracklocks[tidx].pagetype == PAGETYPE_GENERIC &&
2257 !stricmp(addon->Addon_tracklocks[tidx].name, genericpage.objinfo_struct.name)) {
2258 // found it!!
2259 mprintf(0, "GenericPage: %s previously loaded\n", genericpage.objinfo_struct.name);
2260 need_to_load_page = false;
2261 break;
2262 }
2263 }
2264 }
2265
2266 if (need_to_load_page) {
2267 mng_FreePagetypePrimitives(PAGETYPE_GENERIC, genericpage.objinfo_struct.name, 0);
2268 mng_AssignGenericPageToObjInfo(&genericpage, i);
2269
2270 // For addon data
2271 if (Loading_addon_table != -1) {
2272 // this is an overlay of some sort..see which we are overlaying
2273 int overlay = 1;
2274 int addidx, tidx;
2275 bool found = false;
2276 for (addidx = Num_addon_tables - 1; addidx >= 0; addidx--) {
2277 if (addidx == Loading_addon_table)

Callers 2

mng_LoadLocalPagesFunction · 0.85
mng_LoadAddonPagesFunction · 0.85

Calls 7

mng_ReadNewGenericPageFunction · 0.85
FindObjectIDNameFunction · 0.85
mng_PushAddonPageFunction · 0.85
mng_SetAndLoadGenericFunction · 0.85
mng_AllocTrackLockFunction · 0.85

Tested by

no test coverage detected