mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
- First part of kingdom overview window (not a 100% stable)
- Implemented town buildings: dwarven treasury, ballista yard, partially - mystic pond
This commit is contained in:
parent
3ec6cfd115
commit
0f22ba0c0f
@ -12,6 +12,7 @@ SOURCES = AdventureMapButton.cpp \
|
|||||||
CBattleInterface.cpp \
|
CBattleInterface.cpp \
|
||||||
CCallback.cpp \
|
CCallback.cpp \
|
||||||
CCastleInterface.cpp \
|
CCastleInterface.cpp \
|
||||||
|
CKingdomInterface.cpp \
|
||||||
CConsoleHandler.cpp \
|
CConsoleHandler.cpp \
|
||||||
CCursorHandler.cpp \
|
CCursorHandler.cpp \
|
||||||
CGameInfo.cpp \
|
CGameInfo.cpp \
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "CCursorHandler.h"
|
#include "CCursorHandler.h"
|
||||||
#include "CGameInfo.h"
|
#include "CGameInfo.h"
|
||||||
#include "CHeroWindow.h"
|
#include "CHeroWindow.h"
|
||||||
|
#include "CKingdomInterface.h"
|
||||||
#include "CMessage.h"
|
#include "CMessage.h"
|
||||||
#include "SDL_Extensions.h"
|
#include "SDL_Extensions.h"
|
||||||
#include "CBitmapHandler.h"
|
#include "CBitmapHandler.h"
|
||||||
@ -1550,6 +1551,7 @@ CAdvMapInt::~CAdvMapInt()
|
|||||||
|
|
||||||
void CAdvMapInt::fshowOverview()
|
void CAdvMapInt::fshowOverview()
|
||||||
{
|
{
|
||||||
|
GH.pushInt(new CKingdomInterface);
|
||||||
}
|
}
|
||||||
void CAdvMapInt::fswitchLevel()
|
void CAdvMapInt::fswitchLevel()
|
||||||
{
|
{
|
||||||
|
@ -621,52 +621,82 @@ void CCastleInterface::buildingClicked(int building)
|
|||||||
GH.pushInt(cmw);
|
GH.pushInt(cmw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//case 15: //resource silo - default handling should be enought
|
//case 15: //resource silo - default handling only
|
||||||
|
|
||||||
case 16: //blacksmith
|
case 16: //blacksmith
|
||||||
{
|
enterBlacksmith(town->town->warMachine);
|
||||||
const CGHeroInstance *hero = town->visitingHero;
|
|
||||||
if(!hero)
|
|
||||||
{
|
|
||||||
std::string pom = CGI->generaltexth->allTexts[273];
|
|
||||||
boost::algorithm::replace_first(pom,"%s",CGI->buildh->buildings[town->subID][16]->Name());
|
|
||||||
LOCPLINT->showInfoDialog(pom,std::vector<SComponent*>(), soundBase::sound_todo);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int aid = town->town->warMachine;
|
|
||||||
int price = CGI->arth->artifacts[aid].price;
|
|
||||||
bool possible = (LOCPLINT->cb->getResourceAmount(6) >= price);
|
|
||||||
if(vstd::contains(hero->artifWorn,ui16(aid+9))) //hero already has machine
|
|
||||||
possible = false;
|
|
||||||
|
|
||||||
GH.pushInt(new CBlacksmithDialog(possible,CArtHandler::convertMachineID(aid,false),aid,hero->id));
|
|
||||||
break;
|
break;
|
||||||
}
|
case 17:
|
||||||
//TODO: case 17: //special 1
|
|
||||||
//TODO: case 18: //basic horde 1
|
|
||||||
//TODO: case 19: //upg horde 1
|
|
||||||
case 20: //ship at shipyard
|
|
||||||
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
|
|
||||||
break;
|
|
||||||
//TODO: case 21: //special 2
|
|
||||||
case 22: //special 3
|
|
||||||
{
|
{
|
||||||
switch(town->subID)
|
switch(town->subID)
|
||||||
{
|
{
|
||||||
case 0: //brotherhood of sword
|
/*Rampart*/ case 1://Mystic Pond
|
||||||
enterTavern();
|
enterFountain(building);
|
||||||
|
break;
|
||||||
|
/*Tower*/ case 2://Artifact Merchant
|
||||||
|
/*Dungeon*/ case 5://Artifact Merchant
|
||||||
|
/*Conflux*/ case 8://Artifact Merchant
|
||||||
|
tlog4<<"Artifact Merchant not handled\n";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
defaultBuildingClicked(building);
|
defaultBuildingClicked(building);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//TODO: case 23: //special 4
|
//case 18: //basic horde 1 - can't be selected
|
||||||
//TODO: case 24: //basic horde 2
|
//case 19: //upg horde 1 - can't be selected
|
||||||
//TODO: case 25: //upg horde 2
|
case 20: //ship at shipyard
|
||||||
//TODO: case 26: //grail
|
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
|
||||||
|
break;
|
||||||
|
case 21: //special 2
|
||||||
|
{
|
||||||
|
switch(town->subID)
|
||||||
|
{
|
||||||
|
/*Rampart*/ case 1: //Fountain of Fortune
|
||||||
|
enterFountain(building);
|
||||||
|
break;
|
||||||
|
/*Stronghold*/ case 6: //Freelancer's Guild
|
||||||
|
tlog4<<"Freelancer's Guild not handled\n";
|
||||||
|
break;
|
||||||
|
/*Conflux*/ case 8: //Magic University
|
||||||
|
tlog4<<"Magic University not handled\n";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
defaultBuildingClicked(building);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 22: //special 3
|
||||||
|
{
|
||||||
|
switch(town->subID)
|
||||||
|
{
|
||||||
|
/*Castle*/ case 0: //brotherhood of sword
|
||||||
|
enterTavern();
|
||||||
|
break;
|
||||||
|
/*Inferno*/ case 3: //Castle Gate
|
||||||
|
tlog4<<"Castle Gate not handled\n";
|
||||||
|
break;
|
||||||
|
/*Necropolis*/ case 4: //Skeleton Transformer
|
||||||
|
tlog4<<"Skeleton Transformer not handled\n";
|
||||||
|
break;
|
||||||
|
/*Dungeon*/ case 5: //Portal of Summoning
|
||||||
|
tlog4<<"Portal of Summoning not handled\n";
|
||||||
|
break;
|
||||||
|
/*Stronghold*/ case 6: //Ballista Yard
|
||||||
|
enterBlacksmith(4);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
defaultBuildingClicked(building);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//case 23: //special 4 - default handling only
|
||||||
|
//case 24: //basic horde 2 - can't be selected
|
||||||
|
//case 25: //upg horde 2 - can't be selected
|
||||||
|
//case 26: //grail - default handling only
|
||||||
default:
|
default:
|
||||||
defaultBuildingClicked(building);
|
defaultBuildingClicked(building);
|
||||||
break;
|
break;
|
||||||
@ -683,6 +713,44 @@ void CCastleInterface::defaultBuildingClicked(int building)
|
|||||||
comps, soundBase::sound_todo);
|
comps, soundBase::sound_todo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCastleInterface::enterFountain(int building)
|
||||||
|
{
|
||||||
|
std::vector<SComponent*> comps(1,
|
||||||
|
new CCustomImgComponent(SComponent::building,town->subID,building,bicons->ourImages[building].bitmap,false));
|
||||||
|
|
||||||
|
std::string descr = CGI->buildh->buildings[town->subID][building]->Description();
|
||||||
|
if ( building == 21)//we need description for mystic pond as well
|
||||||
|
descr += "\n\n"+CGI->buildh->buildings[town->subID][17]->Description();
|
||||||
|
// if (true)//fountain was builded this week
|
||||||
|
descr += "\n\n"+ CGI->generaltexth->allTexts[677];
|
||||||
|
/* else//fountain produced something;
|
||||||
|
{
|
||||||
|
descr+= "\n\n"+ CGI->generaltexth->allTexts[678];
|
||||||
|
boost::algorithm::replace_first(descr,"%s",CGI->generaltexth->restypes[resID]);
|
||||||
|
char buf[10];
|
||||||
|
SDL_itoa(ResCount,buf,10);
|
||||||
|
boost::algorithm::replace_first(descr,"%d",buf);
|
||||||
|
}*/
|
||||||
|
LOCPLINT->showInfoDialog(descr, comps, soundBase::sound_todo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCastleInterface::enterBlacksmith(int ArtifactID)
|
||||||
|
{
|
||||||
|
const CGHeroInstance *hero = town->visitingHero;
|
||||||
|
if(!hero)
|
||||||
|
{
|
||||||
|
std::string pom = CGI->generaltexth->allTexts[273];
|
||||||
|
boost::algorithm::replace_first(pom,"%s",CGI->buildh->buildings[town->subID][16]->Name());
|
||||||
|
LOCPLINT->showInfoDialog(pom,std::vector<SComponent*>(), soundBase::sound_todo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int price = CGI->arth->artifacts[ArtifactID].price;
|
||||||
|
bool possible = (LOCPLINT->cb->getResourceAmount(6) >= price);
|
||||||
|
if(vstd::contains(hero->artifWorn,ui16(ArtifactID+9))) //hero already has machine
|
||||||
|
possible = false;
|
||||||
|
GH.pushInt(new CBlacksmithDialog(possible,CArtHandler::convertMachineID(ArtifactID,false),ArtifactID,hero->id));
|
||||||
|
}
|
||||||
|
|
||||||
void CCastleInterface::enterHall()
|
void CCastleInterface::enterHall()
|
||||||
{
|
{
|
||||||
CHallInterface *h = new CHallInterface(this);
|
CHallInterface *h = new CHallInterface(this);
|
||||||
|
@ -130,6 +130,8 @@ public:
|
|||||||
void showAll(SDL_Surface * to);
|
void showAll(SDL_Surface * to);
|
||||||
void buildingClicked(int building);
|
void buildingClicked(int building);
|
||||||
void defaultBuildingClicked(int building);//for buildings with simple description + pic left-click messages
|
void defaultBuildingClicked(int building);//for buildings with simple description + pic left-click messages
|
||||||
|
void enterFountain(int building);
|
||||||
|
void enterBlacksmith(int ArtifactID);//support for blacksmith + ballista yard
|
||||||
void enterTavern();
|
void enterTavern();
|
||||||
void enterMageGuild();
|
void enterMageGuild();
|
||||||
void splitClicked(); //for hero meeting (splitting stacks is handled by garrison int)
|
void splitClicked(); //for hero meeting (splitting stacks is handled by garrison int)
|
||||||
@ -154,7 +156,7 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int BID;
|
int BID;
|
||||||
int state;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
int state;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - already builded today, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
|
//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
|
||||||
void hover(bool on);
|
void hover(bool on);
|
||||||
void clickLeft(tribool down, bool previousState);
|
void clickLeft(tribool down, bool previousState);
|
||||||
|
533
client/CKingdomInterface.cpp
Normal file
533
client/CKingdomInterface.cpp
Normal file
@ -0,0 +1,533 @@
|
|||||||
|
#include "CKingdomInterface.h"
|
||||||
|
#include "AdventureMapButton.h"
|
||||||
|
#include "CAdvmapInterface.h"
|
||||||
|
#include "../CCallback.h"
|
||||||
|
#include "CGameInfo.h"
|
||||||
|
#include "CHeroWindow.h"
|
||||||
|
#include "CMessage.h"
|
||||||
|
#include "SDL_Extensions.h"
|
||||||
|
#include "Graphics.h"
|
||||||
|
#include "../hch/CArtHandler.h"
|
||||||
|
#include "../hch/CDefHandler.h"
|
||||||
|
#include "../hch/CGeneralTextHandler.h"
|
||||||
|
#include "../hch/CObjectHandler.h"
|
||||||
|
#include <boost/assign/std/vector.hpp>
|
||||||
|
#include <sstream>
|
||||||
|
using namespace boost::assign;
|
||||||
|
using namespace CSDL_Ext;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CKingdomInterface.cpp, 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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int PicCount = 4;
|
||||||
|
|
||||||
|
CDefEssential* CKingdomInterface::slots;
|
||||||
|
CDefEssential* CKingdomInterface::fort;
|
||||||
|
CDefEssential* CKingdomInterface::hall;
|
||||||
|
|
||||||
|
CKingdomInterface::CKingdomInterface()
|
||||||
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
|
defActions = SHARE_POS;
|
||||||
|
pos.x = screen->w/2 - 400;
|
||||||
|
pos.y = screen->h/2 - 300;
|
||||||
|
size = 4;//we have 4 visible items in the list, would be nice to move this value to configs later
|
||||||
|
heroPos = townPos = 0;
|
||||||
|
state = 2;
|
||||||
|
showHarrisoned = false;
|
||||||
|
|
||||||
|
bg = BitmapHandler::loadBitmap("OVCAST.bmp");
|
||||||
|
graphics->blueToPlayersAdv(bg, LOCPLINT->playerID);
|
||||||
|
mines = CDefHandler::giveDefEss("OVMINES.DEF");
|
||||||
|
slots = CDefHandler::giveDefEss("OVSLOT.DEF");
|
||||||
|
title = CDefHandler::giveDefEss("OVTITLE.DEF");
|
||||||
|
hall = CDefHandler::giveDefEss("ITMTL.DEF");
|
||||||
|
fort = CDefHandler::giveDefEss("ITMCL.DEF");
|
||||||
|
|
||||||
|
toHeroes = new AdventureMapButton (CGI->generaltexth->overview[11],"",
|
||||||
|
boost::bind(&CKingdomInterface::listToHeroes,this),748,492,"OVBUTN1.DEF");
|
||||||
|
toHeroes->block(2);
|
||||||
|
|
||||||
|
toTowns = new AdventureMapButton (CGI->generaltexth->overview[12],"",
|
||||||
|
boost::bind(&CKingdomInterface::listToTowns,this),748,528,"OVBUTN6.DEF");
|
||||||
|
toTowns->block(0);
|
||||||
|
|
||||||
|
exit = new AdventureMapButton (CGI->generaltexth->allTexts[600],"",
|
||||||
|
boost::bind(&CKingdomInterface::close,this),748,563,"OVBUTN1.DEF");
|
||||||
|
exit->bitmapOffset = 3;
|
||||||
|
|
||||||
|
statusbar = new CStatusBar(pos.x+7,pos.y+555,"TSTATBAR.bmp",732);
|
||||||
|
resdatabar = new CResDataBar("KRESBAR.bmp",pos.x+3,pos.y+575,32,2,76,76);
|
||||||
|
|
||||||
|
for (int i=0; i<RESOURCE_QUANTITY; i++)
|
||||||
|
incomes.push_back(new CResIncomePic(i,mines));
|
||||||
|
|
||||||
|
heroes.resize(size);
|
||||||
|
for(size_t i=0;i<size;i++)//preparing lists for input
|
||||||
|
heroes[i] = NULL;
|
||||||
|
towns.resize(size);
|
||||||
|
for(size_t i=0;i<size;i++)
|
||||||
|
towns[i] = NULL;
|
||||||
|
|
||||||
|
slider = new CSlider(4, 4, 483, boost::bind (&CKingdomInterface::sliderMoved, this, _1),
|
||||||
|
size, LOCPLINT->cb->howManyHeroes(showHarrisoned), 0, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::~CKingdomInterface()
|
||||||
|
{
|
||||||
|
SDL_FreeSurface(bg);
|
||||||
|
|
||||||
|
delete statusbar;
|
||||||
|
delete resdatabar;
|
||||||
|
|
||||||
|
delete exit;
|
||||||
|
delete toTowns;
|
||||||
|
delete toHeroes;
|
||||||
|
|
||||||
|
delete slider;
|
||||||
|
delete title;
|
||||||
|
delete slots;
|
||||||
|
delete fort;
|
||||||
|
delete hall;
|
||||||
|
delete mines;
|
||||||
|
|
||||||
|
/* for(size_t i=0;i<size;i++)
|
||||||
|
delete heroes[i];
|
||||||
|
heroes.clear();
|
||||||
|
for(size_t i=0;i<size;i++)
|
||||||
|
delete towns[i];
|
||||||
|
towns.clear();*/
|
||||||
|
for(size_t i=0;i<incomes.size();i++)
|
||||||
|
delete incomes[i];
|
||||||
|
incomes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::close()
|
||||||
|
{
|
||||||
|
GH.popIntTotally(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::showAll( SDL_Surface * to/*=NULL*/)
|
||||||
|
{
|
||||||
|
LOCPLINT->adventureInt->resdatabar.draw(to);
|
||||||
|
blitAt(bg,pos,to);
|
||||||
|
resdatabar->draw(to);
|
||||||
|
toTowns->show(to);
|
||||||
|
toHeroes->show(to);
|
||||||
|
exit->show(to);
|
||||||
|
if (state == 1)
|
||||||
|
{//printing text "Town", "Harrisoned hero", "Visiting hero"
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[3],pos.x+145,pos.y+12,TNRB16,zwykly,to);
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[4],pos.x+370,pos.y+12,TNRB16,zwykly,to);
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[5],pos.x+600,pos.y+12,TNRB16,zwykly,to);
|
||||||
|
for (size_t i=0; i<size; i++)
|
||||||
|
towns[i]->show(to);//show town list
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{//text "Hero/stats" and "Skills"
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[0],pos.x+150,pos.y+12,TNRB16,zwykly,to);
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[1],pos.x+500,pos.y+12,TNRB16,zwykly,to);
|
||||||
|
for (size_t i=0; i<size; i++)
|
||||||
|
heroes[i]->show(to);//show hero list
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i=0;i<incomes.size();i++)
|
||||||
|
incomes[i]->show(to);//printing resource incomes
|
||||||
|
|
||||||
|
if(screen->w != 800 || screen->h !=600)
|
||||||
|
CMessage::drawBorder(LOCPLINT->playerID,to,828,628,pos.x-14,pos.y-15);
|
||||||
|
show(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
statusbar->show(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::activate()
|
||||||
|
{
|
||||||
|
LOCPLINT->statusbar = statusbar;
|
||||||
|
exit->activate();
|
||||||
|
toTowns->activate();
|
||||||
|
toHeroes->activate();
|
||||||
|
if (state == 1)
|
||||||
|
for (int i=0; i<size; i++)
|
||||||
|
towns[i]->activate();
|
||||||
|
else
|
||||||
|
for (int i=0; i<size; i++)
|
||||||
|
heroes[i]->activate();
|
||||||
|
|
||||||
|
slider->activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::deactivate()
|
||||||
|
{
|
||||||
|
exit->deactivate();
|
||||||
|
toTowns->deactivate();
|
||||||
|
toHeroes->deactivate();
|
||||||
|
if (state == 1)
|
||||||
|
for (int i=0; i<size; i++)
|
||||||
|
towns[i]->deactivate();
|
||||||
|
else
|
||||||
|
for (int i=0; i<size; i++)
|
||||||
|
heroes[i]->deactivate();
|
||||||
|
slider->deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::keyPressed(const SDL_KeyboardEvent & key)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::recreateHeroList(int pos)
|
||||||
|
{
|
||||||
|
for (int j=0; j<size; j++)
|
||||||
|
delete heroes[j];//removing old list
|
||||||
|
std::vector<const CGHeroInstance*> Heroes = LOCPLINT->cb->getHeroesInfo(true);
|
||||||
|
int i=0, cnt=0;
|
||||||
|
for (int j = 0; ((j<Heroes.size()) && (i<size));j++)
|
||||||
|
{
|
||||||
|
if (Heroes[j]->inTownGarrison && (!showHarrisoned))//if hero in garrison and we don't show them
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (cnt<pos)//skipping heroes
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
continue;
|
||||||
|
}//this hero will be added
|
||||||
|
heroes[i] = new CHeroItem(i, Heroes[j]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
for (i;i<size;i++)//if we still have empty pieces
|
||||||
|
heroes[i] = new CHeroItem(i, NULL);//empty pic
|
||||||
|
GH.totalRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::recreateTownList(int pos)
|
||||||
|
{
|
||||||
|
std::vector<const CGTownInstance*> Towns = LOCPLINT->cb->getTownsInfo(true);
|
||||||
|
for(int i=0;i<size;i++)
|
||||||
|
{
|
||||||
|
delete towns[i];//remove old
|
||||||
|
if (i+pos<Towns.size())
|
||||||
|
towns[i] = new CTownItem(i, Towns[i+pos]);//and add new
|
||||||
|
else
|
||||||
|
towns[i] = new CTownItem(i, NULL);//empty pic
|
||||||
|
}
|
||||||
|
GH.totalRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::listToTowns()
|
||||||
|
{
|
||||||
|
state = 1;
|
||||||
|
toHeroes->block(0);
|
||||||
|
toTowns->block(2);
|
||||||
|
heroPos = slider->value;
|
||||||
|
slider->setAmount(LOCPLINT->cb->howManyTowns());
|
||||||
|
slider->value=townPos;//moving slider
|
||||||
|
recreateTownList(townPos);
|
||||||
|
for (size_t i=0;i<size;i++)//TODO:is this loop needed?
|
||||||
|
{
|
||||||
|
towns[i]->deactivate();
|
||||||
|
heroes[i]->activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::listToHeroes()
|
||||||
|
{
|
||||||
|
state = 2;
|
||||||
|
toHeroes->block(2);
|
||||||
|
toTowns->block(0);
|
||||||
|
townPos = slider->value;
|
||||||
|
slider->setAmount(LOCPLINT->cb->howManyHeroes(showHarrisoned));
|
||||||
|
slider->value=heroPos;//moving slider
|
||||||
|
recreateHeroList(heroPos);
|
||||||
|
for (size_t i=0;i<size;i++)//TODO:is this loop needed?
|
||||||
|
{
|
||||||
|
towns[i]->deactivate();
|
||||||
|
heroes[i]->activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::sliderMoved(int newpos)
|
||||||
|
{
|
||||||
|
if ( state == 1 )//towns
|
||||||
|
{
|
||||||
|
townPos = newpos;
|
||||||
|
recreateTownList(newpos);
|
||||||
|
}
|
||||||
|
else//heroes
|
||||||
|
{
|
||||||
|
heroPos = newpos;
|
||||||
|
recreateHeroList(newpos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::CResIncomePic::CResIncomePic(int RID, CDefEssential * Mines)
|
||||||
|
{
|
||||||
|
resID = RID;
|
||||||
|
pos.x += 20 + RID*80;
|
||||||
|
pos.y += 495;
|
||||||
|
pos.h = 54;
|
||||||
|
pos.w = (resID!=7)?68:136;//gold pile is bigger
|
||||||
|
mines = Mines;
|
||||||
|
|
||||||
|
value = 0;
|
||||||
|
int resource = resID==7?6:resID;
|
||||||
|
|
||||||
|
for(size_t i = 0; i<CGI->state->map->objects.size(); i++)
|
||||||
|
{
|
||||||
|
CGObjectInstance* obj = CGI->state->map->objects[i];
|
||||||
|
if (obj)
|
||||||
|
if (obj->ID == 53 && obj->subID == resource && //this is mine, produce required resource
|
||||||
|
CGI->state->currentPlayer == obj->tempOwner )//mine is ours
|
||||||
|
value++;
|
||||||
|
}
|
||||||
|
if (resID == 7)//we need to calculate income of whole kingdom
|
||||||
|
{
|
||||||
|
value *=1000;// mines = 1000 gold
|
||||||
|
std::vector<const CGHeroInstance*> heroes = LOCPLINT->cb->getHeroesInfo(true);
|
||||||
|
for(size_t i=0; i<heroes.size();i++)
|
||||||
|
switch(heroes[i]->getSecSkillLevel(13))//some heroes may have estates
|
||||||
|
{
|
||||||
|
case 1: //basic
|
||||||
|
value += 125;
|
||||||
|
break;
|
||||||
|
case 2: //advanced
|
||||||
|
value += 250;
|
||||||
|
break;
|
||||||
|
case 3: //expert
|
||||||
|
value += 500;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::vector<const CGTownInstance*> towns = LOCPLINT->cb->getTownsInfo(true);
|
||||||
|
for(size_t i=0; i<towns.size();i++)
|
||||||
|
value += towns[i]->dailyIncome();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::CResIncomePic::~CResIncomePic()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CResIncomePic::hover(bool on)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CResIncomePic::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
if (resID < 7)//this is not income
|
||||||
|
blitAt(mines->ourImages[resID].bitmap,pos.x,pos.y,to);
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << value;
|
||||||
|
CSDL_Ext::printAtMiddle(oss.str(),pos.x+pos.w/2,pos.y+50,GEOR13,zwykly,to);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CKingdomInterface::CTownItem::CTownItem(int num, const CGTownInstance * Town)
|
||||||
|
{
|
||||||
|
// defActions = ACTIVATE | DEACTIVATE | SHOWALL | DISPOSE;
|
||||||
|
numb = num;
|
||||||
|
pos.x = screen->w/2 - 400 + 23;
|
||||||
|
pos.y = screen->h/2 - 300 + 26+num*116;
|
||||||
|
pos.w = 702;
|
||||||
|
pos.h = 114;
|
||||||
|
town = Town;
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::CTownItem::~CTownItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CTownItem::activate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CTownItem::deactivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CTownItem::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
if (!town)
|
||||||
|
{//if NULL - print background & exit
|
||||||
|
blitAt(slots->ourImages[numb % PicCount].bitmap,pos.x,pos.y,to);
|
||||||
|
return;
|
||||||
|
}//background
|
||||||
|
blitAt(slots->ourImages[6].bitmap,pos.x,pos.y,to);
|
||||||
|
//town pic/name
|
||||||
|
int townPic = town->subID*2;
|
||||||
|
if (!town->hasFort())
|
||||||
|
townPic += F_NUMBER*2;
|
||||||
|
if(town->builded >= MAX_BUILDING_PER_TURN)
|
||||||
|
townPic++;
|
||||||
|
blitAt(graphics->bigTownPic->ourImages[townPic].bitmap,pos.x+5,pos.y+6,to);
|
||||||
|
CSDL_Ext::printAt(town->name,pos.x+73,pos.y+7,GEOR13,zwykly,to);
|
||||||
|
//fort pic
|
||||||
|
townPic = town->fortLevel()-1;
|
||||||
|
if (townPic==-1) townPic = 3;
|
||||||
|
blitAt(fort->ourImages[townPic].bitmap,pos.x+111,pos.y+31,to);
|
||||||
|
//hall pic
|
||||||
|
townPic = town->hallLevel();
|
||||||
|
blitAt(hall->ourImages[townPic].bitmap,pos.x+69,pos.y+31,to);
|
||||||
|
//income pic
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << town->dailyIncome();
|
||||||
|
CSDL_Ext::printAtMiddle(oss.str(),pos.x+188,pos.y+60,GEOR13,zwykly,to);
|
||||||
|
// Creature bonuses/ Creature available texts - need to find text wrapper thingy
|
||||||
|
// CSDL_Ext::printAtWR(CGI->generaltexth->allTexts[265],pos.x,pos.y+80,GEOR13,zwykly,to);
|
||||||
|
// CSDL_Ext::printTo(CGI->generaltexth->allTexts[266],pos.x+350,pos.y+80,GEOR13,zwykly,to);
|
||||||
|
for (int i=0; i<CREATURES_PER_TOWN;i++)
|
||||||
|
{//creatures info
|
||||||
|
int crid = -1;
|
||||||
|
int bid = 30+i;
|
||||||
|
if (!vstd::contains(town->builtBuildings,bid))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (vstd::contains(town->builtBuildings,bid+CREATURES_PER_TOWN))
|
||||||
|
{
|
||||||
|
crid = town->town->upgradedCreatures[i];
|
||||||
|
bid += CREATURES_PER_TOWN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
crid = town->town->basicCreatures[i];
|
||||||
|
//creature growth
|
||||||
|
blitAt(graphics->smallImgs[crid],pos.x+56+i*37,pos.y+78,to);
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << '+' << town->creatureGrowth(i);
|
||||||
|
CSDL_Ext::printTo(oss.str(),pos.x+87+i*37,pos.y+110,GEORM,zwykly,to);
|
||||||
|
//creature available
|
||||||
|
blitAt(graphics->smallImgs[crid],pos.x+409+i*37,pos.y+78,to);
|
||||||
|
std::ostringstream ostrs;
|
||||||
|
ostrs << town->creatures[i].first;
|
||||||
|
CSDL_Ext::printTo(ostrs.str(),pos.x+440+i*37,pos.y+110,GEORM,zwykly,to);
|
||||||
|
}
|
||||||
|
const CGHeroInstance * hero = town->garrisonHero;
|
||||||
|
int posX = 244;
|
||||||
|
for (int i=0;i<2;i++)
|
||||||
|
{//heroes info
|
||||||
|
if (hero)
|
||||||
|
{
|
||||||
|
int iter = 0;//portrait
|
||||||
|
blitAt(graphics->portraitLarge[hero->portrait],pos.x+posX,pos.y+6,to);
|
||||||
|
for(std::map<si32,std::pair<ui32,si32> >::const_iterator
|
||||||
|
j=hero->army.slots.begin(); j!=hero->army.slots.end(); j++)
|
||||||
|
{//army
|
||||||
|
int X = (iter<4)?(pos.x+posX+70+36*iter):(pos.x+posX+88+36*(iter-4));
|
||||||
|
int Y = (iter<4)?(pos.y+3):(pos.y+40);
|
||||||
|
iter++;
|
||||||
|
blitAt(graphics->smallImgs[j->second.first],X,Y,to);
|
||||||
|
std::ostringstream creanum;
|
||||||
|
creanum << (j->second.second);
|
||||||
|
CSDL_Ext::printTo(creanum.str(),X+30,Y+32,GEORM,zwykly,to);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hero = town->visitingHero;
|
||||||
|
posX = 476;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::CHeroItem::CHeroItem(int num, const CGHeroInstance * Hero)
|
||||||
|
{
|
||||||
|
numb = num;
|
||||||
|
pos.x = screen->w/2 - 400 + 23;
|
||||||
|
pos.y = screen->h/2 - 300 + 26+num*116;
|
||||||
|
pos.w = 702;
|
||||||
|
pos.h = 114;
|
||||||
|
hero = Hero;
|
||||||
|
artGroup = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CKingdomInterface::CHeroItem::~CHeroItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CHeroItem::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
if (!hero)
|
||||||
|
{//if we have no hero for this slot - print background & exit
|
||||||
|
blitAt(slots->ourImages[numb % PicCount].bitmap,pos.x,pos.y,to);
|
||||||
|
return;
|
||||||
|
}//print background, different for arts view/backpack mode
|
||||||
|
blitAt(slots->ourImages[(artGroup=2)?4:5].bitmap,pos.x,pos.y,to);
|
||||||
|
//text "Artifacts"
|
||||||
|
CSDL_Ext::printAtMiddle(CGI->generaltexth->overview[2],pos.x+320,pos.y+55,GEOR13,zwykly,to);
|
||||||
|
int X = pos.x+6;//portrait
|
||||||
|
blitAt(graphics->portraitLarge[hero->portrait],pos.x+5,pos.y+6,to);
|
||||||
|
for(std::map<si32,std::pair<ui32,si32> >::const_iterator
|
||||||
|
j=hero->army.slots.begin(); j!=hero->army.slots.end(); j++)
|
||||||
|
{//army
|
||||||
|
blitAt(graphics->smallImgs[j->second.first],X,pos.y+78,to);
|
||||||
|
std::ostringstream creanum;
|
||||||
|
creanum << (j->second.second);
|
||||||
|
CSDL_Ext::printTo(creanum.str(),X+30,pos.y+110,GEOR13,zwykly,to);
|
||||||
|
X+=36;
|
||||||
|
}//hero name
|
||||||
|
CSDL_Ext::printAt(hero->name,pos.x+73,pos.y+7,GEOR13,zwykly,to);
|
||||||
|
for (int i = 0; i<6; i++)
|
||||||
|
{//primary skills, mana and exp. pics
|
||||||
|
blitAt(graphics->pskillst->ourImages[i].bitmap,(i<4)?(pos.x+78+36*i):(pos.x+539-52*i),
|
||||||
|
(i<4)?(pos.y+26):(pos.y+6),to);
|
||||||
|
if (i>3) continue;//primary skills text
|
||||||
|
std::ostringstream str;
|
||||||
|
str << (hero->primSkills[i]);
|
||||||
|
CSDL_Ext::printAtMiddle(str.str(),pos.x+95+36*i,pos.y+65,GEOR13,zwykly,to);
|
||||||
|
}
|
||||||
|
{//luck and morale pics, experience and mana text
|
||||||
|
blitAt(graphics->luck30->ourImages[hero->getCurrentLuck()+3].bitmap,pos.x+222,pos.y+30,to);
|
||||||
|
blitAt(graphics->morale30->ourImages[hero->getCurrentMorale()+3].bitmap,pos.x+222,pos.y+54,to);
|
||||||
|
std::ostringstream str;
|
||||||
|
str << (hero->exp);
|
||||||
|
CSDL_Ext::printAtMiddle(str.str(),(pos.x+348),(pos.y+31),GEORM,zwykly,to);
|
||||||
|
std::ostringstream strnew;
|
||||||
|
strnew << (hero->mana)<<"/"<<(hero->manaLimit());
|
||||||
|
CSDL_Ext::printAtMiddle(strnew.str(),(pos.x+298),(pos.y+31),GEORM,zwykly,to);
|
||||||
|
}
|
||||||
|
//hero speciality
|
||||||
|
blitAt(graphics->un32->ourImages[hero->subID].bitmap, pos.x+375, pos.y+6, to);
|
||||||
|
|
||||||
|
for(int i=0; i<hero->secSkills.size(); i++)
|
||||||
|
{//secondary skills
|
||||||
|
int skill = hero->secSkills[i].first,
|
||||||
|
level = hero->secSkills[i].second;
|
||||||
|
blitAt(graphics->abils32->ourImages[skill*3+level+2].bitmap,pos.x+411+i*36,pos.y+6,to);
|
||||||
|
}
|
||||||
|
|
||||||
|
int iter=0;
|
||||||
|
switch (artGroup)
|
||||||
|
{//arts
|
||||||
|
case 1:iter = 9;//misc. arts, spellbook, war machines
|
||||||
|
case 0://equipped arts
|
||||||
|
for (int i = iter ; i<iter+9;i++)
|
||||||
|
{
|
||||||
|
int artID = hero->getArtAtPos(i);
|
||||||
|
if (artID>=0)
|
||||||
|
blitAt(graphics->artDefs->ourImages[artID].bitmap,pos.x+268+48*(i%9),pos.y+66,to);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2://TODO:backpack
|
||||||
|
break;
|
||||||
|
default: tlog1<<"Unknown artifact group: "<<artGroup<<"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CHeroItem::onArtChange(int newstate)
|
||||||
|
{
|
||||||
|
artGroup = newstate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CHeroItem::activate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CKingdomInterface::CHeroItem::deactivate()
|
||||||
|
{
|
||||||
|
}
|
109
client/CKingdomInterface.h
Normal file
109
client/CKingdomInterface.h
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#ifndef __CKINGDOMINTERFACE_H__
|
||||||
|
#define __CKINGDOMINTERFACE_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "../global.h"
|
||||||
|
#include <SDL.h>
|
||||||
|
#include "GUIBase.h"
|
||||||
|
#include "../hch/CMusicBase.h"
|
||||||
|
class AdventureMapButton;
|
||||||
|
class CHighlightableButtonsGroup;
|
||||||
|
class CResDataBar;
|
||||||
|
class CStatusBar;
|
||||||
|
class CSlider;
|
||||||
|
class CMinorResDataBar;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CKingdomInterface.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
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CKingdomInterface : public CIntObject
|
||||||
|
{
|
||||||
|
/* class CDwellingList : public
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||||
|
void genList();
|
||||||
|
void select(int which);
|
||||||
|
void draw(SDL_Surface * to);
|
||||||
|
int size(); //how many elements do we have
|
||||||
|
}*/
|
||||||
|
class CResIncomePic : public CIntObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int resID,value;//resource ID
|
||||||
|
CResIncomePic(int RID, CDefEssential * Mines);//c-tor
|
||||||
|
~CResIncomePic();//d-tor
|
||||||
|
void hover(bool on);
|
||||||
|
void show(SDL_Surface * to);
|
||||||
|
CDefEssential * mines;//pointer to mines pictures;
|
||||||
|
};
|
||||||
|
class CTownItem : public CIntObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int numb;//position on screen (1..4)
|
||||||
|
const CGTownInstance * town;
|
||||||
|
void show(SDL_Surface * to);
|
||||||
|
void activate();
|
||||||
|
void deactivate();
|
||||||
|
CTownItem (int num, const CGTownInstance * Town);//c-tor
|
||||||
|
~CTownItem();//d-tor
|
||||||
|
};
|
||||||
|
class CHeroItem : public CIntObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
const CGHeroInstance * hero;
|
||||||
|
int artGroup,numb;//current art group (0 = equiped, 1 = misc, 2 = backpack)
|
||||||
|
void onArtChange(int newstate);//changes artgroup
|
||||||
|
void show(SDL_Surface * to);
|
||||||
|
void activate();
|
||||||
|
void deactivate();
|
||||||
|
CHeroItem (int num, const CGHeroInstance * Hero);//c-tor
|
||||||
|
~CHeroItem();//d-tor
|
||||||
|
};
|
||||||
|
public:
|
||||||
|
//common data
|
||||||
|
int state;//0 = initialisation 1 = towns showed, 2 = heroes;
|
||||||
|
SDL_Surface * bg;//background
|
||||||
|
CStatusBar * statusbar;//statusbar
|
||||||
|
CResDataBar *resdatabar;//resources
|
||||||
|
|
||||||
|
AdventureMapButton *exit;//exit button
|
||||||
|
AdventureMapButton *toTowns;//town button
|
||||||
|
AdventureMapButton *toHeroes;//hero button
|
||||||
|
CDefEssential * title; //title bar
|
||||||
|
//hero/town lists
|
||||||
|
bool showHarrisoned;//show harrisoned hero in heroes list or not
|
||||||
|
CSlider * slider;//slider
|
||||||
|
int heroPos,townPos,size;//position of lists; size of list
|
||||||
|
std::vector<CHeroItem *> heroes;//heroes list
|
||||||
|
std::vector<CTownItem *> towns;//towns list
|
||||||
|
static CDefEssential * slots, *fort, *hall;
|
||||||
|
|
||||||
|
//income pics
|
||||||
|
std::vector<CResIncomePic *> incomes;//mines + incomes
|
||||||
|
CDefEssential * mines;//picture of mines
|
||||||
|
|
||||||
|
CKingdomInterface(); //c-tor
|
||||||
|
~CKingdomInterface(); //d-tor
|
||||||
|
void recreateHeroList(int pos);//recreating heroes list (on slider move)
|
||||||
|
void recreateTownList(int pos);//same for town list
|
||||||
|
void keyPressed(const SDL_KeyboardEvent & key);
|
||||||
|
void listToTowns();//changing list to town view
|
||||||
|
void listToHeroes();//changing list to heroes view
|
||||||
|
void sliderMoved(int newpos);//when we move a slider...
|
||||||
|
void show(SDL_Surface * to);
|
||||||
|
void showAll(SDL_Surface * to);
|
||||||
|
void close();
|
||||||
|
void activate();
|
||||||
|
void deactivate();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __CCASTLEINTERFACE_H__
|
@ -294,6 +294,7 @@ Graphics::Graphics()
|
|||||||
tasks += GET_DEF_ESS(pskillsm,"PSKIL42.DEF");
|
tasks += GET_DEF_ESS(pskillsm,"PSKIL42.DEF");
|
||||||
tasks += GET_DEF_ESS(pskillst,"PSKIL32.DEF");
|
tasks += GET_DEF_ESS(pskillst,"PSKIL32.DEF");
|
||||||
tasks += GET_DEF_ESS(resources,"RESOUR82.DEF");
|
tasks += GET_DEF_ESS(resources,"RESOUR82.DEF");
|
||||||
|
tasks += GET_DEF_ESS(un32,"UN32.DEF");
|
||||||
tasks += GET_DEF_ESS(un44,"UN44.DEF");
|
tasks += GET_DEF_ESS(un44,"UN44.DEF");
|
||||||
tasks += GET_DEF_ESS(smallIcons,"ITPA.DEF");
|
tasks += GET_DEF_ESS(smallIcons,"ITPA.DEF");
|
||||||
tasks += GET_DEF_ESS(resources32,"RESOURCE.DEF");
|
tasks += GET_DEF_ESS(resources32,"RESOURCE.DEF");
|
||||||
@ -676,3 +677,10 @@ int Font::getWidth(const char *text ) const
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
void Font::WriteAt(const char *text, SDL_Surface *sur, int x, int y )
|
||||||
|
{
|
||||||
|
SDL_Surface *SDL_CreateRGBSurfaceFrom(pixels, w, h, 8, int pitch,
|
||||||
|
224, 28, 3, 0);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
@ -72,6 +72,7 @@ public:
|
|||||||
CDefEssential * pskillsb, *resources; //82x93
|
CDefEssential * pskillsb, *resources; //82x93
|
||||||
CDefEssential * pskillsm; //42x42 primary skills
|
CDefEssential * pskillsm; //42x42 primary skills
|
||||||
CDefEssential * pskillst; //32x32
|
CDefEssential * pskillst; //32x32
|
||||||
|
CDefEssential * un32; //many small things
|
||||||
CDefEssential * un44; //many things
|
CDefEssential * un44; //many things
|
||||||
CDefEssential * smallIcons, *resources32; //resources 32x32
|
CDefEssential * smallIcons, *resources32; //resources 32x32
|
||||||
CDefEssential * flags;
|
CDefEssential * flags;
|
||||||
|
@ -54,6 +54,8 @@ vcmiclient_SOURCES = \
|
|||||||
CGameInfo.h \
|
CGameInfo.h \
|
||||||
CHeroWindow.cpp \
|
CHeroWindow.cpp \
|
||||||
CHeroWindow.h \
|
CHeroWindow.h \
|
||||||
|
CKingdomInterface.cpp \
|
||||||
|
CKingdomInterface.h \
|
||||||
CMT.cpp \
|
CMT.cpp \
|
||||||
CMessage.cpp \
|
CMessage.cpp \
|
||||||
CMessage.h \
|
CMessage.h \
|
||||||
|
@ -73,7 +73,9 @@ am_vcmiclient_OBJECTS = vcmiclient-CCallback.$(OBJEXT) \
|
|||||||
vcmiclient-CCreatureAnimation.$(OBJEXT) \
|
vcmiclient-CCreatureAnimation.$(OBJEXT) \
|
||||||
vcmiclient-CCursorHandler.$(OBJEXT) \
|
vcmiclient-CCursorHandler.$(OBJEXT) \
|
||||||
vcmiclient-CGameInfo.$(OBJEXT) \
|
vcmiclient-CGameInfo.$(OBJEXT) \
|
||||||
vcmiclient-CHeroWindow.$(OBJEXT) vcmiclient-CMT.$(OBJEXT) \
|
vcmiclient-CHeroWindow.$(OBJEXT) \
|
||||||
|
vcmiclient-CKingdomInterface.$(OBJEXT) \
|
||||||
|
vcmiclient-CMT.$(OBJEXT) \
|
||||||
vcmiclient-CMessage.$(OBJEXT) \
|
vcmiclient-CMessage.$(OBJEXT) \
|
||||||
vcmiclient-CPlayerInterface.$(OBJEXT) \
|
vcmiclient-CPlayerInterface.$(OBJEXT) \
|
||||||
vcmiclient-CPreGame.$(OBJEXT) \
|
vcmiclient-CPreGame.$(OBJEXT) \
|
||||||
@ -296,6 +298,8 @@ vcmiclient_SOURCES = \
|
|||||||
CGameInfo.h \
|
CGameInfo.h \
|
||||||
CHeroWindow.cpp \
|
CHeroWindow.cpp \
|
||||||
CHeroWindow.h \
|
CHeroWindow.h \
|
||||||
|
CKingdomInterface.cpp \
|
||||||
|
CKingdomInterface.h \
|
||||||
CMT.cpp \
|
CMT.cpp \
|
||||||
CMessage.cpp \
|
CMessage.cpp \
|
||||||
CMessage.h \
|
CMessage.h \
|
||||||
@ -421,6 +425,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CGameInfo.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CGameInfo.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CGameInterface.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CGameInterface.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CHeroWindow.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CHeroWindow.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CKingdomInterface.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMT.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMT.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMessage.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMessage.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMusicHandler.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vcmiclient-CMusicHandler.Po@am__quote@
|
||||||
@ -712,6 +717,20 @@ vcmiclient-CHeroWindow.obj: CHeroWindow.cpp
|
|||||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CHeroWindow.obj `if test -f 'CHeroWindow.cpp'; then $(CYGPATH_W) 'CHeroWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/CHeroWindow.cpp'; fi`
|
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CHeroWindow.obj `if test -f 'CHeroWindow.cpp'; then $(CYGPATH_W) 'CHeroWindow.cpp'; else $(CYGPATH_W) '$(srcdir)/CHeroWindow.cpp'; fi`
|
||||||
|
|
||||||
|
vcmiclient-CKingdomInterface.o: CKingdomInterface.cpp
|
||||||
|
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CKingdomInterface.o -MD -MP -MF $(DEPDIR)/vcmiclient-CKingdomInterface.Tpo -c -o vcmiclient-CKingdomInterface.o `test -f 'CKingdomInterface.cpp' || echo '$(srcdir)/'`CKingdomInterface.cpp
|
||||||
|
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vcmiclient-CKingdomInterface.Tpo $(DEPDIR)/vcmiclient-CKingdomInterface.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CKingdomInterface.cpp' object='vcmiclient-CKingdomInterface.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CKingdomInterface.o `test -f 'CKingdomInterface.cpp' || echo '$(srcdir)/'`CKingdomInterface.cpp
|
||||||
|
|
||||||
|
vcmiclient-CKingdomInterface.obj: CKingdomInterface.cpp
|
||||||
|
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CKingdomInterface.obj -MD -MP -MF $(DEPDIR)/vcmiclient-CKingdomInterface.Tpo -c -o vcmiclient-CKingdomInterface.obj `if test -f 'CKingdomInterface.cpp'; then $(CYGPATH_W) 'CKingdomInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/CKingdomInterface.cpp'; fi`
|
||||||
|
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vcmiclient-CKingdomInterface.Tpo $(DEPDIR)/vcmiclient-CKingdomInterface.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CKingdomInterface.cpp' object='vcmiclient-CKingdomInterface.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -c -o vcmiclient-CKingdomInterface.obj `if test -f 'CKingdomInterface.cpp'; then $(CYGPATH_W) 'CKingdomInterface.cpp'; else $(CYGPATH_W) '$(srcdir)/CKingdomInterface.cpp'; fi`
|
||||||
|
|
||||||
vcmiclient-CMT.o: CMT.cpp
|
vcmiclient-CMT.o: CMT.cpp
|
||||||
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMT.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMT.Tpo -c -o vcmiclient-CMT.o `test -f 'CMT.cpp' || echo '$(srcdir)/'`CMT.cpp
|
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(vcmiclient_CXXFLAGS) $(CXXFLAGS) -MT vcmiclient-CMT.o -MD -MP -MF $(DEPDIR)/vcmiclient-CMT.Tpo -c -o vcmiclient-CMT.o `test -f 'CMT.cpp' || echo '$(srcdir)/'`CMT.cpp
|
||||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vcmiclient-CMT.Tpo $(DEPDIR)/vcmiclient-CMT.Po
|
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vcmiclient-CMT.Tpo $(DEPDIR)/vcmiclient-CMT.Po
|
||||||
|
@ -98,6 +98,7 @@ void FoWChange::applyCl( CClient *cl )
|
|||||||
else
|
else
|
||||||
cl->playerint[player]->tileHidden(tiles);
|
cl->playerint[player]->tileHidden(tiles);
|
||||||
|
|
||||||
|
if (cl->IGameCallback::getSelectedHero(player))//if we have selected hero...
|
||||||
GS(cl)->calculatePaths(cl->IGameCallback::getSelectedHero(player), *cl->pathInfo);
|
GS(cl)->calculatePaths(cl->IGameCallback::getSelectedHero(player), *cl->pathInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +352,15 @@ void CGeneralTextHandler::load()
|
|||||||
allTexts.push_back(buflet);
|
allTexts.push_back(buflet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string stro = bitmaph->getTextFile("Overview.txt");
|
||||||
|
itr=0;
|
||||||
|
while(itr<stro.length()-1)
|
||||||
|
{
|
||||||
|
loadToIt(tmp, stro, itr, 3);
|
||||||
|
trimQuotation(tmp);
|
||||||
|
overview.push_back(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
std::string strs = bitmaph->getTextFile("ARRAYTXT.TXT");
|
std::string strs = bitmaph->getTextFile("ARRAYTXT.TXT");
|
||||||
|
|
||||||
itr=0;
|
itr=0;
|
||||||
|
@ -33,6 +33,7 @@ public:
|
|||||||
std::vector<std::string> primarySkillNames;
|
std::vector<std::string> primarySkillNames;
|
||||||
std::vector<std::string> jktexts;
|
std::vector<std::string> jktexts;
|
||||||
std::vector<std::string> heroscrn;
|
std::vector<std::string> heroscrn;
|
||||||
|
std::vector<std::string> overview;//text for Kingdom Overview window
|
||||||
|
|
||||||
//artifacts
|
//artifacts
|
||||||
std::vector<std::string> artifEvents;
|
std::vector<std::string> artifEvents;
|
||||||
|
@ -775,6 +775,9 @@ void CGameHandler::newTurn()
|
|||||||
n.day = gs->day + 1;
|
n.day = gs->day + 1;
|
||||||
n.resetBuilded = true;
|
n.resetBuilded = true;
|
||||||
|
|
||||||
|
std::map<ui8, si32> hadGold;//starting gold - for buildings like dwarven treasury
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
std::map<ui32,CGHeroInstance *> pool = gs->hpool.heroesPool;
|
std::map<ui32,CGHeroInstance *> pool = gs->hpool.heroesPool;
|
||||||
|
|
||||||
for ( std::map<ui8, PlayerState>::iterator i=gs->players.begin() ; i!=gs->players.end();i++)
|
for ( std::map<ui8, PlayerState>::iterator i=gs->players.begin() ; i!=gs->players.end();i++)
|
||||||
@ -782,6 +785,10 @@ void CGameHandler::newTurn()
|
|||||||
if(i->first == 255) continue;
|
if(i->first == 255) continue;
|
||||||
else if(i->first > PLAYER_LIMIT) assert(0); //illegal player number!
|
else if(i->first > PLAYER_LIMIT) assert(0); //illegal player number!
|
||||||
|
|
||||||
|
std::pair<ui8,si32> playerGold(i->first,i->second.resources[6]);
|
||||||
|
hadGold.insert(playerGold);
|
||||||
|
tlog1<<i->first<<" & "<<i->second.resources[6]<<"\n";
|
||||||
|
|
||||||
if(gs->getDate(1)==7) //first day of week - new heroes in tavern
|
if(gs->getDate(1)==7) //first day of week - new heroes in tavern
|
||||||
{
|
{
|
||||||
SetAvailableHeroes sah;
|
SetAvailableHeroes sah;
|
||||||
@ -849,6 +856,20 @@ void CGameHandler::newTurn()
|
|||||||
ui8 player = (*j)->tempOwner;
|
ui8 player = (*j)->tempOwner;
|
||||||
if(gs->getDate(1)==7) //first day of week
|
if(gs->getDate(1)==7) //first day of week
|
||||||
{
|
{
|
||||||
|
if ( ((**j).subID == 1) && (gs->getDate(0)) && (player < PLAYER_LIMIT) )//this is rampart and not a first day
|
||||||
|
{
|
||||||
|
if (vstd::contains((**j).builtBuildings,22))//we have treasury
|
||||||
|
{
|
||||||
|
n.res[player][6] += hadGold[player]/10; //give 10% of starting gold
|
||||||
|
}
|
||||||
|
if (vstd::contains((**j).builtBuildings,17))//we have mystic pond
|
||||||
|
{//TODO: whole week pond should have message "pond produced %d" - need vars to store it
|
||||||
|
int restype = rand()%4+2;//bonus to random rare resource
|
||||||
|
restype = (restype==2)?1:restype;
|
||||||
|
int cnt = rand()%4+1;//with size 1..4
|
||||||
|
n.res[player][restype] += cnt;
|
||||||
|
}
|
||||||
|
}
|
||||||
SetAvailableCreatures sac;
|
SetAvailableCreatures sac;
|
||||||
sac.tid = (**j).id;
|
sac.tid = (**j).id;
|
||||||
sac.creatures = (**j).creatures;
|
sac.creatures = (**j).creatures;
|
||||||
|
Loading…
Reference in New Issue
Block a user