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

Function GetRandomObjectPosition

Source/objects.cpp:396–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396std::optional<Point> GetRandomObjectPosition(Displacement standoff)
397{
398 for (int i = 0; i <= 20000; i++) {
399 Point position = Point { GenerateRnd(80), GenerateRnd(80) } + Displacement { 16, 16 };
400 if (CanPlaceRandomObject(position, standoff))
401 return position;
402 }
403 return {};
404}
405
406void InitRndLocObj5x5(int min, int max, _object_id objtype)
407{

Callers 4

InitRndLocObj5x5Function · 0.85
AddBookLeverFunction · 0.85
AddCryptStoryBookFunction · 0.85
AddStoryBooksFunction · 0.85

Calls 2

GenerateRndFunction · 0.85
CanPlaceRandomObjectFunction · 0.85

Tested by

no test coverage detected