From 28bc14e267daff85d66efc9467f40ce87bfcb858 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 1 Feb 2012 00:02:48 +0000 Subject: Plugins can now be enabled and disabled through WebAdmin WebPlugins can now have spaces in their tab names git-svn-id: http://mc-server.googlecode.com/svn/trunk@204 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- iniFile/iniFile.cpp | 22 +++++++++++++++------- iniFile/iniFile.h | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'iniFile') diff --git a/iniFile/iniFile.cpp b/iniFile/iniFile.cpp index f4381c64f..d1c15df16 100644 --- a/iniFile/iniFile.cpp +++ b/iniFile/iniFile.cpp @@ -342,6 +342,20 @@ unsigned cIniFile::GetValueV( const string & keyname, const string & valuename, return nVals; } +bool cIniFile::DeleteValueByID( const unsigned keyID, const unsigned valueID ) +{ + if ( keyID < keys.size() && valueID < keys[keyID].names.size()) + { + // This looks strange, but is neccessary. + vector::iterator npos = keys[keyID].names.begin() + valueID; + vector::iterator vpos = keys[keyID].values.begin() + valueID; + keys[keyID].names.erase( npos, npos + 1); + keys[keyID].values.erase( vpos, vpos + 1); + return true; + } + return false; +} + bool cIniFile::DeleteValue( const string & keyname, const string & valuename) { long keyID = FindKey( keyname); @@ -352,13 +366,7 @@ bool cIniFile::DeleteValue( const string & keyname, const string & valuename) if ( valueID == noID) return false; - // This looks strange, but is neccessary. - vector::iterator npos = keys[keyID].names.begin() + valueID; - vector::iterator vpos = keys[keyID].values.begin() + valueID; - keys[keyID].names.erase( npos, npos + 1); - keys[keyID].values.erase( vpos, vpos + 1); - - return true; + return DeleteValueByID( keyID, valueID ); } bool cIniFile::DeleteKey( const string & keyname) diff --git a/iniFile/iniFile.h b/iniFile/iniFile.h index d0d34e145..6b766ecf7 100644 --- a/iniFile/iniFile.h +++ b/iniFile/iniFile.h @@ -138,6 +138,7 @@ public: // Deletes specified value. // Returns true if value existed and deleted, false otherwise. + bool DeleteValueByID( const unsigned keyID, const unsigned valueID ); //tolua_export bool DeleteValue( const std::string & keyname, const std::string & valuename); //tolua_export // Deletes specified key and all values contained within. -- cgit v1.2.3