Skip to content

Commit

Permalink
Limit pickup events to half a tile height differences
Browse files Browse the repository at this point in the history
  • Loading branch information
KJeff01 committed Feb 12, 2024
1 parent 9426f09 commit 17f6300
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ static void checkLocalFeatures(DROID *psDroid)

// scan the neighbours
#define DROIDDIST ((TILE_UNITS*5)/2)
constexpr int MAX_PICKUP_DISTANCE = (TILE_UNITS / 2);
static GridList gridList; // static to avoid allocations.
gridList = gridStartIterate(psDroid->pos.x, psDroid->pos.y, DROIDDIST);
for (GridIterator gi = gridList.begin(); gi != gridList.end(); ++gi)
Expand All @@ -2035,6 +2036,11 @@ static void checkLocalFeatures(DROID *psDroid)

if (psObj->type == OBJ_FEATURE && !psObj->died)
{
if (std::abs(psDroid->pos.z - psObj->pos.z) > MAX_PICKUP_DISTANCE)
{
continue; // Don't pickup if height difference is more than half of a tile.
}

switch (((FEATURE *)psObj)->psStats->subType)
{
case FEAT_OIL_DRUM:
Expand Down

0 comments on commit 17f6300

Please sign in to comment.