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

Limit pickup events to half a tile height differences #3625

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all 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
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
Loading