#include "town.h"
#include "date_func.h"
#include "tile_map.h"
#include "functions.h"
Go to the source code of this file.
Functions | |
static TownID | GetTownIndex (TileIndex t) |
Get the index of which town this house/street is attached to. | |
static void | SetTownIndex (TileIndex t, TownID index) |
Set the town index for a road or house tile. | |
static Town * | GetTownByTile (TileIndex t) |
Gets the town associated with the house or road tile. | |
static HouseID | GetHouseType (TileIndex t) |
Get the type of this house, which is an index into the house spec array Since m4 is only a byte and we want to support 512 houses, we use the bit 6 of m3 as an additional bit to house type. | |
static void | SetHouseType (TileIndex t, HouseID house_id) |
Set the house type. | |
static bool | LiftHasDestination (TileIndex t) |
Check if the lift of this animated house has a destination. | |
static void | SetLiftDestination (TileIndex t, byte dest) |
Set the new destination of the lift for this animated house, and activate the LiftHasDestination bit. | |
static byte | GetLiftDestination (TileIndex t) |
Get the current destination for this lift. | |
static void | HaltLift (TileIndex t) |
Stop the lift of this animated house from moving. | |
static byte | GetLiftPosition (TileIndex t) |
Get the position of the lift on this animated house. | |
static void | SetLiftPosition (TileIndex t, byte pos) |
Set the position of the lift on this animated house. | |
static byte | GetHouseAnimationFrame (TileIndex t) |
Get the current animation frame for this house. | |
static void | SetHouseAnimationFrame (TileIndex t, byte frame) |
Set a new animation frame for this house. | |
static bool | IsHouseCompleted (TileIndex t) |
Get the completion of this house. | |
static void | SetHouseCompleted (TileIndex t, bool status) |
Mark this house as been completed. | |
static void | MakeHouseTile (TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits) |
Make the tile a house. | |
static byte | GetHouseBuildingStage (TileIndex t) |
House Construction Scheme. | |
static byte | GetHouseConstructionTick (TileIndex t) |
Gets the construction stage of a house. | |
static void | IncHouseConstructionTick (TileIndex t) |
Sets the increment stage of a house It is working with the whole counter + stage 5 bits, making it easier to work: the wraparound is automatic. | |
static Year | GetHouseConstructionYear (TileIndex t) |
Get the year that this house was constructed (between 1920 and 2175). | |
static void | SetHouseRandomBits (TileIndex t, byte random) |
Set the random bits for this house. | |
static byte | GetHouseRandomBits (TileIndex t) |
Get the random bits for this house. | |
static void | SetHouseTriggers (TileIndex t, byte triggers) |
Set the activated triggers bits for this house. | |
static byte | GetHouseTriggers (TileIndex t) |
Get the already activated triggers bits for this house. | |
static byte | GetHouseProcessingTime (TileIndex t) |
Get the amount of time remaining before the tile loop processes this tile. | |
static void | SetHouseProcessingTime (TileIndex t, byte time) |
Set the amount of time remaining before the tile loop processes this tile. | |
static void | DecHouseProcessingTime (TileIndex t) |
Decrease the amount of time remaining before the tile loop processes this tile. |
Definition in file town_map.h.
static void DecHouseProcessingTime | ( | TileIndex | t | ) | [inline, static] |
Decrease the amount of time remaining before the tile loop processes this tile.
t | the house tile |
Definition at line 366 of file town_map.h.
References _me, IsTileType(), TileExtended::m7, and MP_HOUSE.
static byte GetHouseAnimationFrame | ( | TileIndex | t | ) | [inline, static] |
Get the current animation frame for this house.
t | the tile |
Definition at line 145 of file town_map.h.
References _m, GB(), IsTileType(), and MP_HOUSE.
Referenced by HouseGetVariable().
static byte GetHouseBuildingStage | ( | TileIndex | t | ) | [inline, static] |
House Construction Scheme.
Construction counter, for buildings under construction. Incremented on every periodic tile processing. On wraparound, the stage of building in is increased. GetHouseBuildingStage is taking care of the real stages, (as the sprite for the next phase of house building) (Get|Inc)HouseConstructionTick is simply a tick counter between the different stages Gets the building stage of a house Since the stage is used for determining what sprite to use, if the house is complete (and that stage no longuer is available), fool the system by returning the TOWN_HOUSE_COMPLETE (3), thus showing a beautiful complete house.
t | the tile of the house to get the building stage of |
Definition at line 235 of file town_map.h.
References _m, GB(), IsHouseCompleted(), IsTileType(), MP_HOUSE, and TOWN_HOUSE_COMPLETED.
Referenced by DrawTile_Town(), and HouseGetVariable().
static byte GetHouseConstructionTick | ( | TileIndex | t | ) | [inline, static] |
Gets the construction stage of a house.
t | the tile of the house to get the construction stage of |
Definition at line 247 of file town_map.h.
References _m, GB(), IsHouseCompleted(), IsTileType(), and MP_HOUSE.
Referenced by MakeSingleHouseBigger().
static Year GetHouseConstructionYear | ( | TileIndex | t | ) | [inline, static] |
Get the year that this house was constructed (between 1920 and 2175).
t | the tile of this house |
Definition at line 279 of file town_map.h.
References _m, IsHouseCompleted(), IsTileType(), Tile::m5, MP_HOUSE, and ORIGINAL_BASE_YEAR.
Referenced by HouseGetVariable(), and TileLoop_Town().
static byte GetHouseProcessingTime | ( | TileIndex | t | ) | [inline, static] |
Get the amount of time remaining before the tile loop processes this tile.
t | the house tile |
Definition at line 343 of file town_map.h.
References _me, IsTileType(), TileExtended::m7, and MP_HOUSE.
static byte GetHouseRandomBits | ( | TileIndex | t | ) | [inline, static] |
Get the random bits for this house.
This is required for newgrf house
t | the tile of this house |
Definition at line 305 of file town_map.h.
References _m, IsTileType(), Tile::m1, and MP_HOUSE.
static byte GetHouseTriggers | ( | TileIndex | t | ) | [inline, static] |
Get the already activated triggers bits for this house.
This is required for newgrf house
t | the tile of this house |
Definition at line 331 of file town_map.h.
References _m, GB(), IsTileType(), and MP_HOUSE.
static HouseID GetHouseType | ( | TileIndex | t | ) | [inline, static] |
Get the type of this house, which is an index into the house spec array Since m4 is only a byte and we want to support 512 houses, we use the bit 6 of m3 as an additional bit to house type.
t | the tile |
Definition at line 56 of file town_map.h.
References _m, GB(), IsTileType(), Tile::m4, and MP_HOUSE.
Referenced by AnimateTile_Town(), DrawTile_Town(), MakeSingleHouseBigger(), MakeTownHouseBigger(), TileLoop_Town(), and UpdateHousesAndTowns().
static byte GetLiftDestination | ( | TileIndex | t | ) | [inline, static] |
Get the current destination for this lift.
t | the tile |
Definition at line 102 of file town_map.h.
Referenced by AnimateTile_Town().
static byte GetLiftPosition | ( | TileIndex | t | ) | [inline, static] |
Get the position of the lift on this animated house.
t | the tile |
Definition at line 124 of file town_map.h.
Referenced by AnimateTile_Town().
static Town* GetTownByTile | ( | TileIndex | t | ) | [inline, static] |
Gets the town associated with the house or road tile.
t | the tile to get the town of |
Definition at line 43 of file town_map.h.
References GetTownIndex().
Referenced by GrowTownAtRoad(), MakeSingleHouseBigger(), RemoveRoad(), TileLoop_Town(), and UpdateHousesAndTowns().
static TownID GetTownIndex | ( | TileIndex | t | ) | [inline, static] |
Get the index of which town this house/street is attached to.
t | the tile |
Definition at line 19 of file town_map.h.
References _m, IsTileType(), Tile::m2, MP_HOUSE, and MP_ROAD.
Referenced by CanBuildHouseHere(), CmdBuildSingleRail(), CmdRemoveSingleRail(), and GetTownByTile().
static void HaltLift | ( | TileIndex | t | ) | [inline, static] |
Stop the lift of this animated house from moving.
Clears the first 4 bits of m7 at once, clearing the LiftHasDestination bit and the destination.
t | the tile |
Definition at line 113 of file town_map.h.
References _me, DeleteAnimatedTile(), and SB().
Referenced by AnimateTile_Town().
static void IncHouseConstructionTick | ( | TileIndex | t | ) | [inline, static] |
Sets the increment stage of a house It is working with the whole counter + stage 5 bits, making it easier to work: the wraparound is automatic.
t | the tile of the house to increment the construction stage of |
Definition at line 260 of file town_map.h.
References _m, AB(), Clamp(), GB(), IsTileType(), Tile::m5, MP_HOUSE, ORIGINAL_BASE_YEAR, SetHouseCompleted(), and TOWN_HOUSE_COMPLETED.
Referenced by MakeSingleHouseBigger().
static bool IsHouseCompleted | ( | TileIndex | t | ) | [inline, static] |
Get the completion of this house.
t | the tile |
Definition at line 169 of file town_map.h.
References _m, HasBit(), IsTileType(), and MP_HOUSE.
Referenced by GetHouseBuildingStage(), GetHouseConstructionTick(), GetHouseConstructionYear(), MakeHouseTile(), MakeSingleHouseBigger(), TileLoop_Town(), and UpdateHousesAndTowns().
static bool LiftHasDestination | ( | TileIndex | t | ) | [inline, static] |
Check if the lift of this animated house has a destination.
t | the tile |
Definition at line 80 of file town_map.h.
Referenced by AnimateTile_Town(), MakeSingleHouseBigger(), and TileLoop_Town().
static void MakeHouseTile | ( | TileIndex | t, | |
TownID | tid, | |||
byte | counter, | |||
byte | stage, | |||
HouseID | type, | |||
byte | random_bits | |||
) | [inline, static] |
Make the tile a house.
t | tile index | |
tid | Town index | |
counter | of construction step | |
stage | of construction (used for drawing) | |
type | of house. Index into house specs array | |
random_bits | required for newgrf houses |
Definition at line 196 of file town_map.h.
References _m, _me, AddAnimatedTile(), IsHouseCompleted(), IsTileType(), Tile::m1, Tile::m2, Tile::m3, Tile::m5, TileExtended::m7, MarkTileDirtyByTile(), MP_CLEAR, MP_HOUSE, SetHouseAnimationFrame(), SetHouseCompleted(), SetHouseType(), SetTileType(), and TOWN_HOUSE_COMPLETED.
Referenced by ClearMakeHouseTile().
static void SetHouseAnimationFrame | ( | TileIndex | t, | |
byte | frame | |||
) | [inline, static] |
Set a new animation frame for this house.
t | the tile | |
frame | the new frame number |
Definition at line 157 of file town_map.h.
References _m, GB(), IsTileType(), MP_HOUSE, and SB().
Referenced by MakeHouseTile().
static void SetHouseCompleted | ( | TileIndex | t, | |
bool | status | |||
) | [inline, static] |
Mark this house as been completed.
t | the tile | |
status |
Definition at line 180 of file town_map.h.
References _m, IsTileType(), MP_HOUSE, and SB().
Referenced by IncHouseConstructionTick(), and MakeHouseTile().
static void SetHouseProcessingTime | ( | TileIndex | t, | |
byte | time | |||
) | [inline, static] |
Set the amount of time remaining before the tile loop processes this tile.
t | the house tile | |
time | the time to be set |
Definition at line 355 of file town_map.h.
References _me, IsTileType(), TileExtended::m7, and MP_HOUSE.
static void SetHouseRandomBits | ( | TileIndex | t, | |
byte | random | |||
) | [inline, static] |
Set the random bits for this house.
This is required for newgrf house
t | the tile of this house | |
random | the new random bits |
Definition at line 292 of file town_map.h.
References _m, IsTileType(), Tile::m1, and MP_HOUSE.
static void SetHouseTriggers | ( | TileIndex | t, | |
byte | triggers | |||
) | [inline, static] |
Set the activated triggers bits for this house.
This is required for newgrf house
t | the tile of this house | |
triggers | the activated triggers |
Definition at line 318 of file town_map.h.
References _m, IsTileType(), MP_HOUSE, and SB().
static void SetHouseType | ( | TileIndex | t, | |
HouseID | house_id | |||
) | [inline, static] |
Set the house type.
t | the tile | |
house_id | the new house type |
Definition at line 68 of file town_map.h.
References _m, GB(), IsTileType(), Tile::m4, MP_HOUSE, and SB().
Referenced by MakeHouseTile(), and UpdateHousesAndTowns().
static void SetLiftDestination | ( | TileIndex | t, | |
byte | dest | |||
) | [inline, static] |
Set the new destination of the lift for this animated house, and activate the LiftHasDestination bit.
t | the tile | |
dest | new destination |
Definition at line 91 of file town_map.h.
References _me, SB(), and SetBit().
Referenced by AnimateTile_Town().
static void SetLiftPosition | ( | TileIndex | t, | |
byte | pos | |||
) | [inline, static] |
Set the position of the lift on this animated house.
t | the tile | |
pos | position, from 0 to 36 |
Definition at line 134 of file town_map.h.
Referenced by AnimateTile_Town().
static void SetTownIndex | ( | TileIndex | t, | |
TownID | index | |||
) | [inline, static] |
Set the town index for a road or house tile.
t | the tile |
index | the index of the town |
Definition at line 32 of file town_map.h.
References _m, IsTileType(), Tile::m2, MP_HOUSE, and MP_ROAD.
Referenced by CmdBuildRoad(), and GrowTownAtRoad().