From fa6ccb030d3a2e714e4c95c3c02bb6d97fb2b8cb Mon Sep 17 00:00:00 2001 From: mateuszb Date: Sun, 8 Jul 2007 17:28:08 +0000 Subject: [PATCH] =?UTF-8?q?obs=C5=82uga=20dodatkowych=20tekst=C3=B3w=20i?= =?UTF-8?q?=20ma=C5=82a=20poprawka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CGameInfo.h | 2 + CGeneralTextHandler.cpp | 173 ++++++++++++++++++++++++++++++++++++++++ CGeneralTextHandler.h | 20 +++++ CMT.cpp | 3 + CPreGameTextHandler.cpp | 6 +- 5 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 CGeneralTextHandler.cpp create mode 100644 CGeneralTextHandler.h diff --git a/CGameInfo.h b/CGameInfo.h index 56e00c9e5..1eaa93a37 100644 --- a/CGameInfo.h +++ b/CGameInfo.h @@ -13,6 +13,7 @@ #include "CSemiLodHandler.h" #include "CDefObjInfoHandler.h" #include "CLodHandler.h" +#include "CGeneralTextHandler.h" /* CGameInfo class @@ -35,6 +36,7 @@ public: CDefObjInfoHandler * dobjinfo; CLodHandler * spriteh; CLodHandler * bitmaph; + CGeneralTextHandler * generaltexth; }; #endif //CGAMEINFO_H \ No newline at end of file diff --git a/CGeneralTextHandler.cpp b/CGeneralTextHandler.cpp new file mode 100644 index 000000000..f5510fcef --- /dev/null +++ b/CGeneralTextHandler.cpp @@ -0,0 +1,173 @@ +#include "CGeneralTextHandler.h" +#include + +void CGeneralTextHandler::load() +{ + std::ifstream inp("H3bitmap.lod\\GENRLTXT.TXT", std::ios::in|std::ios::binary); + inp.seekg(0,std::ios::end); // na koniec + int andame = inp.tellg(); // read length + inp.seekg(0,std::ios::beg); // wracamy na poczatek + char * bufor = new char[andame]; // allocate memory + inp.read((char*)bufor, andame); // read map file to buffer + inp.close(); + std::string buf = std::string(bufor); + delete [andame] bufor; + int i=0; //buf iterator + for(i; i + +class CGeneralTextHandler +{ +public: + std::string cantAddManager, experienceLimitScenarioReached, heroExperienceInfo, perDay, or, somethingVanquished, lastTownLostInfo, heroesAbandonedYou, heroesAbandonedHim; + std::string couldNotSaveGame, errorOpeningFile, newgameUppercase, sureToDismissArmy, playersTurn, errorReceivingDataKeepTrying, somethingTheSomething, recruit, noRoomInGarrision, numberOFAdventuringHeroes, heroWithoutCreatures; + std::string videoQuality, itemCantBeTraded, sureDismissHero, selectSpellTarget, invalidTeleportDestination, teleportHere, castSomething, castSomethingOnSomething, sureRetreat, notEnoughGold, capturedEnemyArtifact, none; + std::string surrenderProposal, highMoraleNextAttack, lowMoraleFreeze, makeRoomInArmyForSomething, attackSomethingSomethingDamage, shootSomethingOneShootLeftSomethingDamage; + std::string campaignDescription, somethingIsActive, sessionName, userName, creature, creatures, badLuckOnSomething, goodLuckOnSomething, treasure, somethingSomethingsUnderAttack, town, hero, townScreen, cannotBuildBoat, requires, systemUppercase; + + void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, dest to tab, dump to eol //mode 1 - dump to tab, src to eol //mode 2 - copy to tab, dump to eol //mode 3 - copy to eol + void load(); +}; + + +#endif //CGENERALTEXTHANDLER_H \ No newline at end of file diff --git a/CMT.cpp b/CMT.cpp index 22244b5bd..618635c56 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -33,6 +33,7 @@ #include "mapHandler.h" #include "global.h" #include "CPreGame.h" +#include "CGeneralTextHandler.h" #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) # include @@ -304,6 +305,8 @@ int _tmain(int argc, _TCHAR* argv[]) CObjectHandler * objh = new CObjectHandler; objh->loadObjects(); cgi->objh = objh; + cgi->generaltexth = new CGeneralTextHandler; + cgi->generaltexth->load(); cgi->dobjinfo = new CDefObjInfoHandler; cgi->dobjinfo->load(); cgi->spriteh = new CLodHandler; diff --git a/CPreGameTextHandler.cpp b/CPreGameTextHandler.cpp index a1a1f99d0..e18497eba 100644 --- a/CPreGameTextHandler.cpp +++ b/CPreGameTextHandler.cpp @@ -424,6 +424,8 @@ void CPreGameTextHandler::loadTexts() std::string dump; loadToIt(dump, buf, i, 1); loadToIt(multiCancel, buf, i, 0); + loadLossConditions(); + loadVictoryConditions(); } void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &iter, int mode) @@ -484,8 +486,8 @@ void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &ite iter+=2; } } - loadLossConditions(); - loadVictoryConditions(); + //loadLossConditions(); + //loadVictoryConditions(); //moved to loadTexts } void CPreGameTextHandler::loadVictoryConditions()