1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Wspólne zmiany (Common changes)

* fixed heroWindow
* started making garrisons
This commit is contained in:
mateuszb
2008-01-26 19:36:31 +00:00
parent b5ecb2e146
commit 8da051febf
9 changed files with 348 additions and 48 deletions

View File

@@ -373,6 +373,26 @@ int CCallback::getHeroSerial(const CGHeroInstance * hero)
} }
return -1; return -1;
} }
int CCallback::swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int p1, int p2)
{
CCreatureSet *S1=const_cast<CCreatureSet *>(s1), *S2 = const_cast<CCreatureSet *>(s2);//todo - ugly
if (false)
{
//TODO: check if we are allowed to swap these creatures
return -1;
}
//if(S1->slots[p1].first)
{
//if(s2->slots[p2].first)
{
CCreature * pom = S2->slots[p2].first;
S2->slots[p2].first = S1->slots[p1].first;
S1->slots[p1].first = pom;
}
}
return -1;
}
int CCallback::getMySerial() int CCallback::getMySerial()
{ {
return gs->players[player].serial; return gs->players[player].serial;

View File

@@ -34,6 +34,7 @@ public:
virtual int getMyColor()=0; virtual int getMyColor()=0;
virtual int getMySerial()=0; virtual int getMySerial()=0;
virtual int getHeroSerial(const CGHeroInstance * hero)=0; virtual int getHeroSerial(const CGHeroInstance * hero)=0;
virtual int swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int p1, int p2)=0;//swaps creatures between two posiibly different garrisons // TODO: AI-unsafe code - fix it!
}; };
struct HeroMoveDetails struct HeroMoveDetails
@@ -78,6 +79,7 @@ public:
int getMyColor(); int getMyColor();
int getHeroSerial(const CGHeroInstance * hero); int getHeroSerial(const CGHeroInstance * hero);
int getMySerial(); int getMySerial();
int swapCreatures(const CCreatureSet *s1, const CCreatureSet *s2, int p1, int p2);
//friends //friends
friend int _tmain(int argc, _TCHAR* argv[]); friend int _tmain(int argc, _TCHAR* argv[]);

View File

