From 9530fb42c2660c2d09de0c4c5df6ec6d9fcad547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Wed, 9 Jan 2008 19:59:23 +0000 Subject: [PATCH] Reading buildings in the castles - still needs more testing and improvents. --- CCastleInterface.cpp | 22 +++++ global.h | 1 + hch/CAmbarCendamo.cpp | 214 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+) diff --git a/CCastleInterface.cpp b/CCastleInterface.cpp index e08f280d8..6ca582226 100644 --- a/CCastleInterface.cpp +++ b/CCastleInterface.cpp @@ -72,6 +72,8 @@ void CCastleInterface::show() LOCPLINT->adventureInt->resdatabar.draw(); int pom; + + //draw fort icon if(town->builtBuildings.find(9)!=town->builtBuildings.end()) pom = 2; else if(town->builtBuildings.find(8)!=town->builtBuildings.end()) @@ -81,6 +83,7 @@ void CCastleInterface::show() else pom = 3; blitAt(fort->ourImages[pom].bitmap,122,413); + //draw ((village/town/city) hall)/capitol icon if(town->builtBuildings.find(13)!=town->builtBuildings.end()) pom = 3; else if(town->builtBuildings.find(12)!=town->builtBuildings.end()) @@ -90,6 +93,25 @@ void CCastleInterface::show() else pom = 0; blitAt(hall->ourImages[pom].bitmap,80,413); + //draw creatures icons and their growths + for(int i=0;ibuiltBuildings.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); char temp[10]; itoa(town->income,temp,10); diff --git a/global.h b/global.h index 1345f746e..5955ac50f 100644 --- a/global.h +++ b/global.h @@ -52,6 +52,7 @@ const int TERRAIN_TYPES=10; const int PRIMARY_SKILLS=4; const int NEUTRAL_PLAYER=255; const int NAMES_PER_TOWN=16; +const int CREATURES_PER_TOWN = 7; //without upgrades #define MARK_BLOCKED_POSITIONS false #define MARK_VISITABLE_POSITIONS false diff --git a/hch/CAmbarCendamo.cpp b/hch/CAmbarCendamo.cpp index 717ebe378..677626fc0 100644 --- a/hch/CAmbarCendamo.cpp +++ b/hch/CAmbarCendamo.cpp @@ -1586,6 +1586,220 @@ void CAmbarCendamo::deh3m() delete nobj; 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<builtBuildings.insert(11+bs); + } + } + else if (bs<6) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(7+bs-3); + } + } + else if(bs==6) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(5); + } + } + else// if(bs==7) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(16); + } + } + } //if(ir==0) + else if(ir==1) + { + if(bs<2) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(14+bs); + } + } + else if (bs==2) + { + if(spec->buildingSettings[ir] & (1<buildingSettings[ir] & (1<builtBuildings.insert(0+bs-3); + } + } + + }//else if(ir==1) + else if(ir==2) + { + if(bs==0) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(6); //stocznia + } + } + else if(bs==1) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(26); //graal + } + } + else if(bs==2) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(17); //latarnia + } + } + else if(bs==3) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(22); //bractwo miecza + } + } + else if(bs==4) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(21); //stajnia + } + } + else if(bs==5) + { + if(spec->buildingSettings[ir] & (1<buildingSettings[ir] & (1<builtBuildings.insert(30); //gen1 + } + } + else if(bs==7) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(37); //gen1+ + } + } + }//else if(ir==2) + else if (ir==3) + { + if(bs==0) + { + if(spec->buildingSettings[ir] & (1<buildingSettings[ir] & (1<builtBuildings.insert(31); //gen2 + } + } + else + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(38); //gen2+ + } + } + } + else if (bs==3) + { + if(spec->buildingSettings[ir] & (1<buildingSettings[ir] & (1<builtBuildings.insert((int)(39+(bs/2)-2)); + } + } + else + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(32+(bs/2)-2); + } + } + } + + }//else if (ir==3) + else if (ir==4) + { + if(bs%2) //ulepszone + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(40+(bs/2)); + } + } + else + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert((int)(34+(bs/2))); + } + } + }//else if (ir==4) + else if (ir==5) + { + if(bs==0) + { + if(spec->buildingSettings[ir] & (1<builtBuildings.insert(43); //gen7+ + } + } + }//else if (ir==5) + } + } + } + else + { + if(spec->hasFort) + { + nt->builtBuildings.insert(7); + } + } + nt->setOwner(spec->player); nt->town = &CGI->townh->towns[nt->defInfo->subid]; nt->builded = 0;