Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#2622 closed enhancement (fixed)

[PATCH] Gui moddability - splitup of XML files and loading multiple scripts at once

Reported by: sanderd17 Owned by: sanderd17
Priority: Should Have Milestone: Alpha 17
Component: UI & Simulation Keywords: patch
Cc: leper Patch:

Description

For moddability, it's best to have small files. When changes to a file happens, conflicts are easier to resolve.

So instead of having one big XML file, with the entire in-game GUI, it would be better to have it split up in multiple files. With this patch, an object can have an "include" attribute, which contains a path to an XML file. And the children are loaded from that XML file rather than from the big GUI file.

In the patch, I prepared the diplomacy window in this way. Other portions should be split off too for sure.

The second part of the patch allows you to load all scripts in a directory at once. Instead of naming every one of them. This allows modders to just include extra scripts to modify behaviour.

This second part is also needed for victory conditions. Where we want mods being able to add extra victory conditions. So we need to load the entire directory of possible victory conditions, and execute the checks defined on them.

Attachments (3)

gui_moddability.diff (13.2 KB) - added by sanderd17 6 years ago.
gui_moddability.2.diff (23.2 KB) - added by sanderd17 6 years ago.
Fixed whitespace, added recursion check, don't reload the same script twice, added comments and warnings
gui_mod_fix.patch (11.9 KB) - added by leper 6 years ago.
Fixes issues. Refactors some of the code too. One TODO, dunno if that is worth fixing.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by sanderd17

Attachment: gui_moddability.diff added

Changed 6 years ago by sanderd17

Attachment: gui_moddability.2.diff added

Fixed whitespace, added recursion check, don't reload the same script twice, added comments and warnings

comment:1 Changed 6 years ago by sanderd17

Owner: set to sanderd17
Resolution: fixed
Status: newclosed

In 15330:

Improve gui moddability by allowing to load an entire directory of scripts at once, and being able to split up big gui XML files. Fixes #2622

comment:2 Changed 6 years ago by sanderd17

Keywords: review removed

Changed 6 years ago by leper

Attachment: gui_mod_fix.patch added

Fixes issues. Refactors some of the code too. One TODO, dunno if that is worth fixing.

comment:3 Changed 6 years ago by sanderd17

In 15353:

Fix for r15330. Refs #2622

comment:4 Changed 5 years ago by leper

In 16703:

Fix some issues found by static analysis.

Actually abort in case of recursive includes again. Refs #2622.

Note: See TracTickets for help on using tickets.