1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* redone ZELP.TXT handling. Now VCMI should handle all language versions of that file.

This commit is contained in:
Michał W. Urbańczyk 2008-02-06 05:12:59 +00:00
parent 2e0dacd65a
commit f0db8760c2
6 changed files with 49 additions and 647 deletions

View File

@ -177,7 +177,7 @@ void CTownList<T>::mouseMoved (SDL_MouseMotionEvent & sEvent)
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if (from>0)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advTListUp.first);
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[306].first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
@ -185,7 +185,7 @@ void CTownList<T>::mouseMoved (SDL_MouseMotionEvent & sEvent)
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if ((items.size()-from) > SIZE)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advTListDown.first);
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[307].first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
@ -273,17 +273,17 @@ void CTownList<T>::clickRight(tribool down)
/***************************ARROWS*****************************************/
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[306].second,down,this);
}
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListDown.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[307].second,down,this);
}
}
else
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advTListDown.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[306].second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[307].second,down,this);
}
}
template<typename T>

View File

@ -32,8 +32,8 @@ CAdvMapInt::~CAdvMapInt()
}
CMinimap::CMinimap(bool draw)
{
statusbarTxt = CGI->preth->advWorldMap.first;
rcText = CGI->preth->advWorldMap.second;
statusbarTxt = CGI->preth->zelp[291].first;
rcText = CGI->preth->zelp[291].second;
pos.x=630;
pos.y=26;
pos.h=pos.w=144;
@ -778,34 +778,34 @@ void CInfoBar::tick()
CAdvMapInt::CAdvMapInt(int Player)
:player(Player),
statusbar(7,556),
kingOverview(CGI->preth->advKingdomOverview.first,CGI->preth->advKingdomOverview.second,
kingOverview(CGI->preth->zelp[293].first,CGI->preth->zelp[293].second,
&CAdvMapInt::fshowOverview, 679, 196, "IAM002.DEF", this),
underground(CGI->preth->advSurfaceSwitch.first,CGI->preth->advSurfaceSwitch.second,
underground(CGI->preth->zelp[294].first,CGI->preth->zelp[294].second,
&CAdvMapInt::fswitchLevel, 711, 196, "IAM010.DEF", this, false, new std::vector<std::string>(1,std::string("IAM003.DEF"))),
questlog(CGI->preth->advQuestlog.first,CGI->preth->advQuestlog.second,
questlog(CGI->preth->zelp[295].first,CGI->preth->zelp[295].second,
&CAdvMapInt::fshowQuestlog, 679, 228, "IAM004.DEF", this),
sleepWake(CGI->preth->advSleepWake.first,CGI->preth->advSleepWake.second,
sleepWake(CGI->preth->zelp[296].first,CGI->preth->zelp[296].second,
&CAdvMapInt::fsleepWake, 711, 228, "IAM005.DEF", this),
moveHero(CGI->preth->advMoveHero.first,CGI->preth->advMoveHero.second,
moveHero(CGI->preth->zelp[297].first,CGI->preth->zelp[297].second,
&CAdvMapInt::fmoveHero, 679, 260, "IAM006.DEF", this),
spellbook(CGI->preth->advCastSpell.first,CGI->preth->advCastSpell.second,
spellbook(CGI->preth->zelp[298].first,CGI->preth->zelp[298].second,
&CAdvMapInt::fshowSpellbok, 711, 260, "IAM007.DEF", this),
advOptions(CGI->preth->advAdvOptions.first,CGI->preth->advAdvOptions.second,
advOptions(CGI->preth->zelp[299].first,CGI->preth->zelp[299].second,
&CAdvMapInt::fadventureOPtions, 679, 292, "IAM008.DEF", this),
sysOptions(CGI->preth->advSystemOptions.first,CGI->preth->advSystemOptions.second,
sysOptions(CGI->preth->zelp[300].first,CGI->preth->zelp[300].second,
&CAdvMapInt::fsystemOptions, 711, 292, "IAM009.DEF", this),
nextHero(CGI->preth->advNextHero.first,CGI->preth->advNextHero.second,
nextHero(CGI->preth->zelp[301].first,CGI->preth->zelp[301].second,
&CAdvMapInt::fnextHero, 679, 324, "IAM000.DEF", this),
endTurn(CGI->preth->advEndTurn.first,CGI->preth->advEndTurn.second,
endTurn(CGI->preth->zelp[302].first,CGI->preth->zelp[302].second,
&CAdvMapInt::fendTurn, 679, 356, "IAM001.DEF", this),
townList(5,&genRect(192,48,747,196),747,196,747,372)

View File

@ -2108,7 +2108,7 @@ void CHeroList::mouseMoved (SDL_MouseMotionEvent & sEvent)
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if (from>0)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advHListUp.first);
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[303].first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
@ -2116,7 +2116,7 @@ void CHeroList::mouseMoved (SDL_MouseMotionEvent & sEvent)
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
{
if ((items.size()-from) > 5)
LOCPLINT->adventureInt->statusbar.print(CGI->preth->advHListDown.first);
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[304].first);
else
LOCPLINT->adventureInt->statusbar.clear();
return;
@ -2144,17 +2144,17 @@ void CHeroList::clickRight(tribool down)
/***************************ARROWS*****************************************/
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[303].second,down,this);
}
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListDown.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[304].second,down,this);
}
}
else
{
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListUp.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->advHListDown.second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[303].second,down,this);
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[304].second,down,this);
}
}
void CHeroList::hover (bool on)

Binary file not shown.

View File

@ -2,6 +2,8 @@
#include "CPreGameTextHandler.h"
#include "../CGameInfo.h"
#include "CLodHandler.h"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
std::string CPreGameTextHandler::getTitle(std::string text)
{
std::string ret;
@ -23,586 +25,32 @@ std::string CPreGameTextHandler::getDescr(std::string text)
}
void CPreGameTextHandler::loadTexts()
{
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("ZELP.TXT");
int i=0; //buf iterator
int hmcr=0;
for(i; i<buf.length(); ++i)
std::string buf1 = CGameInfo::mainObj->bitmaph->getTextFile("ZELP.TXT");
int itr=0, eol=-1, eolnext=-1, pom;
eolnext = buf1.find_first_of('\r',itr);
while(itr<buf1.size())
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==3)
eol = eolnext; //end of this line
eolnext = buf1.find_first_of('\r',eol+1); //end of the next line
pom=buf1.find_first_of('\t',itr); //upcoming tab
if(eol<0 || pom<0)
break;
}
i+=3;
int befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
mainNewGame = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
mainLoadGame = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
mainHighScores = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
mainCredits = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
mainQuit = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==3)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
ngSingleScenario = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
ngCampain = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
ngMultiplayer = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
ngTutorial = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==1)
break;
}
i+=3;
befi=i;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\t')
break;
}
ngBack = buf.substr(befi, i-befi);
++i;
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==4)
break;
}
i+=2;
loadToIt(singleChooseScenario, buf, i);
loadToIt(singleSetAdvOptions, buf, i);
loadToIt(singleRandomMap, buf, i);
loadToIt(singleScenarioName, buf, i);
loadToIt(singleDescriptionTitle, buf, i);
loadToIt(singleDescriptionText, buf, i);
loadToIt(singleEasy, buf, i);
loadToIt(singleNormal, buf, i);
loadToIt(singleHard, buf, i);
loadToIt(singleExpert, buf, i);
loadToIt(singleImpossible, buf, i);
loadToIt(singleAllyFlag[0], buf, i);
loadToIt(singleAllyFlag[1], buf, i);
loadToIt(singleAllyFlag[2], buf, i);
loadToIt(singleAllyFlag[3], buf, i, 1);
loadToIt(singleAllyFlag[4], buf, i, 1);
loadToIt(singleAllyFlag[5], buf, i, 1);
loadToIt(singleAllyFlag[6], buf, i, 1);
loadToIt(singleAllyFlag[7], buf, i, 1);
loadToIt(singleEnemyFlag[0], buf, i, 1);
loadToIt(singleEnemyFlag[1], buf, i, 1);
loadToIt(singleEnemyFlag[2], buf, i, 1);
loadToIt(singleEnemyFlag[3], buf, i, 1);
loadToIt(singleEnemyFlag[4], buf, i, 1);
loadToIt(singleEnemyFlag[5], buf, i, 1);
loadToIt(singleEnemyFlag[6], buf, i, 1);
loadToIt(singleEnemyFlag[7], buf, i, 1);
loadToIt(singleViewHideScenarioList, buf, i, 1);
loadToIt(singleViewHideAdvOptions, buf, i, 1);
loadToIt(singlePlayRandom, buf, i, 1);
loadToIt(singleChatDesc, buf, i, 1);
loadToIt(singleMapDifficulty, buf, i, 1);
loadToIt(singleRating, buf, i, 1);
loadToIt(singleMapPossibleDifficulties, buf, i, 1);
loadToIt(singleVicCon, buf, i, 1);
loadToIt(singleLossCon, buf, i, 1);
loadToIt(singleSFilter, buf, i, 1);
loadToIt(singleMFilter, buf, i, 1);
loadToIt(singleLFilter, buf, i, 1);
loadToIt(singleXLFilter, buf, i, 1);
loadToIt(singleAllFilter, buf, i, 1);
for(int vv=0; vv<18; ++vv)
{
loadToIt(singleScenarioNameNr[vv], buf, i, 1);
}
for(int vv=0; vv<18; ++vv)
{
loadToIt(singleEntryScenarioNameNr[vv], buf, i, 1);
}
std::string ff = singleEntryScenarioNameNr[4];
loadToIt(singleTurnDuration, buf, i, 1);
loadToIt(singleChatText, buf, i, 0);
loadToIt(singleChatEntry, buf, i, 0);
loadToIt(singleChatPlug, buf, i, 0);
loadToIt(singleChatPlayer, buf, i, 0);
loadToIt(singleChatPlayerSlider, buf, i, 0);
loadToIt(singleRollover, buf, i, 0);
loadToIt(singleNext, buf, i, 0);
loadToIt(singleBegin, buf, i, 0);
loadToIt(singleBack, buf, i, 0);
loadToIt(singleSSExit, buf, i, 0);
loadToIt(singleWhichMap, buf, i, 0);
loadToIt(singleSortNumber, buf, i, 0);
loadToIt(singleSortSize, buf, i, 0);
loadToIt(singleSortVersion, buf, i, 0);
loadToIt(singleSortAlpha, buf, i, 0);
loadToIt(singleSortVictory, buf, i, 0);
loadToIt(singleSortLoss, buf, i, 1);
loadToIt(singleBriefing, buf, i, 1);
loadToIt(singleSSHero, buf, i, 1);
loadToIt(singleGoldpic, buf, i, 1);
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleHumanCPU[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleHandicap[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleTownLeft[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleTownRite[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleHeroLeft[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleHeroRite[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleResLeft[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleResRite[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleHeroSetting[vv], buf, i, 1);
}
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleTownSetting[vv], buf, i, 1);
}
loadToIt(singleConstCreateMap, buf, i, 1);
loadToIt(singleConstMapSizeLabel, buf, i, 1);
loadToIt(singleConstSmallMap, buf, i, 1);
loadToIt(singleConstMediumMap, buf, i, 1);
loadToIt(singleConstLargeMap, buf, i, 1);
loadToIt(singleConstHugeMap, buf, i, 1);
loadToIt(singleConstMapLevels, buf, i, 1);
loadToIt(singleConstHumanPositionsLabel, buf, i, 1);
for(int vv=0; vv<8; ++vv)
{
loadToIt(singleConstNHumans[vv], buf, i, 1);
}
loadToIt(singleConstRandomHumans, buf, i, 1);
loadToIt(singleConstHumanTeamsLabel, buf, i, 1);
loadToIt(singleConstNoHumanTeams, buf, i, 1);
for(int vv=0; vv<7; ++vv)
{
loadToIt(singleConstNHumanTeams[vv], buf, i, 1);
}
loadToIt(singleConstRandomHumanTeams, buf, i, 1);
loadToIt(singleConstComputerPositionsLabel, buf, i, 1);
loadToIt(singleConstNoComputers, buf, i, 1);
for(int vv=0; vv<7; ++vv)
{
loadToIt(singleConstNComputers[vv], buf, i, 1);
}
loadToIt(singleConstRandomComputers, buf, i, 1);
loadToIt(singleConstComputerTeamsLabel, buf, i, 1);
loadToIt(singleConstNoComputerTeams, buf, i, 1);
for(int vv=0; vv<6; ++vv)
{
loadToIt(singleConstNComputerTeams[vv], buf, i, 1);
}
loadToIt(singleConstRandomComputerTeams, buf, i, 1);
loadToIt(singleConstWaterLabel, buf, i, 1);
loadToIt(singleConstNoWater, buf, i, 1);
loadToIt(singleConstNormalWater, buf, i, 1);
loadToIt(singleConstIslands, buf, i, 1);
loadToIt(singleConstRandomWater, buf, i, 1);
loadToIt(singleConstMonsterStrengthLabel, buf, i, 1);
loadToIt(singleConstWeakMonsters, buf, i, 1);
loadToIt(singleConstNormalMonsters, buf, i, 1);
loadToIt(singleConstStrongMonsters, buf, i, 1);
loadToIt(singleConstRandomMonsters, buf, i, 1);
loadToIt(singleConstShowSavedRandomMaps, buf, i, 1);
loadToIt(singleSliderChatWindow, buf, i, 1);
loadToIt(singleSliderFileMenu, buf, i, 1);
loadToIt(singleSliderDuration, buf, i, 1);
loadToIt(singlePlayerHandicapHeaderID, buf, i, 0);
loadToIt(singleTurnDurationHeaderID, buf, i, 0);
loadToIt(singleStartingTownHeaderID, buf, i, 0);
loadToIt(singleStartingTownHeaderWConfluxID, buf, i, 0);
loadToIt(singleStartingHeroHeaderID, buf, i, 0);
loadToIt(singleStartingBonusHeaderID, buf, i, 0);
hmcr = 0;
for(i; i<buf.length(); ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==3)
break;
}
i+=2;
loadToIt(multiOnlineService, buf, i, 0);
loadToIt(multiHotSeat, buf, i, 0);
loadToIt(multiIPX, buf, i, 0);
loadToIt(multiTCPIP, buf, i, 0);
loadToIt(multiModem, buf, i, 0);
loadToIt(multiDirectConnection, buf, i, 0);
loadToIt(multiHostGame, buf, i, 0);
loadToIt(multiJoinGame, buf, i, 1);
loadToIt(multiSearchGame, buf, i, 1);
for(int vv=0; vv<12; ++vv)
{
loadToIt(multiGameNo[vv], buf, i, 1);
}
loadToIt(multiScrollGames, buf, i, 1);
std::string dump;
loadToIt(dump, buf, i, 1);
loadToIt(multiCancel, buf, i, 0);
loadToIt(dump, buf, i, 0);
loadToIt(dump, buf, i, 4);
loadToIt(dump, buf, i, 2);
loadToIt(advWorldMap.first, buf, i, 4);
loadToIt(advWorldMap.second, buf, i, 2);
loadToIt(advStatusWindow1.first, buf, i, 4);
loadToIt(advStatusWindow1.second, buf, i, 2);
loadToIt(advKingdomOverview.first, buf, i, 4);
loadToIt(advKingdomOverview.second, buf, i, 2);
loadToIt(advSurfaceSwitch.first, buf, i, 4);
loadToIt(advSurfaceSwitch.second, buf, i, 2);
loadToIt(advQuestlog.first, buf, i, 4);
loadToIt(advQuestlog.second, buf, i, 2);
loadToIt(advSleepWake.first, buf, i, 4);
loadToIt(advSleepWake.second, buf, i, 2);
loadToIt(advMoveHero.first, buf, i, 4);
loadToIt(advMoveHero.second, buf, i, 2);
loadToIt(advCastSpell.first, buf, i, 4);
loadToIt(advCastSpell.second, buf, i, 2);
loadToIt(advAdvOptions.first, buf, i, 4);
loadToIt(advAdvOptions.second, buf, i, 2);
loadToIt(advSystemOptions.first, buf, i, 4);
loadToIt(advSystemOptions.second, buf, i, 2);
loadToIt(advNextHero.first, buf, i, 4);
loadToIt(advNextHero.second, buf, i, 2);
loadToIt(advEndTurn.first, buf, i, 4);
loadToIt(advEndTurn.second, buf, i, 2);
loadToIt(advHListUp.first, buf, i, 4);
loadToIt(advHListUp.second, buf, i, 2);
loadToIt(advHListDown.first, buf, i, 4);
loadToIt(advHListDown.second, buf, i, 2);
loadToIt(advHPortrait.first, buf, i, 4);
loadToIt(advHPortrait.second, buf, i, 2);
loadToIt(advTListUp.first, buf, i, 4);
loadToIt(advTListUp.second, buf, i, 2);
loadToIt(advTListDown.first, buf, i, 4);
loadToIt(advTListDown.second, buf, i, 2);
loadToIt(advTPortrait.first, buf, i, 4);
loadToIt(advTPortrait.second, buf, i, 2);
loadToIt(advRGold.first, buf, i, 4);
loadToIt(advRGold.second, buf, i, 2);
loadToIt(advRWood.first, buf, i, 4);
loadToIt(advRWood.second, buf, i, 2);
loadToIt(advRMercury.first, buf, i, 4);
loadToIt(advRMercury.second, buf, i, 2);
loadToIt(advROre.first, buf, i, 4);
loadToIt(advROre.second, buf, i, 2);
loadToIt(advRSulfur.first, buf, i, 4);
loadToIt(advRSulfur.second, buf, i, 2);
loadToIt(advRCrystal.first, buf, i, 4);
loadToIt(advRCrystal.second, buf, i, 2);
loadToIt(advRGems.first, buf, i, 4);
loadToIt(advRGems.second, buf, i, 2);
loadToIt(advDate.first, buf, i, 4);
loadToIt(advDate.second, buf, i, 2);
loadLossConditions();
loadVictoryConditions();
}
void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &iter, int mode)
{
switch(mode)
{
case 0:
if(pom>eol) //in current line there is not tab
zelp.push_back(std::pair<std::string,std::string>());
else
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
++iter;
hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
++hmcr;
if(hmcr==1)
break;
}
iter+=2;
break;
}
case 1:
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
break;
}
dest = src.substr(befi, iter-befi);
iter+=2;
break;
}
case 2:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
++iter;
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
++hmcr;
if(hmcr==1)
break;
}
iter+=2;
break;
}
case 3:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
break;
}
dest = src.substr(befi, iter-befi);
iter+=2;
break;
}
case 4:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
iter++;
break;
zelp.push_back
(std::pair<std::string,std::string>
(buf1.substr(itr,pom-itr),
buf1.substr(pom+1,eol-pom-1)));
boost::algorithm::replace_all(zelp[zelp.size()-1].first,"\t","");
boost::algorithm::replace_all(zelp[zelp.size()-1].second,"\t","");
}
itr=eol+2;
}
//loadLossConditions();
//loadVictoryConditions(); //moved to loadTexts
}
void CPreGameTextHandler::loadVictoryConditions()
{
//std::ifstream inp("H3bitmap.lod\\VCDESC.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;
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("VCDESC.TXT");
int andame = buf.size();
int i=0; //buf iterator
for(int gg=0; gg<14; ++gg)
{
int befi=i;
@ -614,23 +62,9 @@ void CPreGameTextHandler::loadVictoryConditions()
victoryConditions[gg] = buf.substr(befi, i-befi);
i+=2;
}
}
void CPreGameTextHandler::loadLossConditions()
{
//std::ifstream inp("H3bitmap.lod\\LCDESC.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;
std::string buf = CGameInfo::mainObj->bitmaph->getTextFile("LCDESC.TXT");
int andame = buf.size();
int i=0; //buf iterator
buf = CGameInfo::mainObj->bitmaph->getTextFile("LCDESC.TXT");
andame = buf.size();
i=0; //buf iterator
for(int gg=0; gg<4; ++gg)
{
int befi=i;
@ -642,4 +76,4 @@ void CPreGameTextHandler::loadLossConditions()
lossCondtions[gg] = buf.substr(befi, i-befi);
i+=2;
}
}
}

