summaryrefslogtreecommitdiff
path: root/plugins/cleaners.cpp
diff options
context:
space:
mode:
authorQuietust2012-01-31 10:55:38 -0600
committerQuietust2012-01-31 10:55:38 -0600
commit9afcea3debd7588e897eea21b33b8a86e9adcc4d (patch)
tree3db1c6e2a1613eef4d8ebac243b5353e18db654b /plugins/cleaners.cpp
parenta82f4c913803038d20b4c92e65b53f9fea9555dc (diff)
downloaddfhack-9afcea3debd7588e897eea21b33b8a86e9adcc4d.tar.gz
dfhack-9afcea3debd7588e897eea21b33b8a86e9adcc4d.tar.bz2
dfhack-9afcea3debd7588e897eea21b33b8a86e9adcc4d.tar.xz
In all loops that iterate across a vector, use a size_t as the index
Diffstat (limited to 'plugins/cleaners.cpp')
-rw-r--r--plugins/cleaners.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/cleaners.cpp b/plugins/cleaners.cpp
index 8fb5af93..de46dac3 100644
--- a/plugins/cleaners.cpp
+++ b/plugins/cleaners.cpp
@@ -38,7 +38,7 @@ command_result cleanmap (Core * c, bool snow, bool mud)
block->occupancy[x][y].bits.arrow_variant = 0;
}
}
- for (int j = 0; j < block->block_events.size(); j++)
+ for (size_t j = 0; j < block->block_events.size(); j++)
{
df::block_square_event *evt = block->block_events[j];
if (evt->getType() != block_square_event_type::material_spatter)
@@ -74,13 +74,13 @@ command_result cleanitems (Core * c)
{
// Invoked from clean(), already suspended
int cleaned_items = 0, cleaned_total = 0;
- for (int i = 0; i < world->items.all.size(); i++)
+ for (size_t i = 0; i < world->items.all.size(); i++)
{
// currently, all item classes extend item_actual, so this should be safe
df::item_actual *item = (df::item_actual *)world->items.all[i];
if (item->contaminants && item->contaminants->size())
{
- for (int j = 0; j < item->contaminants->size(); j++)
+ for (size_t j = 0; j < item->contaminants->size(); j++)
delete item->contaminants->at(j);
cleaned_items++;
cleaned_total += item->contaminants->size();
@@ -95,14 +95,13 @@ command_result cleanitems (Core * c)
command_result cleanunits (Core * c)
{
// Invoked from clean(), already suspended
- int num_units = world->units.all.size();
int cleaned_units = 0, cleaned_total = 0;
- for (int i = 0; i < num_units; i++)
+ for (size_t i = 0; i < world->units.all.size(); i++)
{
df::unit *unit = world->units.all[i];
if (unit->body.spatters.size())
{
- for (int j = 0; j < unit->body.spatters.size(); j++)
+ for (size_t j = 0; j < unit->body.spatters.size(); j++)
delete unit->body.spatters[j];
cleaned_units++;
cleaned_total += unit->body.spatters.size();
@@ -134,7 +133,7 @@ DFhackCExport command_result spotclean (Core * c, vector <string> & parameters)
return CR_FAILURE;
}
- for (int i = 0; i < block->block_events.size(); i++)
+ for (size_t i = 0; i < block->block_events.size(); i++)
{
df::block_square_event *evt = block->block_events[i];
if (evt->getType() != block_square_event_type::material_spatter)
@@ -153,7 +152,7 @@ DFhackCExport command_result clean (Core * c, vector <string> & parameters)
bool mud = false;
bool units = false;
bool items = false;
- for(int i = 0; i < parameters.size();i++)
+ for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "map")
map = true;