Unit appearance causing the game to crash

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by Anonymissimus »

mattsc wrote:Still, this is a bug that should be reported (and hopefully get fixed). Even if the WML is incorrect (I'm not sure that it is), Wesnoth should never crash to desktop on a WML error, as already stated above.
Okay. So, in case revansurik doesn't do it, I hope you feel responsible for this task, since you know most about reproducing it. :P
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Unit appearance causing the game to crash

Post by revansurik »

Ok, so where do I send the bug report?
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
fabi
Inactive Developer
Posts: 1260
Joined: March 21st, 2004, 2:42 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by fabi »

revansurik wrote:Ok, so where do I send the bug report?
http://bugs.wesnoth.org
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: Unit appearance causing the game to crash

Post by trewe »

Code: Select all

    !,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*#enddef
To be precise, the incorrect thing in that line is the second “!“ in the middle. The starting one can stay.

(exclamation marks means in formula wml that the string is reversed, so the above is identical to:

Code: Select all

   [not]
       terrain=Wwf,*^B*,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*
   [/not]
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Unit appearance causing the game to crash

Post by JaMiT »

trewe wrote:(exclamation marks means in formula wml that the string is reversed,
Not exactly. First off, this should not be confused with formulas as special attribute values (the word "formula" is potentially misleading here). Secondly, the exclamation point only reverses the meaning of the string that follows it, not the entire string.

(In particular, these two exclamation points do not cancel each other out completely. The meaning of "terrain=!,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*" is "not fords, nor anything with a bridge, but otherwise include all water, water with a village, swamp human ruins, sunken human ruins, swamps, swamp with a village, and unwalkable terrain". If you remove both exclamation points, fords and bridges get included rather than excluded.)
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Unit appearance causing the game to crash

Post by Anonymissimus »

JaMiT wrote:
trewe wrote:(exclamation marks means in formula wml that the string is reversed,
Not exactly. First off, this should not be confused with formulas as special attribute values (the word "formula" is potentially misleading here).
It isn't formula wml at all, is it ? Just an additional feature of how terrain strings can be passed to the engine.
Secondly, the exclamation point only reverses the meaning of the string that follows it, not the entire string.

(In particular, these two exclamation points do not cancel each other out completely. The meaning of "terrain=!,Wwf,*^B*,!,W*,W*^V*,Chs,Chw,S*,S*^V*,Q*" is "not fords, nor anything with a bridge, but otherwise include all water, water with a village, swamp human ruins, sunken human ruins, swamps, swamp with a village, and unwalkable terrain". If you remove both exclamation points, fords and bridges get included rather than excluded.)
This statement is based on interpretation or debugging the code which parses such terrain strings ? (Where is it, I was debugging the bug a bit.)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Unit appearance causing the game to crash

Post by JaMiT »

Anonymissimus wrote:It isn't formula wml at all, is it ? Just an additional feature of how terrain strings can be passed to the engine.
Correct. I was just refraining from bluntly saying "you're wrong" (for once). :)
Anonymissimus wrote:
JaMiT wrote:Secondly, the exclamation point only reverses the meaning of the string that follows it, not the entire string.

(In particular, [example given].)
This statement is based on interpretation or debugging the code which parses such terrain strings ? (Where is it, I was debugging the bug a bit.)
It's based on what the wiki says (under FilterWML -- there is even an example there addressing two exclamation points). I have looked at this a bit, but ran out of time before analyzing how the string is parsed. I think it is done by terrain_matches() in terrain_translation.cpp, though.

If you want to look at that, I can (if I get time -- always an issue these days) focus more on the infinite recursion being triggered. (My initial perusal suggests the terrain string is being misinterpreted AND there is a logical flaw in the recursion. Two problems, one uncovering the other. Not sure about that though.)
User avatar
vinipsmaker
Posts: 4
Joined: July 1st, 2012, 9:27 pm
Contact:

Re: Unit appearance causing the game to crash

Post by vinipsmaker »

JaMiT wrote:[...]

If you want to look at that, I can (if I get time -- always an issue these days) focus more on the infinite recursion being triggered. (My initial perusal suggests the terrain string is being misinterpreted AND there is a logical flaw in the recursion. Two problems, one uncovering the other. Not sure about that though.)
Bug fixed:
https://github.com/wesnoth/wesnoth-old/pull/3

=D
Post Reply