MCPcopy Create free account
hub / github.com/assaultcube/AC / FloodThink

Method FloodThink

source/src/bot/bot_waypoint.cpp:1275–1404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1273}
1274
1275void CWaypointClass::FloodThink()
1276{
1277 if (!m_bFlooding) return;
1278
1279 static int x, y, count;
1280 count = 0;
1281
1282 if (!m_bFilteringNodes)
1283 {
1284 // loop through ALL cubes and check if we should add a waypoint here
1285 for (x=m_iCurFloodX; x<(ssize-MINBORD); x+=4)
1286 {
1287 if (count >= 3)
1288 {
1289 AddScreenText("Flooding map with waypoints... %.2f %%",
1290 ((float)x / float(ssize-MINBORD)) * 100.0f);
1291 m_iCurFloodX = x;
1292 return;
1293 }
1294
1295 count++;
1296
1297 for (y=MINBORD; y<(ssize-MINBORD); y+=4)
1298 {
1299 vec from(x, y, GetCubeFloor(x, y)+2.0f);
1300 bool bFound = CanPlaceNodeHere(from);
1301
1302 if (!bFound)
1303 {
1304 for (int a=x-2;a<=(x+2);a++)
1305 {
1306 for (int b=y-2;b<=(y+2);b++)
1307 {
1308 if (OUTBORD(a, b)) continue;
1309 if ((a==x) && (b==y)) continue;
1310 makevec(&from, a, b, GetCubeFloor(a, b) + 2.0f);
1311 if (CanPlaceNodeHere(from))
1312 {
1313 bFound = true;
1314 break;
1315 }
1316 }
1317
1318 if (bFound) break;
1319 }
1320 }
1321
1322 if (!bFound) continue;
1323
1324 // Add WP
1325 int flags = W_FL_FLOOD;
1326 if (S((int)from.x, (int)from.y)->tag) flags |= W_FL_INTAG;
1327
1328 node_s *pWP = new node_s(from, flags, 0);
1329
1330 short i, j;
1331 GetNodeIndexes(from, &i, &j);
1332 m_Waypoints[i][j].PushNode(pWP);

Callers

nothing calls this directly

Calls 12

AddScreenTextFunction · 0.85
GetCubeFloorFunction · 0.85
makevecFunction · 0.85
PushNodeMethod · 0.80
DelWaypointMethod · 0.80
PickNextTriggerMethod · 0.80
conoutfFunction · 0.50
AddWaypointMethod · 0.45
GetFirstMethod · 0.45
EmptyMethod · 0.45
DeleteNodeMethod · 0.45

Tested by

no test coverage detected