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

Function DL2_FillVoids

Source/drlg_l2.cpp:1103–1373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101}
1102
1103static BOOL DL2_FillVoids()
1104{
1105 int ii, jj, xx, yy, x1, x2, y1, y2;
1106 BOOL xf1, xf2, yf1, yf2;
1107 int to;
1108
1109 to = 0;
1110 while (DL2_NumNoChar() > 700 && to < 100) {
1111 xx = random_(0, 38) + 1;
1112 yy = random_(0, 38) + 1;
1113 if (predungeon[xx][yy] != 35) {
1114 continue;
1115 }
1116 xf1 = xf2 = yf1 = yf2 = FALSE;
1117 if (predungeon[xx - 1][yy] == 32 && predungeon[xx + 1][yy] == 46) {
1118 if (predungeon[xx + 1][yy - 1] == 46
1119 && predungeon[xx + 1][yy + 1] == 46
1120 && predungeon[xx - 1][yy - 1] == 32
1121 && predungeon[xx - 1][yy + 1] == 32) {
1122 xf1 = yf1 = yf2 = TRUE;
1123 }
1124 } else if (predungeon[xx + 1][yy] == 32 && predungeon[xx - 1][yy] == 46) {
1125 if (predungeon[xx - 1][yy - 1] == 46
1126 && predungeon[xx - 1][yy + 1] == 46
1127 && predungeon[xx + 1][yy - 1] == 32
1128 && predungeon[xx + 1][yy + 1] == 32) {
1129 xf2 = yf1 = yf2 = TRUE;
1130 }
1131 } else if (predungeon[xx][yy - 1] == 32 && predungeon[xx][yy + 1] == 46) {
1132 if (predungeon[xx - 1][yy + 1] == 46
1133 && predungeon[xx + 1][yy + 1] == 46
1134 && predungeon[xx - 1][yy - 1] == 32
1135 && predungeon[xx + 1][yy - 1] == 32) {
1136 yf1 = xf1 = xf2 = TRUE;
1137 }
1138 } else if (predungeon[xx][yy + 1] == 32 && predungeon[xx][yy - 1] == 46) {
1139 if (predungeon[xx - 1][yy - 1] == 46
1140 && predungeon[xx + 1][yy - 1] == 46
1141 && predungeon[xx - 1][yy + 1] == 32
1142 && predungeon[xx + 1][yy + 1] == 32) {
1143 yf2 = xf1 = xf2 = TRUE;
1144 }
1145 }
1146 if (DL2_Cont(xf1, yf1, xf2, yf2)) {
1147 if (xf1) {
1148 x1 = xx - 1;
1149 } else {
1150 x1 = xx;
1151 }
1152 if (xf2) {
1153 x2 = xx + 1;
1154 } else {
1155 x2 = xx;
1156 }
1157 if (yf1) {
1158 y1 = yy - 1;
1159 } else {
1160 y1 = yy;

Callers 1

CreateDungeonFunction · 0.85

Calls 5

DL2_NumNoCharFunction · 0.85
random_Function · 0.85
DL2_ContFunction · 0.85
DL2_DrawRoomFunction · 0.85
DL2_KnockWallsFunction · 0.85

Tested by

no test coverage detected