diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index ce4a4755..e85da20c 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -2706,13 +2706,13 @@ void Renderer::renderSelectionQuad() { Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) { if(font == NULL) { //abort(); - throw megaglest_runtime_error("font == NULL (1)"); + throw megaglest_runtime_error("font == NULL (1) text = " + text); } const Metrics &metrics= Metrics::getInstance(); FontMetrics *fontMetrics= font->getMetrics(); if(fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL (1)"); + throw megaglest_runtime_error("fontMetrics == NULL (1) text = " + text); } int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast(fontMetrics->getTextWidth(text)/2.f) : 5); @@ -2729,13 +2729,13 @@ Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) { Vec2i computeCenteredPos(const string &text, Font3D *font, int x, int y) { if(font == NULL) { - throw megaglest_runtime_error("font == NULL (2)"); + throw megaglest_runtime_error("font == NULL (2) text = " + text); } const Metrics &metrics= Metrics::getInstance(); FontMetrics *fontMetrics= font->getMetrics(); if(fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL (2)"); + throw megaglest_runtime_error("fontMetrics == NULL (2) text = " + text); } int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast(fontMetrics->getTextWidth(text) / 2.f) : 5); @@ -2861,10 +2861,10 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i if(centeredW == true) { if(font == NULL) { //abort(); - throw megaglest_runtime_error("font == NULL (5)"); + throw megaglest_runtime_error("font == NULL (5) text = " + text); } else if(font->getTextHandler() == NULL) { - throw megaglest_runtime_error("font->getTextHandler() == NULL (5)"); + throw megaglest_runtime_error("font->getTextHandler() == NULL (5) text = " + text); } float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * ::Shared::Graphics::Font::scaleFontValue); @@ -2875,10 +2875,10 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i if(centeredH) { if(font == NULL) { - throw megaglest_runtime_error("font == NULL (6)"); + throw megaglest_runtime_error("font == NULL (6) text = " + text); } else if(font->getTextHandler() == NULL) { - throw megaglest_runtime_error("font->getTextHandler() == NULL (6)"); + throw megaglest_runtime_error("font->getTextHandler() == NULL (6) text = " + text); } //const Metrics &metrics= Metrics::getInstance(); @@ -3080,7 +3080,7 @@ void Renderer::renderTextShadow3D(const string &text, Font3D *font,const Vec4f & } if(font == NULL) { - throw megaglest_runtime_error("font == NULL (3)"); + throw megaglest_runtime_error("font == NULL (3) text = " + text); } glPushAttrib(GL_CURRENT_BIT); @@ -3108,7 +3108,7 @@ void Renderer::renderTextShadow(const string &text, Font2D *font,const Vec4f &co } if(font == NULL) { - throw megaglest_runtime_error("font == NULL (4)"); + throw megaglest_runtime_error("font == NULL (4) text = " + text); } glPushAttrib(GL_CURRENT_BIT); diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index 63bd276f..d784b29a 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -165,6 +165,15 @@ Object *Gui::getHighlightedResourceObject() const{ return NULL; } else { + if(world == NULL) { + throw megaglest_runtime_error("world == NULL"); + } + if(world->getMap() == NULL) { + throw megaglest_runtime_error("world->getMap() == NULL"); + } + if(world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL) { + throw megaglest_runtime_error("world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL"); + } return world->getMap()->getSurfaceCell(highlightedResourceObjectPos)->getObject(); } } diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 04df2afb..9cb4fd2c 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -4914,6 +4914,7 @@ void MenuStateCustomGame::processScenario() { setupTechList("", false); reloadFactions(false,""); setupTilesetList(""); + updateControlers(); } SetupUIForScenarios(); }