41#include "table/strings.h"
120 assert(o->
town !=
nullptr);
133 if (remove) RemoveDockingTile(t);
155#define GetCompanyHQSize GetAnimationFrame
157#define IncreaseCompanyHQSize IncreaseAnimationStage
169 if (score >= 170) val++;
170 if (score >= 350) val++;
171 if (score >= 520) val++;
172 if (score >= 720) val++;
188 if (owner != c->
index)
continue;
194 const Livery *l = c->livery;
214 if (type >= ObjectSpec::Count())
return CMD_ERROR;
226 int size_x =
GB(spec->
size,
HasBit(view, 0) ? 4 : 0, 4);
227 int size_y =
GB(spec->
size,
HasBit(view, 0) ? 0 : 4, 4);
244 if (!allow_water)
return CommandCost(STR_ERROR_CAN_T_BUILD_ON_WATER);
258 if (!allow_ground)
return CommandCost(STR_ERROR_MUST_BE_BUILT_ON_WATER);
288 if (ret.
Failed())
return ret;
306 if (cost.
Failed())
return cost;
313 return CommandCost(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
318 uint build_object_size = 1;
357 build_object_size = size_x * size_y;
364 return CommandCost(STR_ERROR_BUILD_OBJECT_LIMIT_REACHED);
395 if (type >= ObjectSpec::Count())
return CMD_ERROR;
404 bool had_success =
false;
415 if (c !=
nullptr && limit-- <= 0)
break;
427 if (ret.
GetCost() > 0 && money < 0)
break;
433 return had_success ? cost : last_error;
438static void DrawTile_Object(
TileInfo *ti)
457 dts = &_objects[type];
464 case SPR_FLAT_BARE_LAND: DrawClearLandTile(ti, 0);
break;
465 case SPR_FLAT_1_THIRD_GRASS_TILE: DrawClearLandTile(ti, 1);
break;
466 case SPR_FLAT_2_THIRD_GRASS_TILE: DrawClearLandTile(ti, 2);
break;
467 case SPR_FLAT_GRASS_TILE: DrawClearLandTile(ti, 3);
break;
477 dtss.image.sprite, palette,
478 ti->
x + dtss.delta_x, ti->
y + dtss.delta_y,
479 dtss.size_x, dtss.size_y,
480 dtss.size_z, ti->
z + dtss.delta_z,
492static int GetSlopePixelZ_Object(
TileIndex tile, uint x, uint y,
bool)
518 MakeWaterKeepingClass(tile_cur,
GetTileOwner(tile_cur));
523std::vector<ClearedObjectArea> _cleared_object_areas;
535 if (coa.area.Intersects(ta))
return &coa;
560 return CommandCost(STR_ERROR_CAN_T_BUILD_ON_WATER);
563 return CommandCost(type ==
OBJECT_HQ ? STR_ERROR_COMPANY_HEADQUARTERS_IN : STR_ERROR_OBJECT_IN_THE_WAY);
564 }
else if (_game_mode == GM_EDITOR) {
572 }
else if (spec->
flags.
All({ObjectFlag::CannotRemove, ObjectFlag::Autoremove})) {
582 }
else if (spec->
flags.
Any({ObjectFlag::BuiltOnWater, ObjectFlag::NotOnLand})) {
613 _cleared_object_areas.push_back({tile, ta});
620static void AddAcceptedCargo_Object(
TileIndex tile,
CargoArray &acceptance, CargoTypes &always_accepted)
634 acceptance[pass] += std::max(1U, level);
635 SetBit(always_accepted, pass);
642 CargoType mail = GetCargoTypeByLabel(CT_MAIL);
644 acceptance[mail] += std::max(1U, level / 2);
645 SetBit(always_accepted, mail);
655 CargoType mail = GetCargoTypeByLabel(CT_MAIL);
672static void TileLoop_Object(
TileIndex tile)
698 uint amt =
GB(r, 0, 8) / 8 / 4 + 1;
712 CargoType mail = GetCargoTypeByLabel(CT_MAIL);
714 uint amt =
GB(r, 8, 8) / 8 / 4 + 1;
732static bool ClickTile_Object(
TileIndex tile)
740static void AnimateTile_Object(
TileIndex tile)
766 int perimeter = (
GB(r, 16, 16) % (2 * (maxx + maxy))) - maxy;
768 for (dir =
DIAGDIR_NE; perimeter > 0; dir++) {
784 for (
int j = 0; j < 19; j++) {
815void GenerateObjects()
821 uint num_water_tiles = 0;
827 for (uint y = 1; y <
Map::MaxY() - 1; y++) {
834 for (
const auto &spec :
ObjectSpec::Specs()) {
855 switch (spec.
Index()) {
878 bool do_clear =
false;
947 GetSlopePixelZ_Object,
949 AddAcceptedCargo_Object,
951 GetTileTrackStatus_Object,
955 ChangeTileOwner_Object,
956 AddProducedCargo_Object,
958 GetFoundation_Object,
959 TerraformTile_Object,
Functions related to autoslope.
bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
constexpr T ToggleBit(T &x, const uint8_t y)
Toggles a bit in a variable.
void DrawBridgeMiddle(const TileInfo *ti)
Draw the middle bits of a bridge.
TileIndex GetSouthernBridgeEnd(TileIndex t)
Finds the southern end of a bridge starting at a middle tile.
int GetBridgeHeight(TileIndex t)
Get the height ('z') of a bridge.
Map accessor functions for bridges.
bool IsBridgeAbove(Tile t)
checks if a bridge is set above the ground of this tile
uint8_t CargoType
Cargo slots to indicate a cargo type within a game.
bool IsValidCargoType(CargoType t)
Test whether cargo type is not INVALID_CARGO.
static constexpr CargoLabel CT_PASSENGERS
Available types of cargo Labels may be re-used between different climates.
Base class for cargo packets.
Cheats _cheats
All the cheats.
Types related to cheating.
constexpr bool All(const Timpl &other) const
Test if all of the values are set.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Set()
Set all bits.
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
constexpr Timpl & Reset(Tvalue_type value)
Reset the value-th bit.
Common return value for all commands.
bool Succeeded() const
Did this command succeed?
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Money GetCost() const
The costs as made up to this moment.
bool Failed() const
Did this command fail?
void MultiplyCost(int factor)
Multiplies the cost of the command by the given factor.
Structure contains cached list of stations nearby.
static std::unique_ptr< TileIterator > Create(TileIndex corner1, TileIndex corner2, bool diagonal)
Create either an OrthogonalTileIterator or DiagonalTileIterator given the diagonal parameter.
Wrapper class to abstract away the way the tiles are stored.
static Date date
Current date in days (day counter).
Functions related to clear (MP_CLEAR) land.
Functions related to commands.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
@ Execute
execute the given command
@ NoModifyTownRating
do not change town rating
@ NoTestTownRating
town rating does not disallow you from building
@ NoWater
don't allow building on water
@ Auto
don't allow building on structures
Definition of stuff that is very close to a company, like the company struct itself.
Money CalculateCompanyValue(const Company *c, bool including_loan=true)
Calculate the value of the company.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
Money GetAvailableMoneyForCommand()
This functions returns the money which can be used to execute a command.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
CompanyID _current_company
Company currently doing an action.
Functions related to companies.
void ShowCompany(CompanyID company)
Show the window with the overview of the company.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
GUI Functions related to companies.
static constexpr Owner OWNER_DEITY
The object is owned by a superuser / goal script.
static constexpr Owner OWNER_TOWN
A town owns the tile, or a town is expanding.
static constexpr Owner OWNER_NONE
The tile has no ownership.
static constexpr Owner INVALID_OWNER
An invalid owner.
static constexpr Owner OWNER_WATER
The tile/execution is done by "water".
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
DiagDirection
Enumeration for diagonal directions.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
int UpdateCompanyRatingAndValue(Company *c, bool update)
if update is set to true, the economy is updated with this score (also the house is updated,...
bool EconomyIsInRecession()
Is the economy in recession?
uint ScaleByCargoScale(uint num, bool town)
Scale a number by the cargo scale setting.
@ EXPENSES_CONSTRUCTION
Construction costs.
bool _generating_world
Whether we are generating the map or not.
Functions related to world/map generation.
void IncreaseGeneratingWorldProgress(GenWorldProgress cls)
Increases the current stage of the world generation with one.
@ GWP_OBJECT
Generate objects (radio tower, light houses)
void SetGeneratingWorldProgress(GenWorldProgress cls, uint total)
Set the total of a stage of the world generation.
uint32_t PaletteID
The number of the palette.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a tile.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
Functions related to OTTD's landscape.
Command definitions related to landscape (slopes etc.).
@ Random
Randomise borders.
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data)
Function performing a search around a center tile and going outward, thus in circle.
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
#define RandomTile()
Get a valid random tile.
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
@ OAT_BUILT
Triggered when the object is built (for all tiles at the same time).
@ OAT_TILELOOP
Triggered in the periodic tile loop.
@ OAT_256_TICKS
Triggered every 256 ticks (for all tiles at the same time).
@ CBID_OBJECT_LAND_SLOPE_CHECK
Callback done for each tile of an object to check the slope.
@ CBID_OBJECT_AUTOSLOPE
Called to determine if one can alter the ground below an object tile.
@ CBID_OBJECT_COLOUR
Called to determine the colour of a town building.
@ Autoslope
decides allowance of autosloping
@ Colour
decide the colour of the building
@ SlopeCheck
decides slope suitability
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
CommandCost GetErrorMessageFromLocationCallbackResult(uint16_t cb_res, const GRFFile *grffile, StringID default_error)
Get the error message from a shape/location/slope check callback result.
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
bool ConvertBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
GRFConfig * GetGRFConfig(uint32_t grfid, uint32_t mask)
Retrieve a NewGRF from the current config by its grfid.
Functions to find and configure NewGRFs.
Functions/types related to NewGRF debugging.
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Delete inspect window for a given feature and index.
void TriggerObjectAnimation(Object *o, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
Trigger the update of animation on a whole object.
void DrawNewObjectTile(TileInfo *ti, const ObjectSpec *spec)
Draw an object on the map.
uint16_t GetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8_t view)
Perform a callback for an object.
void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigger trigger, const ObjectSpec *spec)
Trigger the update of animation on a single tile.
void AnimateNewObjectTile(TileIndex tile)
Handle the animation of the object tile.
Functions related to NewGRF objects.
static const uint8_t OBJECT_SIZE_1X1
The value of a NewGRF's size property when the object is 1x1 tiles: low nibble for X,...
@ Autoremove
Object get automatically removed (like "owned land").
@ CannotRemove
Object can not be removed.
@ AllowUnderBridge
Object can built under a bridge.
@ OnlyInScenedit
Object can only be constructed in the scenario editor.
@ BuiltOnWater
Object can be built on water (not required).
@ OnlyInGame
Object can only be built in game.
@ HasNoFoundation
Do not display foundations when on a slope.
@ Uses2CC
Object wants 2CC colour mapping.
@ NotOnLand
Object can not be on land, implicitly sets ObjectFlag::BuiltOnWater.
@ ScaleByWater
Object count is roughly scaled by water amount at edges.
@ Animation
Object has animated tiles.
@ ClearIncome
When object is cleared a positive income is generated instead of a cost.
Functions related to objects.
CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge)
Checks if the given tile is buildable, flat and has a certain height.
void UpdateObjectColours(const Company *c)
Updates the colour of the object whenever a company changes.
void BuildObject(ObjectType type, TileIndex tile, CompanyID owner, Town *town, uint8_t view)
Actually build the object.
static void ReallyClearObjectTile(Object *o)
Perform the actual removal of the object from the map.
void InitializeObjects()
Initialize/reset the objects.
#define IncreaseCompanyHQSize
We encode the company HQ size in the animation stage.
static bool TryBuildTransmitter()
Try to build a transmitter.
CommandCost CmdBuildObjectArea(DoCommandFlags flags, TileIndex tile, TileIndex start_tile, ObjectType type, uint8_t view, bool diagonal)
Construct multiple objects in an area.
static bool TryBuildLightHouse()
Try to build a lighthouse.
#define GetCompanyHQSize
We encode the company HQ size in the animation stage.
static void IncreaseAnimationStage(TileIndex tile)
Increase the animation stage of a whole structure.
ObjectType GetObjectType(Tile t)
Gets the ObjectType of the given object tile.
static bool HasTransmitter(TileIndex tile, void *)
Helper function for CircularTileSearch.
void UpdateCompanyHQ(TileIndex tile, uint score)
Update the CompanyHQ to the state associated with the given score.
ClearedObjectArea * FindClearedObject(TileIndex tile)
Find the entry in _cleared_object_areas which occupies a certain tile.
CommandCost CmdBuildObject(DoCommandFlags flags, TileIndex tile, ObjectType type, uint8_t view)
Build an object object.
Command definitions related to objects.
Sprites to use and how to display them for object tiles.
Map accessors for object tiles.
void MakeObject(Tile t, Owner o, ObjectID index, WaterClass wc, uint8_t random)
Make an Object tile.
bool IsObjectTypeTile(Tile t, ObjectType type)
Check whether a tile is a object tile of a specific type.
bool IsObjectType(Tile t, ObjectType type)
Check whether the object on a tile is of a specific type.
ObjectID GetObjectIndex(Tile t)
Get the index of which object this tile is attached to.
static const ObjectType OBJECT_LIGHTHOUSE
The nice lighthouse.
uint16_t ObjectType
Types of objects.
static const ObjectType OBJECT_STATUE
Statue in towns.
static const ObjectType OBJECT_HQ
HeadQuarter of a player.
static const ObjectType NUM_OBJECTS
Number of supported objects overall.
static const ObjectType OBJECT_TRANSMITTER
The large antenna.
static const ObjectType NEW_OBJECT_OFFSET
Offset for new objects.
static const ObjectType OBJECT_OWNED_LAND
Owned land 'flag'.
Some methods of Pool are placed here in order to reduce compilation time and binary size.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
Pseudo random number generator.
uint32_t RandomRange(uint32_t limit, const std::source_location location=std::source_location::current())
Pick a random number between 0 and limit - 1, inclusive.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static constexpr int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height)
static constexpr bool IsSteepSlope(Slope s)
Checks if a slope is steep.
Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
Slope
Enumeration for the slope-type.
Foundation
Enumeration for Foundations.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
@ Headquarters
Source/destination are company headquarters.
Functions related to stations.
Definition of base types and functions in a cross-platform compatible way.
Class for storing amounts of cargo.
static void InvalidateAllFrom(Source src)
Invalidates (sets source_id to INVALID_SOURCE) all cargo packets from given source.
bool value
tells if the bool cheat is active or not
Cheat magic_bulldozer
dynamite industries, objects
Keeps track of removed objects during execution/testruns of commands.
TileIndex location_of_HQ
Northern tile of HQ; INVALID_TILE when there is none.
uint32_t build_object_limit
Amount of tiles we can (still) build objects on (times 65536). Also applies to buying land.
bool freeform_edges
allow terraforming the tiles at the map edges
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Ground palette sprite of a tile, together with its sprite layout.
PalSpriteID ground
Palette and sprite for the ground.
const char * GetName() const
Get the name of this grf.
const struct GRFFile * grffile
grf file that introduced this entity
uint32_t grfid
grfid that introduced this entity.
bool HasGrfFile() const
Test if this entity was introduced by NewGRF.
ConstructionSettings construction
construction of things in-game
Information about a particular livery.
Colours colour2
Second colour, for vehicles with 2CC support.
Colours colour1
First colour, for all vehicles.
static uint ScaleBySize(uint n)
Scales the given value by the map size, where the given value is for a 256 by 256 map.
static uint ScaleBySize1D(uint n)
Scales the given value by the maps circumference, where the given value is for a 256 by 256 map.
static uint MaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static debug_inline uint Size()
Get the size of the map.
static debug_inline uint MaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
Allow incrementing of ObjectClassID variables.
bool IsEnabled() const
Test if this object is enabled.
StringID name
The name for this object.
static const ObjectSpec * GetByTile(TileIndex tile)
Get the specification associated with a tile.
static const ObjectSpec * Get(ObjectType index)
Get the specification associated with a specific ObjectType.
bool IsAvailable() const
Check whether the object is available at this time.
Money GetClearCost() const
Get the cost for clearing a structure of this type.
uint8_t size
The size of this objects; low nibble for X, high nibble for Y.
uint8_t generate_amount
Number of objects which are attempted to be generated per 256^2 map during world generation.
uint Index() const
Gets the index of this spec.
ObjectCallbackMasks callback_mask
Bitmask of requested/allowed callbacks.
ObjectFlags flags
Flags/settings related to the object.
uint8_t height
The height of this structure, in heightlevels; max MAX_TILE_HEIGHT.
FixedGRFFileProps< 2 > grf_prop
Properties related the the grf file.
bool WasEverAvailable() const
Check whether the object was available at some point in the past or present in this game with the cur...
Money GetBuildCost() const
Get the cost for building a structure of this type.
uint8_t views
The number of views.
An object, such as transmitter, on the map.
ObjectType type
Type of the object.
Town * town
Town the object is built in.
static Object * GetByTile(TileIndex tile)
Get the object associated with a tile.
static void IncTypeCount(ObjectType type)
Increment the count of objects for this type.
TimerGameCalendar::Date build_date
Date of construction.
static uint16_t counts[NUM_OBJECTS]
Number of objects per type ingame.
uint8_t view
The view setting for this object.
TileArea location
Location of the object.
uint8_t colour
Colour of the object, for display purpose.
static void DecTypeCount(ObjectType type)
Decrement the count of objects for this type.
static void ResetTypeCounts()
Resets object counts.
Represents the covered area of e.g.
uint16_t w
The width of the area.
TileIndex tile
The base tile of the area.
uint16_t h
The height of the area.
SpriteID sprite
The 'real' sprite.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
Tindex index
Index of this pool item.
static size_t GetNumItems()
Returns number of valid items in the pool.
static Titem * GetIfValid(auto index)
Returns Titem with given index.
static Titem * Get(auto index)
Returns Titem with given index.
Base class for all pools.
Tile description for the 'land area information' tool.
StringID str
Description of the tile.
TimerGameCalendar::Date build_date
Date of construction of tile contents.
const char * grf
newGRF used for the tile contents
Owner owner[4]
Name of the owner(s)
Tile information, used while rendering the tile.
int x
X position of the tile in unit coordinates.
Slope tileh
Slope of the tile.
TileIndex tile
Tile index.
int y
Y position of the tile in unit coordinates.
Set of callback functions for performing tile operations of a given tile type.
CompanyMask statues
which companies have a statue?
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
uint8_t GetAnimationFrame(Tile t)
Get the current animation frame.
std::tuple< Slope, int > GetTilePixelSlope(TileIndex tile)
Return the slope of a given tile.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
void SetAnimationFrame(Tile t, uint8_t frame)
Set a new animation frame.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
Slope GetTileSlope(TileIndex tile)
Return the slope of a given tile inside the map.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
@ MP_CLEAR
A tile without any structures, i.e. grass, rocks, farm fields etc.
@ MP_OBJECT
Contains objects such as transmitters and owned land.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
Definition of the game-calendar-timer.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
bool IsTransparencySet(TransparencyOption to)
Check if the transparency option bit is set and if we aren't in the game menu (there's never transpar...
bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
@ TO_STRUCTURES
other objects such as transmitters and lighthouses
TransportType
Available types of transport.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
Functions related to vehicles.
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
Functions related to (drawing on) viewports.
Functions related to water (management)
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd,...
void ClearNeighbourNonFloodingStates(TileIndex tile)
Clear non-flooding state of the tiles around a tile.
bool HasTileWaterGround(Tile t)
Checks whether the tile has water at the ground.
bool IsTileOnWater(Tile t)
Tests if the tile was built on water.
WaterClass
classes of water (for WATER_TILE_CLEAR water tile type).
@ WATER_CLASS_CANAL
Canal.
@ WATER_CLASS_INVALID
Used for industry tiles on land (also for oilrig if newgrf says so).
WaterClass GetWaterClass(Tile t)
Get the water class at a tile.
bool IsDockingTile(Tile t)
Checks whether the tile is marked as a dockling tile.
bool IsWaterTile(Tile t)
Is it a water tile with plain water?
void InvalidateWaterRegion(TileIndex tile)
Marks the water region that tile is part of as invalid.
Handles dividing the water in the map into regions to assist pathfinding.
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
Window functions not directly related to making/drawing windows.
@ WC_TOWN_AUTHORITY
Town authority; Window numbers:
@ WC_COMPANY
Company view; Window numbers: