Follow-up Comment #2, patch #971 (project wesnoth):

Sorry, I didn't keep the traceback :(. But ironically the crash started in
battle_context::battle_context when it tried to check if the weapon was
valid.

actions.cpp, line 249:
        VALIDATE(attacker_weapon < static_cast<int>(attacker.attacks().size()),

attacker_weapon was -1 as it should be.
attacker had been set by:
        const unit& attacker = units.find(attacker_loc)->second;
so I did some quick checking with gdb and as far as I could tell the location
pointed to didn't have a unit on it.

I only had it happen a couple times, and only on the "Sablestone Delta" map,
playing vs. my AI.

Maybe it would be better to do the check in battle_context, but I felt more
comfortable putting it in the python_AI wrapper.


For the unit name vs. description: I'm pretty sure the comments in unit.hpp
are incorrect... custom_unit_description_ is definitely the unit's individual
name (which can be modified for renamable units). And unit->name() was
definitely returning the type name of the unit.

I'm not sure about the difference between description_ and
custom_unit_description_ though... language_name() seems to be the translated
type name... I really couldn't quite tell what all the different fields were
supposed to represent :(.

The python AI reference documentation said:
name -> Name of the unit (description from WML).
so I tried unit->description() which is now returning the individual name of
the unit as I expected unit.name should.


I'm not very good at navigating C++ code yet, but if it would help I could
put some effort into it and find out for good whether unit->description() was
the right one to use, or whether unit->name() was returning the wrong thing.
Should I? I would like to get it right.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?971>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to