Go to the documentation of this file.
245 uint min_buttons = (type == GQT_QUESTION ? 1 : 0);
286 Game::NewEvent(
new ScriptEventGoalQuestionAnswer(uniqueid, (ScriptCompany::CompanyID)(
byte)
_current_company, (ScriptGoal::QuestionButton)(1 << button)));
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.
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.
@ GT_TILE
Destination is a tile.
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.
CommandCost CmdRemoveGoal(DoCommandFlag flags, GoalID goal)
Remove a goal.
static uint CountBits(T value)
Counts the number of set bits in a variable.
@ 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.
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.
bool _networking
are we in networking mode?
CommandCost CmdSetGoalText(DoCommandFlag flags, GoalID goal, const std::string &text)
Update goal text of a goal.
@ GT_NONE
Destination is not linked.
ClientID _network_own_client_id
Our client identifier.
CommandCost CmdSetGoalCompleted(DoCommandFlag flags, GoalID goal, bool completed)
Update completed state of a goal.
char * progress
Progress text of the goal.
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16 uniqueid, uint16 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text)
Ask a goal related question.
CompanyID _current_company
Company currently doing an action.
Base class for all pools.
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.
uint32 GoalTypeID
Contains either tile, industry ID, town ID or company ID (or INVALID_GOALTYPE)
static const GoalID INVALID_GOAL
Constant representing a non-existing goal.
@ 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.
CommandCost CmdGoalQuestionAnswer(DoCommandFlag flags, uint16 uniqueid, uint8 button)
Reply to a goal question.
@ 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.
CommandCost CmdSetGoalProgress(DoCommandFlag flags, GoalID goal, const std::string &text)
Update progress text of a goal.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
@ INVALID_COMPANY
An invalid company.
std::tuple< CommandCost, GoalID > CmdCreateGoal(DoCommandFlag flags, CompanyID company, GoalType type, GoalTypeID dest, const std::string &text)
Create a new goal.
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.
char * text
Text of the goal.
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
Display a goal question.