OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
38 if (dest != 0)
return false;
64 default:
return false;
148 if (!Goal::IsValidGoalDestination(g->
company, type, dest))
return CMD_ERROR;
250 static_assert(
sizeof(uint32_t) >=
sizeof(
CompanyID));
252 static_assert(
sizeof(uint32_t) >=
sizeof(
ClientID));
268 uint min_buttons = (type == GQT_QUESTION ? 1 : 0);
309 Game::NewEvent(
new ScriptEventGoalQuestionAnswer(uniqueid, (ScriptCompany::CompanyID)(uint8_t)
_current_company, (ScriptGoal::QuestionButton)(1 << button)));
@ OWNER_DEITY
The object is owned by a superuser / goal script.
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.
@ INVALID_COMPANY
An invalid company.
bool _network_server
network-server is active
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Owner
Enum for all companies/owners.
Tindex index
Index of this pool item.
@ GT_TILE
Destination is a tile.
@ GT_STORY_PAGE
Destination is a story page.
GoalTypeID dst
Index of type.
@ WC_GOALS_LIST
Goals list; Window numbers:
CommandCost CmdGoalQuestionAnswer(DoCommandFlag flags, uint16_t uniqueid, uint8_t button)
Reply to a goal question.
@ DC_EXEC
execute the given command
DoCommandFlag
List of flags for a command.
CommandCost CmdRemoveGoal(DoCommandFlag flags, GoalID goal)
Remove a goal.
static NetworkClientInfo * GetByClientID(ClientID client_id)
Return the CI given it's client-identifier.
@ GT_COMPANY
Destination is a company.
Common return value for all commands.
@ GT_INDUSTRY
Destination is an industry.
static void NewEvent(class ScriptEvent *event)
Queue a new event for a Game Script.
void ShowGoalQuestion(uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question)
Display a goal question.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
uint32_t GoalTypeID
Contains either tile, industry ID, town ID, company ID, or story page ID.
bool _networking
are we in networking mode?
CommandCost CmdSetGoalText(DoCommandFlag flags, GoalID goal, const std::string &text)
Update goal text of a goal.
uint16_t GoalID
ID of a goal.
CommandCost CmdSetGoalDestination(DoCommandFlag flags, GoalID goal, GoalType type, GoalTypeID dest)
Update goal destination of a goal.
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
ClientID _network_own_client_id
Our client identifier.
CommandCost CmdSetGoalCompleted(DoCommandFlag flags, GoalID goal, bool completed)
Update completed state of a goal.
CompanyID _current_company
Company currently doing an action.
Base class for all pools.
std::string progress
Progress text of the goal.
ClientID
'Unique' identifier to be given to clients
static size_t GetNumItems()
Returns number of valid items in the pool.
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.
@ GT_NONE
Destination is not linked.
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_TOWN
Destination is a town.
static const uint32_t GOAL_QUESTION_BUTTON_COUNT
Amount of buttons available.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
CommandCost CmdGoalQuestion(DoCommandFlag flags, uint16_t uniqueid, uint32_t target, bool is_client, uint32_t button_mask, GoalQuestionType type, const std::string &text)
Ask a goal related question.
CommandCost CmdSetGoalProgress(DoCommandFlag flags, GoalID goal, const std::string &text)
Update progress text of a goal.
std::string text
Text of the goal.
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.
@ WC_MAIN_TOOLBAR
Main toolbar (the long bar at the top); Window numbers:
GoalType
Types of goal destinations.
GoalType type
Type of the goal.