Replace ScriptInterface::Call* with new ScriptFunction functions

Finishes work started in f3aedf88a6.
This removes the boost-CPP function wrappers entirely, in favour of pure
templated code in FunctionWrapper.h
The Call* functions were already heavily templated, so there is nothing
really new here. I just use tag dispatch to reduce the number of
overloads slightly.

The new functions do not need the script interface, only the script
request.

Differential Revision: https://code.wildfiregames.com/D3912
This was SVN commit r25354.
This commit is contained in:
wraitii
2021-05-01 14:04:53 +00:00
parent d9748173c7
commit d46a417748
20 changed files with 164 additions and 446 deletions
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -23,6 +23,7 @@
#include "ps/CLogger.h"
#include "ps/Game.h"
#include "ps/Profile.h"
#include "scriptinterface/FunctionWrapper.h"
#include "simulation2/system/TurnManager.h"
class CCmpCommandQueue : public ICmpCommandQueue
@@ -109,14 +110,14 @@ public:
for (size_t i = 0; i < localCommands.size(); ++i)
{
bool ok = scriptInterface.CallFunctionVoid(global, "ProcessCommand", localCommands[i].player, localCommands[i].data);
bool ok = ScriptFunction::CallVoid(rq, global, "ProcessCommand", localCommands[i].player, localCommands[i].data);
if (!ok)
LOGERROR("Failed to call ProcessCommand() global script function");
}
for (size_t i = 0; i < commands.size(); ++i)
{
bool ok = scriptInterface.CallFunctionVoid(global, "ProcessCommand", commands[i].player, commands[i].data);
bool ok = ScriptFunction::CallVoid(rq, global, "ProcessCommand", commands[i].player, commands[i].data);
if (!ok)
LOGERROR("Failed to call ProcessCommand() global script function");
}