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

* Added RMG tab to pregame(disabled by default, activate with: enableRMG=true in settings.json) * Fixed tab intendation * Renamed colors to more comprehensible names

This commit is contained in:
beegee1 2012-11-11 12:23:31 +00:00
parent 0d863c83d7
commit c336abcf4a
37 changed files with 4303 additions and 3609 deletions

View File

@ -713,7 +713,7 @@ void CInfoBar::CVisibleInfo::loadDay()
else
labelText = CGI->generaltexth->allTexts[64] + " " + boost::lexical_cast<std::string>(LOCPLINT->cb->getDate(1));
forceRefresh.push_back(new CLabel(95, 31, FONT_MEDIUM, CENTER, Colors::Cornsilk, labelText));
forceRefresh.push_back(new CLabel(95, 31, FONT_MEDIUM, CENTER, Colors::WHITE, labelText));
}
void CInfoBar::CVisibleInfo::loadEnemyTurn(int player)
@ -763,8 +763,8 @@ void CInfoBar::CVisibleInfo::loadGameStatus()
//generate component
OBJ_CONSTRUCTION_CAPTURING_ALL;
new CPicture("ADSTATIN");
auto allyLabel = new CLabel(10, 106, FONT_SMALL, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[390] + ":");
auto enemyLabel = new CLabel(10, 136, FONT_SMALL, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[391] + ":");
auto allyLabel = new CLabel(10, 106, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[390] + ":");
auto enemyLabel = new CLabel(10, 136, FONT_SMALL, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[391] + ":");
int posx = allyLabel->pos.w + allyLabel->pos.x - pos.x + 4;
BOOST_FOREACH(int & player, allies)
@ -784,7 +784,7 @@ void CInfoBar::CVisibleInfo::loadGameStatus()
{
new CAnimImage("itmtl", i, 0, 6 + 42 * i , 11);
if (halls[i])
new CLabel( 26 + 42 * i, 64, FONT_SMALL, CENTER, Colors::Cornsilk, boost::lexical_cast<std::string>(halls[i]));
new CLabel( 26 + 42 * i, 64, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(halls[i]));
}
}
@ -799,7 +799,7 @@ void CInfoBar::CVisibleInfo::loadComponent(const Component & compToDisplay, std:
auto comp = new CComponent(compToDisplay);
comp->moveTo(Point(pos.x+47, pos.y+50));
new CTextBox(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, CENTER, Colors::Cornsilk);
new CTextBox(message, Rect(10, 4, 160, 50), 0, FONT_SMALL, CENTER, Colors::WHITE);
}
void CInfoBar::CVisibleInfo::updateEnemyTurn(double progress)

View File

@ -2270,7 +2270,7 @@ void CBattleInterface::showAliveStack(const CStack *stack, SDL_Surface * to)
creAnims[ID]->pos.x + xAdd + 15,
creAnims[ID]->pos.y + yAdd + 5,
FONT_TINY,
Colors::Cornsilk,
Colors::WHITE,
to
);
}

View File

@ -33,22 +33,22 @@ void CBattleConsole::showAll(SDL_Surface * to)
{
if(ingcAlter.size())
{
CSDL_Ext::printAtMiddleWB(ingcAlter, pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::Cornsilk, to);
CSDL_Ext::printAtMiddleWB(ingcAlter, pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::WHITE, to);
}
else if(alterTxt.size())
{
CSDL_Ext::printAtMiddleWB(alterTxt, pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::Cornsilk, to);
CSDL_Ext::printAtMiddleWB(alterTxt, pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::WHITE, to);
}
else if(texts.size())
{
if(texts.size()==1)
{
CSDL_Ext::printAtMiddleWB(texts[0], pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::Cornsilk, to);
CSDL_Ext::printAtMiddleWB(texts[0], pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::WHITE, to);
}
else
{
CSDL_Ext::printAtMiddleWB(texts[lastShown-1], pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::Cornsilk, to);
CSDL_Ext::printAtMiddleWB(texts[lastShown], pos.x + pos.w/2, pos.y + 27, FONT_SMALL, 80, Colors::Cornsilk, to);
CSDL_Ext::printAtMiddleWB(texts[lastShown-1], pos.x + pos.w/2, pos.y + 11, FONT_SMALL, 80, Colors::WHITE, to);
CSDL_Ext::printAtMiddleWB(texts[lastShown], pos.x + pos.w/2, pos.y + 27, FONT_SMALL, 80, Colors::WHITE, to);
}
}
}
@ -271,29 +271,29 @@ CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInt
exit->update();
//creating labels
labels.push_back(new CLabel(242, 32, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[392]));//window title
labels.push_back(new CLabel(122, 214, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[393]));//animation speed
labels.push_back(new CLabel(122, 293, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[394]));//music volume
labels.push_back(new CLabel(122, 359, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[395]));//effects' volume
labels.push_back(new CLabel(353, 66, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[396]));//auto - combat options
labels.push_back(new CLabel(353, 265, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[397]));//creature info
labels.push_back(new CLabel(242, 32, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[392]));//window title
labels.push_back(new CLabel(122, 214, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[393]));//animation speed
labels.push_back(new CLabel(122, 293, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[394]));//music volume
labels.push_back(new CLabel(122, 359, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[395]));//effects' volume
labels.push_back(new CLabel(353, 66, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[396]));//auto - combat options
labels.push_back(new CLabel(353, 265, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[397]));//creature info
//auto - combat options
labels.push_back(new CLabel(283, 86, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[398]));//creatures
labels.push_back(new CLabel(283, 116, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[399]));//spells
labels.push_back(new CLabel(283, 146, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[400]));//catapult
labels.push_back(new CLabel(283, 176, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[151]));//ballista
labels.push_back(new CLabel(283, 206, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[401]));//first aid tent
labels.push_back(new CLabel(283, 86, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[398]));//creatures
labels.push_back(new CLabel(283, 116, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[399]));//spells
labels.push_back(new CLabel(283, 146, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[400]));//catapult
labels.push_back(new CLabel(283, 176, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[151]));//ballista
labels.push_back(new CLabel(283, 206, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[401]));//first aid tent
//creature info
labels.push_back(new CLabel(283, 285, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[402]));//all stats
labels.push_back(new CLabel(283, 315, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[403]));//spells only
labels.push_back(new CLabel(283, 285, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[402]));//all stats
labels.push_back(new CLabel(283, 315, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[403]));//spells only
//general options
labels.push_back(new CLabel(61, 57, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[404]));
labels.push_back(new CLabel(61, 90, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[405]));
labels.push_back(new CLabel(61, 123, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[406]));
labels.push_back(new CLabel(61, 156, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, CGI->generaltexth->allTexts[407]));
labels.push_back(new CLabel(61, 57, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[404]));
labels.push_back(new CLabel(61, 90, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[405]));
labels.push_back(new CLabel(61, 123, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[406]));
labels.push_back(new CLabel(61, 156, FONT_MEDIUM, TOPLEFT, Colors::WHITE, CGI->generaltexth->allTexts[407]));
}
void CBattleOptionsWindow::bDefaultf()
@ -319,18 +319,18 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
if(br.winner==0) //attacker won
{
new CLabel( 59, 124, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[410]);
new CLabel(408, 124, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[411]);
new CLabel( 59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]);
new CLabel(408, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]);
}
else //if(br.winner==1)
{
new CLabel( 59, 124, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[411]);
new CLabel(412, 124, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[410]);
new CLabel( 59, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[411]);
new CLabel(412, 124, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[410]);
}
new CLabel(232, 302, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[407]);
new CLabel(232, 332, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[408]);
new CLabel(232, 428, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[409]);
new CLabel(232, 302, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[407]);
new CLabel(232, 332, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[408]);
new CLabel(232, 428, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[409]);
std::string attackerName, defenderName;
@ -380,16 +380,16 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
}
//printing attacker and defender's names
new CLabel( 89, 37, FONT_SMALL, TOPLEFT, Colors::Cornsilk, attackerName);
new CLabel( 89, 37, FONT_SMALL, TOPLEFT, Colors::WHITE, attackerName);
new CLabel( 381, 53, FONT_SMALL, BOTTOMRIGHT, Colors::Cornsilk, defenderName);
new CLabel( 381, 53, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, defenderName);
//printing casualities
for(int step = 0; step < 2; ++step)
{
if(br.casualties[step].size()==0)
{
new CLabel( 235, 360 + 97*step, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[523]);
new CLabel( 235, 360 + 97*step, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[523]);
}
else
{
@ -400,7 +400,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
new CAnimImage("CPRSMALL", CGI->creh->creatures[it->first]->iconIndex, 0, xPos, yPos);
std::ostringstream amount;
amount<<it->second;
new CLabel( xPos+16, yPos + 42, FONT_SMALL, CENTER, Colors::Cornsilk, amount.str());
new CLabel( xPos+16, yPos + 42, FONT_SMALL, CENTER, Colors::WHITE, amount.str());
xPos += 42;
}
}
@ -429,7 +429,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
boost::algorithm::replace_first(str,"%d",boost::lexical_cast<std::string>(br.exp[weAreAttacker?0:1]));
}
new CTextBox(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, CENTER, Colors::Cornsilk);
new CTextBox(str, Rect(69, 203, 330, 68), 0, FONT_SMALL, CENTER, Colors::WHITE);
}
else // we lose
{
@ -439,21 +439,21 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
{
CCS->musich->playMusic("Music/LoseCombat", false);
CCS->videoh->open("LBSTART.BIK");
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[311]);
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[311]);
break;
}
case 1: //flee
{
CCS->musich->playMusic("Music/Retreat Battle", false);
CCS->videoh->open("RTSTART.BIK");
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[310]);
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[310]);
break;
}
case 2: //surrender
{
CCS->musich->playMusic("Music/Surrender Battle", false);
CCS->videoh->open("SURRENDER.BIK");
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[309]);
new CLabel(235, 235, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[309]);
break;
}
}
@ -683,9 +683,9 @@ void CStackQueue::StackBox::showAll(SDL_Surface * to)
CIntObject::showAll(to);
if(small)
printAtMiddleLoc(makeNumberShort(stack->count), pos.w/2, pos.h - 7, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(makeNumberShort(stack->count), pos.w/2, pos.h - 7, FONT_SMALL, Colors::WHITE, to);
else
printAtMiddleLoc(makeNumberShort(stack->count), pos.w/2, pos.h - 8, FONT_MEDIUM, Colors::Cornsilk, to);
printAtMiddleLoc(makeNumberShort(stack->count), pos.w/2, pos.h - 8, FONT_MEDIUM, Colors::WHITE, to);
}
void CStackQueue::StackBox::setStack( const CStack *stack )

View File

@ -339,13 +339,13 @@ void CResDataBar::draw(SDL_Surface * to)
for (int i=0;i<7;i++)
{
SDL_itoa(LOCPLINT->cb->getResourceAmount(i),buf,10);
printAt(buf,txtpos[i].first,txtpos[i].second,FONT_SMALL,Colors::Cornsilk,to);
printAt(buf,txtpos[i].first,txtpos[i].second,FONT_SMALL,Colors::WHITE,to);
}
std::vector<std::string> temp;
SDL_itoa(LOCPLINT->cb->getDate(3),buf,10); temp+=std::string(buf);
SDL_itoa(LOCPLINT->cb->getDate(2),buf,10); temp+=std::string(buf);
SDL_itoa(LOCPLINT->cb->getDate(1),buf,10); temp+=std::string(buf);
printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,FONT_SMALL,Colors::Cornsilk,to);
printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,FONT_SMALL,Colors::WHITE,to);
temp.clear();
//updateRect(&pos,screen);
delete[] buf;

View File

@ -242,19 +242,19 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc
const CCreature * creature = CGI->creh->creatures[Town->creatures[level].second.back()];
title = new CLabel(80, 30, FONT_SMALL, CENTER, Colors::Cornsilk, creature->namePl);
title = new CLabel(80, 30, FONT_SMALL, CENTER, Colors::WHITE, creature->namePl);
animation = new CCreaturePic(30, 44, creature, true, true);
std::string text = boost::lexical_cast<std::string>(Town->creatures[level].first);
available = new CLabel(80,190, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[217] + text);
costPerTroop = new CLabel(80, 227, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[346]);
available = new CLabel(80,190, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[217] + text);
costPerTroop = new CLabel(80, 227, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[346]);
for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++)
{
if(creature->cost[i])
{
resPicture.push_back(new CAnimImage("RESOURCE", i, 0, 0, 0));
resAmount.push_back(new CLabel(0,0, FONT_SMALL, CENTER, Colors::Cornsilk, boost::lexical_cast<std::string>(creature->cost[i])));
resAmount.push_back(new CLabel(0,0, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(creature->cost[i])));
}
}
@ -852,7 +852,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
garr = new CGarrisonInt(305, 387, 4, Point(0,96), panel->bg, Point(62,374), town->getUpperArmy(), town->visitingHero);
heroes = new HeroSlots(town, Point(241, 387), Point(241, 483), garr, true);
title = new CLabel(85, 387, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk, town->name);
title = new CLabel(85, 387, FONT_MEDIUM, TOPLEFT, Colors::WHITE, town->name);
income = new CLabel(195, 443, FONT_SMALL, CENTER);
icon = new CAnimImage("ITPT", 0, 0, 15, 387);
@ -986,14 +986,14 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance *Town, int Level, bool
if (compact)
{
label = new CLabel(40, 32, FONT_TINY, BOTTOMRIGHT, Colors::Cornsilk, value);
label = new CLabel(40, 32, FONT_TINY, BOTTOMRIGHT, Colors::WHITE, value);
pos.x += 8;
pos.w = 32;
pos.h = 32;
}
else
{
label = new CLabel(24, 40, FONT_SMALL, CENTER, Colors::Cornsilk, value);
label = new CLabel(24, 40, FONT_SMALL, CENTER, Colors::WHITE, value);
pos.w = 48;
pos.h = 48;
}
@ -1275,7 +1275,7 @@ CHallInterface::CBuildingBox::CBuildingBox(int x, int y, const CGTownInstance *
panel = new CAnimImage("TPTHBAR", panelIndex[state], 0, 1, 73);
if ( iconIndex[state] >=0 )
icon = new CAnimImage("TPTHCHK", iconIndex[state], 0, 136, 56);
label = new CLabel(75, 81, FONT_SMALL, CENTER, Colors::Cornsilk, building->Name());
label = new CLabel(75, 81, FONT_SMALL, CENTER, Colors::WHITE, building->Name());
}
CHallInterface::CHallInterface(const CGTownInstance *Town):
@ -1290,7 +1290,7 @@ CHallInterface::CHallInterface(const CGTownInstance *Town):
Rect barRect(5, 556, 740, 18);
statusBar = new CGStatusBar(new CPicture(*background, barRect, 5, 556, false));
title = new CLabel(399, 12, FONT_MEDIUM, CENTER, Colors::Cornsilk, town->town->buildings[town->hallLevel()+EBuilding::VILLAGE_HALL]->Name());
title = new CLabel(399, 12, FONT_MEDIUM, CENTER, Colors::WHITE, town->town->buildings[town->hallLevel()+EBuilding::VILLAGE_HALL]->Name());
exit = new CAdventureMapButton(CGI->generaltexth->hcommands[8], "",
boost::bind(&CHallInterface::close,this), 748, 556, "TPMAGE1.DEF", SDLK_RETURN);
exit->assignedKeys.insert(SDLK_ESCAPE);
@ -1364,7 +1364,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
new CAnimImage(town->town->clientInfo.buildingsIcons, building->bid, 0, 125, 50);
new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
new CLabel(197, 30, FONT_MEDIUM, CENTER, Colors::Cornsilk,
new CLabel(197, 30, FONT_MEDIUM, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->hcommands[7]) % building->Name()));
new CTextBox(building->Description(), Rect(33, 135, 329, 67), 0, FONT_MEDIUM, CENTER);
new CTextBox(getTextForState(state), Rect(33, 216, 329, 67), 0, FONT_SMALL, CENTER);
@ -1419,7 +1419,7 @@ CFortScreen::CFortScreen(const CGTownInstance * town):
fortSize--;
const CBuilding *fortBuilding = town->town->buildings[town->fortLevel()+6];
title = new CLabel(400, 12, FONT_BIG, CENTER, Colors::Cornsilk, fortBuilding->Name());
title = new CLabel(400, 12, FONT_BIG, CENTER, Colors::WHITE, fortBuilding->Name());
std::string text = boost::str(boost::format(CGI->generaltexth->fcommands[6]) % fortBuilding->Name());
exit = new CAdventureMapButton(text, "", boost::bind(&CFortScreen::close,this) ,748, 556, "TPMAGE1", SDLK_RETURN);
@ -1494,8 +1494,8 @@ void LabeledValue::init(std::string nameText, std::string descr, int min, int ma
if (min != max)
valueText += '-' + boost::lexical_cast<std::string>(max);
}
name = new CLabel(3, 0, FONT_SMALL, TOPLEFT, Colors::Cornsilk, nameText);
value = new CLabel(pos.w-3, pos.h-2, FONT_SMALL, BOTTOMRIGHT, Colors::Cornsilk, valueText);
name = new CLabel(3, 0, FONT_SMALL, TOPLEFT, Colors::WHITE, nameText);
value = new CLabel(pos.w-3, pos.h-2, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, valueText);
}
void LabeledValue::hover(bool on)
@ -1549,14 +1549,14 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
sizes.y+=20;
values.push_back(new LabeledValue(sizes, CGI->generaltexth->allTexts[194], CGI->generaltexth->fcommands[5], town->creatureGrowth(level)));
creatureName = new CLabel(78, 11, FONT_SMALL, CENTER, Colors::Cornsilk, creature->namePl);
dwellingName = new CLabel(78, 101, FONT_SMALL, CENTER, Colors::Cornsilk, town->town->buildings[buildingID]->Name());
creatureName = new CLabel(78, 11, FONT_SMALL, CENTER, Colors::WHITE, creature->namePl);
dwellingName = new CLabel(78, 101, FONT_SMALL, CENTER, Colors::WHITE, town->town->buildings[buildingID]->Name());
if (vstd::contains(town->builtBuildings, buildingID))
{
ui32 available = town->creatures[level].first;
std::string availableText = CGI->generaltexth->allTexts[217]+ boost::lexical_cast<std::string>(available);
availableCount = new CLabel(78, 119, FONT_SMALL, CENTER, Colors::Cornsilk, availableText);
availableCount = new CLabel(78, 119, FONT_SMALL, CENTER, Colors::WHITE, availableText);
}
}
@ -1687,10 +1687,10 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, int creMachineID, int aid, i
anim = new CCreatureAnim(64, 50, creature->animDefName, Rect());
anim->clipRect(113,125,200,150);
title = new CLabel(165, 28, FONT_BIG, CENTER, Colors::Jasmine,
title = new CLabel(165, 28, FONT_BIG, CENTER, Colors::YELLOW,
boost::str(boost::format(CGI->generaltexth->allTexts[274]) % creature->nameSing));
costText = new CLabel(165, 218, FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->jktexts[43]);
costValue = new CLabel(165, 290, FONT_MEDIUM, CENTER, Colors::Cornsilk,
costText = new CLabel(165, 218, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->jktexts[43]);
costValue = new CLabel(165, 290, FONT_MEDIUM, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(CGI->arth->artifacts[aid]->price));
std::string text = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % creature->nameSing);

View File

@ -314,10 +314,10 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
break;
}
//print commander level
new CLabel(488, 62, FONT_MEDIUM, CENTER, Colors::Jasmine,
new CLabel(488, 62, FONT_MEDIUM, CENTER, Colors::YELLOW,
boost::lexical_cast<std::string>((ui16)(commander->level)));
new CLabel(488, 82, FONT_SMALL, CENTER, Colors::Cornsilk,
new CLabel(488, 82, FONT_SMALL, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(stack->experience));
}
else
@ -346,8 +346,8 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
if (CGI->modh->modules.STACK_EXP && type < COMMANDER)
{
int rank = std::min(stack->getExpRank(), 10); //hopefully nobody adds more
new CLabel(488, 82, FONT_SMALL, CENTER, Colors::Cornsilk, boost::lexical_cast<std::string>(stack->experience));
new CLabel(488, 62, FONT_MEDIUM, CENTER, Colors::Jasmine,
new CLabel(488, 82, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(stack->experience));
new CLabel(488, 62, FONT_MEDIUM, CENTER, Colors::YELLOW,
CGI->generaltexth->zcrexp[rank] + " [" + boost::lexical_cast<std::string>(rank) + "]");
if (type > BATTLE) //we need it only on adv. map
@ -450,7 +450,7 @@ void CCreatureWindow::init(const CStackInstance *Stack, const CBonusSystemNode *
void CCreatureWindow::printLine(int nr, const std::string &text, int baseVal, int val/*=-1*/, bool range/*=false*/)
{
new CLabel(162, 48 + nr*19, FONT_SMALL, TOPLEFT, Colors::Cornsilk, text);
new CLabel(162, 48 + nr*19, FONT_SMALL, TOPLEFT, Colors::WHITE, text);
std::string hlp;
if(range && baseVal != val)
@ -460,7 +460,7 @@ void CCreatureWindow::printLine(int nr, const std::string &text, int baseVal, in
else
hlp = boost::lexical_cast<std::string>(baseVal);
new CLabel(325, 64 + nr*19, FONT_SMALL, BOTTOMRIGHT, Colors::Cornsilk, hlp);
new CLabel(325, 64 + nr*19, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, hlp);
}
void CCreatureWindow::recreateSkillList(int Pos)
@ -509,7 +509,7 @@ void CCreatureWindow::showAll(SDL_Surface * to)
{
CIntObject::showAll(to);
printAtMiddleLoc((type >= COMMANDER ? c->nameSing : c->namePl), 180, 30, FONT_SMALL, Colors::Jasmine, to); //creature name
printAtMiddleLoc((type >= COMMANDER ? c->nameSing : c->namePl), 180, 30, FONT_SMALL, Colors::YELLOW, to); //creature name
printLine(0, CGI->generaltexth->primarySkillNames[0], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->Attack());
printLine(1, CGI->generaltexth->primarySkillNames[1], c->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->Defense());
@ -523,13 +523,13 @@ void CCreatureWindow::showAll(SDL_Surface * to)
}
if (stackNode->valOfBonuses(Bonus::CASTS))
{
printAtMiddleLoc(CGI->generaltexth->allTexts[399], 356, 62, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(CGI->generaltexth->allTexts[399], 356, 62, FONT_SMALL, Colors::WHITE, to);
std::string casts;
if (type == BATTLE)
casts = boost::lexical_cast<std::string>((ui16)dynamic_cast<const CStack*>(stackNode)->casts); //ui8 is converted to char :(
else
casts = boost::lexical_cast<std::string>(stackNode->valOfBonuses(Bonus::CASTS));
printAtMiddleLoc(casts, 356, 82, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(casts, 356, 82, FONT_SMALL, Colors::WHITE, to);
}
//TODO
@ -563,7 +563,7 @@ void CCreatureWindow::showAll(SDL_Surface * to)
void CCreatureWindow::show(SDL_Surface * to)
{
if (count.size()) //army stack
printTo(count, pos.x + 114, pos.y + 174,FONT_TIMES, Colors::Cornsilk, to);
printTo(count, pos.x + 114, pos.y + 174,FONT_TIMES, Colors::WHITE, to);
}
@ -710,8 +710,8 @@ void CBonusItem::showAll (SDL_Surface * to)
{
if (visible)
{
printAt(name, pos.x + 72, pos.y + 6, FONT_SMALL, Colors::Jasmine, to);
printAt(description, pos.x + 72, pos.y + 30, FONT_SMALL, Colors::Cornsilk, to);
printAt(name, pos.x + 72, pos.y + 6, FONT_SMALL, Colors::YELLOW, to);
printAt(description, pos.x + 72, pos.y + 30, FONT_SMALL, Colors::WHITE, to);
if (bonusGraphics && bonusGraphics->bg)
blitAtLoc(bonusGraphics->bg, 12, 2, to);
}
@ -807,7 +807,7 @@ CCreInfoWindow::~CCreInfoWindow()
void CCreInfoWindow::printLine(int position, const std::string &text, int baseVal, int val/*=-1*/, bool range/*=false*/)
{
infoTexts[position].first = new CLabel(155, 48 + position*19, FONT_SMALL, TOPLEFT, Colors::Cornsilk, text);
infoTexts[position].first = new CLabel(155, 48 + position*19, FONT_SMALL, TOPLEFT, Colors::WHITE, text);
std::string valueStr;
if(range && baseVal != val)
@ -819,7 +819,7 @@ void CCreInfoWindow::printLine(int position, const std::string &text, int baseVa
else
valueStr = boost::lexical_cast<std::string>(baseVal);
infoTexts[position].second = new CLabel(276, 63 + position*19, FONT_SMALL, BOTTOMRIGHT, Colors::Cornsilk, valueStr);
infoTexts[position].second = new CLabel(276, 63 + position*19, FONT_SMALL, BOTTOMRIGHT, Colors::WHITE, valueStr);
}
void CCreInfoWindow::init(const CCreature *creature, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner, int count, bool LClicked)
@ -834,9 +834,9 @@ void CCreInfoWindow::init(const CCreature *creature, const CBonusSystemNode *sta
animation = new CCreaturePic(21, 48, creature);
std::string countStr = boost::lexical_cast<std::string>(count);
creatureCount = new CLabel(114, 174, FONT_TIMES, BOTTOMRIGHT, Colors::Cornsilk, countStr);
creatureCount = new CLabel(114, 174, FONT_TIMES, BOTTOMRIGHT, Colors::WHITE, countStr);
creatureName = new CLabel(149, 30, FONT_SMALL, CENTER, Colors::Jasmine, creature->namePl);
creatureName = new CLabel(149, 30, FONT_SMALL, CENTER, Colors::YELLOW, creature->namePl);
printLine(0, CGI->generaltexth->primarySkillNames[0], creature->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::ATTACK));
printLine(1, CGI->generaltexth->primarySkillNames[1], creature->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE), stackNode->valOfBonuses(Bonus::PRIMARY_SKILL, PrimarySkill::DEFENSE));
@ -862,7 +862,7 @@ void CCreInfoWindow::init(const CCreature *creature, const CBonusSystemNode *sta
if(!LClicked)
{
abilityText = new CLabel(17, 231, FONT_SMALL, TOPLEFT, Colors::Cornsilk, creature->abilityText);
abilityText = new CLabel(17, 231, FONT_SMALL, TOPLEFT, Colors::WHITE, creature->abilityText);
}
else
{

View File

@ -324,41 +324,41 @@ void CHeroWindow::showAll(SDL_Surface * to)
CIntObject::showAll(to);
//printing hero's name
printAtMiddleLoc(curHero->name, 190, 38, FONT_BIG, Colors::Jasmine, to);
printAtMiddleLoc(curHero->name, 190, 38, FONT_BIG, Colors::YELLOW, to);
//printing hero's level
std::string secondLine= CGI->generaltexth->allTexts[342];
boost::algorithm::replace_first(secondLine,"%d",boost::lexical_cast<std::string>(curHero->level));
boost::algorithm::replace_first(secondLine,"%s",curHero->type->heroClass->name);
printAtMiddleLoc(secondLine, 190, 65, FONT_MEDIUM, Colors::Cornsilk, to);
printAtMiddleLoc(secondLine, 190, 65, FONT_MEDIUM, Colors::WHITE, to);
//primary skills names
printAtMiddleLoc(CGI->generaltexth->jktexts[1], 52, 99, FONT_SMALL, Colors::Jasmine, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[2], 123, 99, FONT_SMALL, Colors::Jasmine, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[3], 193, 99, FONT_SMALL, Colors::Jasmine, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[4], 262, 99, FONT_SMALL, Colors::Jasmine, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[1], 52, 99, FONT_SMALL, Colors::YELLOW, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[2], 123, 99, FONT_SMALL, Colors::YELLOW, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[3], 193, 99, FONT_SMALL, Colors::YELLOW, to);
printAtMiddleLoc(CGI->generaltexth->jktexts[4], 262, 99, FONT_SMALL, Colors::YELLOW, to);
//dismiss / quest log
std::vector<std::string> toPrin = CMessage::breakText(CGI->generaltexth->jktexts[8]);
if(toPrin.size()==1)
{
printAtLoc(toPrin[0], 372, 439, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[0], 372, 439, FONT_SMALL, Colors::WHITE, to);
}
else
{
printAtLoc(toPrin[0], 372, 430, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[1], 372, 446, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[0], 372, 430, FONT_SMALL, Colors::WHITE, to);
printAtLoc(toPrin[1], 372, 446, FONT_SMALL, Colors::WHITE, to);
}
toPrin = CMessage::breakText(CGI->generaltexth->jktexts[9]);
if(toPrin.size()==1)
{
printAtLoc(toPrin[0], 512, 439, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[0], 512, 439, FONT_SMALL, Colors::WHITE, to);
}
else
{
printAtLoc(toPrin[0], 512, 430, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[1], 512, 446, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(toPrin[0], 512, 430, FONT_SMALL, Colors::WHITE, to);
printAtLoc(toPrin[1], 512, 446, FONT_SMALL, Colors::WHITE, to);
}
//printing primary skills' amounts
@ -366,27 +366,27 @@ void CHeroWindow::showAll(SDL_Surface * to)
{
std::ostringstream primarySkill;
primarySkill << primSkillAreas[m]->bonusValue;
printAtMiddleLoc(primarySkill.str(), 53 + 70 * m, 166, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(primarySkill.str(), 53 + 70 * m, 166, FONT_SMALL, Colors::WHITE, to);
}
//secondary skills
for(size_t v=0; v<std::min(secSkillAreas.size(), curHero->secSkills.size()); ++v)
{
printAtLoc(CGI->generaltexth->levels[curHero->secSkills[v].second-1], (v%2) ? 212 : 68, 280 + 48 * (v/2), FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(CGI->generaltexth->skillName[curHero->secSkills[v].first], (v%2) ? 212 : 68, 300 + 48 * (v/2), FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(CGI->generaltexth->levels[curHero->secSkills[v].second-1], (v%2) ? 212 : 68, 280 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
printAtLoc(CGI->generaltexth->skillName[curHero->secSkills[v].first], (v%2) ? 212 : 68, 300 + 48 * (v/2), FONT_SMALL, Colors::WHITE, to);
}
//printing special ability
printAtLoc(CGI->generaltexth->jktexts[5].substr(1, CGI->generaltexth->jktexts[5].size()-2), 69, 183, FONT_SMALL, Colors::Jasmine, to);
printAtLoc(CGI->generaltexth->hTxts[curHero->subID].bonusName, 69, 205, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(CGI->generaltexth->jktexts[5].substr(1, CGI->generaltexth->jktexts[5].size()-2), 69, 183, FONT_SMALL, Colors::YELLOW, to);
printAtLoc(CGI->generaltexth->hTxts[curHero->subID].bonusName, 69, 205, FONT_SMALL, Colors::WHITE, to);
//printing necessery texts
printAtLoc(CGI->generaltexth->jktexts[6].substr(1, CGI->generaltexth->jktexts[6].size()-2), 69, 232, FONT_SMALL, Colors::Jasmine, to);
printAtLoc(CGI->generaltexth->jktexts[6].substr(1, CGI->generaltexth->jktexts[6].size()-2), 69, 232, FONT_SMALL, Colors::YELLOW, to);
std::ostringstream expstr;
expstr << curHero->exp;
printAtLoc(expstr.str(), 68, 252, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(CGI->generaltexth->jktexts[7].substr(1, CGI->generaltexth->jktexts[7].size()-2), 213, 232, FONT_SMALL, Colors::Jasmine, to);
printAtLoc(expstr.str(), 68, 252, FONT_SMALL, Colors::WHITE, to);
printAtLoc(CGI->generaltexth->jktexts[7].substr(1, CGI->generaltexth->jktexts[7].size()-2), 213, 232, FONT_SMALL, Colors::YELLOW, to);
std::ostringstream manastr;
manastr << curHero->mana << '/' << heroWArt.manaLimit();
printAtLoc(manastr.str(), 211, 252, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(manastr.str(), 211, 252, FONT_SMALL, Colors::WHITE, to);
}

View File

@ -47,21 +47,21 @@ InfoBox::InfoBox(Point position, InfoPos Pos, InfoSize Size, IInfoBoxData *Data)
pos = image->pos;
if (infoPos == POS_CORNER)
value = new CLabel(pos.w, pos.h, font, BOTTOMRIGHT, Colors::Cornsilk, data->getValueText());
value = new CLabel(pos.w, pos.h, font, BOTTOMRIGHT, Colors::WHITE, data->getValueText());
if (infoPos == POS_INSIDE)
value = new CLabel(pos.w/2, pos.h-6, font, CENTER, Colors::Cornsilk, data->getValueText());
value = new CLabel(pos.w/2, pos.h-6, font, CENTER, Colors::WHITE, data->getValueText());
if (infoPos == POS_UP_DOWN || infoPos == POS_DOWN)
value = new CLabel(pos.w/2, pos.h+8, font, CENTER, Colors::Cornsilk, data->getValueText());
value = new CLabel(pos.w/2, pos.h+8, font, CENTER, Colors::WHITE, data->getValueText());
if (infoPos == POS_UP_DOWN)
name = new CLabel(pos.w/2, -12, font, CENTER, Colors::Cornsilk, data->getNameText());
name = new CLabel(pos.w/2, -12, font, CENTER, Colors::WHITE, data->getNameText());
if (infoPos == POS_RIGHT)
{
name = new CLabel(pos.w+6, 6, font, TOPLEFT, Colors::Cornsilk, data->getNameText());
value = new CLabel(pos.w+6, pos.h-16, font, TOPLEFT, Colors::Cornsilk, data->getValueText());
name = new CLabel(pos.w+6, 6, font, TOPLEFT, Colors::WHITE, data->getNameText());
value = new CLabel(pos.w+6, pos.h-16, font, TOPLEFT, Colors::WHITE, data->getValueText());
}
pos = image->pos;
if (name)
@ -604,7 +604,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
incomeArea = new CHoverableArea;
incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68);
incomeArea->hoverText = CGI->generaltexth->allTexts[255];
incomeAmount = new CLabel(628, footerPos + 70, FONT_SMALL, TOPLEFT, Colors::Cornsilk, boost::lexical_cast<std::string>(totalIncome));
incomeAmount = new CLabel(628, footerPos + 70, FONT_SMALL, TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome));
}
void CKingdomInterface::generateButtons()
@ -689,8 +689,8 @@ CKingdHeroList::CKingdHeroList(size_t maxSize)
OBJ_CONSTRUCTION_CAPTURING_ALL;
title = new CPicture("OVTITLE",16,0);
title->colorize(LOCPLINT->playerID);
heroLabel = new CLabel(150, 10, FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[0]);
skillsLabel = new CLabel(500, 10, FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[1]);
heroLabel = new CLabel(150, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[0]);
skillsLabel = new CLabel(500, 10, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[1]);
ui32 townCount = LOCPLINT->cb->howManyHeroes(false);
ui32 size = conf.go()->ac.overviewSize*116 + 19;
@ -741,9 +741,9 @@ CKingdTownList::CKingdTownList(size_t maxSize)
OBJ_CONSTRUCTION_CAPTURING_ALL;
title = new CPicture("OVTITLE",16,0);
title->colorize(LOCPLINT->playerID);
townLabel = new CLabel(146,10,FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[3]);
garrHeroLabel = new CLabel(375,10,FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[4]);
visitHeroLabel = new CLabel(608,10,FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[5]);
townLabel = new CLabel(146,10,FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[3]);
garrHeroLabel = new CLabel(375,10,FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[4]);
visitHeroLabel = new CLabel(608,10,FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->overview[5]);
ui32 townCount = LOCPLINT->cb->howManyTowns();
ui32 size = conf.go()->ac.overviewSize*116 + 19;
@ -788,9 +788,9 @@ CTownItem::CTownItem(const CGTownInstance* Town):
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
background = new CAnimImage("OVSLOT", 6);
name = new CLabel(74, 8, FONT_SMALL, TOPLEFT, Colors::Cornsilk, town->name);
name = new CLabel(74, 8, FONT_SMALL, TOPLEFT, Colors::WHITE, town->name);
income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::Cornsilk, boost::lexical_cast<std::string>(town->dailyIncome()));
income = new CLabel( 190, 60, FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(town->dailyIncome()));
hall = new CTownInfo( 69, 31, town, true);
fort = new CTownInfo(111, 31, town, false);
@ -886,7 +886,7 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
arts2->recActions = DISPOSE | SHARE_POS;
backpack->recActions = DISPOSE | SHARE_POS;
name = new CLabel(75, 7, FONT_SMALL, TOPLEFT, Colors::Cornsilk, hero->name);
name = new CLabel(75, 7, FONT_SMALL, TOPLEFT, Colors::WHITE, hero->name);
std::vector<CArtPlace*> arts;
arts.insert(arts.end(), arts1->arts.begin(), arts1->arts.end());
@ -910,7 +910,7 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
size_t begin = overlay.find('{');
size_t end = overlay.find('}', begin);
overlay = overlay.substr(begin+1, end - begin);
artButtons->buttons[it]->addTextOverlay(overlay, FONT_SMALL, Colors::Jasmine);
artButtons->buttons[it]->addTextOverlay(overlay, FONT_SMALL, Colors::YELLOW);
}
artButtons->onChange += boost::bind(&CTabbedInt::setActive, artsTabs, _1);
artButtons->onChange += boost::bind(&CHeroItem::onArtChange, this, _1);
@ -921,8 +921,8 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero, CArtifactsOfHero::SCommonPart *
portrait = new CAnimImage("PortraitsLarge", hero->subID, 0, 5, 6);
heroArea = new CHeroArea(5, 6, hero);
name = new CLabel(73, 7, FONT_SMALL, TOPLEFT, Colors::Cornsilk, hero->name);
artsText = new CLabel(320, 55, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->overview[2]);
name = new CLabel(73, 7, FONT_SMALL, TOPLEFT, Colors::WHITE, hero->name);
artsText = new CLabel(320, 55, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->overview[2]);
for (size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++)
heroInfo.push_back(new InfoBox(Point(78+i*36, 26), InfoBox::POS_DOWN, InfoBox::SIZE_SMALL,

View File

@ -277,7 +277,7 @@ SDL_Surface * CMessage::blitTextOnSur(std::vector<std::vector<SDL_Surface*> > *
return ret;
}
SDL_Surface * FNT_RenderText (EFonts font, std::string text, SDL_Color kolor= Colors::Cornsilk)
SDL_Surface * FNT_RenderText (EFonts font, std::string text, SDL_Color kolor= Colors::WHITE)
{
if (graphics->fontsTrueType[font])
return TTF_RenderText_Blended(graphics->fontsTrueType[font], text.c_str(), kolor);
@ -312,7 +312,7 @@ std::vector<std::vector<SDL_Surface*> > * CMessage::drawText(std::vector<std::st
z++;
if (z)
(*txtg)[i].push_back(FNT_RenderText(font, (*brtext)[i].substr(0,z), Colors::Cornsilk));
(*txtg)[i].push_back(FNT_RenderText(font, (*brtext)[i].substr(0,z), Colors::WHITE));
(*brtext)[i].erase(0,z);
if ((*brtext)[i].length() && (*brtext)[i][0] == '{')
@ -329,7 +329,7 @@ std::vector<std::vector<SDL_Surface*> > * CMessage::drawText(std::vector<std::st
z++;
if (z)
(*txtg)[i].push_back(FNT_RenderText(font, (*brtext)[i].substr(0,z), Colors::Jasmine));
(*txtg)[i].push_back(FNT_RenderText(font, (*brtext)[i].substr(0,z), Colors::YELLOW));
(*brtext)[i].erase(0,z);
if ((*brtext)[i].length() && (*brtext)[i][0] == '}')
@ -363,7 +363,7 @@ SDL_Surface * CMessage::drawBoxTextBitmapSub( int player, std::string text, SDL_
curh += imgToBmp;
blitAt(bitmap,(ret->w/2)-(bitmap->w/2),curh,ret);
curh += bitmap->h + 5;
CSDL_Ext::printAtMiddle(sub,ret->w/2,curh+10,FONT_SMALL,Colors::Cornsilk,ret);
CSDL_Ext::printAtMiddle(sub,ret->w/2,curh+10,FONT_SMALL,Colors::WHITE,ret);
delete txtg;
return ret;
}
@ -373,7 +373,7 @@ void CMessage::drawIWindow(CInfoWindow * ret, std::string text, int player)
SDL_Surface * _or = NULL;
if(dynamic_cast<CSelWindow*>(ret)) //it's selection window, so we'll blit "or" between components
_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],Colors::Cornsilk);
_or = FNT_RenderText(FONT_MEDIUM,CGI->generaltexth->allTexts[4],Colors::WHITE);
const int sizes[][2] = {{400, 125}, {500, 150}, {600, 200}, {480, 400}};

View File

@ -101,8 +101,8 @@ static void do_quit()
static CMapInfo *mapInfoFromGame()
{
CMapInfo * ret = new CMapInfo();
ret->mapHeader = std::unique_ptr<CMapHeader>(new CMapHeader(*LOCPLINT->cb->getMapHeader()));
CMapInfo * ret = new CMapInfo();
ret->mapHeader = std::unique_ptr<CMapHeader>(new CMapHeader(*LOCPLINT->cb->getMapHeader()));
return ret;
}
@ -390,7 +390,7 @@ CreditsScreen::CreditsScreen()
std::string text((char*)textFile.first.get(), textFile.second);
size_t firstQuote = text.find('\"')+1;
text = text.substr(firstQuote, text.find('\"', firstQuote) - firstQuote );
credits = new CTextBox(text, Rect(pos.w - 350, 600, 350, 32000), 0, FONT_CREDITS, CENTER, Colors::Cornsilk);
credits = new CTextBox(text, Rect(pos.w - 350, 600, 350, 32000), 0, FONT_CREDITS, CENTER, Colors::WHITE);
credits->pos.h = credits->maxH;
}
@ -595,6 +595,9 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
{
opt = new OptionsTab(); //scenario options tab
opt->recActions = DISPOSE;
randMapTab = new RandomMapTab;
randMapTab->recActions = DISPOSE;
}
sel = new SelectionTab(screenType, bind(&CSelectionScreen::changeSelection, this, _1), multiPlayer); //scenario selection tab
sel->recActions = DISPOSE;
@ -611,8 +614,12 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
CAdventureMapButton *opts = new CAdventureMapButton(CGI->generaltexth->zelp[46], bind(&CSelectionScreen::toggleTab, this, opt), 411, 510, "GSPBUTT.DEF", SDLK_a);
opts->addTextOverlay(CGI->generaltexth->allTexts[501], FONT_SMALL);
CAdventureMapButton *random = new CAdventureMapButton(CGI->generaltexth->zelp[47], bind(&CSelectionScreen::toggleTab, this, sel), 411, 105, "GSPBUTT.DEF", SDLK_r);
random->addTextOverlay(CGI->generaltexth->allTexts[740], FONT_SMALL);
CAdventureMapButton * randomBtn = new CAdventureMapButton(CGI->generaltexth->zelp[47], 0, 411, 105, "GSPBUTT.DEF", SDLK_r);
randomBtn->addTextOverlay(CGI->generaltexth->allTexts[740], FONT_SMALL);
if(settings["general"]["enableRMG"].Bool())
{
randomBtn->callback = bind(&CSelectionScreen::toggleTab, this, randMapTab);
}
start = new CAdventureMapButton(CGI->generaltexth->zelp[103], bind(&CSelectionScreen::startGame, this), 411, 535, "SCNRBEG.DEF", SDLK_b);
@ -624,10 +631,10 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EMulti
if(multiPlayer == CMenuScreen::MULTI_NETWORK_GUEST)
{
SDL_Color orange = {232, 184, 32, 0};
select->text->color = opts->text->color = random->text->color = orange;
select->text->color = opts->text->color = randomBtn->text->color = orange;
select->block(true);
opts->block(true);
random->block(true);
randomBtn->block(true);
start->block(true);
}
}
@ -735,6 +742,8 @@ void CSelectionScreen::toggleTab(CIntObject *tab)
pga.action = PregameGuiAction::OPEN_OPTIONS;
else if(tab == sel)
pga.action = PregameGuiAction::OPEN_SCENARIO_LIST;
else if(tab == randMapTab)
pga.action = PregameGuiAction::OPEN_RANDOM_MAP_OPTIONS;
*serv << &pga;
}
@ -771,7 +780,7 @@ void CSelectionScreen::changeSelection( const CMapInfo *to )
SEL->sInfo.difficulty = to->scenarioOpts->difficulty;
if(screenType != CMenuScreen::campaignList)
{
updateStartInfo(to ? to->fileURI : "", sInfo, to ? to->mapHeader.get() : NULL);
updateStartInfo(to ? to->fileURI : "", sInfo, to ? to->mapHeader.get() : NULL);
}
card->changeSelection(to);
if(screenType != CMenuScreen::campaignList)
@ -1027,7 +1036,7 @@ std::vector<ResourceID> SelectionTab::getFiles(std::string dirURI, int resType)
auto iterator = CResourceHandler::get()->getIterator([&](const ResourceID & ident)
{
return ident.getType() == resType
&& boost::algorithm::starts_with(ident.getName(), dirURI);
&& boost::algorithm::starts_with(ident.getName(), dirURI);
});
while (iterator.hasNext())
@ -1041,8 +1050,8 @@ std::vector<ResourceID> SelectionTab::getFiles(std::string dirURI, int resType)
void SelectionTab::parseMaps(const std::vector<ResourceID> & files)
{
allItems.clear();
for(int i = 0; i < files.size(); ++i)
allItems.clear();
for(int i = 0; i < files.size(); ++i)
{
try
{
@ -1276,7 +1285,7 @@ void SelectionTab::select( int position )
if(txt)
{
std::string filename = CResourceHandler::get()->getResourceName(
ResourceID(curItems[py]->fileURI, EResType::LIB_SAVEGAME));
ResourceID(curItems[py]->fileURI, EResType::LIB_SAVEGAME));
txt->setTxt(CFileInfo(filename).getBaseName());
}
@ -1322,9 +1331,9 @@ void SelectionTab::printMaps(SDL_Surface *to)
CMapInfo *currentItem = curItems[elemIdx];
if (elemIdx == selectionPos)
itemColor=Colors::Jasmine;
itemColor=Colors::YELLOW;
else
itemColor=Colors::Cornsilk;
itemColor=Colors::WHITE;
if(tabType != CMenuScreen::campaignList)
{
@ -1355,16 +1364,16 @@ void SelectionTab::printMaps(SDL_Surface *to)
int temp=-1;
switch (currentItem->mapHeader->version)
{
case EMapFormat::ROE:
case EMapFormat::ROE:
temp=0;
break;
case EMapFormat::AB:
case EMapFormat::AB:
temp=1;
break;
case EMapFormat::SOD:
case EMapFormat::SOD:
temp=2;
break;
case EMapFormat::WOG:
case EMapFormat::WOG:
temp=3;
break;
default:
@ -1410,7 +1419,7 @@ void SelectionTab::printMaps(SDL_Surface *to)
else
{
name = CFileInfo(CResourceHandler::get()->getResourceName(
ResourceID(currentItem->fileURI, EResType::LIB_SAVEGAME))).getBaseName();
ResourceID(currentItem->fileURI, EResType::LIB_SAVEGAME))).getBaseName();
}
//print name
@ -1441,10 +1450,10 @@ void SelectionTab::showAll(SDL_Surface * to)
break;
}
CSDL_Ext::printAtMiddle(title, pos.x+205, pos.y+28, FONT_MEDIUM, Colors::Jasmine, to); //Select a Scenario to Play
CSDL_Ext::printAtMiddle(title, pos.x+205, pos.y+28, FONT_MEDIUM, Colors::YELLOW, to); //Select a Scenario to Play
if(tabType != CMenuScreen::campaignList)
{
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[510], pos.x+87, pos.y+62, FONT_SMALL, Colors::Jasmine, to); //Map sizes
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[510], pos.x+87, pos.y+62, FONT_SMALL, Colors::YELLOW, to); //Map sizes
}
}
@ -1527,7 +1536,226 @@ void SelectionTab::selectFName( std::string fname )
selectAbs(0);
}
RandomMapTab::RandomMapTab()
{
OBJ_CONSTRUCTION;
bg = new CPicture("RANMAPBK", 0, 6);
// Map Size
mapSizeBtnGroup = new CHighlightableButtonsGroup(0);
mapSizeBtnGroup->pos.y = 81;
mapSizeBtnGroup->pos.x = 158;
const std::vector<std::string> mapSizeBtns = boost::assign::list_of("RANSIZS")("RANSIZM")("RANSIZL")("RANSIZX");
addButtonsToGroup(mapSizeBtnGroup, mapSizeBtns, 0, 3, 47, 198);
mapSizeBtnGroup->select(1, false);
mapSizeBtnGroup->onChange = [&](int btnId)
{
options.setMapSize(static_cast<EMapSize::EMapSize>(btnId));
};
// Two levels
twoLevelsBtn = new CHighlightableButton(0, 0, std::map<int,std::string>(),
CGI->generaltexth->zelp[202].second, false, "RANUNDR", nullptr, 346, 81);
twoLevelsBtn->callback = [&]() { options.setHasTwoLevels(true); };
twoLevelsBtn->callback2 = [&]() { options.setHasTwoLevels(false); };
twoLevelsBtn->select(true);
// Create number defs list
std::vector<std::string> numberDefs;
for(int i = 0; i <= 8; ++i)
{
numberDefs.push_back("RANNUM" + boost::lexical_cast<std::string>(i));
}
const int NUMBERS_WIDTH = 32;
const int BTNS_GROUP_LEFT_MARGIN = 67;
// Amount of players
playersCntGroup = new CHighlightableButtonsGroup(0);
playersCntGroup->pos.y = 153;
playersCntGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
addButtonsWithRandToGroup(playersCntGroup, numberDefs, 1, 8, NUMBERS_WIDTH, 204, 212);
playersCntGroup->onChange = [&](int btnId)
{
options.setPlayersCnt(btnId);
deactivateButtonsFrom(teamsCntGroup, btnId);
deactivateButtonsFrom(compOnlyPlayersCntGroup, 8 - btnId + 1);
validatePlayersCnt(btnId);
};
// Amount of teams
teamsCntGroup = new CHighlightableButtonsGroup(0);
teamsCntGroup->pos.y = 219;
teamsCntGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
addButtonsWithRandToGroup(teamsCntGroup, numberDefs, 0, 7, NUMBERS_WIDTH, 214, 222);
teamsCntGroup->onChange = [&](int btnId)
{
options.setTeamsCnt(btnId);
};
// Computer only players
compOnlyPlayersCntGroup = new CHighlightableButtonsGroup(0);
compOnlyPlayersCntGroup->pos.y = 285;
compOnlyPlayersCntGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
addButtonsWithRandToGroup(compOnlyPlayersCntGroup, numberDefs, 0, 7, NUMBERS_WIDTH, 224, 232);
compOnlyPlayersCntGroup->onChange = [&](int btnId)
{
options.setCompOnlyPlayersCnt(btnId);
deactivateButtonsFrom(compOnlyTeamsCntGroup, btnId);
validateCompOnlyPlayersCnt(btnId);
};
// Computer only teams
compOnlyTeamsCntGroup = new CHighlightableButtonsGroup(0);
compOnlyTeamsCntGroup->pos.y = 351;
compOnlyTeamsCntGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
addButtonsWithRandToGroup(compOnlyTeamsCntGroup, numberDefs, 0, 6, NUMBERS_WIDTH, 234, 241);
compOnlyTeamsCntGroup->onChange = [&](int btnId)
{
options.setCompOnlyTeamsCnt(btnId);
};
const int WIDE_BTN_WIDTH = 85;
// Water content
waterContentGroup = new CHighlightableButtonsGroup(0);
waterContentGroup->pos.y = 419;
waterContentGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
const std::vector<std::string> waterContentBtns = boost::assign::list_of("RANNONE")("RANNORM")("RANISLD");
addButtonsWithRandToGroup(waterContentGroup, waterContentBtns, 0, 2, WIDE_BTN_WIDTH, 243, 246);
waterContentGroup->onChange = [&](int btnId)
{
options.setWaterContent(static_cast<EWaterContent::EWaterContent>(btnId));
};
// Monster strength
monsterStrengthGroup = new CHighlightableButtonsGroup(0);
monsterStrengthGroup->pos.y = 485;
monsterStrengthGroup->pos.x = BTNS_GROUP_LEFT_MARGIN;
const std::vector<std::string> monsterStrengthBtns = boost::assign::list_of("RANWEAK")("RANNORM")("RANSTRG");
addButtonsWithRandToGroup(monsterStrengthGroup, monsterStrengthBtns, 0, 2, WIDE_BTN_WIDTH, 248, 251);
monsterStrengthGroup->onChange = [&](int btnId)
{
options.setMonsterStrength(static_cast<EMonsterStrength::EMonsterStrength>(btnId));
};
// Show random maps btn
showRandMaps = new CAdventureMapButton("", CGI->generaltexth->zelp[252].second, 0, 54, 535, "RANSHOW");
}
void RandomMapTab::addButtonsWithRandToGroup(CHighlightableButtonsGroup * group, const std::vector<std::string> & defs, int nStart, int nEnd, int btnWidth, int helpStartIndex, int helpRandIndex) const
{
addButtonsToGroup(group, defs, nStart, nEnd, btnWidth, helpStartIndex);
// Add rand button and select rand if help text index is given
const std::string randomDef = "RANRAND";
if (helpRandIndex != -1)
{
// Buttons are relative to button group, TODO better solution?
SObjectConstruction obj__i(group);
group->addButton(new CHighlightableButton("", CGI->generaltexth->zelp[helpRandIndex].second, 0, 256, 0, randomDef, -1));
group->select(-1, true);
}
}
void RandomMapTab::addButtonsToGroup(CHighlightableButtonsGroup * group, const std::vector<std::string> & defs, int nStart, int nEnd, int btnWidth, int helpStartIndex) const
{
// Buttons are relative to button group, TODO better solution?
SObjectConstruction obj__i(group);
const int cnt = nEnd - nStart + 1;
// Buttons
for(int i = 0; i < cnt; ++i)
{
group->addButton(new CHighlightableButton("", CGI->generaltexth->zelp[helpStartIndex + i].second, 0, i * btnWidth, 0, defs[i + nStart], i + nStart));
}
}
void RandomMapTab::deactivateButtonsFrom(CHighlightableButtonsGroup * group, int startId)
{
BOOST_FOREACH(CHighlightableButton * btn, group->buttons)
{
if(startId == -1 || btn->ID < startId)
{
if(btn->isBlocked())
{
btn->setOffset(0);
btn->setState(CButtonBase::NORMAL);
}
}
else
{
// Blocked state looks like frame 'selected'=1
btn->setOffset(-1);
btn->setState(CButtonBase::BLOCKED);
}
}
}
void RandomMapTab::validatePlayersCnt(int playersCnt)
{
if(playersCnt == -1)
{
return;
}
if(options.getTeamsCnt() >= playersCnt)
{
options.setTeamsCnt(playersCnt - 1);
teamsCntGroup->select(options.getTeamsCnt(), true);
}
if(options.getCompOnlyPlayersCnt() > 8 - playersCnt)
{
options.setCompOnlyPlayersCnt(8 - playersCnt);
compOnlyPlayersCntGroup->select(options.getCompOnlyPlayersCnt(), true);
}
validateCompOnlyPlayersCnt(options.getCompOnlyPlayersCnt());
}
void RandomMapTab::validateCompOnlyPlayersCnt(int compOnlyPlayersCnt)
{
if(compOnlyPlayersCnt == -1)
{
return;
}
if(options.getCompOnlyTeamsCnt() >= compOnlyPlayersCnt)
{
options.setCompOnlyTeamsCnt(compOnlyPlayersCnt - 1);
compOnlyTeamsCntGroup->select(options.getCompOnlyTeamsCnt(), true);
}
}
void RandomMapTab::showAll(SDL_Surface * to)
{
CIntObject::showAll(to);
// Headline
printAtMiddleLoc(CGI->generaltexth->allTexts[738], 222, 36, FONT_BIG, Colors::YELLOW, to);
printAtMiddleLoc(CGI->generaltexth->allTexts[739], 222, 56, FONT_SMALL, Colors::WHITE, to);
// Map size
printAtMiddleLoc(CGI->generaltexth->allTexts[752], 104, 97, FONT_SMALL, Colors::WHITE, to);
// Players cnt
printAtLoc(CGI->generaltexth->allTexts[753], 68, 133, FONT_SMALL, Colors::WHITE, to);
// Teams cnt
printAtLoc(CGI->generaltexth->allTexts[754], 68, 199, FONT_SMALL, Colors::WHITE, to);
// Computer only players cnt
printAtLoc(CGI->generaltexth->allTexts[755], 68, 265, FONT_SMALL, Colors::WHITE, to);
// Computer only teams cnt
printAtLoc(CGI->generaltexth->allTexts[756], 68, 331, FONT_SMALL, Colors::WHITE, to);
// Water content
printAtLoc(CGI->generaltexth->allTexts[757], 68, 398, FONT_SMALL, Colors::WHITE, to);
// Monster strength
printAtLoc(CGI->generaltexth->allTexts[758], 68, 465, FONT_SMALL, Colors::WHITE, to);
}
CChatBox::CChatBox(const Rect &rect)
{
@ -1634,17 +1862,17 @@ void InfoCard::showAll(SDL_Surface * to)
//blit texts
if(SEL->screenType != CMenuScreen::campaignList)
{
printAtLoc(CGI->generaltexth->allTexts[390] + ":", 24, 400, FONT_SMALL, Colors::Cornsilk, to); //Allies
printAtLoc(CGI->generaltexth->allTexts[391] + ":", 190, 400, FONT_SMALL, Colors::Cornsilk, to); //Enemies
printAtLoc(CGI->generaltexth->allTexts[494], 33, 430, FONT_SMALL, Colors::Jasmine, to);//"Map Diff:"
printAtLoc(CGI->generaltexth->allTexts[492] + ":", 133,430, FONT_SMALL, Colors::Jasmine, to); //player difficulty
printAtLoc(CGI->generaltexth->allTexts[218] + ":", 290,430, FONT_SMALL, Colors::Jasmine, to); //"Rating:"
printAtLoc(CGI->generaltexth->allTexts[495], 26, 22, FONT_SMALL, Colors::Jasmine, to); //Scenario Name:
printAtLoc(CGI->generaltexth->allTexts[390] + ":", 24, 400, FONT_SMALL, Colors::WHITE, to); //Allies
printAtLoc(CGI->generaltexth->allTexts[391] + ":", 190, 400, FONT_SMALL, Colors::WHITE, to); //Enemies
printAtLoc(CGI->generaltexth->allTexts[494], 33, 430, FONT_SMALL, Colors::YELLOW, to);//"Map Diff:"
printAtLoc(CGI->generaltexth->allTexts[492] + ":", 133,430, FONT_SMALL, Colors::YELLOW, to); //player difficulty
printAtLoc(CGI->generaltexth->allTexts[218] + ":", 290,430, FONT_SMALL, Colors::YELLOW, to); //"Rating:"
printAtLoc(CGI->generaltexth->allTexts[495], 26, 22, FONT_SMALL, Colors::YELLOW, to); //Scenario Name:
if(!chatOn)
{
printAtLoc(CGI->generaltexth->allTexts[496], 26, 132, FONT_SMALL, Colors::Jasmine, to); //Scenario Description:
printAtLoc(CGI->generaltexth->allTexts[497], 26, 283, FONT_SMALL, Colors::Jasmine, to); //Victory Condition:
printAtLoc(CGI->generaltexth->allTexts[498], 26, 339, FONT_SMALL, Colors::Jasmine, to); //Loss Condition:
printAtLoc(CGI->generaltexth->allTexts[496], 26, 132, FONT_SMALL, Colors::YELLOW, to); //Scenario Description:
printAtLoc(CGI->generaltexth->allTexts[497], 26, 283, FONT_SMALL, Colors::YELLOW, to); //Victory Condition:
printAtLoc(CGI->generaltexth->allTexts[498], 26, 339, FONT_SMALL, Colors::YELLOW, to); //Loss Condition:
}
else //players list
{
@ -1654,7 +1882,7 @@ void InfoCard::showAll(SDL_Surface * to)
{
if(i->second.human)
{
printAtLoc(i->second.name, 24, 285 + playerSoFar++ * graphics->fonts[FONT_SMALL]->height, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(i->second.name, 24, 285 + playerSoFar++ * graphics->fonts[FONT_SMALL]->height, FONT_SMALL, Colors::WHITE, to);
playerNames.erase(i->second.human);
}
}
@ -1662,7 +1890,7 @@ void InfoCard::showAll(SDL_Surface * to)
playerSoFar = 0;
for (auto i = playerNames.cbegin(); i != playerNames.cend(); i++)
{
printAtLoc(i->second, 193, 285 + playerSoFar++ * graphics->fonts[FONT_SMALL]->height, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(i->second, 193, 285 + playerSoFar++ * graphics->fonts[FONT_SMALL]->height, FONT_SMALL, Colors::WHITE, to);
}
}
@ -1681,7 +1909,7 @@ void InfoCard::showAll(SDL_Surface * to)
if (temp>20) temp=0;
std::string sss = CGI->generaltexth->victoryConditions[temp];
if (temp && SEL->current->mapHeader->victoryCondition.allowNormalVictory) sss+= "/" + CGI->generaltexth->victoryConditions[0];
printAtLoc(sss, 60, 307, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(sss, 60, 307, FONT_SMALL, Colors::WHITE, to);
temp = SEL->current->mapHeader->victoryCondition.condition;
if (temp>12) temp=11;
@ -1691,7 +1919,7 @@ void InfoCard::showAll(SDL_Surface * to)
temp = SEL->current->mapHeader->lossCondition.typeOfLossCon+1;
if (temp>20) temp=0;
sss = CGI->generaltexth->lossCondtions[temp];
printAtLoc(sss, 60, 366, FONT_SMALL, Colors::Cornsilk, to);
printAtLoc(sss, 60, 366, FONT_SMALL, Colors::WHITE, to);
temp=SEL->current->mapHeader->lossCondition.typeOfLossCon;
if (temp>12) temp=3;
@ -1701,7 +1929,7 @@ void InfoCard::showAll(SDL_Surface * to)
//difficulty
assert(SEL->current->mapHeader->difficulty <= 4);
std::string &diff = CGI->generaltexth->arraytxt[142 + SEL->current->mapHeader->difficulty];
printAtMiddleLoc(diff, 62, 472, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(diff, 62, 472, FONT_SMALL, Colors::WHITE, to);
//selecting size icon
switch (SEL->current->mapHeader->width)
@ -1726,7 +1954,7 @@ void InfoCard::showAll(SDL_Surface * to)
if(SEL->screenType == CMenuScreen::loadGame)
printToLoc((static_cast<const CMapInfo*>(SEL->current))->date,308,34, FONT_SMALL, Colors::Cornsilk, to);
printToLoc((static_cast<const CMapInfo*>(SEL->current))->date,308,34, FONT_SMALL, Colors::WHITE, to);
//print flags
int fx = 34 + graphics->fonts[FONT_SMALL]->getWidth(CGI->generaltexth->allTexts[390].c_str());
@ -1765,7 +1993,7 @@ void InfoCard::showAll(SDL_Surface * to)
tob="200%";
break;
}
printAtMiddleLoc(tob, 311, 472, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(tob, 311, 472, FONT_SMALL, Colors::WHITE, to);
}
//blit description
@ -1782,9 +2010,9 @@ void InfoCard::showAll(SDL_Surface * to)
//name
if (name.length())
printAtLoc(CSDL_Ext::trimToFit(name, 300, FONT_BIG), 26, 39, FONT_BIG, Colors::Jasmine, to);
printAtLoc(CSDL_Ext::trimToFit(name, 300, FONT_BIG), 26, 39, FONT_BIG, Colors::YELLOW, to);
else
printAtLoc("Unnamed", 26, 39, FONT_BIG, Colors::Jasmine, to);
printAtLoc("Unnamed", 26, 39, FONT_BIG, Colors::YELLOW, to);
}
}
@ -1815,14 +2043,14 @@ void InfoCard::clickRight( tribool down, bool previousState )
void InfoCard::showTeamsPopup()
{
SDL_Surface *bmp = CMessage::drawDialogBox(256, 90 + 50 * SEL->current->mapHeader->howManyTeams);
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[657], 128, 30, FONT_MEDIUM, Colors::Jasmine, bmp); //{Team Alignments}
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[657], 128, 30, FONT_MEDIUM, Colors::YELLOW, bmp); //{Team Alignments}
for(int i = 0; i < SEL->current->mapHeader->howManyTeams; i++)
{
std::vector<ui8> flags;
std::string hlp = CGI->generaltexth->allTexts[656]; //Team %d
hlp.replace(hlp.find("%d"), 2, boost::lexical_cast<std::string>(i+1));
CSDL_Ext::printAtMiddle(hlp, 128, 65 + 50*i, FONT_SMALL, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddle(hlp, 128, 65 + 50*i, FONT_SMALL, Colors::WHITE, bmp);
for(int j = 0; j < GameConstants::PLAYER_LIMIT; j++)
if((SEL->current->mapHeader->players[j].canHumanPlay || SEL->current->mapHeader->players[j].canComputerPlay)
@ -1888,15 +2116,15 @@ OptionsTab::~OptionsTab()
void OptionsTab::showAll(SDL_Surface * to)
{
CIntObject::showAll(to);
printAtMiddleLoc(CGI->generaltexth->allTexts[515], 222, 30, FONT_BIG, Colors::Jasmine, to);
printAtMiddleWBLoc(CGI->generaltexth->allTexts[516], 222, 58, FONT_SMALL, 55, Colors::Cornsilk, to); //Select starting options, handicap, and name for each player in the game.
printAtMiddleWBLoc(CGI->generaltexth->allTexts[517], 107, 102, FONT_SMALL, 14, Colors::Jasmine, to); //Player Name Handicap Type
printAtMiddleWBLoc(CGI->generaltexth->allTexts[518], 197, 102, FONT_SMALL, 10, Colors::Jasmine, to); //Starting Town
printAtMiddleWBLoc(CGI->generaltexth->allTexts[519], 273, 102, FONT_SMALL, 10, Colors::Jasmine, to); //Starting Hero
printAtMiddleWBLoc(CGI->generaltexth->allTexts[520], 349, 102, FONT_SMALL, 10, Colors::Jasmine, to); //Starting Bonus
printAtMiddleLoc(CGI->generaltexth->allTexts[521], 222, 538, FONT_SMALL, Colors::Jasmine, to); // Player Turn Duration
printAtMiddleLoc(CGI->generaltexth->allTexts[515], 222, 30, FONT_BIG, Colors::YELLOW, to);
printAtMiddleWBLoc(CGI->generaltexth->allTexts[516], 222, 58, FONT_SMALL, 55, Colors::WHITE, to); //Select starting options, handicap, and name for each player in the game.
printAtMiddleWBLoc(CGI->generaltexth->allTexts[517], 107, 102, FONT_SMALL, 14, Colors::YELLOW, to); //Player Name Handicap Type
printAtMiddleWBLoc(CGI->generaltexth->allTexts[518], 197, 102, FONT_SMALL, 10, Colors::YELLOW, to); //Starting Town
printAtMiddleWBLoc(CGI->generaltexth->allTexts[519], 273, 102, FONT_SMALL, 10, Colors::YELLOW, to); //Starting Hero
printAtMiddleWBLoc(CGI->generaltexth->allTexts[520], 349, 102, FONT_SMALL, 10, Colors::YELLOW, to); //Starting Bonus
printAtMiddleLoc(CGI->generaltexth->allTexts[521], 222, 538, FONT_SMALL, Colors::YELLOW, to); // Player Turn Duration
if (turnDuration)
printAtMiddleLoc(CGI->generaltexth->turnDurations[turnDuration->value], 319,559, FONT_SMALL, Colors::Cornsilk, to);//Turn duration value
printAtMiddleLoc(CGI->generaltexth->turnDurations[turnDuration->value], 319,559, FONT_SMALL, Colors::WHITE, to);//Turn duration value
}
void OptionsTab::nextCastle( int player, int dir )
@ -2008,8 +2236,8 @@ bool OptionsTab::canUseThisHero( int ID )
// return false;
return CGI->heroh->heroes.size() > ID
&& !vstd::contains(usedHeroes, ID)
&& SEL->current->mapHeader->allowedHeroes[ID];
&& !vstd::contains(usedHeroes, ID)
&& SEL->current->mapHeader->allowedHeroes[ID];
}
void OptionsTab::nextBonus( int player, int dir )
@ -2059,9 +2287,9 @@ void OptionsTab::recreate()
for(auto it = SEL->sInfo.playerInfos.begin(); it != SEL->sInfo.playerInfos.end(); ++it)
{
entries.insert(std::make_pair(it->first, new PlayerOptionsEntry(this, it->second)));
const std::vector<SHeroName> &heroes = SEL->current->mapHeader->players[it->first].heroesNames;
const std::vector<SHeroName> &heroes = SEL->current->mapHeader->players[it->first].heroesNames;
for(size_t hi=0; hi<heroes.size(); hi++)
usedHeroes.insert(heroes[hi].heroId);
usedHeroes.insert(heroes[hi].heroId);
}
}
@ -2227,8 +2455,8 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry( OptionsTab *owner, PlayerSet
void OptionsTab::PlayerOptionsEntry::showAll(SDL_Surface * to)
{
CIntObject::showAll(to);
printAtMiddleLoc(s.name, 55, 10, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleWBLoc(CGI->generaltexth->arraytxt[206+whoCanPlay], 28, 34, FONT_TINY, 8, Colors::Cornsilk, to);
printAtMiddleLoc(s.name, 55, 10, FONT_SMALL, Colors::WHITE, to);
printAtMiddleWBLoc(CGI->generaltexth->arraytxt[206+whoCanPlay], 28, 34, FONT_TINY, 8, Colors::WHITE, to);
}
void OptionsTab::PlayerOptionsEntry::selectButtons()
@ -2278,7 +2506,7 @@ void OptionsTab::SelectedBox::showAll(SDL_Surface * to)
SDL_Surface *toBlit = getImg();
const std::string *toPrint = getText();
blitAt(toBlit, pos, to);
printAtMiddleLoc(*toPrint, 23, 39, FONT_TINY, Colors::Cornsilk, to);
printAtMiddleLoc(*toPrint, 23, 39, FONT_TINY, Colors::WHITE, to);
}
OptionsTab::SelectedBox::SelectedBox( SelType Which, ui8 Player )
@ -2503,7 +2731,7 @@ void OptionsTab::SelectedBox::clickRight( tribool down, bool previousState )
}
if(description)
CSDL_Ext::printAtMiddleWB(*description, 125, 145, FONT_SMALL, 37, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddleWB(*description, 125, 145, FONT_SMALL, 37, Colors::WHITE, bmp);
}
else if(val == -2)
{
@ -2514,7 +2742,7 @@ void OptionsTab::SelectedBox::clickRight( tribool down, bool previousState )
bmp = CMessage::drawDialogBox(256, 319);
title = &CGI->generaltexth->allTexts[80];
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[79], 135, 137, FONT_MEDIUM, Colors::Jasmine, bmp);
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[79], 135, 137, FONT_MEDIUM, Colors::YELLOW, bmp);
const CTown &t = CGI->townh->towns[val];
//print creatures
@ -2523,7 +2751,7 @@ void OptionsTab::SelectedBox::clickRight( tribool down, bool previousState )
{
int c = t.creatures[i][0];
blitAt(graphics->smallImgs[c], x, y, bmp);
CSDL_Ext::printAtMiddleWB(CGI->creh->creatures[c]->nameSing, x + 16, y + 45, FONT_TINY, 10, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddleWB(CGI->creh->creatures[c]->nameSing, x + 16, y + 45, FONT_TINY, 10, Colors::WHITE, bmp);
if(i == 2)
{
@ -2543,24 +2771,24 @@ void OptionsTab::SelectedBox::clickRight( tribool down, bool previousState )
bmp = CMessage::drawDialogBox(320, 255);
title = &CGI->generaltexth->allTexts[77];
CSDL_Ext::printAtMiddle(*title, 167, 36, FONT_MEDIUM, Colors::Jasmine, bmp);
CSDL_Ext::printAtMiddle(*subTitle + " - " + h->heroClass->name, 160, 99, FONT_SMALL, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddle(*title, 167, 36, FONT_MEDIUM, Colors::YELLOW, bmp);
CSDL_Ext::printAtMiddle(*subTitle + " - " + h->heroClass->name, 160, 99, FONT_SMALL, Colors::WHITE, bmp);
blitAt(getImg(), 136, 56, bmp);
//print specialty
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[78], 166, 132, FONT_MEDIUM, Colors::Jasmine, bmp);
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[78], 166, 132, FONT_MEDIUM, Colors::YELLOW, bmp);
blitAt(graphics->un44->ourImages[val].bitmap, 140, 150, bmp);
CSDL_Ext::printAtMiddle(CGI->generaltexth->hTxts[val].bonusName, 166, 203, FONT_SMALL, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddle(CGI->generaltexth->hTxts[val].bonusName, 166, 203, FONT_SMALL, Colors::WHITE, bmp);
GH.pushInt(new CInfoPopup(bmp, true));
return;
}
if(title)
CSDL_Ext::printAtMiddle(*title, 135, 36, FONT_MEDIUM, Colors::Jasmine, bmp);
CSDL_Ext::printAtMiddle(*title, 135, 36, FONT_MEDIUM, Colors::YELLOW, bmp);
if(subTitle)
CSDL_Ext::printAtMiddle(*subTitle, 127, 103, FONT_SMALL, Colors::Cornsilk, bmp);
CSDL_Ext::printAtMiddle(*subTitle, 127, 103, FONT_SMALL, Colors::WHITE, bmp);
blitAt(getImg(), 104, 60, bmp);
@ -2607,8 +2835,8 @@ CScenarioInfo::~CScenarioInfo()
bool mapSorter::operator()(const CMapInfo *aaa, const CMapInfo *bbb)
{
const CMapHeader * a = aaa->mapHeader.get(),
* b = bbb->mapHeader.get();
const CMapHeader * a = aaa->mapHeader.get(),
* b = bbb->mapHeader.get();
if(a && b) //if we are sorting scenarios
{
switch (sortBy)
@ -2710,7 +2938,7 @@ CHotSeatPlayers::CHotSeatPlayers(const std::string &firstPlayer)
std::string text = CGI->generaltexth->allTexts[446];
boost::replace_all(text, "\t","\n");
Rect boxRect(25, 20, 315, 50);
title = new CTextBox(text, boxRect, 0, FONT_BIG, CENTER, Colors::Cornsilk);//HOTSEAT Please enter names
title = new CTextBox(text, boxRect, 0, FONT_BIG, CENTER, Colors::WHITE);//HOTSEAT Please enter names
for(int i = 0; i < ARRAY_COUNT(txt); i++)
{
@ -2780,16 +3008,16 @@ void CBonusSelection::init()
//campaign name
if (ourCampaign->camp->header.name.length())
CSDL_Ext::printAt(ourCampaign->camp->header.name, 481, 28, FONT_BIG, Colors::Jasmine, background);
CSDL_Ext::printAt(ourCampaign->camp->header.name, 481, 28, FONT_BIG, Colors::YELLOW, background);
else
CSDL_Ext::printAt("Unnamed", 481, 28, FONT_BIG, Colors::Jasmine, background);
CSDL_Ext::printAt("Unnamed", 481, 28, FONT_BIG, Colors::YELLOW, background);
//map size icon
sizes = CDefHandler::giveDef("SCNRMPSZ.DEF");
//campaign description
CSDL_Ext::printAt(CGI->generaltexth->allTexts[38], 481, 63, FONT_SMALL, Colors::Jasmine, background);
CSDL_Ext::printAt(CGI->generaltexth->allTexts[38], 481, 63, FONT_SMALL, Colors::YELLOW, background);
cmpgDesc = new CTextBox(ourCampaign->camp->header.description, Rect(480, 86, 286, 117), 1);
//cmpgDesc->showAll(background);
@ -2798,7 +3026,7 @@ void CBonusSelection::init()
mapDesc = new CTextBox("", Rect(480, 280, 286, 117), 1);
//bonus choosing
CSDL_Ext::printAt(CGI->generaltexth->allTexts[71], 511, 432, FONT_MEDIUM, Colors::Cornsilk, background); //Choose a bonus:
CSDL_Ext::printAt(CGI->generaltexth->allTexts[71], 511, 432, FONT_MEDIUM, Colors::WHITE, background); //Choose a bonus:
bonuses = new CHighlightableButtonsGroup(bind(&CBonusSelection::selectBonus, this, _1));
//set left part of window
@ -2831,15 +3059,15 @@ void CBonusSelection::init()
// }
//allies / enemies
CSDL_Ext::printAt(CGI->generaltexth->allTexts[390] + ":", 486, 407, FONT_SMALL, Colors::Cornsilk, background); //Allies
CSDL_Ext::printAt(CGI->generaltexth->allTexts[391] + ":", 619, 407, FONT_SMALL, Colors::Cornsilk, background); //Enemies
CSDL_Ext::printAt(CGI->generaltexth->allTexts[390] + ":", 486, 407, FONT_SMALL, Colors::WHITE, background); //Allies
CSDL_Ext::printAt(CGI->generaltexth->allTexts[391] + ":", 619, 407, FONT_SMALL, Colors::WHITE, background); //Enemies
SDL_FreeSurface(panel);
//difficulty
std::vector<std::string> difficulty;
boost::split(difficulty, CGI->generaltexth->allTexts[492], boost::is_any_of(" "));
CSDL_Ext::printAt(difficulty.back(), 689, 432, FONT_MEDIUM, Colors::Cornsilk, background); //Difficulty
CSDL_Ext::printAt(difficulty.back(), 689, 432, FONT_MEDIUM, Colors::WHITE, background); //Difficulty
//difficulty pics
for (int b=0; b<ARRAY_COUNT(diffPics); ++b)
@ -2945,9 +3173,9 @@ void CBonusSelection::selectMap( int whichOne )
//get header
delete ourHeader;
std::string & headerStr = ourCampaign->camp->mapPieces.find(whichOne)->second;
auto buffer = reinterpret_cast<const ui8 *>(headerStr.data());
ourHeader = CMapService::loadMapHeader(buffer, headerStr.size()).release();
std::string & headerStr = ourCampaign->camp->mapPieces.find(whichOne)->second;
auto buffer = reinterpret_cast<const ui8 *>(headerStr.data());
ourHeader = CMapService::loadMapHeader(buffer, headerStr.size()).release();
std::map<TPlayerColor, std::string> names;
names[1] = settings["general"]["playerName"].String();
@ -2968,12 +3196,12 @@ void CBonusSelection::show(SDL_Surface * to)
std::string mapName = ourHeader->name;
if (mapName.length())
printAtLoc(mapName, 481, 219, FONT_BIG, Colors::Jasmine, to);
printAtLoc(mapName, 481, 219, FONT_BIG, Colors::YELLOW, to);
else
printAtLoc("Unnamed", 481, 219, FONT_BIG, Colors::Jasmine, to);
printAtLoc("Unnamed", 481, 219, FONT_BIG, Colors::YELLOW, to);
//map description
printAtLoc(CGI->generaltexth->allTexts[496], 481, 253, FONT_SMALL, Colors::Jasmine, to);
printAtLoc(CGI->generaltexth->allTexts[496], 481, 253, FONT_SMALL, Colors::YELLOW, to);
mapDesc->showAll(to); //showAll because CTextBox has no show()
@ -3485,6 +3713,9 @@ void PregameGuiAction::apply(CSelectionScreen *selScreen)
case OPEN_SCENARIO_LIST:
selScreen->toggleTab(selScreen->sel);
break;
case OPEN_RANDOM_MAP_OPTIONS:
selScreen->toggleTab(selScreen->randMapTab);
break;
}
}
@ -3585,7 +3816,7 @@ CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode &config )
addUsedEvents(LCLICK | HOVER);
image = new CPicture(config["image"].String());
hoverLabel = new CLabel(pos.w / 2, pos.h + 20, FONT_MEDIUM, CENTER, Colors::Jasmine, "");
hoverLabel = new CLabel(pos.w / 2, pos.h + 20, FONT_MEDIUM, CENTER, Colors::YELLOW, "");
parent->addChild(hoverLabel);
}

View File

@ -6,6 +6,7 @@
#include "GUIClasses.h"
#include "FunctionList.h"
#include "../lib/Map/CMapInfo.h"
#include "../lib/RMG/CMapGenOptions.h"
/*
* CPreGame.h, part of VCMI engine
@ -178,7 +179,7 @@ public:
void keyPressed(const SDL_KeyboardEvent & key);
void onDoubleClick();
SelectionTab(CMenuScreen::EState Type, const boost::function<void(CMapInfo *)> &OnSelect, CMenuScreen::EMultiMode MultiPlayer = CMenuScreen::SINGLE_PLAYER);
~SelectionTab();
~SelectionTab();
};
/// The options tab which is shown at the map selection phase.
@ -249,6 +250,107 @@ public:
bool canUseThisHero( int ID );
};
/**
* The random map tab shows options for generating a random map.
*/
class RandomMapTab : public CIntObject
{
public:
/**
* C-tor.
*/
RandomMapTab();
/**
* Shows the interface and the visual representation of this tab.
*
* @param to where the graphics should be inserted
*/
void showAll(SDL_Surface * to);
private:
/**
* Adds buttons specified by the defs list to the given buttons group.
*
* @param group the button group where the buttons should be added to
* @param defs the names of the button defs
* @param startIndex start index of the defs vector
* @param endIndex end index of the defs vector
* @param btnWidth width of one button(fixed width)
* @param helpStartIndex the index of the first help msg entry
*/
void addButtonsToGroup(CHighlightableButtonsGroup * group, const std::vector<std::string> & defs, int startIndex, int endIndex, int btnWidth, int helpStartIndex) const;
/**
* Adds buttons specified by the defs list and the random button to the given buttons group. Auto-selects the
* random button.
*
* @param group the button group where the buttons should be added to
* @param defs the names of the button defs
* @param startIndex start index of the defs vector
* @param endIndex end index of the defs vector
* @param btnWidth width of one button(fixed width)
* @param helpStartIndex the index of the first help msg entry
* @param helpRandIndex the index of the random help msg entry
*/
void addButtonsWithRandToGroup(CHighlightableButtonsGroup * group, const std::vector<std::string> & defs, int startIndex, int endIndex, int btnWidth, int helpStartIndex, int helpRandIndex) const;
/**
* Deactives buttons of a highlightable button group beginning from startId. Buttons with a id
* lower than startId will be activated/reseted.
*
* @param group the associated highlightable button group
* @param startId the id of the first button to deactivate
*/
void deactivateButtonsFrom(CHighlightableButtonsGroup * group, int startId);
/**
* Validates players count and updates teams count, comp only players/teams count if necessary.
*
* @param playersCnt the players count to validate
*/
void validatePlayersCnt(int playersCnt);
/**
* Validates computer only players count and updates comp only teams count if necessary.
*
* @param compOnlyPlayersCnt the computer only players count to validate
*/
void validateCompOnlyPlayersCnt(int compOnlyPlayersCnt);
/** the background image of the rmg options tab */
CPicture * bg;
/** the map size buttons group */
CHighlightableButtonsGroup * mapSizeBtnGroup;
/** the two levels highlightable button */
CHighlightableButton * twoLevelsBtn;
/** the players count group */
CHighlightableButtonsGroup * playersCntGroup;
/** the teams count group */
CHighlightableButtonsGroup * teamsCntGroup;
/** the computer only players count group */
CHighlightableButtonsGroup * compOnlyPlayersCntGroup;
/** the computer only teams count group */
CHighlightableButtonsGroup * compOnlyTeamsCntGroup;
/** the water content group */
CHighlightableButtonsGroup * waterContentGroup;
/** the monster strength group */
CHighlightableButtonsGroup * monsterStrengthGroup;
CAdventureMapButton * showRandMaps;
/** the map options selected by the user */
CMapGenOptions options;
};
/// Interface for selecting a map.
class ISelectionScreenInfo
{
@ -283,6 +385,7 @@ public:
CPicture *bg; //general bg image
InfoCard *card;
OptionsTab *opt;
RandomMapTab * randMapTab;
CAdventureMapButton *start, *back;
SelectionTab *sel;

View File

@ -130,7 +130,7 @@ CQuestLog::CQuestLog (const std::vector<QuestInfo> & Quests) :
void CQuestLog::init()
{
minimap = new CQuestMinimap (Rect (47, 33, 144, 144));
description = new CTextBox ("", Rect(245, 33, 350, 355), 1, FONT_MEDIUM, TOPLEFT, Colors::Cornsilk);
description = new CTextBox ("", Rect(245, 33, 350, 355), 1, FONT_MEDIUM, TOPLEFT, Colors::WHITE);
ok = new CAdventureMapButton("",CGI->generaltexth->zelp[445].second, boost::bind(&CQuestLog::close,this), 547, 401, "IOKAY.DEF", SDLK_RETURN);
if (quests.size() > QUEST_COUNT)
@ -142,7 +142,7 @@ void CQuestLog::init()
quests[i].quest->getRolloverText (text, false);
if (quests[i].obj)
text.addReplacement (quests[i].obj->getHoverText()); //get name of the object
CQuestLabel * label = new CQuestLabel (28, 199 + i * 24, FONT_SMALL, TOPLEFT, Colors::Cornsilk, text.toString());
CQuestLabel * label = new CQuestLabel (28, 199 + i * 24, FONT_SMALL, TOPLEFT, Colors::WHITE, text.toString());
label->callback = boost::bind(&CQuestLog::selectQuest, this, i);
label->setBounds (172, 30);
labels.push_back(label);

View File

@ -38,8 +38,8 @@ class CQuestLabel : public LRClickableAreaWText, public CBoundedLabel
public:
boost::function<void()> callback;
CQuestLabel (int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk, const std::string &Text = "")
: CBoundedLabel (x, y, FONT_SMALL, TOPLEFT, Colors::Cornsilk, Text){};
CQuestLabel (int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
: CBoundedLabel (x, y, FONT_SMALL, TOPLEFT, Colors::WHITE, Text){};
void clickLeft(tribool down, bool previousState);
void showAll(SDL_Surface * to);
};

View File

@ -321,7 +321,7 @@ void CSpellWindow::showAll(SDL_Surface * to)
std::ostringstream mana;
mana<<myHero->mana;
CSDL_Ext::printAtMiddle(mana.str(), pos.x+435, pos.y +426, FONT_SMALL, Colors::Jasmine, to);
CSDL_Ext::printAtMiddle(mana.str(), pos.x+435, pos.y +426, FONT_SMALL, Colors::YELLOW, to);
statusBar->showAll(to);
@ -841,13 +841,13 @@ void CSpellWindow::SpellArea::showAll(SDL_Surface * to)
if(spellCost > owner->myHero->mana) //hero cannot cast this spell
{
static const SDL_Color unavailableSpell = {239, 189, 33, 0};
firstLineColor = Colors::Cornsilk;
firstLineColor = Colors::WHITE;
secondLineColor = unavailableSpell;
}
else
{
firstLineColor = Colors::Jasmine;
secondLineColor = Colors::Cornsilk;
firstLineColor = Colors::YELLOW;
secondLineColor = Colors::WHITE;
}
//printing spell's name
CSDL_Ext::printAtMiddle(spell->name, pos.x + 39, pos.y + 70, FONT_TINY, firstLineColor, to);

View File

@ -69,7 +69,7 @@ void CArmyTooltip::init(const InfoAboutArmy &army)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
new CLabel(66, 2, FONT_SMALL, TOPLEFT, Colors::Cornsilk, army.name);
new CLabel(66, 2, FONT_SMALL, TOPLEFT, Colors::WHITE, army.name);
std::vector<Point> slotsPos;
slotsPos.push_back(Point(36,73));
@ -100,7 +100,7 @@ void CArmyTooltip::init(const InfoAboutArmy &army)
subtitle = CGI->generaltexth->arraytxt[171 + 3*(slot.second.count)];
}
new CLabel(slotsPos[slot.first].x + 17, slotsPos[slot.first].y + 41, FONT_TINY, CENTER, Colors::Cornsilk, subtitle);
new CLabel(slotsPos[slot.first].x + 17, slotsPos[slot.first].y + 41, FONT_TINY, CENTER, Colors::WHITE, subtitle);
}
}
@ -125,10 +125,10 @@ void CHeroTooltip::init(const InfoAboutHero &hero)
if(hero.details)
{
for (size_t i = 0; i < hero.details->primskills.size(); i++)
new CLabel(75 + 28 * i, 58, FONT_SMALL, CENTER, Colors::Cornsilk,
new CLabel(75 + 28 * i, 58, FONT_SMALL, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(hero.details->primskills[i]));
new CLabel(158, 98, FONT_TINY, CENTER, Colors::Cornsilk,
new CLabel(158, 98, FONT_TINY, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(hero.details->mana));
new CAnimImage("IMRL22", hero.details->morale + 3, 0, 5, 74);
@ -169,7 +169,7 @@ void CTownTooltip::init(const InfoAboutTown &town)
new CAnimImage("ITMTLS", town.details->hallLevel, 0, 67, 31);
if (town.details->goldIncome)
new CLabel(157, 58, FONT_TINY, CENTER, Colors::Cornsilk,
new CLabel(157, 58, FONT_TINY, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(town.details->goldIncome));
if(town.details->garrisonedHero) //garrisoned hero icon
@ -474,7 +474,7 @@ void CGarrisonSlot::showAll(SDL_Surface * to)
creatureImage->showAll(to);
char buf[15];
SDL_itoa(count,buf,10);
printTo(buf, pos.x+pos.w, pos.y+pos.h+1, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, Colors::Cornsilk, to);
printTo(buf, pos.x+pos.w, pos.y+pos.h+1, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, Colors::WHITE, to);
if((owner->highlighted==this)
|| (owner->splitting && owner->highlighted->creature == creature))
@ -608,7 +608,7 @@ CInfoWindow::CInfoWindow(std::string Text, int player, const TCompsInfo &comps,
buttons.push_back(button);
}
text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::Cornsilk);
text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE);
if(!text->slider)
{
text->pos.w = text->maxW;
@ -817,7 +817,7 @@ void CComponent::init(Etype Type, int Subtype, int Val, ESize imageSize)
BOOST_FOREACH(auto & line, textLines)
{
int height = graphics->fonts[FONT_SMALL]->height;
CLabel * label = new CLabel(pos.w/2, pos.h + height/2, FONT_SMALL, CENTER, Colors::Cornsilk, line);
CLabel * label = new CLabel(pos.w/2, pos.h + height/2, FONT_SMALL, CENTER, Colors::WHITE, line);
pos.h += height;
if (label->pos.w > pos.w)
@ -1129,7 +1129,7 @@ void CComponentBox::placeComponents(bool selectable)
{
Point orPos = Point(currentX, currentY) + getOrTextPos(prevComp, *iter);
new CLabel(orPos.x, orPos.y, FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[4]);
new CLabel(orPos.x, orPos.y, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[4]);
}
currentX += getDistance(prevComp, *iter);
}
@ -1205,7 +1205,7 @@ CSelWindow::CSelWindow(const std::string &Text, int player, int charperline, con
buttons[i]->callback += boost::bind(&CInfoWindow::close,this); //each button will close the window apart from call-defined actions
}
text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::Cornsilk);
text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE);
buttons.front()->assignedKeys.insert(SDLK_RETURN); //first button - reacts on enter
buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape
@ -1309,7 +1309,7 @@ CRecruitmentWindow::CCostBox::CCostBox(Rect position, std::string title)
type |= REDRAW_PARENT;
pos = position + pos;
OBJ_CONSTRUCTION_CAPTURING_ALL;
new CLabel(pos.w/2, 10, FONT_SMALL, CENTER, Colors::Cornsilk, title);
new CLabel(pos.w/2, 10, FONT_SMALL, CENTER, Colors::WHITE, title);
}
void CRecruitmentWindow::CCostBox::set(TResources res)
@ -1336,7 +1336,7 @@ void CRecruitmentWindow::CCostBox::createItems(TResources res)
while (iter.valid())
{
CAnimImage * image = new CAnimImage("RESOURCE", iter->resType);
CLabel * text = new CLabel(15, 43, FONT_SMALL, CENTER, Colors::Cornsilk, "0");
CLabel * text = new CLabel(15, 43, FONT_SMALL, CENTER, Colors::WHITE, "0");
resources.insert(std::make_pair(iter->resType, std::make_pair(text, image)));
iter++;
@ -1461,15 +1461,15 @@ CRecruitmentWindow::CRecruitmentWindow(const CGDwelling *Dwelling, int Level, co
buyButton = new CAdventureMapButton(CGI->generaltexth->zelp[554],boost::bind(&CRecruitmentWindow::buy,this),212,313,"IBY6432.DEF",SDLK_RETURN);
cancelButton = new CAdventureMapButton(CGI->generaltexth->zelp[555],boost::bind(&CRecruitmentWindow::close,this),290,313,"ICN6432.DEF",SDLK_ESCAPE);
title = new CLabel(243, 32, FONT_BIG, CENTER, Colors::Jasmine);
availableValue = new CLabel(205, 253, FONT_SMALL, CENTER, Colors::Cornsilk);
toRecruitValue = new CLabel(279, 253, FONT_SMALL, CENTER, Colors::Cornsilk);
title = new CLabel(243, 32, FONT_BIG, CENTER, Colors::YELLOW);
availableValue = new CLabel(205, 253, FONT_SMALL, CENTER, Colors::WHITE);
toRecruitValue = new CLabel(279, 253, FONT_SMALL, CENTER, Colors::WHITE);
costPerTroopValue = new CCostBox(Rect(65, 222, 97, 74), CGI->generaltexth->allTexts[346]);
totalCostValue = new CCostBox(Rect(323, 222, 97, 74), CGI->generaltexth->allTexts[466]);
new CLabel(205, 233, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[465]); //available t
new CLabel(279, 233, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[16]); //recruit t
new CLabel(205, 233, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[465]); //available t
new CLabel(279, 233, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[16]); //recruit t
availableCreaturesChanged();
}
@ -1590,7 +1590,7 @@ CSplitWindow::CSplitWindow(const CCreature * creature, boost::function<void(int,
std::string title = CGI->generaltexth->allTexts[256];
boost::algorithm::replace_first(title,"%s", creature->namePl);
new CLabel(150, 34, FONT_BIG, CENTER, Colors::Jasmine, title);
new CLabel(150, 34, FONT_BIG, CENTER, Colors::YELLOW, title);
}
void CSplitWindow::setAmountText(std::string text, bool left)
@ -1638,16 +1638,16 @@ CLevelWindow::CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<u
new CAdventureMapButton("", "", boost::bind(&CLevelWindow::close, this), 297, 413, "IOKAY", SDLK_RETURN);
//%s has gained a level.
new CLabel(192, 33, FONT_MEDIUM, CENTER, Colors::Cornsilk,
new CLabel(192, 33, FONT_MEDIUM, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[444]) % hero->name));
//%s is now a level %d %s.
new CLabel(192, 162, FONT_MEDIUM, CENTER, Colors::Cornsilk,
new CLabel(192, 162, FONT_MEDIUM, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[445]) % hero->name % hero->level % hero->type->heroClass->name));
new CAnimImage("PSKIL42", pskill, 0, 174, 190);
new CLabel(192, 253, FONT_MEDIUM, CENTER, Colors::Cornsilk,
new CLabel(192, 253, FONT_MEDIUM, CENTER, Colors::WHITE,
CGI->generaltexth->primarySkillNames[pskill] + " +1");
if (!skills.empty())
@ -1688,7 +1688,7 @@ void CMinorResDataBar::showAll(SDL_Surface * to)
for (int i=0;i<7;i++)
{
SDL_itoa(LOCPLINT->cb->getResourceAmount(i),buf,10);
CSDL_Ext::printAtMiddle(buf,pos.x + 50 + 76*i,pos.y+pos.h/2,FONT_SMALL,Colors::Cornsilk,to);
CSDL_Ext::printAtMiddle(buf,pos.x + 50 + 76*i,pos.y+pos.h/2,FONT_SMALL,Colors::WHITE,to);
}
std::vector<std::string> temp;
SDL_itoa(LOCPLINT->cb->getDate(3),buf,10); temp.push_back(std::string(buf));
@ -1701,7 +1701,7 @@ void CMinorResDataBar::showAll(SDL_Surface * to)
+ ": %s, "
+ CGI->generaltexth->allTexts[64]
+ ": %s",temp)
,pos.x+545+(pos.w-545)/2,pos.y+pos.h/2,FONT_SMALL,Colors::Cornsilk,to);
,pos.x+545+(pos.w-545)/2,pos.y+pos.h/2,FONT_SMALL,Colors::WHITE,to);
}
CMinorResDataBar::CMinorResDataBar()
@ -1729,7 +1729,7 @@ CObjectListWindow::CItem::CItem(CObjectListWindow *_parent, size_t _id, std::str
addUsedEvents(LCLICK);
type |= REDRAW_PARENT;
text = new CLabel(pos.w/2, pos.h/2, FONT_SMALL, CENTER, Colors::Cornsilk, _text);
text = new CLabel(pos.w/2, pos.h/2, FONT_SMALL, CENTER, Colors::WHITE, _text);
select(index == parent->selected);
}
@ -1779,8 +1779,8 @@ void CObjectListWindow::init(CPicture * titlePic, std::string _title, std::strin
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
title = new CLabel(152, 27, FONT_BIG, CENTER, Colors::Jasmine, _title);
descr = new CLabel(145, 133, FONT_SMALL, CENTER, Colors::Cornsilk, _descr);
title = new CLabel(152, 27, FONT_BIG, CENTER, Colors::YELLOW, _title);
descr = new CLabel(145, 133, FONT_SMALL, CENTER, Colors::WHITE, _descr);
ok = new CAdventureMapButton("","",boost::bind(&CObjectListWindow::elementSelected, this),15,402,"IOKAY.DEF", SDLK_RETURN);
ok->block(true);
@ -1916,7 +1916,7 @@ void CTradeWindow::CTradeableItem::showAll(SDL_Surface * to)
if(SDL_Surface *hlp = getSurface())
blitAt(hlp, pos + posToBitmap, to);
printAtMiddleLoc(subtitle, posToSubCenter, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(subtitle, posToSubCenter, FONT_SMALL, Colors::WHITE, to);
}
void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
@ -2462,7 +2462,7 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
}
}
new CLabel(300, 27, FONT_BIG, CENTER, Colors::Jasmine, title);
new CLabel(300, 27, FONT_BIG, CENTER, Colors::YELLOW, title);
initItems(false);
initItems(true);
@ -2494,17 +2494,17 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
case EMarketMode::RESOURCE_RESOURCE:
case EMarketMode::RESOURCE_PLAYER:
case EMarketMode::RESOURCE_ARTIFACT:
new CLabel(154, 148, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[270]);
new CLabel(154, 148, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[270]);
break;
case EMarketMode::CREATURE_RESOURCE:
//%s's Creatures
new CLabel(152, 102, FONT_SMALL, CENTER, Colors::Cornsilk,
new CLabel(152, 102, FONT_SMALL, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name));
break;
case EMarketMode::ARTIFACT_RESOURCE:
//%s's Artifacts
new CLabel(152, 102, FONT_SMALL, CENTER, Colors::Cornsilk,
new CLabel(152, 102, FONT_SMALL, CENTER, Colors::WHITE,
boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name));
break;
}
@ -2516,11 +2516,11 @@ CMarketplaceWindow::CMarketplaceWindow(const IMarket *Market, const CGHeroInstan
case EMarketMode::CREATURE_RESOURCE:
case EMarketMode::RESOURCE_ARTIFACT:
case EMarketMode::ARTIFACT_RESOURCE:
new CLabel(445, 148, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[168]);
new CLabel(445, 148, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[168]);
traderTextRect = Rect(316, 48, 260, 75);
break;
case EMarketMode::RESOURCE_PLAYER:
new CLabel(445, 55, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->allTexts[169]);
new CLabel(445, 55, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->allTexts[169]);
traderTextRect = Rect(28, 48, 260, 75);
break;
}
@ -2872,14 +2872,14 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*=
if(Mode == EMarketMode::CREATURE_EXP)
{
//%s's Creatures
new CLabel(155, 30, FONT_SMALL, CENTER, Colors::Jasmine,
new CLabel(155, 30, FONT_SMALL, CENTER, Colors::YELLOW,
boost::str(boost::format(CGI->generaltexth->allTexts[272]) % hero->name));
//Altar of Sacrifice
new CLabel(450, 30, FONT_SMALL, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[479]);
new CLabel(450, 30, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[479]);
//To sacrifice creatures, move them from your army on to the Altar and click Sacrifice
new CTextBox(CGI->generaltexth->allTexts[480], Rect(320, 56, 256, 40), 0, FONT_SMALL, CENTER, Colors::Jasmine);
new CTextBox(CGI->generaltexth->allTexts[480], Rect(320, 56, 256, 40), 0, FONT_SMALL, CENTER, Colors::YELLOW);
slider = new CSlider(231,481,137,0,0,0);
slider->moved = boost::bind(&CAltarWindow::sliderMoved,this,_1);
@ -2895,9 +2895,9 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*=
else
{
//Sacrifice artifacts for experience
new CLabel(450, 34, FONT_SMALL, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[477]);
new CLabel(450, 34, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[477]);
//%s's Creatures
new CLabel(302, 423, FONT_SMALL, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[478]);
new CLabel(302, 423, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[478]);
sacrificeAll = new CAdventureMapButton(CGI->generaltexth->zelp[571], boost::bind(&CAltarWindow::SacrificeAll,this),393,520,"ALTFILL.DEF");
sacrificeAll->block(hero->artifactsInBackpack.empty() && hero->artifactsWorn.empty());
@ -2912,9 +2912,9 @@ CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*=
}
//Experience needed to reach next level
new CTextBox(CGI->generaltexth->allTexts[475], Rect(15, 415, 125, 50), 0, FONT_SMALL, CENTER, Colors::Jasmine);
new CTextBox(CGI->generaltexth->allTexts[475], Rect(15, 415, 125, 50), 0, FONT_SMALL, CENTER, Colors::YELLOW);
//Total experience on the Altar
new CTextBox(CGI->generaltexth->allTexts[476], Rect(15, 495, 125, 40), 0, FONT_SMALL, CENTER, Colors::Jasmine);
new CTextBox(CGI->generaltexth->allTexts[476], Rect(15, 495, 125, 40), 0, FONT_SMALL, CENTER, Colors::YELLOW);
new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
@ -3215,7 +3215,7 @@ void CAltarWindow::showAll(SDL_Surface * to)
int dmp, val;
market->getOffer(arts->commonInfo->src.art->artType->id, 0, dmp, val, EMarketMode::ARTIFACT_EXP);
printAtMiddleLoc(boost::lexical_cast<std::string>(val), 304, 498, FONT_SMALL, Colors::Cornsilk, to);
printAtMiddleLoc(boost::lexical_cast<std::string>(val), 304, 498, FONT_SMALL, Colors::WHITE, to);
}
}
@ -3310,10 +3310,10 @@ CSystemOptionsWindow::CSystemOptionsWindow():
static const std::string rsHelp = "{Select resolution}\n\n Change in-game screen resolution. Will only affect adventure map. Game restart required to apply new resolution.";
OBJ_CONSTRUCTION_CAPTURING_ALL;
title = new CLabel(242, 32, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[568]);
title = new CLabel(242, 32, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[568]);
//left window section
leftGroup = new CLabelGroup(FONT_MEDIUM, CENTER, Colors::Jasmine);
leftGroup = new CLabelGroup(FONT_MEDIUM, CENTER, Colors::YELLOW);
leftGroup->add(122, 64, CGI->generaltexth->allTexts[569]);
leftGroup->add(122, 130, CGI->generaltexth->allTexts[570]);
leftGroup->add(122, 196, CGI->generaltexth->allTexts[571]);
@ -3322,7 +3322,7 @@ CSystemOptionsWindow::CSystemOptionsWindow():
leftGroup->add(122, 412, CGI->generaltexth->allTexts[395]);
//right section
rightGroup = new CLabelGroup(FONT_MEDIUM, TOPLEFT, Colors::Cornsilk);
rightGroup = new CLabelGroup(FONT_MEDIUM, TOPLEFT, Colors::WHITE);
rightGroup->add(282, 57, CGI->generaltexth->allTexts[572]);
rightGroup->add(282, 89, CGI->generaltexth->allTexts[573]);
rightGroup->add(282, 121, CGI->generaltexth->allTexts[574]);
@ -3414,7 +3414,7 @@ CSystemOptionsWindow::CSystemOptionsWindow():
resText += boost::lexical_cast<std::string>(settings["video"]["screenRes"]["width"].Float());
resText += "x";
resText += boost::lexical_cast<std::string>(settings["video"]["screenRes"]["height"].Float());
gameResLabel = new CLabel(170, 292, FONT_MEDIUM, CENTER, Colors::Jasmine, resText);
gameResLabel = new CLabel(170, 292, FONT_MEDIUM, CENTER, Colors::YELLOW, resText);
}
@ -3528,9 +3528,9 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj):
selected = -1;
oldSelected = -1;
new CLabel(200, 35, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->jktexts[37]);
new CLabel(320, 328, FONT_SMALL, CENTER, Colors::Cornsilk, "2500");
new CTextBox(LOCPLINT->cb->getTavernGossip(tavernObj), Rect(32, 190, 330, 68), 0, FONT_SMALL, CENTER, Colors::Cornsilk);
new CLabel(200, 35, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[37]);
new CLabel(320, 328, FONT_SMALL, CENTER, Colors::WHITE, "2500");
new CTextBox(LOCPLINT->cb->getTavernGossip(tavernObj), Rect(32, 190, 330, 68), 0, FONT_SMALL, CENTER, Colors::WHITE);
new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
cancel = new CAdventureMapButton(CGI->generaltexth->tavernInfo[7],"", boost::bind(&CTavernWindow::close, this), 310, 428, "ICANCEL.DEF", SDLK_ESCAPE);
@ -3599,7 +3599,7 @@ void CTavernWindow::show(SDL_Surface * to)
boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",sel->h->type->heroClass->name);
}
printAtMiddleWB(sel->descr,pos.x+146,pos.y+389,FONT_SMALL,40,Colors::Cornsilk,to);
printAtMiddleWB(sel->descr,pos.x+146,pos.y+389,FONT_SMALL,40,Colors::WHITE,to);
CSDL_Ext::drawBorder(to,sel->pos.x-2,sel->pos.y-2,sel->pos.w+4,sel->pos.h+4,int3(247,223,123));
}
}
@ -3879,7 +3879,7 @@ CGarrisonWindow::CGarrisonWindow( const CArmedInstance *up, const CGHeroInstance
titleText = CGI->generaltexth->allTexts[35];
boost::algorithm::replace_first(titleText, "%s", garr->armedObjs[0]->Slots().begin()->second->type->namePl);
}
new CLabel(275, 30, FONT_BIG, CENTER, Colors::Jasmine, titleText);
new CLabel(275, 30, FONT_BIG, CENTER, Colors::YELLOW, titleText);
new CAnimImage("CREST58", garr->armedObjs[0]->getOwner(), 0, 28, 124);
new CAnimImage("PortraitsLarge", dynamic_cast<const CGHeroInstance*>(garr->armedObjs[1])->portrait, 0, 29, 222);
@ -4827,8 +4827,8 @@ void CExchangeWindow::prepareBackground()
% h->name % h->level % h->type->heroClass->name);
};
new CLabel(147, 25, FONT_SMALL, CENTER, Colors::Cornsilk, genTitle(heroInst[0]));
new CLabel(653, 25, FONT_SMALL, CENTER, Colors::Cornsilk, genTitle(heroInst[1]));
new CLabel(147, 25, FONT_SMALL, CENTER, Colors::WHITE, genTitle(heroInst[0]));
new CLabel(653, 25, FONT_SMALL, CENTER, Colors::WHITE, genTitle(heroInst[1]));
//printing primary skills
for(int g=0; g<4; ++g)
@ -4840,7 +4840,7 @@ void CExchangeWindow::prepareBackground()
CHeroWithMaybePickedArtifact heroWArt = CHeroWithMaybePickedArtifact(this, heroInst[b]);
//printing primary skills' amounts
for(int m=0; m<4; ++m)
new CLabel(352 + 93 * b, 35 + 36 * m, FONT_SMALL, CENTER, Colors::Cornsilk,
new CLabel(352 + 93 * b, 35 + 36 * m, FONT_SMALL, CENTER, Colors::WHITE,
boost::lexical_cast<std::string>(heroWArt.getPrimSkillLevel(m)));
//printing secondary skills
@ -4856,11 +4856,11 @@ void CExchangeWindow::prepareBackground()
//experience
new CAnimImage("PSKIL32", 4, 0, 103 + 490*b, 45);
new CLabel(119 + 490*b, 71, FONT_SMALL, CENTER, Colors::Cornsilk, makeNumberShort(heroInst[b]->exp));
new CLabel(119 + 490*b, 71, FONT_SMALL, CENTER, Colors::WHITE, makeNumberShort(heroInst[b]->exp));
//mana points
new CAnimImage("PSKIL32", 5, 0, 139 + 490*b, 45);
new CLabel(155 + 490*b, 71, FONT_SMALL, CENTER, Colors::Cornsilk, makeNumberShort(heroInst[b]->mana));
new CLabel(155 + 490*b, 71, FONT_SMALL, CENTER, Colors::WHITE, makeNumberShort(heroInst[b]->mana));
}
//printing portraits
@ -4991,8 +4991,8 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int b
std::string goldValue = boost::lexical_cast<std::string>(cost[Res::GOLD]);
std::string woodValue = boost::lexical_cast<std::string>(cost[Res::WOOD]);
goldCost = new CLabel(118, 294, FONT_SMALL, CENTER, Colors::Cornsilk, goldValue);
woodCost = new CLabel(212, 294, FONT_SMALL, CENTER, Colors::Cornsilk, woodValue);
goldCost = new CLabel(118, 294, FONT_SMALL, CENTER, Colors::WHITE, goldValue);
woodCost = new CLabel(212, 294, FONT_SMALL, CENTER, Colors::WHITE, woodValue);
goldPic = new CAnimImage("RESOURCE", Res::GOLD, 0, 100, 244);
woodPic = new CAnimImage("RESOURCE", Res::WOOD, 0, 196, 244);
@ -5012,8 +5012,8 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int b
statusBar = new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
title = new CLabel(164, 27, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->jktexts[13]);
costLabel = new CLabel(164, 220, FONT_MEDIUM, CENTER, Colors::Cornsilk, CGI->generaltexth->jktexts[14]);
title = new CLabel(164, 27, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[13]);
costLabel = new CLabel(164, 220, FONT_MEDIUM, CENTER, Colors::WHITE, CGI->generaltexth->jktexts[14]);
}
CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio):
@ -5030,7 +5030,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &GrailPos, double discoveredRatio):
quitb->borderEnabled = true;
new CPicture("PUZZLOGO", 607, 3);
new CLabel(700, 95, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[463]);
new CLabel(700, 95, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[463]);
new CResDataBar("ZRESBAR.bmp", 3, 575, 32, 2, 85, 85);
int faction = LOCPLINT->cb->getStartInfo()->playerInfos.find(LOCPLINT->playerID)->second.castle;
@ -5122,7 +5122,7 @@ CTransformerWindow::CItem::CItem(CTransformerWindow * parent, int size, int id):
pos.x += 45 + (id%3)*83 + id/6*83;
pos.y += 109 + (id/3)*98;
icon = new CAnimImage("TWCRPORT", parent->army->getCreature(id)->idNumber + 2);
new CLabel(28, 76,FONT_SMALL, CENTER, Colors::Cornsilk, boost::lexical_cast<std::string>(size));//stack size
new CLabel(28, 76,FONT_SMALL, CENTER, Colors::WHITE, boost::lexical_cast<std::string>(size));//stack size
}
void CTransformerWindow::makeDeal()
@ -5168,10 +5168,10 @@ CTransformerWindow::CTransformerWindow(const CGHeroInstance * _hero, const CGTow
cancel = new CAdventureMapButton(CGI->generaltexth->zelp[592],boost::bind(&CTransformerWindow::close, this),392,416,"ICANCEL.DEF",SDLK_ESCAPE);
bar = new CGStatusBar(new CPicture(*background, Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
new CLabel(153, 29,FONT_SMALL, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[485]);//holding area
new CLabel(153+295, 29, FONT_SMALL, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[486]);//transformer
new CTextBox(CGI->generaltexth->allTexts[487], Rect(26, 56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::Jasmine);//move creatures to create skeletons
new CTextBox(CGI->generaltexth->allTexts[488], Rect(320, 56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::Jasmine);//creatures here will become skeletons
new CLabel(153, 29,FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[485]);//holding area
new CLabel(153+295, 29, FONT_SMALL, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[486]);//transformer
new CTextBox(CGI->generaltexth->allTexts[487], Rect(26, 56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::YELLOW);//move creatures to create skeletons
new CTextBox(CGI->generaltexth->allTexts[488], Rect(320, 56, 255, 40), 0, FONT_MEDIUM, CENTER, Colors::YELLOW);//creatures here will become skeletons
}
@ -5240,8 +5240,8 @@ void CUniversityWindow::CItem::showAll(SDL_Surface * to)
blitAtLoc(bar->bg, -28, -22, to);
blitAtLoc(bar->bg, -28, 48, to);
printAtMiddleLoc (CGI->generaltexth->skillName[ID], 22, -13, FONT_SMALL, Colors::Cornsilk,to);//Name
printAtMiddleLoc (CGI->generaltexth->levels[0], 22, 57, FONT_SMALL, Colors::Cornsilk,to);//Level(always basic)
printAtMiddleLoc (CGI->generaltexth->skillName[ID], 22, -13, FONT_SMALL, Colors::WHITE,to);//Name
printAtMiddleLoc (CGI->generaltexth->levels[0], 22, 57, FONT_SMALL, Colors::WHITE,to);//Level(always basic)
CAnimImage::showAll(to);
}
@ -5283,10 +5283,10 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket
titlePic->center(Point(232 + pos.x, 76 + pos.y));
//Clerk speech
new CTextBox(CGI->generaltexth->allTexts[603], Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::Cornsilk);
new CTextBox(CGI->generaltexth->allTexts[603], Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE);
//University
new CLabel(231, 26, FONT_MEDIUM, CENTER, Colors::Jasmine, CGI->generaltexth->allTexts[602]);
new CLabel(231, 26, FONT_MEDIUM, CENTER, Colors::YELLOW, CGI->generaltexth->allTexts[602]);
std::vector<int> list = market->availableItemsIds(EMarketMode::RESOURCE_SKILL);
@ -5312,14 +5312,14 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bo
boost::replace_first(text, "%s", CGI->generaltexth->skillName[SKILL]);
boost::replace_first(text, "%d", "2000");
new CTextBox(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::Cornsilk);//Clerk speech
new CTextBox(text, Rect(24, 129, 413, 70), 0, FONT_SMALL, CENTER, Colors::WHITE);//Clerk speech
new CLabel(230, 37, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth-> skillName[SKILL]);//Skill name
new CLabel(230, 37, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth-> skillName[SKILL]);//Skill name
new CAnimImage("SECSKILL", SKILL*3+3, 0, 211, 51);//skill
new CLabel(230, 107, FONT_SMALL, CENTER, Colors::Cornsilk, CGI->generaltexth->levels[1]);//Skill level
new CLabel(230, 107, FONT_SMALL, CENTER, Colors::WHITE, CGI->generaltexth->levels[1]);//Skill level
new CAnimImage("RESOURCE", Res::GOLD, 0, 210, 210);//gold
new CLabel(230, 267, FONT_SMALL, CENTER, Colors::Cornsilk, "2000");//Cost
new CLabel(230, 267, FONT_SMALL, CENTER, Colors::WHITE, "2000");//Cost
std::string hoverText = CGI->generaltexth->allTexts[609];
boost::replace_first(hoverText, "%s", CGI->generaltexth->levels[0]+ " " + CGI->generaltexth->skillName[SKILL]);
@ -5354,7 +5354,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance *visitor, const CGObjectIn
slotsCount=7;
resources = CDefHandler::giveDefEss("SMALRES.DEF");
new CLabel(325, 32, FONT_BIG, CENTER, Colors::Jasmine, fort->hoverName);//Hill Fort
new CLabel(325, 32, FONT_BIG, CENTER, Colors::YELLOW, fort->hoverName);//Hill Fort
heroPic = new CHeroArea(30, 60, hero);
@ -5457,14 +5457,14 @@ void CHillFortWindow::showAll (SDL_Surface *to)
if(!val) continue;
blitAtLoc(resources->ourImages[j].bitmap, 104+76*i, curY, to);
printToLoc(boost::lexical_cast<std::string>(val), 168+76*i, curY+16, FONT_SMALL, Colors::Cornsilk, to);
printToLoc(boost::lexical_cast<std::string>(val), 168+76*i, curY+16, FONT_SMALL, Colors::WHITE, to);
curY += 20;
}
}
else//free upgrade - print gold image and "Free" text
{
blitAtLoc(resources->ourImages[6].bitmap, 104+76*i, 128, to);
printToLoc(CGI->generaltexth->allTexts[344], 168+76*i, 144, FONT_SMALL, Colors::Cornsilk, to);
printToLoc(CGI->generaltexth->allTexts[344], 168+76*i, 144, FONT_SMALL, Colors::WHITE, to);
}
}
}
@ -5473,7 +5473,7 @@ void CHillFortWindow::showAll (SDL_Surface *to)
if (totalSumm[i])//this resource is used - display it
{
blitAtLoc(resources->ourImages[i].bitmap, 104+76*i, 237, to);
printToLoc(boost::lexical_cast<std::string>(totalSumm[i]), 166+76*i, 253, FONT_SMALL, Colors::Cornsilk, to);
printToLoc(boost::lexical_cast<std::string>(totalSumm[i]), 166+76*i, 253, FONT_SMALL, Colors::WHITE, to);
}
}
}
@ -5563,14 +5563,14 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
std::string text = CGI->generaltexth->jktexts[24+g];
boost::algorithm::trim_if(text,boost::algorithm::is_any_of("\""));
new CLabel(135, y, FONT_MEDIUM, CENTER, Colors::Jasmine, text);
new CLabel(135, y, FONT_MEDIUM, CENTER, Colors::YELLOW, text);
}
for(int g=1; g<tgi.playerColors.size(); ++g)
new CAnimImage("PRSTRIPS", g-1, 0, 250 + 66*g, 7);
for(int g=0; g<tgi.playerColors.size(); ++g)
new CLabel(283 + 66*g, 24, FONT_BIG, CENTER, Colors::Jasmine, CGI->generaltexth->jktexts[16+g]);
new CLabel(283 + 66*g, 24, FONT_BIG, CENTER, Colors::YELLOW, CGI->generaltexth->jktexts[16+g]);
//printing flags
for(int g = 0; g < ARRAY_COUNT(fields); ++g) //by lines
@ -5618,10 +5618,10 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
if(iter.second.details)
{
new CTextBox(CGI->generaltexth->allTexts[184], Rect(260 + 66*counter, 396, 52, 64),
0, FONT_TINY, TOPLEFT, Colors::Cornsilk);
0, FONT_TINY, TOPLEFT, Colors::WHITE);
for (int i=0; i<iter.second.details->primskills.size(); ++i)
{
new CLabel(310 + 66 * counter, 407 + 11*i, FONT_TINY, BOTTOMRIGHT, Colors::Cornsilk,
new CLabel(310 + 66 * counter, 407 + 11*i, FONT_TINY, BOTTOMRIGHT, Colors::WHITE,
boost::lexical_cast<std::string>(iter.second.details->primskills[i]));
}
}
@ -5652,7 +5652,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
text = CGI->generaltexth->arraytxt[168 + it.second];
}
new CLabel(283 + 66*counter, 459, FONT_SMALL, CENTER, Colors::Cornsilk, text);
new CLabel(283 + 66*counter, 459, FONT_SMALL, CENTER, Colors::WHITE, text);
counter++;
}

