Renaming Creatures to Units

develop
Petr Mrázek 2011-12-02 10:56:40 +01:00
parent 9dba6003bc
commit f7d78539d3
18 changed files with 109 additions and 109 deletions

@ -43,7 +43,7 @@ include/dfhack/extra/stopwatch.h
include/dfhack/extra/termutil.h include/dfhack/extra/termutil.h
include/dfhack/modules/Buildings.h include/dfhack/modules/Buildings.h
include/dfhack/modules/Constructions.h include/dfhack/modules/Constructions.h
include/dfhack/modules/Creatures.h include/dfhack/modules/Units.h
include/dfhack/modules/Engravings.h include/dfhack/modules/Engravings.h
include/dfhack/modules/Gui.h include/dfhack/modules/Gui.h
include/dfhack/modules/Items.h include/dfhack/modules/Items.h
@ -77,7 +77,7 @@ depends/tthread/tinythread.cpp
modules/Buildings.cpp modules/Buildings.cpp
modules/Constructions.cpp modules/Constructions.cpp
modules/Creatures.cpp modules/Units.cpp
modules/Engravings.cpp modules/Engravings.cpp
modules/Gui.cpp modules/Gui.cpp
modules/Items.cpp modules/Items.cpp

@ -775,7 +775,7 @@ TYPE * Core::get##TYPE() \
return s_mods.p##TYPE;\ return s_mods.p##TYPE;\
} }
MODULE_GETTER(Creatures); MODULE_GETTER(Units);
MODULE_GETTER(Engravings); MODULE_GETTER(Engravings);
MODULE_GETTER(Maps); MODULE_GETTER(Maps);
MODULE_GETTER(Gui); MODULE_GETTER(Gui);

@ -57,7 +57,7 @@ distribution.
#include "dfhack/modules/Engravings.h" #include "dfhack/modules/Engravings.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack/modules/Constructions.h" #include "dfhack/modules/Constructions.h"
#include "dfhack/modules/Creatures.h" #include "dfhack/modules/Units.h"
#include "dfhack/modules/Translation.h" #include "dfhack/modules/Translation.h"
#include "dfhack/modules/World.h" #include "dfhack/modules/World.h"
#include "dfhack/modules/Items.h" #include "dfhack/modules/Items.h"

