Solution to user campaigns causing instability
Moderator: Forum Moderators
Solution to user campaigns causing instability
Following is an email I sent to the developer's mailing list. I think it might be of interest to developers of campaigns...
We obviously can't ship 1.0 with the possibility of users connecting to the campaign server, and downloading campaigns which makes it impossible for them to start the game.
I have thus come up with a solution that I'm currently testing, that I think works nicely, and simply. It reduces the generality of the engine slightly, but I think it gives us the stability we need for a 1.0 release.
The solution is to remove the {~data/campaigns} reference in the game.cfg file. Instead, the game now reads data/game.cfg and then reads each file in the pattern ~data/campaigns/*.cfg, and appends them to the config object. If a user campaign has any errors, it will not be loaded, and an error message will be displayed stating that the campaign didn't load properly. A failed user campaign load will not affect caching, and thus the message about a campaign not loading will only be displayed again the next time the user changes their data.
The top-level [units] tags are merged together into one [units] tag immediately after reading all the files. Also, since the user campaigns are now read after the core unit definitions, user campaigns cannot redefine core units. There are plenty of alternatives for user campaigns that want to make units that appear identical to core units yet somehow act differently.
Any comments on this change are welcome. I plan to check it in shortly if my testing goes well.
David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Re: Solution to user campaigns causing instability
Well, the advance_from patch will come in handy now.Dave wrote:Also, since the user campaigns are now read after the core unit definitions, user campaigns cannot redefine core units. There are plenty of alternatives for user campaigns that want to make units that appear identical to core units yet somehow act differently.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
Re: Solution to user campaigns causing instability
... it was added in 0.9.2.scott wrote:Well, the advance_from patch will come in handy now.
This quote is not attributable to Antoine de Saint-Exupéry.
This is a bad and evil change.
It makes it so you can't put [+units] inside an '#ifdef CAMPAIGN_{CAMPAIGN_NAME}' and still have certain stuff work correctly. Specifically, it causes both the campaign description and the difficulty descriptions to not work. This is clear whenever you play either of my UMCs in their current shape on the campaign server using most recent CVS.
Strangely enough, though, it doesn't appear to have stopped the units from being loaded in-game.

It makes it so you can't put [+units] inside an '#ifdef CAMPAIGN_{CAMPAIGN_NAME}' and still have certain stuff work correctly. Specifically, it causes both the campaign description and the difficulty descriptions to not work. This is clear whenever you play either of my UMCs in their current shape on the campaign server using most recent CVS.
Strangely enough, though, it doesn't appear to have stopped the units from being loaded in-game.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
Probably a bug.turin wrote:This is a bad and evil change.![]()
It makes it so you can't put [+units] inside an '#ifdef CAMPAIGN_{CAMPAIGN_NAME}' and still have certain stuff work correctly. Specifically, it causes both the campaign description and the difficulty descriptions to not work. This is clear whenever you play either of my UMCs in their current shape on the campaign server using most recent CVS.
Strangely enough, though, it doesn't appear to have stopped the units from being loaded in-game.
What I hate is this prohibition of replacing core units, which will break a LOT of saves in FtF.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom