1.13 Mac CTD on attack logic (?)

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:

1.13 Mac CTD on attack logic (?)

Postby Jozrael » September 15th, 2017, 11:08 pm

Playing "2p/3p vs Survival" on 1.13.

2p_-_vs_Survival-Auto-Save7.gz
(42.3 KiB) Downloaded 10 times
^ this autosave at start of turn will not crash.

2p_-_vs_Survival_Turn_7.gz
(42.49 KiB) Downloaded 10 times
^ this save after moving one unit a couple hexes will crash.

Dump.txt
(68.37 KiB) Downloaded 15 times
^ Quick glance looks like attack logic. Haven't debugged wesnoth before, so not sure where I should be starting/what I can ignore.
Jozrael
Forum Regular
 
Posts: 1032
Joined: June 2nd, 2006, 1:39 pm
Location: NJ, USA.

Re: 1.13 Mac CTD on attack logic (?)

Postby Jozrael » September 25th, 2017, 10:42 pm

Subsequently it didn't crash, but threw an error in https://github.com/wesnoth/wesnoth/blob ... target.lua on line 23, target was nil. So get_closest_enemy didn't properly return. Is wesnoth coding practice here to catch nils or ensure they're never sent?
Jozrael
Forum Regular
 
Posts: 1032
Joined: June 2nd, 2006, 1:39 pm
Location: NJ, USA.

Re: 1.13 Mac CTD on attack logic (?)

Postby mattsc » September 26th, 2017, 1:28 am

Jozrael wrote:Is wesnoth coding practice here to catch nils or ensure they're never sent?

I'm not sure whether we have a strict coding practice for this, but I think it makes sense that ai_helper.get_closest_enemy() returns nil if it does not find such an enemy. And apparently I thought so 4 years ago too, as I clearly intentionally changed the behavior to that effect here.

So that line 23 should be changed to
if target then
I can change that, or if you want you can put in a change pull request since you found the error. Let me know and thanks for finding this.

PS: Btw, I read 'CTD' in the title as 'chance to die'. Took me a while to figure out what you were talking about. :P
mattsc
 
Posts: 984
Joined: October 13th, 2010, 6:14 pm
Location: Wandering, mostly aimlessly

Re: 1.13 Mac CTD on attack logic (?)

Postby Jozrael » October 2nd, 2017, 9:46 pm

https://github.com/wesnoth/wesnoth/pull/2072 submitted. Unsure if it should be changed to the the line in the comment.
Jozrael
Forum Regular
 
Posts: 1032
Joined: June 2nd, 2006, 1:39 pm
Location: NJ, USA.

Re: 1.13 Mac CTD on attack logic (?)

Postby mattsc » October 4th, 2017, 3:13 am

Merged. Thanks for finding the problem and fixing it. (And I replied to your question in the comments of the pull request.)
mattsc
 
Posts: 984
Joined: October 13th, 2010, 6:14 pm
Location: Wandering, mostly aimlessly


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests