bugfix unpausing crashes

This commit is contained in:
devZoGok
2026-03-15 15:21:11 +02:00
parent 3df38f8eda
commit adc5f329f0
4 changed files with 8 additions and 8 deletions
+3 -2
View File
@@ -478,14 +478,15 @@ namespace battleship{
void ActiveGameState::renderUnits() {
vector<Unit*> friendlyUnits = mainPlayer->getFriendlyUnits();
Game *game = Game::getSingleton();
for (Player *p : Game::getSingleton()->getPlayers(true)){
for (Player *p : game->getPlayers(true)){
vector<Unit*> units = p->getUnits();
for (Unit *u : units) {
if(u->isVehicle() && ((Vehicle*)u)->getGarrisonable()) continue;
bool unitVisible = mainPlayer->isObjectVisible((GameObject*)u, friendlyUnits);
bool unitVisible = (game->isDebug() || mainPlayer->isObjectVisible((GameObject*)u, friendlyUnits));
u->getModel()->setVisible(unitVisible);
}
}
+2 -3
View File
@@ -75,15 +75,14 @@ namespace battleship{
FxManager::getSingleton()->update();
}
void Game::initLuaPlayers(bool resetBehaviour){
void Game::initLuaPlayers(){
sol::state_view SOL_LUA_VIEW = generateView();
vector<Player*> cpuPlayers = getCpuPlayers();
for(int i = 0; i < cpuPlayers.size(); i++)
SOL_LUA_VIEW["game"]["cpuPlayers"][i + 1] = cpuPlayers[i];
if(resetBehaviour)
SOL_LUA_VIEW.script_file(GameManager::getSingleton()->getPath() + "Scripts/Core/playerInit.lua");
SOL_LUA_VIEW.script_file(GameManager::getSingleton()->getPath() + "Scripts/Core/playerInit.lua");
}
void Game::removeAllElements(){
+1 -1
View File
@@ -20,7 +20,7 @@ namespace battleship{
public:
static Game* getSingleton();
void update();
void initLuaPlayers(bool = false);
void initLuaPlayers();
void togglePause();
void removeAllElements();
void initTechnologies();
+2 -2
View File
@@ -74,8 +74,8 @@ namespace battleship{
activeState = new ActiveGameState(guiState, playerId);
stateManager->attachAppState(activeState);
Game::getSingleton()->initLuaPlayers(true);
Map::Minimap::getSingleton()->updateImage();
Game::getSingleton()->initLuaPlayers();
//Map::Minimap::getSingleton()->updateImage();
}
void InGameAppState::onDettached() {