Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed clone depot items #460

Merged
merged 3 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3529,7 +3529,7 @@ void Player::removeThing(Thing* thing, uint32_t count)
}
}

uint8_t Player::getThingIndex(const Thing* thing) const
int32_t Player::getThingIndex(const Thing* thing) const
{
for (uint8_t i = CONST_SLOT_FIRST; i <= CONST_SLOT_LAST; ++i) {
if (inventory[i] == thing) {
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/players/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ class Player final : public Creature, public Cylinder

void removeThing(Thing* thing, uint32_t count) override;

uint8_t getThingIndex(const Thing* thing) const override;
int32_t getThingIndex(const Thing* thing) const override;
size_t getFirstIndex() const override;
size_t getLastIndex() const override;
uint32_t getItemTypeCount(uint16_t itemId, int32_t subType = -1) const override;
Expand Down
4 changes: 2 additions & 2 deletions src/items/containers/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,9 @@ void Container::removeThing(Thing* thing, uint32_t count)
}
}

uint8_t Container::getThingIndex(const Thing* thing) const
int32_t Container::getThingIndex(const Thing* thing) const
{
uint8_t index = 0;
int32_t index = 0;
for (Item* item : itemlist) {
if (item == thing) {
return index;
Expand Down
2 changes: 1 addition & 1 deletion src/items/containers/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class Container : public Item, public Cylinder

void removeThing(Thing* thing, uint32_t count) override final;

uint8_t getThingIndex(const Thing* thing) const override final;
int32_t getThingIndex(const Thing* thing) const override final;
size_t getFirstIndex() const override final;
size_t getLastIndex() const override final;
uint32_t getItemTypeCount(uint16_t itemId, int32_t subType = -1) const override final;
Expand Down
2 changes: 1 addition & 1 deletion src/items/cylinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

VirtualCylinder* VirtualCylinder::virtualCylinder = new VirtualCylinder;

uint8_t Cylinder::getThingIndex(const Thing*) const
int32_t Cylinder::getThingIndex(const Thing*) const
{
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/items/cylinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Cylinder : virtual public Thing
* \param thing the object to get the index value from
* \returns the index of the object, returns -1 if not found
*/
virtual uint8_t getThingIndex(const Thing* thing) const;
virtual int32_t getThingIndex(const Thing* thing) const;

/**
* Returns the first index
Expand Down
4 changes: 2 additions & 2 deletions src/items/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,9 @@ void Tile::removeCreature(Creature* creature)
removeThing(creature, 0);
}

uint8_t Tile::getThingIndex(const Thing* thing) const
int32_t Tile::getThingIndex(const Thing* thing) const
{
uint8_t n = -1;
int32_t n = -1;
if (ground) {
if (ground == thing) {
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/items/tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class Tile : public Cylinder

void removeCreature(Creature* creature);

uint8_t getThingIndex(const Thing* thing) const override final;
int32_t getThingIndex(const Thing* thing) const override final;
size_t getFirstIndex() const override final;
size_t getLastIndex() const override final;
uint32_t getItemTypeCount(uint16_t itemId, int32_t subType = -1) const override final;
Expand Down