Add bounded aircraft control and verify current packaged runtime closure
This commit is contained in:
@@ -53,14 +53,15 @@ class ActionSource:
|
||||
source=action_path.read_text()
|
||||
return source[source.index('class ERR_PrisonDoorAction'):source.index('class ERR_TuneRadioAction')]
|
||||
action=ActionSource()
|
||||
availability=body(action,'override bool CanBePerformedScript(').replace('override ','').replace('ERR_GameMode mode = ERR_GameMode.Get();','ERR_GameMode* mode = ERR_GameMode::Get();').replace('mode.Phase()','mode->Phase()').replace('ERR_Phase.PRISON','ERR_Phase::PRISON').replace('super.CanBePerformedScript','Base::CanBePerformedScript')
|
||||
availability=body(action,'override bool CanBePerformedScript(').replace('override ','').replace('ERR_GameMode mode = ERR_GameMode.Get();','ERR_GameMode* mode = ERR_GameMode::Get();').replace('mode.Phase()','mode->Phase()').replace('ERR_Phase.PRISON','ERR_Phase::PRISON').replace('super.CanBePerformedScript','Base::CanBePerformedScript').replace('string.Empty','std::string{}')
|
||||
execution=body(action,'override void PerformAction(').replace('override ','').replace('super.PerformAction','Base::PerformAction')
|
||||
run('''#include <cassert>
|
||||
#include <string>
|
||||
using IEntity=int;
|
||||
enum ERR_Phase {PREPARING,PRISON,RADIO_SEARCH,RADIO_DEFENCE};
|
||||
struct ERR_GameMode {int phase=PRISON;static ERR_GameMode* current;static ERR_GameMode* Get(){return current;}int Phase(){return phase;}};
|
||||
ERR_GameMode* ERR_GameMode::current=nullptr;
|
||||
struct Base {bool nativeAllowed=true;int calls=0,owner=0,user=0;bool CanBePerformedScript(IEntity){return nativeAllowed;}void PerformAction(IEntity pOwnerEntity,IEntity pUserEntity){calls++;owner=pOwnerEntity;user=pUserEntity;}};
|
||||
struct Base {void SetCannotPerformReason(const std::string&){}bool nativeAllowed=true;int calls=0,owner=0,user=0;bool CanBePerformedScript(IEntity){return nativeAllowed;}void PerformAction(IEntity pOwnerEntity,IEntity pUserEntity){calls++;owner=pOwnerEntity;user=pUserEntity;}};
|
||||
struct Action:Base {
|
||||
'''+availability+execution+'''
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user