Skip to content

Commit

Permalink
wmlunits: Allow detecting wmlunits with the __WMLUNITS__ preprocessor…
Browse files Browse the repository at this point in the history
… symbol

This is an experimental attempt at enabling add-ons to either
voluntarily decrease unit tree bloat by defining a single campaign for
wmlunits (for multi-campaign add-ons), or disable unit tree generation
altogether by emiting an #error early.
  • Loading branch information
irydacea committed Aug 15, 2017
1 parent 5a675ec commit 5985754
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions data/tools/wmlunits
Expand Up @@ -272,15 +272,15 @@ def list_contents():
info["version"] = "mainline"
info["parsed"] = "false"

parse("{core}{multiplayer/eras.cfg}", "SKIP_CORE")
parse("{core}{multiplayer/eras.cfg}", "__WMLUNITS__,SKIP_CORE")
info["eras"] = list_eras(batchlist, "mainline")

# Fake mainline campaign to have an overview of the mainline units
info["campaigns"] = []
append(info["campaigns"], "mainline", "", name="Units", domain="wesnoth-help")

if not options.addons_only:
parse("{core}{campaigns}", "SKIP_CORE")
parse("{core}{campaigns}", "__WMLUNITS__,SKIP_CORE")
info["campaigns"] += list_campaigns(batchlist, "mainline")

addons = []
Expand Down Expand Up @@ -324,7 +324,7 @@ def list_contents():
continue
info["parsed"] = False
info["dependencies"] = get_dependencies(addon)
parse("{core}{multiplayer}{multiplayer/eras.cfg}{~add-ons}", "MULTIPLAYER,SKIP_CORE")
parse("{core}{multiplayer}{multiplayer/eras.cfg}{~add-ons}", "__WMLUNITS__,MULTIPLAYER,SKIP_CORE")
info["eras"] = list_eras(batchlist, addon)
info["campaigns"] = list_campaigns(batchlist, addon)
info["version"] = version
Expand Down Expand Up @@ -378,15 +378,15 @@ def process_campaign_or_era(addon, cid, define, batchlist):
wesnoth.add_units("mainline")

if define == "MULTIPLAYER":
wesnoth.parser.parse_text("{core}{multiplayer}{multiplayer/eras.cfg}{~add-ons}", "MULTIPLAYER,SKIP_CORE")
wesnoth.parser.parse_text("{core}{multiplayer}{multiplayer/eras.cfg}{~add-ons}", "__WMLUNITS__,MULTIPLAYER,SKIP_CORE")
wesnoth.add_units(cid)
else:
if addon == "mainline":
if cid != "mainline":
wesnoth.parser.parse_text("{core}{campaigns}", "SKIP_CORE,NORMAL," + define)
wesnoth.parser.parse_text("{core}{campaigns}", "__WMLUNITS__,SKIP_CORE,NORMAL," + define)
wesnoth.add_units(cid)
else:
wesnoth.parser.parse_text("{core}{~add-ons}", "SKIP_CORE," + define)
wesnoth.parser.parse_text("{core}{~add-ons}", "__WMLUNITS__,SKIP_CORE," + define)
wesnoth.add_units(cid)

if addon == "mainline" and cid == "mainline":
Expand Down

0 comments on commit 5985754

Please sign in to comment.