Vermin tweaks.

develop
Petr Mrázek 2012-01-10 00:45:43 +01:00
parent 1652e99a0b
commit 571498ea21
4 changed files with 16 additions and 22 deletions

@ -13,13 +13,13 @@ namespace DFHack { namespace Simple { namespace Vermin
{
void * origin;
int16_t race;
uint16_t type;
int16_t caste;
uint16_t x;
uint16_t y;
uint16_t z;
bool in_use;
uint8_t unknown;
uint32_t countdown;
bool visible:1;
bool is_colony:1; /// Is vermin object a colony?
};
static const uint16_t TYPE_WILD_COLONY = 0xFFFF;
@ -35,8 +35,4 @@ namespace DFHack { namespace Simple { namespace Vermin
* Write into vermin object
*/
DFHACK_EXPORT bool Write (const uint32_t index, t_vermin & point);
/**
* Is vermin object a colony?
*/
DFHACK_EXPORT bool isWildColony(t_vermin & point);
} } } // end DFHack::Simple::Vermin

@ -57,12 +57,13 @@ bool Vermin::Read (const uint32_t index, t_vermin & sp)
sp.origin = verm;
sp.race = verm->race;
sp.type = verm->type;
sp.in_use = verm->in_use;
sp.caste = verm->caste;
sp.visible = verm->visible;
sp.countdown = verm->countdown;
sp.x = verm->x;
sp.y = verm->y;
sp.z = verm->z;
sp.is_colony = verm->flags.bits.is_colony;
return true;
}
@ -72,16 +73,12 @@ bool Vermin::Write (const uint32_t index, t_vermin & sp)
if (!verm) return false;
verm->race = sp.race;
verm->type = sp.type;
verm->in_use = sp.in_use;
verm->caste = sp.caste;
verm->visible = sp.visible;
verm->countdown = sp.countdown;
verm->x = sp.x;
verm->y = sp.y;
verm->z = sp.z;
verm->flags.bits.is_colony = sp.is_colony;
return true;
}
bool Vermin::isWildColony(t_vermin & point)
{
return (point.type == TYPE_WILD_COLONY);
}

@ -1 +1 @@
Subproject commit 85dfa3550fe204c8c75279335cae1457cf03e0ed
Subproject commit f7903623ec2f69759debd2974b037463cc46efff

@ -88,6 +88,7 @@ DFhackCExport command_result colonies (Core * c, vector <string> & parameters)
return CR_OK;
}
//FIXME: this is probably bullshit
void destroyColonies()
{
uint32_t numSpawnPoints = Vermin::getNumVermin();
@ -96,9 +97,9 @@ void destroyColonies()
Vermin::t_vermin sp;
Vermin::Read(i, sp);
if (sp.in_use && Vermin::isWildColony(sp))
if (sp.visible && sp.is_colony)
{
sp.in_use = false;
sp.visible = false;
Vermin::Write(i, sp);
}
}
@ -127,7 +128,7 @@ void convertColonies(DFHack::Materials *Materials)
Vermin::t_vermin sp;
Vermin::Read(i, sp);
if (sp.in_use && Vermin::isWildColony(sp))
if (sp.visible && sp.is_colony)
{
sp.race = bee_idx;
Vermin::Write(i, sp);
@ -145,14 +146,14 @@ void showColonies(Core *c, DFHack::Materials *Materials)
Vermin::Read(i, sp);
if (sp.in_use && Vermin::isWildColony(sp))
if (sp.visible && sp.is_colony)
{
numColonies++;
string race="(no race)";
if(sp.race != -1)
race = Materials->raceEx[sp.race].id;
c->con.print("Spawn point %u: %s at %d:%d:%d\n", i,
c->con.print("Colony %u: %s at %d:%d:%d\n", i,
race.c_str(), sp.x, sp.y, sp.z);
}
}