@@ -83,7 +83,7 @@ int CFunctions::amxLoadPlugin(lua_State *luaVM) {
8383 #endif
8484
8585 HMODULE hPlugin = loadLib (pluginPath.c_str ());
86-
86+
8787 if (!hPlugin) {
8888 lua_pushboolean (luaVM, 0 );
8989 return 1 ;
@@ -184,8 +184,8 @@ int CFunctions::amxLoad(lua_State *luaVM) {
184184 amx_TimeInit (amx);
185185 amx_FileInit (amx);
186186 err = amx_SAMPInit (amx);
187- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
188- AmxLoad_t* pfnAmxLoad = it-> second ->AmxLoad ;
187+ for ( const auto & plugin : loadedPlugins) {
188+ AmxLoad_t* pfnAmxLoad = plugin. second ->AmxLoad ;
189189 if (pfnAmxLoad) {
190190 err = pfnAmxLoad (amx);
191191 }
@@ -290,8 +290,8 @@ int CFunctions::amxCall(lua_State *luaVM) {
290290 cell ret;
291291 int err = amx_Exec (amx, &ret, fnIndex);
292292 // Release string arguments
293- for (vector<cell>::iterator it = stringsToRelease. begin (); it != stringsToRelease. end (); it++ ) {
294- amx_Release (amx, *it );
293+ for ( const auto & amxStringAddr : stringsToRelease ) {
294+ amx_Release (amx, amxStringAddr );
295295 }
296296 if (err != AMX_ERR_NONE) {
297297 if (err == AMX_ERR_SLEEP)
@@ -377,16 +377,16 @@ int CFunctions::amxUnload(lua_State *luaVM) {
377377 return 1 ;
378378 }
379379 // Call all plugins' AmxUnload function
380- for (map< string, SampPlugin* >::iterator piIt = loadedPlugins. begin (); piIt != loadedPlugins. end (); piIt++ ) {
381- AmxUnload_t *pfnAmxUnload = piIt-> second ->AmxUnload ;
380+ for ( const auto & plugin : loadedPlugins) {
381+ AmxUnload_t *pfnAmxUnload = plugin. second ->AmxUnload ;
382382 if (pfnAmxUnload) {
383383 pfnAmxUnload (amx);
384384 }
385385 }
386386 // Close any open databases
387387 if (loadedDBs.find (amx) != loadedDBs.end ()) {
388- for (map< int , sqlite3 * >::iterator dbIt = loadedDBs[amx]. begin (); dbIt != loadedDBs[amx]. end (); dbIt++ )
389- sqlite3_close (dbIt-> second );
388+ for ( const auto & db : loadedDBs[amx])
389+ sqlite3_close (db. second );
390390 loadedDBs.erase (amx);
391391 }
392392 // Unload
@@ -402,13 +402,13 @@ int CFunctions::amxUnload(lua_State *luaVM) {
402402
403403// amxUnloadAllPlugins()
404404int CFunctions::amxUnloadAllPlugins (lua_State *luaVM) {
405- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
406- Unload_t* Unload = it-> second ->Unload ;
405+ for (const auto & plugin : loadedPlugins) {
406+ Unload_t* Unload = it. second ->Unload ;
407407 if (Unload) {
408408 Unload ();
409409 }
410- freeLib (it-> second ->pPluginPointer );
411- delete it-> second ;
410+ freeLib (it. second ->pPluginPointer );
411+ delete it. second ;
412412 }
413413 loadedPlugins.clear ();
414414 vecPfnProcessTick.clear ();
@@ -492,9 +492,9 @@ int CFunctions::pawn(lua_State *luaVM) {
492492
493493 int fnIndex;
494494 AMX *amx = NULL ;
495- for (vector<AMX *>::iterator it = amxs. begin (); it != amxs. end (); it++ ) {
496- if (amx_FindPublic (* it, fnName, &fnIndex) == AMX_ERR_NONE) {
497- amx = * it;
495+ for ( const auto & it : amxs) {
496+ if (amx_FindPublic (it, fnName, &fnIndex) == AMX_ERR_NONE) {
497+ amx = it;
498498 break ;
499499 }
500500 }
0 commit comments