OpenTTD Source  20241109-master-g5e4f8db7d6
goal_cmd.h File Reference

Command definitions related to goals. More...

#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 CmdSetGoalDestination (DoCommandFlag flags, GoalID goal, GoalType type, GoalTypeID dest)
 Update goal destination of 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_t uniqueid, uint32_t target, bool is_client, uint32_t button_mask, GoalQuestionType type, const std::string &text)
 Ask a goal related question. More...
 
CommandCost CmdGoalQuestionAnswer (DoCommandFlag flags, uint16_t uniqueid, uint8_t button)
 Reply to a goal question. More...
 

Detailed Description

Command definitions related to goals.

Definition in file goal_cmd.h.

Function Documentation

◆ CmdCreateGoal()

◆ CmdGoalQuestion()

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.

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 248 of file goal.cpp.

◆ CmdGoalQuestionAnswer()

CommandCost CmdGoalQuestionAnswer ( DoCommandFlag  flags,
uint16_t  uniqueid,
uint8_t  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 292 of file goal.cpp.

◆ CmdRemoveGoal()

◆ CmdSetGoalCompleted()

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

◆ CmdSetGoalDestination()

CommandCost CmdSetGoalDestination ( DoCommandFlag  flags,
GoalID  goal,
GoalType  type,
GoalTypeID  dest 
)

Update goal destination of a goal.

Parameters
flagstype of operation
goalGoalID to update.
typeGoalType of destination.
destGoalTypeID of destination.
Returns
the cost of this operation or an error

Definition at line 143 of file goal.cpp.

References _current_company, CMD_ERROR, Goal::company, DC_EXEC, Goal::dst, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, and Goal::type.

◆ CmdSetGoalProgress()

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

◆ CmdSetGoalText()

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