MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / GetItemPosition

Function GetItemPosition

Source/msg.cpp:297–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297Point GetItemPosition(Point position)
298{
299 if (CanPut(position))
300 return position;
301
302 for (int k = 1; k < 50; k++) {
303 for (int j = -k; j <= k; j++) {
304 int yy = position.y + j;
305 for (int l = -k; l <= k; l++) {
306 int xx = position.x + l;
307 if (CanPut({ xx, yy }))
308 return { xx, yy };
309 }
310 }
311 }
312
313 return position;
314}
315
316/**
317 * @brief Throttles that a player command is only sent once per game tick.

Callers 2

SyncDropItemFunction · 0.85
DeltaLoadLevelFunction · 0.85

Calls 1

CanPutFunction · 0.85

Tested by

no test coverage detected