Fix crash while loading mod and blank settings menu while paused game

pyro-refactor
DavivaD 2018-08-02 17:21:31 +02:00
parent 1b47cf76d3
commit e823c209fa
6 changed files with 30 additions and 9 deletions

View File

@ -77,11 +77,11 @@ void CPathManager::AddMod(const std::string &modPath)
if (ON == std::string::npos)
{
GetLogger()->Info("Loading mod: '%s'\n", modPath.c_str());
m_mods.push_back(modPath);
CResourceManager::AddLocation(modPath, true);
}
else
{
GetLogger()->Info("Found Excluded mod: '%s'\n", modPath.c_str());
GetLogger()->Info("Found excluded mod: '%s'\n", modPath.c_str());
}
}
@ -171,15 +171,33 @@ void CPathManager::InitPaths()
GetLogger()->Trace("Searching for mods in '%s'...\n", modAutoloadDir.c_str());
for (const std::string& modPath : FindModsInDir(modAutoloadDir))
{
GetLogger()->Info("Autoloading mod: '%s'\n", modPath.c_str());
CResourceManager::AddLocation(modPath);
std::string::size_type ON;
ON = modPath.find('~');
if (ON == std::string::npos)
{
GetLogger()->Info("Autoloading mod: '%s'\n", modPath.c_str());
CResourceManager::AddLocation(modPath);
}
else
{
GetLogger()->Info("Found excluded mod: '%s'\n", modPath.c_str());
}
}
}
for (const std::string& modPath : m_mods)
{
GetLogger()->Info("Loading mod: '%s'\n", modPath.c_str());
CResourceManager::AddLocation(modPath);
std::string::size_type ON;
ON = modPath.find('~');
if (ON == std::string::npos)
{
GetLogger()->Info("Loading mod: '%s'\n", modPath.c_str());
CResourceManager::AddLocation(modPath);
}
else
{
GetLogger()->Info("Found excluded mod: '%s'\n", modPath.c_str());
}
}
CResourceManager::SetSaveLocation(m_savePath);

View File

@ -327,6 +327,7 @@ std::string PhaseToString(Phase phase)
if (phase == PHASE_SETUPps) return "PHASE_SETUPps";
if (phase == PHASE_SETUPcs) return "PHASE_SETUPcs";
if (phase == PHASE_SETUPss) return "PHASE_SETUPss";
if (phase == PHASE_SETUPms) return "PHASE_SETUPms";
if (phase == PHASE_WRITEs) return "PHASE_WRITEs";
if (phase == PHASE_READ) return "PHASE_READ";
if (phase == PHASE_READs) return "PHASE_READs";
@ -339,7 +340,7 @@ std::string PhaseToString(Phase phase)
bool IsInSimulationConfigPhase(Phase phase)
{
return (phase >= PHASE_SETUPds && phase <= PHASE_SETUPss) || phase == PHASE_READs || phase == PHASE_WRITEs;
return (phase >= PHASE_SETUPds && phase <= PHASE_SETUPms) || phase == PHASE_READs || phase == PHASE_WRITEs;
}
bool IsPhaseWithWorld(Phase phase)
@ -3865,6 +3866,7 @@ void CRobotMain::ChangeColor()
m_phase != PHASE_SETUPps &&
m_phase != PHASE_SETUPcs &&
m_phase != PHASE_SETUPss &&
m_phase != PHASE_SETUPms &&
m_phase != PHASE_WIN &&
m_phase != PHASE_LOST &&
m_phase != PHASE_APPERANCE ) return;

View File

@ -67,6 +67,7 @@ enum Phase
PHASE_SETUPps,
PHASE_SETUPcs,
PHASE_SETUPss,
PHASE_SETUPms,
PHASE_WRITEs,
PHASE_READ,
PHASE_READs,

View File

@ -107,6 +107,7 @@ bool CMainDialog::EventProcess(const Event &event)
if ( CScreenSetup::GetTab() == PHASE_SETUPp ) m_main->ChangePhase(PHASE_SETUPps);
if ( CScreenSetup::GetTab() == PHASE_SETUPc ) m_main->ChangePhase(PHASE_SETUPcs);
if ( CScreenSetup::GetTab() == PHASE_SETUPs ) m_main->ChangePhase(PHASE_SETUPss);
if ( CScreenSetup::GetTab() == PHASE_SETUPm ) m_main->ChangePhase(PHASE_SETUPss);
}
if ( pressedButton == EVENT_INTERFACE_WRITE )

View File

@ -192,7 +192,7 @@ void CMainUserInterface::ChangePhase(Phase phase)
screenSetup->SetActive();
m_currentScreen = screenSetup;
}
if (m_phase >= PHASE_SETUPds && m_phase <= PHASE_SETUPss)
if (m_phase >= PHASE_SETUPds && m_phase <= PHASE_SETUPms)
{
CScreenSetup* screenSetup = GetSetupScreen(static_cast<Phase>(m_phase - PHASE_SETUPds + PHASE_SETUPd));
screenSetup->SetInSimulation(true);

View File

@ -240,7 +240,6 @@ bool CScreenSetup::EventProcess(const Event &event)
return false;
case EVENT_INTERFACE_SETUPm:
m_main->ChangePhase(PHASE_SETUPm);
return false;
default: