Skip to content

Commit

Permalink
Fix: #389
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed Oct 25, 2018
1 parent d7a5e9c commit 53fcca0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
3 changes: 1 addition & 2 deletions path_7_x/sources/player.cpp
Expand Up @@ -828,8 +828,7 @@ bool Player::canWalkthrough(const Creature* creature) const

if(((g_game.getWorldType() == WORLDTYPE_OPTIONAL &&
!player->isProtected()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || player->isProtected()) && player->getTile()->ground
&& Item::items[player->getTile()->ground->getID()].walkStack && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
|| player->getAccess() <= getAccess()))
&& (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges) || player->getAccess() <= getAccess()))
return true;

return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
Expand Down
31 changes: 13 additions & 18 deletions path_7_x/sources/tile.cpp
Expand Up @@ -389,7 +389,7 @@ void Tile::onUpdateTileItem(Item* oldItem, const ItemType& oldType, Item* newIte
(*it)->onUpdateTileItem(this, pos, oldItem, oldType, newItem, newType);
}

void Tile::onRemoveTileItem(const SpectatorVec& list, std::vector<uint32_t>& oldStackposVector, Item* item)
void Tile::onRemoveTileItem(const SpectatorVec& list, std::vector<int32_t>& oldStackposVector, Item* item)
{
updateTileFlags(item, true);
const ItemType& iType = Item::items[item->getID()];
Expand Down Expand Up @@ -441,7 +441,7 @@ void Tile::moveCreature(Creature* actor, Creature* creature, Cylinder* toCylinde
if(forceTeleport || !newTile->ground || !Position::areInRange<1,1,0>(pos, newPos))
teleport = true;

std::vector<uint32_t> oldStackposVector;
std::vector<int32_t> oldStackposVector;
Player* tmpPlayer = NULL;
for(it = list.begin(); it != list.end(); ++it)
{
Expand Down Expand Up @@ -538,7 +538,7 @@ ReturnValue Tile::__queryAdd(int32_t, const Thing* thing, uint32_t,
for(CreatureVector::const_iterator cit = creatures->begin(); cit != creatures->end(); ++cit)
{
if(!creature->canWalkthrough(*cit))
return RET_NOTPOSSIBLE; //NOTPOSSIBLE
return RET_NOTENOUGHROOM; //NOTPOSSIBLE
}
}

Expand Down Expand Up @@ -854,7 +854,7 @@ Cylinder* Tile::__queryDestination(int32_t&, const Thing*, Item** destItem,

if(destTile)
{
if(Item* item = destTile->getTopTopItem())
if(Item* item = destTile->getTopDownItem())
*destItem = item;
}

Expand All @@ -869,7 +869,7 @@ void Tile::__addThing(Creature* actor, int32_t, Thing* thing)
creature->setParent(this);

CreatureVector* creatures = makeCreatures();
creatures->insert(creatures->end(), creature);
creatures->insert(creatures->begin(), creature);

++thingCount;
return;
Expand Down Expand Up @@ -1221,7 +1221,7 @@ void Tile::__removeThing(Thing* thing, uint32_t count)
if(item == ground)
{
const SpectatorVec& list = g_game.getSpectators(pos);
std::vector<uint32_t> oldStackposVector;
std::vector<int32_t> oldStackposVector;

Player* tmpPlayer = NULL;
for(SpectatorVec::const_iterator it = list.begin(); it != list.end(); ++it)
Expand Down Expand Up @@ -1267,7 +1267,7 @@ void Tile::__removeThing(Thing* thing, uint32_t count)
if(it != items->end())
{
const SpectatorVec& list = g_game.getSpectators(pos);
std::vector<uint32_t> oldStackposVector;
std::vector<int32_t> oldStackposVector;

Player* tmpPlayer = NULL;
for(SpectatorVec::const_iterator iit = list.begin(); iit != list.end(); ++iit)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ void Tile::__removeThing(Thing* thing, uint32_t count)
else
{
const SpectatorVec& list = g_game.getSpectators(pos);
std::vector<uint32_t> oldStackposVector;
std::vector<int32_t> oldStackposVector;

Player* tmpPlayer = NULL;
for(SpectatorVec::const_iterator iit = list.begin(); iit != list.end(); ++iit)
Expand Down Expand Up @@ -1380,17 +1380,12 @@ int32_t Tile::__getIndexOfThing(const Thing* thing) const

if(const CreatureVector* creatures = getCreatures())
{
if(thing->getCreature())
for(CreatureVector::const_iterator cit = creatures->begin(); cit != creatures->end(); ++cit)
{
for(CreatureVector::const_iterator cit = creatures->begin(); cit != creatures->end(); ++cit)
{
++n;
if((*cit) == thing)
return n;
}
++n;
if((*cit) == thing)
return n;
}
else
n += creatures->size();
}

if(items)
Expand Down Expand Up @@ -1562,7 +1557,7 @@ void Tile::__internalAddThing(uint32_t, Thing* thing)
{
g_game.clearSpectatorCache();
CreatureVector* creatures = makeCreatures();
creatures->insert(creatures->end(), creature);
creatures->insert(creatures->begin(), creature);

++thingCount;
return;
Expand Down
2 changes: 1 addition & 1 deletion path_7_x/sources/tile.h
Expand Up @@ -293,7 +293,7 @@ class Tile : public Cylinder
private:
void onAddTileItem(Item* item);
void onUpdateTileItem(Item* oldItem, const ItemType& oldType, Item* newItem, const ItemType& newType);
void onRemoveTileItem(const SpectatorVec& list, std::vector<uint32_t>& oldStackPosVector, Item* item);
void onRemoveTileItem(const SpectatorVec& list, std::vector<int32_t>& oldStackPosVector, Item* item);

protected:
bool isDynamic() const {return (m_flags & TILESTATE_DYNAMIC_TILE) != 0;}
Expand Down

0 comments on commit 53fcca0

Please sign in to comment.