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

* support for Inferno

* started doing splitting/merging stacks
This commit is contained in:
Michał W. Urbańczyk
2008-01-29 22:47:43 +00:00
parent 580e8d33a6
commit b675de7ca5
8 changed files with 147 additions and 3 deletions

View File

@@ -423,11 +423,21 @@ int CCallback::swapCreatures(const CGObjectInstance *s1, const CGObjectInstance
CGI->playerint[s1->tempOwner]->garrisonChanged(s1); CGI->playerint[s1->tempOwner]->garrisonChanged(s1);
if(s2->tempOwner<PLAYER_LIMIT) if(s2->tempOwner<PLAYER_LIMIT)
CGI->playerint[s2->tempOwner]->garrisonChanged(s2); CGI->playerint[s2->tempOwner]->garrisonChanged(s2);
return 0;
} }
} }
return -1; return -1;
} }
int CCallback::mergeStacks(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2)
{
return -1;
}
int CCallback::splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2, int val)
{
return -1;
}
bool CCallback::dismissHero(const CGHeroInstance *hero) bool CCallback::dismissHero(const CGHeroInstance *hero)
{ {
CGHeroInstance * Vhero = const_cast<CGHeroInstance *>(hero); CGHeroInstance * Vhero = const_cast<CGHeroInstance *>(hero);

View File

@@ -35,6 +35,8 @@ public:
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 CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2)=0;//swaps creatures between two posiibly different garrisons // TODO: AI-unsafe code - fix it! virtual int swapCreatures(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2)=0;//swaps creatures between two posiibly different garrisons // TODO: AI-unsafe code - fix it!
virtual int mergeStacks(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2)=0;//joins first stack tothe second (creatures must be same type)
virtual int splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2, int val)=0;//split creatures from the first stack
virtual bool dismissHero(const CGHeroInstance * hero)=0; //dismisses diven hero; true - successfuly, false - not successfuly virtual bool dismissHero(const CGHeroInstance * hero)=0; //dismisses diven hero; true - successfuly, false - not successfuly
virtual const CCreatureSet* getGarrison(const CGObjectInstance *obj)=0; virtual const CCreatureSet* getGarrison(const CGObjectInstance *obj)=0;
}; };
@@ -82,6 +84,8 @@ public:
int getHeroSerial(const CGHeroInstance * hero); int getHeroSerial(const CGHeroInstance * hero);
int getMySerial(); int getMySerial();
int swapCreatures(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2); int swapCreatures(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2);
int mergeStacks(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2);
int splitStack(const CGObjectInstance *s1, const CGObjectInstance *s2, int p1, int p2, int val);
bool dismissHero(const CGHeroInstance * hero); bool dismissHero(const CGHeroInstance * hero);
const CCreatureSet* getGarrison(const CGObjectInstance *obj); const CCreatureSet* getGarrison(const CGObjectInstance *obj);

View File

