@@ -83,7 +83,7 @@ int CFunctions::amxLoadPlugin(lua_State *luaVM) {
83
83
#endif
84
84
85
85
HMODULE hPlugin = loadLib (pluginPath.c_str ());
86
-
86
+
87
87
if (!hPlugin) {
88
88
lua_pushboolean (luaVM, 0 );
89
89
return 1 ;
@@ -184,8 +184,8 @@ int CFunctions::amxLoad(lua_State *luaVM) {
184
184
amx_TimeInit (amx);
185
185
amx_FileInit (amx);
186
186
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 ;
189
189
if (pfnAmxLoad) {
190
190
err = pfnAmxLoad (amx);
191
191
}
@@ -290,8 +290,8 @@ int CFunctions::amxCall(lua_State *luaVM) {
290
290
cell ret;
291
291
int err = amx_Exec (amx, &ret, fnIndex);
292
292
// 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 );
295
295
}
296
296
if (err != AMX_ERR_NONE) {
297
297
if (err == AMX_ERR_SLEEP)
@@ -377,16 +377,16 @@ int CFunctions::amxUnload(lua_State *luaVM) {
377
377
return 1 ;
378
378
}
379
379
// 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 ;
382
382
if (pfnAmxUnload) {
383
383
pfnAmxUnload (amx);
384
384
}
385
385
}
386
386
// Close any open databases
387
387
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 );
390
390
loadedDBs.erase (amx);
391
391
}
392
392
// Unload
@@ -402,13 +402,13 @@ int CFunctions::amxUnload(lua_State *luaVM) {
402
402
403
403
// amxUnloadAllPlugins()
404
404
int 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 ;
407
407
if (Unload) {
408
408
Unload ();
409
409
}
410
- freeLib (it-> second ->pPluginPointer );
411
- delete it-> second ;
410
+ freeLib (it. second ->pPluginPointer );
411
+ delete it. second ;
412
412
}
413
413
loadedPlugins.clear ();
414
414
vecPfnProcessTick.clear ();
@@ -492,9 +492,9 @@ int CFunctions::pawn(lua_State *luaVM) {
492
492
493
493
int fnIndex;
494
494
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;
498
498
break ;
499
499
}
500
500
}
0 commit comments