_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "ai_local.h"
#include "map.h"
#include "pathfinder.h"
#include "player.h"
#include "tileset.h"
#include "unit.h"
#include "unit_find.h"
#include "unittype.h"
Classes | |
class | BuildingPlaceFinder |
class | HallPlaceFinder |
class | LumberMillPlaceFinder |
Functions | |
ai_building.cpp - AI building functions. | |
static bool | IsPosFree (const Vec2i &pos, const CUnit &exceptionUnit) |
static bool | AiCheckSurrounding (const CUnit &worker, const CUnitType &type, const Vec2i &pos, bool &backupok) |
static bool | AiFindBuildingPlace2 (const CUnit &worker, const CUnitType &type, const Vec2i &startPos, const CUnit *startUnit, bool checkSurround, Vec2i *resultPos) |
static bool | AiFindHallPlace (const CUnit &worker, const CUnitType &type, const Vec2i &startPos, int resource, Vec2i *resultPos) |
static bool | AiFindLumberMillPlace (const CUnit &worker, const CUnitType &type, const Vec2i &startPos, int resource, Vec2i *resultPos) |
static bool | AiFindMiningPlace (const CUnit &worker, const CUnitType &type, const Vec2i &startPos, int resource, Vec2i *resultPos) |
bool | AiFindBuildingPlace (const CUnit &worker, const CUnitType &type, const Vec2i &nearPos, Vec2i *resultPos) |
Find nice building place. More... | |
|
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. |
pos | map tile position for the building. |
backupok | Location can be used as a backup |
bool AiFindBuildingPlace | ( | const CUnit & | worker, |
const CUnitType & | type, | ||
const Vec2i & | nearPos, | ||
Vec2i * | resultPos | ||
) |
Find nice building place.
Find free building place.
worker | Worker to build building. |
type | Type of building. |
nearPos | Start search near nearPos position (or worker->X if nearPos is invalid). |
resultPos | Pointer for position returned. |
|
static |
Find free building place. (flood fill version)
worker | Worker to build building. |
type | Type of building. |
startPos | Original position to try building |
checkSurround | Check if the perimeter of the building is free |
resultPos | OUT: Pointer for position returned. |
|
static |
Find building place for hall. (flood fill version)
The best place: 1) near to resource. !2) near to wood. !3) near to worker and must be reachable. 4) no enemy near it. 5) no hall already near !6) enough gold in mine
worker | Worker to build building. |
type | Type of building. |
startPos | Start search position (if == -1 then unit X pos used). |
resource | resource to be near. |
resultPos | OUT: Pointer for position returned. |
|
static |
Find free building place for lumber mill. (flood fill version)
worker | Worker to build building. |
type | Type of building. |
resource | resource terrain to be near. |
startPos | Start search X position (if == -1 then unit X pos used). |
resultPos | OUT: Pointer for position returned. |
|
static |