____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include <stdio.h>
#include <stdlib.h>
#include "stratagus.h"
#include "unit.h"
#include "unittype.h"
#include "map.h"
#include "pathfinder.h"
#include "ai_local.h"
#include "player.h"
Go to the source code of this file.
Functions | |
| static int | AiCheckSurrounding (const CUnit *worker, const CUnitType *type, int x, int y, bool &backupok) |
| static int | AiFindBuildingPlace2 (const CUnit *worker, const CUnitType *type, int ox, int oy, int *dx, int *dy) |
| int | AiFindBuildingPlace (const CUnit *worker, const CUnitType *type, int *dx, int *dy) |
| < Find nice building place | |
Definition in file ai_building.cpp.
| static int AiCheckSurrounding | ( | const CUnit * | worker, | |
| const CUnitType * | type, | |||
| int | x, | |||
| int | y, | |||
| bool & | backupok | |||
| ) | [static] |
Check if the surrounding are free. Depending on the value of flag, it will check : 0: the building will not block any way 1: all surrounding is free
| worker | Worker to build. | |
| type | Type of building. | |
| x | X map tile position for the building. | |
| y | Y map tile position for the building. | |
| backupok | Location can be used as a backup |
Definition at line 69 of file ai_building.cpp.
References CMap::Field(), CMapField::Flags, CMap::Info, Map, MapFieldBuilding, MapFieldCoastAllowed, MapFieldLandAllowed, MapFieldUnpassable, MapFieldWaterAllowed, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitType::ShoreBuilding, CUnitType::TileWidth, CUnit::X, and CUnit::Y.
Referenced by AiFindBuildingPlace2().
< Find nice building place
Find free building place.
| worker | Worker to build building. | |
| type | Type of building. | |
| dx | Pointer for X position returned. | |
| dy | Pointer for Y position returned. |
Definition at line 298 of file ai_building.cpp.
References _C_, AiFindBuildingPlace2(), DebugPrint, CUnitType::Ident, CUnitType::Name, CUnit::X, and CUnit::Y.
Referenced by AiBuildBuilding().
| static int AiFindBuildingPlace2 | ( | const CUnit * | worker, | |
| const CUnitType * | type, | |||
| int | ox, | |||
| int | oy, | |||
| int * | dx, | |||
| int * | dy | |||
| ) | [static] |
Find free building place. (flood fill version)
| worker | Worker to build building. | |
| type | Type of building. | |
| ox | Original X position to try building | |
| oy | Original Y position to try building | |
| dx | Pointer for X position returned. | |
| dy | Pointer for Y position returned. |
Definition at line 147 of file ai_building.cpp.
References AiCheckSurrounding(), AiEnemyUnitsInDistance(), CanBuildUnitType(), CanMoveToMask(), CreateMatrix(), CMap::Info, Map, MapFieldAirUnit, MapFieldLandUnit, MapFieldSeaUnit, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitType::MovementMask, CUnit::Player, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, and y.
Referenced by AiFindBuildingPlace().
1.5.6