OpenTTD Source: src/goal_cmd.h Source File

OpenTTD Source 15.0-RC2

goal_cmd.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef GOAL_CMD_H
11#define GOAL_CMD_H
12
13#include "command_type.h"
14#include "goal_type.h"
15
16std::tuple<CommandCost, GoalID> CmdCreateGoal(DoCommandFlags flags, CompanyID company, GoalType type, GoalTypeID dest, const EncodedString &text);
17 CommandCost CmdRemoveGoal(DoCommandFlags flags, GoalID goal);
18 CommandCost CmdSetGoalDestination(DoCommandFlags flags, GoalID goal, GoalType type, GoalTypeID dest);
19 CommandCost CmdSetGoalText(DoCommandFlags flags, GoalID goal, const EncodedString &text);
20 CommandCost CmdSetGoalProgress(DoCommandFlags flags, GoalID goal, const EncodedString &text);
21 CommandCost CmdSetGoalCompleted(DoCommandFlags flags, GoalID goal, bool completed);
22 CommandCost CmdGoalQuestion(DoCommandFlags flags, uint16_t uniqueid, uint32_t target, bool is_client, uint32_t button_mask, GoalQuestionType type, const EncodedString &text);
23 CommandCost CmdGoalQuestionAnswer(DoCommandFlags flags, uint16_t uniqueid, uint8_t button);
24
25DEF_CMD_TRAIT(CMD_CREATE_GOAL, CmdCreateGoal, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
26DEF_CMD_TRAIT(CMD_REMOVE_GOAL, CmdRemoveGoal, CommandFlag::Deity, CommandType::OtherManagement)
27DEF_CMD_TRAIT(CMD_SET_GOAL_DESTINATION, CmdSetGoalDestination, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
28DEF_CMD_TRAIT(CMD_SET_GOAL_TEXT, CmdSetGoalText, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
29DEF_CMD_TRAIT(CMD_SET_GOAL_PROGRESS, CmdSetGoalProgress, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
30DEF_CMD_TRAIT(CMD_SET_GOAL_COMPLETED, CmdSetGoalCompleted, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
31DEF_CMD_TRAIT(CMD_GOAL_QUESTION, CmdGoalQuestion, CommandFlags({CommandFlag::Deity, CommandFlag::StrCtrl}), CommandType::OtherManagement)
32DEF_CMD_TRAIT(CMD_GOAL_QUESTION_ANSWER, CmdGoalQuestionAnswer, CommandFlag::Deity, CommandType::OtherManagement)
33
34#endif /* GOAL_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EncodedString
Container for an encoded string, created by GetEncodedString.
Definition strings_type.h:98
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
command_type.h
Types related to commands.
CommandType::OtherManagement
@ OtherManagement
Renaming stuff, changing company colours, placing signs, etc.
CommandFlag::Deity
@ Deity
the command may be executed by COMPANY_DEITY
CommandFlag::StrCtrl
@ StrCtrl
the command's string may contain control strings
CMD_GOAL_QUESTION_ANSWER
@ CMD_GOAL_QUESTION_ANSWER
answer(s) to CMD_GOAL_QUESTION
Definition command_type.h:322
CMD_SET_GOAL_DESTINATION
@ CMD_SET_GOAL_DESTINATION
update goal destination of a goal
Definition command_type.h:317
CMD_GOAL_QUESTION
@ CMD_GOAL_QUESTION
ask a goal related question
Definition command_type.h:321
CMD_CREATE_GOAL
@ CMD_CREATE_GOAL
create a new goal
Definition command_type.h:315
CMD_SET_GOAL_COMPLETED
@ CMD_SET_GOAL_COMPLETED
update goal completed status of a goal
Definition command_type.h:320
CMD_SET_GOAL_TEXT
@ CMD_SET_GOAL_TEXT
update goal text of a goal
Definition command_type.h:318
CMD_SET_GOAL_PROGRESS
@ CMD_SET_GOAL_PROGRESS
update goal progress text of a goal
Definition command_type.h:319
CMD_REMOVE_GOAL
@ CMD_REMOVE_GOAL
remove a goal
Definition command_type.h:316
CmdGoalQuestion
CommandCost CmdGoalQuestion(DoCommandFlags flags, uint16_t uniqueid, uint32_t target, bool is_client, uint32_t button_mask, GoalQuestionType type, const EncodedString &text)
Ask a goal related question.
Definition goal.cpp:243
CmdGoalQuestionAnswer
CommandCost CmdGoalQuestionAnswer(DoCommandFlags flags, uint16_t uniqueid, uint8_t button)
Reply to a goal question.
Definition goal.cpp:287
CmdSetGoalProgress
CommandCost CmdSetGoalProgress(DoCommandFlags flags, GoalID goal, const EncodedString &text)
Update progress text of a goal.
Definition goal.cpp:187
CmdRemoveGoal
CommandCost CmdRemoveGoal(DoCommandFlags flags, GoalID goal)
Remove a goal.
Definition goal.cpp:109
CmdCreateGoal
std::tuple< CommandCost, GoalID > CmdCreateGoal(DoCommandFlags flags, CompanyID company, GoalType type, GoalTypeID dest, const EncodedString &text)
Create a new goal.
Definition goal.cpp:78
CmdSetGoalText
CommandCost CmdSetGoalText(DoCommandFlags flags, GoalID goal, const EncodedString &text)
Update goal text of a goal.
Definition goal.cpp:160
CmdSetGoalDestination
CommandCost CmdSetGoalDestination(DoCommandFlags flags, GoalID goal, GoalType type, GoalTypeID dest)
Update goal destination of a goal.
Definition goal.cpp:138
CmdSetGoalCompleted
CommandCost CmdSetGoalCompleted(DoCommandFlags flags, GoalID goal, bool completed)
Update completed state of a goal.
Definition goal.cpp:213
goal_type.h
basic types related to goals
GoalType
GoalType
Types of goal destinations.
Definition goal_type.h:26
GoalTypeID
uint32_t GoalTypeID
Contains either tile, industry ID, town ID, company ID, or story page ID.
Definition goal_type.h:35
PoolID< uint8_t, struct CompanyIDTag, 0xF, 0xFF >