View File

@ -129,11 +129,6 @@ struct SSetCaptureState
~SSetCaptureState();
};
namespace Colors
{
}
#define OBJ_CONSTRUCTION SObjectConstruction obj__i(this)
#define OBJ_CONSTRUCTION_CAPTURING_ALL defActions = 255; SSetCaptureState obj__i1(true, 255); SObjectConstruction obj__i(this)
#define BLOCK_CAPTURING SSetCaptureState obj__i(false, 0)

View File

@ -127,12 +127,12 @@ CIntObject::~CIntObject()
parent_m->removeChild(this);
}
void CIntObject::printAtLoc( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::Cornsilk*/, SDL_Surface * dst/*=screen*/ )
void CIntObject::printAtLoc( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::WHITE*/, SDL_Surface * dst/*=screen*/ )
{
CSDL_Ext::printAt(text, pos.x + x, pos.y + y, font, kolor, dst);
}
void CIntObject::printAtMiddleLoc( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::Cornsilk*/, SDL_Surface * dst/*=screen*/ )
void CIntObject::printAtMiddleLoc( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::WHITE*/, SDL_Surface * dst/*=screen*/ )
{
CSDL_Ext::printAtMiddle(text, pos.x + x, pos.y + y, font, kolor, dst);
}

View File

@ -1147,7 +1147,7 @@ void CStatusBar::show(SDL_Surface * to)
SDL_Rect srcRect = genRect(pos.h,pos.w,0,0);
SDL_Rect dstRect = genRect(pos.h,pos.w,pos.x,pos.y);
CSDL_Ext::blitSurface(bg,&srcRect,to,&dstRect);
CSDL_Ext::printAtMiddle(current,middlex,middley,FONT_SMALL,Colors::Cornsilk,to);
CSDL_Ext::printAtMiddle(current,middlex,middley,FONT_SMALL,Colors::WHITE,to);
}
std::string CStatusBar::getCurrent()
@ -1218,7 +1218,7 @@ void CLabel::showAll(SDL_Surface * to)
printer[alignment](toPrint, pos.x + textOffset.x, pos.y + textOffset.y, font, color, to);
}
CLabel::CLabel(int x, int y, EFonts Font /*= FONT_SMALL*/, EAlignment Align, const SDL_Color &Color /*= Colors::Cornsilk*/, const std::string &Text /*= ""*/)
CLabel::CLabel(int x, int y, EFonts Font /*= FONT_SMALL*/, EAlignment Align, const SDL_Color &Color /*= Colors::WHITE*/, const std::string &Text /*= ""*/)
:alignment(Align), font(Font), color(Color), text(Text)
{
autoRedraw = true;
@ -1279,7 +1279,7 @@ void CBoundedLabel::blitLine(SDL_Surface *to, Point where, std::string what)
end = what.find_first_of(delimeters[currDelimeter % 2], begin);
std::string toPrint = what.substr(begin, end);
if (currDelimeter % 2)
CSDL_Ext::printAt(toPrint, where.x, where.y, font, Colors::Jasmine, to);
CSDL_Ext::printAt(toPrint, where.x, where.y, font, Colors::YELLOW, to);
else
CSDL_Ext::printAt(toPrint, where.x, where.y, font, color, to);
begin = end;
@ -1344,7 +1344,7 @@ void CLabelGroup::add(int x, int y, const std::string &text)
new CLabel(x, y, font, align, color, text);
}
CTextBox::CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font /*= FONT_SMALL*/, EAlignment Align /*= TOPLEFT*/, const SDL_Color &Color /*= Colors::Cornsilk*/)
CTextBox::CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font /*= FONT_SMALL*/, EAlignment Align /*= TOPLEFT*/, const SDL_Color &Color /*= Colors::WHITE*/)
:CBoundedLabel(rect.x, rect.y, Font, Align, Color, Text), sliderStyle(SliderStyle), slider(NULL)
{
type |= REDRAW_PARENT;
@ -1436,13 +1436,13 @@ std::string CGStatusBar::getCurrent()
return text;
}
//CGStatusBar::CGStatusBar(int x, int y, EFonts Font /*= FONT_SMALL*/, EAlignment Align, const SDL_Color &Color /*= Colors::Cornsilk*/, const std::string &Text /*= ""*/)
//CGStatusBar::CGStatusBar(int x, int y, EFonts Font /*= FONT_SMALL*/, EAlignment Align, const SDL_Color &Color /*= Colors::WHITE*/, const std::string &Text /*= ""*/)
//: CLabel(x, y, Font, Align, Color, Text)
//{
// init();
//}
CGStatusBar::CGStatusBar(CPicture *BG, EFonts Font /*= FONT_SMALL*/, EAlignment Align /*= CENTER*/, const SDL_Color &Color /*= Colors::Cornsilk*/)
CGStatusBar::CGStatusBar(CPicture *BG, EFonts Font /*= FONT_SMALL*/, EAlignment Align /*= CENTER*/, const SDL_Color &Color /*= Colors::WHITE*/)
: CLabel(BG->pos.x, BG->pos.y, Font, Align, Color, "")
{
init();

View File

@ -99,7 +99,7 @@ public:
bool swappedImages,//fix for some buttons: normal and pressed image are swapped
keepFrame; // don't change visual representation
void addTextOverlay(const std::string &Text, EFonts font, SDL_Color color = Colors::Cornsilk);
void addTextOverlay(const std::string &Text, EFonts font, SDL_Color color = Colors::WHITE);
void update();//to refresh button after image or text change
void setOffset(int newOffset);
@ -347,7 +347,7 @@ public:
virtual void setTxt(const std::string &Txt);
void showAll(SDL_Surface * to); //shows statusbar (with current text)
CLabel(int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk, const std::string &Text = "");
CLabel(int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "");
};
class CBoundedLabel : public CLabel
@ -361,7 +361,7 @@ public:
std::vector<std::string> lines;
CBoundedLabel(int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk, const std::string &Text = "")
CBoundedLabel(int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
: CLabel (x, y, Font, Align, Color, Text){};
void setTxt(const std::string &Txt);
void setBounds(int limitW, int limitH);
@ -377,7 +377,7 @@ class CLabelGroup : public CIntObject
EAlignment align;
const SDL_Color &color;
public:
CLabelGroup(EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk);
CLabelGroup(EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE);
void add(int x=0, int y=0, const std::string &text = "");
};
@ -391,8 +391,8 @@ public:
std::vector<CAnimImage* > effects;
CSlider *slider;
//CTextBox( std::string Text, const Point &Pos, int w, int h, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk);
CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::Cornsilk);
//CTextBox( std::string Text, const Point &Pos, int w, int h, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE);
CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE);
void showAll(SDL_Surface * to); //shows statusbar (with current text)
void recalculateLines(const std::string &Txt);
@ -412,8 +412,8 @@ public:
std::string getCurrent(); //returns currently displayed text
void show(SDL_Surface * to); //shows statusbar (with current text)
//CGStatusBar(int x, int y, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = Colors::Cornsilk, const std::string &Text = "");
CGStatusBar(CPicture *BG, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = Colors::Cornsilk); //given CPicture will be captured by created sbar and it's pos will be used as pos for sbar
//CGStatusBar(int x, int y, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "");
CGStatusBar(CPicture *BG, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = Colors::WHITE); //given CPicture will be captured by created sbar and it's pos will be used as pos for sbar
CGStatusBar(int x, int y, std::string name, int maxw=-1);
~CGStatusBar();