@@ -155,7 +155,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
flag = CGI->spriteh->giveDef("CREST58.DEF"); flag = CGI->spriteh->giveDef("CREST58.DEF");
CSDL_Ext::blueToPlayersAdv(townInt,LOCPLINT->playerID); CSDL_Ext::blueToPlayersAdv(townInt,LOCPLINT->playerID);
exit = new AdventureMapButton<CCastleInterface> exit = new AdventureMapButton<CCastleInterface>
(CGI->townh->tcommands[8],"",&CCastleInterface::close,744,544,"TSBTNS.DEF",this,Activate); (CGI->townh->tcommands[8],"",&CCastleInterface::close,744,544,"TSBTNS.DEF",this,false);
exit->bitmapOffset = 4; exit->bitmapOffset = 4;
for (std::set<int>::const_iterator i=town->builtBuildings.begin();i!=town->builtBuildings.end();i++) for (std::set<int>::const_iterator i=town->builtBuildings.begin();i!=town->builtBuildings.end();i++)
@@ -173,6 +173,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
} }
std::sort(buildings.begin(),buildings.end(),srthlp); std::sort(buildings.begin(),buildings.end(),srthlp);
garr = new CGarrisonInt(305,387,4,32,townInt,241,13,&town->garrison,(town->garrisonHero)?(&town->garrisonHero->army):(NULL));
if(Activate) if(Activate)
{ {
@@ -281,23 +282,25 @@ void CCastleInterface::showAll(SDL_Surface * to)
//flag //flag
blitAt(flag->ourImages[town->getOwner()].bitmap,241,387,to); blitAt(flag->ourImages[town->getOwner()].bitmap,241,387,to);
//print garrison //print garrison
for( //for(
std::map<int,std::pair<CCreature*,int> >::const_iterator i=town->garrison.slots.begin(); // std::map<int,std::pair<CCreature*,int> >::const_iterator i=town->garrison.slots.begin();
i!=town->garrison.slots.end(); // i!=town->garrison.slots.end();
i++ // i++
) // )
{ //{
blitAt(CGI->creh->bigImgs[i->second.first->idNumber],305+(62*(i->first)),387,to); // blitAt(CGI->creh->bigImgs[i->second.first->idNumber],305+(62*(i->first)),387,to);
itoa(i->second.second,temp,10); // itoa(i->second.second,temp,10);
CSDL_Ext::printTo(temp,305+(62*(i->first))+57,387+61,GEOR13,zwykly,to); // CSDL_Ext::printTo(temp,305+(62*(i->first))+57,387+61,GEOR13,zwykly,to);
} //}
show(); show();
} }
void CCastleInterface::show(SDL_Surface * to) void CCastleInterface::show(SDL_Surface * to)
{ {
if (!to) if (!to)
to=ekran; to=ekran;
garr->show();
count++; count++;
if(count==5) if(count==5)
{ {
@@ -333,12 +336,15 @@ void CCastleInterface::show(SDL_Surface * to)
} }
void CCastleInterface::activate() void CCastleInterface::activate()
{ {
garr->activate();
LOCPLINT->curint = this; LOCPLINT->curint = this;
exit->activate();
for(int i=0;i<buildings.size();i++) for(int i=0;i<buildings.size();i++)
buildings[i]->activate(); buildings[i]->activate();
} }
void CCastleInterface::deactivate() void CCastleInterface::deactivate()
{ {
garr->deactivate();
exit->deactivate(); exit->deactivate();
for(int i=0;i<buildings.size();i++) for(int i=0;i<buildings.size();i++)
buildings[i]->deactivate(); buildings[i]->deactivate();

View File

@@ -38,6 +38,7 @@ public:
CDefHandler *hall,*fort, CDefHandler *hall,*fort,
*bigTownPic, *flag; *bigTownPic, *flag;
CGarrisonInt * garr;
AdventureMapButton<CCastleInterface> * exit; AdventureMapButton<CCastleInterface> * exit;
std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling

View File

@@ -31,6 +31,9 @@ int internalFunc(void * callback)
int heronum; int heronum;
int3 dest; int3 dest;
if(pom==std::string("die, fool"))
exit(0);
switch (*cn.c_str()) switch (*cn.c_str())
{ {
case 'P': case 'P':

View File

@@ -118,7 +118,8 @@ void CHeroWindow::show(SDL_Surface *to)
{ {
if(!to) if(!to)
to=ekran; to=ekran;
blitAt(curBack,pos.x,pos.y,to); if(curBack)
blitAt(curBack,pos.x,pos.y,to);
quitButton->show(); quitButton->show();
dismissButton->show(); dismissButton->show();
questlogButton->show(); questlogButton->show();
@@ -192,106 +193,87 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
artFeet->pos.x = 515; artFeet->pos.x = 515;
artFeet->pos.y = 295; artFeet->pos.y = 295;
artFeet->pos.h = artFeet->pos.w = 44; artFeet->pos.h = artFeet->pos.w = 44;
artFeet->activate();
artHead = new CArtPlace(hero->artHead); artHead = new CArtPlace(hero->artHead);
artHead->pos.x = 509; artHead->pos.x = 509;
artHead->pos.y = 30; artHead->pos.y = 30;
artHead->pos.h = artHead->pos.h = 44; artHead->pos.h = artHead->pos.h = 44;
artHead->activate();
artLHand = new CArtPlace(hero->artLHand); artLHand = new CArtPlace(hero->artLHand);
artLHand->pos.x = 564; artLHand->pos.x = 564;
artLHand->pos.y = 183; artLHand->pos.y = 183;
artLHand->pos.h = artLHand->pos.h = 44; artLHand->pos.h = artLHand->pos.h = 44;
artLHand->activate();
artLRing = new CArtPlace(hero->artLRing); artLRing = new CArtPlace(hero->artLRing);
artLRing->pos.x = 610; artLRing->pos.x = 610;
artLRing->pos.y = 183; artLRing->pos.y = 183;
artLRing->pos.h = artLRing->pos.h = 44; artLRing->pos.h = artLRing->pos.h = 44;
artLRing->activate();
artMach1 = new CArtPlace(hero->artMach1); artMach1 = new CArtPlace(hero->artMach1);
artMach1->pos.x = 564; artMach1->pos.x = 564;
artMach1->pos.y = 30; artMach1->pos.y = 30;
artMach1->pos.h = artMach1->pos.h = 44; artMach1->pos.h = artMach1->pos.h = 44;
artMach1->activate();
artMach2 = new CArtPlace(hero->artMach2); artMach2 = new CArtPlace(hero->artMach2);
artMach2->pos.x = 610; artMach2->pos.x = 610;
artMach2->pos.y = 30; artMach2->pos.y = 30;
artMach2->pos.h = artMach2->pos.h = 44; artMach2->pos.h = artMach2->pos.h = 44;
artMach2->activate();
artMach3 = new CArtPlace(hero->artMach3); artMach3 = new CArtPlace(hero->artMach3);
artMach3->pos.x = 610; artMach3->pos.x = 610;
artMach3->pos.y = 76; artMach3->pos.y = 76;
artMach3->pos.h = artMach3->pos.h = 44; artMach3->pos.h = artMach3->pos.h = 44;
artMach3->activate();
artMach4 = new CArtPlace(hero->artMach4); artMach4 = new CArtPlace(hero->artMach4);
artMach4->pos.x = 610; artMach4->pos.x = 610;
artMach4->pos.y = 122; artMach4->pos.y = 122;
artMach4->pos.h = artMach4->pos.h = 44; artMach4->pos.h = artMach4->pos.h = 44;
artMach4->activate();
artMisc1 = new CArtPlace(hero->artMisc1); artMisc1 = new CArtPlace(hero->artMisc1);
artMisc1->pos.x = 383; artMisc1->pos.x = 383;
artMisc1->pos.y = 143; artMisc1->pos.y = 143;
artMisc1->pos.h = artMisc1->pos.h = 44; artMisc1->pos.h = artMisc1->pos.h = 44;
artMisc1->activate();
artMisc2 = new CArtPlace(hero->artMisc2); artMisc2 = new CArtPlace(hero->artMisc2);
artMisc2->pos.x = 399; artMisc2->pos.x = 399;
artMisc2->pos.y = 194; artMisc2->pos.y = 194;
artMisc2->pos.h = artMisc2->pos.h = 44; artMisc2->pos.h = artMisc2->pos.h = 44;
artMisc2->activate();
artMisc3 = new CArtPlace(hero->artMisc3); artMisc3 = new CArtPlace(hero->artMisc3);
artMisc3->pos.x = 415; artMisc3->pos.x = 415;
artMisc3->pos.y = 245; artMisc3->pos.y = 245;
artMisc3->pos.h = artMisc3->pos.h = 44; artMisc3->pos.h = artMisc3->pos.h = 44;
artMisc3->activate();
artMisc4 = new CArtPlace(hero->artMisc4); artMisc4 = new CArtPlace(hero->artMisc4);
artMisc4->pos.x = 431; artMisc4->pos.x = 431;
artMisc4->pos.y = 296; artMisc4->pos.y = 296;
artMisc4->pos.h = artMisc4->pos.h = 44; artMisc4->pos.h = artMisc4->pos.h = 44;
artMisc4->activate();
artMisc5 = new CArtPlace(hero->artMisc5); artMisc5 = new CArtPlace(hero->artMisc5);
artMisc5->pos.x = 381; artMisc5->pos.x = 381;
artMisc5->pos.y = 296; artMisc5->pos.y = 296;
artMisc5->pos.h = artMisc5->pos.h = 44; artMisc5->pos.h = artMisc5->pos.h = 44;
artMisc5->activate();
artNeck = new CArtPlace(hero->artNeck); artNeck = new CArtPlace(hero->artNeck);
artNeck->pos.x = 508; artNeck->pos.x = 508;
artNeck->pos.y = 79; artNeck->pos.y = 79;
artNeck->pos.h = artNeck->pos.h = 44; artNeck->pos.h = artNeck->pos.h = 44;
artNeck->activate();
artRhand = new CArtPlace(hero->artRhand); artRhand = new CArtPlace(hero->artRhand);
artRhand->pos.x = 383; artRhand->pos.x = 383;
artRhand->pos.y = 68; artRhand->pos.y = 68;
artRhand->pos.h = artRhand->pos.h = 44; artRhand->pos.h = artRhand->pos.h = 44;
artRhand->activate();
artRRing = new CArtPlace(hero->artRRing); artRRing = new CArtPlace(hero->artRRing);
artRRing->pos.x = 431; artRRing->pos.x = 431;
artRRing->pos.y = 68; artRRing->pos.y = 68;
artRRing->pos.h = artRRing->pos.h = 44; artRRing->pos.h = artRRing->pos.h = 44;
artRRing->activate();
artShoulders = new CArtPlace(hero->artShoulders); artShoulders = new CArtPlace(hero->artShoulders);
artShoulders->pos.x = 567; artShoulders->pos.x = 567;
artShoulders->pos.y = 240; artShoulders->pos.y = 240;
artShoulders->pos.h = artShoulders->pos.h = 44; artShoulders->pos.h = artShoulders->pos.h = 44;
artShoulders->activate();
artSpellBook = new CArtPlace(hero->artSpellBook); artSpellBook = new CArtPlace(hero->artSpellBook);
artSpellBook->pos.x = 610; artSpellBook->pos.x = 610;
artSpellBook->pos.y = 310; artSpellBook->pos.y = 310;
artSpellBook->pos.h = artSpellBook->pos.h = 44; artSpellBook->pos.h = artSpellBook->pos.h = 44;
artSpellBook->activate();
artTorso = new CArtPlace(hero->artTorso); artTorso = new CArtPlace(hero->artTorso);
artTorso->pos.x = 509; artTorso->pos.x = 509;
artTorso->pos.y = 130; artTorso->pos.y = 130;
artTorso->pos.h = artTorso->pos.h = 44; artTorso->pos.h = artTorso->pos.h = 44;
artTorso->activate();
for(int s=0; s<5 && s<curHero->artifacts.size(); ++s) for(int s=0; s<5 && s<curHero->artifacts.size(); ++s)
{ {
CArtPlace * add = new CArtPlace(curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ]); CArtPlace * add = new CArtPlace(curHero->artifacts[(s+backpackPos) % curHero->artifacts.size() ]);
add->pos.x = 403 + 46*s; add->pos.x = 403 + 46*s;
add->pos.y = 365; add->pos.y = 365;
add->pos.h = add->pos.h = 44; add->pos.h = add->pos.h = 44;
add->activate();
backpack.push_back(add); backpack.push_back(add);
} }
redrawCurBack();
} }
void CHeroWindow::quit() void CHeroWindow::quit()
@@ -303,19 +285,7 @@ void CHeroWindow::quit()
LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+i); LOCPLINT->objsToBlit.erase(LOCPLINT->objsToBlit.begin()+i);
} }
} }
quitButton->deactivate(); deactivate();
dismissButton->deactivate();
questlogButton->deactivate();
gar1button->deactivate();
gar2button->deactivate();
gar3button->deactivate();
gar4button->deactivate();
leftArtRoll->deactivate();
rightArtRoll->deactivate();
for(int g=0; g<heroListMi.size(); ++g)
{
heroListMi[g]->deactivate();
}
LOCPLINT->adventureInt->show(); LOCPLINT->adventureInt->show();
@@ -326,7 +296,6 @@ void CHeroWindow::quit()
if(dynamic_cast<CArtPlace*>(LOCPLINT->lclickable[v])) if(dynamic_cast<CArtPlace*>(LOCPLINT->lclickable[v]))
LOCPLINT->lclickable.erase(LOCPLINT->lclickable.begin()+v); LOCPLINT->lclickable.erase(LOCPLINT->lclickable.begin()+v);
}*/ }*/
portraitArea->deactivate();
delete artFeet; delete artFeet;
artFeet = 0; artFeet = 0;
@@ -435,6 +404,10 @@ void CHeroWindow::activate()
if(backpack[f]) if(backpack[f])
backpack[f]->activate(); backpack[f]->activate();
} }
for(int e=0; e<heroListMi.size(); ++e)
{
heroListMi[e]->activate();
}
//LOCPLINT->lclickable.push_back(artFeet); //LOCPLINT->lclickable.push_back(artFeet);
} }
@@ -499,6 +472,10 @@ void CHeroWindow::deactivate()
if(backpack[f]) if(backpack[f])
backpack[f]->deactivate(); backpack[f]->deactivate();
} }
for(int e=0; e<heroListMi.size(); ++e)
{
heroListMi[e]->deactivate();
}
} }
void CHeroWindow::dismissCurrent() void CHeroWindow::dismissCurrent()
@@ -784,8 +761,10 @@ void LClickableAreaHero::clickLeft(boost::logic::tribool down)
{ {
if(!down) if(!down)
{ {
owner->deactivate();
const CGHeroInstance * buf = LOCPLINT->cb->getHeroInfo(owner->player, id, false); const CGHeroInstance * buf = LOCPLINT->cb->getHeroInfo(owner->player, id, false);
owner->setHero(buf); owner->setHero(buf);
owner->redrawCurBack(); owner->redrawCurBack();
owner->activate();
} }
} }

