1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
Broken #87
This commit is contained in:
Michał W. Urbańczyk 2010-08-01 14:04:48 +00:00
parent 32597fb391
commit c6653949e1
8 changed files with 31 additions and 9 deletions

View File

@ -49,6 +49,7 @@
#include "SDL_syswm.h"
#endif
#include <boost/foreach.hpp>
#include "../hch/CDefObjInfoHandler.h"
#if __MINGW32__
#undef main
@ -591,6 +592,10 @@ static void listenForEvents()
delete ev;
delete CGI->dobjinfo;
CGI->dobjinfo = new CDefObjInfoHandler;
CGI->dobjinfo->load();
GH.curInt = CGP;
GH.defActionsDef = 63;
continue;

View File

@ -397,6 +397,7 @@ void CMapHandler::init()
}
else
n = CGI->state->capitols[i%ccc];
ifs >> n->name;
if(!n)
tlog1 << "*HUGE* Warning - missing town def for " << i << std::endl;

View File

@ -24,7 +24,7 @@ typedef si64 expType;
#define THC
#endif
#define NAME_VER ("VCMI 0.81d")
#define NAME_VER ("VCMI 0.81e")
extern std::string NAME; //full name
extern std::string NAME_AFFIX; //client / server
#define CONSOLE_LOGGING_LEVEL 5

View File

@ -59,12 +59,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & gobjs;
if(!h.saving) //recrete castles map
for(std::map<int,std::map<int,CGDefInfo*> >::iterator i=gobjs.begin(); i!=gobjs.end(); i++)
for(std::map<int,CGDefInfo*>::iterator j=i->second.begin(); j!=i->second.end(); j++)
if(j->second->id == TOWNI_TYPE)
castles[j->second->subid]=j->second;
h & castles;
}
};

View File

@ -311,7 +311,7 @@ bool CSmackPlayer::open( std::string name )
buffer = new char[data->width*data->height*2];
buf = buffer+data->width*(data->height-1)*2; // adjust pointer position for later use by 'SmackToBuffer'
ptrVolumePan(data, 0xfe000, 3640 * GDefaultOptions.musicVolume / 11, 0x8000); //set volume
//ptrVolumePan(data, 0xfe000, 3640 * GDefaultOptions.musicVolume / 11, 0x8000); //set volume
return true;
}

View File

@ -1188,6 +1188,10 @@ CGameState::~CGameState()
//delete scenarioOps;
delete applierGs;
delete objCaller;
//TODO: delete properly that definfos
villages.clear();
capitols.clear();
}
void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
@ -1966,8 +1970,24 @@ void CGameState::loadTownDInfos()
{
villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
forts[i] = VLC->dobjinfo->castles[i];
map->defy.push_back(forts[i]);
capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
}
std::ifstream ifs(DATA_DIR "/config/townsDefs.txt");
int ccc;
ifs>>ccc;
for(int i=0; i < ccc*2; i++)
{
CGDefInfo *n;
if(i<ccc)
n = villages[i];
else
n = capitols[i%ccc];
ifs >> n->name;
map->defy.push_back(n);
}
}
void CGameState::getNeighbours(const TerrainTile &srct, int3 tile, std::vector<int3> &vec, const boost::logic::tribool &onLand, bool limitCoastSailing)

View File

@ -446,6 +446,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & scenarioOps & seed & currentPlayer & day & map & players & hpool & globalEffects & campaign;
h & villages & forts & capitols;
if(!h.saving)
{
loadTownDInfos();

View File

@ -23,7 +23,7 @@
#include <boost/mpl/identity.hpp>
#include <boost/any.hpp>
const ui32 version = 725;
const ui32 version = 726;
class CConnection;
class CGObjectInstance;
class CGameState;