____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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 "missile.h"
#include "unittype.h"
#include "unit_cache.h"
#include "map.h"
#include "pathfinder.h"
#include "actions.h"
#include "ai_local.h"
#include "player.h"
Go to the source code of this file.
Functions | |
| static CUnit * | EnemyOnMapTile (const CUnit *source, int tx, int ty) |
| static void | AiMarkWaterTransporter (const CUnit *unit, unsigned char *matrix) |
| static int | AiFindTarget (const CUnit *unit, unsigned char *matrix, int *dx, int *dy, int *ds) |
| int | AiPlanAttack (AiForce *force) |
| < Plan the an attack | |
| void | AiSendExplorers (void) |
| Enemy units in distance. | |
Definition in file ai_plan.cpp.
| static int AiFindTarget | ( | const CUnit * | unit, | |
| unsigned char * | matrix, | |||
| int * | dx, | |||
| int * | dy, | |||
| int * | ds | |||
| ) | [static] |
Find possible targets.
| unit | Attack. | |
| matrix | Water matrix. | |
| dx | Attack point X. | |
| dy | Attack point Y. | |
| ds | Attack state. |
Definition at line 218 of file ai_plan.cpp.
References _C_, CanMoveToMask(), DebugPrint, EnemyOnMapTile(), CMap::Info, Map, MapFieldAirUnit, MapFieldLandUnit, MapFieldSeaUnit, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitType::MovementMask, CUnit::Type, CUnit::X, CUnit::Y, and y.
Referenced by AiPlanAttack().
| static void AiMarkWaterTransporter | ( | const CUnit * | unit, | |
| unsigned char * | matrix | |||
| ) | [static] |
Mark all by transporter reachable water tiles.
| unit | Transporter | |
| matrix | Water matrix. |
Definition at line 115 of file ai_plan.cpp.
References CanMoveToMask(), DebugPrint, CMap::Info, Map, MapFieldAirUnit, MapFieldLandUnit, MapFieldSeaUnit, CMapInfo::MapHeight, CMapInfo::MapWidth, CUnitType::MovementMask, CUnit::Type, CUnit::X, CUnit::Y, and y.
Referenced by AiPlanAttack().
| int AiPlanAttack | ( | AiForce * | force | ) |
< Plan the an attack
Plan an attack with a force. We know, that we must use a transporter.
| force | Pointer on the force. |
Definition at line 375 of file ai_plan.cpp.
References _C_, AiFindTarget(), AiMarkWaterTransporter(), AiPlayer, CUnitType::CanTransport, CreateMatrix(), DebugPrint, PlayerAi::Force, AiForce::GoalX, AiForce::GoalY, CPlayer::Index, int(), CUnit::IsIdle(), AiForce::MustTransport, PlayerAi::Player, CUnit::RefsIncrease(), AiForce::State, CPlayer::TotalNumUnits, CUnit::Type, UnitNumber, CPlayer::Units, AiForce::Units, CUnitType::UnitType, UnitTypeLand, and y.
Referenced by AiAttackWithForce().
| void AiSendExplorers | ( | void | ) |
Enemy units in distance.
Respond to ExplorationRequests
Definition at line 464 of file ai_plan.cpp.
References AiPlayer, CanMove(), CommandMove(), PlayerAi::FirstExplorationRequest, FlushCommands, GameCycle, CMap::Info, CMap::IsFieldExplored(), PlayerAi::LastExplorationGameCycle, Map, MapFieldLandUnit, MapFieldSeaUnit, CMapInfo::MapHeight, CMapInfo::MapWidth, AiExplorationRequest::Mask, PlayerAi::Player, SyncRand(), CPlayer::TotalNumUnits, CUnit::Type, CPlayer::Units, CUnitType::UnitType, UnitTypeFly, UnitTypeLand, UnitTypeNaval, AiExplorationRequest::X, AiExplorationRequest::Y, and y.
Referenced by AiEachSecond().
Choose enemy on map tile.
| source | Unit which want to attack. | |
| tx | X position on map, tile-based. | |
| ty | Y position on map, tile-based. |
Definition at line 65 of file ai_plan.cpp.
References CanTarget(), CPlayer::IsEnemy(), NoUnitP, CUnit::Orders, CUnit::Player, CUnitType::Priority, CUnit::Removed, CUnitCache::Select(), CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, UnitActionDie, UnitCache, UnitMax, CUnit::X, and CUnit::Y.
Referenced by AiFindTarget().
1.5.6