Merge remote-tracking branch 'upstream/master'

develop
Mike Stewart 2012-01-31 11:45:20 -08:00
commit 7d55b84545
38 changed files with 233 additions and 234 deletions

@ -65,6 +65,7 @@ using namespace DFHack;
using namespace tthread;
using namespace df::enums;
using df::global::init;
struct Core::Cond
{
@ -100,7 +101,7 @@ void cheap_tokenise(string const& input, vector<string> &output)
{
string *cur = NULL;
for (unsigned i = 0; i < input.size(); i++) {
for (size_t i = 0; i < input.size(); i++) {
char c = input[i];
if (isspace(c)) {
cur = NULL;
@ -222,7 +223,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
{
Plugin *plug = plug_mgr->getPluginByCommand(parts[0]);
if (plug) {
for (int j = 0; j < plug->size();j++)
for (size_t j = 0; j < plug->size();j++)
{
const PluginCommand & pcmd = (plug->operator[](j));
if (pcmd.name != parts[0])
@ -251,7 +252,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
string & plugname = parts[0];
if(plugname == "all")
{
for(int i = 0; i < plug_mgr->size();i++)
for(size_t i = 0; i < plug_mgr->size();i++)
{
Plugin * plug = (plug_mgr->operator[](i));
plug->load();
@ -278,7 +279,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
string & plugname = parts[0];
if(plugname == "all")
{
for(int i = 0; i < plug_mgr->size();i++)
for(size_t i = 0; i < plug_mgr->size();i++)
{
Plugin * plug = (plug_mgr->operator[](i));
plug->reload();
@ -305,7 +306,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
string & plugname = parts[0];
if(plugname == "all")
{
for(int i = 0; i < plug_mgr->size();i++)
for(size_t i = 0; i < plug_mgr->size();i++)
{
Plugin * plug = (plug_mgr->operator[](i));
plug->unload();
@ -335,7 +336,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
{
con.printerr("There's no plugin called %s!\n",plugname.c_str());
}
else for (int j = 0; j < plug->size();j++)
else for (size_t j = 0; j < plug->size();j++)
{
const PluginCommand & pcmd = (plug->operator[](j));
if (pcmd.isHotkeyCommand())
@ -361,12 +362,12 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
"\n"
"plugins:\n"
);
for(int i = 0; i < plug_mgr->size();i++)
for(size_t i = 0; i < plug_mgr->size();i++)
{
const Plugin * plug = (plug_mgr->operator[](i));
if(!plug->size())
continue;
for (int j = 0; j < plug->size();j++)
for (size_t j = 0; j < plug->size();j++)
{
const PluginCommand & pcmd = (plug->operator[](j));
if (pcmd.isHotkeyCommand())
@ -379,7 +380,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
}
else if(first == "plug")
{
for(int i = 0; i < plug_mgr->size();i++)
for(size_t i = 0; i < plug_mgr->size();i++)
{
const Plugin * plug = (plug_mgr->operator[](i));
if(!plug->size())
@ -404,7 +405,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
}
else if (parts.size() >= 2 && parts[0] == "clear")
{
for (unsigned i = 1; i < parts.size(); i++)
for (size_t i = 1; i < parts.size(); i++)
{
if (!core->ClearKeyBindings(parts[i])) {
con.printerr("Invalid key spec: %s\n", parts[i].c_str());
@ -417,7 +418,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
std::vector<std::string> list = core->ListKeyBindings(parts[1]);
if (list.empty())
con << "No bindings." << endl;
for (unsigned i = 0; i < list.size(); i++)
for (size_t i = 0; i < list.size(); i++)
con << " " << list[i] << endl;
}
else
@ -630,7 +631,7 @@ bool Core::Init()
// init the console.
Gui * g = getGui();
bool is_text_mode = false;
if(df::global::init && df::global::init->display.flag.is_set(df::enums::init_display_flags::TEXT))
if(init && init->display.flag.is_set(init_display_flags::TEXT))
{
is_text_mode = true;
}
@ -818,7 +819,7 @@ int Core::Shutdown ( void )
plug_mgr = 0;
}
// invalidate all modules
for(unsigned int i = 0 ; i < allModules.size(); i++)
for(size_t i = 0 ; i < allModules.size(); i++)
{
delete allModules[i];
}

@ -125,7 +125,7 @@ Plugin::Plugin(Core * core, const std::string & filepath, const std::string & _f
filename = filepath;
parent = pm;
name.reserve(_filename.size());
for(int i = 0; i < _filename.size();i++)
for(size_t i = 0; i < _filename.size();i++)
{
char ch = _filename[i];
if(ch == '.')
@ -274,7 +274,7 @@ command_result Plugin::invoke( std::string & command, std::vector <std::string>
access->lock_add();
if(state == PS_LOADED)
{
for (int i = 0; i < commands.size();i++)
for (size_t i = 0; i < commands.size();i++)
{
PluginCommand &cmd = commands[i];
if(cmd.name == command)
@ -322,7 +322,7 @@ bool Plugin::can_invoke_hotkey( std::string & command, df::viewscreen *top )
access->lock_add();
if(state == PS_LOADED)
{
for (int i = 0; i < commands.size();i++)
for (size_t i = 0; i < commands.size();i++)
{
PluginCommand &cmd = commands[i];
if(cmd.name == command)
@ -384,7 +384,7 @@ PluginManager::PluginManager(Core * core)
cmdlist_mutex = new mutex();
vector <string> filez;
getdir(path, filez);
for(int i = 0; i < filez.size();i++)
for(size_t i = 0; i < filez.size();i++)
{
if(hasEnding(filez[i],searchstr))
{
@ -398,7 +398,7 @@ PluginManager::PluginManager(Core * core)
PluginManager::~PluginManager()
{
for(int i = 0; i < all_plugins.size();i++)
for(size_t i = 0; i < all_plugins.size();i++)
{
delete all_plugins[i];
}
@ -408,7 +408,7 @@ PluginManager::~PluginManager()
Plugin *PluginManager::getPluginByName (const std::string & name)
{
for(int i = 0; i < all_plugins.size(); i++)
for(size_t i = 0; i < all_plugins.size(); i++)
{
if(name == all_plugins[i]->name)
return all_plugins[i];
@ -441,7 +441,7 @@ bool PluginManager::CanInvokeHotkey(std::string &command, df::viewscreen *top)
void PluginManager::OnUpdate( void )
{
for(int i = 0; i < all_plugins.size(); i++)
for(size_t i = 0; i < all_plugins.size(); i++)
{
all_plugins[i]->on_update();
}
@ -449,7 +449,7 @@ void PluginManager::OnUpdate( void )
void PluginManager::OnStateChange( state_change_event event )
{
for(int i = 0; i < all_plugins.size(); i++)
for(size_t i = 0; i < all_plugins.size(); i++)
{
all_plugins[i]->on_state_change(event);
}
@ -460,7 +460,7 @@ void PluginManager::registerCommands( Plugin * p )
{
cmdlist_mutex->lock();
vector <PluginCommand> & cmds = p->commands;
for(int i = 0; i < cmds.size();i++)
for(size_t i = 0; i < cmds.size();i++)
{
belongs[cmds[i].name] = p;
}
@ -472,7 +472,7 @@ void PluginManager::unregisterCommands( Plugin * p )
{
cmdlist_mutex->lock();
vector <PluginCommand> & cmds = p->commands;
for(int i = 0; i < cmds.size();i++)
for(size_t i = 0; i < cmds.size();i++)
{
belongs.erase(cmds[i].name);
}

@ -83,7 +83,7 @@ namespace DFHack
vtable = old.vtable;
assign = old.assign;
type_offset = old.type_offset;
for(uint32_t i = 0; i < old.subs.size();i++)
for(size_t i = 0; i < old.subs.size();i++)
{
t_type * t = new t_type (*old.subs[i]);
subs.push_back(t);
@ -97,7 +97,7 @@ namespace DFHack
}
~t_class()
{
for(uint32_t i = 0; i < subs.size();i++)
for(size_t i = 0; i < subs.size();i++)
{
delete subs[i];
}
@ -730,7 +730,7 @@ void VersionInfo::copy(const VersionInfo * old)
d->has_timestamp = old->d->has_timestamp;
d->base = old->d->base;
//d->classes = old.d->classes;
for(uint32_t i = 0; i < old->d->classes.size(); i++)
for(size_t i = 0; i < old->d->classes.size(); i++)
{
t_class * copy = new t_class(*old->d->classes[i]);
d->classes.push_back(copy);
@ -757,7 +757,7 @@ void VersionInfo::setParentProcess(Process * _p)
VersionInfo::~VersionInfo()
{
// delete the vtables
for(uint32_t i = 0; i < d->classes.size();i++)
for(size_t i = 0; i < d->classes.size();i++)
{
delete d->classes[i];
}
@ -966,7 +966,7 @@ t_class * VersionInfo::setClass (const char * name, uint32_t vtable, uint32_t ty
{
if(name == 0)
return 0;
for (uint32_t i=0; i<d->classes.size(); i++)
for (size_t i=0; i<d->classes.size(); i++)
{
if(d->classes[i]->classname == name)
{
@ -1000,7 +1000,7 @@ t_class * VersionInfo::setClass (const char * name, uint32_t vtable, uint32_t ty
void VersionInfo::setClassChild (t_class * parent, const char * name, const char * type)
{
vector <t_type *>& vec = parent->subs;
for (uint32_t i=0; i<vec.size(); i++)
for (size_t i=0; i<vec.size(); i++)
{
if(vec[i]->classname == name)
{
@ -1054,7 +1054,7 @@ bool VersionInfo::resolveObjectToClassID(const char * address, int32_t & classid
uint32_t type = d->p->readWord(address + cl->type_offset);
// return typed building if successful
//FIXME: the vector should map directly to the type IDs here, so we don't have to mess with O(n) search
for (uint32_t k = 0; k < vec.size();k++)
for (size_t k = 0; k < vec.size();k++)
{
if(vec[k]->type == type)
{
@ -1076,7 +1076,7 @@ bool VersionInfo::resolveObjectToClassID(const char * address, int32_t & classid
bool VersionInfo::resolveClassnameToVPtr(const string classname, void * & vptr)
{
// FIXME: another stupid search.
for(uint32_t i = 0;i< d->classes.size();i++)
for(size_t i = 0;i< d->classes.size();i++)
{
//if(classes[i].)
if(d->classes[i]->classname == classname) // got class
@ -1094,7 +1094,7 @@ bool VersionInfo::resolveClassnameToClassID (const string classname, int32_t & c
{
// FIXME: another stupid search.
classID = -1;
for(uint32_t i = 0;i< d->classnames.size();i++)
for(size_t i = 0;i< d->classnames.size();i++)
{
if(d->classnames[i] == classname)
{

@ -109,7 +109,7 @@ VersionInfoFactory::~VersionInfoFactory()
void VersionInfoFactory::clear(void)
{
// for each stored version, delete
for(uint32_t i = 0; i < versions.size();i++)
for(size_t i = 0; i < versions.size();i++)
{
delete versions[i];
}
@ -121,7 +121,7 @@ void VersionInfoFactory::clear(void)
VersionInfo * VersionInfoFactory::getVersionInfoByMD5(string hash)
{
VersionInfo * vinfo;
for(uint32_t i = 0; i < versions.size();i++)
for(size_t i = 0; i < versions.size();i++)
{
vinfo = versions[i];
string test_hash;
@ -137,7 +137,7 @@ VersionInfo * VersionInfoFactory::getVersionInfoByPETimestamp(uint32_t timestamp
{
VersionInfo * vinfo;
//cout << "lookup size:" << versions.size() << endl;
for(uint32_t i = 0; i < versions.size();i++)
for(size_t i = 0; i < versions.size();i++)
{
vinfo = versions[i];
uint32_t test_PE;
@ -724,7 +724,7 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
// transform elements
{
// trash existing list
for(uint32_t i = 0; i < versions.size(); i++)
for(size_t i = 0; i < versions.size(); i++)
{
delete versions[i];
}
@ -759,7 +759,7 @@ bool VersionInfoFactory::loadFile(string path_to_xml)
}
}
// Parse the versions
for(uint32_t i = 0; i< v_sEntries.size();i++)
for(size_t i = 0; i< v_sEntries.size();i++)
{
//FIXME: add a set of entries processed in a step of this cycle, use it to check for infinite loops
string & name = v_sEntries[i];

@ -1,4 +1,4 @@
bool isOre()
{
return flags.is_set(df::inorganic_flags::METAL_ORE) || flags.is_set(df::inorganic_flags::THREAD_METAL);
return flags.is_set(df::enums::inorganic_flags::METAL_ORE) || flags.is_set(df::enums::inorganic_flags::THREAD_METAL);
}

@ -1,8 +1,8 @@
bool isGem()
{
return flags.is_set(df::material_flags::IS_GEM);
return flags.is_set(df::enums::material_flags::IS_GEM);
}
bool isStone()
{
return flags.is_set(df::material_flags::IS_STONE);
return flags.is_set(df::enums::material_flags::IS_STONE);
}

@ -188,7 +188,7 @@ bool ItemTypeInfo::find(const std::string &token)
switch (type) {
#define ITEM(type,vec,tclass) \
case type: \
for (int i = 0; i < defs.vec.size(); i++) { \
for (size_t i = 0; i < defs.vec.size(); i++) { \
if (defs.vec[i]->id == items[1]) { \
subtype = i; custom = defs.vec[i]; return true; \
} \
@ -427,10 +427,10 @@ bool Items::copyItem(df::item * itembase, DFHack::dfh_item &item)
int32_t Items::getItemOwnerID(const df::item * item)
{
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() == general_ref_type::UNIT_ITEMOWNER)
return ref->getID();
}
return -1;
@ -438,10 +438,10 @@ int32_t Items::getItemOwnerID(const df::item * item)
df::unit *Items::getItemOwner(const df::item * item)
{
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() == general_ref_type::UNIT_ITEMOWNER)
return ref->getUnit();
}
return NULL;
@ -449,10 +449,10 @@ df::unit *Items::getItemOwner(const df::item * item)
int32_t Items::getItemContainerID(const df::item * item)
{
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
return ref->getID();
}
return -1;
@ -460,10 +460,10 @@ int32_t Items::getItemContainerID(const df::item * item)
df::item *Items::getItemContainer(const df::item * item)
{
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
return ref->getItem();
}
return NULL;
@ -471,14 +471,14 @@ df::item *Items::getItemContainer(const df::item * item)
bool Items::getContainedItems(const df::item * item, std::vector<int32_t> &items)
{
return readItemRefs(item, df::general_ref_type::CONTAINS_ITEM, items);
return readItemRefs(item, general_ref_type::CONTAINS_ITEM, items);
}
bool Items::readItemRefs(const df::item * item, df::general_ref_type type, std::vector<int32_t> &values)
{
values.clear();
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == type)
@ -490,10 +490,10 @@ bool Items::readItemRefs(const df::item * item, df::general_ref_type type, std::
bool Items::removeItemOwner(df::item * item)
{
for (uint32_t i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() != df::general_ref_type::UNIT_ITEMOWNER)
if (ref->getType() != general_ref_type::UNIT_ITEMOWNER)
continue;
df::unit *unit = ref->getUnit();

@ -210,13 +210,13 @@ void DFHack::printJobDetails(Core *c, df::job *job)
if (!job->reaction_name.empty())
c->con << " reaction: " << job->reaction_name << endl;
for (unsigned i = 0; i < job->job_items.size(); i++)
for (size_t i = 0; i < job->job_items.size(); i++)
print_job_item_details(c, job, i, job->job_items[i]);
}
df::building *DFHack::getJobHolder(df::job *job)
{
for (unsigned i = 0; i < job->references.size(); i++)
for (size_t i = 0; i < job->references.size(); i++)
{
VIRTUAL_CAST_VAR(ref, df::general_ref_building_holderst, job->references[i]);
if (ref)

@ -48,31 +48,32 @@ using namespace std;
using namespace DFHack;
using namespace DFHack::Simple;
using namespace df::enums;
using df::global::world;
const char * DFHack::sa_feature(df::feature_type index)
{
switch(index)
{
case df::feature_type::outdoor_river:
case feature_type::outdoor_river:
return "River";
case df::feature_type::cave:
case feature_type::cave:
return "Cave";
case df::feature_type::pit:
case feature_type::pit:
return "Pit";
case df::feature_type::magma_pool:
case feature_type::magma_pool:
return "Magma pool";
case df::feature_type::volcano:
case feature_type::volcano:
return "Volcano";
case df::feature_type::deep_special_tube:
case feature_type::deep_special_tube:
return "Adamantine deposit";
case df::feature_type::deep_surface_portal:
case feature_type::deep_surface_portal:
return "Underworld portal";
case df::feature_type::subterranean_from_layer:
case feature_type::subterranean_from_layer:
return "Cavern";
case df::feature_type::magma_core_from_layer:
case feature_type::magma_core_from_layer:
return "Magma sea";
case df::feature_type::feature_underworld_from_layer:
case feature_type::feature_underworld_from_layer:
return "Underworld";
default:
return "Unknown/Error";
@ -184,7 +185,7 @@ bool Maps::ReadDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool &dirtybit)
df::map_block *block = getBlock(x,y,z);
if (block)
{
dirtybit = block->flags.is_set(df::block_flags::Designated);
dirtybit = block->flags.is_set(block_flags::Designated);
return true;
}
return false;
@ -195,7 +196,7 @@ bool Maps::WriteDirtyBit(uint32_t x, uint32_t y, uint32_t z, bool dirtybit)
df::map_block *block = getBlock(x,y,z);
if (block)
{
block->flags.set(df::block_flags::Designated, dirtybit);
block->flags.set(block_flags::Designated, dirtybit);
return true;
}
return false;
@ -475,7 +476,7 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
vector <df::block_square_event_mineralst *>* veins,
vector <df::block_square_event_frozen_liquidst *>* ices,
vector <df::block_square_event_material_spatterst *> *splatter,
vector <df::block_square_event_grassst *> *grass,
vector <df::block_square_event_grassst *> *grasses,
vector <df::block_square_event_world_constructionst *> *constructions)
{
if (veins)
@ -484,8 +485,8 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
ices->clear();
if (splatter)
splatter->clear();
if (grass)
grass->clear();
if (grasses)
grasses->clear();
if (constructions)
constructions->clear();
@ -493,30 +494,29 @@ bool Maps::SortBlockEvents(uint32_t x, uint32_t y, uint32_t z,
if (!block)
return false;
uint32_t size = block->block_events.size();
// read all events
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < block->block_events.size(); i++)
{
df::block_square_event *evt = block->block_events[i];
switch (evt->getType())
{
case df::block_square_event_type::mineral:
case block_square_event_type::mineral:
if (veins)
veins->push_back((df::block_square_event_mineralst *)evt);
break;
case df::block_square_event_type::frozen_liquid:
case block_square_event_type::frozen_liquid:
if (ices)
ices->push_back((df::block_square_event_frozen_liquidst *)evt);
break;
case df::block_square_event_type::material_spatter:
case block_square_event_type::material_spatter:
if (splatter)
splatter->push_back((df::block_square_event_material_spatterst *)evt);
break;
case df::block_square_event_type::grass:
if (grass)
grass->push_back((df::block_square_event_grassst *)evt);
case block_square_event_type::grass:
if (grasses)
grasses->push_back((df::block_square_event_grassst *)evt);
break;
case df::block_square_event_type::world_construction:
case block_square_event_type::world_construction:
if (constructions)
constructions->push_back((df::block_square_event_world_constructionst *)evt);
break;
@ -530,7 +530,7 @@ bool Maps::RemoveBlockEvent(uint32_t x, uint32_t y, uint32_t z, df::block_square
df::map_block * block = getBlock(x,y,z);
if (!block)
return false;
for (uint32_t i = 0; i < block->block_events.size(); i++)
for (size_t i = 0; i < block->block_events.size(); i++)
{
if (block->block_events[i] == which)
{
@ -580,7 +580,7 @@ bool Maps::ReadGeology (vector < vector <uint16_t> >& assign)
v_geology[i].reserve(geolayers.size());
// finally, read the layer matgloss
for (uint32_t j = 0; j < geolayers.size(); j++)
for (size_t j = 0; j < geolayers.size(); j++)
v_geology[i].push_back(geolayers[j]->mat_index);
}

@ -220,7 +220,7 @@ bool MaterialInfo::findInorganic(const std::string &token)
}
df::world_raws &raws = world->raws;
for (unsigned i = 0; i < raws.inorganics.size(); i++)
for (size_t i = 0; i < raws.inorganics.size(); i++)
{
df::inorganic_raw *p = raws.inorganics[i];
if (p->id == token)
@ -234,7 +234,7 @@ bool MaterialInfo::findPlant(const std::string &token, const std::string &subtok
if (token.empty())
return decode(-1);
df::world_raws &raws = world->raws;
for (unsigned i = 0; i < raws.plants.all.size(); i++)
for (size_t i = 0; i < raws.plants.all.size(); i++)
{
df::plant_raw *p = raws.plants.all[i];
if (p->id != token)
@ -244,7 +244,7 @@ bool MaterialInfo::findPlant(const std::string &token, const std::string &subtok
if (subtoken.empty())
return decode(p->material_defs.type_basic_mat, p->material_defs.idx_basic_mat);
for (unsigned j = 0; j < p->material.size(); j++)
for (size_t j = 0; j < p->material.size(); j++)
if (p->material[j]->id == subtoken)
return decode(PLANT_BASE+j, i);
@ -258,13 +258,13 @@ bool MaterialInfo::findCreature(const std::string &token, const std::string &sub
if (token.empty() || subtoken.empty())
return decode(-1);
df::world_raws &raws = world->raws;
for (unsigned i = 0; i < raws.creatures.all.size(); i++)
for (size_t i = 0; i < raws.creatures.all.size(); i++)
{
df::creature_raw *p = raws.creatures.all[i];
if (p->creature_id != token)
continue;
for (unsigned j = 0; j < p->material.size(); j++)
for (size_t j = 0; j < p->material.size(); j++)
if (p->material[j]->id == subtoken)
return decode(CREATURE_BASE+j, i);
@ -503,7 +503,7 @@ bool DFHack::parseJobMaterialCategory(df::job_material_category *cat, const std:
std::vector<std::string> items;
split_string(&items, toLower(token), ",", true);
for (unsigned i = 0; i < items.size(); i++)
for (size_t i = 0; i < items.size(); i++)
{
int id = findBitfieldField(*cat, items[i]);
if (id < 0)
@ -522,7 +522,7 @@ bool DFHack::parseJobMaterialCategory(df::dfhack_material_category *cat, const s
std::vector<std::string> items;
split_string(&items, toLower(token), ",", true);
for (unsigned i = 0; i < items.size(); i++)
for (size_t i = 0; i < items.size(); i++)
{
int id = findBitfieldField(*cat, items[i]);
if (id < 0)
@ -597,10 +597,10 @@ bool t_matglossInorganic::isGem()
bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorganic)
{
Process * p = d->owner;
uint32_t size = world->raws.inorganics.size();
size_t size = world->raws.inorganics.size();
inorganic.clear();
inorganic.reserve (size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
df::inorganic_raw *orig = world->raws.inorganics[i];
t_matglossInorganic mat;
@ -624,10 +624,10 @@ bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorg
bool Materials::CopyOrganicMaterials (std::vector<t_matgloss> & organic)
{
uint32_t size = world->raws.plants.all.size();
size_t size = world->raws.plants.all.size();
organic.clear();
organic.reserve (size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
t_matgloss mat;
mat.id = world->raws.plants.all[i]->id;
@ -638,10 +638,10 @@ bool Materials::CopyOrganicMaterials (std::vector<t_matgloss> & organic)
bool Materials::CopyWoodMaterials (std::vector<t_matgloss> & tree)
{
uint32_t size = world->raws.plants.trees.size();
size_t size = world->raws.plants.trees.size();
tree.clear();
tree.reserve (size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
t_matgloss mat;
mat.id = world->raws.plants.trees[i]->id;
@ -652,10 +652,10 @@ bool Materials::CopyWoodMaterials (std::vector<t_matgloss> & tree)
bool Materials::CopyPlantMaterials (std::vector<t_matgloss> & plant)
{
uint32_t size = world->raws.plants.bushes.size();
size_t size = world->raws.plants.bushes.size();
plant.clear();
plant.reserve (size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
t_matgloss mat;
mat.id = world->raws.plants.bushes[i]->id;
@ -666,10 +666,10 @@ bool Materials::CopyPlantMaterials (std::vector<t_matgloss> & plant)
bool Materials::ReadCreatureTypes (void)
{
uint32_t size = world->raws.creatures.all.size();
size_t size = world->raws.creatures.all.size();
race.clear();
race.reserve (size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
t_matgloss mat;
mat.id = world->raws.creatures.all[i]->creature_id;
@ -692,13 +692,13 @@ bool Materials::ReadOthers(void)
bool Materials::ReadDescriptorColors (void)
{
uint32_t size = world->raws.language.colors.size();
size_t size = world->raws.language.colors.size();
color.clear();
if(size == 0)
return false;
color.reserve(size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
df::descriptor_color *c = world->raws.language.colors[i];
t_descriptor_color col;
@ -713,7 +713,7 @@ bool Materials::ReadDescriptorColors (void)
size = world->raws.language.patterns.size();
alldesc.clear();
alldesc.reserve(size);
for (uint32_t i = 0; i < size;i++)
for (size_t i = 0; i < size;i++)
{
t_matgloss mat;
mat.id = world->raws.language.patterns[i]->id;
@ -724,10 +724,10 @@ bool Materials::ReadDescriptorColors (void)
bool Materials::ReadCreatureTypesEx (void)
{
uint32_t size = world->raws.creatures.all.size();
size_t size = world->raws.creatures.all.size();
raceEx.clear();
raceEx.reserve (size);
for (uint32_t i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
df::creature_raw *cr = world->raws.creatures.all[i];
t_creaturetype mat;
@ -737,8 +737,8 @@ bool Materials::ReadCreatureTypesEx (void)
mat.tilecolor.back = cr->color[1];
mat.tilecolor.bright = cr->color[2];
uint32_t sizecas = cr->caste.size();
for (uint32_t j = 0; j < sizecas;j++)
size_t sizecas = cr->caste.size();
for (size_t j = 0; j < sizecas;j++)
{
df::caste_raw *ca = cr->caste[j];
/* caste name */
@ -751,15 +751,15 @@ bool Materials::ReadCreatureTypesEx (void)
// color mod reading
// Caste + offset > color mod vector
auto & colorings = ca->color_modifiers;
uint32_t sizecolormod = colorings.size();
size_t sizecolormod = colorings.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
for(size_t k = 0; k < sizecolormod;k++)
{
// color mod [0] -> color list
auto & indexes = colorings[k]->color_indexes;
uint32_t sizecolorlist = indexes.size();
size_t sizecolorlist = indexes.size();
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
for(size_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k].colorlist[l] = indexes[l];
// color mod [color_modifier_part_offset] = string part
caste.ColorModifier[k].part = colorings[k]->part;
@ -769,8 +769,8 @@ bool Materials::ReadCreatureTypesEx (void)
// body parts
caste.bodypart.empty();
uint32_t sizebp = ca->body_info.body_parts.size();
for (uint32_t k = 0; k < sizebp; k++)
size_t sizebp = ca->body_info.body_parts.size();
for (size_t k = 0; k < sizebp; k++)
{
df::body_part_raw *bp = ca->body_info.body_parts[k];
t_bodypart part;
@ -781,30 +781,30 @@ bool Materials::ReadCreatureTypesEx (void)
for (int32_t k = 0; k < 7; k++)
{
caste.strength[k] = ca->attributes.phys_att_range[df::physical_attribute_type::STRENGTH][k];
caste.agility[k] = ca->attributes.phys_att_range[df::physical_attribute_type::AGILITY][k];
caste.toughness[k] = ca->attributes.phys_att_range[df::physical_attribute_type::TOUGHNESS][k];
caste.endurance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::ENDURANCE][k];
caste.recuperation[k] = ca->attributes.phys_att_range[df::physical_attribute_type::RECUPERATION][k];
caste.disease_resistance[k] = ca->attributes.phys_att_range[df::physical_attribute_type::DISEASE_RESISTANCE][k];
caste.analytical_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::ANALYTICAL_ABILITY][k];
caste.focus[k] = ca->attributes.phys_att_range[df::mental_attribute_type::FOCUS][k];
caste.willpower[k] = ca->attributes.phys_att_range[df::mental_attribute_type::WILLPOWER][k];
caste.creativity[k] = ca->attributes.phys_att_range[df::mental_attribute_type::CREATIVITY][k];
caste.intuition[k] = ca->attributes.phys_att_range[df::mental_attribute_type::INTUITION][k];
caste.patience[k] = ca->attributes.phys_att_range[df::mental_attribute_type::PATIENCE][k];
caste.memory[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MEMORY][k];
caste.linguistic_ability[k] = ca->attributes.phys_att_range[df::mental_attribute_type::LINGUISTIC_ABILITY][k];
caste.spatial_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SPATIAL_SENSE][k];
caste.musicality[k] = ca->attributes.phys_att_range[df::mental_attribute_type::MUSICALITY][k];
caste.kinesthetic_sense[k] = ca->attributes.phys_att_range[df::mental_attribute_type::KINESTHETIC_SENSE][k];
caste.empathy[k] = ca->attributes.phys_att_range[df::mental_attribute_type::EMPATHY][k];
caste.social_awareness[k] = ca->attributes.phys_att_range[df::mental_attribute_type::SOCIAL_AWARENESS][k];
caste.strength[k] = ca->attributes.phys_att_range[physical_attribute_type::STRENGTH][k];
caste.agility[k] = ca->attributes.phys_att_range[physical_attribute_type::AGILITY][k];
caste.toughness[k] = ca->attributes.phys_att_range[physical_attribute_type::TOUGHNESS][k];
caste.endurance[k] = ca->attributes.phys_att_range[physical_attribute_type::ENDURANCE][k];
caste.recuperation[k] = ca->attributes.phys_att_range[physical_attribute_type::RECUPERATION][k];
caste.disease_resistance[k] = ca->attributes.phys_att_range[physical_attribute_type::DISEASE_RESISTANCE][k];
caste.analytical_ability[k] = ca->attributes.phys_att_range[mental_attribute_type::ANALYTICAL_ABILITY][k];
caste.focus[k] = ca->attributes.phys_att_range[mental_attribute_type::FOCUS][k];
caste.willpower[k] = ca->attributes.phys_att_range[mental_attribute_type::WILLPOWER][k];
caste.creativity[k] = ca->attributes.phys_att_range[mental_attribute_type::CREATIVITY][k];
caste.intuition[k] = ca->attributes.phys_att_range[mental_attribute_type::INTUITION][k];
caste.patience[k] = ca->attributes.phys_att_range[mental_attribute_type::PATIENCE][k];
caste.memory[k] = ca->attributes.phys_att_range[mental_attribute_type::MEMORY][k];
caste.linguistic_ability[k] = ca->attributes.phys_att_range[mental_attribute_type::LINGUISTIC_ABILITY][k];
caste.spatial_sense[k] = ca->attributes.phys_att_range[mental_attribute_type::SPATIAL_SENSE][k];
caste.musicality[k] = ca->attributes.phys_att_range[mental_attribute_type::MUSICALITY][k];
caste.kinesthetic_sense[k] = ca->attributes.phys_att_range[mental_attribute_type::KINESTHETIC_SENSE][k];
caste.empathy[k] = ca->attributes.phys_att_range[mental_attribute_type::EMPATHY][k];
caste.social_awareness[k] = ca->attributes.phys_att_range[mental_attribute_type::SOCIAL_AWARENESS][k];
}
mat.castes.push_back(caste);
}
for (uint32_t j = 0; j < world->raws.creatures.all[i]->material.size(); j++)
for (size_t j = 0; j < world->raws.creatures.all[i]->material.size(); j++)
{
t_creatureextract extract;
extract.id = world->raws.creatures.all[i]->material[j]->id;

@ -82,8 +82,8 @@ int32_t Units::GetCreatureInBox (int32_t index, df::unit ** furball,
if (!isValid())
return -1;
uint32_t size = world->units.all.size();
while (uint32_t(index) < size)
size_t size = world->units.all.size();
while (size_t(index) < size)
{
// read pointer from vector at position
df::unit * temp = world->units.all[index];
@ -482,7 +482,7 @@ bool Units::ReadInventoryByPtr(const df::unit * unit, std::vector<df::item *> &
if(!isValid()) return false;
if(!unit) return false;
items.clear();
for (uint32_t i = 0; i < unit->inventory.size(); i++)
for (size_t i = 0; i < unit->inventory.size(); i++)
items.push_back(unit->inventory[i]->item);
return true;
}

@ -248,7 +248,7 @@ PersistentDataItem World::AddPersistentData(const std::string &key)
PersistentDataItem World::GetPersistentData(const std::string &key)
{
std::vector<df::historical_figure*> &hfvec = df::historical_figure::get_vector();
for (unsigned i = 0; i < hfvec.size(); i++)
for (size_t i = 0; i < hfvec.size(); i++)
{
df::historical_figure *hfig = hfvec[i];
@ -265,7 +265,7 @@ PersistentDataItem World::GetPersistentData(const std::string &key)
void World::GetPersistentData(std::vector<PersistentDataItem> *vec, const std::string &key)
{
std::vector<df::historical_figure*> &hfvec = df::historical_figure::get_vector();
for (unsigned i = 0; i < hfvec.size(); i++)
for (size_t i = 0; i < hfvec.size(); i++)
{
df::historical_figure *hfig = hfvec[i];

@ -57,7 +57,7 @@ void Kitchen::allowPlantSeedCookery(t_materialIndex materialIndex)
for(std::size_t i = 0; i < size(); ++i)
{
if(ui->kitchen.mat_indices[i] == materialIndex
&& (ui->kitchen.item_types[i] == df::item_type::SEEDS || ui->kitchen.item_types[i] == df::item_type::PLANT)
&& (ui->kitchen.item_types[i] == item_type::SEEDS || ui->kitchen.item_types[i] == item_type::PLANT)
&& ui->kitchen.exc_types[i] == cookingExclusion
)
{
@ -86,15 +86,15 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex)
if(ui->kitchen.mat_indices[i] == materialIndex
&& ui->kitchen.exc_types[i] == cookingExclusion)
{
if(ui->kitchen.item_types[i] == df::item_type::SEEDS)
if(ui->kitchen.item_types[i] == item_type::SEEDS)
SeedAlreadyIn = true;
else if (ui->kitchen.item_types[i] == df::item_type::PLANT)
else if (ui->kitchen.item_types[i] == item_type::PLANT)
PlantAlreadyIn = true;
}
}
if(!SeedAlreadyIn)
{
ui->kitchen.item_types.push_back(df::item_type::SEEDS);
ui->kitchen.item_types.push_back(item_type::SEEDS);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_seed);
ui->kitchen.mat_indices.push_back(materialIndex);
@ -102,7 +102,7 @@ void Kitchen::denyPlantSeedCookery(t_materialIndex materialIndex)
}
if(!PlantAlreadyIn)
{
ui->kitchen.item_types.push_back(df::item_type::PLANT);
ui->kitchen.item_types.push_back(item_type::PLANT);
ui->kitchen.item_subtypes.push_back(organicSubtype);
ui->kitchen.mat_types.push_back(type->material_defs.type_basic_mat);
ui->kitchen.mat_indices.push_back(materialIndex);

@ -1 +1 @@
Subproject commit 200131405d59142e6121d76cf5cb097a1f07694b
Subproject commit 7aa928ebe466a4a6036e6bb9e72b12416f0168e4

@ -41,7 +41,7 @@ DFhackCExport const char * plugin_name ( void )
return "autodump";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
DFhackCExport command_result plugin_init ( Core * c, vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand(
@ -78,7 +78,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
return CR_OK;
}
typedef std::map <DFCoord, uint32_t> coordmap;
typedef map <DFCoord, uint32_t> coordmap;
static command_result autodump_main(Core * c, vector <string> & parameters)
{
@ -88,7 +88,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
bool need_visible = false;
bool need_hidden = false;
bool need_forbidden = false;
for (unsigned i = 0; i < parameters.size(); i++)
for (size_t i = 0; i < parameters.size(); i++)
{
string & p = parameters[i];
if(p == "destroy")
@ -118,7 +118,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
c->con.printerr("Map is not available!\n");
return CR_FAILURE;
}
std::size_t numItems = world->items.all.size();
size_t numItems = world->items.all.size();
MapCache MC;
int i = 0;
@ -154,7 +154,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
}
coordmap counts;
// proceed with the dumpification operation
for(std::size_t i=0; i< numItems; i++)
for(size_t i=0; i< numItems; i++)
{
df::item * itm = world->items.all[i];
DFCoord pos_item(itm->pos.x, itm->pos.y, itm->pos.z);
@ -163,7 +163,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
coordmap::iterator it = counts.find(pos_item);
if(it == counts.end())
{
std::pair< coordmap::iterator, bool > inserted = counts.insert(std::make_pair(pos_item,1));
pair< coordmap::iterator, bool > inserted = counts.insert(make_pair(pos_item,1));
it = inserted.first;
}
else
@ -211,7 +211,7 @@ static command_result autodump_main(Core * c, vector <string> & parameters)
df::map_block * bl_tgt = Maps::getBlockAbs(cx, cy, cz);
if(bl_src)
{
std::remove(bl_src->items.begin(), bl_src->items.end(),itm->id);
remove(bl_src->items.begin(), bl_src->items.end(),itm->id);
}
else
{
@ -302,7 +302,7 @@ DFhackCExport command_result df_autodump_destroy_here(Core * c, vector <string>
return autodump_main(c, args);
}
static std::map<int, df::item_flags> pending_destroy;
static map<int, df::item_flags> pending_destroy;
static int last_frame = 0;
DFhackCExport command_result df_autodump_destroy_item(Core * c, vector <string> & parameters)
@ -349,7 +349,7 @@ DFhackCExport command_result df_autodump_destroy_item(Core * c, vector <string>
return CR_FAILURE;
}
for (unsigned i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == general_ref_type::UNIT_HOLDER)

@ -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;

@ -47,7 +47,7 @@ DFhackCExport command_result colonies (Core * c, vector <string> & parameters)
bool destroy = false;
bool convert = false;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "kill")
destroy = true;

@ -25,7 +25,7 @@ DFhackCExport command_result df_drybuckets (Core * c, vector <string> & paramete
CoreSuspender suspend(c);
int dried_total = 0;
for (int i = 0; i < world->items.all.size(); i++)
for (size_t i = 0; i < world->items.all.size(); i++)
{
df::item *item = world->items.all[i];
if ((item->getType() == item_type::LIQUID_MISC) && (item->getMaterial() == builtin_mats::WATER))

@ -35,7 +35,7 @@ DFhackCExport command_result plugin_onupdate ( Core * c )
int32_t race = ui->race_id;
int32_t civ = ui->civ_id;
for (int i = 0; i < world->units.all.size(); i++)
for (size_t i = 0; i < world->units.all.size(); i++)
{
df::unit *unit = world->units.all[i];

@ -93,7 +93,7 @@ DFhackCExport command_result filltraffic(DFHack::Core * c, std::vector<std::stri
bool checkbuilding = true;
//Loop through parameters
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if (params[i] == "help" || params[i] == "?" || params[i].size() != 1)
return CR_WRONG_USAGE;
@ -246,7 +246,7 @@ DFhackCExport command_result alltraffic(DFHack::Core * c, std::vector<std::strin
void (*proc)(DFHack::DFCoord, MapExtras::MapCache &) = allNormal;
//Loop through parameters
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if (params[i] == "help" || params[i] == "?" || params[i].size() != 1)
return CR_WRONG_USAGE;

@ -56,7 +56,7 @@ DFhackCExport command_result df_fixveins (Core * c, vector <string> & parameters
{
df::map_block *block = world->map.map_blocks[i];
uint16_t has_mineral[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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::mineral)

@ -27,7 +27,7 @@ command_result df_fixwagons (Core *c, vector<string> &parameters)
CoreSuspender suspend(c);
int32_t wagon_creature = -1, wagon_puller_creature = -1;
df::creature_raw *wagon, *wagon_puller;
for (int i = 0; i < world->raws.creatures.all.size(); i++)
for (size_t i = 0; i < world->raws.creatures.all.size(); i++)
{
df::creature_raw *cr = world->raws.creatures.all[i];
if (cr->flags.is_set(creature_raw_flags::EQUIPMENT_WAGON) && (wagon_creature == -1))
@ -52,7 +52,7 @@ command_result df_fixwagons (Core *c, vector<string> &parameters)
return CR_FAILURE;
}
int count = 0;
for (int i = 0; i < world->entities.all.size(); i++)
for (size_t i = 0; i < world->entities.all.size(); i++)
{
bool updated = false;
df::historical_entity *ent = world->entities.all[i];
@ -61,7 +61,7 @@ command_result df_fixwagons (Core *c, vector<string> &parameters)
if (ent->resources.animals.wagon_races.size() == 0)
{
updated = true;
for (int j = 0; j < wagon->caste.size(); j++)
for (size_t j = 0; j < wagon->caste.size(); j++)
{
ent->resources.animals.wagon_races.push_back(wagon_creature);
ent->resources.animals.wagon_castes.push_back(j);
@ -70,7 +70,7 @@ command_result df_fixwagons (Core *c, vector<string> &parameters)
if (ent->resources.animals.wagon_puller_races.size() == 0)
{
updated = true;
for (int j = 0; j < wagon_puller->caste.size(); j++)
for (size_t j = 0; j < wagon_puller->caste.size(); j++)
{
ent->resources.animals.wagon_puller_races.push_back(wagon_puller_creature);
ent->resources.animals.wagon_puller_castes.push_back(j);

@ -24,7 +24,7 @@ DFhackCExport command_result df_flows (Core * c, vector <string> & parameters)
int flow1 = 0, flow2 = 0, flowboth = 0, water = 0, magma = 0;
c->con.print("Counting flows and liquids ...\n");
for (int i = 0; i < world->map.map_blocks.size(); i++)
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block *cur = world->map.map_blocks[i];
if (cur->flags.is_set(block_flags::UpdateLiquid))

@ -54,7 +54,7 @@ DFhackCExport command_result df_getplants (Core * c, vector <string> & parameter
CoreSuspender suspend(c);
for (int i = 0; i < world->raws.plants.all.size(); i++)
for (size_t i = 0; i < world->raws.plants.all.size(); i++)
{
df::plant_raw *plant = world->raws.plants.all[i];
if (plantNames.find(plant->id) != plantNames.end())
@ -75,7 +75,7 @@ DFhackCExport command_result df_getplants (Core * c, vector <string> & parameter
if (plantIDs.size() == 0)
{
c->con.print("Valid plant IDs:\n");
for (int i = 0; i < world->raws.plants.all.size(); i++)
for (size_t i = 0; i < world->raws.plants.all.size(); i++)
{
df::plant_raw *plant = world->raws.plants.all[i];
if (plant->flags.is_set(plant_raw_flags::GRASS))
@ -86,11 +86,11 @@ DFhackCExport command_result df_getplants (Core * c, vector <string> & parameter
}
count = 0;
for (int i = 0; i < world->map.map_blocks.size(); i++)
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block *cur = world->map.map_blocks[i];
bool dirty = false;
for (int j = 0; j < cur->plants.size(); j++)
for (size_t j = 0; j < cur->plants.size(); j++)
{
const df::plant *plant = cur->plants[i];
int x = plant->pos.x % 16;

@ -154,7 +154,7 @@ static command_result job_material_in_job(Core *c, MaterialInfo &new_mat)
return CR_FAILURE;
}
for (unsigned i = 0; i < job->job_items.size(); i++)
for (size_t i = 0; i < job->job_items.size(); i++)
{
df::job_item *item = job->job_items[i];
MaterialInfo item_mat(item);
@ -178,7 +178,7 @@ static command_result job_material_in_job(Core *c, MaterialInfo &new_mat)
job->mat_type = new_mat.type;
job->mat_index = new_mat.index;
for (unsigned i = 0; i < job->job_items.size(); i++)
for (size_t i = 0; i < job->job_items.size(); i++)
{
df::job_item *item = job->job_items[i];
item->mat_type = new_mat.type;
@ -224,10 +224,10 @@ static command_result job_material_in_build(Core *c, MaterialInfo &new_mat)
// Loop through matching choices
bool matches = build_choice_matches(req, sel->choices[sel->sel_index], new_mat, true);
int size = sel->choices.size();
size_t size = sel->choices.size();
int base = (matches ? sel->sel_index + 1 : 0);
for (unsigned i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
int idx = (base + i) % size;
@ -335,7 +335,7 @@ static command_result job_cmd(Core * c, vector <string> & parameters)
return CR_WRONG_USAGE;
df::building *selected = world->selected_building;
for (unsigned i = 0; i < selected->jobs.size(); i++)
for (size_t i = 0; i < selected->jobs.size(); i++)
printJobDetails(c, selected->jobs[i]);
}
}

@ -169,7 +169,7 @@ DFhackCExport command_result df_liquids (Core * c, vector <string> & parameters)
int32_t x,y,z;
DFHack::Gui * Position;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{

@ -42,7 +42,7 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
DFhackCExport command_result mapexport (Core * c, std::vector <std::string> & parameters)
{
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{

@ -51,7 +51,7 @@ enum do_what
static bool getoptions( vector <string> & parameters, bool & shrubs, bool & trees, bool & help)
{
for(int i = 0;i < parameters.size();i++)
for(size_t i = 0;i < parameters.size();i++)
{
if(parameters[i] == "shrubs")
{
@ -192,7 +192,7 @@ DFhackCExport command_result df_extirpate (Core * c, vector <string> & parameter
DFhackCExport command_result df_grow (Core * c, vector <string> & parameters)
{
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{

@ -69,8 +69,7 @@ DFhackCExport command_result df_cprobe (Core * c, vector <string> & parameters)
}
else
{
uint32_t ncr = world->units.all.size();
for(auto i = 0; i < ncr; i++)
for(size_t i = 0; i < world->units.all.size(); i++)
{
df::unit * unit = world->units.all[i];
if(unit->pos.x == cursorX && unit->pos.y == cursorY && unit->pos.z == cursorZ)

@ -205,7 +205,7 @@ DFhackCExport command_result prospector (DFHack::Core * c, vector <string> & par
bool showValue = false;
bool showTube = false;
Console & con = c->con;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if (parameters[i] == "all")
{

@ -25,7 +25,7 @@ DFhackCExport command_result df_regrass (Core * c, vector <string> & parameters)
CoreSuspender suspend(c);
int count = 0;
for (int i = 0; i < world->map.map_blocks.size(); i++)
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block *cur = world->map.map_blocks[i];
for (int x = 0; x < 16; x++)

@ -128,7 +128,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
{
bool no_hell = true;
bool pause = true;
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if(params[i]=="hell")
no_hell = false;
@ -175,7 +175,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
Maps::getSize(x_max,y_max,z_max);
hidesaved.reserve(x_max * y_max * z_max);
for (uint32_t i = 0; i < world->map.map_blocks.size(); i++)
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block *block = world->map.map_blocks[i];
// in 'no-hell'/'safe' mode, don't reveal blocks with hell and adamantine
@ -218,7 +218,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string> & params)
{
Console & con = c->con;
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if(params[i] == "help" || params[i] == "?")
{
@ -274,7 +274,7 @@ DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string>
DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector<std::string> & params)
{
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if(params[i] == "help" || params[i] == "?")
{
@ -294,7 +294,7 @@ DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector<std::strin
DFhackCExport command_result revflood(DFHack::Core * c, std::vector<std::string> & params)
{
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if(params[i] == "help" || params[i] == "?")
{
@ -348,7 +348,7 @@ DFhackCExport command_result revflood(DFHack::Core * c, std::vector<std::string>
// hide all tiles, flush cache
Maps::getSize(x_max,y_max,z_max);
for(uint32_t i = 0; i < world->map.map_blocks.size(); i++)
for(size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block * b = world->map.map_blocks[i];
// change the hidden flag to 0

@ -49,7 +49,7 @@ DFhackCExport command_result df_showmood (Core * c, vector <string> & parameters
found = true;
df::unit *unit = NULL;
df::building *building = NULL;
for (int i = 0; i < job->references.size(); i++)
for (size_t i = 0; i < job->references.size(); i++)
{
df::general_ref *ref = job->references[i];
if (ref->getType() == general_ref_type::UNIT_WORKER)
@ -155,7 +155,7 @@ DFhackCExport command_result df_showmood (Core * c, vector <string> & parameters
else
c->con.print(" and has not yet claimed a workshop\n");
for (int i = 0; i < job->job_items.size(); i++)
for (size_t i = 0; i < job->job_items.size(); i++)
{
df::job_item *item = job->job_items[i];
c->con.print("Item %i: ", i + 1);

@ -643,7 +643,7 @@ DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameter
int32_t x = 0, y = 0, z = 0;
DFHack::Gui *gui;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{

@ -41,7 +41,7 @@ DFhackCExport command_result tubefill(DFHack::Core * c, std::vector<std::string>
{
uint64_t count = 0;
for(int i = 0; i < params.size();i++)
for(size_t i = 0; i < params.size();i++)
{
if(params[i] == "help" || params[i] == "?")
{
@ -59,7 +59,7 @@ DFhackCExport command_result tubefill(DFHack::Core * c, std::vector<std::string>
}
// walk the map
for (uint32_t i = 0; i < world->map.map_blocks.size(); i++)
for (size_t i = 0; i < world->map.map_blocks.size(); i++)
{
df::map_block *block = world->map.map_blocks[i];
df::map_block *above = Maps::getBlockAbs(block->map_pos.x, block->map_pos.y, block->map_pos.z + 1);

@ -188,7 +188,7 @@ DFhackCExport command_result digcircle (Core * c, vector <string> & parameters)
static int diameter = 0;
auto saved_d = diameter;
bool force_help = false;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{
@ -782,7 +782,7 @@ DFhackCExport command_result expdig (Core * c, vector <string> & parameters)
bool force_help = false;
static explo_how how = EXPLO_NOTHING;
static explo_what what = EXPLO_HIDDEN;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "help" || parameters[i] == "?")
{
@ -967,7 +967,7 @@ DFhackCExport command_result vdig (Core * c, vector <string> & parameters)
// HOTKEY COMMAND: CORE ALREADY SUSPENDED
uint32_t x_max,y_max,z_max;
bool updown = false;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters.size() && parameters[0]=="x")
updown = true;

@ -48,7 +48,7 @@ DFhackCExport command_result weather (Core * c, vector <string> & parameters)
bool snow = false;
bool rain = false;
bool clear = false;
for(int i = 0; i < parameters.size();i++)
for(size_t i = 0; i < parameters.size();i++)
{
if(parameters[i] == "rain")
rain = true;

@ -414,7 +414,7 @@ static void cleanup_state(Core *c)
stop_protect(c);
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
delete constraints[i];
constraints.clear();
}
@ -678,7 +678,7 @@ static ItemConstraint *get_constraint(Core *c, const std::string &str, Persisten
return NULL;
}
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
ItemConstraint *ct = constraints[i];
if (ct->item == item && ct->material == material &&
@ -724,7 +724,7 @@ static void link_job_constraint(ProtectedJob *pj, df::item_type itype, int16_t i
{
MaterialInfo mat(mat_type, mat_index);
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
ItemConstraint *ct = constraints[i];
@ -768,7 +768,7 @@ static void compute_custom_job(ProtectedJob *pj, df::job *job)
if (!r)
return;
for (unsigned i = 0; i < r->products.size(); i++)
for (size_t i = 0; i < r->products.size(); i++)
{
using namespace df::enums::reaction_product_item_flags;
@ -892,7 +892,7 @@ static void compute_job_outputs(Core *c, ProtectedJob *pj)
if (mat.inorganic)
{
std::vector<int16_t> &ores = mat.inorganic->metal_ore.mat_index;
for (unsigned i = 0; i < ores.size(); i++)
for (size_t i = 0; i < ores.size(); i++)
link_job_constraint(pj, item_type::BAR, -1, 0, 0, ores[i]);
}
return;
@ -901,7 +901,7 @@ static void compute_job_outputs(Core *c, ProtectedJob *pj)
if (mat.inorganic)
{
std::vector<int16_t> &threads = mat.inorganic->thread_metal.mat_index;
for (unsigned i = 0; i < threads.size(); i++)
for (size_t i = 0; i < threads.size(); i++)
link_job_constraint(pj, item_type::THREAD, -1, 0, 0, threads[i]);
}
return;
@ -910,7 +910,7 @@ static void compute_job_outputs(Core *c, ProtectedJob *pj)
if (job->mat_type != -1)
{
std::vector<df::itemdef_foodst*> &food = df::itemdef_foodst::get_vector();
for (unsigned i = 0; i < food.size(); i++)
for (size_t i = 0; i < food.size(); i++)
if (food[i]->level == job->mat_type)
link_job_constraint(pj, item_type::FOOD, i, 0, -1, -1);
return;
@ -953,7 +953,7 @@ static void map_job_constraints(Core *c)
{
melt_active = false;
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
constraints[i]->jobs.clear();
constraints[i]->is_active = false;
@ -981,10 +981,10 @@ static void map_job_constraints(Core *c)
static void dryBucket(df::item *item)
{
for (unsigned i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINS_ITEM)
if (ref->getType() == general_ref_type::CONTAINS_ITEM)
{
df::item *obj = ref->getItem();
@ -1003,23 +1003,23 @@ static bool itemBusy(df::item *item)
{
using namespace df::enums::item_type;
for (unsigned i = 0; i < item->itemrefs.size(); i++)
for (size_t i = 0; i < item->itemrefs.size(); i++)
{
df::general_ref *ref = item->itemrefs[i];
if (ref->getType() == df::general_ref_type::CONTAINS_ITEM)
if (ref->getType() == general_ref_type::CONTAINS_ITEM)
{
df::item *obj = ref->getItem();
if (obj && !obj->flags.bits.garbage_colect)
return true;
}
else if (ref->getType() == df::general_ref_type::CONTAINS_UNIT)
else if (ref->getType() == general_ref_type::CONTAINS_UNIT)
return true;
else if (ref->getType() == df::general_ref_type::UNIT_HOLDER)
else if (ref->getType() == general_ref_type::UNIT_HOLDER)
{
if (!item->flags.bits.in_job)
return true;
}
else if (ref->getType() == df::general_ref_type::CONTAINED_IN_ITEM)
else if (ref->getType() == general_ref_type::CONTAINED_IN_ITEM)
{
df::item *obj = ref->getItem();
if (!obj)
@ -1051,7 +1051,7 @@ static bool itemInRealJob(df::item *item)
static void map_job_items(Core *c)
{
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
constraints[i]->item_amount = 0;
constraints[i]->item_count = 0;
@ -1074,7 +1074,7 @@ static void map_job_items(Core *c)
std::vector<df::item*> &items = world->items.other[items_other_id::ANY_FREE];
for (unsigned i = 0; i < items.size(); i++)
for (size_t i = 0; i < items.size(); i++)
{
df::item *item = items[i];
@ -1112,7 +1112,7 @@ static void map_job_items(Core *c)
// Match to constraints
TMaterialCache::key_type matkey(imattype, imatindex);
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
ItemConstraint *cv = constraints[i];
if (cv->item.type != itype ||
@ -1152,7 +1152,7 @@ static void map_job_items(Core *c)
}
}
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
constraints[i]->computeRequest();
}
@ -1198,7 +1198,7 @@ static void update_jobs_by_constraints(Core *c)
int resume_weight = -1;
int suspend_weight = -1;
for (unsigned i = 0; i < pj->constraints.size(); i++)
for (size_t i = 0; i < pj->constraints.size(); i++)
{
if (pj->constraints[i]->request_resume)
resume_weight = std::max(resume_weight, pj->constraints[i]->weight);
@ -1216,12 +1216,12 @@ static void update_jobs_by_constraints(Core *c)
setJobResumed(c, pj, goal);
}
for (unsigned i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
ItemConstraint *ct = constraints[i];
bool is_running = false;
for (unsigned j = 0; j < ct->jobs.size(); j++)
for (size_t j = 0; j < ct->jobs.size(); j++)
if (!!(is_running = ct->jobs[j]->isResumed()))
break;
@ -1321,10 +1321,10 @@ static void print_constraint(Core *c, ItemConstraint *cv, bool no_job = false, s
std::vector<ProtectedJob*> unique_jobs;
std::vector<int> unique_counts;
for (int i = 0; i < cv->jobs.size(); i++)
for (size_t i = 0; i < cv->jobs.size(); i++)
{
ProtectedJob *pj = cv->jobs[i];
for (int j = 0; j < unique_jobs.size(); j++)
for (size_t j = 0; j < unique_jobs.size(); j++)
{
if (unique_jobs[j]->building_id == pj->building_id &&
*unique_jobs[j]->actual_job == *pj->actual_job)
@ -1339,7 +1339,7 @@ static void print_constraint(Core *c, ItemConstraint *cv, bool no_job = false, s
next_job:;
}
for (int i = 0; i < unique_jobs.size(); i++)
for (size_t i = 0; i < unique_jobs.size(); i++)
{
ProtectedJob *pj = unique_jobs[i];
df::job *job = pj->actual_job;
@ -1394,7 +1394,7 @@ static void print_job(Core *c, ProtectedJob *pj)
c->con.reset_color();
}
for (int i = 0; i < pj->constraints.size(); i++)
for (size_t i = 0; i < pj->constraints.size(); i++)
print_constraint(c, pj->constraints[i], true, " ");
}
@ -1447,7 +1447,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters)
return CR_OK;
}
for (unsigned i = 1; i < parameters.size(); i++)
for (size_t i = 1; i < parameters.size(); i++)
{
if (parameters[i] == "drybuckets")
setOptionEnabled(CF_DRYBUCKETS, enable);
@ -1482,7 +1482,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters)
{
if (workshop)
{
for (unsigned i = 0; i < workshop->jobs.size(); i++)
for (size_t i = 0; i < workshop->jobs.size(); i++)
print_job(c, get_known(workshop->jobs[i]->id));
}
else
@ -1494,7 +1494,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters)
bool pending = false;
for (unsigned i = 0; i < pending_recover.size(); i++)
for (size_t i = 0; i < pending_recover.size(); i++)
{
if (!workshop || pending_recover[i]->holder == workshop)
{
@ -1512,7 +1512,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters)
}
else if (cmd == "list")
{
for (int i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
print_constraint(c, constraints[i]);
return CR_OK;
@ -1548,7 +1548,7 @@ static command_result workflow_cmd(Core *c, vector <string> & parameters)
if (parameters.size() != 2)
return CR_WRONG_USAGE;
for (int i = 0; i < constraints.size(); i++)
for (size_t i = 0; i < constraints.size(); i++)
{
if (constraints[i]->config.val() != parameters[1])
continue;