mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Less ugly API declarations
This commit is contained in:
@@ -25,35 +25,13 @@ namespace events
|
||||
|
||||
VCMI_REGISTER_SCRIPT_API(ObjectVisitStartedProxy, "events.ObjectVisitStarted");
|
||||
|
||||
const std::vector<ObjectVisitStartedProxy::RegType> ObjectVisitStartedProxy::REGISTER = {};
|
||||
|
||||
const std::vector<ObjectVisitStartedProxy::CustomRegType> ObjectVisitStartedProxy::REGISTER_CUSTOM =
|
||||
{
|
||||
{
|
||||
"subscribeBefore",
|
||||
&SubscriptionRegistryProxy<ObjectVisitStartedProxy>::subscribeBefore,
|
||||
true
|
||||
},
|
||||
{
|
||||
"subscribeAfter",
|
||||
&SubscriptionRegistryProxy<ObjectVisitStartedProxy>::subscribeAfter,
|
||||
true
|
||||
},
|
||||
{
|
||||
"getPlayer",
|
||||
LuaMethodWrapper<ObjectVisitStarted, PlayerColor(ObjectVisitStarted:: *)()const, &ObjectVisitStarted::getPlayer>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"getHero",
|
||||
LuaMethodWrapper<ObjectVisitStarted, ObjectInstanceID(ObjectVisitStarted:: *)()const, &ObjectVisitStarted::getHero>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"getObject",
|
||||
LuaMethodWrapper<ObjectVisitStarted, ObjectInstanceID(ObjectVisitStarted:: *)()const, &ObjectVisitStarted::getObject>::invoke,
|
||||
false
|
||||
},
|
||||
{"subscribeBefore", &SubscriptionRegistryProxy<ObjectVisitStartedProxy>::subscribeBefore, true},
|
||||
{"subscribeAfter", &SubscriptionRegistryProxy<ObjectVisitStartedProxy>::subscribeAfter,true},
|
||||
{"getPlayer", LuaMethodWrapper<ObjectVisitStarted, decltype(&ObjectVisitStarted::getPlayer), &ObjectVisitStarted::getPlayer>::invoke, false},
|
||||
{"getHero", LuaMethodWrapper<ObjectVisitStarted, decltype(&ObjectVisitStarted::getHero), &ObjectVisitStarted::getHero>::invoke, false},
|
||||
{"getObject", LuaMethodWrapper<ObjectVisitStarted, decltype(&ObjectVisitStarted::getObject), &ObjectVisitStarted::getObject>::invoke, false},
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ class ObjectVisitStartedProxy : public OpaqueWrapper<ObjectVisitStarted, ObjectV
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<ObjectVisitStarted, ObjectVisitStartedProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,26 +27,6 @@ using ::events::ApplyDamage;
|
||||
|
||||
VCMI_REGISTER_SCRIPT_API(ApplyDamageProxy, "events.ApplyDamage");
|
||||
|
||||
const std::vector<ApplyDamageProxy::RegType> ApplyDamageProxy::REGISTER =
|
||||
{
|
||||
{
|
||||
"getInitalDamage",
|
||||
LuaCallWrapper<ApplyDamage>::createFunctor(&ApplyDamage::getInitalDamage)
|
||||
},
|
||||
{
|
||||
"getDamage",
|
||||
LuaCallWrapper<ApplyDamage>::createFunctor(&ApplyDamage::getDamage)
|
||||
},
|
||||
{
|
||||
"setDamage",
|
||||
LuaCallWrapper<ApplyDamage>::createFunctor(&ApplyDamage::setDamage)
|
||||
},
|
||||
{
|
||||
"getTarget",
|
||||
LuaCallWrapper<ApplyDamage>::createFunctor(&ApplyDamage::getTarget)
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<ApplyDamageProxy::CustomRegType> ApplyDamageProxy::REGISTER_CUSTOM =
|
||||
{
|
||||
{
|
||||
@@ -58,7 +38,28 @@ const std::vector<ApplyDamageProxy::CustomRegType> ApplyDamageProxy::REGISTER_CU
|
||||
"subscribeAfter",
|
||||
&SubscriptionRegistryProxy<ApplyDamageProxy>::subscribeAfter,
|
||||
true
|
||||
}
|
||||
},
|
||||
{
|
||||
"getInitalDamage",
|
||||
LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getInitalDamage), &ApplyDamage::getInitalDamage>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"getDamage",
|
||||
LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getDamage), &ApplyDamage::getDamage>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"setDamage",
|
||||
LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::setDamage), &ApplyDamage::setDamage>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"getTarget",
|
||||
LuaMethodWrapper<ApplyDamage, decltype(&ApplyDamage::getTarget), &ApplyDamage::getTarget>::invoke,
|
||||
false
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ class ApplyDamageProxy : public OpaqueWrapper<::events::ApplyDamage, ApplyDamage
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<::events::ApplyDamage, ApplyDamageProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace events
|
||||
{
|
||||
//No methods here, just an empty metatable for type safety.
|
||||
VCMI_REGISTER_CORE_SCRIPT_API(EventBusProxy, "EventBus");
|
||||
const std::vector<EventBusProxy::RegType> EventBusProxy::REGISTER = {};
|
||||
const std::vector<EventBusProxy::CustomRegType> EventBusProxy::REGISTER_CUSTOM = {};
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ class EventBusProxy : public OpaqueWrapper<::events::EventBus, EventBusProxy>
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<::events::EventBus, EventBusProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ VCMI_REGISTER_SCRIPT_API(GameResumedProxy, "events.GameResumed");
|
||||
VCMI_REGISTER_SCRIPT_API(PlayerGotTurnProxy, "events.PlayerGotTurn");
|
||||
VCMI_REGISTER_SCRIPT_API(TurnStartedProxy, "events.TurnStarted");
|
||||
|
||||
const std::vector<GameResumedProxy::RegType> GameResumedProxy::REGISTER = {};
|
||||
|
||||
const std::vector<GameResumedProxy::CustomRegType> GameResumedProxy::REGISTER_CUSTOM =
|
||||
{
|
||||
{
|
||||
@@ -46,18 +44,6 @@ const std::vector<GameResumedProxy::CustomRegType> GameResumedProxy::REGISTER_CU
|
||||
}
|
||||
};
|
||||
|
||||
const std::vector<PlayerGotTurnProxy::RegType> PlayerGotTurnProxy::REGISTER =
|
||||
{
|
||||
{
|
||||
"getPlayer",
|
||||
LuaCallWrapper<PlayerGotTurn>::createFunctor(&PlayerGotTurn::getPlayerIndex)
|
||||
},
|
||||
{
|
||||
"setPlayer",
|
||||
LuaCallWrapper<PlayerGotTurn>::createFunctor(&PlayerGotTurn::setPlayerIndex)
|
||||
},
|
||||
};
|
||||
|
||||
const std::vector<PlayerGotTurnProxy::CustomRegType> PlayerGotTurnProxy::REGISTER_CUSTOM =
|
||||
{
|
||||
{
|
||||
@@ -69,11 +55,19 @@ const std::vector<PlayerGotTurnProxy::CustomRegType> PlayerGotTurnProxy::REGISTE
|
||||
"subscribeAfter",
|
||||
&SubscriptionRegistryProxy<PlayerGotTurnProxy>::subscribeAfter,
|
||||
true
|
||||
}
|
||||
},
|
||||
{
|
||||
"getPlayer",
|
||||
LuaMethodWrapper<PlayerGotTurn, decltype(&PlayerGotTurn::getPlayerIndex), &PlayerGotTurn::getPlayerIndex>::invoke,
|
||||
false
|
||||
},
|
||||
{
|
||||
"setPlayer",
|
||||
LuaMethodWrapper<PlayerGotTurn, decltype(&PlayerGotTurn::setPlayerIndex), &PlayerGotTurn::setPlayerIndex>::invoke,
|
||||
false
|
||||
},
|
||||
};
|
||||
|
||||
const std::vector<TurnStartedProxy::RegType> TurnStartedProxy::REGISTER = {};
|
||||
|
||||
const std::vector<TurnStartedProxy::CustomRegType> TurnStartedProxy::REGISTER_CUSTOM =
|
||||
{
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ class GameResumedProxy : public OpaqueWrapper<::events::GameResumed, GameResumed
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<::events::GameResumed, GameResumedProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
@@ -35,7 +34,6 @@ class PlayerGotTurnProxy : public OpaqueWrapper<::events::PlayerGotTurn, PlayerG
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<::events::PlayerGotTurn, PlayerGotTurnProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
@@ -43,7 +41,6 @@ class TurnStartedProxy : public OpaqueWrapper<::events::TurnStarted, TurnStarted
|
||||
{
|
||||
public:
|
||||
using Wrapper = OpaqueWrapper<::events::TurnStarted, TurnStartedProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace events
|
||||
{
|
||||
//No methods here, just an empty metatable for type safety.
|
||||
VCMI_REGISTER_CORE_SCRIPT_API(EventSubscriptionProxy, "EventSubscription");
|
||||
const std::vector<EventSubscriptionProxy::RegType> EventSubscriptionProxy::REGISTER = {};
|
||||
const std::vector<EventSubscriptionProxy::CustomRegType> EventSubscriptionProxy::REGISTER_CUSTOM = {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ class EventSubscriptionProxy : public UniqueOpaqueWrapper<::events::EventSubscri
|
||||
{
|
||||
public:
|
||||
using Wrapper = UniqueOpaqueWrapper<::events::EventSubscription, EventSubscriptionProxy>;
|
||||
static const std::vector<typename Wrapper::RegType> REGISTER;
|
||||
static const std::vector<typename Wrapper::CustomRegType> REGISTER_CUSTOM;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user