Random soldier battle animations don´t work

Bug #1738054 reported by Benedikt Straub
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Critical
Unassigned

Bug Description

The init.lua for a soldier contains tables
   attack_success_e = {
      "atk_ok_e",
   },
   evade_success_w = {
      "eva_ok_w",
   },
   die_w = {
      "die_w",
   },
etc. The idea, according to the documentation, is that if several entries exist, one is chosen at random. This is not the case.
When a soldier is killed, it is always the animation named "die_w"/"die_e" that gets called.
If the table looks like this:
   die_w = {
      "die_w_0",
      "die_w_1",
   },
and the "animations" table contains no animation named "die_w", the game crashes with:

terminate called after throwing an instance of 'Widelands::MapObjectDescr::AnimationNonexistent'
Thread 1 "widelands" received signal SIGABRT, Aborted.

Also, if the animation "die_w" exists but is not listed in the table die_w, it is still the only animation that will be played at the soldier´s death.

Related branches

Revision history for this message
GunChleoc (gunchleoc) wrote :

This might well be buggy, because we don't have any unit with multiple animations yet, so there is nothing to test with.

Can you create a branch with a random animation for testing? Then we can fix the code.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

Here´s the branch with a simple example:
https://code.launchpad.net/~widelands-dev/widelands/bug-1738054-random-battle-animations
bzr branch lp:~widelands-dev/widelands/bug-1738054-random-battle-animations

The barbarian soldier shows the first observation – there are several random animations in each of the tables, but no animation called die_e or die_w exists in the animations table.
The empire soldier is for the other point: The tables for die_e and die_w do not contain the animations named die_e and die_w but those are the ones that will be shown at the soldier´s death.

I found this bug while working on the frisians branch, I made two die animations for the soldier. I didn´t upload them because of this bug.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks for the branch. I can reproduce this and will have a look.

Changed in widelands:
status: New → In Progress
assignee: nobody → GunChleoc (gunchleoc)
milestone: none → build20-rc1
importance: Undecided → Critical
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: GunChleoc (gunchleoc) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.