static */
| 51 | } |
| 52 | |
| 53 | /* static */ GoalID ScriptGoal::New(ScriptCompany::CompanyID company, Text *goal, GoalType type, SQInteger destination) |
| 54 | { |
| 55 | ScriptObjectRef counter(goal); |
| 56 | |
| 57 | EnforceDeityMode(GOAL_INVALID); |
| 58 | EnforcePrecondition(GOAL_INVALID, goal != nullptr); |
| 59 | EncodedString text = goal->GetEncodedText(); |
| 60 | EnforcePreconditionEncodedText(GOAL_INVALID, text); |
| 61 | EnforcePrecondition(GOAL_INVALID, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID); |
| 62 | EnforcePrecondition(GOAL_INVALID, IsValidGoalDestination(company, type, destination)); |
| 63 | |
| 64 | if (!ScriptObject::Command<CMD_CREATE_GOAL>::Do(&ScriptInstance::DoCommandReturnGoalID, ScriptCompany::FromScriptCompanyID(company), (::GoalType)type, destination, text)) return GOAL_INVALID; |
| 65 | |
| 66 | /* In case of test-mode, we return GoalID 0 */ |
| 67 | return GoalID::Begin(); |
| 68 | } |
| 69 | |
| 70 | /* static */ bool ScriptGoal::Remove(GoalID goal_id) |
| 71 | { |
nothing calls this directly
no test coverage detected