Fix creature owned items vector offset on Windows, added support for owned items to more versions.

develop
Petr Mrázek 2011-05-28 10:18:50 +02:00
parent 6e00dc4c8e
commit da2fb1cb1a
4 changed files with 20 additions and 6 deletions

@ -5,7 +5,7 @@ ENDIF()
FIND_PATH(Curses_INCLUDE_PATH FIND_PATH(Curses_INCLUDE_PATH
NAMES ncurses.h curses.h NAMES ncurses.h curses.h
PATH_SUFFIXES ncurses 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 FIND_LIBRARY(Curses_LIBRARY

@ -2010,6 +2010,7 @@
<Offset name="birth_year" value="0x224" /> <Offset name="birth_year" value="0x224" />
<Offset name="birth_time" value="0x228" /> <Offset name="birth_time" value="0x228" />
<Offset name="inventory_vector" value="0x288" /> <Offset name="inventory_vector" value="0x288" />
<Offset name="owned_items_vector" value="0x298"/>
<Offset name="current_job" value="0x2f4" /> <Offset name="current_job" value="0x2f4" />
<Offset name="current_job_skill" value="0x2f8" /> THIS IS TOTAL BS <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' <Offset name="physical" value="0x3cc" /> DT: 0x3C4, I don't believe that's OK'
@ -2243,6 +2244,11 @@
<PETimeStamp value="0x4D90764F" /> <PETimeStamp value="0x4D90764F" />
<MD5 value="6ada05fc94785b53efe6aa5728b3756b" /> <MD5 value="6ada05fc94785b53efe6aa5728b3756b" />
<Offsets> <Offsets>
<Group name="Creatures">
<Group name="creature">
<Offset name="flags3" value="0xE8"/>
</Group>
</Group>
<Group name="Items" valid="true"> <Group name="Items" valid="true">
<Address name="items_vector" value="0x16c4540"/> <Address name="items_vector" value="0x16c4540"/>
<Offset name="id" value="0x14"/> <Offset name="id" value="0x14"/>
@ -2880,6 +2886,7 @@
<Offset name="birth_year" value="0x1A0" /> <Offset name="birth_year" value="0x1A0" />
<Offset name="birth_time" value="0x1A4" /> <Offset name="birth_time" value="0x1A4" />
<Offset name="inventory_vector" value="0x204" /> <Offset name="inventory_vector" value="0x204" />
<Offset name="owned_items_vector" value="0x210"/>
<Offset name="current_job" value="0x25C" /> <Offset name="current_job" value="0x25C" />
<Offset name="current_job_skill" value="0x260" /> <Offset name="current_job_skill" value="0x260" />
<Offset name="physical" value="0x310" /> <Offset name="physical" value="0x310" />
@ -2889,6 +2896,7 @@
<Offset name="current_soul" value="0x53C" /> <Offset name="current_soul" value="0x53C" />
<Offset name="labors" value="0x54C" /> <Offset name="labors" value="0x54C" />
<Offset name="happiness" value="0x05dc" /> <Offset name="happiness" value="0x05dc" />
<Offset name="hist_figure_id" value="0x640"/>
</Group> </Group>
</Group> </Group>
<Group name="job"> <Group name="job">
@ -3021,10 +3029,6 @@
Address name="vector" value="0x0940b174" Address name="vector" value="0x0940b174"
<Group name="creature"> <Group name="creature">
<Offset name="flags3" value="0x94"/> <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> </Group>
<Group name="Position" valid="true"> <Group name="Position" valid="true">

@ -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) 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); uint32_t temp = d->p_cre->at (index);
return this->RemoveOwnedItemPtr(temp, id); return this->RemoveOwnedItemPtr(temp, id);
} }

@ -592,11 +592,17 @@ bool Items::removeItemOwner(dfh_item &item, Creatures *creatures)
int32_t ix = creatures->FindIndexById(oid); int32_t ix = creatures->FindIndexById(oid);
if (ix < 0 || !creatures->RemoveOwnedItemIdx(ix, item.id)) if (ix < 0 || !creatures->RemoveOwnedItemIdx(ix, item.id))
{
cerr << "RemoveOwnedItemIdx: CREATURE " << ix << " ID " << item.id << " FAILED!" << endl;
return false; return false;
}
if (!p_refs.remove(i--)) if (!p_refs.remove(i--))
{
cerr << "p_refs.remove FAILED!" << endl;
return false; return false;
} }
}
item.base.flags.owned = 0; item.base.flags.owned = 0;