Patching REPLAY_THEME in a custom theme

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Patching REPLAY_THEME in a custom theme

Post by josteph »

I've been looking into packaging my custom theme as an add-on for 1.15.

Apparently, if I write an addon that uses a [theme] tag, that actually works to make the theme available.

However, my theme relies on this change to the REPLAY_THEME macro in _initial.cfg:

Code: Select all

diff --git a/data/themes/_initial.cfg b/data/themes/_initial.cfg
index ed07787996d..78975b1b925 100644
--- a/data/themes/_initial.cfg
+++ b/data/themes/_initial.cfg
@@ -406,7 +423,7 @@
                 id=replay-panel
                 image=themes/editor/classic/toolbar.png
                 ref=top-panel
-                rect="=,+0,+842,+41"
+                rect="182,+0,+660,+41"
                 xanchor=left
                 yanchor=fixed
             [/panel]
@@ -414,7 +431,7 @@
         [change]
             id=main-map
             ref=top-panel
-            rect="=,+41,+842,768"
+            rect="182,+41,+660,768"
         [/change]
         [add]
             [action]
Obviously an addon can't just patch macros in core like this. Nor do I want to duplicate the entire definition of REPLAY_THEME into the addon. What options do I have?

I have tried adding [+replay][change]id=replay-panel/id=main-map tags in the theme's file after the use of {REPLAY_THEME}, instead of the _initial.cfg patch, but haven't got that to work. (edit: maybe due to #3944?)
Post Reply