adonthell-commits
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]