From 8084d7c0e4b87cd7ced91959e59d0f3ce01ac6ce Mon Sep 17 00:00:00 2001 From: turley Date: Wed, 7 Oct 2009 10:55:39 +0000 Subject: [PATCH] more cleanup +pre-incrementing of iters is faster --- pol-core/bscript/executor.cpp | 3 +- pol-core/bscript/executor.h | 2 +- pol-core/bscript/object.cpp | 5 +- pol-core/bscript/str.cpp | 4 +- pol-core/clib/strutil.cpp | 4 +- pol-core/plib/stlastar.h | 22 +- pol-core/pol/binaryfilescrobj.cpp | 305 +++++++++++++++------------ pol-core/pol/cfgrepos.cpp | 2 +- pol-core/pol/mobile/attribute.cpp | 2 +- pol-core/pol/mobile/boundbox.cpp | 2 +- pol-core/pol/mobile/charactr.cpp | 4 +- pol-core/pol/module/basicmod.cpp | 2 +- pol-core/pol/movecost.cpp | 2 +- pol-core/pol/multi/boat.cpp | 2 +- pol-core/pol/multi/multidef.cpp | 2 +- pol-core/pol/network/packethooks.cpp | 2 +- pol-core/pol/npctmpl.cpp | 2 +- pol-core/pol/objecthash.cpp | 2 +- pol-core/pol/proplist.cpp | 12 +- pol-core/pol/region.cpp | 2 +- pol-core/pol/spells.cpp | 4 +- pol-core/pol/storage.cpp | 2 +- pol-core/pol/umap.cpp | 2 +- pol-core/pol/uopathnode.h | 4 +- pol-core/pol/vital.cpp | 2 +- 25 files changed, 216 insertions(+), 181 deletions(-) diff --git a/pol-core/bscript/executor.cpp b/pol-core/bscript/executor.cpp index fa4e9d775..5523a5877 100644 --- a/pol-core/bscript/executor.cpp +++ b/pol-core/bscript/executor.cpp @@ -185,10 +185,9 @@ int Executor::getParams(unsigned howMany) return 0; } -int Executor::cleanParams() +void Executor::cleanParams() { fparams.clear(); - return 0; } int Executor::makeString(unsigned param) diff --git a/pol-core/bscript/executor.h b/pol-core/bscript/executor.h index e89a9b773..5ece2b0f3 100644 --- a/pol-core/bscript/executor.h +++ b/pol-core/bscript/executor.h @@ -99,7 +99,7 @@ class Executor protected: int getParams(unsigned howMany); - int cleanParams(); + void cleanParams(); public: int makeString(unsigned param); diff --git a/pol-core/bscript/object.cpp b/pol-core/bscript/object.cpp index 9057c73cf..c9c728093 100644 --- a/pol-core/bscript/object.cpp +++ b/pol-core/bscript/object.cpp @@ -484,7 +484,7 @@ ObjArray::ObjArray( const ObjArray& copyfrom ) : void ObjArray::deepcopy() { - for( iterator itr = ref_arr.begin(); itr != ref_arr.end(); itr++ ) + for( iterator itr = ref_arr.begin(); itr != ref_arr.end(); ++itr ) { if (itr->get()) { @@ -494,6 +494,7 @@ void ObjArray::deepcopy() No, we're making a copy, leaving the original be. (SO, bno's refcount should be >1 here) */ + BObject *bo = itr->get(); itr->set( new BObject( bo->impptr()->copy() ) ); } @@ -986,7 +987,7 @@ BObjectImp* ObjArray::call_method( const char* methodname, Executor& ex ) void ObjArray::packonto( ostream& os ) const { os << "a" << ref_arr.size() << ":"; - for( const_iterator itr = ref_arr.begin(); itr != ref_arr.end(); itr++ ) + for( const_iterator itr = ref_arr.begin(); itr != ref_arr.end(); ++itr ) { if (itr->get()) { diff --git a/pol-core/bscript/str.cpp b/pol-core/bscript/str.cpp index 1e026a30f..bbc82e3b4 100644 --- a/pol-core/bscript/str.cpp +++ b/pol-core/bscript/str.cpp @@ -291,7 +291,7 @@ String *String::midstring(int begin, int len) const void String::toUpper( void ) { - for( string::iterator itr = value_.begin(); itr != value_.end(); itr++ ) + for( string::iterator itr = value_.begin(); itr != value_.end(); ++itr ) { *itr = toupper(*itr); } @@ -299,7 +299,7 @@ void String::toUpper( void ) void String::toLower( void ) { - for( string::iterator itr = value_.begin(); itr != value_.end(); itr++ ) + for( string::iterator itr = value_.begin(); itr != value_.end(); ++itr ) { *itr = tolower(*itr); } diff --git a/pol-core/clib/strutil.cpp b/pol-core/clib/strutil.cpp index 5d768d67d..7ab1f786c 100644 --- a/pol-core/clib/strutil.cpp +++ b/pol-core/clib/strutil.cpp @@ -247,7 +247,7 @@ UnitTest test_convertquotedstring_obj(test_convertquotedstring); void mklower( string& str ) { - for( string::iterator itr = str.begin(); itr != str.end(); itr++ ) + for( string::iterator itr = str.begin(); itr != str.end(); ++itr ) { *itr = tolower(*itr); } @@ -255,7 +255,7 @@ void mklower( string& str ) void mkupper( string& str ) { - for( string::iterator itr = str.begin(); itr != str.end(); itr++ ) + for( string::iterator itr = str.begin(); itr != str.end(); ++itr ) { *itr = toupper(*itr); } diff --git a/pol-core/plib/stlastar.h b/pol-core/plib/stlastar.h index fdc549d67..ac4d6f323 100644 --- a/pol-core/plib/stlastar.h +++ b/pol-core/plib/stlastar.h @@ -154,7 +154,7 @@ public: // methods bool InOpenList(UserState& theState) { NodeVectorIterator openlist_result; - for( openlist_result = m_OpenList.begin(); openlist_result != m_OpenList.end(); openlist_result ++ ) + for( openlist_result = m_OpenList.begin(); openlist_result != m_OpenList.end(); ++openlist_result ) { if( (*openlist_result)->m_UserState.IsSameState( theState ) ) { @@ -170,7 +170,7 @@ public: // methods return true; NodeVectorIterator closedlist_result; - for( closedlist_result = m_ClosedList.begin(); closedlist_result != m_ClosedList.end(); closedlist_result ++ ) + for( closedlist_result = m_ClosedList.begin(); closedlist_result != m_ClosedList.end(); ++closedlist_result ) { if( (*closedlist_result)->m_UserState.IsSameState( theState ) ) { @@ -183,7 +183,7 @@ public: // methods bool AddToSolutionList(Node * theNode) { NodeVectorIterator solution_result; - for ( solution_result = m_SolutionList.begin(); solution_result != m_SolutionList.end(); solution_result ++) + for ( solution_result = m_SolutionList.begin(); solution_result != m_SolutionList.end(); ++solution_result) { if ((*solution_result) == theNode) return false; @@ -286,7 +286,7 @@ public: // methods if( !ret ) { // free the nodes that may previously have been added - for( NodeVectorIterator successor = m_Successors.begin(); successor != m_Successors.end(); successor ++ ) + for( NodeVectorIterator successor = m_Successors.begin(); successor != m_Successors.end(); ++successor ) { FreeNode( (*successor) ); } @@ -301,7 +301,7 @@ public: // methods } // Now handle each successor to the current node ... - for( NodeVectorIterator successor = m_Successors.begin(); successor != m_Successors.end(); successor ++ ) + for( NodeVectorIterator successor = m_Successors.begin(); successor != m_Successors.end(); ++successor ) { // The g value for this successor ... float newg = n->g + n->m_UserState.GetCost( (*successor)->m_UserState ); @@ -314,7 +314,7 @@ public: // methods NodeVectorIterator openlist_result; - for( openlist_result = m_OpenList.begin(); openlist_result != m_OpenList.end(); openlist_result ++ ) + for( openlist_result = m_OpenList.begin(); openlist_result != m_OpenList.end(); ++openlist_result ) { if( (*openlist_result)->m_UserState.IsSameState( (*successor)->m_UserState ) ) { @@ -337,7 +337,7 @@ public: // methods NodeVectorIterator closedlist_result; - for( closedlist_result = m_ClosedList.begin(); closedlist_result != m_ClosedList.end(); closedlist_result ++ ) + for( closedlist_result = m_ClosedList.begin(); closedlist_result != m_ClosedList.end(); ++closedlist_result ) { if( (*closedlist_result)->m_UserState.IsSameState( (*successor)->m_UserState ) ) { @@ -616,7 +616,7 @@ private: // methods Node *n = (*iterOpen); FreeNode( n ); - iterOpen ++; + ++iterOpen; } m_OpenList.clear(); @@ -624,7 +624,7 @@ private: // methods // iterate closed list and delete unused nodes NodeVectorIterator iterClosed; - for( iterClosed = m_ClosedList.begin(); iterClosed != m_ClosedList.end(); iterClosed ++ ) + for( iterClosed = m_ClosedList.begin(); iterClosed != m_ClosedList.end(); ++iterClosed ) { Node *n = (*iterClosed); FreeNode( n ); @@ -653,13 +653,13 @@ private: // methods FreeNode( n ); n = NULL; } - iterOpen ++; + ++iterOpen; } m_OpenList.clear(); // iterate closed list and delete unused nodes NodeVectorIterator iterClosed; - for( iterClosed = m_ClosedList.begin(); iterClosed != m_ClosedList.end(); iterClosed ++ ) + for( iterClosed = m_ClosedList.begin(); iterClosed != m_ClosedList.end(); ++iterClosed ) { Node *n = (*iterClosed); diff --git a/pol-core/pol/binaryfilescrobj.cpp b/pol-core/pol/binaryfilescrobj.cpp index 4c6317e2b..224238ae5 100644 --- a/pol-core/pol/binaryfilescrobj.cpp +++ b/pol-core/pol/binaryfilescrobj.cpp @@ -79,41 +79,33 @@ BObjectImp* BBinaryfile::call_method( const char* methodname, Executor& ex ) BObjectImp* BBinaryfile::call_method_id( const int id, Executor& ex ) { - long value, type; - u32 _u32; - u16 _u16; - u8 _u8; - s32 _s32; - s16 _s16; - s8 _s8; - const char* _str; - vector _char; - int len; - const String* text; - ios::seekdir seekdir = 0x0; switch(id) { case MTH_CLOSE: file.Close(); return new BLong(1); case MTH_SIZE: - return new BLong(static_cast(file.FileSize(ex))); + return new BLong(static_cast(file.FileSize(ex))); case MTH_SEEK: - if(ex.numParams() != 2) - return new BError( "Seek requires 2 parameter." ); - if((!ex.getParam( 0, value )) || - (!ex.getParam( 1, type ))) - return new BError("Invalid parameter"); - // FIXME: ms::stl has different flag values then stlport :( - if (type & 0x01) - seekdir = ios::beg; - else if (type & 0x02) - seekdir = ios::cur; - else - seekdir = ios::end; - if (!file.Seek(value,seekdir)) - return new BLong(0); - return new BLong(1); + { + if(ex.numParams() != 2) + return new BError( "Seek requires 2 parameter." ); + long value, type; + if((!ex.getParam( 0, value )) || + (!ex.getParam( 1, type ))) + return new BError("Invalid parameter"); + // FIXME: ms::stl has different flag values then stlport :( + ios::seekdir seekdir = 0x0; + if (type & 0x01) + seekdir = ios::beg; + else if (type & 0x02) + seekdir = ios::cur; + else + seekdir = ios::end; + if (!file.Seek(value,seekdir)) + return new BLong(0); + return new BLong(1); + } case MTH_TELL: return new BLong(static_cast(file.Tell())); case MTH_PEEK: @@ -123,127 +115,170 @@ BObjectImp* BBinaryfile::call_method_id( const int id, Executor& ex ) return new BLong(1); case MTH_GETINT32: - if (!file.Read(_u32)) - return new BError("Failed to read"); - if (bigendian) - _u32=cfBEu32(_u32); - return new BLong(_u32); + { + u32 _u32; + if (!file.Read(_u32)) + return new BError("Failed to read"); + if (bigendian) + _u32=cfBEu32(_u32); + return new BLong(_u32); + } case MTH_GETSINT32: - if (!file.Read(_s32)) - return new BError("Failed to read"); - if (bigendian) - _s32=cfBEu32(_s32); - return new BLong(_s32); + { + s32 _s32; + if (!file.Read(_s32)) + return new BError("Failed to read"); + if (bigendian) + _s32=cfBEu32(_s32); + return new BLong(_s32); + } case MTH_GETINT16: - if (!file.Read(_u16)) - return new BError("Failed to read"); - if (bigendian) - _u16=cfBEu16(_u16); - return new BLong(_u16); + { + u16 _u16; + if (!file.Read(_u16)) + return new BError("Failed to read"); + if (bigendian) + _u16=cfBEu16(_u16); + return new BLong(_u16); + } case MTH_GETSINT16: - if (!file.Read(_s16)) - return new BError("Failed to read"); - if (bigendian) - _s16=cfBEu16(_s16); - return new BLong(_s16); + { + s16 _s16; + if (!file.Read(_s16)) + return new BError("Failed to read"); + if (bigendian) + _s16=cfBEu16(_s16); + return new BLong(_s16); + } case MTH_GETINT8: - if (!file.Read(_u8)) - return new BError("Failed to read"); - return new BLong(_u8); + { + u8 _u8; + if (!file.Read(_u8)) + return new BError("Failed to read"); + return new BLong(_u8); + } case MTH_GETSINT8: - if (!file.Read(_s8)) - return new BError("Failed to read"); - return new BLong(_s8); + { + s8 _s8; + if (!file.Read(_s8)) + return new BError("Failed to read"); + return new BLong(_s8); + } case MTH_GETSTRING: - if(ex.numParams() != 1) - return new BError( "GetString requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _char.resize(value); - if (!file.Read(&_char[0],value)) - return new BError("Failed to read"); - len = 0; - _str = reinterpret_cast(&_char[0]); - // Returns maximum of len characters or up to the first null-byte - while (len < value && *(_str+len)) - len++; - return new String( _str, len); + { + if(ex.numParams() != 1) + return new BError( "GetString requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + vector _char; + _char.resize(value); + if (!file.Read(&_char[0],value)) + return new BError("Failed to read"); + int len = 0; + const char* _str = reinterpret_cast(&_char[0]); + // Returns maximum of len characters or up to the first null-byte + while (len < value && *(_str+len)) + len++; + return new String( _str, len); + } case MTH_SETINT32: - if(ex.numParams() != 1) - return new BError( "SetInt32 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _u32=static_cast(value); - if (bigendian) - _u32=cfBEu32(_u32); - if (!file.Write(_u32)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetInt32 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + u32 _u32=static_cast(value); + if (bigendian) + _u32=cfBEu32(_u32); + if (!file.Write(_u32)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETSINT32: - if(ex.numParams() != 1) - return new BError( "SetSInt32 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _s32=static_cast(value); - if (bigendian) - _s32=cfBEu32(_s32); - if (!file.Write(_s32)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetSInt32 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + s32 _s32=static_cast(value); + if (bigendian) + _s32=cfBEu32(_s32); + if (!file.Write(_s32)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETINT16: - if(ex.numParams() != 1) - return new BError( "SetInt16 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _u16=static_cast(value); - if (bigendian) - _u16=cfBEu16(_u16); - if (!file.Write(_u16)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetInt16 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + u16 _u16=static_cast(value); + if (bigendian) + _u16=cfBEu16(_u16); + if (!file.Write(_u16)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETSINT16: - if(ex.numParams() != 1) - return new BError( "SetSInt16 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _s16=static_cast(value); - if (bigendian) - _s16=cfBEu16(_s16); - if (!file.Write(_s16)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetSInt16 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + s16 _s16=static_cast(value); + if (bigendian) + _s16=cfBEu16(_s16); + if (!file.Write(_s16)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETINT8: - if(ex.numParams() != 1) - return new BError( "SetInt8 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _u8=static_cast(value); - if (!file.Write(_u8)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetInt8 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + u8 _u8=static_cast(value); + if (!file.Write(_u8)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETSINT8: - if(ex.numParams() != 1) - return new BError( "SetSInt8 requires 1 parameter." ); - if(!ex.getParam( 0, value )) - return new BError("Invalid parameter"); - _s8=static_cast(value); - if (!file.Write(_s8)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 1) + return new BError( "SetSInt8 requires 1 parameter." ); + long value; + if(!ex.getParam( 0, value )) + return new BError("Invalid parameter"); + s8 _s8=static_cast(value); + if (!file.Write(_s8)) + return new BError("Failed to write"); + return new BLong(1); + } case MTH_SETSTRING: - if(ex.numParams() != 2) - return new BError( "SetString requires 2 parameters." ); - if((!ex.getStringParam( 0, text )) || - (!ex.getParam( 1, value )) ) - return new BError( "Invalid parameter" ); - _str = text->value().c_str(); - len=text->value().length(); - if (value==1) - len++; - if (!file.WriteString(text->value().c_str(),len)) - return new BError("Failed to write"); - return new BLong(1); + { + if(ex.numParams() != 2) + return new BError( "SetString requires 2 parameters." ); + long value; + const String* text; + if((!ex.getStringParam( 0, text )) || + (!ex.getParam( 1, value )) ) + return new BError( "Invalid parameter" ); + int len=text->value().length(); + if (value==1) + len++; + if (!file.WriteString(text->value().c_str(),len)) + return new BError("Failed to write"); + return new BLong(1); + } default: return NULL; diff --git a/pol-core/pol/cfgrepos.cpp b/pol-core/pol/cfgrepos.cpp index 7c47e625a..ee762f65b 100644 --- a/pol-core/pol/cfgrepos.cpp +++ b/pol-core/pol/cfgrepos.cpp @@ -84,7 +84,7 @@ BObjectImp* StoredConfigElem::listprops( ) const ObjArray* objarr = new ObjArray; String propname; PropImpList::const_iterator itr; - for( itr = propimps_.begin(); itr != propimps_.end(); itr++ ) + for( itr = propimps_.begin(); itr != propimps_.end(); ++itr ) { propname = (*itr).first.c_str(); if ( !objarr->contains(propname) ) diff --git a/pol-core/pol/mobile/attribute.cpp b/pol-core/pol/mobile/attribute.cpp index 8b95d8153..0f0c68f03 100644 --- a/pol-core/pol/mobile/attribute.cpp +++ b/pol-core/pol/mobile/attribute.cpp @@ -111,7 +111,7 @@ void load_attributes_cfg() void clean_attributes() { std::vector::iterator iter = attributes.begin(); - for ( ; iter != attributes.end(); iter++) { + for ( ; iter != attributes.end(); ++iter) { delete *iter; *iter=NULL; } diff --git a/pol-core/pol/mobile/boundbox.cpp b/pol-core/pol/mobile/boundbox.cpp index 661fa897b..72a350142 100644 --- a/pol-core/pol/mobile/boundbox.cpp +++ b/pol-core/pol/mobile/boundbox.cpp @@ -14,7 +14,7 @@ Notes bool BoundingBox::contains( unsigned short x, unsigned short y ) const { - for( Areas::const_iterator itr = areas.begin(); itr != areas.end(); itr++ ) + for( Areas::const_iterator itr = areas.begin(); itr != areas.end(); ++itr ) { if (x >= itr->topleft.x && x <= itr->bottomright.x && y >= itr->topleft.y && y <= itr->bottomright.y) diff --git a/pol-core/pol/mobile/charactr.cpp b/pol-core/pol/mobile/charactr.cpp index c08229c72..924f13fad 100644 --- a/pol-core/pol/mobile/charactr.cpp +++ b/pol-core/pol/mobile/charactr.cpp @@ -3711,7 +3711,7 @@ Item* Character::search_remote_containers( u32 serial, bool* isRemoteContainer ) *isRemoteContainer = false; for( std::vector::const_iterator itr = remote_containers_.begin(); itr != remote_containers_.end(); - itr++ ) + ++itr ) { Item* item = (*itr).get(); if (item->orphan()) @@ -3743,7 +3743,7 @@ bool Character::mightsee( const Item *item ) const for( std::vector::const_iterator itr = remote_containers_.begin(); itr != remote_containers_.end(); - itr++ ) + ++itr ) { Item* additional_item = (*itr).get(); if (additional_item == item) diff --git a/pol-core/pol/module/basicmod.cpp b/pol-core/pol/module/basicmod.cpp index ef30f329c..b4b969161 100644 --- a/pol-core/pol/module/basicmod.cpp +++ b/pol-core/pol/module/basicmod.cpp @@ -321,7 +321,7 @@ BObjectImp* BasicExecutorModule::mf_CChrZ() ObjArray* arr = static_cast(exec.getParamImp( 0, BObjectImp::OTArray )); if (!arr) return new BError( "Invalid parameter type" ); - for( ObjArray::const_iterator itr = arr->ref_arr.begin(); itr != arr->ref_arr.end(); itr++ ) + for( ObjArray::const_iterator itr = arr->ref_arr.begin(); itr != arr->ref_arr.end(); ++itr ) { BObjectImp* imp = (*itr).get()->impptr(); if (imp) diff --git a/pol-core/pol/movecost.cpp b/pol-core/pol/movecost.cpp index a2ee5589a..421234bb8 100644 --- a/pol-core/pol/movecost.cpp +++ b/pol-core/pol/movecost.cpp @@ -74,7 +74,7 @@ void read_movecost( ConfigElem& elem, MovementCost& movecost ) } } - for(itr = Costs.begin(); itr != Costs.end(); itr++) + for(itr = Costs.begin(); itr != Costs.end(); ++itr) { perc = itr->first; mult = itr->second; diff --git a/pol-core/pol/multi/boat.cpp b/pol-core/pol/multi/boat.cpp index 127dca4dd..6e6bdbbae 100644 --- a/pol-core/pol/multi/boat.cpp +++ b/pol-core/pol/multi/boat.cpp @@ -184,7 +184,7 @@ void read_boat_cfg(void) void clean_boatshapes() { BoatShapes::iterator iter = boatshapes.begin(); - for ( ; iter != boatshapes.end(); iter++) { + for ( ; iter != boatshapes.end(); ++iter) { if (iter->second != NULL) delete iter->second; iter->second = NULL; diff --git a/pol-core/pol/multi/multidef.cpp b/pol-core/pol/multi/multidef.cpp index b3b50507a..050ad09db 100644 --- a/pol-core/pol/multi/multidef.cpp +++ b/pol-core/pol/multi/multidef.cpp @@ -307,7 +307,7 @@ const MultiDef* MultiDefByGraphic( u16 graphic ) void clean_multidefs() { MultiDefs::iterator iter = my_multidefs_by_graphic.begin(); - for ( ; iter != my_multidefs_by_graphic.end(); iter++) { + for ( ; iter != my_multidefs_by_graphic.end(); ++iter) { if (iter->second != NULL) delete iter->second; iter->second = NULL; diff --git a/pol-core/pol/network/packethooks.cpp b/pol-core/pol/network/packethooks.cpp index 5f844dcb5..4271585bc 100644 --- a/pol-core/pol/network/packethooks.cpp +++ b/pol-core/pol/network/packethooks.cpp @@ -493,7 +493,7 @@ void load_packet_hooks() PacketHookData::~PacketHookData() { map::iterator itr = SubCommands.begin(), end = SubCommands.end(); - for ( ; itr != end; itr++) { + for ( ; itr != end; ++itr) { delete itr->second; } if (function != NULL) diff --git a/pol-core/pol/npctmpl.cpp b/pol-core/pol/npctmpl.cpp index a96fa34ac..2d820865a 100644 --- a/pol-core/pol/npctmpl.cpp +++ b/pol-core/pol/npctmpl.cpp @@ -139,7 +139,7 @@ const NpcTemplate& find_npc_template( const ConfigElem& elem ) void unload_npc_templates() { NpcTemplates::iterator iter = npc_templates.begin(); - for ( ; iter != npc_templates.end(); iter++) { + for ( ; iter != npc_templates.end(); ++iter) { if (iter->second != NULL) delete iter->second; iter->second = NULL; diff --git a/pol-core/pol/objecthash.cpp b/pol-core/pol/objecthash.cpp index 8daff4fb7..b96a35f20 100644 --- a/pol-core/pol/objecthash.cpp +++ b/pol-core/pol/objecthash.cpp @@ -129,7 +129,7 @@ void ObjectHash::PrintContents( std::ostream& os ) const { OH_const_iterator itr; os << "Object Count: " << hash.size() <second->printOn(os); } diff --git a/pol-core/pol/proplist.cpp b/pol-core/pol/proplist.cpp index 42ade3da6..06adf1af3 100644 --- a/pol-core/pol/proplist.cpp +++ b/pol-core/pol/proplist.cpp @@ -72,7 +72,7 @@ void PropertyList::clear() void PropertyList::getpropnames( std::vector< std::string >& propnames ) const { - for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); itr++ ) + for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); ++itr ) { const string& first = (*itr).first; propnames.push_back( first ); @@ -81,7 +81,7 @@ void PropertyList::getpropnames( std::vector< std::string >& propnames ) const void PropertyList::printProperties( ostream& os ) const { - for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); itr++ ) + for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); ++itr ) { const string& first = (*itr).first; if (first[0] != '#') @@ -92,7 +92,7 @@ void PropertyList::printProperties( ostream& os ) const } void PropertyList::printProperties( ConfigElem& elem ) const { - for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); itr++ ) + for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); ++itr ) { const string& first = (*itr).first; if (first[0] != '#') @@ -103,7 +103,7 @@ void PropertyList::printProperties( ConfigElem& elem ) const } void PropertyList::printPropertiesAsStrings( ostream& os ) const { - for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); itr++ ) + for( Properties::const_iterator itr = properties.begin(); itr != properties.end(); ++itr ) { const string& first = (*itr).first; if (first[0] != '#') @@ -170,7 +170,7 @@ bool PropertyList::operator==(const PropertyList& plist) const PropertyList& PropertyList::operator-( const std::set& CPropNames) //dave added 1/26/3 { std::set::const_iterator itr; - for(itr = CPropNames.begin(); itr != CPropNames.end(); itr++) + for(itr = CPropNames.begin(); itr != CPropNames.end(); ++itr) { eraseprop(*itr); } @@ -181,7 +181,7 @@ PropertyList& PropertyList::operator-( const std::set& CPropNames) void PropertyList::operator-=( const std::set& CPropNames) //dave added 1/26/3 { std::set::const_iterator itr; - for(itr = CPropNames.begin(); itr != CPropNames.end(); itr++) + for(itr = CPropNames.begin(); itr != CPropNames.end(); ++itr) { eraseprop(*itr); } diff --git a/pol-core/pol/region.cpp b/pol-core/pol/region.cpp index 3f016913d..349a02c0c 100644 --- a/pol-core/pol/region.cpp +++ b/pol-core/pol/region.cpp @@ -97,7 +97,7 @@ RegionGroupBase::~RegionGroupBase() // cleans the regions_ vector... std::vector::iterator reg_itr = regions_.begin(), reg_end = regions_.end(); - for ( ; reg_itr != reg_end; reg_itr++) { + for ( ; reg_itr != reg_end; ++reg_itr) { delete *reg_itr; } regions_.clear(); diff --git a/pol-core/pol/spells.cpp b/pol-core/pol/spells.cpp index d5745e6ea..1c4aa73ac 100644 --- a/pol-core/pol/spells.cpp +++ b/pol-core/pol/spells.cpp @@ -539,13 +539,13 @@ void load_spell_data() void clean_spells() { std::vector::iterator c_iter = spellcircles.begin(); - for ( ; c_iter != spellcircles.end(); c_iter++) { + for ( ; c_iter != spellcircles.end(); ++c_iter) { delete *c_iter; *c_iter=NULL; } spellcircles.clear(); std::vector::iterator s_iter = spells2.begin(); - for ( ; s_iter != spells2.end(); s_iter++) { + for ( ; s_iter != spells2.end(); ++s_iter) { delete *s_iter; *s_iter=NULL; } diff --git a/pol-core/pol/storage.cpp b/pol-core/pol/storage.cpp index fb9ab3c62..693088ff1 100644 --- a/pol-core/pol/storage.cpp +++ b/pol-core/pol/storage.cpp @@ -254,7 +254,7 @@ void Storage::print( ostream& os ) const { for( AreaCont::const_iterator itr = areas.begin(); itr != areas.end(); - itr++ ) + ++itr ) { os << "StorageArea" << endl << "{" << endl diff --git a/pol-core/pol/umap.cpp b/pol-core/pol/umap.cpp index a2c1988db..a7f58f75a 100644 --- a/pol-core/pol/umap.cpp +++ b/pol-core/pol/umap.cpp @@ -91,7 +91,7 @@ void Map::printPinPoints( std::ostream& os ) const int i=0; os << "\tNumPins " << pin_points.size() << pf_endl; - for( itr = pin_points.begin(); itr != pin_points.end(); itr++, i++ ) + for( itr = pin_points.begin(); itr != pin_points.end(); ++itr, ++i ) { os << "\tPin" << i << " " << itr->x << "," << itr->y << pf_endl; } diff --git a/pol-core/pol/uopathnode.h b/pol-core/pol/uopathnode.h index e0a913de1..96940f37e 100644 --- a/pol-core/pol/uopathnode.h +++ b/pol-core/pol/uopathnode.h @@ -56,13 +56,13 @@ public: ~AStarBlockers() { - for( BlockNodeVector::iterator blockNode = m_List.begin(); blockNode != m_List.end(); blockNode ++ ) + for( BlockNodeVector::iterator blockNode = m_List.begin(); blockNode != m_List.end(); ++blockNode ) delete (*blockNode); } bool IsBlocking(short x, short y, short z) { BlockNode * theNode; - for( BlockNodeVector::iterator blockNode = m_List.begin(); blockNode != m_List.end(); blockNode ++ ) + for( BlockNodeVector::iterator blockNode = m_List.begin(); blockNode != m_List.end(); ++blockNode ) { theNode = (*blockNode); if ((theNode->x == x) && (theNode->y == y) && (abs(theNode->z - z) < PLAYER_CHARACTER_HEIGHT)) diff --git a/pol-core/pol/vital.cpp b/pol-core/pol/vital.cpp index 94591f7e2..7c214c691 100644 --- a/pol-core/pol/vital.cpp +++ b/pol-core/pol/vital.cpp @@ -72,7 +72,7 @@ Vital::~Vital() { void clean_vitals() { std::vector::iterator iter = vitals.begin(); - for ( ; iter != vitals.end(); iter++) { + for ( ; iter != vitals.end(); ++iter) { delete *iter; *iter=NULL; }