Class that handles some goal related functions. More...
#include <script_goal.hpp>
Public Types | |
enum | GoalID { GOAL_INVALID = ::INVALID_GOALTYPE } |
The goal IDs. More... | |
enum | GoalType { GT_NONE = ::GT_NONE, GT_TILE = ::GT_TILE, GT_INDUSTRY = ::GT_INDUSTRY, GT_TOWN = ::GT_TOWN, GT_COMPANY = ::GT_COMPANY } |
Goal types that can be given to a goal. More... | |
Static Public Member Functions | |
static bool | IsValidGoal (GoalID goal_id) |
Check whether this is a valid goalID. | |
static GoalID | New (ScriptCompany::CompanyID company, Text *goal, GoalType type, uint32 destination) |
Create a new goal. | |
static bool | Remove (GoalID goal_id) |
Remove a goal from the list. |
Class that handles some goal related functions.
game
Definition at line 23 of file script_goal.hpp.
enum ScriptGoal::GoalID |
The goal IDs.
Definition at line 28 of file script_goal.hpp.
enum ScriptGoal::GoalType |
Goal types that can be given to a goal.
GT_NONE |
Destination is not linked. |
GT_TILE |
Destination is a tile. |
GT_INDUSTRY |
Destination is an industry. |
GT_TOWN |
Destination is a town. |
GT_COMPANY |
Destination is a company. |
Definition at line 36 of file script_goal.hpp.
bool ScriptGoal::IsValidGoal | ( | GoalID | goal_id | ) | [static] |
Check whether this is a valid goalID.
goal_id | The GoalID to check. |
Definition at line 26 of file script_goal.cpp.
Referenced by Remove().
ScriptGoal::GoalID ScriptGoal::New | ( | ScriptCompany::CompanyID | company, | |
Text * | goal, | |||
GoalType | type, | |||
uint32 | destination | |||
) | [static] |
Create a new goal.
company | The company to create the goal for, or ScriptCompany::COMPANY_INVALID for all. | |
goal | The goal to add to the GUI (can be either a raw string, or a ScriptText object). | |
type | The type of the goal. | |
destination | The destination of the type type. |
Definition at line 31 of file script_goal.cpp.
References CMD_CREATE_GOAL, ScriptCompany::COMPANY_INVALID, ScriptObject::DoCommand(), EnforcePrecondition, Text::GetEncodedText(), GOAL_INVALID, GT_COMPANY, GT_INDUSTRY, GT_NONE, GT_TILE, GT_TOWN, ScriptIndustry::IsValidIndustry(), ScriptMap::IsValidTile(), ScriptTown::IsValidTown(), ScriptCompany::ResolveCompanyID(), and StrEmpty().
bool ScriptGoal::Remove | ( | GoalID | goal_id | ) | [static] |
Remove a goal from the list.
goal_id | The goal to remove. |
Definition at line 49 of file script_goal.cpp.
References CMD_REMOVE_GOAL, ScriptObject::DoCommand(), EnforcePrecondition, and IsValidGoal().