[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_module_entry.cc
From: |
Kai Sterker <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_module_entry.cc,1.3,1.4 dlg_module_entry.h,1.2,1.3 |
Date: |
Fri, 26 Apr 2002 16:20:12 -0400 |
Update of /cvsroot/adonthell/adonthell/src/tools/dlgedit
In directory subversions:/tmp/cvs-serv4245
Modified Files:
dlg_module_entry.cc dlg_module_entry.h
Log Message:
FIXED crash through iterator invalidation
Index: dlg_module_entry.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module_entry.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** dlg_module_entry.cc 25 Apr 2002 22:46:43 -0000 1.3
--- dlg_module_entry.cc 26 Apr 2002 20:20:10 -0000 1.4
***************
*** 34,37 ****
--- 34,40 ----
dtor_ = "";
methods_ = "";
+
+ itc = characters.end ();
+ itq = quests.end ();
}
***************
*** 90,94 ****
// close file
in.close ();
!
return true;
}
--- 93,99 ----
// close file
in.close ();
!
! itc = characters.begin ();
!
return true;
}
***************
*** 121,125 ****
// close file
in.close ();
!
return true;
}
--- 126,132 ----
// close file
in.close ();
!
! itq = quests.begin ();
!
return true;
}
***************
*** 168,180 ****
std::string DlgModuleEntry::character ()
{
- static std::vector<std::string>::iterator i = characters.begin ();
std::string character = "";
! if (i != characters.end ())
{
! character = *i;
! i++;
}
! else i = characters.begin ();
return character;
--- 175,186 ----
std::string DlgModuleEntry::character ()
{
std::string character = "";
! if (itc != characters.end ())
{
! character = *itc;
! itc++;
}
! else itc = characters.begin ();
return character;
***************
*** 184,196 ****
std::string DlgModuleEntry::quest ()
{
- static std::vector<std::string>::iterator i = quests.begin ();
std::string quest = "";
! if (i != quests.end ())
{
! quest = *i;
! i++;
}
! else i = quests.begin ();
return quest;
--- 190,201 ----
std::string DlgModuleEntry::quest ()
{
std::string quest = "";
! if (itq != quests.end ())
{
! quest = *itq;
! itq++;
}
! else itq = quests.begin ();
return quest;
Index: dlg_module_entry.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module_entry.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** dlg_module_entry.h 7 Apr 2002 09:51:28 -0000 1.2
--- dlg_module_entry.h 26 Apr 2002 20:20:10 -0000 1.3
***************
*** 72,85 ****
*/
bool setProject (std::string p);
!
void setImports (std::string i) { imports_ = i; }
void setCtor (std::string c) { ctor_ = c; }
void setDtor (std::string d) { dtor_ = d; }
void setMethods (std::string m) { methods_ = m; }
bool isCharacter (const std::string &c);
bool isQuest (const std::string &q);
std::string character ();
std::string quest ();
//@}
--- 72,121 ----
*/
bool setProject (std::string p);
!
! /**
! * Set the import statements assigned to this module.
! * @param i the module's additional imports.
! */
void setImports (std::string i) { imports_ = i; }
+ /**
+ * Set the constructor code assigned to this module.
+ * @param c the module's constructor code.
+ */
void setCtor (std::string c) { ctor_ = c; }
+ /**
+ * Set the destructor code assigned to this module.
+ * @param d the module's destructor code.
+ */
void setDtor (std::string d) { dtor_ = d; }
+ /**
+ * Set the user defined methods of this module.
+ * @param m the module's user defined methods.
+ */
void setMethods (std::string m) { methods_ = m; }
+ /**
+ * Test whether the given string represents an available character.
+ * @param c name of the character to check for.
+ * @retorn <b>true</b> if the character exists, <b>false</b> otherwise.
+ */
bool isCharacter (const std::string &c);
+ /**
+ * Test whether the given string represents an available quest.
+ * @param q name of the quest to check for.
+ * @retorn <b>true</b> if the quest exists, <b>false</b> otherwise.
+ */
bool isQuest (const std::string &q);
+ /**
+ * Iterate over the available characters.
+ * @return the character name or the empty string ("") when the
+ * end of the list is reached.
+ */
std::string character ();
+ /**
+ * Iterate over the available quests.
+ * @return the quest name or the empty string ("") when the
+ * end of the list is reached.
+ */
std::string quest ();
//@}
***************
*** 100,103 ****
--- 136,141 ----
std::vector<std::string> characters;
std::vector<std::string> quests;
+ std::vector<std::string>::iterator itc;
+ std::vector<std::string>::iterator itq;
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_module_entry.cc,1.3,1.4 dlg_module_entry.h,1.2,1.3,
Kai Sterker <address@hidden> <=