View File

@@ -28,6 +28,250 @@ public:
return (*a.first)<(*b.first); return (*a.first)<(*b.first);
} }
} ocmptwo_cgin ; } ocmptwo_cgin ;
void CGarrisonSlot::hover (bool on)
{
}
void CGarrisonSlot::clickRight (tribool down)
{
}
void CGarrisonSlot::clickLeft(tribool down)
{
if(owner->ignoreEvent)
{
owner->ignoreEvent = false;
return;
}
if(down)
{
if(owner->highlighted)
{
LOCPLINT->cb->swapCreatures(
(!upg)?(owner->set1):(owner->set2),
(!owner->highlighted->upg)?(owner->set1):(owner->set2),
ID,owner->highlighted->ID);
owner->highlighted = NULL;
owner->recreateSlots();
}
else
{
owner->highlighted = this;
}
}
}
void CGarrisonSlot::activate()
{
ClickableL::activate();
ClickableR::activate();
Hoverable::activate();
}
void CGarrisonSlot::deactivate()
{
ClickableL::deactivate();
ClickableR::deactivate();
Hoverable::deactivate();
}
CGarrisonSlot::CGarrisonSlot(CGarrisonInt *Owner, int x, int y, int IID, const CCreature * Creature, int Count)
{
upg = 0;
count = Count;
ID = IID;
creature = Creature;
pos.x = x;
pos.y = y;
pos.w = 58;
pos.h = 64;
owner = Owner;
}
void CGarrisonSlot::show()
{
if(creature)
{
blitAtWR(CGI->creh->bigImgs[creature->idNumber],pos);
}
else
{
SDL_Rect jakis1 = genRect(pos.w,pos.h,owner->offx+ID*(pos.w+owner->interx),owner->offy+upg*(pos.h+owner->intery)), jakis2 = pos;
SDL_BlitSurface(owner->sur,&jakis1,ekran,&jakis2);
SDL_UpdateRect(ekran,pos.x,pos.y,pos.w,pos.h);
}
}
CGarrisonInt::~CGarrisonInt()
{
if(sup)
{
for(int i=0;i<sup->size();i++)
delete (*sup)[i];
delete sup;
}
if(sdown)
{
for(int i=0;i<sdown->size();i++)
delete (*sdown)[i];
delete sdown;
}
}
void CGarrisonInt::show()
{
if(sup)
{
for(int i = 0; i<sup->size(); i++)
if((*sup)[i])
(*sup)[i]->show();
}
if(sdown)
{
for(int i = 0; i<sdown->size(); i++)
if((*sdown)[i])
(*sdown)[i]->show();
}
if(highlighted)
{
blitAt(CGI->creh->bigImgs[-1],highlighted->pos);
}
}
void CGarrisonInt::deactiveteSlots()
{
if(sup)
{
for(int i = 0; i<sup->size(); i++)
{
if((*sup)[i])
{
(*sup)[i]->deactivate();
}
}
}
if(sdown)
{
for(int i = 0; i<sdown->size(); i++)
{
if((*sdown)[i])
{
(*sdown)[i]->deactivate();
}
}
}
}
void CGarrisonInt::activeteSlots()
{
if(sup)
{
for(int i = 0; i<sup->size(); i++)
{
if((*sup)[i])
{
(*sup)[i]->activate();
}
}
}
if(sdown)
{
for(int i = 0; i<sdown->size(); i++)
{
if((*sdown)[i])
{
(*sdown)[i]->activate();
}
}
}
}
void CGarrisonInt::createSlots()
{
if(set1)
{
sup = new std::vector<CGarrisonSlot*>(7,(CGarrisonSlot *)(NULL));
for
(std::map<int,std::pair<CCreature*,int> >::const_iterator i=set1->slots.begin();
i!=set1->slots.end(); i++)
{
(*sup)[i->first] =
new CGarrisonSlot(this, pos.x + (i->first*(58+interx)), pos.y,i->first, i->second.first,i->second.second);
}
for(int i=0; i<sup->size(); i++)
if((*sup)[i] == NULL)
(*sup)[i] = new CGarrisonSlot(this, pos.x + (i*(58+interx)), pos.y,i, NULL, 0);
}
if(set2)
{
sdown = new std::vector<CGarrisonSlot*>(7,(CGarrisonSlot *)(NULL));
for
(std::map<int,std::pair<CCreature*,int> >::const_iterator i=set2->slots.begin();
i!=set2->slots.end(); i++)
{
(*sdown)[i->first] =
new CGarrisonSlot(this, pos.x + (i->first*(58+interx)), pos.y + 64 + intery,i->first, i->second.first,i->second.second);
}
for(int i=0; i<sup->size(); i++)
if((*sdown)[i] == NULL)
(*sdown)[i] = new CGarrisonSlot(this, pos.x + (i*(58+interx)), pos.y,i, NULL, 0);
}
}
void CGarrisonInt::deleteSlots()
{
if(sup)
{
for(int i = 0; i<sup->size(); i++)
{
if((*sup)[i])
{
delete (*sup)[i];
}
}
}
if(sdown)
{
for(int i = 0; i<sdown->size(); i++)
{
if((*sdown)[i])
{
delete (*sdown)[i];
}
}
}
}
void CGarrisonInt::recreateSlots()
{
deactiveteSlots();
deleteSlots();
createSlots();
activeteSlots();
show();
}
CGarrisonInt::CGarrisonInt(int x, int y, int inx, int iny, SDL_Surface *pomsur, int OX, int OY, const CCreatureSet * s1, const CCreatureSet *s2)
:interx(inx),intery(iny),sur(pomsur),highlighted(NULL),sup(NULL),sdown(NULL),set1(s1),set2(s2),
offx(OX),offy(OY)
{
ignoreEvent = false;
pos.x=(x);
pos.y=(y);
pos.w=(58);
pos.h=(64);
createSlots();
}
void CGarrisonInt::activate()
{
if(sup)
{
for(int i = 0; i<sup->size(); i++)
if((*sup)[i])
(*sup)[i]->activate();
}
if(sdown)
{
for(int i = 0; i<sdown->size(); i++)
if((*sdown)[i])
(*sdown)[i]->activate();
}
}
void CGarrisonInt::deactivate()
{
deactiveteSlots();
}
CInfoWindow::CInfoWindow() CInfoWindow::CInfoWindow()
:okb(NMessage::ok,NULL,&CInfoWindow::okClicked) :okb(NMessage::ok,NULL,&CInfoWindow::okClicked)
{ {
@@ -1582,6 +1826,6 @@ void CPlayerInterface::openHeroWindow(const CGHeroInstance *hero)
{ {
adventureInt->heroWindow->setHero(hero); adventureInt->heroWindow->setHero(hero);
this->objsToBlit.push_back(adventureInt->heroWindow); this->objsToBlit.push_back(adventureInt->heroWindow);
adventureInt->heroWindow->activate();
adventureInt->hide(); adventureInt->hide();
adventureInt->heroWindow->activate();
} }

View File

@@ -178,6 +178,51 @@ public:
void select(bool on); void select(bool on);
SDL_Surface * getImg(); SDL_Surface * getImg();
}; };
class CGarrisonInt;
class CGarrisonSlot : public ClickableL, public ClickableR, public Hoverable
{
public:
CGarrisonInt *owner;
const CCreature * creature;
int count;
int upg; //upper garrison
virtual void hover (bool on);
void clickRight (tribool down);
void clickLeft(tribool down);
void activate();
void deactivate();
void show();
CGarrisonSlot(CGarrisonInt *Owner, int x, int y, int IID, const CCreature * Creature=NULL, int Count=0);
};
class CGarrisonInt :public CIntObject
{
public:
int interx, intery;
CGarrisonSlot *highlighted;
SDL_Surface *sur;
int offx, offy;
bool ignoreEvent;
const CCreatureSet *set1;
const CCreatureSet *set2;
std::vector<CGarrisonSlot*> *sup, *sdown;
void activate();
void deactivate();
void show();
void activeteSlots();
void deactiveteSlots();
void deleteSlots();
void createSlots();
void recreateSlots();
CGarrisonInt(int x, int y, int inx, int iny, SDL_Surface *pomsur, int OX, int OY, const CCreatureSet * s1, const CCreatureSet *s2=NULL);
~CGarrisonInt();
};
class CPlayerInterface : public CGameInterface class CPlayerInterface : public CGameInterface
{ {

View File

@@ -29,7 +29,7 @@ namespace CSDL_Ext
SDL_Surface * secondAlphaTransform(SDL_Surface * src, SDL_Surface * alpha); //alpha is a surface we want to blit src to SDL_Surface * secondAlphaTransform(SDL_Surface * src, SDL_Surface * alpha); //alpha is a surface we want to blit src to
void fullAlphaTransform(SDL_Surface *& src); //performs first and second alpha transform void fullAlphaTransform(SDL_Surface *& src); //performs first and second alpha transform
Uint32 colorToUint32(const SDL_Color * color); //little endian only Uint32 colorToUint32(const SDL_Color * color); //little endian only
void printTo(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); void printTo(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2);// quality: 0 - lowest, 1 - medium, 2 - highest; prints at right bottom corner of specific area. position of corner indicated by (x, y)
void printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest void printAtMiddle(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest
void printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran); void printAtMiddleWB(std::string text, int x, int y, TTF_Font * font, int charpr, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran);
void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest void printAt(std::string text, int x, int y, TTF_Font * font, SDL_Color kolor=tytulowy, SDL_Surface * dst=ekran, unsigned char quality = 2); // quality: 0 - lowest, 1 - medium, 2 - highest