Author: elias
Date: Wed Apr 30 18:47:15 2008
New Revision: 26260

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26260&view=rev
Log:
Pierre Bourdon (delroth) added gold_per_village and is_border to the Python AI.

Modified:
    trunk/changelog
    trunk/data/core/about.cfg
    trunk/src/ai_python.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=26260&r1=26259&r2=26260&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Wed Apr 30 18:47:15 2008
@@ -9,6 +9,9 @@
  * miscellaneous and bug fixes:
    * Implemented the option to use the mouse selection clipboard in X11
      the new widget library also uses it.
+ * Python AI:
+   * Implemented a function which detects if a location is on the map border.
+   * Implemented a function which gives the game's gold parameters.
 
 Version 1.5.0:
  * campaigns:

Modified: trunk/data/core/about.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=26260&r1=26259&r2=26260&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Wed Apr 30 18:47:15 2008
@@ -739,8 +739,8 @@
         name = "Petr Sobotka (Pietro)"
     [/entry] 
     [entry]
-       name = "Prevost Thomas (zancdar)"
-       email = "thomas.prevost_AT_gmail.com"
+        name = "Pierre Bourdon (delroth)"
+        email = "root_AT_delroth.is-a-geek.org"
     [/entry]   
     [entry]
         name = "Priit Laes (plaes)"
@@ -759,6 +759,10 @@
     [/entry]
     [entry]
         name = "Thomas Baumhauer (Baufo)"
+    [/entry]
+    [entry]
+        name = "Thomas Prevost (zancdar)"
+        email = "thomas.prevost_AT_gmail.com"
     [/entry]
     [entry]
         name = "Tomasz Sikorski (Tomsik)"

Modified: trunk/src/ai_python.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai_python.cpp?rev=26260&r1=26259&r2=26260&view=diff
==============================================================================
--- trunk/src/ai_python.cpp (original)
+++ trunk/src/ai_python.cpp Wed Apr 30 18:47:15 2008
@@ -51,6 +51,7 @@
 #include "menu_events.hpp"
 #include "game_events.hpp"
 #include "game_config.hpp"
+#include "settings.hpp"
 
 #include <cassert>
 #include <fstream>
@@ -898,6 +899,17 @@
        return Py_BuildValue(INTVALUE, 
map->map_->is_castle(*location->location_) ? 1 : 0);
 }
 
+static PyObject* wrapper_getmap_is_border( wesnoth_gamemap* map, PyObject* 
args )
+{
+       wesnoth_location* location;
+       bool on_board, on_board_without_borders;
+       if ( !PyArg_ParseTuple( args, OBVALUE, &wesnoth_location_type, 
&location ) )
+               return NULL;
+       on_board = map->map_->on_board(*location->location_, true);
+       on_board_without_borders = map->map_->on_board(*location->location_, 
false);
+       return Py_BuildValue(INTVALUE, on_board && !on_board_without_borders ? 
1 : 0);
+}
+
 static PyMethodDef gamemap_methods[] = {
        MDEF("is_village", wrapper_getmap_is_village,
                "Parameters: location\n"
@@ -913,6 +925,10 @@
                "Returns: result\n"
                "Returns True if the given location is a castle tile (where 
units are "
                "recruited to), False otherwise.")
+       MDEF("is_border", wrapper_getmap_is_border,
+               "Parameters: location\n"
+               "Returns: result\n"
+               "Returns True if the given location is a border tile, False 
otherwise.")
        { NULL, NULL, 0, NULL }
 };
 
@@ -1210,6 +1226,11 @@
        return Py_BuildValue(INTVALUE, 
status->status_->get_previous_time_of_day().lawful_bonus);
 }
 
+static PyObject* wrapper_gamestatus_gold_per_village(wesnoth_gamestatus* 
status, void* /*closure*/)
+{
+       return Py_BuildValue(INTVALUE, settings::get_village_gold(""));
+}
+
 static PyGetSetDef gamestatus_getseters[] = {
     GSDEF("turn", wrapper_gamestatus_turn,     "The current turn.")
     GSDEF("number_of_turns", wrapper_gamestatus_number_of_turns,
@@ -1220,6 +1241,8 @@
         "units (alignment = 2). Neutral units (alignment = 1) are not 
affected.")
     GSDEF("previous_lawful_bonus", wrapper_gamestatus_previous_lawful_bonus,
                "The value of lawful_bonus in the previous turn.")
+       GSDEF("gold_per_village", wrapper_gamestatus_gold_per_village,
+               "The gold a village generates each turn.")
        { NULL, NULL, NULL, NULL, NULL }
 };
 


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

Reply via email to