1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

some improvements in map randomizing, most things done. If you want to do sth with this, do it ;].

This commit is contained in:
mateuszb 2007-12-26 13:57:38 +00:00
parent 01c996591a
commit d116caeb26
2 changed files with 11 additions and 6 deletions

View File

@ -1562,7 +1562,7 @@ void CAmbarCendamo::deh3m()
nobj = nt;
nt->setOwner(spec->player);
nt->town = &CGI->townh->towns[CTownHandler::getTypeByDefName(nobj->defInfo->name)];
nt->town = &CGI->townh->towns[nt->defInfo->subid];
nt->builded = 0;
nt->destroyed = 0;
nt->name = spec->name;

View File

@ -35,6 +35,11 @@ void CMapHandler::randomizeObjects()
std::string nname = getRandomizedDefName(CGI->objh->objInstances[no]->defInfo, CGI->objh->objInstances[no]);
if(nname.size()>0) //change def
{
CGDefInfo * ndi = new CGDefInfo;
*ndi = *CGI->objh->objInstances[no]->defInfo; //something to start with
CGI->mh->reader->map.defy.push_back(ndi);
CGI->objh->objInstances[no]->defInfo = ndi;
int f=-1;
for(f=0; f<CGI->dobjinfo->objs.size(); ++f)
{
@ -1669,7 +1674,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
if(di->id==76) //random resource
{
std::vector<std::string> resDefNames;
resDefNames.push_back("AVTRNDM0.DEF");
//resDefNames.push_back("AVTRNDM0.DEF");
resDefNames.push_back("AVTWOOD0.DEF");
resDefNames.push_back("AVTMERC0.DEF");
resDefNames.push_back("AVTORE0.DEF");
@ -1776,13 +1781,13 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
std::vector<std::string> town1DefNames; //with fort
for(int dd=0; dd<F_NUMBER; ++dd)
{
town1DefNames.push_back(CGI->dobjinfo->objs[dd+385].defName);
town1DefNames.push_back(CGI->dobjinfo->objs[dd+384].defName);
}
std::vector<std::string> town2DefNames; //with capitol
for(int dd=0; dd<F_NUMBER; ++dd)
{
town2DefNames.push_back(CGI->dobjinfo->objs[dd+385].defName);
town2DefNames.push_back(CGI->dobjinfo->objs[dd+384].defName);
}
for(int b=0; b<town2DefNames.size(); ++b)
{
@ -1869,7 +1874,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[2]==((CCreGenObjInfo*)obj->info)->bytes[2]
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGenObjInfo*)obj->info)->bytes[3])
{
fraction = ((CGTownInstance*)CGI->objh->objInstances[vv])->town->typeID; //TODO: is typeID what we really want?
fraction = CGI->objh->objInstances[vv]->subID; //TODO: is typeID what we really want?
}
}
}
@ -1928,7 +1933,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[2]==((CCreGenObjInfo*)obj->info)->bytes[2]
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGenObjInfo*)obj->info)->bytes[3])
{
faction = ((CGTownInstance*)CGI->objh->objInstances[vv])->town->typeID; //TODO: is typeID what we really want?
faction = CGI->objh->objInstances[vv]->subID; //TODO: is typeID what we really want?
}
}
}