View File

@ -24,6 +24,11 @@ SDL_Color Colors::createColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a /*= 0*/)
return temp;
}
const SDL_Color Colors::YELLOW = createColor(229, 215, 123, 0);
const SDL_Color Colors::WHITE = createColor(255, 243, 222, 0);
const SDL_Color Colors::MetallicGold = createColor(173, 142, 66);
const SDL_Color Colors::Maize = createColor(242, 226, 110);
SDL_Surface * CSDL_Ext::newSurface(int w, int h, SDL_Surface * mod) //creates new surface, with flags/format same as in surface given
{
SDL_Surface * ret = SDL_CreateRGBSurface(mod->flags,w,h,mod->format->BitsPerPixel,mod->format->Rmask,mod->format->Gmask,mod->format->Bmask,mod->format->Amask);
@ -155,7 +160,7 @@ void CSDL_Ext::printAtWB(const std::string & text, int x, int y, EFonts font, in
}
void CSDL_Ext::printAtMiddleWB( const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor/*=Colors::Jasmine*/, SDL_Surface * dst/*=screen*/ )
void CSDL_Ext::printAtMiddleWB( const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor/*=Colors::YELLOW*/, SDL_Surface * dst/*=screen*/ )
{
if (graphics->fontsTrueType[font])
{
@ -204,7 +209,7 @@ void printAtMiddle(const std::string & text, int x, int y, TTF_Font * font, SDL_
SDL_FreeSurface(temp);
}
void CSDL_Ext::printAtMiddle( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::Cornsilk*/, SDL_Surface * dst/*=screen*/ )
void CSDL_Ext::printAtMiddle( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::WHITE*/, SDL_Surface * dst/*=screen*/ )
{
if (graphics->fontsTrueType[font])
{
@ -351,7 +356,7 @@ void printTo(const std::string & text, int x, int y, TTF_Font * font, SDL_Color
SDL_FreeSurface(temp);
}
void CSDL_Ext::printTo( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::Cornsilk*/, SDL_Surface * dst/*=screen*/ )
void CSDL_Ext::printTo( const std::string & text, int x, int y, EFonts font, SDL_Color kolor/*=Colors::WHITE*/, SDL_Surface * dst/*=screen*/ )
{
if (graphics->fontsTrueType[font])
{
@ -612,18 +617,18 @@ void CSDL_Ext::blitWithRotate2(const SDL_Surface *src, const SDL_Rect * srcRect,
template<int bpp>
void CSDL_Ext::blitWithRotate3(const SDL_Surface *src, const SDL_Rect * srcRect, SDL_Surface * dst, const SDL_Rect * dstRect)//srcRect is not used, works with 8bpp sources and 24/32 bpp dests
{
Uint8 *sp = (Uint8 *)src->pixels + (src->h - srcRect->h - srcRect->y)*src->pitch + (src->w - srcRect->w - srcRect->x);
Uint8 *dporg = (Uint8 *)dst->pixels +(dstRect->y + dstRect->h - 1)*dst->pitch + (dstRect->x+dstRect->w)*bpp;
const SDL_Color * const colors = src->format->palette->colors;
Uint8 *sp = (Uint8 *)src->pixels + (src->h - srcRect->h - srcRect->y)*src->pitch + (src->w - srcRect->w - srcRect->x);
Uint8 *dporg = (Uint8 *)dst->pixels +(dstRect->y + dstRect->h - 1)*dst->pitch + (dstRect->x+dstRect->w)*bpp;
const SDL_Color * const colors = src->format->palette->colors;
for(int i=dstRect->h; i>0; i--, dporg -= dst->pitch)
{
Uint8 *dp = dporg;
for(int j=dstRect->w; j>0; j--, sp++)
for(int i=dstRect->h; i>0; i--, dporg -= dst->pitch)
{
Uint8 *dp = dporg;
for(int j=dstRect->w; j>0; j--, sp++)
ColorPutter<bpp, -1>::PutColor(dp, colors[*sp]);
sp += src->w - dstRect->w;
}
}
}
template<int bpp>
@ -1123,7 +1128,7 @@ template<int bpp>
void scaleSurfaceFastInternal(SDL_Surface *surf, SDL_Surface *ret)
{
const float factorX = float(surf->w) / float(ret->w),
factorY = float(surf->h) / float(ret->h);
factorY = float(surf->h) / float(ret->h);
for(int y = 0; y < ret->h; y++)
{
@ -1131,7 +1136,7 @@ void scaleSurfaceFastInternal(SDL_Surface *surf, SDL_Surface *ret)
{
//coordinates we want to calculate
int origX = floor(factorX * x),
origY = floor(factorY * y);
origY = floor(factorY * y);
// Get pointers to source pixels
Uint8 *srcPtr = (Uint8*)surf->pixels + origY * surf->pitch + origX * bpp;
@ -1167,7 +1172,7 @@ template<int bpp>
void scaleSurfaceInternal(SDL_Surface *surf, SDL_Surface *ret)
{
const float factorX = float(surf->w - 1) / float(ret->w),
factorY = float(surf->h - 1) / float(ret->h);
factorY = float(surf->h - 1) / float(ret->h);
for(int y = 0; y < ret->h; y++)
{
@ -1175,10 +1180,10 @@ void scaleSurfaceInternal(SDL_Surface *surf, SDL_Surface *ret)
{
//coordinates we want to interpolate
float origX = factorX * x,
origY = factorY * y;
origY = factorY * y;
float x1 = floor(origX), x2 = floor(origX+1),
y1 = floor(origY), y2 = floor(origY+1);
y1 = floor(origY), y2 = floor(origY+1);
//assert( x1 >= 0 && y1 >= 0 && x2 < surf->w && y2 < surf->h);//All pixels are in range
// Calculate weights of each source pixel
@ -1312,4 +1317,4 @@ std::string CSDL_Ext::trimToFit(std::string text, int widthLimit, EFonts font)
template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<2>(int, int);
template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<3>(int, int);
template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<4>(int, int);
template SDL_Surface * CSDL_Ext::createSurfaceWithBpp<4>(int, int);

View File

@ -38,15 +38,33 @@ void blitAt(SDL_Surface * src, const SDL_Rect & pos, SDL_Surface * dst=screen);
void updateRect (SDL_Rect * rect, SDL_Surface * scr = screen);
bool isItIn(const SDL_Rect * rect, int x, int y);
namespace Colors
/**
* The colors class defines color constants of type SDL_Color.
*/
class Colors
{
SDL_Color createColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 0);
public:
/** the h3 yellow color, typically used for headlines */
static const SDL_Color YELLOW;
const SDL_Color Jasmine = createColor(229, 215, 123, 0); // http://en.wikipedia.org/wiki/Jasmine_%28color%29
const SDL_Color Cornsilk = createColor(255, 243, 222, 0); // http://en.wikipedia.org/wiki/Shades_of_white
const SDL_Color MetallicGold = createColor(173, 142, 66); // http://en.wikipedia.org/wiki/Gold_%28color%29
const SDL_Color Maize = createColor(242, 226, 110); // http://en.wikipedia.org/wiki/Maize_%28color%29
}
/** the standard h3 white color */
static const SDL_Color WHITE;
static const SDL_Color MetallicGold;
static const SDL_Color Maize;
private:
/**
* Creates a SDL_Color object.
*
* @param r the red value ranging from 0 to 255
* @param g the green value ranging from 0 to 255
* @param b the blue value ranging from 0 to 255
* @param a the alpha value ranging from 0(opaque) to 255(transparent)
* @return the created SDL_Color object
*/
static SDL_Color createColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a = 0);
};
//MSVC gives an error when calling abs with ui64 -> we add template that will match calls with unsigned arg and return it
template<typename T>
@ -109,7 +127,7 @@ namespace CSDL_Ext
SDL_Rect oldRect;
public:
CClipRectGuard(SDL_Surface * surface, const SDL_Rect & rect):
surf(surface)
surf(surface)
{
SDL_GetClipRect(surf, &oldRect);
SDL_SetClipRect(surf, &rect);
@ -164,11 +182,11 @@ namespace CSDL_Ext
int blit8bppAlphaTo24bpp(const SDL_Surface * src, const SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect); //blits 8 bpp surface with alpha channel to 24 bpp surface
Uint32 colorToUint32(const SDL_Color * color); //little endian only
void printAtWB(const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor=Colors::Cornsilk, SDL_Surface * dst=screen);
void printAt(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::Cornsilk, SDL_Surface * dst=screen);
void printTo(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::Cornsilk, SDL_Surface * dst=screen);
void printAtMiddle(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::Cornsilk, SDL_Surface * dst=screen);
void printAtMiddleWB(const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor=Colors::Jasmine, SDL_Surface * dst=screen);
void printAtWB(const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor=Colors::WHITE, SDL_Surface * dst=screen);
void printAt(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::WHITE, SDL_Surface * dst=screen);
void printTo(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::WHITE, SDL_Surface * dst=screen);
void printAtMiddle(const std::string & text, int x, int y, EFonts font, SDL_Color kolor=Colors::WHITE, SDL_Surface * dst=screen);
void printAtMiddleWB(const std::string & text, int x, int y, EFonts font, int charpr, SDL_Color kolor=Colors::YELLOW, SDL_Surface * dst=screen);
void update(SDL_Surface * what = screen); //updates whole surface (default - main screen)
void drawBorder(SDL_Surface * sur, int x, int y, int w, int h, const int3 &color);

View File

@ -23,7 +23,11 @@
"sound" : {
"type" : "number",
"default" : 88
}
},
"enableRMG" : {
"type" : "bool",
"default" : false
}
},
"default" : {}
},

View File

@ -17,6 +17,7 @@ set(lib_SRCS
Map/CMap.cpp
Map/CMapInfo.cpp
Map/CMapService.cpp
RMG/CMapGenOptions.cpp
BattleAction.cpp
BattleHex.cpp
BattleState.cpp
@ -48,7 +49,25 @@ set(lib_SRCS
VCMI_Lib.cpp
)
add_library(vcmi SHARED ${lib_SRCS})
set(lib_HEADERS
AI_Base.h
CondSh.h
ConstTransitivePtr.h
CScriptingModule.h
CStopWatch.h
GameConstants.h
IGameEventsReceiver.h
int3.h
Interprocess.h
NetPacks.h
RegisterTypes.h
StartInfo.h
UnlockGuard.h
VCMIDirs.h
vcmi_endian.h
)
add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
target_link_libraries(vcmi ${Boost_LIBRARIES} ${SDL_LIBRARY} ${ZLIB_LIBRARIES})
install(TARGETS vcmi DESTINATION ${LIB_DIR})

View File

@ -39,7 +39,7 @@ CInputStream * CBinaryReader::getStream()
void CBinaryReader::setStream(CInputStream * stream)
{
this->stream = stream;
this->stream = stream;
}
si64 CBinaryReader::read(ui8 * data, si64 size)

View File

@ -6,11 +6,11 @@
static const int inflateBlockSize = 10000;
CCompressedStream::CCompressedStream(std::unique_ptr<CInputStream> stream, bool gzip, size_t decompressedSize):
gzipStream(std::move(stream)),
buffer(decompressedSize),
decompressedSize(0),
compressedBuffer(inflateBlockSize),
position(0)
gzipStream(std::move(stream)),
buffer(decompressedSize),
decompressedSize(0),
compressedBuffer(inflateBlockSize),
position(0)
{
assert(gzipStream);

View File

@ -2,36 +2,36 @@
#include "CMemoryStream.h"
CMemoryStream::CMemoryStream(const ui8 * data, si64 size) :
data(data), size(size), position(0)
data(data), size(size), position(0)
{
}
si64 CMemoryStream::read(ui8 * data, si64 size)
{
si64 toRead = std::min(this->size - tell(), size);
std::copy(this->data + position, this->data + position + toRead, data);
si64 toRead = std::min(this->size - tell(), size);
std::copy(this->data + position, this->data + position + toRead, data);
position += size;
return toRead;
return toRead;
}
si64 CMemoryStream::seek(si64 position)
{
si64 origin = tell();
this->position = std::min(position, size);
return tell() - origin;
si64 origin = tell();
this->position = std::min(position, size);
return tell() - origin;
}
si64 CMemoryStream::tell()
{
return this->position;
return this->position;
}
si64 CMemoryStream::skip(si64 delta)
{
si64 origin = tell();
this->position += std::min(size - origin, delta);
return tell() - origin;
si64 origin = tell();
this->position += std::min(size - origin, delta);
return tell() - origin;
}
si64 CMemoryStream::getSize()

View File

@ -20,12 +20,12 @@ class DLL_LINKAGE CMemoryStream : public CInputStream
{
public:
/**
* C-tor. The data buffer won't be free'd. (no ownership)
* C-tor. The data buffer won't be free'd. (no ownership)
*
* @param data a pointer to the data array.
* @param data a pointer to the data array.
* @param size The size in bytes of the array.
*/
CMemoryStream(const ui8 * data, si64 size);
CMemoryStream(const ui8 * data, si64 size);
/**
* Reads n bytes from the stream into the data buffer.
@ -67,8 +67,8 @@ public:
si64 getSize();
private:
/** A pointer to the data array. */
const ui8 * data;
/** A pointer to the data array. */
const ui8 * data;
/** The size in bytes of the array. */
si64 size;

View File

@ -11,48 +11,48 @@ SHeroName::SHeroName() : heroId(-1)
}
PlayerInfo::PlayerInfo(): p7(0), p8(0), p9(0), powerPlaceholders(-1),
canHumanPlay(false), canComputerPlay(false),
aiTactic(EAiTactic::RANDOM), isFactionRandom(false), mainHeroPortrait(0), hasMainTown(false),
generateHeroAtMainTown(false), team(255), generateHero(false)
canHumanPlay(false), canComputerPlay(false),
aiTactic(EAiTactic::RANDOM), isFactionRandom(false), mainHeroPortrait(0), hasMainTown(false),
generateHeroAtMainTown(false), team(255), generateHero(false)
{
}
si8 PlayerInfo::defaultCastle() const
{
assert(!allowedFactions.empty()); // impossible?
assert(!allowedFactions.empty()); // impossible?
if(allowedFactions.size() == 1)
{
// only one faction is available - pick it
return *allowedFactions.begin();
}
if(allowedFactions.size() == 1)
{
// only one faction is available - pick it
return *allowedFactions.begin();
}
// set to random
return -1;
// set to random
return -1;
}
si8 PlayerInfo::defaultHero() const
{
// we will generate hero in front of main town
if((generateHeroAtMainTown && hasMainTown) || p8)
{
//random hero
return -1;
}
// we will generate hero in front of main town
if((generateHeroAtMainTown && hasMainTown) || p8)
{
//random hero
return -1;
}
return -2;
return -2;
}
LossCondition::LossCondition() : typeOfLossCon(ELossConditionType::LOSSSTANDARD),
pos(int3(-1, -1, -1)), timeLimit(-1), obj(nullptr)
pos(int3(-1, -1, -1)), timeLimit(-1), obj(nullptr)
{
}
VictoryCondition::VictoryCondition() : condition(EVictoryConditionType::WINSTANDARD),
allowNormalVictory(false), appliesToAI(false), pos(int3(-1, -1, -1)), objectId(0),
count(0), obj(nullptr)
allowNormalVictory(false), appliesToAI(false), pos(int3(-1, -1, -1)), objectId(0),
count(0), obj(nullptr)
{
}
@ -63,19 +63,19 @@ DisposedHero::DisposedHero() : heroId(0), portrait(255), players(0)
}
CMapEvent::CMapEvent() : players(0), humanAffected(0), computerAffected(0),
firstOccurence(0), nextOccurence(0)
firstOccurence(0), nextOccurence(0)
{
}
bool CMapEvent::earlierThan(const CMapEvent & other) const
{
return firstOccurence < other.firstOccurence;
return firstOccurence < other.firstOccurence;
}
bool CMapEvent::earlierThanOrEqual(const CMapEvent & other) const
{
return firstOccurence <= other.firstOccurence;
return firstOccurence <= other.firstOccurence;
}
CCastleEvent::CCastleEvent() : town(nullptr)
@ -84,51 +84,51 @@ CCastleEvent::CCastleEvent() : town(nullptr)
}
TerrainTile::TerrainTile() : terType(ETerrainType::BORDER), terView(0), riverType(ERiverType::NO_RIVER),
riverDir(0), roadType(ERoadType::NO_ROAD), roadDir(0), extTileFlags(0), visitable(false),
blocked(false)
riverDir(0), roadType(ERoadType::NO_ROAD), roadDir(0), extTileFlags(0), visitable(false),
blocked(false)
{
}
bool TerrainTile::entrableTerrain(const TerrainTile * from /*= NULL*/) const
{
return entrableTerrain(from ? from->terType != ETerrainType::WATER : true, from ? from->terType == ETerrainType::WATER : true);
return entrableTerrain(from ? from->terType != ETerrainType::WATER : true, from ? from->terType == ETerrainType::WATER : true);
}
bool TerrainTile::entrableTerrain(bool allowLand, bool allowSea) const
{
return terType != ETerrainType::ROCK
&& ((allowSea && terType == ETerrainType::WATER) || (allowLand && terType != ETerrainType::WATER));
return terType != ETerrainType::ROCK
&& ((allowSea && terType == ETerrainType::WATER) || (allowLand && terType != ETerrainType::WATER));
}
bool TerrainTile::isClear(const TerrainTile *from /*= NULL*/) const
{
return entrableTerrain(from) && !blocked;
return entrableTerrain(from) && !blocked;
}
int TerrainTile::topVisitableId() const
{
return visitableObjects.size() ? visitableObjects.back()->ID : -1;
return visitableObjects.size() ? visitableObjects.back()->ID : -1;
}
bool TerrainTile::isCoastal() const
{
return extTileFlags & 64;
return extTileFlags & 64;
}
bool TerrainTile::hasFavourableWinds() const
{
return extTileFlags & 128;
return extTileFlags & 128;
}
bool TerrainTile::isWater() const
{
return terType == ETerrainType::WATER;
return terType == ETerrainType::WATER;
}
CMapHeader::CMapHeader() : version(EMapFormat::INVALID), areAnyPlayers(false),
height(-1), width(-1), twoLevel(-1), difficulty(0), levelLimit(0),
howManyTeams(0)
height(-1), width(-1), twoLevel(-1), difficulty(0), levelLimit(0),
howManyTeams(0)
{
}
@ -145,136 +145,136 @@ CMap::CMap() : checksum(0), terrain(nullptr), grailRadious(0)
CMap::~CMap()
{
if(terrain)
{
for(int ii=0;ii<width;ii++)
{
for(int jj=0;jj<height;jj++)
delete [] terrain[ii][jj];
delete [] terrain[ii];
}
delete [] terrain;
}
if(terrain)
{
for(int ii=0;ii<width;ii++)
{
for(int jj=0;jj<height;jj++)
delete [] terrain[ii][jj];
delete [] terrain[ii];
}
delete [] terrain;
}
for(std::list<ConstTransitivePtr<CMapEvent> >::iterator i = events.begin(); i != events.end(); i++)
{
i->dellNull();
}
for(std::list<ConstTransitivePtr<CMapEvent> >::iterator i = events.begin(); i != events.end(); i++)
{
i->dellNull();
}
}
void CMap::removeBlockVisTiles(CGObjectInstance * obj, bool total)
{
for(int fx=0; fx<8; ++fx)
{
for(int fy=0; fy<6; ++fy)
{
int xVal = obj->pos.x + fx - 7;
int yVal = obj->pos.y + fy - 5;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if(total || ((obj->defInfo->visitMap[fy] >> (7 - fx)) & 1))
{
curt.visitableObjects -= obj;
curt.visitable = curt.visitableObjects.size();
}
if(total || !((obj->defInfo->blockMap[fy] >> (7 - fx)) & 1))
{
curt.blockingObjects -= obj;
curt.blocked = curt.blockingObjects.size();
}
}
}
}
for(int fx=0; fx<8; ++fx)
{
for(int fy=0; fy<6; ++fy)
{
int xVal = obj->pos.x + fx - 7;
int yVal = obj->pos.y + fy - 5;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if(total || ((obj->defInfo->visitMap[fy] >> (7 - fx)) & 1))
{
curt.visitableObjects -= obj;
curt.visitable = curt.visitableObjects.size();
}
if(total || !((obj->defInfo->blockMap[fy] >> (7 - fx)) & 1))
{
curt.blockingObjects -= obj;
curt.blocked = curt.blockingObjects.size();
}
}
}
}
}
void CMap::addBlockVisTiles(CGObjectInstance * obj)
{
for(int fx=0; fx<8; ++fx)
{
for(int fy=0; fy<6; ++fy)
{
int xVal = obj->pos.x + fx - 7;
int yVal = obj->pos.y + fy - 5;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if(((obj->defInfo->visitMap[fy] >> (7 - fx)) & 1))
{
curt.visitableObjects.push_back(obj);
curt.visitable = true;
}
if(!((obj->defInfo->blockMap[fy] >> (7 - fx)) & 1))
{
curt.blockingObjects.push_back(obj);
curt.blocked = true;
}
}
}
}
for(int fx=0; fx<8; ++fx)
{
for(int fy=0; fy<6; ++fy)
{
int xVal = obj->pos.x + fx - 7;
int yVal = obj->pos.y + fy - 5;
int zVal = obj->pos.z;
if(xVal>=0 && xVal<width && yVal>=0 && yVal<height)
{
TerrainTile & curt = terrain[xVal][yVal][zVal];
if(((obj->defInfo->visitMap[fy] >> (7 - fx)) & 1))
{
curt.visitableObjects.push_back(obj);
curt.visitable = true;
}
if(!((obj->defInfo->blockMap[fy] >> (7 - fx)) & 1))
{
curt.blockingObjects.push_back(obj);
curt.blocked = true;
}
}
}
}
}
CGHeroInstance * CMap::getHero(int heroID)
{
for(ui32 i=0; i<heroes.size();i++)
if(heroes[i]->subID == heroID)
return heroes[i];
return nullptr;
for(ui32 i=0; i<heroes.size();i++)
if(heroes[i]->subID == heroID)
return heroes[i];
return nullptr;
}
bool CMap::isInTheMap(const int3 &pos) const
{
if(pos.x<0 || pos.y<0 || pos.z<0 || pos.x >= width || pos.y >= height || pos.z > twoLevel)
return false;
else return true;
if(pos.x<0 || pos.y<0 || pos.z<0 || pos.x >= width || pos.y >= height || pos.z > twoLevel)
return false;
else return true;
}
TerrainTile & CMap::getTile( const int3 & tile )
{
return terrain[tile.x][tile.y][tile.z];
return terrain[tile.x][tile.y][tile.z];
}
const TerrainTile & CMap::getTile( const int3 & tile ) const
{
return terrain[tile.x][tile.y][tile.z];
return terrain[tile.x][tile.y][tile.z];
}
bool CMap::isWaterTile(const int3 &pos) const
{
return isInTheMap(pos) && getTile(pos).terType == ETerrainType::WATER;
return isInTheMap(pos) && getTile(pos).terType == ETerrainType::WATER;
}
const CGObjectInstance *CMap::getObjectiveObjectFrom(int3 pos, bool lookForHero)
{
const std::vector <CGObjectInstance *> & objs = getTile(pos).visitableObjects;
assert(objs.size());
if(objs.size() > 1 && lookForHero && objs.front()->ID != Obj::HERO)
{
assert(objs.back()->ID == Obj::HERO);
return objs.back();
}
else
return objs.front();
const std::vector <CGObjectInstance *> & objs = getTile(pos).visitableObjects;
assert(objs.size());
if(objs.size() > 1 && lookForHero && objs.front()->ID != Obj::HERO)
{
assert(objs.back()->ID == Obj::HERO);
return objs.back();
}
else
return objs.front();
}
void CMap::checkForObjectives()
{
if(isInTheMap(victoryCondition.pos))
victoryCondition.obj = getObjectiveObjectFrom(victoryCondition.pos, victoryCondition.condition == EVictoryConditionType::BEATHERO);
if(isInTheMap(victoryCondition.pos))
victoryCondition.obj = getObjectiveObjectFrom(victoryCondition.pos, victoryCondition.condition == EVictoryConditionType::BEATHERO);
if(isInTheMap(lossCondition.pos))
lossCondition.obj = getObjectiveObjectFrom(lossCondition.pos, lossCondition.typeOfLossCon == ELossConditionType::LOSSHERO);
if(isInTheMap(lossCondition.pos))
lossCondition.obj = getObjectiveObjectFrom(lossCondition.pos, lossCondition.typeOfLossCon == ELossConditionType::LOSSHERO);
}
void CMap::addNewArtifactInstance( CArtifactInstance *art )
{
art->id = artInstances.size();
artInstances.push_back(art);
art->id = artInstances.size();
artInstances.push_back(art);
}
void CMap::eraseArtifactInstance(CArtifactInstance *art)
{
assert(artInstances[art->id] == art);
artInstances[art->id].dellNull();
assert(artInstances[art->id] == art);
artInstances[art->id].dellNull();
}

File diff suppressed because it is too large Load Diff

View File

@ -9,41 +9,41 @@
void CMapInfo::countPlayers()
{
actualHumanPlayers = playerAmnt = humanPlayers = 0;
for(int i=0;i<GameConstants::PLAYER_LIMIT;i++)
{
if(mapHeader->players[i].canHumanPlay)
{
playerAmnt++;
humanPlayers++;
}
else if(mapHeader->players[i].canComputerPlay)
{
playerAmnt++;
}
}
actualHumanPlayers = playerAmnt = humanPlayers = 0;
for(int i=0;i<GameConstants::PLAYER_LIMIT;i++)
{
if(mapHeader->players[i].canHumanPlay)
{
playerAmnt++;
humanPlayers++;
}
else if(mapHeader->players[i].canComputerPlay)
{
playerAmnt++;
}
}
if(scenarioOpts)
for (auto i = scenarioOpts->playerInfos.cbegin(); i != scenarioOpts->playerInfos.cend(); i++)
if(i->second.human)
actualHumanPlayers++;
if(scenarioOpts)
for (auto i = scenarioOpts->playerInfos.cbegin(); i != scenarioOpts->playerInfos.cend(); i++)
if(i->second.human)
actualHumanPlayers++;
}
CMapInfo::CMapInfo() :
scenarioOpts(nullptr)
scenarioOpts(nullptr)
{
}
void CMapInfo::mapInit(const std::string & fname)
{
fileURI = fname;
mapHeader = CMapService::loadMapHeader(fname);
countPlayers();
fileURI = fname;
mapHeader = CMapService::loadMapHeader(fname);
countPlayers();
}
void CMapInfo::campaignInit()
{
campaignHeader = std::unique_ptr<CCampaignHeader>(new CCampaignHeader(CCampaignHandler::getHeader(fileURI)));
campaignHeader = std::unique_ptr<CCampaignHeader>(new CCampaignHeader(CCampaignHandler::getHeader(fileURI)));
}

View File

@ -22,23 +22,23 @@ class DLL_LINKAGE CMapInfo
public:
//FIXME: unique_ptr won't work here with gcc-4.5. (can't move into vector at CPregame.cpp, SelectionTab::parseMaps() method)
//Needs some workaround or wait till there is no need to support 4.5
shared_ptr<CMapHeader> mapHeader; //may be nullptr if campaign
shared_ptr<CCampaignHeader> campaignHeader; //may be nullptr if scenario
StartInfo * scenarioOpts; //options with which scenario has been started (used only with saved games)
std::string fileURI;
std::string date;
int playerAmnt; //players in map
int humanPlayers; //players ALLOWED to be controlled by human
int actualHumanPlayers; // >1 if multiplayer game
shared_ptr<CMapHeader> mapHeader; //may be nullptr if campaign
shared_ptr<CCampaignHeader> campaignHeader; //may be nullptr if scenario
StartInfo * scenarioOpts; //options with which scenario has been started (used only with saved games)
std::string fileURI;
std::string date;
int playerAmnt; //players in map
int humanPlayers; //players ALLOWED to be controlled by human
int actualHumanPlayers; // >1 if multiplayer game
CMapInfo();
void mapInit(const std::string & fname);
void campaignInit();
void countPlayers();
CMapInfo();
void mapInit(const std::string & fname);
void campaignInit();
void countPlayers();
template <typename Handler> void serialize(Handler &h, const int Version)
{
h & mapHeader & campaignHeader & scenarioOpts & fileURI & date & playerAmnt & humanPlayers;
h & actualHumanPlayers;
}
template <typename Handler> void serialize(Handler &h, const int Version)
{
h & mapHeader & campaignHeader & scenarioOpts & fileURI & date & playerAmnt & humanPlayers;
h & actualHumanPlayers;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -31,74 +31,74 @@ class IMapLoader;
class DLL_LINKAGE CMapService
{
public:
/**
* Loads the VCMI/H3 map file specified by the name.
*
* @param name the name of the map
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMap> loadMap(const std::string & name);
/**
* Loads the VCMI/H3 map file specified by the name.
*
* @param name the name of the map
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMap> loadMap(const std::string & name);
/**
* Loads the VCMI/H3 map header specified by the name.
*
* @param name the name of the map
* @return a unique ptr to the loaded map header class
*/
static std::unique_ptr<CMapHeader> loadMapHeader(const std::string & name);
/**
* Loads the VCMI/H3 map header specified by the name.
*
* @param name the name of the map
* @return a unique ptr to the loaded map header class
*/
static std::unique_ptr<CMapHeader> loadMapHeader(const std::string & name);
/**
* Loads the VCMI/H3 map file from a buffer. This method is temporarily
* in use to ease the transition to use the new map service.
*
* TODO Replace method params with a CampaignMapInfo struct which contains
* a campaign loading object + name of map.
*
* @param buffer a pointer to a buffer containing the map data
* @param size the size of the buffer
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMap> loadMap(const ui8 * buffer, int size);
/**
* Loads the VCMI/H3 map file from a buffer. This method is temporarily
* in use to ease the transition to use the new map service.
*
* TODO Replace method params with a CampaignMapInfo struct which contains
* a campaign loading object + name of map.
*
* @param buffer a pointer to a buffer containing the map data
* @param size the size of the buffer
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMap> loadMap(const ui8 * buffer, int size);
/**
* Loads the VCMI/H3 map header from a buffer. This method is temporarily
* in use to ease the transition to use the new map service.
*
* TODO Replace method params with a CampaignMapInfo struct which contains
* a campaign loading object + name of map.
*
* @param buffer a pointer to a buffer containing the map header data
* @param size the size of the buffer
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMapHeader> loadMapHeader(const ui8 * buffer, int size);
/**
* Loads the VCMI/H3 map header from a buffer. This method is temporarily
* in use to ease the transition to use the new map service.
*
* TODO Replace method params with a CampaignMapInfo struct which contains
* a campaign loading object + name of map.
*
* @param buffer a pointer to a buffer containing the map header data
* @param size the size of the buffer
* @return a unique ptr to the loaded map class
*/
static std::unique_ptr<CMapHeader> loadMapHeader(const ui8 * buffer, int size);
private:
/**
* Gets a map input stream object specified by a map name.
*
* @param name the name of the map
* @return a unique ptr to the input stream class
*/
static std::unique_ptr<CInputStream> getStreamFromFS(const std::string & name);
/**
* Gets a map input stream object specified by a map name.
*
* @param name the name of the map
* @return a unique ptr to the input stream class
*/
static std::unique_ptr<CInputStream> getStreamFromFS(const std::string & name);
/**
* Gets a map input stream from a buffer.
*
* @param buffer a pointer to a buffer containing the map data
* @param size the size of the buffer
* @return a unique ptr to the input stream class
*/
static std::unique_ptr<CInputStream> getStreamFromMem(const ui8 * buffer, int size);
/**
* Gets a map input stream from a buffer.
*
* @param buffer a pointer to a buffer containing the map data
* @param size the size of the buffer
* @return a unique ptr to the input stream class
*/
static std::unique_ptr<CInputStream> getStreamFromMem(const ui8 * buffer, int size);
/**
* Gets a map loader from the given stream. It performs checks to test
* in which map format the map is.
*
* @param stream the input map stream
* @return the constructed map loader
*/
static std::unique_ptr<IMapLoader> getMapLoader(std::unique_ptr<CInputStream> & stream);
/**
* Gets a map loader from the given stream. It performs checks to test
* in which map format the map is.
*
* @param stream the input map stream
* @return the constructed map loader
*/
static std::unique_ptr<IMapLoader> getMapLoader(std::unique_ptr<CInputStream> & stream);
};
/**
@ -107,255 +107,255 @@ private:
class DLL_LINKAGE IMapLoader
{
public:
/**
* Loads the VCMI/H3 map file.
*
* @return a unique ptr of the loaded map class
*/
virtual std::unique_ptr<CMap> loadMap() = 0;
/**
* Loads the VCMI/H3 map file.
*
* @return a unique ptr of the loaded map class
*/
virtual std::unique_ptr<CMap> loadMap() = 0;
/**
* Loads the VCMI/H3 map header.
*
* @return a unique ptr of the loaded map header class
*/
virtual std::unique_ptr<CMapHeader> loadMapHeader() = 0;
/**
* Loads the VCMI/H3 map header.
*
* @return a unique ptr of the loaded map header class
*/
virtual std::unique_ptr<CMapHeader> loadMapHeader() = 0;
};
class DLL_LINKAGE CMapLoaderH3M : public IMapLoader
{
public:
/**
* Default constructor.
*
* @param stream a stream containing the map data
*/
CMapLoaderH3M(CInputStream * stream);
/**
* Default constructor.
*
* @param stream a stream containing the map data
*/
CMapLoaderH3M(CInputStream * stream);
/**
* Destructor.
*/
~CMapLoaderH3M();
/**
* Destructor.
*/
~CMapLoaderH3M();
/**
* Loads the VCMI/H3 map file.
*
* @return a unique ptr of the loaded map class
*/
std::unique_ptr<CMap> loadMap();
/**
* Loads the VCMI/H3 map file.
*
* @return a unique ptr of the loaded map class
*/
std::unique_ptr<CMap> loadMap();
/**
* Loads the VCMI/H3 map header.
*
* @return a unique ptr of the loaded map header class
*/
std::unique_ptr<CMapHeader> loadMapHeader();
/**
* Loads the VCMI/H3 map header.
*
* @return a unique ptr of the loaded map header class
*/
std::unique_ptr<CMapHeader> loadMapHeader();
/** true if you want to enable the map loader profiler to see how long a specific part took; default=false */
static const bool IS_PROFILING_ENABLED;
/** true if you want to enable the map loader profiler to see how long a specific part took; default=false */
static const bool IS_PROFILING_ENABLED;
private:
/**
* Initializes the map object from parsing the input buffer.
*/
void init();
/**
* Initializes the map object from parsing the input buffer.
*/
void init();
/**
* Reads the map header.
*/
void readHeader();
/**
* Reads the map header.
*/
void readHeader();
/**
* Reads player information.
*/
void readPlayerInfo();
/**
* Reads player information.
*/
void readPlayerInfo();
/**
* Reads victory/loss conditions.
*/
void readVictoryLossConditions();
/**
* Reads victory/loss conditions.
*/
void readVictoryLossConditions();
/**
* Reads team information.
*/
void readTeamInfo();
/**
* Reads team information.
*/
void readTeamInfo();
/**
* Reads the list of allowed heroes.
*/
void readAllowedHeroes();
/**
* Reads the list of allowed heroes.
*/
void readAllowedHeroes();
/**
* Reads the list of disposed heroes.
*/
void readDisposedHeroes();
/**
* Reads the list of disposed heroes.
*/
void readDisposedHeroes();
/**
* Reads the list of allowed artifacts.
*/
void readAllowedArtifacts();
/**
* Reads the list of allowed artifacts.
*/
void readAllowedArtifacts();
/**
* Reads the list of allowed spells and abilities.
*/
void readAllowedSpellsAbilities();
/**
* Reads the list of allowed spells and abilities.
*/
void readAllowedSpellsAbilities();
/**
* Loads artifacts of a hero.
*
* @param hero the hero which should hold those artifacts
*/
void loadArtifactsOfHero(CGHeroInstance * hero);
/**
* Loads artifacts of a hero.
*
* @param hero the hero which should hold those artifacts
*/
void loadArtifactsOfHero(CGHeroInstance * hero);
/**
* Loads an artifact to the given slot of the specified hero.
*
* @param hero the hero which should hold that artifact
* @param slot the artifact slot where to place that artifact
* @return true if it loaded an artifact
*/
bool loadArtifactToSlot(CGHeroInstance * hero, int slot);
/**
* Loads an artifact to the given slot of the specified hero.
*
* @param hero the hero which should hold that artifact
* @param slot the artifact slot where to place that artifact
* @return true if it loaded an artifact
*/
bool loadArtifactToSlot(CGHeroInstance * hero, int slot);
/**
* Creates an artifact instance.
*
* @param aid the id of the artifact
* @param spellID optional. the id of a spell if a spell scroll object should be created
* @return the created artifact instance
*/
CArtifactInstance * createArtifact(int aid, int spellID = -1);
/**
* Creates an artifact instance.
*
* @param aid the id of the artifact
* @param spellID optional. the id of a spell if a spell scroll object should be created
* @return the created artifact instance
*/
CArtifactInstance * createArtifact(int aid, int spellID = -1);
/**
* Adds the specified artifact instance to the list of artifacts of this map.
*
* @param art the artifact which should be added to the list of artifacts
*/
void addNewArtifactInstance(CArtifactInstance * art);
/**
* Adds the specified artifact instance to the list of artifacts of this map.
*
* @param art the artifact which should be added to the list of artifacts
*/
void addNewArtifactInstance(CArtifactInstance * art);
/**
* Read rumors.
*/
void readRumors();
/**
* Read rumors.
*/
void readRumors();
/**
* Reads predefined heroes.
*/
void readPredefinedHeroes();
/**
* Reads predefined heroes.
*/
void readPredefinedHeroes();
/**
* Reads terrain data.
*/
void readTerrain();
/**
* Reads terrain data.
*/
void readTerrain();
/**
* Reads custom(map) def information.
*/
void readDefInfo();
/**
* Reads custom(map) def information.
*/
void readDefInfo();
/**
* Reads objects(towns, mines,...).
*/
void readObjects();
/**
* Reads objects(towns, mines,...).
*/
void readObjects();
/**
* Reads a creature set.
*
* @param out the loaded creature set
* @param number the count of creatures to read
* @param version true for > ROE maps
*/
void readCreatureSet(CCreatureSet * out, int number, bool version);
/**
* Reads a creature set.
*
* @param out the loaded creature set
* @param number the count of creatures to read
* @param version true for > ROE maps
*/
void readCreatureSet(CCreatureSet * out, int number, bool version);
/**
* Reads a hero.
*
* @param idToBeGiven the object id which should be set for the hero
* @return a object instance
*/
CGObjectInstance * readHero(int idToBeGiven);
/**
* Reads a hero.
*
* @param idToBeGiven the object id which should be set for the hero
* @return a object instance
*/
CGObjectInstance * readHero(int idToBeGiven);
/**
* Reads a seer hut.
*
* @return the initialized seer hut object
*/
CGSeerHut * readSeerHut();
/**
* Reads a seer hut.
*
* @return the initialized seer hut object
*/
CGSeerHut * readSeerHut();
/**
* Reads a quest for the given quest guard.
*
* @param guard the quest guard where that quest should be applied to
*/
void readQuest(IQuestObject * guard);
/**
* Reads a quest for the given quest guard.
*
* @param guard the quest guard where that quest should be applied to
*/
void readQuest(IQuestObject * guard);
/**
* Adds the specified quest instance to the list of quests.
*
* @param quest the quest object which should be added to the list of quests
*/
void addQuest(CGObjectInstance * quest);
/**
* Adds the specified quest instance to the list of quests.
*
* @param quest the quest object which should be added to the list of quests
*/
void addQuest(CGObjectInstance * quest);
/**
* Reads a town.
*
* @param castleID the id of the castle type
* @return the loaded town object
*/
CGTownInstance * readTown(int castleID);
/**
* Reads a town.
*
* @param castleID the id of the castle type
* @return the loaded town object
*/
CGTownInstance * readTown(int castleID);
/**
* Converts buildings to the specified castle id.
*
* @param h3m the ids of the buildings
* @param castleID the castle id
* @param addAuxiliary true if the village hall should be added
* @return the converted buildings
*/
std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID, bool addAuxiliary = true);
/**
* Converts buildings to the specified castle id.
*
* @param h3m the ids of the buildings
* @param castleID the castle id
* @param addAuxiliary true if the village hall should be added
* @return the converted buildings
*/
std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID, bool addAuxiliary = true);
/**
* Reads events.
*/
void readEvents();
/**
* Reads events.
*/
void readEvents();
/**
* Adds object instance to block visitable tiles.
*
* @param obj the object to add
*/
void addBlockVisibleTiles(CGObjectInstance * obj);
/**
* Adds object instance to block visitable tiles.
*
* @param obj the object to add
*/
void addBlockVisibleTiles(CGObjectInstance * obj);
/**
* Reverses the input argument.
*
* @param arg the input argument
* @return the reversed 8-bit integer
*/
ui8 reverse(ui8 arg);
/**
* Reverses the input argument.
*
* @param arg the input argument
* @return the reversed 8-bit integer
*/
ui8 reverse(ui8 arg);
/**
* Init buffer / size.
*
* @param stream the stream which serves as the data input
*/
void initBuffer(CInputStream * stream);
/**
* Init buffer / size.
*
* @param stream the stream which serves as the data input
*/
void initBuffer(CInputStream * stream);
/** ptr to the map object which gets filled by data from the buffer */
CMap * map;
/** ptr to the map object which gets filled by data from the buffer */
CMap * map;
/**
* ptr to the map header object which gets filled by data from the buffer.
* (when loading a map then the mapHeader ptr points to the same object)
*/
std::unique_ptr<CMapHeader> mapHeader;
/**
* ptr to the map header object which gets filled by data from the buffer.
* (when loading a map then the mapHeader ptr points to the same object)
*/
std::unique_ptr<CMapHeader> mapHeader;
/** pointer to the array containing the map data;
* TODO replace with CBinaryReader later (this makes pos & size redundant) */
ui8 * buffer;
/** pointer to the array containing the map data;
* TODO replace with CBinaryReader later (this makes pos & size redundant) */
ui8 * buffer;
/** current buffer reading position */
int pos;
/** current buffer reading position */
int pos;
/** size of the map in bytes */
int size;
/** size of the map in bytes */
int size;
};

View File

@ -2225,7 +2225,7 @@ struct UpdateStartOptions : public CPregamePackToPropagate
struct PregameGuiAction : public CPregamePackToPropagate
{
enum {NO_TAB, OPEN_OPTIONS, OPEN_SCENARIO_LIST};
enum {NO_TAB, OPEN_OPTIONS, OPEN_SCENARIO_LIST, OPEN_RANDOM_MAP_OPTIONS};
ui8 action;

122
lib/RMG/CMapGenOptions.cpp Normal file
View File

@ -0,0 +1,122 @@
#include "StdInc.h"
#include "CMapGenOptions.h"
CMapGenOptions::CMapGenOptions() : mapSize(EMapSize::MEDIUM), hasTwoLevels(true),
playersCnt(-1), teamsCnt(-1), compOnlyPlayersCnt(-1), compOnlyTeamsCnt(-1),
waterContent(EWaterContent::NORMAL), monsterStrength(EMonsterStrength::NORMAL)
{
}
EMapSize::EMapSize CMapGenOptions::getMapSize() const
{
return mapSize;
}
void CMapGenOptions::setMapSize(EMapSize::EMapSize value)
{
mapSize = value;
}
bool CMapGenOptions::getHasTwoLevels() const
{
return hasTwoLevels;
}
void CMapGenOptions::setHasTwoLevels(bool value)
{
hasTwoLevels = value;
}
int CMapGenOptions::getPlayersCnt() const
{
return playersCnt;
}
void CMapGenOptions::setPlayersCnt(int value)
{
if((value >= 1 && value <= 8) || value == -1)
{
playersCnt = value;
}
else
{
throw std::runtime_error("Players count of RMG options should be between 1 and 8 or -1 for random.");
}
}
int CMapGenOptions::getTeamsCnt() const
{
return teamsCnt;
}
void CMapGenOptions::setTeamsCnt(int value)
{
if(playersCnt == -1 || (value >= 0 && value < playersCnt) || value == -1)
{
teamsCnt = value;
}
else
{
throw std::runtime_error("Teams count of RMG options should be between 0 and <" +
boost::lexical_cast<std::string>(playersCnt) + "(players count) - 1> or -1 for random.");
}
}
int CMapGenOptions::getCompOnlyPlayersCnt() const
{
return compOnlyPlayersCnt;
}
void CMapGenOptions::setCompOnlyPlayersCnt(int value)
{
if(value == -1 || (value >= 0 && value <= 8 - playersCnt))
{
compOnlyPlayersCnt = value;
}
else
{
throw std::runtime_error(std::string("Computer only players count of RMG options should be ") +
"between 0 and <8 - " + boost::lexical_cast<std::string>(playersCnt) +
"(playersCount)> or -1 for random.");
}
}
int CMapGenOptions::getCompOnlyTeamsCnt() const
{
return compOnlyTeamsCnt;
}
void CMapGenOptions::setCompOnlyTeamsCnt(int value)
{
if(value == -1 || compOnlyPlayersCnt == -1 || (value >= 0 && value <= compOnlyPlayersCnt - 1))
{
compOnlyTeamsCnt = value;
}
else
{
throw std::runtime_error(std::string("Computer only teams count of RMG options should be ") +
"between 0 and <" + boost::lexical_cast<std::string>(compOnlyPlayersCnt) +
"(compOnlyPlayersCnt) - 1> or -1 for random.");
}
}
EWaterContent::EWaterContent CMapGenOptions::getWaterContent() const
{
return waterContent;
}
void CMapGenOptions::setWaterContent(EWaterContent::EWaterContent value)
{
waterContent = value;
}
EMonsterStrength::EMonsterStrength CMapGenOptions::getMonsterStrength() const
{
return monsterStrength;
}
void CMapGenOptions::setMonsterStrength(EMonsterStrength::EMonsterStrength value)
{
monsterStrength = value;
}

195
lib/RMG/CMapGenOptions.h Normal file
View File

@ -0,0 +1,195 @@
/*
* CMapGenOptions.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
namespace EMapSize
{
enum EMapSize
{
SMALL,
MEDIUM,
LARGE,
EXTRA_LARGE
};
}
namespace EWaterContent
{
enum EWaterContent
{
RANDOM = -1,
NONE,
NORMAL,
ISLANDS
};
}
namespace EMonsterStrength
{
enum EMonsterStrength
{
RANDOM = -1,
WEAK,
NORMAL,
STRONG
};
}
/**
* The map gen options class holds values about general map
* generation settings e.g. the size of the map, the count of players,...
*/
class CMapGenOptions
{
public:
/**
* C-tor.
*/
CMapGenOptions();
/**
* Gets the size of the map.
*
* @return size of the map
*/
EMapSize::EMapSize getMapSize() const;
/**
* Sets the size of the map.
*
* @param value the size of the map
*/
void setMapSize(EMapSize::EMapSize value);
/**
* Gets the flag whether the map should be generated with two levels.
*
* @return true for two level map
*/
bool getHasTwoLevels() const;
/**
* Sets the flag whether the map should be generated with two levels.
*
* @param value true for two level map
*/
void setHasTwoLevels(bool value);
/**
* Gets the count of the players.
*
* @return the count of the players ranging from 1 to 8, -1 for random
*/
int getPlayersCnt() const;
/**
* Sets the count of the players.
*
* @param value the count of the players ranging from 1 to 8, -1 for random
*/
void setPlayersCnt(int value);
/**
* Gets the count of the teams.
*
* @return the count of the teams ranging from 0 to <players count - 1>, -1 for random
*/
int getTeamsCnt() const;
/**
* Sets the count of the teams
*
* @param value the count of the teams ranging from 0 to <players count - 1>, -1 for random
*/
void setTeamsCnt(int value);
/**
* Gets the count of the computer only players.
*
* @return the count of the computer only players ranging from 0 to <8 - players count>, -1 for random
*/
int getCompOnlyPlayersCnt() const;
/**
* Sets the count of the computer only players.
*
* @param value the count of the computer only players ranging from 0 to <8 - players count>, -1 for random
*/
void setCompOnlyPlayersCnt(int value);
/**
* Gets the count of the computer only teams.
*
* @return the count of the computer only teams ranging from 0 to <comp only players - 1>, -1 for random
*/
int getCompOnlyTeamsCnt() const;
/**
* Sets the count of the computer only teams.
*
* @param value the count of the computer only teams ranging from 0 to <comp only players - 1>, -1 for random
*/
void setCompOnlyTeamsCnt(int value);
/**
* Gets the water content.
*
* @return the water content
*/
EWaterContent::EWaterContent getWaterContent() const;
/**
* Sets the water content.
*
* @param value the water content
*/
void setWaterContent(EWaterContent::EWaterContent value);
/**
* Gets the strength of the monsters.
*
* @return the strenght of the monsters
*/
EMonsterStrength::EMonsterStrength getMonsterStrength() const;
/**
* Sets the strength of the monsters.
*
* @param value the strenght of the monsters
*/
void setMonsterStrength(EMonsterStrength::EMonsterStrength value);
private:
/** the size of the map */
EMapSize::EMapSize mapSize;
/** true if the map has two levels/underground */
bool hasTwoLevels;
/** the count of the players(human + computer); -1 if random */
int playersCnt;
/** the count of the teams; -1 if random */
int teamsCnt;
/** the count of computer only players; -1 if random */
int compOnlyPlayersCnt;
/** the count of computer only teams; -1 if random */
int compOnlyTeamsCnt;
/** the water content, -1 if random */
EWaterContent::EWaterContent waterContent;
/** the strength of the monsters, -1 if random */
EMonsterStrength::EMonsterStrength monsterStrength;
};

View File

@ -254,6 +254,7 @@
<ClCompile Include="Map\CMap.cpp" />
<ClCompile Include="Map\CMapInfo.cpp" />
<ClCompile Include="Map\CMapService.cpp" />
<ClCompile Include="RMG\CMapGenOptions.cpp" />
<ClCompile Include="HeroBonus.cpp" />
<ClCompile Include="CBattleCallback.cpp" />
<ClCompile Include="IGameCallback.cpp" />
@ -314,6 +315,7 @@
<ClInclude Include="Map\CMap.h" />
<ClInclude Include="Map\CMapInfo.h" />
<ClInclude Include="Map\CMapService.h" />
<ClInclude Include="RMG\CMapGenOptions.h" />
<ClInclude Include="GameConstants.h" />
<ClInclude Include="HeroBonus.h" />
<ClInclude Include="CBattleCallback.h" />
@ -334,4 +336,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>