|
@@ -15,6 +15,17 @@
|
|
|
#include <sstream>
|
|
|
#include "../CLua.h"
|
|
|
|
|
|
+int readInt(unsigned char * bufor, int bytCon)
|
|
|
+{
|
|
|
+ int ret=0;
|
|
|
+ int amp=1;
|
|
|
+ for (int i=0; i<bytCon; i++)
|
|
|
+ {
|
|
|
+ ret+=bufor[i]*amp;
|
|
|
+ amp*=256;
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+}
|
|
|
unsigned int intPow(unsigned int a, unsigned int b)
|
|
|
{
|
|
|
unsigned int ret=1;
|
|
@@ -1692,225 +1703,9 @@ void CAmbarCendamo::deh3m()
|
|
|
(*(static_cast<CGObjectInstance*>(nt))) = *nobj;
|
|
|
delete nobj;
|
|
|
nobj = nt;
|
|
|
-
|
|
|
+ nt->identifier = readInt(spec->bytes,4);;
|
|
|
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 - not known what it is, 4 in 2. byte
|
|
|
- // 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); //grail
|
|
|
- // }
|
|
|
- // }
|
|
|
- // 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); //stables
|
|
|
- // }
|
|
|
- // }
|
|
|
- // 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)
|
|
|
- // {
|
|
|
-
|
|
|
- // //horda dla 1 poziomu???
|
|
|
- // 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))
|
|
|
- // {
|
|
|
- // //horde building for 2lvl
|
|
|
- // if(nt->builtBuildings.find(38)!=nt->builtBuildings.end())
|
|
|
- // nt->builtBuildings.insert(19);
|
|
|
- // else
|
|
|
- // nt->builtBuildings.insert(18);
|
|
|
- // }
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- // else if(bs==4)
|
|
|
- // {
|
|
|
- // 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 && bs==0)
|
|
|
- // {
|
|
|
- // if(spec->buildingSettings[ir] & 1<<0)
|
|
|
- // nt->builtBuildings.insert(40);
|
|
|
- // if(spec->buildingSettings[ir] & 1<<2)
|
|
|
- // nt->builtBuildings.insert(34);
|
|
|
- // if(spec->buildingSettings[ir] & 1<<3)
|
|
|
- // nt->builtBuildings.insert(41);
|
|
|
- // if(spec->buildingSettings[ir] & 1<<4)
|
|
|
- // {
|
|
|
- // if(nt->builtBuildings.find(41)!=nt->builtBuildings.end())
|
|
|
- // nt->builtBuildings.insert(25);
|
|
|
- // else
|
|
|
- // nt->builtBuildings.insert(24);
|
|
|
- // }
|
|
|
- // if(spec->buildingSettings[ir] & 1<<5)
|
|
|
- // nt->builtBuildings.insert(35);
|
|
|
- // if(spec->buildingSettings[ir] & 1<<6)
|
|
|
- // nt->builtBuildings.insert(42);
|
|
|
- // if(spec->buildingSettings[ir] & 1<<7)
|
|
|
- // nt->builtBuildings.insert(36);
|
|
|
- // }//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)
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
- //testowe zczytywanie h3mowych ID
|
|
|
for(int byte=0;byte<6;byte++)
|
|
|
{
|
|
|
for(int bit=0;bit<8;bit++)
|
|
@@ -2057,13 +1852,9 @@ void CAmbarCendamo::deh3m()
|
|
|
case EDefType::CREGEN_DEF:
|
|
|
{
|
|
|
CCreGenObjInfo * spec = new CCreGenObjInfo;
|
|
|
- spec->player = bufor[i]; ++i;
|
|
|
- i+=3;
|
|
|
- for(int ggg=0; ggg<4; ++ggg)
|
|
|
- {
|
|
|
- spec->bytes[ggg] = bufor[i]; ++i;
|
|
|
- }
|
|
|
- if((spec->bytes[0] == '\0') && (spec->bytes[1] == '\0') && (spec->bytes[2] == '\0') && (spec->bytes[3] == '\0'))
|
|
|
+ spec->player = readNormalNr(i); i+=4;
|
|
|
+ spec->identifier = readNormalNr(i); i+=4;
|
|
|
+ if(!spec->identifier)
|
|
|
{
|
|
|
spec->asCastle = false;
|
|
|
spec->castles[0] = bufor[i]; ++i;
|
|
@@ -2080,13 +1871,9 @@ void CAmbarCendamo::deh3m()
|
|
|
case EDefType::CREGEN2_DEF:
|
|
|
{
|
|
|
CCreGen2ObjInfo * spec = new CCreGen2ObjInfo;
|
|
|
- spec->player = bufor[i]; ++i;
|
|
|
- i+=3;
|
|
|
- for(int ggg=0; ggg<4; ++ggg)
|
|
|
- {
|
|
|
- spec->bytes[ggg] = bufor[i]; ++i;
|
|
|
- }
|
|
|
- if((spec->bytes[0] == '\0') && (spec->bytes[1] == '\0') && (spec->bytes[2] == '\0') && (spec->bytes[3] == '\0'))
|
|
|
+ spec->player = readNormalNr(i); i+=4;
|
|
|
+ spec->identifier = readNormalNr(i); i+=4;
|
|
|
+ if(!spec->identifier)
|
|
|
{
|
|
|
spec->asCastle = false;
|
|
|
spec->castles[0] = bufor[i]; ++i;
|
|
@@ -2098,10 +1885,10 @@ void CAmbarCendamo::deh3m()
|
|
|
}
|
|
|
spec->minLevel = bufor[i]; ++i;
|
|
|
spec->maxLevel = bufor[i]; ++i;
|
|
|
- if(spec->maxLevel>7)
|
|
|
- spec->maxLevel = 7;
|
|
|
- if(spec->minLevel<1)
|
|
|
- spec->minLevel = 1;
|
|
|
+ //if(spec->maxLevel>7)
|
|
|
+ // spec->maxLevel = 7;
|
|
|
+ //if(spec->minLevel<1)
|
|
|
+ // spec->minLevel = 1;
|
|
|
nobj->setOwner(spec->player);
|
|
|
nobj->info = spec;
|
|
|
break;
|
|
@@ -2344,7 +2131,14 @@ borderguardend:
|
|
|
|
|
|
THC std::cout<<"\tUnpacking defs: "<<th.getDif()<<std::endl;
|
|
|
for (int i=0;i<dhandlers.size();i++)
|
|
|
+ {
|
|
|
map.defy[i]->handler=dhandlers[i];
|
|
|
+ CGDefInfo* pom = CGI->dobjinfo->gobjs[map.defy[i]->id][map.defy[i]->subid];
|
|
|
+ if(pom)
|
|
|
+ pom->handler=dhandlers[i];
|
|
|
+ else
|
|
|
+ std::cout << "Lacking def info for " << map.defy[i]->id << " " << map.defy[i]->subid <<" " << map.defy[i]->name << std::endl;
|
|
|
+ }
|
|
|
for(int vv=0; vv<map.defy.size(); ++vv)
|
|
|
{
|
|
|
if(map.defy[vv]->handler->alphaTransformed)
|
|
@@ -2654,672 +2448,4 @@ CCreatureSet CAmbarCendamo::readCreatureSet(int pos, int number)
|
|
|
}
|
|
|
|
|
|
void CAmbarCendamo::processMap(std::vector<std::string> & defsToUnpack)
|
|
|
-{
|
|
|
- resDefNames.push_back("AVTRNDM0.DEF");
|
|
|
- resDefNames.push_back("AVTWOOD0.DEF");
|
|
|
- resDefNames.push_back("AVTMERC0.DEF");
|
|
|
- resDefNames.push_back("AVTORE0.DEF");
|
|
|
- resDefNames.push_back("AVTSULF0.DEF");
|
|
|
- resDefNames.push_back("AVTCRYS0.DEF");
|
|
|
- resDefNames.push_back("AVTGEMS0.DEF");
|
|
|
- resDefNames.push_back("AVTGOLD0.DEF");
|
|
|
- resDefNames.push_back("ZMITHR.DEF");
|
|
|
-
|
|
|
- std::vector<CGDefInfo*> resDefNumbers;
|
|
|
- for(int hh=0; hh<resDefNames.size(); ++hh)
|
|
|
- {
|
|
|
- resDefNumbers.push_back(NULL);
|
|
|
- for(int k=0; k<map.defy.size(); ++k)
|
|
|
- {
|
|
|
- std::string buf = map.defy[k]->name;
|
|
|
- std::transform(buf.begin(), buf.end(), buf.begin(), (int(*)(int))toupper);
|
|
|
- if(resDefNames[hh] == buf)
|
|
|
- {
|
|
|
- resDefNumbers[resDefNumbers.size()-1] = map.defy[k];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- std::vector<std::string> creDefNames;
|
|
|
- for(int dd=0; dd<140; ++dd) //we do not use here WoG units
|
|
|
- {
|
|
|
- creDefNames.push_back(CGI->dobjinfo->objs[dd+1184].defName);
|
|
|
- }
|
|
|
- std::vector<CGDefInfo*> creDefNumbers;
|
|
|
- for(int ee=0; ee<creDefNames.size(); ++ee)
|
|
|
- {
|
|
|
- creDefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
- std::vector<std::string> artDefNames;
|
|
|
- std::vector<CGDefInfo* > artDefNumbers;
|
|
|
- for(int bb=0; bb<162; ++bb)
|
|
|
- {
|
|
|
- if(CGI->arth->artifacts[CGI->dobjinfo->objs[bb+213].subtype].aClass!=EartClass::SartClass)
|
|
|
- artDefNames.push_back(CGI->dobjinfo->objs[bb+213].defName);
|
|
|
- }
|
|
|
- for(int ee=0; ee<artDefNames.size(); ++ee)
|
|
|
- {
|
|
|
- artDefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector<std::string> art1DefNames;
|
|
|
- std::vector<CGDefInfo*> art1DefNumbers;
|
|
|
- for(int bb=0; bb<162; ++bb)
|
|
|
- {
|
|
|
- if(CGI->arth->artifacts[CGI->dobjinfo->objs[bb+213].subtype].aClass==EartClass::TartClass)
|
|
|
- art1DefNames.push_back(CGI->dobjinfo->objs[bb+213].defName);
|
|
|
- }
|
|
|
- for(int ee=0; ee<art1DefNames.size(); ++ee)
|
|
|
- {
|
|
|
- art1DefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector<std::string> art2DefNames;
|
|
|
- std::vector<CGDefInfo*> art2DefNumbers;
|
|
|
- for(int bb=0; bb<162; ++bb)
|
|
|
- {
|
|
|
- if(CGI->arth->artifacts[CGI->dobjinfo->objs[bb+213].subtype].aClass==EartClass::NartClass)
|
|
|
- art2DefNames.push_back(CGI->dobjinfo->objs[bb+213].defName);
|
|
|
- }
|
|
|
- for(int ee=0; ee<art2DefNames.size(); ++ee)
|
|
|
- {
|
|
|
- art2DefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector<std::string> art3DefNames;
|
|
|
- std::vector<CGDefInfo*> art3DefNumbers;
|
|
|
- for(int bb=0; bb<162; ++bb)
|
|
|
- {
|
|
|
- if(CGI->arth->artifacts[CGI->dobjinfo->objs[bb+213].subtype].aClass==EartClass::JartClass)
|
|
|
- art3DefNames.push_back(CGI->dobjinfo->objs[bb+213].defName);
|
|
|
- }
|
|
|
- for(int ee=0; ee<art3DefNames.size(); ++ee)
|
|
|
- {
|
|
|
- art3DefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector<std::string> art4DefNames;
|
|
|
- std::vector<CGDefInfo*> art4DefNumbers;
|
|
|
- for(int bb=0; bb<162; ++bb)
|
|
|
- {
|
|
|
- if(CGI->arth->artifacts[CGI->dobjinfo->objs[bb+213].subtype].aClass==EartClass::RartClass)
|
|
|
- art4DefNames.push_back(CGI->dobjinfo->objs[bb+213].defName);
|
|
|
- }
|
|
|
- for(int ee=0; ee<art4DefNames.size(); ++ee)
|
|
|
- {
|
|
|
- art4DefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector<std::string> town0DefNames; //without fort
|
|
|
- std::vector<CGDefInfo*> town0DefNumbers;
|
|
|
- std::vector<std::string> town1DefNames; //with fort
|
|
|
- std::vector<CGDefInfo*> town1DefNumbers;
|
|
|
-
|
|
|
- for(int dd=0; dd<F_NUMBER; ++dd)
|
|
|
- {
|
|
|
- town1DefNames.push_back(CGI->dobjinfo->objs[dd+385].defName);
|
|
|
- town1DefNumbers.push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- std::vector< std::vector<std::string> > creGenNames;
|
|
|
- std::vector< std::vector<CGDefInfo*> > creGenNumbers;
|
|
|
- creGenNames.resize(F_NUMBER);
|
|
|
- creGenNumbers.resize(F_NUMBER);
|
|
|
-
|
|
|
- for(int ff=0; ff<F_NUMBER-1; ++ff)
|
|
|
- {
|
|
|
- for(int dd=0; dd<7; ++dd)
|
|
|
- {
|
|
|
- creGenNames[ff].push_back(CGI->dobjinfo->objs[395+7*ff+dd].defName);
|
|
|
- creGenNumbers[ff].push_back(NULL);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for(int dd=0; dd<7; ++dd)
|
|
|
- {
|
|
|
- creGenNumbers[8].push_back(NULL);
|
|
|
- }
|
|
|
-
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[457].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[452].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[455].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[454].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[453].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[458].defName);
|
|
|
- creGenNames[F_NUMBER-1].push_back(CGI->dobjinfo->objs[459].defName);
|
|
|
-
|
|
|
- for(int b=0; b<CGI->scenarioOps.playerInfos.size(); ++b) // choosing random player alignment
|
|
|
- {
|
|
|
- if(CGI->scenarioOps.playerInfos[b].castle==-1)
|
|
|
- CGI->scenarioOps.playerInfos[b].castle = rand()%F_NUMBER;
|
|
|
- }
|
|
|
-
|
|
|
- //variables initialized
|
|
|
- for(int j=0; j<CGI->objh->objInstances.size(); ++j)
|
|
|
- {
|
|
|
- CGDefInfo * curDef = CGI->objh->objInstances[j]->defInfo;
|
|
|
- switch(getDefType(curDef))
|
|
|
- {
|
|
|
- case EDefType::RESOURCE_DEF:
|
|
|
- {
|
|
|
- if(curDef->id==76) //resource to specify
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 79;
|
|
|
- nxt->subid = rand()%7;
|
|
|
- if(resDefNumbers[nxt->subid+1]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = resDefNumbers[nxt->subid+1];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = resDefNames[nxt->subid+1];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(resDefNumbers[nxt->subid+1]==NULL)
|
|
|
- {
|
|
|
- resDefNumbers[nxt->subid+1] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case EDefType::CREATURES_DEF:
|
|
|
- {
|
|
|
- if(curDef->id==72) //random monster lvl 1
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==73) //random monster lvl 2
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+2;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==74) //random monster lvl 3
|
|
|
- {
|
|
|
- CGDefInfo *nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+4;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==75) //random monster lvl 4
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+6;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==162) //random monster lvl 5
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+8;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==163) //random monster lvl 6
|
|
|
- {
|
|
|
- CGDefInfo* nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+10;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==164) //random monster lvl 7
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = 14*(rand()%9)+rand()%2+12;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==71) //random monster (any level)
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 54;
|
|
|
- nxt->subid = rand()%126;
|
|
|
- if(creDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = creDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- creDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- } //end of case
|
|
|
- case EDefType::ARTIFACT_DEF:
|
|
|
- {
|
|
|
- if(curDef->id==65) //random atrifact (any class)
|
|
|
- {
|
|
|
- CGDefInfo *nxt = curDef;
|
|
|
- nxt->id = 5;
|
|
|
- nxt->subid = rand()%artDefNames.size();
|
|
|
- if(artDefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = artDefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = artDefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(artDefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- artDefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==66) //random atrifact (treasure)
|
|
|
- {
|
|
|
- CGDefInfo* nxt = curDef;
|
|
|
- nxt->id = 5;
|
|
|
- nxt->subid = rand()%art1DefNames.size();
|
|
|
- if(art1DefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = art1DefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = art1DefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(art1DefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- art1DefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==67) //random atrifact (minor)
|
|
|
- {
|
|
|
- CGDefInfo *nxt = curDef;
|
|
|
- nxt->id = 5;
|
|
|
- nxt->subid = rand()%art2DefNames.size();
|
|
|
- if(art2DefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = art2DefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = art2DefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(art2DefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- art2DefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==68) //random atrifact (major)
|
|
|
- {
|
|
|
- CGDefInfo* nxt = curDef;
|
|
|
- nxt->id = 5;
|
|
|
- nxt->subid = rand()%art3DefNames.size();
|
|
|
- if(art3DefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = art3DefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = art3DefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(art3DefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- art3DefNumbers[nxt->subid] =nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- if(curDef->id==69) //random atrifact (relic)
|
|
|
- {
|
|
|
- CGDefInfo *nxt = curDef;
|
|
|
- nxt->id = 5;
|
|
|
- nxt->subid = rand()%art4DefNames.size();
|
|
|
- if(art4DefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = art4DefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = art4DefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(art4DefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- art4DefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case EDefType::TOWN_DEF:
|
|
|
- {
|
|
|
- if(curDef->id==77) //random town
|
|
|
- {
|
|
|
- CGDefInfo* nxt = curDef;
|
|
|
- nxt->id = 98;
|
|
|
- if(((CCastleObjInfo*)CGI->objh->objInstances[j]->info)->player==0xff)
|
|
|
- {
|
|
|
- nxt->subid = rand()%town1DefNames.size();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if(CGI->scenarioOps.getIthPlayersSettings(((CCastleObjInfo*)CGI->objh->objInstances[j]->info)->player).castle>-1)
|
|
|
- {
|
|
|
- nxt->subid = CGI->scenarioOps.getIthPlayersSettings(((CCastleObjInfo*)CGI->objh->objInstances[j]->info)->player).castle;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- nxt->subid = rand()%town1DefNames.size();
|
|
|
- }
|
|
|
- }
|
|
|
- if(town1DefNumbers[nxt->subid]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = town1DefNumbers[nxt->subid];
|
|
|
- continue;
|
|
|
- }
|
|
|
- nxt->name = town1DefNames[nxt->subid];
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(town1DefNumbers[nxt->subid]==NULL)
|
|
|
- {
|
|
|
- town1DefNumbers[nxt->subid] = nxt;
|
|
|
- }
|
|
|
- for (int ij=0;ij<CGI->townh->townInstances.size();ij++) // wyharatac gdy bedzie dziedziczenie
|
|
|
- {
|
|
|
- if (CGI->townh->townInstances[ij]->pos==CGI->objh->objInstances[j]->pos)
|
|
|
- {
|
|
|
- CGI->townh->townInstances[ij]->town = &CGI->townh->towns[nxt->subid];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //((CCastleObjInfo*)CGI->objh->objInstances[j].info)
|
|
|
- break;
|
|
|
- }
|
|
|
- case EDefType::HERO_DEF:
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo->printPriority = 0;
|
|
|
- break;
|
|
|
- }
|
|
|
- } //end of main switch
|
|
|
- } //end of main loop
|
|
|
- for(int j=0; j<CGI->objh->objInstances.size(); ++j) //for creature dwellings on map (they are town type dependent)
|
|
|
- {
|
|
|
- CGDefInfo * curDef = CGI->objh->objInstances[j]->defInfo;
|
|
|
- switch(getDefType(curDef))
|
|
|
- {
|
|
|
- case EDefType::CREGEN_DEF:
|
|
|
- {
|
|
|
- if(((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->asCastle)
|
|
|
- {
|
|
|
- CGDefInfo *nxt = curDef;
|
|
|
- nxt->id = 17;
|
|
|
- for(int vv=0; vv<CGI->objh->objInstances.size(); ++vv)
|
|
|
- {
|
|
|
- if(getDefType(CGI->objh->objInstances[vv]->defInfo)==EDefType::TOWN_DEF)
|
|
|
- {
|
|
|
- if(
|
|
|
- ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[0]==((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->bytes[0]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[1]==((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->bytes[1]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[2]==((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->bytes[2]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->bytes[3])
|
|
|
- {
|
|
|
- for(int mm=0; mm<town1DefNames.size(); ++mm)
|
|
|
- {
|
|
|
- std::transform(town1DefNames[mm].begin(), town1DefNames[mm].end(), town1DefNames[mm].begin(), (int(*)(int))toupper);
|
|
|
- std::string hlp = CGI->objh->objInstances[vv]->defInfo->name;
|
|
|
- std::transform(hlp.begin(), hlp.end(), hlp.begin(), (int(*)(int))toupper);
|
|
|
- if(town1DefNames[mm]==hlp)
|
|
|
- {
|
|
|
- nxt->subid = mm;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- int lvl = atoi(CGI->objh->objInstances[j]->defInfo->name.substr(7, 8).c_str())-1;
|
|
|
- nxt->name = creGenNames[nxt->subid][lvl];
|
|
|
- if(creGenNumbers[nxt->subid][lvl]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
|
|
|
- continue;
|
|
|
- }
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creGenNumbers[nxt->subid][lvl]==NULL)
|
|
|
- {
|
|
|
- creGenNumbers[nxt->subid][lvl] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- else //if not as castle
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 17;
|
|
|
- std::vector<int> possibleTowns;
|
|
|
- for(int bb=0; bb<8; ++bb)
|
|
|
- {
|
|
|
- if(((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->castles[0] & (1<<bb))
|
|
|
- {
|
|
|
- possibleTowns.push_back(bb);
|
|
|
- }
|
|
|
- }
|
|
|
- if(((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->castles[1])
|
|
|
- possibleTowns.push_back(8);
|
|
|
- nxt->subid = possibleTowns[rand()%possibleTowns.size()];
|
|
|
- int lvl = atoi(CGI->objh->objInstances[j]->defInfo->name.substr(7, 8).c_str())-1;
|
|
|
- nxt->name = creGenNames[nxt->subid][lvl];
|
|
|
- if(creGenNumbers[nxt->subid][lvl]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
|
|
|
- continue;
|
|
|
- }
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creGenNumbers[nxt->subid][lvl]==NULL)
|
|
|
- {
|
|
|
- creGenNumbers[nxt->subid][lvl] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- case EDefType::CREGEN2_DEF:
|
|
|
- {
|
|
|
- if(((CCreGenObjInfo*)CGI->objh->objInstances[j]->info)->asCastle)
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 17;
|
|
|
- for(int vv=0; vv<CGI->objh->objInstances.size(); ++vv)
|
|
|
- {
|
|
|
- if(getDefType(CGI->objh->objInstances[vv]->defInfo)==EDefType::TOWN_DEF)
|
|
|
- {
|
|
|
- if(
|
|
|
- ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[0]==((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->bytes[0]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[1]==((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->bytes[1]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[2]==((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->bytes[2]
|
|
|
- && ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->bytes[3])
|
|
|
- {
|
|
|
- for(int mm=0; mm<town1DefNames.size(); ++mm)
|
|
|
- {
|
|
|
- std::transform(town1DefNames[mm].begin(), town1DefNames[mm].end(), town1DefNames[mm].begin(), (int(*)(int))toupper);
|
|
|
- std::string hlp = CGI->objh->objInstances[vv]->defInfo->name;
|
|
|
- std::transform(hlp.begin(), hlp.end(), hlp.begin(), (int(*)(int))toupper);
|
|
|
- if(town1DefNames[mm]==hlp)
|
|
|
- {
|
|
|
- nxt->subid = mm;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- int lvl;
|
|
|
- if((((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel - ((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel)!=0)
|
|
|
- lvl = rand()%(((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel - ((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel) + ((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel;
|
|
|
- else lvl = 0;
|
|
|
- nxt->name = creGenNames[nxt->subid][lvl];
|
|
|
- if(creGenNumbers[nxt->subid][lvl]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
|
|
|
- continue;
|
|
|
- }
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creGenNumbers[nxt->subid][lvl]==NULL)
|
|
|
- {
|
|
|
- creGenNumbers[nxt->subid][lvl] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- else //if not as castle
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 17;
|
|
|
- std::vector<int> possibleTowns;
|
|
|
- for(int bb=0; bb<8; ++bb)
|
|
|
- {
|
|
|
- if(((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->castles[0] & (1<<bb))
|
|
|
- {
|
|
|
- possibleTowns.push_back(bb);
|
|
|
- }
|
|
|
- }
|
|
|
- if(((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->castles[1])
|
|
|
- possibleTowns.push_back(8);
|
|
|
- nxt->subid = possibleTowns[rand()%possibleTowns.size()];
|
|
|
- int lvl = rand()%(((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel - ((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel) + ((CCreGen2ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel;
|
|
|
- nxt->name = creGenNames[nxt->subid][lvl];
|
|
|
- if(creGenNumbers[nxt->subid][lvl]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
|
|
|
- continue;
|
|
|
- }
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creGenNumbers[nxt->subid][lvl]==NULL)
|
|
|
- {
|
|
|
- creGenNumbers[nxt->subid][lvl] = nxt;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- case EDefType::CREGEN3_DEF:
|
|
|
- {
|
|
|
- CGDefInfo * nxt = curDef;
|
|
|
- nxt->id = 17;
|
|
|
- nxt->subid = atoi(CGI->objh->objInstances[j]->defInfo->name.substr(7, 8).c_str());
|
|
|
- int lvl = -1;
|
|
|
- CCreGen3ObjInfo * ct = (CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info;
|
|
|
- if(ct->maxLevel>7)
|
|
|
- ct->maxLevel = 7;
|
|
|
- if(ct->minLevel<1)
|
|
|
- ct->minLevel = 1;
|
|
|
- if((((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel - ((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel)!=0)
|
|
|
- lvl = rand()%(((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel - ((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel) + ((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->minLevel;
|
|
|
- else
|
|
|
- lvl = ((CCreGen3ObjInfo*)CGI->objh->objInstances[j]->info)->maxLevel;
|
|
|
- nxt->name = creGenNames[nxt->subid][lvl];
|
|
|
- if(creGenNumbers[nxt->subid][lvl]!=NULL)
|
|
|
- {
|
|
|
- CGI->objh->objInstances[j]->defInfo = creGenNumbers[nxt->subid][lvl];
|
|
|
- continue;
|
|
|
- }
|
|
|
- map.defy.push_back(nxt); // add this def to the vector
|
|
|
- defsToUnpack.push_back(nxt->name);
|
|
|
- CGI->objh->objInstances[j]->defInfo = nxt;
|
|
|
- if(creGenNumbers[nxt->subid][lvl]==NULL)
|
|
|
- {
|
|
|
- creGenNumbers[nxt->subid][lvl] = nxt;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }//end of main switch
|
|
|
- } //end of sencond for loop
|
|
|
-}
|
|
|
+{}
|