View File

@ -6,47 +6,15 @@
class CPreGameTextHandler //handles pre - game texts
{
public:
std::string mainNewGame, mainLoadGame, mainHighScores, mainCredits, mainQuit; //right - click texts in main menu
std::string ngSingleScenario, ngCampain, ngMultiplayer, ngTutorial, ngBack; //right - click texts in new game menu
std::string singleChooseScenario, singleSetAdvOptions, singleRandomMap, singleScenarioName, singleDescriptionTitle, singleDescriptionText, singleEasy, singleNormal, singleHard, singleExpert, singleImpossible; //main single scenario texts
std::string singleAllyFlag[8], singleEnemyFlag[8];
std::string singleViewHideScenarioList, singleViewHideAdvOptions, singlePlayRandom, singleChatDesc, singleMapDifficulty, singleRating, singleMapPossibleDifficulties, singleVicCon, singleLossCon;
std::string singleSFilter, singleMFilter, singleLFilter, singleXLFilter, singleAllFilter;
std::string singleScenarioNameNr[18], singleEntryScenarioNameNr[18];
std::string singleTurnDuration, singleChatText, singleChatEntry, singleChatPlug, singleChatPlayer, singleChatPlayerSlider, singleRollover, singleNext, singleBegin, singleBack, singleSSExit, singleWhichMap, singleSortNumber, singleSortSize, singleSortVersion, singleSortAlpha, singleSortVictory, singleSortLoss, singleBriefing, singleSSHero, singleGoldpic;
std::string singleHumanCPU[8], singleHandicap[8], singleTownLeft[8], singleTownRite[8], singleHeroLeft[8], singleHeroRite[8], singleResLeft[8], singleResRite[8], singleHeroSetting[8], singleTownSetting[8];
std::string singleConstCreateMap, singleConstMapSizeLabel, singleConstSmallMap, singleConstMediumMap, singleConstLargeMap, singleConstHugeMap, singleConstMapLevels, singleConstHumanPositionsLabel;
std::string singleConstNHumans[8];
std::string singleConstRandomHumans, singleConstHumanTeamsLabel, singleConstNoHumanTeams;
std::string singleConstNHumanTeams[7];
std::string singleConstRandomHumanTeams, singleConstComputerPositionsLabel, singleConstNoComputers;
std::string singleConstNComputers[7];
std::string singleConstRandomComputers, singleConstComputerTeamsLabel, singleConstNoComputerTeams;
std::string singleConstNComputerTeams[6];
std::string singleConstRandomComputerTeams, singleConstWaterLabel, singleConstNoWater, singleConstNormalWater, singleConstIslands, singleConstRandomWater, singleConstMonsterStrengthLabel, singleConstWeakMonsters, singleConstNormalMonsters, singleConstStrongMonsters, singleConstRandomMonsters, singleConstShowSavedRandomMaps, singleSliderChatWindow, singleSliderFileMenu, singleSliderDuration;
std::string singlePlayerHandicapHeaderID, singleTurnDurationHeaderID, singleStartingTownHeaderID, singleStartingTownHeaderWConfluxID, singleStartingHeroHeaderID, singleStartingBonusHeaderID;
std::string multiOnlineService, multiHotSeat, multiIPX, multiTCPIP, multiModem, multiDirectConnection, multiHostGame, multiJoinGame, multiSearchGame;
std::string multiGameNo [12];
std::string multiScrollGames, multiCancel;
std::vector<std::pair<std::string,std::string> > zelp;
std::string lossCondtions[4];
std::string victoryConditions[14];
std::string getTitle(std::string text);
std::string getDescr(std::string text);
std::pair<std::string, std::string> //first is statusbar text, second right-click help; they're all for adventure map interface
advKingdomOverview, advSurfaceSwitch, advQuestlog, advSleepWake, advMoveHero, advCastSpell, advAdvOptions, advSystemOptions, advNextHero, advEndTurn, advHListUp, advHListDown, advHPortrait, advTListUp, advTListDown, advTPortrait, //buttons
advRGold, advRWood, advRMercury, advROre, advRSulfur, advRCrystal, advRGems, //resources
advDate, advWorldMap, advStatusWindow1;
void loadTexts();
static 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 //mode 4 - copy to tab
void loadVictoryConditions();
void loadLossConditions();
};