adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src dialog.cc,1.27,1.28 dialog.h,1.50


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src dialog.cc,1.27,1.28 dialog.h,1.50,1.51
Date: Sun, 28 Apr 2002 12:34:40 -0400

Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv2137

Modified Files:
        dialog.cc dialog.h 
Log Message:
Slight changes to dialogue stuff - still doesn't prevent crash on some wrong 
dialogues

Index: dialog.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.cc,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** dialog.cc   27 Apr 2002 22:08:29 -0000      1.27
--- dialog.cc   28 Apr 2002 16:34:34 -0000      1.28
***************
*** 75,78 ****
--- 75,79 ----
          s = PyList_GetItem (list, i);
          if (s) strings[i] = PyString_AsString (s);
+         else strings[i] = "*** Error";
      }
  
***************
*** 108,121 ****
  string dialog::text ()
  {
!     string text = "";
!     
!     if (i_text != text_.end ())
      {
!         text = *i_text;
!         i_text++;
      }
-     else i_text = text_.begin ();
      
!     return text;
  }
  
--- 109,119 ----
  string dialog::text ()
  {
!     if (i_text == text_.end ())
      {
!         i_text = text_.begin ();
!         return "";
      }
      
!     return *i_text++;
  }
  
***************
*** 127,130 ****
--- 125,132 ----
      u_int32 stop, size;
      
+     // empty previous dialogue text
+     text_.clear ();
+     answers.clear ();
+     
      // end of dialogue
      if (answer == -1)
***************
*** 137,144 ****
      }
      
-     // empty previous dialogue text
-     text_.clear ();
-     answers.clear ();
-     
      do
      {
--- 139,142 ----
***************
*** 185,189 ****
              answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
              text_.push_back (scan_string (nls::translate (strings[answer])));
!             
              // get the NPC color, portrait and name
              char *npc = PyString_AsString (PyList_GetItem (speaker, rnd));
--- 183,187 ----
              answer = PyInt_AsLong (PyList_GetItem (speech, rnd));
              text_.push_back (scan_string (nls::translate (strings[answer])));
! 
              // get the NPC color, portrait and name
              char *npc = PyString_AsString (PyList_GetItem (speaker, rnd));
***************
*** 202,205 ****
--- 200,206 ----
              }
              
+             cout << "NPC: " << npc << " says \"" << text_.back () << "\n\""
+                  << flush;
+                         
              // check whether we shall continue or not
              arg = Py_BuildValue ("(i)", answer);

Index: dialog.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/dialog.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** dialog.h    27 Apr 2002 22:08:29 -0000      1.50
--- dialog.h    28 Apr 2002 16:34:34 -0000      1.51
***************
*** 123,127 ****
       * @return name of the image.
       */
!     string npc_portrait () { return npc_portrait_; }
  
      /**
--- 123,127 ----
       * @return name of the image.
       */
!     const string & npc_portrait () { return npc_portrait_; }
  
      /**
***************
*** 131,135 ****
       * @return name of the NPC.
       */
!     string npc_name () { return npc_name_; }
  
      /** 
--- 131,135 ----
       * @return name of the NPC.
       */
!     const string & npc_name () { return npc_name_; }
  
      /** 




reply via email to

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