mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +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:
@ -1562,7 +1562,7 @@ void CAmbarCendamo::deh3m()
|
|||||||
nobj = nt;
|
nobj = nt;
|
||||||
|
|
||||||
nt->setOwner(spec->player);
|
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->builded = 0;
|
||||||
nt->destroyed = 0;
|
nt->destroyed = 0;
|
||||||
nt->name = spec->name;
|
nt->name = spec->name;
|
||||||
|
@ -35,6 +35,11 @@ void CMapHandler::randomizeObjects()
|
|||||||
std::string nname = getRandomizedDefName(CGI->objh->objInstances[no]->defInfo, CGI->objh->objInstances[no]);
|
std::string nname = getRandomizedDefName(CGI->objh->objInstances[no]->defInfo, CGI->objh->objInstances[no]);
|
||||||
if(nname.size()>0) //change def
|
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;
|
int f=-1;
|
||||||
for(f=0; f<CGI->dobjinfo->objs.size(); ++f)
|
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
|
if(di->id==76) //random resource
|
||||||
{
|
{
|
||||||
std::vector<std::string> resDefNames;
|
std::vector<std::string> resDefNames;
|
||||||
resDefNames.push_back("AVTRNDM0.DEF");
|
//resDefNames.push_back("AVTRNDM0.DEF");
|
||||||
resDefNames.push_back("AVTWOOD0.DEF");
|
resDefNames.push_back("AVTWOOD0.DEF");
|
||||||
resDefNames.push_back("AVTMERC0.DEF");
|
resDefNames.push_back("AVTMERC0.DEF");
|
||||||
resDefNames.push_back("AVTORE0.DEF");
|
resDefNames.push_back("AVTORE0.DEF");
|
||||||
@ -1776,13 +1781,13 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
|
|||||||
std::vector<std::string> town1DefNames; //with fort
|
std::vector<std::string> town1DefNames; //with fort
|
||||||
for(int dd=0; dd<F_NUMBER; ++dd)
|
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
|
std::vector<std::string> town2DefNames; //with capitol
|
||||||
for(int dd=0; dd<F_NUMBER; ++dd)
|
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)
|
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[2]==((CCreGenObjInfo*)obj->info)->bytes[2]
|
||||||
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGenObjInfo*)obj->info)->bytes[3])
|
&& ((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[2]==((CCreGenObjInfo*)obj->info)->bytes[2]
|
||||||
&& ((CCastleObjInfo*)CGI->objh->objInstances[vv]->info)->bytes[3]==((CCreGenObjInfo*)obj->info)->bytes[3])
|
&& ((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?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user