| 1313 | return ok; |
| 1314 | } |
| 1315 | |
| 1316 | bool World::CheckVehicleStructure() const |
| 1317 | { |
| 1318 | bool ok = true; |
| 1319 | for (int i = 0; i < NVehicles(); i++) |
| 1320 | { |
| 1321 | Entity* vehicle = GetVehicle(i); |
| 1322 | EntityAI* veh = dyn_cast<EntityAI>(vehicle); |
| 1323 | AIUnit* unit = veh->CommanderUnit(); |
| 1324 | if (unit) |
| 1325 | { |
| 1326 | if (!unit->AssertValid()) |
| 1327 | { |
| 1328 | ok = false; |
| 1329 | } |
| 1330 | } |
| 1331 | unit = veh->PilotUnit(); |
| 1332 | if (unit) |
| 1333 | { |
| 1334 | if (!unit->AssertValid()) |
| 1335 | { |
| 1336 | ok = false; |
| 1337 | } |
| 1338 | } |
| 1339 | unit = veh->GunnerUnit(); |
| 1340 | if (unit) |
| 1341 | { |
| 1342 | if (!unit->AssertValid()) |
| 1343 | { |
| 1344 | ok = false; |
| 1345 | } |
| 1346 | } |
| 1347 | } |
| 1348 | for (int i = 0; i < NOutVehicles(); i++) |
| 1349 | { |
| 1350 | Entity* vehicle = GetOutVehicle(i); |
| 1351 | EntityAI* veh = dyn_cast<EntityAI>(vehicle); |
| 1352 | AIUnit* unit = veh->CommanderUnit(); |
| 1353 | if (unit) |
| 1354 | { |
| 1355 | if (!unit->AssertValid()) |
| 1356 | { |
| 1357 | ok = false; |
| 1358 | } |
| 1359 | } |
| 1360 | unit = veh->PilotUnit(); |
| 1361 | if (unit) |
| 1362 | { |
| 1363 | if (!unit->AssertValid()) |
| 1364 | { |
| 1365 | ok = false; |
| 1366 | } |
| 1367 | } |
| 1368 | unit = veh->GunnerUnit(); |
| 1369 | if (unit) |
| 1370 | { |
| 1371 | if (!unit->AssertValid()) |
| 1372 | { |
no test coverage detected