Permalink
Browse files

Fix creature owned items vector offset on Windows, added support for …

…owned items to more versions.
  • Loading branch information...
1 parent 6e00dc4 commit da2fb1cb1adb9f4d8f36e6b6e263c7fec6aad2ee @peterix peterix committed May 28, 2011
Showing with 20 additions and 6 deletions.
  1. +1 −1 CMake/Modules/FindCurses.cmake
  2. +8 −4 Memory.xml
  3. +5 −1 library/modules/Creatures.cpp
  4. +6 −0 library/modules/Items.cpp
View
2 CMake/Modules/FindCurses.cmake
@@ -5,7 +5,7 @@ ENDIF()
FIND_PATH(Curses_INCLUDE_PATH
NAMES ncurses.h curses.h
PATH_SUFFIXES ncurses
- PATHS /usr/include /usr/local/include /usr/pkg/include
+ PATHS /usr/include/ncursesw /usr/include /usr/local/include /usr/pkg/include
)
FIND_LIBRARY(Curses_LIBRARY
View
12 Memory.xml
@@ -2010,6 +2010,7 @@
<Offset name="birth_year" value="0x224" />
<Offset name="birth_time" value="0x228" />
<Offset name="inventory_vector" value="0x288" />
+ <Offset name="owned_items_vector" value="0x298"/>
<Offset name="current_job" value="0x2f4" />
<Offset name="current_job_skill" value="0x2f8" /> THIS IS TOTAL BS
<Offset name="physical" value="0x3cc" /> DT: 0x3C4, I don't believe that's OK'
@@ -2243,6 +2244,11 @@
<PETimeStamp value="0x4D90764F" />
<MD5 value="6ada05fc94785b53efe6aa5728b3756b" />
<Offsets>
+ <Group name="Creatures">
+ <Group name="creature">
+ <Offset name="flags3" value="0xE8"/>
+ </Group>
+ </Group>
<Group name="Items" valid="true">
<Address name="items_vector" value="0x16c4540"/>
<Offset name="id" value="0x14"/>
@@ -2880,6 +2886,7 @@
<Offset name="birth_year" value="0x1A0" />
<Offset name="birth_time" value="0x1A4" />
<Offset name="inventory_vector" value="0x204" />
+ <Offset name="owned_items_vector" value="0x210"/>
<Offset name="current_job" value="0x25C" />
<Offset name="current_job_skill" value="0x260" />
<Offset name="physical" value="0x310" />
@@ -2889,6 +2896,7 @@
<Offset name="current_soul" value="0x53C" />
<Offset name="labors" value="0x54C" />
<Offset name="happiness" value="0x05dc" />
+ <Offset name="hist_figure_id" value="0x640"/>
</Group>
</Group>
<Group name="job">
@@ -3021,10 +3029,6 @@
Address name="vector" value="0x0940b174"
<Group name="creature">
<Offset name="flags3" value="0x94"/>
- <Group name="advanced">
- <Offset name="owned_items_vector" value="0x210"/>
- <Offset name="hist_figure_id" value="0x640"/>
- </Group>
</Group>
</Group>
<Group name="Position" valid="true">
View
6 library/modules/Creatures.cpp
@@ -724,7 +724,11 @@ bool Creatures::ReadOwnedItemsPtr(const uint32_t temp, std::vector<int32_t> & it
bool Creatures::RemoveOwnedItemIdx(const uint32_t index, int32_t id)
{
- if(!d->Started || !d->Ft_owned_items) return false;
+ if(!d->Started || !d->Ft_owned_items)
+ {
+ cerr << "!d->Started || !d->Ft_owned_items FAIL" << endl;
+ return false;
+ }
uint32_t temp = d->p_cre->at (index);
return this->RemoveOwnedItemPtr(temp, id);
}
View
6 library/modules/Items.cpp
@@ -592,10 +592,16 @@ bool Items::removeItemOwner(dfh_item &item, Creatures *creatures)
int32_t ix = creatures->FindIndexById(oid);
if (ix < 0 || !creatures->RemoveOwnedItemIdx(ix, item.id))
+ {
+ cerr << "RemoveOwnedItemIdx: CREATURE " << ix << " ID " << item.id << " FAILED!" << endl;
return false;
+ }
if (!p_refs.remove(i--))
+ {
+ cerr << "p_refs.remove FAILED!" << endl;
return false;
+ }
}
item.base.flags.owned = 0;

0 comments on commit da2fb1c

Please sign in to comment.