Would it be possible to move out common functions used in campaign scripts?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
widelands |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
For a while it has annoyed me that some campaign maps show new objectives and similar parts of the text with proper headlines while others merely use dashes (--). Especially since the dashes cause most of the victory messages to end up spanning two lines. So since some of the maps are able to do this I looked into how I could update the other maps to use this as well.
From what I found it looks like the methods for turning things into headlines consists of a small set of identical functions defined in each campaign text. So the easist fix would be to just copy it over and start using it elsewhere. However, this would make it a lot harder to change the different places it is used if we at some point decide to for instance change headline color. So I wondered if it would be possible to place these methods related to campaign story text somewhere common where all the campaings can reach them? That way, they could be defined in one place, the campaigns all import them so they can use them, and in case of any changes they only need to be performed in one place. I realize this would make all campaigns depend on external scripting, but if it ships as part of the Widelands install, this should not be a problem. I would suggest placing these files in a subdirectory of campaigns, such as widelands/
Related branches
- SirVer: Approve
- GunChleoc: Needs Resubmitting
-
Diff: 3705 lines (+983/-1187)30 files modifiedcampaigns/atl01.wmf/scripting/init.lua (+80/-0)
campaigns/atl01.wmf/scripting/mission_thread.lua (+14/-114)
campaigns/atl01.wmf/scripting/starting_conditions.lua (+27/-0)
campaigns/atl01.wmf/scripting/texts.lua (+219/-342)
campaigns/bar01.wmf/scripting/mission_thread.lua (+1/-1)
campaigns/bar01.wmf/scripting/texts.lua (+142/-165)
campaigns/bar02.wmf/scripting/init.lua (+0/-10)
campaigns/bar02.wmf/scripting/mission_thread.lua (+35/-33)
campaigns/bar02.wmf/scripting/texts.lua (+125/-134)
campaigns/dummy.wmf/scripting/init.lua (+2/-1)
campaigns/emp01.wmf/scripting/init.lua (+0/-10)
campaigns/emp01.wmf/scripting/mission_thread.lua (+20/-19)
campaigns/emp01.wmf/scripting/texts.lua (+61/-84)
campaigns/emp02.wmf/scripting/init.lua (+1/-12)
campaigns/emp02.wmf/scripting/mission_thread.lua (+32/-29)
campaigns/emp02.wmf/scripting/texts.lua (+69/-84)
maps/MP Scenarios/Island Hopping.wmf/scripting/multiplayer_init.lua (+3/-2)
maps/MP Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua (+1/-1)
maps/MP Scenarios/Smugglers.wmf/scripting/smuggling.lua (+5/-3)
maps/MP Scenarios/Smugglers.wmf/scripting/texts.lua (+28/-42)
maps/Plateau.wmf/scripting/init.lua (+11/-10)
maps/Plateau.wmf/scripting/texts.lua (+44/-75)
scripting/coroutine.lua (+3/-2)
scripting/format_scenario.lua (+14/-1)
scripting/messages.lua (+7/-7)
scripting/ui.lua (+27/-0)
scripting/win_condition_functions.lua (+4/-1)
scripting/win_conditions/02_collectors.lua (+3/-2)
scripting/win_conditions/03_territorial_lord.lua (+3/-2)
scripting/win_conditions/03_territorial_time.lua (+2/-1)
Changed in widelands: | |
milestone: | none → build19-rc1 |
Changed in widelands: | |
assignee: | GunChleoc (gunchleoc) → nobody |
Changed in widelands: | |
status: | Fix Committed → Fix Released |
I agree. This was something that I didn't like from the first moment on. I found a common file for formatting. Have a look at /scripting/ formatting. lua. These functions are similar or equal to those used in the "well-formatted campaigns". However they should be used in all the campaigns to create some unitary look. I could get started with it in the next days.