From 571498ea2100ae84b360c1ef54f727404be20986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 10 Jan 2012 00:45:43 +0100 Subject: [PATCH] Vermin tweaks. --- library/include/modules/Vermin.h | 10 +++------- library/modules/Vermin.cpp | 15 ++++++--------- library/xml | 2 +- plugins/colonies.cpp | 11 ++++++----- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/library/include/modules/Vermin.h b/library/include/modules/Vermin.h index bcec96b51..9ca2730d8 100644 --- a/library/include/modules/Vermin.h +++ b/library/include/modules/Vermin.h @@ -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 diff --git a/library/modules/Vermin.cpp b/library/modules/Vermin.cpp index 31e156e22..6b83d76bb 100644 --- a/library/modules/Vermin.cpp +++ b/library/modules/Vermin.cpp @@ -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); -} diff --git a/library/xml b/library/xml index 85dfa3550..f7903623e 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 85dfa3550fe204c8c75279335cae1457cf03e0ed +Subproject commit f7903623ec2f69759debd2974b037463cc46efff diff --git a/plugins/colonies.cpp b/plugins/colonies.cpp index 73106b966..3089b7ccd 100644 --- a/plugins/colonies.cpp +++ b/plugins/colonies.cpp @@ -88,6 +88,7 @@ DFhackCExport command_result colonies (Core * c, vector & 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); } }