$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#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"
Functions | |
ai_building.cpp - AI building 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, Vec2i *dpos, int surround) |
static int | AiFindHallPlace (const CUnit &worker, const CUnitType &type, int nx, int ny, Vec2i *dpos, int resource=GoldCost) |
static int | AiFindLumberMillPlace (const CUnit &worker, const CUnitType &type, int nx, int ny, Vec2i *dpos) |
static int | AiFindMiningPlace (const CUnit &worker, const CUnitType &type, int nx, int ny, Vec2i *dpos, int resource) |
int | AiFindBuildingPlace (const CUnit &worker, const CUnitType &type, int nx, int ny, Vec2i *dpos) |
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 |
int AiFindBuildingPlace | ( | const CUnit & | worker, | |
const CUnitType & | type, | |||
int | nx, | |||
int | ny, | |||
Vec2i * | dpos | |||
) |
Find free building place.
worker | Worker to build building. | |
type | Type of building. | |
nx | Start search near X position (or worker->X if nx == -1). | |
ny | Start search near Y position (or worker->Y if ny == -1). | |
dpos | Pointer for position returned. |
static int AiFindBuildingPlace2 | ( | const CUnit & | worker, | |
const CUnitType & | type, | |||
int | ox, | |||
int | oy, | |||
Vec2i * | dpos, | |||
int | surround | |||
) | [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 | |
dpos | Pointer for position returned. |
static int AiFindHallPlace | ( | const CUnit & | worker, | |
const CUnitType & | type, | |||
int | nx, | |||
int | ny, | |||
Vec2i * | dpos, | |||
int | resource = GoldCost | |||
) | [static] |
Find building place for hall. (flood fill version)
The best place: 1) near to goldmine. !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. | |
nx | Start search X position (if == -1 then unit X pos used). | |
ny | Start search Y position (if == -1 then unit Y pos used). | |
dpos | Pointer for position returned. |
static int AiFindLumberMillPlace | ( | const CUnit & | worker, | |
const CUnitType & | type, | |||
int | nx, | |||
int | ny, | |||
Vec2i * | dpos | |||
) | [static] |
Find free building place for lumber mill. (flood fill version)
worker | Worker to build building. | |
type | Type of building. | |
nx | Start search X position (if == -1 then unit X pos used). | |
ny | Start search X position (if == -1 then unit X pos used). | |
dpos | Pointer for position returned. |
static int AiFindMiningPlace | ( | const CUnit & | worker, | |
const CUnitType & | type, | |||
int | nx, | |||
int | ny, | |||
Vec2i * | dpos, | |||
int | resource | |||
) | [static] |