mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-09 18:34:04 +00:00
Applied patch #608 by Mark de Wever <mordante>:
Add wesnoth.get_version() to Python AI API.
This commit is contained in:
parent
5ab0634957
commit
8044c537b6
@ -1,3 +1,7 @@
|
||||
Version 1.1.11 (or 1.2.0?):
|
||||
* Python AI
|
||||
* there is now wesnoth.get_version()
|
||||
|
||||
Version 1.1.10:
|
||||
* campaigns:
|
||||
* Heir to the Throne
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "filesystem.hpp"
|
||||
#include "menu_events.hpp"
|
||||
#include "game_events.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@ -1586,6 +1587,13 @@ PyObject* python_ai::wrapper_get_variable(PyObject* /*self*/, PyObject* args)
|
||||
return Py_BuildValue("s", memory[variable].c_str());
|
||||
}
|
||||
|
||||
PyObject* python_ai::wrapper_get_version(PyObject* /*self*/, PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "" ))
|
||||
return NULL;
|
||||
return Py_BuildValue("s", game_config::version.c_str());
|
||||
}
|
||||
|
||||
static PyMethodDef wesnoth_python_methods[] = {
|
||||
{ "log_message", python_ai::wrapper_log_message, METH_VARARGS,
|
||||
"Parameters: string\n"
|
||||
@ -1654,7 +1662,9 @@ static PyMethodDef wesnoth_python_methods[] = {
|
||||
"Returns: value\n"
|
||||
"Retrieves a persistent variable 'variable' from the AI, which has "
|
||||
"previously been set with set_variable."},
|
||||
{ NULL, NULL, 0, NULL}
|
||||
{ "get_version", python_ai::wrapper_get_version, METH_VARARGS,
|
||||
"Returns a string containing current Wesnoth version"},
|
||||
{ NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
static PyObject* wrapper_get_gamestatus(PyObject* self, PyObject* args);
|
||||
static PyObject* wrapper_set_variable(PyObject*, PyObject* args);
|
||||
static PyObject* wrapper_get_variable(PyObject*, PyObject* args);
|
||||
static PyObject* wrapper_get_version(PyObject*, PyObject* args);
|
||||
|
||||
static PyObject* unittype_advances_to( wesnoth_unittype* type, PyObject* args );
|
||||
static PyObject* wrapper_team_recruits( wesnoth_team* team, PyObject* args );
|
||||
|
Loading…
x
Reference in New Issue
Block a user