From b4e5327c24fe1a18a6f9c74cea870b1c17259060 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 7 Apr 2011 23:56:39 +0000 Subject: [PATCH] - fix for supporting custom credits in about screen --- source/glest_game/menu/menu_state_about.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/glest_game/menu/menu_state_about.cpp b/source/glest_game/menu/menu_state_about.cpp index 54a351aa..4b4a1a44 100644 --- a/source/glest_game/menu/menu_state_about.cpp +++ b/source/glest_game/menu/menu_state_about.cpp @@ -47,7 +47,7 @@ MenuStateAbout::MenuStateAbout(Program *program, MainMenu *mainMenu) : labelAdditionalCredits.init(500, 700); labelAdditionalCredits.setText(additionalCredits); - if(additionalCredits == NULL){ + if(additionalCredits == ""){ for(int i= 0; i < aboutStringCount1; ++i){ labelAbout1[i].registerGraphicComponent(containerName, "labelAbout1" + intToStr(i)); labelAbout1[i].init(100, 750 - i * 20); @@ -103,14 +103,16 @@ string MenuStateAbout::loadAdditionalCredits(){ } string result= ""; const string dir= data_path + "data/core/menu/credits.txt"; - ifstream file(dir.c_str()); - std::string buffer; - while(!file.eof()){ - getline(file, buffer); - result+= buffer + "\n"; + if(fileExists(dir) == true) { + ifstream file(dir.c_str()); + std::string buffer; + while(!file.eof()){ + getline(file, buffer); + result+= buffer + "\n"; + } + std::cout << buffer << std::endl; + file.close(); } - std::cout << buffer << std::endl; - file.close(); return result; }