MCPcopy Create free account
hub / github.com/diasurgical/devilution / AddLazStand

Function AddLazStand

Source/objects.cpp:705–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

703}
704
705void AddLazStand()
706{
707 int xp, yp, xx, yy;
708 int cnt;
709 BOOL found;
710
711 cnt = 0;
712 while (TRUE) {
713 found = 1;
714 xp = random_(139, 80) + 16;
715 yp = random_(139, 80) + 16;
716 for (yy = -3; yy <= 3; yy++) {
717 for (xx = -2; xx <= 3; xx++) {
718 if (!RndLocOk(xp + xx, yp + yy))
719 found = FALSE;
720 }
721 }
722 if (found)
723 break;
724
725 cnt++;
726 if (cnt > 10000) {
727 InitRndLocObj(1, 1, OBJ_LAZSTAND);
728 return;
729 }
730 }
731 AddObject(OBJ_LAZSTAND, xp, yp);
732 AddObject(OBJ_TNUDEM2, xp, yp + 2);
733 AddObject(OBJ_STORYCANDLE, xp + 1, yp + 2);
734 AddObject(OBJ_TNUDEM3, xp + 2, yp + 2);
735 AddObject(OBJ_TNUDEW1, xp, yp - 2);
736 AddObject(OBJ_STORYCANDLE, xp + 1, yp - 2);
737 AddObject(OBJ_TNUDEW2, xp + 2, yp - 2);
738 AddObject(OBJ_STORYCANDLE, xp - 1, yp - 1);
739 AddObject(OBJ_TNUDEW3, xp - 1, yp);
740 AddObject(OBJ_STORYCANDLE, xp - 1, yp + 1);
741}
742
743void InitObjects()
744{

Callers 1

InitObjectsFunction · 0.85

Calls 4

random_Function · 0.85
RndLocOkFunction · 0.85
InitRndLocObjFunction · 0.85
AddObjectFunction · 0.85

Tested by

no test coverage detected