Index: build/premake/premake5.lua =================================================================== --- build/premake/premake5.lua +++ build/premake/premake5.lua @@ -818,7 +818,9 @@ source_dirs = { "tools/atlas/GameInterface", - "tools/atlas/GameInterface/Handlers" + "tools/atlas/GameInterface/Handlers", + "tools/atlas/EditorInterface", + "tools/atlas/EditorInterface/scripting" } extern_libs = { "boost", Index: source/gui/Scripting/ScriptFunctions.cpp =================================================================== --- source/gui/Scripting/ScriptFunctions.cpp +++ source/gui/Scripting/ScriptFunctions.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -41,6 +41,7 @@ #include "scriptinterface/ScriptInterface.h" #include "simulation2/scripting/JSInterface_Simulation.h" #include "soundmanager/scripting/JSInterface_Sound.h" +#include "tools/atlas/EditorInterface/scripting/JSInterface_Editor.h" /* * This file defines a set of functions that are available to GUI scripts, to allow @@ -73,4 +74,5 @@ JSI_UserReport::RegisterScriptFunctions(rq); JSI_VFS::RegisterScriptFunctions_ReadWriteAnywhere(rq); JSI_VisualReplay::RegisterScriptFunctions(rq); + JSI_Editor::RegisterScriptFunctions(rq); } Index: source/ps/Game.h =================================================================== --- source/ps/Game.h +++ source/ps/Game.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -151,6 +151,16 @@ { return m_IsVisualReplay; } /** + * Get m_IsEditorGame. + * + * @return bool the value of m_IsEditorGame. + **/ + inline bool IsEditorGame() const + { + return m_IsEditorGame; + } + + /** * Get the pointer to the game world object. * * @return CWorld * the value of m_World. @@ -220,6 +230,8 @@ bool m_IsVisualReplay; std::istream* m_ReplayStream; u32 m_FinalReplayTurn; + + bool m_IsEditorGame; // true if the game is for use the editor }; extern CGame *g_Game; Index: source/ps/Game.cpp =================================================================== --- source/ps/Game.cpp +++ source/ps/Game.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -78,6 +78,7 @@ m_ViewedPlayerID(-1), m_IsSavedGame(false), m_IsVisualReplay(false), + m_IsEditorGame(false), m_ReplayStream(NULL) { // TODO: should use CDummyReplayLogger unless activated by cmd-line arg, perhaps? @@ -229,6 +230,9 @@ LOGERROR("GameSpeed could not be parsed."); } + if (Script::HasProperty(rq, attribs, "editorType")) + m_IsEditorGame = true; + LDR_BeginRegistering(); RegMemFun(m_Simulation2, &CSimulation2::ProgressiveLoad, L"Simulation init", 1000);