OpenTTD
|
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 "safeguards.h"
Go to the source code of this file.
Functions | |
CommandCost | CmdCreateGoal (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Create a new goal. | |
CommandCost | CmdRemoveGoal (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Remove a goal. | |
CommandCost | CmdSetGoalText (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Update goal text of a goal. | |
CommandCost | CmdSetGoalProgress (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Update progress text of a goal. | |
CommandCost | CmdSetGoalCompleted (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Update completed state of a goal. | |
CommandCost | CmdGoalQuestion (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Ask a goal related question. | |
CommandCost | CmdGoalQuestionAnswer (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) |
Reply to a goal question. |
Variables | |
GoalID | _new_goal_id |
GoalPool | _goal_pool ("Goal") |
Handling of goals.
Definition in file goal.cpp.
CommandCost CmdCreateGoal | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Create a new goal.
tile | unused. |
flags | type of operation |
p1 | various bitstuffed elements
|
p2 | GoalTypeID of destination. |
text | Text of the goal. |
Definition at line 46 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, GB(), 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, InvalidateWindowClassesData(), InvalidateWindowData(), 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<&_story_page_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), IsValidTile(), OWNER_DEITY, Goal::progress, stredup(), StrEmpty(), Goal::text, Goal::type, WC_GOALS_LIST, and WC_MAIN_TOOLBAR.
CommandCost CmdGoalQuestion | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Ask a goal related question.
tile | unused. |
flags | type of operation |
p1 | various bitstuffed elements
|
p2 | Buttons of the question. |
text | Text of the question. |
Definition at line 242 of file goal.cpp.
References _current_company, _local_company, CMD_ERROR, CountBits(), DC_EXEC, GB(), GOAL_QUESTION_BUTTON_COUNT, GOAL_QUESTION_TYPE_COUNT, INVALID_COMPANY, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), OWNER_DEITY, ShowGoalQuestion(), and StrEmpty().
CommandCost CmdGoalQuestionAnswer | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Reply to a goal question.
tile | unused. |
flags | type of operation |
p1 | Unique ID to use for this question. |
p2 | Button the company pressed |
text | Text of the question. |
Definition at line 271 of file goal.cpp.
References _current_company, _local_company, _network_server, _networking, CMD_ERROR, DC_EXEC, DeleteWindowById(), GOAL_QUESTION_BUTTON_COUNT, Game::NewEvent(), OWNER_DEITY, and WC_GOAL_QUESTION.
CommandCost CmdRemoveGoal | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Remove a goal.
tile | unused. |
flags | type of operation |
p1 | GoalID to remove. |
p2 | unused. |
text | unused. |
Definition at line 119 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, DC_EXEC, 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 >::GetNumItems(), INVALID_COMPANY, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, WC_GOALS_LIST, and WC_MAIN_TOOLBAR.
CommandCost CmdSetGoalCompleted | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Update completed state of a goal.
tile | unused. |
flags | type of operation |
p1 | GoalID to update. |
p2 | completed state. If goal is completed, set to 1, otherwise 0. |
text | unused |
Definition at line 212 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, Goal::completed, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::Get(), INVALID_COMPANY, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, and WC_GOALS_LIST.
CommandCost CmdSetGoalProgress | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Update progress text of a goal.
tile | unused. |
flags | type of operation |
p1 | GoalID to update. |
p2 | unused |
text | Progress text of the goal. |
Definition at line 179 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, DC_EXEC, free(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::Get(), INVALID_COMPANY, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, Goal::progress, stredup(), StrEmpty(), and WC_GOALS_LIST.
CommandCost CmdSetGoalText | ( | TileIndex | tile, |
DoCommandFlag | flags, | ||
uint32 | p1, | ||
uint32 | p2, | ||
const char * | text | ||
) |
Update goal text of a goal.
tile | unused. |
flags | type of operation |
p1 | GoalID to update. |
p2 | unused |
text | Text of the goal. |
Definition at line 149 of file goal.cpp.
References _current_company, CMD_ERROR, Goal::company, DC_EXEC, free(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::Get(), INVALID_COMPANY, InvalidateWindowClassesData(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_goal_pool >::IsValidID(), OWNER_DEITY, stredup(), StrEmpty(), Goal::text, and WC_GOALS_LIST.