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

Function GetRndObjLoc

Source/objects.cpp:1517–1541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1515}
1516
1517Point GetRndObjLoc(int randarea)
1518{
1519 if (randarea == 0)
1520 return { 0, 0 };
1521
1522 int tries = 0;
1523 int x;
1524 int y;
1525 while (true) {
1526 tries++;
1527 if (tries > 1000 && randarea > 1)
1528 randarea--;
1529 x = GenerateRnd(MAXDUNX);
1530 y = GenerateRnd(MAXDUNY);
1531 bool failed = false;
1532 for (int i = 0; i < randarea && !failed; i++) {
1533 for (int j = 0; j < randarea && !failed; j++) {
1534 failed = !RndLocOk(i + x, j + y);
1535 }
1536 }
1537 if (!failed)
1538 break;
1539 }
1540 return { x, y };
1541}
1542
1543void AddMushPatch()
1544{

Callers 2

AddMushPatchFunction · 0.85
AddSlainHeroFunction · 0.85

Calls 2

GenerateRndFunction · 0.85
RndLocOkFunction · 0.85

Tested by

no test coverage detected