25 #include "table/strings.h" 34 { 1621, PAL_NONE }, { 1587, PAL_NONE }, { 1656, PAL_NONE }, { 1579, PAL_NONE },
35 { 1607, PAL_NONE }, { 1593, PAL_NONE }, { 1614, PAL_NONE }, { 1586, PAL_NONE },
36 { 1663, PAL_NONE }, { 1677, PAL_NONE }, { 1691, PAL_NONE }, { 1705, PAL_NONE },
37 { 1711, PAL_NONE }, { 1746, PAL_NONE }, { 1753, PAL_NONE }, { 1732, PAL_NONE },
38 { 1739, PAL_NONE }, { 1718, PAL_NONE }, { 1725, PAL_NONE }, { 1760, PAL_NONE },
39 { 1838, PAL_NONE }, { 1844, PAL_NONE }, { 1866, PAL_NONE }, { 1871, PAL_NONE },
40 { 1899, PAL_NONE }, { 1935, PAL_NONE }, { 1928, PAL_NONE }, { 1915, PAL_NONE },
41 { 1887, PAL_NONE }, { 1908, PAL_NONE }, { 1824, PAL_NONE }, { 1943, PAL_NONE },
42 { 1950, PAL_NONE }, { 1957, PALETTE_TO_GREEN }, { 1964, PALETTE_TO_RED }, { 1971, PAL_NONE },
43 { 1978, PAL_NONE }, { 1985, PALETTE_TO_RED, }, { 1992, PALETTE_TO_PALE_GREEN }, { 1999, PALETTE_TO_YELLOW }, { 2006, PALETTE_TO_RED }
77 for (
int i = this->base; i < this->base + this->
count; i++) {
78 if (i >= (
int)
lengthof(tree_sprites))
return size;
80 size.width = max<int>(size.width, 2 * max<int>(this_size.width, -offset.x));
81 size.height = max<int>(size.height, max<int>(this_size.height, -offset.y));
99 if (_game_mode != GM_EDITOR) {
154 DoCommandP(end_tile, this->tree_to_plant, start_tile,
174 static const NWidgetPart _nested_build_trees_widgets[] = {
242 _nested_build_trees_widgets,
lengthof(_nested_build_trees_widgets)
245 void ShowBuildTreesToolbar()
248 AllocateWindowDescFront<BuildTreesWindow>(&_build_trees_desc, 0);
ViewportDragDropSelectionProcess
Drag and drop selection process, or, what to do with an area of land when you've selected it...
GameSettings _settings_game
Game settings of a running game or the scenario editor.
const PalSpriteID tree_sprites[]
Tree Sprites with their palettes.
Definition of stuff that is very close to a company, like the company struct itself.
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
The user has dragged over the map when the tile highlight mode has been set.
ResizeInfo resize
Resize information.
byte landscape
the landscape we're currently in
High level window description.
void PlaceTreesRandomly()
Place some trees randomly.
Combination of a palette sprite and a 'real' sprite.
virtual void OnInit()
Initialize the window data.
Map accessors for tree tiles.
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
The user is dragging over the map when the tile highlight mode has been set.
Functions, definitions and such used only by the GUI.
virtual void OnPlaceObjectAbort()
The user cancelled a tile highlight mode that has been set.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Data structure for an opened window.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
This window is used for construction; close it whenever changing company.
uint16 count
Number of different trees available.
SoundSettings sound
sound effect settings
Sprites to use and how to display them for tree tiles.
uint16 base
Base tree number used for drawing the window.
ViewportPlaceMethod
Viewport place method (type of highlighted area and placed objects)
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
Functions related to the gfx engine.
ClientSettings _settings_client
The current settings for this game.
Definition of base types and functions in a cross-platform compatible way.
A number of safeguards to prevent using unsafe methods.
rectangle (stations, depots, ...)
TreeType tree_to_plant
Tree number to plant, TREE_INVALID for a random tree.
virtual void OnClick(Point pt, int widget, int click_count)
A click with the left mouse button has been made on the window.
Offset at bottom to draw the frame rectangular area.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
void VpStartPlaceSizing(TileIndex tile, ViewportPlaceMethod method, ViewportDragDropSelectionProcess process)
highlighting tiles while only going over them with the mouse
#define lengthof(x)
Return the length of an fixed size array.
Functions related to sound.
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
Selects tiles while dragging.
Build trees toolbar; Window numbers:
No window, redirects to WC_MAIN_WINDOW.
Functions related to companies.
area of land in X and Y directions
uint32 TileIndex
The index/ID of a Tile.
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
Dimension GetMaxTreeSpriteSize()
Calculate the maximum size of all tree sprites.
bool confirm
Play sound effect on succesful constructions or other actions.
virtual void DrawWidget(const Rect &r, int widget) const
Draw the contents of a nested widget.
Functions related to commands.
Coordinates of a point in 2D.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
TreeType
List of tree types along all landscape types.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
Offset at right to draw the frame rectangular area.
#define CMD_MSG(x)
Used to combine a StringID with the command.
int32 WindowNumber
Number to differentiate different windows of the same class.
GameCreationSettings game_creation
settings used during the creation of a game (map)
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Specification of a rectangle with absolute coordinates of all edges.
WindowNumber window_number
Window number within the window class.
Functions related to tile highlights.
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
Update size and resize step of a widget in the window.
Find a place automatically.
Dimensions (a width and height) of a rectangle in 2D.
Offset at left to draw the frame rectangular area.
This file contains all sprite-related enums and defines.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
virtual void OnPlaceObject(Point pt, TileIndex tile)
The user clicked some place on the map when a tile highlight mode has been set.