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

                 Summary: Add check for unit existence when a python AI calls
attack_unit, fix unit.name
                 Project: Battle for Wesnoth
            Submitted by: mesilliac
            Submitted on: Thursday 02/07/2008 at 05:34
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

bruteforce.py was causing wesnoth to crash by occasionally calling
attack_unit with a location argument that didn't point to a valid unit.

Added a quick check to the attack_unit wrapper that simply tests whether
there are units on the tiles (it already tests whether the tiles are
adjacent, and whether the attack index is valid).

Also, the "name" method of a unit was returning the unit type name in stead
of the name of the specific unit. Was this intentional? The type name is
already accessible through unit.type().name.

Having unit.name point to the name of the specific unit isn't really
necessary, but it helps with debugging, and looks prettier in the debug log.

Neither sample.py or bruteforce.py use the unit.name method, so changing it
shouldn't cause any confusion at all.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thursday 02/07/2008 at 05:34  Name: ai_python.diff  Size: 1kB   By:
mesilliac
patch to ai_python.cpp
<http://gna.org/patch/download.php?file_id=3753>

    _______________________________________________________

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