@@ -172,8 +172,8 @@ int CFunctions::amxLoad(lua_State *luaVM) {
172
172
amx_TimeInit (amx);
173
173
amx_FileInit (amx);
174
174
err = amx_SAMPInit (amx);
175
- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
176
- AmxLoad_t* pfnAmxLoad = it-> second ->AmxLoad ;
175
+ for ( const auto & plugin : loadedPlugins) {
176
+ AmxLoad_t* pfnAmxLoad = plugin. second ->AmxLoad ;
177
177
if (pfnAmxLoad) {
178
178
err = pfnAmxLoad (amx);
179
179
}
@@ -206,7 +206,7 @@ int CFunctions::amxLoad(lua_State *luaVM) {
206
206
lua_getfield (luaVM, LUA_REGISTRYINDEX, " amx" );
207
207
lua_getfield (luaVM, -1 , resName);
208
208
if (lua_isnil (luaVM, -1 )) {
209
- lua_newtable (luaVM);
209
+ lua_newtable (luaVM);
210
210
lua_setfield (luaVM, -3 , resName);
211
211
}
212
212
@@ -278,8 +278,8 @@ int CFunctions::amxCall(lua_State *luaVM) {
278
278
cell ret;
279
279
int err = amx_Exec (amx, &ret, fnIndex);
280
280
// Release string arguments
281
- for (vector<cell>::iterator it = stringsToRelease. begin (); it != stringsToRelease. end (); it++ ) {
282
- amx_Release (amx, *it );
281
+ for ( const auto & amxStringAddr : stringsToRelease ) {
282
+ amx_Release (amx, amxStringAddr );
283
283
}
284
284
if (err != AMX_ERR_NONE) {
285
285
if (err == AMX_ERR_SLEEP)
@@ -365,16 +365,16 @@ int CFunctions::amxUnload(lua_State *luaVM) {
365
365
return 1 ;
366
366
}
367
367
// Call all plugins' AmxUnload function
368
- for (map< string, SampPlugin* >::iterator piIt = loadedPlugins. begin (); piIt != loadedPlugins. end (); piIt++ ) {
369
- AmxUnload_t *pfnAmxUnload = piIt-> second ->AmxUnload ;
368
+ for ( const auto & plugin : loadedPlugins) {
369
+ AmxUnload_t *pfnAmxUnload = plugin. second ->AmxUnload ;
370
370
if (pfnAmxUnload) {
371
371
pfnAmxUnload (amx);
372
372
}
373
373
}
374
374
// Close any open databases
375
375
if (loadedDBs.find (amx) != loadedDBs.end ()) {
376
- for (map< int , sqlite3 * >::iterator dbIt = loadedDBs[amx]. begin (); dbIt != loadedDBs[amx]. end (); dbIt++ )
377
- sqlite3_close (dbIt-> second );
376
+ for ( const auto & db : loadedDBs[amx])
377
+ sqlite3_close (db. second );
378
378
loadedDBs.erase (amx);
379
379
}
380
380
// Unload
@@ -390,10 +390,10 @@ int CFunctions::amxUnload(lua_State *luaVM) {
390
390
391
391
// amxUnloadAllPlugins()
392
392
int CFunctions::amxUnloadAllPlugins (lua_State *luaVM) {
393
- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
394
- it-> second ->Unload ();
395
- freeLib (it-> second ->pPluginPointer );
396
- delete it-> second ;
393
+ for (const auto & plugin : loadedPlugins) {
394
+ plugin. second ->Unload ();
395
+ freeLib (plugin. second ->pPluginPointer );
396
+ delete plugin. second ;
397
397
}
398
398
loadedPlugins.clear ();
399
399
vecPfnProcessTick.clear ();
@@ -477,9 +477,9 @@ int CFunctions::pawn(lua_State *luaVM) {
477
477
478
478
int fnIndex;
479
479
AMX *amx = NULL ;
480
- for (vector<AMX *>::iterator it = amxs. begin (); it != amxs. end (); it++ ) {
481
- if (amx_FindPublic (* it, fnName, &fnIndex) == AMX_ERR_NONE) {
482
- amx = * it;
480
+ for ( const auto & it : amxs) {
481
+ if (amx_FindPublic (it, fnName, &fnIndex) == AMX_ERR_NONE) {
482
+ amx = it;
483
483
break ;
484
484
}
485
485
}
0 commit comments