bugBattle for Wesnoth - Bugs: bug #20853, In scenarios, if a side starts...

Show feedback again

bug #20853: In scenarios, if a side starts with gold=0 it is 100

Submitted by:  None
Submitted on:  Tue May 28 15:49:15 2013  
Category: BugSeverity: 5 - Blocker
Priority: 5 - NormalItem Group: WML
Status: FixedPrivacy: Public
Assigned to: Anja K <ayne>Originator Email: -unavailable-
Open/Closed: ClosedRelease: 1.11.4
Operating System: Windows 7

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Sun Jun 2 17:04:01 2013, comment #13:

I just committed the fix to GitHub. If you're getting compiling Wesnoth yourself you can just pull the updated file from there.
Negative gold in savegames worked in my tests as well.

Anja K <ayne>
Project MemberIn charge of this item.
Sun Jun 2 06:22:34 2013, comment #12:

After posting the bug, and you've seemed to have fixed it (cool!), could someone be so kind to explain how I apply the patch?

I have been looking allmost everywhere, but I just can't find where the nessesary lines need to be inserted (or where the gold default is set anyway).

Thank you!

By the way, have you tested the behavior of minus gold in savegames? (prepatch minus gold is set to 100 if you load)

Sun Jun 2 05:44:46 2013, comment #11:

Hm, it seems I messed up my testing completely and posted something untrue yesterday. Let me try this again...


  • gold=abc (invalid number) -> sticks to 0 gold.
  • gold=0 -> sticks to 0 gold.
  • gold= (empty string) -> defaults to 100 gold.
  • gold attribute missing -> defaults to 100 gold.

Git master with file #18040 applied

  • gold=abc (invalid number ) -> sticks to 0 gold.
  • gold=0 -> sticks to 0 gold.
  • gold= (empty string) -> sticks to 0 gold.
  • gold attribute missing -> defaults to 100 gold.

So the only remaining mismatched behavior would be the handling of the empty string on master.

Ignacio R. Morelle <shadowmaster>
Project Administrator
Sun Jun 2 05:13:31 2013, comment #10:

It should only set the default when the gold attribute is missing, not when it's explicitly set to 0. It worked that way when I tested it, could you give me an example where it didn't work for you?
I'm not sure what will happen if gold= is set to the empty string, I will have to check that later.

Anja K <ayne>
Project MemberIn charge of this item.
Sat Jun 1 11:59:34 2013, comment #9:

The patch fixes both bugs.

Unfortunately, it also affects the case where the scenario designer has explicitly set gold=0 for a side in the scenario WML. On 1.10.x and 1.11.0 through 1.11.2 this was handled as one would expect -- the default of 100 was only set when the gold= attribute was missing or set to the empty string.

Of course, with this patch it is possible again to just set a side's gold to zero on a prestart event using the [modify_side] action and not have it reset to 100 after reloading from a saved game, but if the former behavior I mentioned above could be restored that would be nice.

Ignacio R. Morelle <shadowmaster>
Project Administrator
Sat Jun 1 10:28:44 2013, comment #8:

I attached a patch that fixes bug #20734 without causing this one. Could you please confirm that everything works as expected?

(file #18040)

Anja K <ayne>
Project MemberIn charge of this item.
Sat Jun 1 08:54:37 2013, comment #7:

Confirmed that reverting commit 0d2eeeeeefaa8fa87d2861d0ed1011574fda5495 "Adding default starting gold to team creation" by Ayne eliminates this bug. The commit in question fixes bug #20734.

Assigning to Ayne.

Ignacio R. Morelle <shadowmaster>
Project Administrator
Fri May 31 21:42:23 2013, comment #6:

Confirmed the last point about mid-scenario saved-games on git master as of this writing. This can seriously break campaign balance, so I am promoting it to blocker.

Ignacio R. Morelle <shadowmaster>
Project Administrator
Fri May 31 15:18:11 2013, comment #5:

Just wanted to note, it also happens in savegames. If a side has 0 or minus gold, it is reseted to 100 goldpieces as soon as you load the game.

Wed May 29 20:49:24 2013, comment #4:

This was just some help for a developer trying to fix this bug.
Not directed at you and nothing you need to understand.

Anonymissimus <anonymissimus>
Project Member
Tue May 28 22:23:50 2013, comment #3:

Sorry, Anonymissimus I didn't understand a word you said :-\

Especially the part with the seemingly random numbers (do you mean a file in the cache folder? -don't have one with these numbers)


Tue May 28 18:37:38 2013, comment #2:

wrong commit hash...


Anonymissimus <anonymissimus>
Project Member
Tue May 28 18:36:01 2013, comment #1:

Perhaps it was introduced by commit by0d2eeeeeefaa8fa87d2861d0ed1011574fda5495
as I didn't notice it in my campaign recently (about 08.04.2013, with probably a recent trunk built) but now I do.

Anonymissimus <anonymissimus>
Project Member
Tue May 28 15:49:15 2013, original submission:

Hi folks!
Found a bug in release 1.11.4 . Haven't found it reported, so here I go:

Acrose all scenarios if a side starts with gold=0 in the side tab, it is set to 100 in the game. It mixes up some Ai behavior, insofar that he recrutes even if he shouldn't yet do so, because of scenario setting. (Bug doesn't happen in 1.10.6)

Because this happens in all scenarios, I think it has to do something with the more deeper levels of programming (with which I have no clue).

If anybody has a quickfix other than setting gold=1 in the scenario side tab, I'd be happy to hear.

Excuse my english,



(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #18040:  default_gold.patch added by ayne (750B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by ayne (Updated the item)
  • -unavailable- added by shadowmaster (Posted a comment)
  • -unavailable- added by anonymissimus (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Jun 27 10:04:46 2013shadowmasterOpen/ClosedOpen=>Closed
    Sun Jun 2 17:04:01 2013ayneStatusNone=>Fixed
    Sat Jun 1 10:28:44 2013ayneAttached File-=>Added default_gold.patch, #18040
    Sat Jun 1 08:54:37 2013shadowmasterAssigned toNone=>ayne
    Fri May 31 21:42:23 2013shadowmasterSeverity3 - Normal=>5 - Blocker
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup