____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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 <unit_cache.h>
Public Member Functions | |
| void | Init (int mapWidth, int mapHeight) |
| < Initialize unit cache | |
| void | Insert (CUnit *unit) |
| Remove unit from cache. | |
| void | Remove (CUnit *unit) |
| Select units in range. | |
| int | Select (int x1, int y1, int x2, int y2, CUnit **table, int tablesize) |
| Select units on tile. | |
| int | Select (int x, int y, CUnit **table, int tablesize) |
Definition at line 49 of file unit_cache.h.
| void CUnitCache::Init | ( | int | mapWidth, | |
| int | mapHeight | |||
| ) |
< Initialize unit cache
Insert new unit into cache
Initialize unit-cache.
| mapWidth | Map width | |
| mapHeight | Map height |
Definition at line 56 of file unit_cache.cpp.
Referenced by CclStratagusMap(), CMap::Create(), and CEditor::Init().
| void CUnitCache::Insert | ( | CUnit * | unit | ) |
Remove unit from cache.
Insert new unit into cache.
| unit | Unit pointer to place in cache. |
Definition at line 73 of file unit_cache.cpp.
References Assert, CUnit::Removed, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::X, and CUnit::Y.
Referenced by LetUnitDie(), CUnit::MoveToXY(), and CUnit::Place().
| void CUnitCache::Remove | ( | CUnit * | unit | ) |
Select units in range.
Remove unit from cache.
| unit | Unit pointer to remove from cache. |
Definition at line 89 of file unit_cache.cpp.
References Assert, CUnit::Removed, CUnitType::TileHeight, CUnitType::TileWidth, CUnit::Type, CUnit::X, and CUnit::Y.
Referenced by CUnit::MoveToXY(), and CUnit::Remove().
| int CUnitCache::Select | ( | int | x1, | |
| int | y1, | |||
| int | x2, | |||
| int | y2, | |||
| CUnit ** | table, | |||
| int | tablesize | |||
| ) |
Select units on tile.
Select units in rectangle range.
| x1 | Left column of selection rectangle | |
| y1 | Top row of selection rectangle | |
| x2 | Right column of selection rectangle | |
| y2 | Bottom row of selection rectangle | |
| table | All units in the selection rectangle | |
| tablesize | Size of table array |
Definition at line 118 of file unit_cache.cpp.
References Assert, CUnit::Removed, CUnitType::Revealer, Select(), CUnit::Slot, CUnit::Type, and UnitMax.
Referenced by AddSelectedAirUnitsInRectangle(), AddSelectedGroundUnitsInRectangle(), AddSelectedUnitsInRectangle(), AiEnemyUnitsInDistance(), AttackUnitsInDistance(), Summon::Cast(), AreaAdjustVitals::Cast(), Demolish::Cast(), CclChangeUnitsOwner(), CclGetNumUnitsAt(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclKillUnitAt(), CclOrderUnit(), CBuildRestrictionOnTop::Check(), CBuildRestrictionAddOn::Check(), CBuildRestrictionDistance::Check(), CheckAlreadyBuilding(), EditorActionPlaceUnit(), EnemyOnMapTile(), FindAndSortUnits(), FindRangeAttack(), MapFogFilterFlags(), MissileHit(), RescueUnits(), ResourceOnMap(), Select(), SelectAirUnitsInRectangle(), SelectGroundUnitsInRectangle(), SelectTargetUnitsOfAutoCast(), SelectUnitsByType(), SelectUnitsInRectangle(), TargetOnMap(), ToggleUnitsByType(), UnitOnMapTile(), UnitsOnTileMarkSeen(), UnitsOnTileUnmarkSeen(), UnitToRepairInRange(), and UnmarkUnitFieldFlags().
| int CUnitCache::Select | ( | int | x, | |
| int | y, | |||
| CUnit ** | table, | |||
| int | tablesize | |||
| ) |
Select units on map tile.
| x | Map X tile position | |
| y | Map Y tile position | |
| table | All units in the selection rectangle | |
| tablesize | Size of table array |
Definition at line 173 of file unit_cache.cpp.
References Assert.
1.5.6