You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thinking ordered scripts, previously scripts were recorded with an unordered map from script name to enabled state, however this doesn't guarantee maintained order, causing script failure. An ordered map wouldn't work because it requires a comparison function, when the order needs to be determined by insertion order. It seems like it may as well be handled with a vector of script names, while maintaining the unordered map of script name to enabled state. However, each script name is recorded twice there (this is also what I have implemented, it works). Probably the best solution would be to just keep a vector of script name and a vector of corresponding enabled states, however the efficiency of searching goes from log of size to linear with position, which seems bad, but nothing should ever have enough scripts on it to be a problem, is what I imagine. Feels like I'm missing the optimal solution.
/// Enables or dsiableds the script at the given path on this MO.
@@ -1235,7 +1235,8 @@ namespace RTE {
1235
1235
};
1236
1236
1237
1237
std::string m_ScriptObjectName; //!< The name of this object for script usage.
1238
-
std::unordered_map<std::string, bool> m_AllLoadedScripts; //!< A map of script paths to the enabled state of the given script.
1238
+
std::vector<std::string> m_AllLoadedScripts; //!< A map of script paths to the enabled state of the given script.
1239
+
std::unordered_map<std::string, bool> m_EnabledScripts; //!< A map of script paths to the enabled state of the given script.
1239
1240
std::unordered_map<std::string, std::vector<LuaFunction>> m_FunctionsAndScripts; //!< A map of function names to vectors of Lua functions. Used to maintain script execution order and avoid extraneous Lua calls.
1240
1241
1241
1242
volatilebool m_RequestedSyncedUpdate; //!< For optimisation purposes, scripts explicitly request a synced update if they want one.
0 commit comments