[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src Makefile.am,1.90,1.91 dialog.cc,1
From: |
Kai Sterker <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src Makefile.am,1.90,1.91 dialog.cc,1.29,1.30 dialog.h,1.51,1.52 |
Date: |
Tue, 25 Jun 2002 12:24:18 -0400 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv3977
Modified Files:
Makefile.am dialog.cc dialog.h
Log Message:
RE-ENABLED 'loop' feature of dialogue engine
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Makefile.am,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -r1.90 -r1.91
*** Makefile.am 26 May 2002 09:27:27 -0000 1.90
--- Makefile.am 25 Jun 2002 16:24:15 -0000 1.91
***************
*** 1,4 ****
## Process this file with automake to produce Makefile.in
!
if BUILD_TOOLS
SUBDIRS = . modules tools
--- 1,4 ----
## Process this file with automake to produce Makefile.in
!
if BUILD_TOOLS
SUBDIRS = . modules tools
Index: dialog.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.cc,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** dialog.cc 28 Apr 2002 16:53:02 -0000 1.29
--- dialog.cc 25 Jun 2002 16:24:15 -0000 1.30
***************
*** 62,82 ****
bool dialog::setup ()
{
// Extract the dialogue's strings
! PyObject *list = dialogue.get_attribute ("text");
! if (!list || !PyList_Check (list)) return false;
!
! PyObject *s;
! u_int32 i, index = PyList_Size (list);
! strings = new char*[index];
! for (i = 1; i < index; i++)
! {
! s = PyList_GetItem (list, i);
! if (s) strings[i] = PyString_AsString (s);
! else strings[i] = "*** Error";
}
!
! Py_DECREF (list);
// Init the first answer
--- 62,100 ----
bool dialog::setup ()
{
+ PyObject *list, *s;
+ u_int32 i, size;
+
+ // Get the text that may loop
+ list = dialogue.get_attribute ("loop");
+ if (list && PyList_Check (list))
+ {
+ size = PyList_Size (list);
+
+ for (i = 0; i < size; i++)
+ {
+ s = PyList_GetItem (list, i);
+ if (s && PyInt_Check (s)) loop.push_back (PyInt_AsLong (s));
+ }
+
+ Py_DECREF (list);
+ }
+
// Extract the dialogue's strings
! list = dialogue.get_attribute ("text");
! if (list && PyList_Check (list))
! {
! size = PyList_Size (list);
! strings = new char*[size];
! for (i = 1; i < size; i++)
! {
! s = PyList_GetItem (list, i);
! if (s && PyString_Check (s)) strings[i] = PyString_AsString (s);
! else strings[i] = "*** Error";
! }
! Py_DECREF (list);
}
! else return false;
// Init the first answer
***************
*** 133,146 ****
return;
! // Mark the Player's text (if any) as used unless loops allowed
! if (index > 0)
! {
used.push_back (answer);
! }
!
do
{
// Execute the next part of the dialogue
arg = Py_BuildValue ("(i)", answer);
dialogue.run (arg);
#ifdef PY_DEBUG
--- 151,164 ----
return;
! // Mark the Player text as used unless loops allowed
! if (find (loop.begin (), loop.end (), answer) == loop.end ())
used.push_back (answer);
!
do
{
// Execute the next part of the dialogue
arg = Py_BuildValue ("(i)", answer);
+
+ // run next part of dialogue
dialogue.run (arg);
#ifdef PY_DEBUG
***************
*** 207,212 ****
Py_XDECREF (arg);
! // make sure this NPC text can't be used any more
! used.push_back (answer);
answers.push_back (answer);
}
--- 225,232 ----
Py_XDECREF (arg);
! // Mark the NPC text as used unless loops allowed
! if (find (loop.begin (), loop.end (), answer) == loop.end ())
! used.push_back (answer);
!
answers.push_back (answer);
}
Index: dialog.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** dialog.h 28 Apr 2002 16:34:34 -0000 1.51
--- dialog.h 25 Jun 2002 16:24:15 -0000 1.52
***************
*** 168,175 ****
string npc_name_; // Current NPCs name
! vector<s_int32> answers; // The indices with which to call
instance.run ()
vector<s_int32> choices; // Strings player can chose from
vector<s_int32> used; // Dialogue parts that are already spoken
!
void clear (); // Cleanup
bool setup (); // Further dialogue initialisation
--- 168,176 ----
string npc_name_; // Current NPCs name
! vector<s_int32> answers; // The indices to pass to dialogue.run ()
vector<s_int32> choices; // Strings player can chose from
vector<s_int32> used; // Dialogue parts that are already spoken
! vector<s_int32> loop; // Dialogue parts that can be looped
!
void clear (); // Cleanup
bool setup (); // Further dialogue initialisation
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src Makefile.am,1.90,1.91 dialog.cc,1.29,1.30 dialog.h,1.51,1.52,
Kai Sterker <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/src animation.cc,1.9.4.1,1.9.4.2 character_base.cc,1.10.2.1,1.10.2.2 event.cc,1.12.2.6,1.12.2.7 event_list.cc,1.1.2.3,1.1.2.4 event_list.h,1.1.2.3,1.1.2.4 image.cc,1.8.2.5,1.8.2.6 landmap.h,1.24.4.12,1.24.4.13 map_character_with_gfx.cc,1.1.2.11,1.1.2.12 map_coordinates.cc,1.1.2.3,1.1.2.4 map_object_with_gfx.cc,1.1.2.11,1.1.2.12 map_placeable_area_gfx.cc,1.1.2.3,1.1.2.4 map_placeable_model_gfx.cc,1.1.2.6,1.1.2.7 py_object.cc,1.10.2.3,1.10.2.4 screen.cc,1.12.2.3,1.12.2.4 storage.h,1.23.2.1,1.23.2.2 str_hash.h,1.3,1.3.2.1 surface.cc,1.9.2.4,1.9.2.5
- Next by Date:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_circle.cc,1.2,1.3 dlg_circle_entry.cc,1.3,1.4 dlg_circle_entry.h,1.2,1.3 dlg_compiler.cc,1.6,1.7 dlg_compiler.h,1.3,1.4 dlg_module.cc,1.3,1.4 dlg_module.h,1.2,1.3 dlg_types.h,1.2,1.3 gui_circle.cc,1.2,1.3 gui_circle.h,1.2,1.3 gui_dlgedit.cc,1.3,1.4 gui_dlgedit.h,1.3,1.4 gui_graph.cc,1.2,1.3 gui_graph.h,1.2,1.3 lex.loadlg.cc,1.14,1.15 loadlg.l,1.11,1.12
- Previous by thread:
[Adonthell-commits] CVS: adonthell/src animation.cc,1.9.4.1,1.9.4.2 character_base.cc,1.10.2.1,1.10.2.2 event.cc,1.12.2.6,1.12.2.7 event_list.cc,1.1.2.3,1.1.2.4 event_list.h,1.1.2.3,1.1.2.4 image.cc,1.8.2.5,1.8.2.6 landmap.h,1.24.4.12,1.24.4.13 map_character_with_gfx.cc,1.1.2.11,1.1.2.12 map_coordinates.cc,1.1.2.3,1.1.2.4 map_object_with_gfx.cc,1.1.2.11,1.1.2.12 map_placeable_area_gfx.cc,1.1.2.3,1.1.2.4 map_placeable_model_gfx.cc,1.1.2.6,1.1.2.7 py_object.cc,1.10.2.3,1.10.2.4 screen.cc,1.12.2.3,1.12.2.4 storage.h,1.23.2.1,1.23.2.2 str_hash.h,1.3,1.3.2.1 surface.cc,1.9.2.4,1.9.2.5
- Next by thread:
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_circle.cc,1.2,1.3 dlg_circle_entry.cc,1.3,1.4 dlg_circle_entry.h,1.2,1.3 dlg_compiler.cc,1.6,1.7 dlg_compiler.h,1.3,1.4 dlg_module.cc,1.3,1.4 dlg_module.h,1.2,1.3 dlg_types.h,1.2,1.3 gui_circle.cc,1.2,1.3 gui_circle.h,1.2,1.3 gui_dlgedit.cc,1.3,1.4 gui_dlgedit.h,1.3,1.4 gui_graph.cc,1.2,1.3 gui_graph.h,1.2,1.3 lex.loadlg.cc,1.14,1.15 loadlg.l,1.11,1.12
- Index(es):