Implement a developer overlay command to change the current player ID (very useful for AI development).

This was SVN commit r13606.
This commit is contained in:
alpha123
2013-07-29 00:53:44 +00:00
parent 53074c7715
commit 20e7d2224a
3 changed files with 59 additions and 20 deletions
+7
View File
@@ -168,6 +168,12 @@ int GetPlayerID(void* UNUSED(cbdata))
return -1;
}
void SetPlayerID(void* UNUSED(cbdata), int id)
{
if (g_Game)
g_Game->SetPlayerID(id);
}
std::wstring GetDefaultPlayerName(void* UNUSED(cbdata))
{
CStr playername;
@@ -685,6 +691,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
// Misc functions
scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor");
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
scriptInterface.RegisterFunction<void, int, &SetPlayerID>("SetPlayerID");
scriptInterface.RegisterFunction<std::wstring, &GetDefaultPlayerName>("GetDefaultPlayerName");
scriptInterface.RegisterFunction<std::wstring, &GetDefaultMPServer>("GetDefaultMPServer");
scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &SaveMPConfig>("SaveMPConfig");