OpenTTD Source  13.2.1
goal_cmd.h File Reference
#include "command_type.h"
#include "goal_type.h"

Go to the source code of this file.

Functions

std::tuple< CommandCost, GoalIDCmdCreateGoal (DoCommandFlag flags, CompanyID company, GoalType type, GoalTypeID dest, const std::string &text)
 Create a new goal. More...
 
CommandCost CmdRemoveGoal (DoCommandFlag flags, GoalID goal)
 Remove a goal. More...
 
CommandCost CmdSetGoalText (DoCommandFlag flags, GoalID goal, const std::string &text)
 Update goal text of a goal. More...
 
CommandCost CmdSetGoalProgress (DoCommandFlag flags, GoalID goal, const std::string &text)
 Update progress text of a goal. More...
 
CommandCost CmdSetGoalCompleted (DoCommandFlag flags, GoalID goal, bool completed)
 Update completed state of a goal. More...
 
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. More...
 
CommandCost CmdGoalQuestionAnswer (DoCommandFlag flags, uint16 uniqueid, uint8 button)
 Reply to a goal question. More...
 

Detailed Description

Command definitions related to goals.

Definition in file goal_cmd.h.

Function Documentation

◆ CmdCreateGoal()

std::tuple<CommandCost, GoalID> CmdCreateGoal ( DoCommandFlag  flags,
CompanyID  company,
GoalType  type,
GoalTypeID  dest,
const std::string &  text 
)

Create a new goal.

Parameters
flagstype of operation
companyCompany for which this goal is.
typeGoalType of destination.
destGoalTypeID of destination.
textText of the goal.
Returns
the cost of this operation or an error

Definition at line 43 of file goal.cpp.

References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::CanAllocateItem(), CMD_ERROR, Goal::company, Goal::completed, DC_EXEC, Goal::dst, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_story_page_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::GetNumItems(), GT_COMPANY, GT_INDUSTRY, GT_NONE, GT_STORY_PAGE, GT_TILE, GT_TOWN, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_COMPANY, INVALID_GOAL, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_story_page_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::IsValidID(), IsValidTile(), OWNER_DEITY, Goal::progress, stredup(), Goal::text, Goal::type, WC_GOALS_LIST, and WC_MAIN_TOOLBAR.

◆ CmdGoalQuestion()

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.

Parameters
flagstype of operation
uniqueidUnique ID to use for this question.
targetCompany or client for which this question is.
is_clientQuestion target: false - company, true - client.
button_maskButtons of the question.
typeQuestion type.
textText of the question.
Returns
the cost of this operation or an error

Definition at line 227 of file goal.cpp.

◆ CmdGoalQuestionAnswer()

CommandCost CmdGoalQuestionAnswer ( DoCommandFlag  flags,
uint16  uniqueid,
uint8  button 
)

Reply to a goal question.

Parameters
flagstype of operation
uniqueidUnique ID to use for this question.
buttonButton the company pressed
Returns
the cost of this operation or an error

Definition at line 269 of file goal.cpp.

References _current_company, _local_company, _network_server, _networking, CloseWindowById(), CMD_ERROR, DC_EXEC, GOAL_QUESTION_BUTTON_COUNT, Game::NewEvent(), OWNER_DEITY, and WC_GOAL_QUESTION.

◆ CmdRemoveGoal()

◆ CmdSetGoalCompleted()

CommandCost CmdSetGoalCompleted ( DoCommandFlag  flags,
GoalID  goal,
bool  completed 
)

◆ CmdSetGoalProgress()

CommandCost CmdSetGoalProgress ( DoCommandFlag  flags,
GoalID  goal,
const std::string &  text 
)

◆ CmdSetGoalText()

CommandCost CmdSetGoalText ( DoCommandFlag  flags,
GoalID  goal,
const std::string &  text 
)