22 #include "../Battlescape/Position.h" 23 #include "../Mod/MapData.h" 24 #include "BattleUnit.h" 26 #include <SDL_types.h> 45 static struct SerializationKey
57 static const int NOT_CALCULATED = -1;
60 static const int LIGHTLAYERS = 3;
66 int _light[LIGHTLAYERS], _lastLight[LIGHTLAYERS];
73 std::vector<BattleItem *> _inventory;
81 std::list<Particle*> _particles;
88 void load(
const YAML::Node &node);
92 YAML::Node
save()
const;
103 return _objects[part];
109 void getMapData(
int *mapDataID,
int *mapDataSetID,
int part)
const;
113 int getTUCost(
int part, MovementType movementType)
const;
143 return (_objects[part] && _objects[part]->isUFODoor() && _currentFrame[part] != 0);
155 void addLight(
int light,
int layer);
159 bool destroy(
int part, SpecialTileType type);
161 bool damage(
int part,
int power, SpecialTileType type);
163 void setExplosive(
int power,
int damageType,
bool force =
false);
void addParticle(Particle *particle)
adds a particle to this tile's array.
Definition: Tile.cpp:980
Definition: Particle.h:26
int getExplosive() const
Get explosive power of this tile.
Definition: Tile.cpp:529
static struct OpenXcom::Tile::SerializationKey serializationKey
How many bytes various fields use in a serialized tile. See header.
Definition: Tile.cpp:37
Surface * getSprite(int part) const
Get object sprites.
Definition: Tile.cpp:665
Tile(Position pos)
Creates a tile.
Definition: Tile.cpp:51
int getFlammability() const
Get flammability.
Definition: Tile.cpp:547
void setDangerous(bool danger)
set the danger flag on this tile (so the AI will avoid it).
Definition: Tile.cpp:962
int getMarkerColor() const
Get the tile marker color.
Definition: Tile.cpp:883
int getTerrainLevel() const
Get terrain level.
Definition: Tile.cpp:297
void load(const YAML::Node &node)
Load the tile from yaml.
Definition: Tile.cpp:88
void setUnit(BattleUnit *unit, Tile *tileBelow=0)
Set a unit on this tile.
Definition: Tile.cpp:678
int getFire() const
Get fire.
Definition: Tile.cpp:701
void addLight(int light, int layer)
Add light to this tile.
Definition: Tile.cpp:431
void addOverlap()
increment the overlap value on this tile.
Definition: Tile.cpp:954
MapData * getMapData(int part) const
Get the MapData pointer of a part of the tile.
Definition: Tile.h:101
void setMapData(MapData *dat, int mapDataID, int mapDataSetID, int part)
Sets the pointer to the mapdata for a specific part of the tile.
Definition: Tile.cpp:217
int getTopItemSprite()
Get top-most item.
Definition: Tile.cpp:790
void removeItem(BattleItem *item)
Remove item.
Definition: Tile.cpp:773
int openDoor(int part, BattleUnit *Unit=0, BattleActionType reserve=BA_NONE)
Open a door, returns the ID, 0(normal), 1(ufo) or -1 if no door opened.
Definition: Tile.cpp:337
int getOverlaps() const
how many times has this tile been overlapped with smoke/fire (runtime only)
Definition: Tile.cpp:946
Represents a single item in the battlescape.
Definition: BattleItem.h:36
bool getDangerous() const
check the danger flag on this tile.
Definition: Tile.cpp:971
~Tile()
Cleans up a tile.
Definition: Tile.cpp:74
bool destroy(int part, SpecialTileType type)
Destroy a tile part.
Definition: Tile.cpp:463
int getAnimationOffset() const
Get fire and smoke animation offset.
Definition: Tile.cpp:752
bool isUfoDoorOpen(int part) const
Check if the ufo door is open or opening.
Definition: Tile.h:141
int getFootstepSound(Tile *tileBelow) const
Gets the floor object footstep sound.
Definition: Tile.cpp:315
bool isBigWall() const
Checks if this tile is a big wall.
Definition: Tile.cpp:285
MapData is the smallest piece of a Battlescape terrain, holding info about a certain object...
Definition: MapData.h:51
int getShade() const
Get the shade amount.
Definition: Tile.cpp:442
void setExplosive(int power, int damageType, bool force=false)
Set a "virtual" explosive on this tile, to detonate later.
Definition: Tile.cpp:516
std::vector< BattleItem * > * getInventory()
Get inventory on this tile.
Definition: Tile.cpp:864
Basic element of which a battle map is build.
Definition: Tile.h:42
void ignite(int power)
attempt to set the tile on fire, sets overlaps to one if successful.
Definition: Tile.cpp:596
Element that is blit (rendered) onto the screen.
Definition: Surface.h:36
int getTUMarker() const
get the number to be displayed for pathfinding preview.
Definition: Tile.cpp:937
void animate()
Animated the tile parts.
Definition: Tile.cpp:623
void setMarkerColor(int color)
Set the tile marker color.
Definition: Tile.cpp:874
bool isDiscovered(int part) const
Gets the black fog of war status of this tile.
Definition: Tile.cpp:410
void addSmoke(int smoke)
Add smoke, increments overlap.
Definition: Tile.cpp:710
void setFire(int fire)
Set fire, does not increment overlaps.
Definition: Tile.cpp:691
void setVisible(int visibility)
Set the tile visible flag.
Definition: Tile.cpp:892
void setTUMarker(int tu)
set the number to be displayed for pathfinding preview.
Definition: Tile.cpp:928
YAML::Node save() const
Saves the tile to yaml.
Definition: Tile.cpp:155
int getSmoke() const
Get smoke.
Definition: Tile.cpp:742
int closeUfoDoor()
Close ufo door.
Definition: Tile.cpp:366
int getFuel() const
Get turns to burn.
Definition: Tile.cpp:562
int getPreview() const
retrieve the direction stored by the pathfinding.
Definition: Tile.cpp:919
Easy handling of X-Y-Z coordinates.
Definition: Position.h:28
void prepareNewTurn(bool smokeDamage)
New turn preparations.
Definition: Tile.cpp:810
void loadBinary(Uint8 *buffer, Tile::SerializationKey &serializationKey)
Load the tile from binary buffer in memory.
Definition: Tile.cpp:124
BattleUnit * getUnit() const
Get the (alive) unit on this tile.
Definition: Tile.h:178
void setDiscovered(bool flag, int part)
Sets the black fog of war status of this tile.
Definition: Tile.cpp:387
bool hasNoFloor(Tile *tileBelow) const
Checks if this tile has a floor.
Definition: Tile.cpp:271
bool damage(int part, int power, SpecialTileType type)
Damage a tile part.
Definition: Tile.cpp:500
int getExplosiveType() const
Get explosive power of this tile.
Definition: Tile.cpp:538
void saveBinary(Uint8 **buffer) const
Saves the tile to binary.
Definition: Tile.cpp:190
void setPreview(int dir)
set the direction (used for path previewing)
Definition: Tile.cpp:910
bool isVoid() const
Gets whether this tile has no objects.
Definition: Tile.cpp:241
int getTUCost(int part, MovementType movementType) const
Get the TU cost to walk over a certain part of the tile.
Definition: Tile.cpp:252
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:59
Position getPosition() const
Gets the tile's position.
Definition: Tile.h:125
Definition: BaseInfoState.cpp:40
void addItem(BattleItem *item, RuleInventory *ground)
Add item.
Definition: Tile.cpp:762
Represents the static data for a unit that is generated on the battlescape, this includes: HWPs...
Definition: Unit.h:57
void setSmoke(int smoke)
Set smoke, does not increment overlaps.
Definition: Tile.cpp:731
Represents a specific section of the inventory, containing information like available slots and scree...
Definition: RuleInventory.h:42
std::list< Particle * > * getParticleCloud()
gets a pointer to this tile's particle array.
Definition: Tile.cpp:989
int getVisible() const
Get the tile visible flag.
Definition: Tile.cpp:901
void resetLight(int layer)
Reset light to zero for this tile.
Definition: Tile.cpp:420