Now with less endless loops.

develop
Petr Mrázek 2011-03-02 22:43:46 +01:00
parent 777e997da2
commit faea954da1
1 changed files with 69 additions and 68 deletions

@ -32,6 +32,7 @@ distribution.
#include "dfhack/VersionInfo.h"
#include "dfhack/DFProcess.h"
#include "dfhack/DFVector.h"
#include <set>
#define SHMMAPSHDR ((Server::Maps::shm_maps_hdr *)d->d->shm_start)
#define SHMCMD(num) ((shm_cmd *)d->d->shm_start)[num]->pingpong
@ -61,6 +62,8 @@ struct Maps::Private
bool hasFeatures;
bool hasVeggies;
set <uint32_t> unknown_veins;
// map between feature address and the read object
map <uint32_t, t_feature> local_feature_store;
@ -567,8 +570,7 @@ bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector <t_vein>* veins,
if(constructions) constructions->clear();
Server::Maps::maps_offsets &off = d->offsets;
if (addr)
{
if (!addr) return false;
// veins are stored as a vector of pointers to veins
/*pointer is 4 bytes! we work with a 32bit program here, no matter what architecture we compile khazad for*/
DfVector <uint32_t> p_veins (p, addr + off.veinvector);
@ -579,7 +581,6 @@ bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector <t_vein>* veins,
// read the vein pointer from the vector
uint32_t temp = p_veins[i];
uint32_t type = p->readDWord(temp);
try_again:
if(veins && type == off.vein_mineral_vptr)
{
// read the vein data (dereference pointer)
@ -644,16 +645,16 @@ try_again:
off.vein_worldconstruction_vptr = type;
}
else // this is something we've never seen before
{
if(!d->unknown_veins.count(type))
{
cerr << "unknown vein " << cname << hex << " 0x" << temp << " block: 0x" << addr << dec << endl;
d->unknown_veins.insert(type);
}
goto try_again;
// or it was something we don't care about
}
}
return true;
}
return false;
return true;
}
/*