Commit 10b64e5d authored by Yves Combe's avatar Yves Combe
Browse files

fix bargame help bug

parent 1464374a
2005-09-08 Yves Combe <yves@ycombe.net>
fix bargame help bug.
* src/boards/py-mod-gcompris.c:
(py_gcompris_get_wordlist_from_file):
* src/boards/python/bargame.py:
* src/boards/python/pythontest.py:
* src/gcompris/wordlist.c: (gcompris_get_wordlist_from_file):
2005-09-06 Bruno coudoin <bruno.coudoin@free.fr>
Created new xml files for new wordlist format.
......
......@@ -1592,14 +1592,20 @@ py_gcompris_get_current_board_dirname (PyObject* self, PyObject* args)
static PyObject*
py_gcompris_get_wordlist_from_file (PyObject* self, PyObject* args)
{
GcomprisWordlist *result;
gchar *filename;
/* Parse arguments */
if(!PyArg_ParseTuple(args, "s:gcompris.get_wordlist", &filename))
return NULL;
/* Call the corresponding C function */
return gcompris_new_pyGcomprisWordlistObject(gcompris_get_wordlist_from_file (filename));
result = gcompris_get_wordlist_from_file (filename);
if (result)
return gcompris_new_pyGcomprisWordlistObject(result);
else {
Py_INCREF(Py_None);
return Py_None;
}
}
......
......@@ -110,7 +110,7 @@ class Gcompris_bargame:
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
# the game is won
if(pause == 0):
if ((pause == 0) and self.finished_sublevel):
self.set_sublevel(self.gcomprisBoard.sublevel+1)
return 0
......@@ -183,6 +183,7 @@ class Gcompris_bargame:
self.holes = []
self.last_played = -1
self.finished_sublevel = False
self.game_won = False
self.list_win = self.calculate_win_places()
......@@ -270,6 +271,7 @@ class Gcompris_bargame:
self.answer.new_value(self.number_balls[self.gcomprisBoard.sublevel-1][0])
def gamelost(self,human):
self.finished_sublevel = True
if human:
print 'Lost !'
gcompris.bonus.display(gcompris.bonus.LOOSE, gcompris.bonus.GNU)
......
......@@ -40,6 +40,15 @@ class Gcompris_pythontest:
def start(self):
logged = gcompris.admin.get_current_user()
wordlist = gcompris.get_wordlist('wordslevel_max_pt_BR')
print wordlist
print wordlist.filename
print wordlist.level
print wordlist.locale
print wordlist.description
print wordlist.words
print gcompris.get_current_user_dirname()
print gcompris.get_current_board_dirname()
......
......@@ -37,13 +37,13 @@ GcomprisWordlist *gcompris_get_wordlist_from_file(gchar *filename)
GcomprisProperties *properties = gcompris_get_properties ();
xmlfilename = g_strdup_printf("%s/wordlists/%s.xml", properties->shared_dir, filename);
xmlfilename = g_strdup_printf("%s/wordsgame/%s.xml", properties->shared_dir, filename);
/* if the file doesn't exist */
if(!g_file_test(xmlfilename, G_FILE_TEST_EXISTS))
{
g_free(xmlfilename);
xmlfilename = g_strdup_printf("%s/wordgame/%s.xml", properties->package_data_dir, filename);
xmlfilename = g_strdup_printf("%s/wordsgame/%s.xml", properties->package_data_dir, filename);
if(!g_file_test(xmlfilename, G_FILE_TEST_EXISTS)){
g_warning(_("Couldn't find file %s !"), xmlfilename);
g_free(xmlfilename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment