1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Less ugly API declarations

This commit is contained in:
AlexVinS
2021-02-16 17:07:30 +03:00
parent ec6f7b88fe
commit 6d245a7821
59 changed files with 693 additions and 827 deletions

View File

@ -24,34 +24,29 @@ namespace netpacks
VCMI_REGISTER_SCRIPT_API(BattleLogMessageProxy, "netpacks.BattleLogMessage");
const std::vector<BattleLogMessageProxy::RegType> BattleLogMessageProxy::REGISTER =
{
{
"addText",
&BattleLogMessageProxy::addText
},
{
"toNetpackLight",
&PackForClientProxy<BattleLogMessageProxy>::toNetpackLight
},
};
const std::vector<BattleLogMessageProxy::CustomRegType> BattleLogMessageProxy::REGISTER_CUSTOM =
{
{"new", &Wrapper::constructor, true}
{"new", &Wrapper::constructor, true},
{"addText", &BattleLogMessageProxy::addText, false},
{"toNetpackLight",&PackForClientProxy<BattleLogMessageProxy>::toNetpackLight, false}
};
int BattleLogMessageProxy::addText(lua_State * L, std::shared_ptr<BattleLogMessage> object)
int BattleLogMessageProxy::addText(lua_State * L)
{
LuaStack S(L);
std::string text;
std::shared_ptr<BattleLogMessage> object;
if(S.tryGet(1, text))
if(S.tryGet(1, object))
{
if(object->lines.empty())
object->lines.emplace_back();
object->lines.back() << text;
std::string text;
if(S.tryGet(2, text))
{
if(object->lines.empty())
object->lines.emplace_back();
object->lines.back() << text;
}
}
return S.retVoid();