@ -46,7 +46,7 @@ namespace DFHack
{ {
class Process; class Process;
class Module; class Module;
class Creatures; class Units;
class Engravings; class Engravings;
class Maps; class Maps;
class Gui; class Gui;
@ -96,7 +96,7 @@ namespace DFHack
bool isValid(void) { return !errorstate; } bool isValid(void) { return !errorstate; }
/// get the creatures module /// get the creatures module
Creatures * getCreatures(); Units * getUnits();
/// get the engravings module /// get the engravings module
Engravings * getEngravings(); Engravings * getEngravings();
/// get the maps module /// get the maps module
@ -158,7 +158,7 @@ namespace DFHack
// Module storage // Module storage
struct struct
{ {
Creatures * pCreatures; Units * pUnits;
Engravings * pEngravings; Engravings * pEngravings;
Maps * pMaps; Maps * pMaps;
Gui * pGui; Gui * pGui;

@ -42,7 +42,7 @@ namespace DFHack
class Context; class Context;
class DFContextShared; class DFContextShared;
class Creatures; class Units;
/** /**
* Item flags. A bit fuzzy. * Item flags. A bit fuzzy.
@ -594,7 +594,7 @@ public:
/// which items does it contain? /// which items does it contain?
bool getContainedItems(const df_item * item, /*output*/ std::vector<int32_t> &items); bool getContainedItems(const df_item * item, /*output*/ std::vector<int32_t> &items);
/// wipe out the owner records /// wipe out the owner records
bool removeItemOwner(df_item * item, Creatures *creatures); bool removeItemOwner(df_item * item, Units *creatures);
/// read item references, filtered by class /// read item references, filtered by class
bool readItemRefs(const df_item * item, const ClassNameCheck &classname, bool readItemRefs(const df_item * item, const ClassNameCheck &classname,
/*output*/ std::vector<int32_t> &values); /*output*/ std::vector<int32_t> &values);

@ -32,16 +32,16 @@ distribution.
#include "dfhack/Module.h" #include "dfhack/Module.h"
#include "dfhack/modules/Items.h" #include "dfhack/modules/Items.h"
/** /**
* \defgroup grp_creatures Creatures module parts * \defgroup grp_units Unit module parts
* @ingroup grp_modules * @ingroup grp_modules
*/ */
namespace DFHack namespace DFHack
{ {
/** /**
* easy access to first crature flags block * easy access to first crature flags block
* \ingroup grp_creatures * \ingroup grp_units
*/ */
union t_creaturflags1 union t_unitflags1
{ {
uint32_t whole;/*!< Access all flags as a single 32bit number. */ uint32_t whole;/*!< Access all flags as a single 32bit number. */
struct struct
@ -88,7 +88,7 @@ namespace DFHack
} bits; } bits;
}; };
union t_creaturflags2 union t_unitflags2
{ {
uint32_t whole; /*!< Access all flags as a single 32bit number. */ uint32_t whole; /*!< Access all flags as a single 32bit number. */
struct struct
@ -135,7 +135,7 @@ namespace DFHack
} bits; } bits;
}; };
union t_creaturflags3 union t_unitflags3
{ {
uint32_t whole; /*!< Access all flags as a single 32bit number. */ uint32_t whole; /*!< Access all flags as a single 32bit number. */
struct struct
@ -239,7 +239,7 @@ namespace DFHack
}; };
*/ */
/** /**
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct t_skill struct t_skill
{ {
@ -248,7 +248,7 @@ namespace DFHack
uint32_t experience; uint32_t experience;
}; };
/** /**
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct t_job struct t_job
{ {
@ -258,7 +258,7 @@ namespace DFHack
uint32_t occupationPtr; uint32_t occupationPtr;
}; };
/** /**
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct t_like struct t_like
{ {
@ -276,8 +276,8 @@ namespace DFHack
#define NUM_CREATURE_MENTAL_ATTRIBUTES 13 #define NUM_CREATURE_MENTAL_ATTRIBUTES 13
#define NUM_CREATURE_PHYSICAL_ATTRIBUTES 6 #define NUM_CREATURE_PHYSICAL_ATTRIBUTES 6
/** /**
* structure for holding a copy of a creature's soul * Structure for holding a copy of a DF unit's soul
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct t_soul struct t_soul
{ {
@ -301,23 +301,23 @@ namespace DFHack
t_attrib social_awareness; t_attrib social_awareness;
}; };
#define MAX_COLORS 15 #define MAX_COLORS 15
struct df_creature; struct df_unit;
/** /**
* structure for holding a copy of a creature * Structure for holding a limited copy of a DF unit
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct t_creature struct t_unit
{ {
df_creature * origin; df_unit * origin;
uint16_t x; uint16_t x;
uint16_t y; uint16_t y;
uint16_t z; uint16_t z;
uint32_t race; uint32_t race;
int32_t civ; int32_t civ;
t_creaturflags1 flags1; t_unitflags1 flags1;
t_creaturflags2 flags2; t_unitflags2 flags2;
t_creaturflags3 flags3; t_unitflags3 flags3;
t_name name; t_name name;
@ -354,8 +354,8 @@ namespace DFHack
}; };
/** /**
* Creature attribute descriptor * Unit attribute descriptor
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_attrib struct df_attrib
{ {
@ -368,8 +368,8 @@ namespace DFHack
uint32_t unk_18; uint32_t unk_18;
}; };
/** /**
* Creature skill descriptor * Unit skill descriptor
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_skill struct df_skill
{ {
@ -383,8 +383,8 @@ namespace DFHack
uint32_t unk_1c; uint32_t unk_1c;
}; };
/** /**
* Creature like descriptor * Unit like descriptor
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_like struct df_like
{ {
@ -398,7 +398,7 @@ namespace DFHack
}; };
/** /**
* A creature's soul, as it appears in DF memory * A creature's soul, as it appears in DF memory
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_soul struct df_soul
{ {
@ -423,7 +423,7 @@ namespace DFHack
}; };
/** /**
* A creature job - what it's supposed to be doing. * A creature job - what it's supposed to be doing.
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_job struct df_job
{ {
@ -431,7 +431,7 @@ namespace DFHack
}; };
/** /**
* A creature though - dwarves staring at waterfalls! * A creature though - dwarves staring at waterfalls!
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_thought struct df_thought
{ {
@ -445,9 +445,9 @@ namespace DFHack
}; };
/** /**
* A creature, as it appears in DF memory * A creature, as it appears in DF memory
* \ingroup grp_creatures * \ingroup grp_units
*/ */
struct df_creature struct df_unit
{ {
df_name name; // 0 df_name name; // 0
std::string custom_profession; // 6c (MSVC) std::string custom_profession; // 6c (MSVC)
@ -475,9 +475,9 @@ namespace DFHack
std::vector<uint32_t> unk_c0; std::vector<uint32_t> unk_c0;
std::vector<uint32_t> unk_d0; std::vector<uint32_t> unk_d0;
t_creaturflags1 flags1; // e0 t_unitflags1 flags1; // e0
t_creaturflags2 flags2; // e4 t_unitflags2 flags2; // e4
t_creaturflags3 flags3; // e8 t_unitflags3 flags3; // e8
void ** unk_ec; void ** unk_ec;
int32_t unk_f0; int32_t unk_f0;
@ -535,7 +535,7 @@ namespace DFHack
uint32_t birth_time; // 228 uint32_t birth_time; // 228
uint32_t unk_22c; uint32_t unk_22c;
uint32_t unk_230; uint32_t unk_230;
df_creature * unk_234; // suspiciously close to the pregnancy/birth stuff. Mother? df_unit * unk_234; // suspiciously close to the pregnancy/birth stuff. Mother?
uint32_t unk_238; uint32_t unk_238;
int32_t unk_23c; int32_t unk_23c;
int32_t unk_240; int32_t unk_240;
@ -754,34 +754,34 @@ namespace DFHack
/** /**
* The Creatures module - allows reading all non-vermin creatures and their properties * The Creatures module - allows reading all non-vermin creatures and their properties
* \ingroup grp_modules * \ingroup grp_modules
* \ingroup grp_creatures * \ingroup grp_units
*/ */
class DFHACK_EXPORT Creatures : public Module class DFHACK_EXPORT Units : public Module
{ {
public: public:
std::vector <df_creature *> * creatures; std::vector <df_unit *> * creatures;
public: public:
Creatures(); Units();
~Creatures(); ~Units();
bool Start( uint32_t & numCreatures ); bool Start( uint32_t & numCreatures );
bool Finish(); bool Finish();
/* Read Functions */ /* Read Functions */
// Read creatures in a box, starting with index. Returns -1 if no more creatures // Read creatures in a box, starting with index. Returns -1 if no more creatures
// found. Call repeatedly do get all creatures in a specified box (uses tile coords) // found. Call repeatedly do get all creatures in a specified box (uses tile coords)
int32_t GetCreatureInBox(const int32_t index, df_creature ** furball, int32_t GetCreatureInBox(const int32_t index, df_unit ** furball,
const uint16_t x1, const uint16_t y1,const uint16_t z1, const uint16_t x1, const uint16_t y1,const uint16_t z1,
const uint16_t x2, const uint16_t y2,const uint16_t z2); const uint16_t x2, const uint16_t y2,const uint16_t z2);
df_creature * GetCreature(const int32_t index); df_unit * GetCreature(const int32_t index);
void CopyCreature(df_creature * source, t_creature & target); void CopyCreature(df_unit * source, t_unit & target);
bool ReadJob(const df_creature * unit, std::vector<t_material> & mat); bool ReadJob(const df_unit * unit, std::vector<t_material> & mat);
bool ReadInventoryByIdx(const uint32_t index, std::vector<df_item *> & item); bool ReadInventoryByIdx(const uint32_t index, std::vector<df_item *> & item);
bool ReadInventoryByPtr(const df_creature * unit, std::vector<df_item *> & item); bool ReadInventoryByPtr(const df_unit * unit, std::vector<df_item *> & item);
bool ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item); bool ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item);
bool ReadOwnedItemsByPtr(const df_creature * unit, std::vector<int32_t> & item); bool ReadOwnedItemsByPtr(const df_unit * unit, std::vector<int32_t> & item);
int32_t FindIndexById(int32_t id); int32_t FindIndexById(int32_t id);
@ -805,12 +805,12 @@ namespace DFHack
//bool WriteCiv(const uint32_t index, const int32_t civ); //bool WriteCiv(const uint32_t index, const int32_t civ);
//bool WritePregnancy(const uint32_t index, const uint32_t pregTimer); //bool WritePregnancy(const uint32_t index, const uint32_t pregTimer);
void CopyNameTo(df_creature *creature, df_name * target); void CopyNameTo(df_unit *creature, df_name * target);
protected: protected:
friend class Items; friend class Items;
bool RemoveOwnedItemByIdx(const uint32_t index, int32_t id); bool RemoveOwnedItemByIdx(const uint32_t index, int32_t id);
bool RemoveOwnedItemByPtr(df_creature * unit, int32_t id); bool RemoveOwnedItemByPtr(df_unit * unit, int32_t id);
private: private:
struct Private; struct Private;

@ -39,7 +39,7 @@ using namespace std;
#include "dfhack/Vector.h" #include "dfhack/Vector.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack/modules/Items.h" #include "dfhack/modules/Items.h"
#include "dfhack/modules/Creatures.h" #include "dfhack/modules/Units.h"
#include "ModuleFactory.h" #include "ModuleFactory.h"
#include <dfhack/Core.h> #include <dfhack/Core.h>
#include <dfhack/Virtual.h> #include <dfhack/Virtual.h>
@ -265,7 +265,7 @@ bool Items::unknownRefs(const df_item * item, std::vector<std::pair<std::string,
return (refs.size() > 0); return (refs.size() > 0);
} }
bool Items::removeItemOwner(df_item * item, Creatures *creatures) bool Items::removeItemOwner(df_item * item, Units *creatures)
{ {
std::vector <t_itemref *> &p_refs = item->itemrefs; std::vector <t_itemref *> &p_refs = item->itemrefs;
for (uint32_t i=0; i<p_refs.size(); i++) for (uint32_t i=0; i<p_refs.size(); i++)

@ -42,14 +42,14 @@ using namespace std;
// we connect to those // we connect to those
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack/modules/Creatures.h" #include "dfhack/modules/Units.h"
#include "dfhack/modules/Translation.h" #include "dfhack/modules/Translation.h"
#include "ModuleFactory.h" #include "ModuleFactory.h"
#include <dfhack/Core.h> #include <dfhack/Core.h>
using namespace DFHack; using namespace DFHack;
struct Creatures::Private struct Units::Private
{ {
bool Inited; bool Inited;
bool Started; bool Started;
@ -63,12 +63,12 @@ struct Creatures::Private
Translation * trans; Translation * trans;
}; };
Module* DFHack::createCreatures() Module* DFHack::createUnits()
{ {
return new Creatures(); return new Units();
} }
Creatures::Creatures() Units::Units()
{ {
Core & c = Core::getInstance(); Core & c = Core::getInstance();
d = new Private; d = new Private;
@ -85,7 +85,7 @@ Creatures::Creatures()
creatures = 0; creatures = 0;
try try
{ {
creatures = (vector <df_creature *> *) OG_Creatures->getAddress ("vector"); creatures = (vector <df_unit *> *) OG_Creatures->getAddress ("vector");
d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race"); d->dwarf_race_index_addr = OG_Creatures->getAddress("current_race");
d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ"); d->dwarf_civ_id_addr = OG_Creatures->getAddress("current_civ");
} }
@ -93,13 +93,13 @@ Creatures::Creatures()
d->Inited = true; d->Inited = true;
} }
Creatures::~Creatures() Units::~Units()
{ {
if(d->Started) if(d->Started)
Finish(); Finish();
} }
bool Creatures::Start( uint32_t &numcreatures ) bool Units::Start( uint32_t &numcreatures )
{ {
if(creatures) if(creatures)
{ {
@ -112,13 +112,13 @@ bool Creatures::Start( uint32_t &numcreatures )
return false; return false;
} }
bool Creatures::Finish() bool Units::Finish()
{ {
d->Started = false; d->Started = false;
return true; return true;
} }
df_creature * Creatures::GetCreature (const int32_t index) df_unit * Units::GetCreature (const int32_t index)
{ {
if(!d->Started) return NULL; if(!d->Started) return NULL;
@ -129,7 +129,7 @@ df_creature * Creatures::GetCreature (const int32_t index)
} }
// returns index of creature actually read or -1 if no creature can be found // returns index of creature actually read or -1 if no creature can be found
int32_t Creatures::GetCreatureInBox (int32_t index, df_creature ** furball, int32_t Units::GetCreatureInBox (int32_t index, df_unit ** furball,
const uint16_t x1, const uint16_t y1, const uint16_t z1, const uint16_t x1, const uint16_t y1, const uint16_t z1,
const uint16_t x2, const uint16_t y2, const uint16_t z2) const uint16_t x2, const uint16_t y2, const uint16_t z2)
{ {
@ -142,7 +142,7 @@ int32_t Creatures::GetCreatureInBox (int32_t index, df_creature ** furball,
while (uint32_t(index) < size) while (uint32_t(index) < size)
{ {
// read pointer from vector at position // read pointer from vector at position
df_creature * temp = creatures->at(index); df_unit * temp = creatures->at(index);
if (temp->x >= x1 && temp->x < x2) if (temp->x >= x1 && temp->x < x2)
{ {
if (temp->y >= y1 && temp->y < y2) if (temp->y >= y1 && temp->y < y2)
@ -160,7 +160,7 @@ int32_t Creatures::GetCreatureInBox (int32_t index, df_creature ** furball,
return -1; return -1;
} }
void Creatures::CopyCreature(df_creature * source, t_creature & furball) void Units::CopyCreature(df_unit * source, t_unit & furball)
{ {
if(!d->Started) return; if(!d->Started) return;
// read pointer from vector at position // read pointer from vector at position
@ -275,7 +275,7 @@ void Creatures::CopyCreature(df_creature * source, t_creature & furball)
furball.current_job.active = false; furball.current_job.active = false;
} }
} }
int32_t Creatures::FindIndexById(int32_t creature_id) int32_t Units::FindIndexById(int32_t creature_id)
{ {
if (!d->Started) if (!d->Started)
return -1; return -1;
@ -287,7 +287,7 @@ int32_t Creatures::FindIndexById(int32_t creature_id)
uint32_t size = creatures->size(); uint32_t size = creatures->size();
for (uint32_t index = 0; index < size; index++) for (uint32_t index = 0; index < size; index++)
{ {
df_creature * temp = creatures->at(index); df_unit * temp = creatures->at(index);
int32_t id = temp->id; int32_t id = temp->id;
d->IdMap[id] = index; d->IdMap[id] = index;
} }
@ -507,14 +507,14 @@ bool Creatures::WritePregnancy(const uint32_t index, const uint32_t pregTimer)
return true; return true;
} }
*/ */
uint32_t Creatures::GetDwarfRaceIndex() uint32_t Units::GetDwarfRaceIndex()
{ {
if(!d->Inited) return 0; if(!d->Inited) return 0;
Process * p = d->owner; Process * p = d->owner;
return p->readDWord(d->dwarf_race_index_addr); return p->readDWord(d->dwarf_race_index_addr);
} }
int32_t Creatures::GetDwarfCivId() int32_t Units::GetDwarfCivId()
{ {
if(!d->Inited) return -1; if(!d->Inited) return -1;
Process * p = d->owner; Process * p = d->owner;
@ -551,30 +551,30 @@ bool Creatures::ReadJob(const t_creature * furball, vector<t_material> & mat)
return true; return true;
} }
*/ */
bool Creatures::ReadInventoryByIdx(const uint32_t index, std::vector<df_item *> & item) bool Units::ReadInventoryByIdx(const uint32_t index, std::vector<df_item *> & item)
{ {
if(!d->Started) return false; if(!d->Started) return false;
if(index >= creatures->size()) return false; if(index >= creatures->size()) return false;
df_creature * temp = creatures->at(index); df_unit * temp = creatures->at(index);
return this->ReadInventoryByPtr(temp, item); return this->ReadInventoryByPtr(temp, item);
} }
bool Creatures::ReadInventoryByPtr(const df_creature * temp, std::vector<df_item *> & items) bool Units::ReadInventoryByPtr(const df_unit * temp, std::vector<df_item *> & items)
{ {
if(!d->Started) return false; if(!d->Started) return false;
items = temp->inventory; items = temp->inventory;
return true; return true;
} }
bool Creatures::ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item) bool Units::ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item)
{ {
if(!d->Started ) return false; if(!d->Started ) return false;
if(index >= creatures->size()) return false; if(index >= creatures->size()) return false;
df_creature * temp = creatures->at(index); df_unit * temp = creatures->at(index);
return this->ReadOwnedItemsByPtr(temp, item); return this->ReadOwnedItemsByPtr(temp, item);
} }
bool Creatures::ReadOwnedItemsByPtr(const df_creature * temp, std::vector<int32_t> & items) bool Units::ReadOwnedItemsByPtr(const df_unit * temp, std::vector<int32_t> & items)
{ {
unsigned int i; unsigned int i;
if(!d->Started) return false; if(!d->Started) return false;
@ -582,18 +582,18 @@ bool Creatures::ReadOwnedItemsByPtr(const df_creature * temp, std::vector<int32_
return true; return true;
} }
bool Creatures::RemoveOwnedItemByIdx(const uint32_t index, int32_t id) bool Units::RemoveOwnedItemByIdx(const uint32_t index, int32_t id)
{ {
if(!d->Started) if(!d->Started)
{ {
cerr << "!d->Started FAIL" << endl; cerr << "!d->Started FAIL" << endl;
return false; return false;
} }
df_creature * temp = creatures->at (index); df_unit * temp = creatures->at (index);
return this->RemoveOwnedItemByPtr(temp, id); return this->RemoveOwnedItemByPtr(temp, id);
} }
bool Creatures::RemoveOwnedItemByPtr(df_creature * temp, int32_t id) bool Units::RemoveOwnedItemByPtr(df_unit * temp, int32_t id)
{ {
if(!d->Started) return false; if(!d->Started) return false;
Process * p = d->owner; Process * p = d->owner;
@ -612,7 +612,7 @@ bool Creatures::RemoveOwnedItemByPtr(df_creature * temp, int32_t id)
return true; return true;
} }
void Creatures::CopyNameTo(df_creature * creature, df_name * target) void Units::CopyNameTo(df_unit * creature, df_name * target)
{ {
d->trans->copyName(&creature->name, target); d->trans->copyName(&creature->name, target);
} }

@ -15,7 +15,7 @@ using namespace std;
#include "dfhack/Vector.h" #include "dfhack/Vector.h"
#include "dfhack/modules/Materials.h" #include "dfhack/modules/Materials.h"
#include "dfhack/modules/Items.h" #include "dfhack/modules/Items.h"
#include "dfhack/modules/Creatures.h" #include "dfhack/modules/Units.h"
#include "dfhack/modules/kitchen.h" #include "dfhack/modules/kitchen.h"
#include "ModuleFactory.h" #include "ModuleFactory.h"
#include <dfhack/Core.h> #include <dfhack/Core.h>

@ -30,7 +30,7 @@ distribution.
namespace DFHack namespace DFHack
{ {
class Module; class Module;
Module* createCreatures(); Module* createUnits();
Module* createEngravings(); Module* createEngravings();
Module* createGui(); Module* createGui();
Module* createWorld(); Module* createWorld();

@ -4,7 +4,7 @@
#include <dfhack/PluginManager.h> #include <dfhack/PluginManager.h>
#include <dfhack/modules/Maps.h> #include <dfhack/modules/Maps.h>
#include <dfhack/modules/Items.h> #include <dfhack/modules/Items.h>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
#include <dfhack/modules/Gui.h> #include <dfhack/modules/Gui.h>
using namespace DFHack; using namespace DFHack;
@ -135,7 +135,7 @@ command_result cleanitems (Core * c)
command_result cleanunits (Core * c) command_result cleanunits (Core * c)
{ {
DFHack::Creatures * Creatures = c->getCreatures(); DFHack::Units * Creatures = c->getUnits();
uint32_t num_creatures; uint32_t num_creatures;
if (!Creatures->Start(num_creatures)) if (!Creatures->Start(num_creatures))
@ -147,7 +147,7 @@ command_result cleanunits (Core * c)
int cleaned_units = 0, cleaned_total = 0; int cleaned_units = 0, cleaned_total = 0;
for (std::size_t i = 0; i < num_creatures; i++) for (std::size_t i = 0; i < num_creatures; i++)
{ {
df_creature *unit = Creatures->creatures->at(i); df_unit *unit = Creatures->creatures->at(i);
int num = unit->contaminants.size(); int num = unit->contaminants.size();
if (num) if (num)
{ {

@ -16,7 +16,7 @@ using namespace std;
#include <string> #include <string>
#include <dfhack/modules/Maps.h> #include <dfhack/modules/Maps.h>
#include <dfhack/modules/Items.h> #include <dfhack/modules/Items.h>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
#include <dfhack/modules/Materials.h> #include <dfhack/modules/Materials.h>
#include <dfhack/modules/Translation.h> #include <dfhack/modules/Translation.h>
using namespace DFHack; using namespace DFHack;
@ -90,7 +90,7 @@ DFhackCExport command_result df_cleanowned (Core * c, vector <string> & paramete
c->Suspend(); c->Suspend();
DFHack::Materials *Materials = c->getMaterials(); DFHack::Materials *Materials = c->getMaterials();
DFHack::Items *Items = c->getItems(); DFHack::Items *Items = c->getItems();
DFHack::Creatures *Creatures = c->getCreatures(); DFHack::Units *Creatures = c->getUnits();
DFHack::Translation *Tran = c->getTranslation(); DFHack::Translation *Tran = c->getTranslation();
uint32_t num_creatures; uint32_t num_creatures;
@ -195,7 +195,7 @@ DFhackCExport command_result df_cleanowned (Core * c, vector <string> & paramete
if (owner_index >= 0) if (owner_index >= 0)
{ {
DFHack::df_creature * temp = Creatures->GetCreature(owner_index); DFHack::df_unit * temp = Creatures->GetCreature(owner_index);
info = temp->name.first_name; info = temp->name.first_name;
if (!temp->name.nick_name.empty()) if (!temp->name.nick_name.empty())
info += std::string(" '") + temp->name.nick_name + "'"; info += std::string(" '") + temp->name.nick_name + "'";

@ -329,14 +329,14 @@ DFhackCExport command_result kittens (Core * c, vector <string> & parameters)
} }
} }
#include "dfhack/modules/Creatures.h" #include "dfhack/modules/Units.h"
#include "dfhack/VersionInfo.h" #include "dfhack/VersionInfo.h"
#include <stddef.h> #include <stddef.h>
command_result test_creature_offsets(Core* c, vector< string >& parameters) command_result test_creature_offsets(Core* c, vector< string >& parameters)
{ {
uint32_t off_vinfo = c->vinfo->getGroup("Creatures")->getGroup("creature")->/*getGroup("advanced")->*/getOffset("custom_profession"); uint32_t off_vinfo = c->vinfo->getGroup("Creatures")->getGroup("creature")->/*getGroup("advanced")->*/getOffset("custom_profession");
uint32_t off_struct = offsetof(df_creature,custom_profession); uint32_t off_struct = offsetof(df_unit,custom_profession);
c->con.print("Struct 0x%x, vinfo 0x%x\n", off_struct, off_vinfo); c->con.print("Struct 0x%x, vinfo 0x%x\n", off_struct, off_vinfo);
return CR_OK; return CR_OK;
}; };
@ -344,7 +344,7 @@ command_result test_creature_offsets(Core* c, vector< string >& parameters)
command_result creat_job (Core * c, vector< string >& parameters) command_result creat_job (Core * c, vector< string >& parameters)
{ {
c->Suspend(); c->Suspend();
Creatures * cr = c->getCreatures(); Units * cr = c->getUnits();
Gui * g = c-> getGui(); Gui * g = c-> getGui();
uint32_t num_cr = 0; uint32_t num_cr = 0;
int32_t cx,cy,cz; int32_t cx,cy,cz;
@ -364,7 +364,7 @@ command_result creat_job (Core * c, vector< string >& parameters)
auto iter = cr->creatures->begin(); auto iter = cr->creatures->begin();
while (iter != cr->creatures->end()) while (iter != cr->creatures->end())
{ {
df_creature * unit = *iter; df_unit * unit = *iter;
if(cx == unit->x && cy == unit->y && cz == unit->z) if(cx == unit->x && cy == unit->y && cz == unit->z)
{ {
c->con.print("%d:%s - address 0x%x - job 0x%x\n" c->con.print("%d:%s - address 0x%x - job 0x%x\n"
@ -372,8 +372,8 @@ command_result creat_job (Core * c, vector< string >& parameters)
unit->id, unit->id,
unit->name.first_name.c_str(), unit->name.first_name.c_str(),
unit, unit,
uint32_t(unit) + offsetof(df_creature,current_job), uint32_t(unit) + offsetof(df_unit,current_job),
uint32_t(unit) + offsetof(df_creature,current_soul), uint32_t(unit) + offsetof(df_unit,current_soul),
uint32_t(unit->current_soul) + offsetof(df_soul,likes) uint32_t(unit->current_soul) + offsetof(df_soul,likes)
); );
df_soul * s = unit->current_soul; df_soul * s = unit->current_soul;

@ -13,7 +13,7 @@ using namespace std;
#include <dfhack/Export.h> #include <dfhack/Export.h>
#include <dfhack/PluginManager.h> #include <dfhack/PluginManager.h>
#include <dfhack/VersionInfo.h> #include <dfhack/VersionInfo.h>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
using namespace DFHack; using namespace DFHack;
// dfhack interface // dfhack interface
@ -33,9 +33,9 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
{ {
if (!enable_fastdwarf) if (!enable_fastdwarf)
return CR_OK; return CR_OK;
df_creature *cre; df_unit *cre;
DFHack::Creatures * cr = c->getCreatures(); DFHack::Units * cr = c->getUnits();
static vector <df_creature*> *v = cr->creatures; static vector <df_unit*> *v = cr->creatures;
uint32_t race = cr->GetDwarfRaceIndex(); uint32_t race = cr->GetDwarfRaceIndex();
uint32_t civ = cr->GetDwarfCivId(); uint32_t civ = cr->GetDwarfCivId();
if (!v) if (!v)

@ -15,7 +15,7 @@ using namespace std;
#include <dfhack/PluginManager.h> #include <dfhack/PluginManager.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
#include <dfhack/modules/Maps.h> #include <dfhack/modules/Maps.h>
#include <dfhack/modules/Gui.h> #include <dfhack/modules/Gui.h>
#include <dfhack/modules/Materials.h> #include <dfhack/modules/Materials.h>
@ -57,7 +57,7 @@ DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters)
BEGIN_PROBE: BEGIN_PROBE:
c->Suspend(); c->Suspend();
DFHack::Gui *Gui = c->getGui(); DFHack::Gui *Gui = c->getGui();
DFHack::Creatures * cr = c->getCreatures(); DFHack::Units * cr = c->getUnits();
int32_t cursorX, cursorY, cursorZ; int32_t cursorX, cursorY, cursorZ;
Gui->getCursorCoords(cursorX,cursorY,cursorZ); Gui->getCursorCoords(cursorX,cursorY,cursorZ);
if(cursorX == -30000) if(cursorX == -30000)
@ -70,7 +70,7 @@ DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters)
cr->Start(ncr); cr->Start(ncr);
for(auto i = 0; i < ncr; i++) for(auto i = 0; i < ncr; i++)
{ {
df_creature * unit = cr->GetCreature( i ); df_unit * unit = cr->GetCreature( i );
if(unit->x == cursorX && unit->y == cursorY && unit->z == cursorZ) if(unit->x == cursorX && unit->y == cursorY && unit->z == cursorZ)
{ {
con.print("Creature %d, race %d (%x), civ %d (%x)\n", unit->id, unit->race, unit->race, unit->civ, unit->civ); con.print("Creature %d, race %d (%x), civ %d (%x)\n", unit->id, unit->race, unit->race, unit->civ, unit->civ);

@ -1 +1 @@
Subproject commit 71d28909ec397d0a772e6135a822cc1c4a5fd3a7 Subproject commit dbfeaf935df92644b72746842166baf700450e15

@ -70,7 +70,7 @@ using namespace std;
#define DFHACK_WANT_MISCUTILS #define DFHACK_WANT_MISCUTILS
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
/* Note about magic numbers: /* Note about magic numbers:
* If you have an idea how to better solve this, tell me. Currently I'd be * If you have an idea how to better solve this, tell me. Currently I'd be

@ -9,7 +9,7 @@ using namespace std;
#define DFHACK_WANT_MISCUTILS #define DFHACK_WANT_MISCUTILS
#include <DFHack.h> #include <DFHack.h>
#include <dfhack/modules/Materials.h> #include <dfhack/modules/Materials.h>
#include <dfhack/modules/Creatures.h> #include <dfhack/modules/Units.h>
#include <dfhack/modules/Translation.h> #include <dfhack/modules/Translation.h>
vector< vector<string> > englishWords; vector< vector<string> > englishWords;