OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
104 _new_goal_id = g->
index;
247 uint16 uniqueid = (uint16)
GB(p1, 0, 16);
253 byte type =
GB(p2, 29, 2);
254 bool is_client =
HasBit(p2, 31);
266 uint min_buttons = (type == GQT_QUESTION ? 1 : 0);
uint32 TileIndex
The index/ID of a Tile.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
Struct about goals, current and completed.
static Titem * Get(size_t index)
Returns Titem with given index.
CommandCost CmdSetGoalCompleted(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update completed state of a goal.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
@ GT_INDUSTRY
Destination is an industry.
bool _network_server
network-server is active
Tindex index
Index of this pool item.
CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update goal text of a goal.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
@ GT_TILE
Destination is a tile.
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Reply to a goal question.
GoalTypeID dst
Index of type.
@ WC_GOALS_LIST
Goals list; Window numbers:
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
DoCommandFlag
List of flags for a command.
static uint CountBits(T value)
Counts the number of set bits in a variable.
CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Create a new goal.
@ GT_TOWN
Destination is a town.
static NetworkClientInfo * GetByClientID(ClientID client_id)
Return the CI given it's client-identifier.
Common return value for all commands.
CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a goal.
ClientID
'Unique' identifier to be given to clients
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
bool _networking
are we in networking mode?
@ GT_NONE
Destination is not linked.
ClientID _network_own_client_id
Our client identifier.
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Ask a goal related question.
char * progress
Progress text of the goal.
CompanyID _current_company
Company currently doing an action.
Base class for all pools.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
static const uint32 GOAL_QUESTION_BUTTON_COUNT
Amount of buttons available.
static size_t GetNumItems()
Returns number of valid items in the pool.
@ GT_COMPANY
Destination is a company.
bool completed
Is the goal completed or not?
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
CompanyID company
Goal is for a specific company; INVALID_COMPANY if it is global.
@ WC_GOAL_QUESTION
Popup with a set of buttons, designed to ask the user a question from a GameScript.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
@ GT_STORY_PAGE
Destination is a story page.
@ OWNER_DEITY
The object is owned by a superuser / goal script.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
char * stredup(const char *s, const char *last)
Create a duplicate of the given string.
@ INVALID_COMPANY
An invalid company.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
GoalType
Types of goal destinations.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
uint16 GoalID
ID of a goal.
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
GoalType type
Type of the goal.
CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Update progress text of a goal.
char * text
Text of the goal.
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
Display a goal question.