diff --git a/library/include/dfhack/modules/Items.h b/library/include/dfhack/modules/Items.h index 3810e6037..8940b6c95 100644 --- a/library/include/dfhack/modules/Items.h +++ b/library/include/dfhack/modules/Items.h @@ -1,10 +1,6 @@ #ifndef CL_MOD_ITEMS #define CL_MOD_ITEMS -/* - * DEPRECATED, DO NOT USE UNTIL FURTHER NOTICE! - **/ - /* * Creatures */ diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index 265677c8d..c381184d8 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -262,8 +262,17 @@ Items::Items(DFContextShared * d_) d->d = d_; d->owner = d_->p; } -bool Items::Start(){return true;} -bool Items::Finish(){return true;} + +bool Items::Start() +{ + return true; +} + +bool Items::Finish() +{ + return true; +} + Items::~Items() { Finish(); @@ -285,10 +294,10 @@ bool Items::getItemData(uint32_t itemptr, DFHack::t_item &item) Process * p = d->owner; ItemDesc * desc; - it = d->descVTable.find(itemptr); - if(it==d->descVTable.end()) + uint32_t vtable = p->readDWord(itemptr); + it = d->descVTable.find(vtable); + if(it == d->descVTable.end()) { - uint32_t vtable = p->readDWord(itemptr); desc = new ItemDesc(vtable, p); d->descVTable[vtable] = desc; d->descType[desc->mainType] = desc; @@ -305,7 +314,7 @@ std::string Items::getItemClass(int32_t index) std::string out; it = d->descType.find(index); - if(it==d->descType.end()) + if(it == d->descType.end()) { /* these are dummy values for mood decoding */ switch(index) diff --git a/tools/examples/dfitemdump.cpp b/tools/examples/dfitemdump.cpp index eff18dcdb..7633a243a 100644 --- a/tools/examples/dfitemdump.cpp +++ b/tools/examples/dfitemdump.cpp @@ -2,6 +2,12 @@ * dumps vtables, items types and class name for all items in game * best used this way : ./dfitemdump | sort -ug */ + +// THIS IS NOT A GOOD EXAMPLE! +// ... just look at all the magic numbers. +// I'm not fixing it though. +// ~px + #include #include #include diff --git a/tools/supported/vdig.cpp b/tools/supported/vdig.cpp index 80cab23e7..07e17cc3d 100644 --- a/tools/supported/vdig.cpp +++ b/tools/supported/vdig.cpp @@ -16,12 +16,7 @@ using namespace std; class Point { public: - Point(uint32_t x, uint32_t y, uint32_t z) - { - this->x = x; - this->y = y; - this->z = z; - } + Point(uint32_t _x, uint32_t _y, uint32_t _z):x(_x),y(_y),z(_z) {} Point() { x = y = z = 0;