// This routine checks plane loading and grabs anyone we're missing. void XPMPLoadPlanesIfNecessary(void) { int active, models; XPLMPluginID owner; XPLMCountAircraft(&models, &active, &owner); if (owner != XPLMGetMyID()) return; if (models > gPlanePaths.size()) models = gPlanePaths.size(); for (int n = 1; n < models; ++n) { if (!gPlanePaths[n].empty()) { const char * ourPath = gPlanePaths[n].c_str(); char realPath[512]; char fileName[256]; XPLMGetNthAircraftModel(n, fileName, realPath); if (strcmp(ourPath, realPath)) { #if DEBUG_MANUAL_LOADING XPLMDebugString("Manually Loading plane: "); XPLMDebugString(ourPath); XPLMDebugString("\n"); #endif XPLMSetAircraftModel(n, ourPath); } } } }
int xivss_highlevel_reloadmodel(lua_State* L) { vessel* v = 0; int idx = luaL_checkint(L,1); if ((idx >= 0) && (idx < vessel_count)) { v = &vessels[idx]; } #if (!defined(DEDICATED_SERVER)) && (!defined(ORBITER_MODULE)) if (v) { char path[MAX_FILENAME] = { 0 }, model[MAX_FILENAME] = { 0 }; char buf[ARBITRARY_MAX] = { 0 }; char* acfpath; XPLMGetNthAircraftModel(v->plane_index, model, path); XPLMExtractFileAndPath(path); //acfpath = strstr(path,"Aircraft"); //if (acfpath) snprintf(path,MAX_FILENAME-1,"./%s",acfpath); #ifdef APL { char* tpath; while (tpath = strchr(path,':')) *tpath = '/'; strncpy(model,path,MAX_FILENAME-1); strncpy(path,"/Volumes/",MAX_FILENAME-1); strncat(path,model,MAX_FILENAME-1); } #endif //Fetch only aircraft model name acfpath = strstr(model,".acf"); if (acfpath) *acfpath = 0; xivss_initialize_vessel(v,path,model); } #endif return 1; }