|
OpenTTD Source 20251104-master-g3befbdd52f
|
Handling of goals. More...
#include "stdafx.h"#include "company_func.h"#include "industry.h"#include "town.h"#include "window_func.h"#include "goal_base.h"#include "core/pool_func.hpp"#include "game/game.hpp"#include "command_func.h"#include "company_base.h"#include "story_base.h"#include "string_func.h"#include "gui.h"#include "network/network.h"#include "network/network_base.h"#include "network/network_func.h"#include "goal_cmd.h"#include "safeguards.h"Go to the source code of this file.
Functions | |
| std::tuple< CommandCost, GoalID > | CmdCreateGoal (DoCommandFlags flags, CompanyID company, GoalType type, GoalTypeID dest, const EncodedString &text) |
| Create a new goal. | |
| CommandCost | CmdRemoveGoal (DoCommandFlags flags, GoalID goal) |
| Remove a goal. | |
| CommandCost | CmdSetGoalDestination (DoCommandFlags flags, GoalID goal, GoalType type, GoalTypeID dest) |
| Update goal destination of a goal. | |
| CommandCost | CmdSetGoalText (DoCommandFlags flags, GoalID goal, const EncodedString &text) |
| Update goal text of a goal. | |
| CommandCost | CmdSetGoalProgress (DoCommandFlags flags, GoalID goal, const EncodedString &text) |
| Update progress text of a goal. | |
| CommandCost | CmdSetGoalCompleted (DoCommandFlags flags, GoalID goal, bool completed) |
| Update completed state of a goal. | |
| 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. | |
| CommandCost | CmdGoalQuestionAnswer (DoCommandFlags flags, uint16_t uniqueid, uint8_t button) |
| Reply to a goal question. | |
Variables | |
| GoalPool | _goal_pool ("Goal") |
Handling of goals.
Definition in file goal.cpp.
| std::tuple< CommandCost, GoalID > CmdCreateGoal | ( | DoCommandFlags | flags, |
| CompanyID | company, | ||
| GoalType | type, | ||
| GoalTypeID | dest, | ||
| const EncodedString & | text | ||
| ) |
Create a new goal.
| flags | type of operation |
| company | Company for which this goal is. |
| type | GoalType of destination. |
| dest | GoalTypeID of destination. |
| text | Text of the goal. |
Definition at line 78 of file goal.cpp.
References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::CanAllocateItem(), CMD_ERROR, Goal::company, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_GOALS_LIST, and WC_MAIN_TOOLBAR.
| 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.
| flags | type of operation |
| uniqueid | Unique ID to use for this question. |
| target | Company or client for which this question is. |
| is_client | Question target: false - company, true - client. |
| button_mask | Buttons of the question. |
| type | Question type. |
| text | Text of the question. |
Definition at line 243 of file goal.cpp.
References _current_company, _local_company, _network_own_client_id, _network_server, CMD_ERROR, CountBits(), Execute, NetworkClientInfo::GetByClientID(), GOAL_QUESTION_BUTTON_COUNT, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, ShowGoalQuestion(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().
| CommandCost CmdGoalQuestionAnswer | ( | DoCommandFlags | flags, |
| uint16_t | uniqueid, | ||
| uint8_t | button | ||
| ) |
Reply to a goal question.
| flags | type of operation |
| uniqueid | Unique ID to use for this question. |
| button | Button the company pressed |
Definition at line 287 of file goal.cpp.
References _current_company, _local_company, _network_server, _networking, CloseWindowById(), CMD_ERROR, Execute, GOAL_QUESTION_BUTTON_COUNT, Game::NewEvent(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_GOAL_QUESTION.
| CommandCost CmdRemoveGoal | ( | DoCommandFlags | flags, |
| GoalID | goal | ||
| ) |
Remove a goal.
| flags | type of operation |
| goal | GoalID to remove. |
Definition at line 109 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::GetNumItems(), InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), WC_GOALS_LIST, and WC_MAIN_TOOLBAR.
| CommandCost CmdSetGoalCompleted | ( | DoCommandFlags | flags, |
| GoalID | goal, | ||
| bool | completed | ||
| ) |
Update completed state of a goal.
| flags | type of operation |
| goal | GoalID to update. |
| completed | completed state of goal. |
Definition at line 213 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Goal::completed, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::Get(), InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_GOALS_LIST.
| CommandCost CmdSetGoalDestination | ( | DoCommandFlags | flags, |
| GoalID | goal, | ||
| GoalType | type, | ||
| GoalTypeID | dest | ||
| ) |
Update goal destination of a goal.
| flags | type of operation |
| goal | GoalID to update. |
| type | GoalType of destination. |
| dest | GoalTypeID of destination. |
Definition at line 138 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Goal::dst, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and Goal::type.
| CommandCost CmdSetGoalProgress | ( | DoCommandFlags | flags, |
| GoalID | goal, | ||
| const EncodedString & | text | ||
| ) |
Update progress text of a goal.
| flags | type of operation |
| goal | GoalID to update. |
| text | Progress text of the goal. |
Definition at line 187 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::Get(), InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, Goal::progress, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and WC_GOALS_LIST.
| CommandCost CmdSetGoalText | ( | DoCommandFlags | flags, |
| GoalID | goal, | ||
| const EncodedString & | text | ||
| ) |
Update goal text of a goal.
| flags | type of operation |
| goal | GoalID to update. |
| text | Text of the goal. |
Definition at line 160 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::Get(), InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Goal::text, and WC_GOALS_LIST.