@@ -164,6 +164,8 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
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,false); (CGI->townh->tcommands[8],"",&CCastleInterface::close,744,544,"TSBTNS.DEF",this,false);
split = new AdventureMapButton<CCastleInterface>
(CGI->townh->tcommands[8],"",&CCastleInterface::splitF,744,382,"TSBTNS.DEF",this,false);
exit->bitmapOffset = 4; exit->bitmapOffset = 4;
statusbar = new CStatusBar(8,555,"TSTATBAR.bmp",732); statusbar = new CStatusBar(8,555,"TSTATBAR.bmp",732);
std::set< std::pair<int,int> > s; //group - id std::set< std::pair<int,int> > s; //group - id
@@ -243,6 +245,7 @@ CCastleInterface::~CCastleInterface()
SDL_FreeSurface(townInt); SDL_FreeSurface(townInt);
SDL_FreeSurface(cityBg); SDL_FreeSurface(cityBg);
delete exit; delete exit;
delete split;
delete hall; delete hall;
delete fort; delete fort;
delete bigTownPic; delete bigTownPic;
@@ -262,6 +265,9 @@ void CCastleInterface::close()
LOCPLINT->adventureInt->show(); LOCPLINT->adventureInt->show();
delete this; delete this;
} }
void CCastleInterface::splitF()
{
}
void CCastleInterface::showAll(SDL_Surface * to) void CCastleInterface::showAll(SDL_Surface * to)
{ {
if (!to) if (!to)
@@ -391,6 +397,7 @@ void CCastleInterface::activate()
LOCPLINT->curint = this; LOCPLINT->curint = this;
LOCPLINT->statusbar = statusbar; LOCPLINT->statusbar = statusbar;
exit->activate(); exit->activate();
split->activate();
for(int i=0;i<buildings.size();i++) for(int i=0;i<buildings.size();i++)
buildings[i]->activate(); buildings[i]->activate();
} }
@@ -398,6 +405,7 @@ void CCastleInterface::deactivate()
{ {
garr->deactivate(); garr->deactivate();
exit->deactivate(); exit->deactivate();
split->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

@@ -40,7 +40,7 @@ public:
*bigTownPic, *flag; *bigTownPic, *flag;
CGarrisonInt * garr; CGarrisonInt * garr;
AdventureMapButton<CCastleInterface> * exit; AdventureMapButton<CCastleInterface> * exit, *split;
std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling
@@ -49,6 +49,7 @@ public:
void show(SDL_Surface * to=NULL); void show(SDL_Surface * to=NULL);
void showAll(SDL_Surface * to=NULL); void showAll(SDL_Surface * to=NULL);
void close(); void close();
void splitF();
void activate(); void activate();
void deactivate(); void deactivate();
}; };

View File

@@ -113,4 +113,42 @@
2 41 TBTWUP_4.def 511 8 2 41 TBTWUP_4.def 511 8
2 42 TBTWUP_5.def 681 157 2 42 TBTWUP_5.def 681 157
2 43 TBTWUP_6.def 75 91 2 43 TBTWUP_6.def 75 91
2 8 TBTWCAS2.def 301 0 2 8 TBTWCAS2.def 301 0
3 16 TBINBLAK.def 684 253
3 9 TBINCAS3.def 223 18
3 7 TBINCSTL.def 223 44
3 30 TBINDW_0.def 614 256
3 31 TBINDW_1.def 187 248
3 32 TBINDW_2.def 9 325
3 33 TBINDW_3.def 414 204
3 34 TBINDW_4.def 359 296
3 35 TBINDW_5.def 220 350
3 36 TBINDW_6.def 420 153
3 21 TBINEXT0.def 297 0
3 22 TBINEXT1.def 227 174
3 23 TBINEXT2.def 593 104
3 11 TBINHAL2.def 0 174
3 12 TBINHAL3.def 0 174
3 13 TBINHAL4.def 0 131
3 10 TBINHALL.def 0 174
3 26 TBINHOLY.def 24 10
3 18 TBINHRD1.def 614 256
3 19 TBINHRD2.def 614 221
3 24 TBINHRD3.def 10 301
3 25 TBINHRD4.def 9 273
3 1 TBINMAG2.def 667 101
3 2 TBINMAG3.def 667 83
3 3 TBINMAG4.def 667 56
3 4 TBINMAG5.def 667 35
3 0 TBINMAGE.def 667 127
3 14 TBINMARK.def 511 301
3 15 TBINSILO.def 497 337
3 5 TBINTVRN.def 105 219
3 37 TBINUP_0.def 614 221
3 38 TBINUP_1.def 187 212
3 39 TBINUP_2.def 9 273
3 40 TBINUP_3.def 412 197
3 41 TBINUP_4.def 359 244
3 42 TBINUP_5.def 220 282
3 43 TBINUP_6.def 420 105
3 8 TBINCAS2.def 222 44

View File

@@ -74,6 +74,40 @@ CASTLE 2
18 18
19 19
END END
CASTLE 3
26
21
7
8
9
22
31
38
36
43
10
11
12
13
5
32
39
24
25
33
40
34
41
30
37
18
19
14
15
16
35
42
END
EOD EOD
------------------------------------------------------------------ ------------------------------------------------------------------

View File

