Add: GSCompanyMode::IsValid and IsDeity, and precondition enforcement helpers
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#define SCRIPT_ERROR_HPP
|
||||
|
||||
#include "script_object.hpp"
|
||||
#include "script_companymode.hpp"
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
@@ -47,6 +48,20 @@
|
||||
return returnval; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to enforce the precondition that the company mode is valid.
|
||||
* @param returnval The value to return on failure.
|
||||
*/
|
||||
#define EnforceCompanyModeValid(returnval) \
|
||||
EnforcePrecondition(returnval, ScriptCompanyMode::IsValid())
|
||||
|
||||
/**
|
||||
* Helper to enforce the precondition that we are in a deity mode.
|
||||
* @param returnval The value to return on failure.
|
||||
*/
|
||||
#define EnforceDeityMode(returnval) \
|
||||
EnforcePrecondition(returnval, ScriptCompanyMode::IsDeity())
|
||||
|
||||
/**
|
||||
* Class that handles all error related functions.
|
||||
* @api ai game
|
||||
|
Reference in New Issue
Block a user