mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Remove two silently-shadowed code paths
Both were invisible: no error, no warning, just logic that never ran. Console.lua no longer defines the global RunMacro. Core.lua installs a hook of the same name and loads first, so this file's name-only wrapper replaced it. What that cost, whenever SuperMacro was absent: macro *index* arguments stopped working (Blizzard's RunMacro accepts an index or a name, and ExecuteMacroByName takes only a name), the delegation to SuperMacro went away, so did the fallback to the saved Blizzard original when a macro would not resolve, and so did clearing the stop/skip flags at the start of a top-level run -- which is what lets /stopmacro, /skipmacro and /firstaction work across parent/child macro boundaries. With SuperMacro loaded, Compatibility/SuperMacro.lua reassigns the global afterwards anyway, so this definition only ever did harm. SlashCmdList.RUNMACRO keeps using ExecuteMacroByName, which is correct there. Utility.lua drops ClearReactiveProcOnCast and the wrappers it existed for, which tried to clear a reactive proc when its spell was cast. Three independent bugs meant it never worked: the wrappers guarded on CleveRoids.Frame, which Core.lua creates after this file loads, so the guard was always false and neither wrapper installed; the UNIT_CASTEVENT wrapper tested arg2 == "START" when that signature is (caster, target, action, spell_id, cast_time), so it compared the target; and both passed a spell ID to a lookup keyed by spell name. They also allocated an arg table per call and unpack()'d it. Deleting is behaviour-preserving. Swept for both patterns: no other duplicate global definitions, and no remaining file-scope use of CleveRoids.Frame in a file that loads before Core.lua.
This commit is contained in:
+9
-8
@@ -358,14 +358,15 @@ SlashCmdList.RUNMACRO = function(msg)
|
||||
return CleveRoids.ExecuteMacroByName(CleveRoids.Trim(msg))
|
||||
end
|
||||
|
||||
-- Global RunMacro wrapper for user convenience (delegates to namespaced internal function)
|
||||
-- This pattern ensures internal logic uses CleveRoids.ExecuteMacroByName and won't break
|
||||
-- if another addon overwrites the global RunMacro
|
||||
-- NOTE: When SuperMacro is also loaded, Compatibility/SuperMacro.lua redirects this to
|
||||
-- SuperMacro_RunMacro so macros go through RunLine (where CRM commands are intercepted)
|
||||
function RunMacro(name)
|
||||
return CleveRoids.ExecuteMacroByName(name)
|
||||
end
|
||||
-- The global RunMacro is installed by Core.lua, which loads before this file. Do not
|
||||
-- redefine it here: Core's hook accepts a macro index as well as a name (Blizzard's
|
||||
-- RunMacro takes either), delegates to SuperMacro when that is driving execution,
|
||||
-- falls back to the saved Blizzard original when a macro will not resolve, and clears
|
||||
-- the stop/skip flags at the start of a top-level run, which is what lets /stopmacro,
|
||||
-- /skipmacro and /firstaction work across parent/child macro boundaries. A plain
|
||||
-- name-only wrapper here silently replaced all of that.
|
||||
-- When SuperMacro is loaded, Compatibility/SuperMacro.lua redirects the global to
|
||||
-- SuperMacro_RunMacro so macros go through RunLine (where CRM commands are intercepted).
|
||||
|
||||
SLASH_RETARGET1 = "/retarget"
|
||||
SlashCmdList.RETARGET = function(msg)
|
||||
|
||||
Reference in New Issue
Block a user