mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Reading buildings in the castles - still needs more testing and improvents.
This commit is contained in:
parent
b334dbd79d
commit
9530fb42c2
@ -72,6 +72,8 @@ void CCastleInterface::show()
|
|||||||
LOCPLINT->adventureInt->resdatabar.draw();
|
LOCPLINT->adventureInt->resdatabar.draw();
|
||||||
|
|
||||||
int pom;
|
int pom;
|
||||||
|
|
||||||
|
//draw fort icon
|
||||||
if(town->builtBuildings.find(9)!=town->builtBuildings.end())
|
if(town->builtBuildings.find(9)!=town->builtBuildings.end())
|
||||||
pom = 2;
|
pom = 2;
|
||||||
else if(town->builtBuildings.find(8)!=town->builtBuildings.end())
|
else if(town->builtBuildings.find(8)!=town->builtBuildings.end())
|
||||||
@ -81,6 +83,7 @@ void CCastleInterface::show()
|
|||||||
else pom = 3;
|
else pom = 3;
|
||||||
blitAt(fort->ourImages[pom].bitmap,122,413);
|
blitAt(fort->ourImages[pom].bitmap,122,413);
|
||||||
|
|
||||||
|
//draw ((village/town/city) hall)/capitol icon
|
||||||
if(town->builtBuildings.find(13)!=town->builtBuildings.end())
|
if(town->builtBuildings.find(13)!=town->builtBuildings.end())
|
||||||
pom = 3;
|
pom = 3;
|
||||||
else if(town->builtBuildings.find(12)!=town->builtBuildings.end())
|
else if(town->builtBuildings.find(12)!=town->builtBuildings.end())
|
||||||
@ -90,6 +93,25 @@ void CCastleInterface::show()
|
|||||||
else pom = 0;
|
else pom = 0;
|
||||||
blitAt(hall->ourImages[pom].bitmap,80,413);
|
blitAt(hall->ourImages[pom].bitmap,80,413);
|
||||||
|
|
||||||
|
//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)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//print name and income
|
||||||
CSDL_Ext::printAt(town->name,85,389,GEOR13,zwykly);
|
CSDL_Ext::printAt(town->name,85,389,GEOR13,zwykly);
|
||||||
char temp[10];
|
char temp[10];
|
||||||
itoa(town->income,temp,10);
|
itoa(town->income,temp,10);
|
||||||
|
1
global.h
1
global.h
@ -52,6 +52,7 @@ const int TERRAIN_TYPES=10;
|
|||||||
const int PRIMARY_SKILLS=4;
|
const int PRIMARY_SKILLS=4;
|
||||||
const int NEUTRAL_PLAYER=255;
|
const int NEUTRAL_PLAYER=255;
|
||||||
const int NAMES_PER_TOWN=16;
|
const int NAMES_PER_TOWN=16;
|
||||||
|
const int CREATURES_PER_TOWN = 7; //without upgrades
|
||||||
|
|
||||||
#define MARK_BLOCKED_POSITIONS false
|
#define MARK_BLOCKED_POSITIONS false
|
||||||
#define MARK_VISITABLE_POSITIONS false
|
#define MARK_VISITABLE_POSITIONS false
|
||||||
|
@ -1586,6 +1586,220 @@ void CAmbarCendamo::deh3m()
|
|||||||
delete nobj;
|
delete nobj;
|
||||||
nobj = nt;
|
nobj = nt;
|
||||||
|
|
||||||
|
if(spec->unusualBuildins)
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(10);
|
||||||
|
for(int ir = 0; ir < 6; ir++)
|
||||||
|
{
|
||||||
|
for(int bs=0;bs<8;bs++)
|
||||||
|
{
|
||||||
|
if(ir==0)
|
||||||
|
{
|
||||||
|
if (bs<3)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(11+bs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bs<6)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(7+bs-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==6)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else// if(bs==7)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} //if(ir==0)
|
||||||
|
else if(ir==1)
|
||||||
|
{
|
||||||
|
if(bs<2)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(14+bs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bs==2)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
std::cout<<"Hej, sprawdz co to za budynek w miescie " <<nt<<std::endl;
|
||||||
|
}
|
||||||
|
}//bs==3 - nie wiadomo co to, 4 w 2. bajcie
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(0+bs-3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//else if(ir==1)
|
||||||
|
else if(ir==2)
|
||||||
|
{
|
||||||
|
if(bs==0)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(6); //stocznia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==1)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(26); //graal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==2)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(17); //latarnia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==3)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(22); //bractwo miecza
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==4)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(21); //stajnia
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==5)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
std::cout<<"Hej, sprawdz co to za budynek2 w miescie " <<nt<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==6)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(30); //gen1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(bs==7)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(37); //gen1+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//else if(ir==2)
|
||||||
|
else if (ir==3)
|
||||||
|
{
|
||||||
|
if(bs==0)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
std::cout<<"Hej, sprawdz co to za budynek3 w miescie " <<nt<<std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if(bs<3)
|
||||||
|
{
|
||||||
|
if(bs==1)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(31); //gen2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(38); //gen2+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bs==3)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
std::cout<<"Hej, sprawdz co to za budynek4 w miescie " <<nt<<std::endl;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(bs%2) //nieulepszone
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert((int)(39+(bs/2)-2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(32+(bs/2)-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}//else if (ir==3)
|
||||||
|
else if (ir==4)
|
||||||
|
{
|
||||||
|
if(bs%2) //ulepszone
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(40+(bs/2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert((int)(34+(bs/2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//else if (ir==4)
|
||||||
|
else if (ir==5)
|
||||||
|
{
|
||||||
|
if(bs==0)
|
||||||
|
{
|
||||||
|
if(spec->buildingSettings[ir] & (1<<bs))
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(43); //gen7+
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//else if (ir==5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(spec->hasFort)
|
||||||
|
{
|
||||||
|
nt->builtBuildings.insert(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nt->setOwner(spec->player);
|
nt->setOwner(spec->player);
|
||||||
nt->town = &CGI->townh->towns[nt->defInfo->subid];
|
nt->town = &CGI->townh->towns[nt->defInfo->subid];
|
||||||
nt->builded = 0;
|
nt->builded = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user