@@ -109,4 +109,42 @@
2 40 TBTWUP_3.def TOTMAG2.bmp TZTMAG2.bmp 2 40 TBTWUP_3.def TOTMAG2.bmp TZTMAG2.bmp
2 41 TBTWUP_4.def TOTGEN2.bmp TZTGEN2.bmp 2 41 TBTWUP_4.def TOTGEN2.bmp TZTGEN2.bmp
2 42 TBTWUP_5.def TOTNAG2.bmp TZTNAG2.bmp 2 42 TBTWUP_5.def TOTNAG2.bmp TZTNAG2.bmp
2 43 TBTWUP_6.def TOTTIT2.bmp TZTTIT2.bmp 2 43 TBTWUP_6.def TOTTIT2.bmp TZTTIT2.bmp
3 16 TBINBLAK.def TOIBLKA.bmp TZIBLKA.bmp
3 8 TBINCAS2.def TOICAS1A.bmp TZICAS1A.bmp
3 9 TBINCAS3.def TOICAS3A.bmp TZICAS3A.bmp
3 7 TBINCSTL.def TOICAS2A.bmp TZICAS2A.bmp
3 30 TBINDW0_.def TOIMP1A.bmp TZIMP1A.bmp
3 31 TBINDW_1.def TOIGOG1A.bmp TZIGOG1A.bmp
3 32 TBINDW_2.def TOIHND1.bmp TZIHND1.bmp
3 33 TBINDW_3.def TOIDMN1.bmp TZIDMN1.bmp
3 34 TBINDW_4.def TOIPIT1.bmp TZIPIT1.bmp
3 35 TBINDW_5.def TOIEFR1.bmp TZIEFR1.bmp
3 36 TBINDW_6.def TOIDVL1.bmp TZIDVL1.bmp
3 21 TBINEXT0.def TOICAB1A.bmp TZICAB1A.bmp
3 22 TBINEXT1.def TOICASGA.bmp TZICASGA.bmp
3 23 TBINEXT2.def TOIPAIN.bmp TZIPAIN.bmp
3 11 TBINHAL2.def TOIHAL2.bmp TZIHAL2.bmp
3 12 TBINHAL3.def TOIHAL3.bmp TZIHAL3.bmp
3 13 TBINHAL4.def TOIHAL4.bmp TZIHAL4.bmp
3 10 TBINHALL.def TOIHAL1.bmp TZIHAL1.bmp
3 26 TBINHOLY.def TOIHOLY.bmp TZIHOLY.bmp
3 18 TBINHRD1.def TOIMP1HA.bmp TZIMP1HA.bmp
3 19 TBINHRD2.def TOIMP2HA.bmp TZIMP2HA.bmp
3 24 TBINHRD3.def TOIHND1H.bmp TZIHND1H.bmp
3 25 TBINHRD4.def TOIHND2H.bmp TZIHND2H.bmp
3 1 TBINMAG2.def TOIMAG2A.bmp TZIMAG2A.bmp
3 2 TBINMAG3.def TOIMAG3A.bmp TZIMAG3A.bmp
3 3 TBINMAG4.def TOIMAG4A.bmp TZIMAG4A.bmp
3 4 TBINMAG5.def TOIMAG5A.bmp TZIMAG5A.bmp
3 0 TBINMAGE.def TOIMAG1A.bmp TZIMAG1A.bmp
3 14 TBINMARK.def TOIMAR1.bmp TZIMAR1.bmp
3 15 TBINSILO.def TOIMAR2.bmp TZIMAR2.bmp
3 5 TBINTVRN.def TOITAV.bmp TZITAV.bmp
3 37 TBINUP0_.def TOIMP2A.bmp TZIMP2A.bmp
3 38 TBINUP_1.def TOIGOG2A.bmp TZIGOG2A.bmp
3 39 TBINUP_2.def TOIHND2.bmp TZIHND2.bmp
3 40 TBINUP_3.def TOIDMN2.bmp TZIDMN2.bmp
3 41 TBINUP_4.def TOIPIT2.bmp TZIPIT2.bmp
3 42 TBINUP_5.def TOIEFR2.bmp TZIEFR2.bmp
3 43 TBINUP_6.def TOIDVL2.bmp TZIDVL2.bmp

View File

@@ -54,4 +54,15 @@ GROUP
19 19
31 31
38 38
CASTLE 3
GROUP
18
19
30
37
GROUP
32
39
24
25
EOD EOD