Revision: 2525 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2525&view=rev Author: rorthomas Date: 2012-05-07 07:30:45 +0000 (Mon, 07 May 2012) Log Message: ----------- added STL_ERASE macro: a) never ever duplicate code b) precompiler macros are for these kind of hacks, moves the ugly places out of sight. c) do not use WIN32, as people can also use other compilers with non-dinkumware STL on windows
Modified Paths: -------------- trunk/source/main/RoRPrerequisites.h trunk/source/main/audio/SoundScriptManager.cpp Modified: trunk/source/main/RoRPrerequisites.h =================================================================== --- trunk/source/main/RoRPrerequisites.h 2012-05-07 05:15:51 UTC (rev 2524) +++ trunk/source/main/RoRPrerequisites.h 2012-05-07 07:30:45 UTC (rev 2525) @@ -77,6 +77,13 @@ // debug asserts // #define FEAT_DEBUG_ASSERT +// STL Erase fix for dinkumware STL x| +#ifdef _MSC_VER +#define STL_ERASE(x,y) y = x.erase(y) +#else +#define STL_ERASE(x,y) x.erase(y++) +#endif // _MSC_VER + #ifdef FEAT_DEBUG_ASSERT # ifdef WIN32 // __debugbreak will break into the debugger in visual studio Modified: trunk/source/main/audio/SoundScriptManager.cpp =================================================================== --- trunk/source/main/audio/SoundScriptManager.cpp 2012-05-07 05:15:51 UTC (rev 2524) +++ trunk/source/main/audio/SoundScriptManager.cpp 2012-05-07 07:30:45 UTC (rev 2525) @@ -293,11 +293,7 @@ { if (it->second && it->second->group_name == groupname) { -#if WIN32 - it = templates.erase(it); -#else - templates.erase(it++); -#endif + STL_ERASE(templates, it); } else { ++it; @@ -316,11 +312,9 @@ delete(it->second); it->second = 0; counter++; -#if WIN32 - it = templates.erase(it); -#else - templates.erase(it++); -#endif + + STL_ERASE(templates, it); + } else { ++it; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel