1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00

* added support for buildings showing with halls

* creatures base growth is showed
* fixes in building reading
* fixes in building grouping
* fixes in Rampart townview
This commit is contained in:
Michał W. Urbańczyk 2008-01-29 15:08:41 +00:00
parent 099af11606
commit dfbe7d7c6b
8 changed files with 77 additions and 48 deletions

View File

@ -194,7 +194,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
} }
if(obecny != s.end()) if(obecny != s.end())
{ {
if(obecny->second < st->ID) //we have to replace old building with current one if((*(CGI->townh->structures[town->subID][obecny->second])) < (*(CGI->townh->structures[town->subID][st->ID]))) //we have to replace old building with current one
{ {
for(int itpb = 0; itpb<buildings.size(); itpb++) for(int itpb = 0; itpb<buildings.size(); itpb++)
{ {
@ -312,7 +312,7 @@ void CCastleInterface::showAll(SDL_Surface * to)
pomy = (i>3)?(507):(459); pomy = (i>3)?(507):(459);
blitAt(CGI->creh->smallImgs[cid],pomx,pomy,to); blitAt(CGI->creh->smallImgs[cid],pomx,pomy,to);
std::ostringstream oss; std::ostringstream oss;
oss << '+' << town->creatureIncome[i]; oss << '+' << (CGI->creh->creatures[cid].growth + town->creatureIncome[i]);
CSDL_Ext::printAtMiddle(oss.str(),pomx+16,pomy+37,GEOR13,zwykly,to); CSDL_Ext::printAtMiddle(oss.str(),pomx+16,pomy+37,GEOR13,zwykly,to);
} }
} }

View File

@ -48,9 +48,9 @@
1 36 TBRMDW_6.def 502 27 1 36 TBRMDW_6.def 502 27
1 21 TBRMEXT0.def 555 297 1 21 TBRMEXT0.def 555 297
1 22 TBRMEXT1.def 0 181 1 22 TBRMEXT1.def 0 181
1 27 TBRMEXT2.def 327 236 1 -1 TBRMEXT2.def 327 236
1 27 TBRMEXT3.def 293 235 1 27 TBRMEXT3.def 293 235
1 27 TBRMEXT4.def 295 191 1 28 TBRMEXT4.def 295 191
1 29 TBRMEXT5.def 260 171 1 29 TBRMEXT5.def 260 171
1 43 TBRMUP_6.def 502 5 1 43 TBRMUP_6.def 502 5
1 42 TBRMUP_5.def 362 90 1 42 TBRMUP_5.def 362 90

View File

@ -45,13 +45,17 @@ CASTLE 1
30 30
37 37
14 14
15
10 10
11 11
12 12
13 13
21 21
22 22
-1
27
28
29
15
END END
EOD EOD

View File

@ -42,4 +42,10 @@ GROUP
GROUP GROUP
18 18
19 19
CASTLE 1
GROUP
24
25
34
41
EOD EOD

View File

@ -89,7 +89,7 @@ std::set<int> convertBuildings(const std::set<int> h3m, int castleID)
else if(mapa[*i] >= (-CREATURES_PER_TOWN)) // horde buildings else if(mapa[*i] >= (-CREATURES_PER_TOWN)) // horde buildings
{ {
int level = (-mapa[*i]); int level = (-mapa[*i]);
if(h3m.find(36+level) != h3m.end()) //upgraded creature horde building if(h3m.find(20+(level*3)) != h3m.end()) //upgraded creature horde building
{ {
if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5))) if(((castleID==1) || (castleID==3)) && ((level==3) || (level==5)))
ret.insert(25); ret.insert(25);
@ -111,6 +111,14 @@ std::set<int> convertBuildings(const std::set<int> h3m, int castleID)
} }
ret.insert(10); //village hall is always present ret.insert(10); //village hall is always present
ret.insert(-1); //houses near v.hall
if(ret.find(11)!=ret.end())
ret.insert(27);
if(ret.find(12)!=ret.end())
ret.insert(28);
if(ret.find(13)!=ret.end())
ret.insert(29);
return ret; return ret;
} }

View File

@ -439,7 +439,7 @@ public:
//TODO: //TODO:
std::set<int> possibleBuildings, builtBuildings, h3mbuildings; std::set<int> possibleBuildings, builtBuildings, h3mbuildings;
std::vector<int> creatureIncome; //vector by level std::vector<int> creatureIncome; //vector by level - that valueis addedto thebasic growth
std::vector<int> creaturesLeft; //that can be recruited std::vector<int> creaturesLeft; //that can be recruited
const CGHeroInstance * garrisonHero, *visitingHero; const CGHeroInstance * garrisonHero, *visitingHero;

View File

@ -131,13 +131,15 @@ void CTownHandler::loadNames()
} }
else else
{ {
of >> s;
int itr=1;
while(!of.eof()) while(!of.eof())
{ {
std::map<int,std::map<int, Structure*> >::iterator i; std::map<int,std::map<int, Structure*> >::iterator i;
std::map<int, Structure*>::iterator i2; std::map<int, Structure*>::iterator i2;
int itr=1, buildingID; int buildingID;
int castleID; int castleID;
of >> s; itr++;
if (s == "CASTLE") if (s == "CASTLE")
{ {
of >> castleID; of >> castleID;
@ -158,7 +160,7 @@ void CTownHandler::loadNames()
while(1) while(1)
{ {
of >> s; of >> s;
if((s == "GROUP") || (s == "EOD")) // if((s == "GROUP") || (s == "EOD") || (s == "CASTLE")) //
break; break;
buildingID = atoi(s.c_str()); buildingID = atoi(s.c_str());
if(castleID>=0) if(castleID>=0)
@ -186,6 +188,8 @@ void CTownHandler::loadNames()
} }
} }
} }
if(s == "CASTLE")
break;
itr++; itr++;
}//if (s == "GROUP") }//if (s == "GROUP")
else if(s == "EOD") else if(s == "EOD")

View File

@ -29,6 +29,13 @@ struct Structure
int3 pos; int3 pos;
std::string defName, borderName, areaName, name; std::string defName, borderName, areaName, name;
int townID, group; int townID, group;
bool operator<(const Structure & p2) const
{
if(pos.z != p2.pos.z)
return (pos.z) < (p2.pos.z);
else
return (ID) < (p2.ID);
}
}; };
class CTownHandler class CTownHandler