2008-01-09 19:21:31 +02:00
# include "stdafx.h"
# include "CCastleInterface.h"
# include "hch/CObjectHandler.h"
# include "CGameInfo.h"
# include "hch/CLodHandler.h"
# include "SDL_Extensions.h"
# include "CAdvmapInterface.h"
# include "hch/CTownHandler.h"
# include "AdventureMapButton.h"
2008-03-06 20:54:35 +02:00
# include "hch/CBuildingHandler.h"
2008-01-12 13:32:40 +02:00
# include <sstream>
2008-03-06 20:54:35 +02:00
# include "CMessage.h"
2008-01-19 13:55:04 +02:00
CBuildingRect : : CBuildingRect ( Structure * Str )
: str ( Str )
{
def = CGI - > spriteh - > giveDef ( Str - > defName ) ;
2008-02-02 02:41:00 +02:00
pos . x = str - > pos . x ;
pos . y = str - > pos . y ;
pos . w = def - > ourImages [ 0 ] . bitmap - > w ;
pos . h = def - > ourImages [ 0 ] . bitmap - > h ;
if ( Str - > ID < 0 | | ( Str - > ID > = 27 & & Str - > ID < = 29 ) )
{
area = border = NULL ;
return ;
}
2008-01-20 18:24:03 +02:00
if ( border = CGI - > bitmaph - > loadBitmap ( str - > borderName ) )
SDL_SetColorKey ( border , SDL_SRCCOLORKEY , SDL_MapRGB ( border - > format , 0 , 255 , 255 ) ) ;
else
std : : cout < < " Warning: no border for " < < Str - > ID < < std : : endl ;
if ( area = CGI - > bitmaph - > loadBitmap ( str - > areaName ) )
; //SDL_SetColorKey(area,SDL_SRCCOLORKEY,SDL_MapRGB(area->format,0,255,255));
else
std : : cout < < " Warning: no area for " < < Str - > ID < < std : : endl ;
2008-01-19 13:55:04 +02:00
}
CBuildingRect : : ~ CBuildingRect ( )
{
delete def ;
if ( border )
SDL_FreeSurface ( border ) ;
if ( area )
SDL_FreeSurface ( area ) ;
}
void CBuildingRect : : activate ( )
{
2008-01-20 18:24:03 +02:00
Hoverable : : activate ( ) ;
2008-01-19 13:55:04 +02:00
ClickableL : : activate ( ) ;
ClickableR : : activate ( ) ;
}
void CBuildingRect : : deactivate ( )
{
2008-01-20 18:24:03 +02:00
Hoverable : : deactivate ( ) ;
2008-01-19 13:55:04 +02:00
ClickableL : : deactivate ( ) ;
ClickableR : : deactivate ( ) ;
}
bool CBuildingRect : : operator < ( const CBuildingRect & p2 ) const
{
if ( str - > pos . z ! = p2 . str - > pos . z )
return ( str - > pos . z ) < ( p2 . str - > pos . z ) ;
else
return ( str - > ID ) < ( p2 . str - > ID ) ;
}
2008-01-20 18:24:03 +02:00
void CBuildingRect : : hover ( bool on )
2008-01-19 13:55:04 +02:00
{
2008-01-24 00:15:33 +02:00
Hoverable : : hover ( on ) ;
if ( on )
2008-01-20 18:24:03 +02:00
{
2008-01-24 00:15:33 +02:00
MotionInterested : : activate ( ) ;
}
else
{
MotionInterested : : deactivate ( ) ;
if ( LOCPLINT - > castleInt - > hBuild = = this )
2008-01-27 22:37:10 +02:00
{
2008-01-24 00:15:33 +02:00
LOCPLINT - > castleInt - > hBuild = NULL ;
2008-01-27 22:37:10 +02:00
LOCPLINT - > statusbar - > clear ( ) ;
}
2008-01-20 18:24:03 +02:00
}
2008-01-19 13:55:04 +02:00
}
void CBuildingRect : : clickLeft ( tribool down )
{
2008-03-06 20:54:35 +02:00
if ( area & & ( CSDL_Ext : : SDL_GetPixel ( area , LOCPLINT - > current - > motion . x - pos . x , LOCPLINT - > current - > motion . y - pos . y ) ! = 0 ) ) //na polu
{
}
2008-01-19 13:55:04 +02:00
//todo - handle
}
void CBuildingRect : : clickRight ( tribool down )
{
2008-03-06 20:54:35 +02:00
if ( ( ! area ) | | ( ! ( ( bool ) down ) ) )
return ;
if ( ( CSDL_Ext : : SDL_GetPixel ( area , LOCPLINT - > current - > motion . x - pos . x , LOCPLINT - > current - > motion . y - pos . y ) ! = 0 ) ) //na polu
{
CInfoPopup * vinya = new CInfoPopup ( ) ;
vinya - > free = true ;
vinya - > bitmap = CMessage : : drawBoxTextBitmapSub
( LOCPLINT - > playerID ,
CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > description ,
LOCPLINT - > castleInt - > bicons - > ourImages [ str - > ID ] . bitmap ,
CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > name ) ;
vinya - > pos . x = ekran - > w / 2 - vinya - > bitmap - > w / 2 ;
vinya - > pos . y = ekran - > h / 2 - vinya - > bitmap - > h / 2 ;
vinya - > activate ( ) ;
}
2008-01-19 13:55:04 +02:00
}
2008-01-24 00:15:33 +02:00
void CBuildingRect : : mouseMoved ( SDL_MouseMotionEvent & sEvent )
{
if ( area )
{
if ( CSDL_Ext : : SDL_GetPixel ( area , sEvent . x - pos . x , sEvent . y - pos . y ) = = 0 ) //najechany piksel jest poza polem
{
if ( LOCPLINT - > castleInt - > hBuild = = this )
2008-01-27 22:37:10 +02:00
{
2008-01-24 00:15:33 +02:00
LOCPLINT - > castleInt - > hBuild = NULL ;
2008-01-27 22:37:10 +02:00
LOCPLINT - > statusbar - > clear ( ) ;
}
2008-01-24 00:15:33 +02:00
}
else //w polu
{
if ( LOCPLINT - > castleInt - > hBuild ) //jakis budynek jest zaznaczony
{
if ( ( * LOCPLINT - > castleInt - > hBuild ) < ( * this ) ) //ustawiamy sie, jesli jestesmy na wierzchu
{
LOCPLINT - > castleInt - > hBuild = this ;
2008-03-06 20:54:35 +02:00
if ( CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] & & CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > name . length ( ) )
LOCPLINT - > statusbar - > print ( CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > name ) ;
else
LOCPLINT - > statusbar - > print ( str - > name ) ;
2008-01-24 00:15:33 +02:00
}
}
else //nie ma budynku, wiec damy nasz
{
LOCPLINT - > castleInt - > hBuild = this ;
2008-03-06 20:54:35 +02:00
if ( CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] & & CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > name . length ( ) )
LOCPLINT - > statusbar - > print ( CGI - > buildh - > buildings [ str - > townID ] [ str - > ID ] - > name ) ;
else
LOCPLINT - > statusbar - > print ( str - > name ) ;
2008-01-24 00:15:33 +02:00
}
}
}
//if(border)
// blitAt(border,pos.x,pos.y);
}
2008-01-09 19:21:31 +02:00
std : : string getBgName ( int type ) //TODO - co z tym zrobi�?
{
switch ( type )
{
case 0 :
return " TBCSBACK.bmp " ;
case 1 :
return " TBRMBACK.bmp " ;
case 2 :
return " TBTWBACK.bmp " ;
case 3 :
return " TBINBACK.bmp " ;
case 4 :
return " TBNCBACK.bmp " ;
case 5 :
return " TBDNBACK.bmp " ;
case 6 :
return " TBSTBACK.bmp " ;
case 7 :
return " TBFRBACK.bmp " ;
case 8 :
return " TBELBACK.bmp " ;
default :
throw new std : : exception ( " std::string getBgName(int type): invalid type " ) ;
}
}
2008-01-15 23:38:01 +02:00
class SORTHELP
{
public :
bool operator ( )
2008-01-19 13:55:04 +02:00
( const CBuildingRect * a ,
const CBuildingRect * b )
2008-01-15 23:38:01 +02:00
{
2008-01-19 13:55:04 +02:00
return ( * a ) < ( * b ) ;
2008-01-15 23:38:01 +02:00
}
} srthlp ;
2008-01-09 19:21:31 +02:00
CCastleInterface : : CCastleInterface ( const CGTownInstance * Town , bool Activate )
2008-01-31 23:35:30 +02:00
{
2008-01-09 19:21:31 +02:00
townInt = CGI - > bitmaph - > loadBitmap ( " TOWNSCRN.bmp " ) ;
2008-01-31 23:35:30 +02:00
cityBg = CGI - > bitmaph - > loadBitmap ( getBgName ( Town - > subID ) ) ;
2008-01-09 19:21:31 +02:00
hall = CGI - > spriteh - > giveDef ( " ITMTL.DEF " ) ;
fort = CGI - > spriteh - > giveDef ( " ITMCL.DEF " ) ;
2008-01-12 13:32:40 +02:00
flag = CGI - > spriteh - > giveDef ( " CREST58.DEF " ) ;
2008-01-31 23:35:30 +02:00
townlist = new CTownList < CCastleInterface > ( 3 , & genRect ( 128 , 48 , 744 , 414 ) , 744 , 414 , 744 , 526 ) ;
2008-01-19 13:55:04 +02:00
exit = new AdventureMapButton < CCastleInterface >
2008-02-22 19:47:14 +02:00
( CGI - > townh - > tcommands [ 8 ] , " " , & CCastleInterface : : close , 744 , 544 , " TSBTNS.DEF " , this , false , NULL , false ) ;
2008-01-30 00:47:43 +02:00
split = new AdventureMapButton < CCastleInterface >
2008-02-22 19:47:14 +02:00
( CGI - > townh - > tcommands [ 3 ] , " " , & CCastleInterface : : splitF , 744 , 382 , " TSBTNS.DEF " , this , false , NULL , false ) ;
2008-01-27 22:37:10 +02:00
statusbar = new CStatusBar ( 8 , 555 , " TSTATBAR.bmp " , 732 ) ;
2008-01-31 23:35:30 +02:00
townlist - > owner = this ;
townlist - > fun = & CCastleInterface : : townChange ;
townlist - > genList ( ) ;
townlist - > selected = getIndexOf ( townlist - > items , Town ) ;
if ( ( townlist - > selected + 1 ) > townlist - > SIZE )
townlist - > from = townlist - > selected - townlist - > SIZE + 1 ;
hBuild = NULL ;
count = 0 ;
town = Town ;
CSDL_Ext : : blueToPlayersAdv ( townInt , LOCPLINT - > playerID ) ;
exit - > bitmapOffset = 4 ;
2008-01-27 15:18:18 +02:00
std : : set < std : : pair < int , int > > s ; //group - id
2008-01-15 23:38:01 +02:00
2008-01-28 16:01:09 +02:00
//buildings
2008-01-15 23:38:01 +02:00
for ( std : : set < int > : : const_iterator i = town - > builtBuildings . begin ( ) ; i ! = town - > builtBuildings . end ( ) ; i + + )
{
2008-01-27 15:18:18 +02:00
if ( CGI - > townh - > structures . find ( town - > subID ) ! = CGI - > townh - > structures . end ( ) ) //we have info about structures in this town
2008-01-15 23:38:01 +02:00
{
2008-01-27 15:18:18 +02:00
if ( CGI - > townh - > structures [ town - > subID ] . find ( * i ) ! = CGI - > townh - > structures [ town - > subID ] . end ( ) ) //we have info about that structure
2008-01-15 23:38:01 +02:00
{
2008-01-27 15:18:18 +02:00
Structure * st = CGI - > townh - > structures [ town - > subID ] [ * i ] ;
if ( st - > group < 0 ) //no group - just add it
{
buildings . push_back ( new CBuildingRect ( st ) ) ;
}
else
{
std : : set < std : : pair < int , int > > : : iterator obecny = s . end ( ) ;
for ( std : : set < std : : pair < int , int > > : : iterator seti = s . begin ( ) ; seti ! = s . end ( ) ; seti + + ) //check if we have already building from same group
{
if ( seti - > first = = st - > group )
{
obecny = seti ;
break ;
}
}
if ( obecny ! = s . end ( ) )
{
2008-01-29 17:08:41 +02:00
if ( ( * ( CGI - > townh - > structures [ town - > subID ] [ obecny - > second ] ) ) < ( * ( CGI - > townh - > structures [ town - > subID ] [ st - > ID ] ) ) ) //we have to replace old building with current one
2008-01-27 15:18:18 +02:00
{
for ( int itpb = 0 ; itpb < buildings . size ( ) ; itpb + + )
{
if ( buildings [ itpb ] - > str - > ID = = obecny - > second )
{
2008-02-01 23:45:07 +02:00
delete buildings [ itpb ] ;
2008-01-27 15:18:18 +02:00
buildings . erase ( buildings . begin ( ) + itpb ) ;
obecny - > second = st - > ID ;
buildings . push_back ( new CBuildingRect ( st ) ) ;
}
}
}
}
else
{
buildings . push_back ( new CBuildingRect ( st ) ) ;
s . insert ( std : : pair < int , int > ( st - > group , st - > ID ) ) ;
}
}
2008-01-15 23:38:01 +02:00
}
else continue ;
}
else
break ;
}
2008-01-28 16:01:09 +02:00
//garrison
2008-01-15 23:38:01 +02:00
std : : sort ( buildings . begin ( ) , buildings . end ( ) , srthlp ) ;
2008-01-28 16:01:09 +02:00
garr = new CGarrisonInt ( 305 , 387 , 4 , 32 , townInt , 243 , 13 , town , town - > visitingHero ) ;
2008-01-15 23:38:01 +02:00
2008-01-09 19:21:31 +02:00
if ( Activate )
{
2008-01-19 14:26:55 +02:00
LOCPLINT - > objsToBlit . push_back ( this ) ;
2008-01-09 19:21:31 +02:00
activate ( ) ;
2008-01-19 14:26:55 +02:00
showAll ( ) ;
2008-01-09 19:21:31 +02:00
}
2008-01-19 14:26:55 +02:00
2008-03-06 20:54:35 +02:00
std : : string defname ;
switch ( town - > subID )
{
case 0 :
defname = " HALLCSTL.DEF " ;
break ;
case 1 :
defname = " HALLRAMP.DEF " ;
break ;
case 2 :
defname = " HALLTOWR.DEF " ;
break ;
case 3 :
defname = " HALLINFR.DEF " ;
break ;
case 4 :
defname = " HALLNECR.DEF " ;
break ;
case 5 :
defname = " HALLDUNG.DEF " ;
break ;
case 6 :
defname = " HALLSTRN.DEF " ;
break ;
case 7 :
defname = " HALLFORT.DEF " ;
break ;
case 8 :
defname = " HALLELEM.DEF " ;
break ;
default :
throw new std : : exception ( " Bad town subID " ) ;
}
bicons = CGI - > spriteh - > giveDefEss ( defname ) ;
2008-01-19 14:26:55 +02:00
//blit buildings on bg
//for(int i=0;i<buildings.size();i++)
//{
// blitAt(buildings[i]->def->ourImages[0].bitmap,buildings[i]->pos.x,buildings[i]->pos.y,cityBg);
//}
2008-01-09 19:21:31 +02:00
}
CCastleInterface : : ~ CCastleInterface ( )
{
SDL_FreeSurface ( townInt ) ;
SDL_FreeSurface ( cityBg ) ;
delete exit ;
2008-01-30 00:47:43 +02:00
delete split ;
2008-01-09 19:21:31 +02:00
delete hall ;
delete fort ;
2008-01-12 13:32:40 +02:00
delete flag ;
2008-01-26 23:50:51 +02:00
delete garr ;
2008-01-31 23:35:30 +02:00
delete townlist ;
delete statusbar ;
2008-01-15 23:38:01 +02:00
for ( int i = 0 ; i < buildings . size ( ) ; i + + )
{
delete buildings [ i ] ;
}
2008-03-06 20:54:35 +02:00
delete bicons ;
2008-01-15 23:38:01 +02:00
2008-01-09 19:21:31 +02:00
}
void CCastleInterface : : close ( )
{
2008-01-19 14:26:55 +02:00
LOCPLINT - > objsToBlit . erase ( std : : find ( LOCPLINT - > objsToBlit . begin ( ) , LOCPLINT - > objsToBlit . end ( ) , this ) ) ;
2008-01-09 19:21:31 +02:00
deactivate ( ) ;
LOCPLINT - > castleInt = NULL ;
2008-02-23 00:26:31 +02:00
LOCPLINT - > adventureInt - > activate ( ) ;
2008-01-09 19:21:31 +02:00
delete this ;
}
2008-01-30 00:47:43 +02:00
void CCastleInterface : : splitF ( )
{
}
2008-01-19 14:26:55 +02:00
void CCastleInterface : : showAll ( SDL_Surface * to )
{
if ( ! to )
to = ekran ;
2008-01-27 22:37:10 +02:00
statusbar - > show ( ) ;
2008-01-19 14:26:55 +02:00
blitAt ( cityBg , 0 , 0 , to ) ;
blitAt ( townInt , 0 , 374 , to ) ;
2008-01-09 19:21:31 +02:00
LOCPLINT - > adventureInt - > resdatabar . draw ( ) ;
2008-01-31 23:35:30 +02:00
townlist - > draw ( ) ;
2008-01-09 19:21:31 +02:00
2008-02-23 00:26:31 +02:00
garr - > show ( ) ;
2008-01-09 19:21:31 +02:00
int pom ;
2008-01-09 21:59:23 +02:00
//draw fort icon
2008-01-09 19:21:31 +02:00
if ( town - > builtBuildings . find ( 9 ) ! = town - > builtBuildings . end ( ) )
pom = 2 ;
else if ( town - > builtBuildings . find ( 8 ) ! = town - > builtBuildings . end ( ) )
pom = 1 ;
else if ( town - > builtBuildings . find ( 7 ) ! = town - > builtBuildings . end ( ) )
pom = 0 ;
else pom = 3 ;
2008-01-19 14:26:55 +02:00
blitAt ( fort - > ourImages [ pom ] . bitmap , 122 , 413 , to ) ;
2008-01-09 19:21:31 +02:00
2008-01-09 21:59:23 +02:00
//draw ((village/town/city) hall)/capitol icon
2008-01-09 19:21:31 +02:00
if ( town - > builtBuildings . find ( 13 ) ! = town - > builtBuildings . end ( ) )
pom = 3 ;
else if ( town - > builtBuildings . find ( 12 ) ! = town - > builtBuildings . end ( ) )
pom = 2 ;
else if ( town - > builtBuildings . find ( 11 ) ! = town - > builtBuildings . end ( ) )
pom = 1 ;
else pom = 0 ;
2008-01-19 14:26:55 +02:00
blitAt ( hall - > ourImages [ pom ] . bitmap , 80 , 413 , to ) ;
2008-01-09 19:21:31 +02:00
2008-01-09 21:59:23 +02:00
//draw creatures icons and their growths
for ( int i = 0 ; i < CREATURES_PER_TOWN ; i + + )
{
int cid = - 1 ;
if ( town - > builtBuildings . find ( 30 + i ) ! = town - > builtBuildings . end ( ) )
{
cid = ( 14 * town - > subID ) + ( i * 2 ) ;
if ( town - > builtBuildings . find ( 30 + CREATURES_PER_TOWN + i ) ! = town - > builtBuildings . end ( ) )
{
cid + + ;
}
}
if ( cid > = 0 )
{
2008-01-12 13:32:40 +02:00
int pomx , pomy ;
pomx = 22 + ( 55 * ( ( i > 3 ) ? ( i - 4 ) : i ) ) ;
pomy = ( i > 3 ) ? ( 507 ) : ( 459 ) ;
2008-01-19 14:26:55 +02:00
blitAt ( CGI - > creh - > smallImgs [ cid ] , pomx , pomy , to ) ;
2008-01-12 13:32:40 +02:00
std : : ostringstream oss ;
2008-01-29 17:08:41 +02:00
oss < < ' + ' < < ( CGI - > creh - > creatures [ cid ] . growth + town - > creatureIncome [ i ] ) ;
2008-01-19 14:26:55 +02:00
CSDL_Ext : : printAtMiddle ( oss . str ( ) , pomx + 16 , pomy + 37 , GEOR13 , zwykly , to ) ;
2008-01-09 21:59:23 +02:00
}
}
//print name and income
2008-01-19 14:26:55 +02:00
CSDL_Ext : : printAt ( town - > name , 85 , 389 , GEOR13 , zwykly , to ) ;
2008-01-09 19:21:31 +02:00
char temp [ 10 ] ;
2008-02-18 23:14:28 +02:00
itoa ( town - > dailyIncome ( ) , temp , 10 ) ;
2008-01-19 14:26:55 +02:00
CSDL_Ext : : printAtMiddle ( temp , 195 , 442 , GEOR13 , zwykly , to ) ;
2008-01-12 13:32:40 +02:00
//blit town icon
pom = town - > subID * 2 ;
if ( ! town - > hasFort ( ) )
pom + = F_NUMBER * 2 ;
if ( town - > builded > = MAX_BUILDING_PER_TURN )
pom + + ;
2008-02-18 23:14:28 +02:00
blitAt ( LOCPLINT - > bigTownPic - > ourImages [ pom ] . bitmap , 15 , 387 , to ) ;
2008-01-12 13:32:40 +02:00
//flag
2008-02-01 02:38:17 +02:00
if ( town - > getOwner ( ) < PLAYER_LIMIT )
blitAt ( flag - > ourImages [ town - > getOwner ( ) ] . bitmap , 241 , 387 , to ) ;
2008-01-26 21:36:31 +02:00
2008-01-12 13:32:40 +02:00
//print garrison
2008-01-26 21:36:31 +02:00
//for(
// std::map<int,std::pair<CCreature*,int> >::const_iterator i=town->garrison.slots.begin();
// i!=town->garrison.slots.end();
// i++
// )
//{
// blitAt(CGI->creh->bigImgs[i->second.first->idNumber],305+(62*(i->first)),387,to);
// itoa(i->second.second,temp,10);
// CSDL_Ext::printTo(temp,305+(62*(i->first))+57,387+61,GEOR13,zwykly,to);
//}
2008-01-19 14:26:55 +02:00
show ( ) ;
}
2008-01-31 23:35:30 +02:00
void CCastleInterface : : townChange ( )
{
const CGTownInstance * nt = townlist - > items [ townlist - > selected ] ;
deactivate ( ) ;
LOCPLINT - > objsToBlit . erase ( std : : find ( LOCPLINT - > objsToBlit . begin ( ) , LOCPLINT - > objsToBlit . end ( ) , this ) ) ;
delete this ;
LOCPLINT - > castleInt = new CCastleInterface ( nt , true ) ;
}
2008-01-19 14:26:55 +02:00
void CCastleInterface : : show ( SDL_Surface * to )
{
if ( ! to )
to = ekran ;
count + + ;
2008-01-29 15:00:45 +02:00
if ( count = = 4 )
2008-01-19 14:26:55 +02:00
{
count = 0 ;
animval + + ;
2008-01-12 13:32:40 +02:00
}
2008-01-15 23:38:01 +02:00
2008-01-20 18:24:03 +02:00
blitAt ( cityBg , 0 , 0 , to ) ;
2008-01-19 14:26:55 +02:00
2008-01-15 23:38:01 +02:00
//blit buildings
for ( int i = 0 ; i < buildings . size ( ) ; i + + )
{
2008-01-19 14:26:55 +02:00
if ( ( animval ) % ( buildings [ i ] - > def - > ourImages . size ( ) ) )
{
blitAt ( buildings [ i ] - > def - > ourImages [ 0 ] . bitmap , buildings [ i ] - > pos . x , buildings [ i ] - > pos . y , to ) ;
blitAt ( buildings [ i ] - > def - > ourImages [ ( animval ) % ( buildings [ i ] - > def - > ourImages . size ( ) ) ] . bitmap , buildings [ i ] - > pos . x , buildings [ i ] - > pos . y , to ) ;
}
else
blitAt ( buildings [ i ] - > def - > ourImages [ ( animval ) % ( buildings [ i ] - > def - > ourImages . size ( ) ) ] . bitmap , buildings [ i ] - > pos . x , buildings [ i ] - > pos . y , to ) ;
2008-01-24 00:15:33 +02:00
//if(buildings[i]->hovered && buildings[i]->border)
// blitAt(buildings[i]->border,buildings[i]->pos.x,buildings[i]->pos.y);
if ( hBuild = = buildings [ i ] & & hBuild - > border )
blitAt ( hBuild - > border , hBuild - > pos , to ) ;
2008-01-15 23:38:01 +02:00
}
2008-01-12 13:32:40 +02:00
2008-01-09 19:21:31 +02:00
}
void CCastleInterface : : activate ( )
{
2008-01-31 23:35:30 +02:00
townlist - > activate ( ) ;
2008-01-26 21:36:31 +02:00
garr - > activate ( ) ;
2008-01-20 14:34:39 +02:00
LOCPLINT - > curint = this ;
2008-01-27 22:37:10 +02:00
LOCPLINT - > statusbar = statusbar ;
2008-01-26 21:36:31 +02:00
exit - > activate ( ) ;
2008-01-30 00:47:43 +02:00
split - > activate ( ) ;
2008-01-20 18:24:03 +02:00
for ( int i = 0 ; i < buildings . size ( ) ; i + + )
buildings [ i ] - > activate ( ) ;
2008-01-09 19:21:31 +02:00
}
void CCastleInterface : : deactivate ( )
{
2008-01-31 23:35:30 +02:00
townlist - > deactivate ( ) ;
2008-01-26 21:36:31 +02:00
garr - > deactivate ( ) ;
2008-01-09 19:21:31 +02:00
exit - > deactivate ( ) ;
2008-01-30 00:47:43 +02:00
split - > deactivate ( ) ;
2008-01-20 18:24:03 +02:00
for ( int i = 0 ; i < buildings . size ( ) ; i + + )
buildings [ i ] - > deactivate ( ) ;
2008-01-09 19:21:31 +02:00
}