From e4f2898b9111c98c6f9aa9365ea1a0ce3ab1c7b1 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff <timfelgentreff@gmail.com> Date: Tue, 15 Feb 2022 22:31:45 +0100 Subject: [PATCH] expose Randomize map to lua --- src/editor/edmap.cpp | 4 ++++ src/tolua/editor.pkg | 1 + 2 files changed, 5 insertions(+) diff --git a/src/editor/edmap.cpp b/src/editor/edmap.cpp index 5f2d8b498..3a03b7ec2 100644 --- a/src/editor/edmap.cpp +++ b/src/editor/edmap.cpp @@ -417,11 +417,15 @@ void CEditor::CreateRandomMap() const UI.Minimap.Update(); EditorUpdateDisplay(); + + const char oldRandom = TileToolRandom; + TileToolRandom = 1; for (std::tuple<int, int, int> t : RandomTiles) { EditorRandomizeTile(std::get<0>(t), mz / 64 * std::get<1>(t), std::get<2>(t)); UI.Minimap.Update(); EditorUpdateDisplay(); } + TileToolRandom = oldRandom; for (std::tuple<std::string, int, int, int> t : RandomUnits) { EditorRandomizeUnit(std::get<0>(t).c_str(), mz / 64 * std::get<1>(t), std::get<2>(t), std::get<3>(t)); diff --git a/src/tolua/editor.pkg b/src/tolua/editor.pkg index f665bc076..6ebdcb309 100644 --- a/src/tolua/editor.pkg +++ b/src/tolua/editor.pkg @@ -14,6 +14,7 @@ class CEditor const CUnitType *StartUnit; bool WriteCompressedMaps; EditorRunningType Running; + void CreateRandomMap() const; }; extern CEditor Editor;