diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 8eadc485..2dff278f 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -6076,26 +6076,28 @@ void Renderer::renderUnitTitles3D(Font3D *font, Vec3f color) { for(int idx = 0; idx < visibleFrameUnitList.size(); idx++) { const Unit *unit = visibleFrameUnitList[idx]; - if(unit != NULL && unit->getVisible() == true) { - if(unit != NULL && unit->getCurrentUnitTitle() != "") { - //get the screen coordinates - Vec3f screenPos = unit->getScreenPos(); + if(unit != NULL) { + if(unit->getVisible() == true) { + if(unit != NULL && unit->getCurrentUnitTitle() != "") { + //get the screen coordinates + Vec3f screenPos = unit->getScreenPos(); #ifdef USE_STREFLOP - renderText3D(unit->getCurrentUnitTitle(), font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); + renderText3D(unit->getCurrentUnitTitle(), font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); #else - renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); + renderText3D(unit->getCurrentUnitTitle(), font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); #endif - unitRenderedList[unit->getId()] = true; - } - else { - string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]"; - Vec3f screenPos = unit->getScreenPos(); + unitRenderedList[unit->getId()] = true; + } + else { + string str = unit->getFullName() + " - " + intToStr(unit->getId()) + " [" + unit->getPos().getString() + "]"; + Vec3f screenPos = unit->getScreenPos(); #ifdef USE_STREFLOP - renderText3D(str, font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); + renderText3D(str, font, color, streflop::fabs(screenPos.x) + 5, streflop::fabs(screenPos.y) + 5, false); #else - renderText3D(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); + renderText3D(str, font, color, fabs(screenPos.x) + 5, fabs(screenPos.y) + 5, false); #endif + } } } } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index f18d615f..4844e5d5 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1100,7 +1100,7 @@ void MenuStateConnectedGame::update() { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pingCount = %d, clientInterface->getLastPingLag() = %f, GameConstants::networkPingInterval = %d\n",__FILE__,__FUNCTION__,__LINE__,pingCount, clientInterface->getLastPingLag(),GameConstants::networkPingInterval); // Starting checking timeout after sending at least 3 pings to server - if(clientInterface != NULL && clientInterface->isConnected() && + if(clientInterface->isConnected() && pingCount >= 3 && clientInterface->getLastPingLag() >= (GameConstants::networkPingInterval * 3)) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index de73ecc9..1aa11976 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -308,6 +308,8 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) { } } else{ + if(f) fclose(f); + throw runtime_error("Can't open file"); } fclose(f);