void MissionSelector::loadMission(string fileName) { if(fileName == "") return; Mission* oldMission = rMain()->getMission(); Orbit* orbitScreen = static_cast<Orbit*>(rMain()->getScreenManager().getState(Main::ORBIT_SCREEN)); orbitScreen->enterReadyState(); DataFile* dataFile = new DataFile(stringToWString(fileName)); if(dataFile->getRootItem() != NULL) { Mission* mission = dataFile->getRootItem()->castToClass<Mission>(); if(mission != NULL) { rMain()->setMission(mission); if(oldMission != NULL) { if (oldMission == ConfigManager::getPlayer()->getHomeBase()) { ConfigManager::getSingleton().savePlayer(); } else { delete oldMission->getDataFile(); } } } } }
int station_load_group(LuaState* state) { wstring fileName = wstringFromLuaObject(state->Stack(1)); if(fileName == L"") return 0; DataFile* groupFile = new DataFile(fileName); if(NULL == groupFile->getRootItem()) { logEngineWarn("station_load_group: File not found"); return 0; } Group* group = groupFile->getRootItem()->castToClass<Group>(); if(NULL == group) return 0; Station* station = rMain()->getMission()->getStation(); station->insertGroup(group); delete groupFile; return 0; }