@@ -606,7 +606,7 @@ static void init_state()
606606 {
607607 string key = p->key ();
608608 df::unit_labor labor = (df::unit_labor) atoi (key.substr (strlen (" autolabor/labors/" )).c_str ());
609- if (labor >= 0 && labor <= labor_infos.size ())
609+ if (labor >= 0 && size_t ( labor) <= labor_infos.size ())
610610 {
611611 labor_infos[labor].config = *p;
612612 labor_infos[labor].is_exclusive = default_labor_infos[labor].is_exclusive ;
@@ -615,7 +615,7 @@ static void init_state()
615615 }
616616
617617 // Add default labors for those not in save
618- for (int i = 0 ; i < ARRAY_COUNT (default_labor_infos); i++) {
618+ for (size_t i = 0 ; i < ARRAY_COUNT (default_labor_infos); i++) {
619619 if (labor_infos[i].config .isValid ())
620620 continue ;
621621
@@ -960,7 +960,7 @@ static void assign_labor(unit_labor::unit_labor labor,
960960 * Military and children/nobles will not have labors assigned.
961961 * Dwarfs with the "health management" responsibility are always assigned DIAGNOSIS.
962962 */
963- for (int i = 0 ; i < candidates.size () && labor_infos[labor].active_dwarfs < max_dwarfs; i++)
963+ for (size_t i = 0 ; i < candidates.size () && labor_infos[labor].active_dwarfs < max_dwarfs; i++)
964964 {
965965 int dwarf = candidates[i];
966966
@@ -1048,7 +1048,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
10481048 bool has_fishery = false ;
10491049 bool trader_requested = false ;
10501050
1051- for (int i = 0 ; i < world->buildings .all .size (); ++i)
1051+ for (size_t i = 0 ; i < world->buildings .all .size (); ++i)
10521052 {
10531053 df::building *build = world->buildings .all [i];
10541054 auto type = build->getType ();
@@ -1074,7 +1074,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
10741074 }
10751075 }
10761076
1077- for (int i = 0 ; i < world->units .active .size (); ++i)
1077+ for (size_t i = 0 ; i < world->units .active .size (); ++i)
10781078 {
10791079 df::unit* cre = world->units .active [i];
10801080 if (Units::isCitizen (cre))
@@ -1105,7 +1105,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
11051105
11061106 df::historical_figure* hf = df::historical_figure::find (dwarfs[dwarf]->hist_figure_id );
11071107 if (hf!=NULL ) // can be NULL. E.g. script created citizens
1108- for (int i = 0 ; i < hf->entity_links .size (); i++)
1108+ for (size_t i = 0 ; i < hf->entity_links .size (); i++)
11091109 {
11101110 df::histfig_entity_link* hfelink = hf->entity_links .at (i);
11111111 if (hfelink->getType () == df::histfig_entity_link_type::POSITION )
@@ -1140,7 +1140,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
11401140
11411141 // identify dwarfs who are needed for meetings and mark them for exclusion
11421142
1143- for (int i = 0 ; i < ui->activities .size (); ++i)
1143+ for (size_t i = 0 ; i < ui->activities .size (); ++i)
11441144 {
11451145 df::activity_info *act = ui->activities [i];
11461146 if (!act) continue ;
@@ -1230,7 +1230,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
12301230 else
12311231 {
12321232 int job = dwarfs[dwarf]->job .current_job ->job_type ;
1233- if (job >= 0 && job < ARRAY_COUNT (dwarf_states))
1233+ if (job >= 0 && size_t ( job) < ARRAY_COUNT (dwarf_states))
12341234 dwarf_info[dwarf].state = dwarf_states[job];
12351235 else
12361236 {
@@ -1341,7 +1341,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
13411341
13421342 for (int i = 0 ; i < num_haulers; i++)
13431343 {
1344- assert (i < hauler_ids.size ());
1344+ assert (size_t (i) < hauler_ids.size ());
13451345
13461346 int dwarf = hauler_ids[i];
13471347
@@ -1357,7 +1357,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
13571357 out.print (" Dwarf %i \" %s\" assigned %s: hauler\n " , dwarf, dwarfs[dwarf]->name .first_name .c_str (), ENUM_KEY_STR (unit_labor, labor).c_str ());
13581358 }
13591359
1360- for (int i = num_haulers; i < hauler_ids.size (); i++)
1360+ for (size_t i = num_haulers; i < hauler_ids.size (); i++)
13611361 {
13621362 assert (i < hauler_ids.size ());
13631363
@@ -1517,7 +1517,7 @@ command_result autolabor (color_ostream &out, std::vector <std::string> & parame
15171517 return CR_FAILURE ;
15181518 }
15191519
1520- for (int i = 0 ; i < labor_infos.size (); i++)
1520+ for (size_t i = 0 ; i < labor_infos.size (); i++)
15211521 {
15221522 reset_labor ((df::unit_labor) i);
15231523 }
0 commit comments