properly cast for unsigned comparisons

develop
Myk Taylor 2023-02-02 23:57:52 -08:00
parent 8c7be9a8c2
commit 49246a60f3
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

@ -48,7 +48,7 @@ void Kitchen::debug_print(color_ostream &out)
void Kitchen::allowPlantSeedCookery(int32_t plant_id)
{
if (plant_id < 0 || plant_id >= world->raws.plants.all.size())
if (plant_id < 0 || (size_t)plant_id >= world->raws.plants.all.size())
return;
df::plant_raw *type = world->raws.plants.all[plant_id];
@ -64,7 +64,7 @@ void Kitchen::allowPlantSeedCookery(int32_t plant_id)
void Kitchen::denyPlantSeedCookery(int32_t plant_id)
{
if (plant_id < 0 || plant_id >= world->raws.plants.all.size())
if (plant_id < 0 || (size_t)plant_id >= world->raws.plants.all.size())
return;
df::plant_raw *type = world->raws.plants.all[plant_id];
@ -79,7 +79,7 @@ void Kitchen::denyPlantSeedCookery(int32_t plant_id)
}
bool Kitchen::isPlantCookeryAllowed(int32_t plant_id) {
if (plant_id < 0 || plant_id >= world->raws.plants.all.size())
if (plant_id < 0 || (size_t)plant_id >= world->raws.plants.all.size())
return false;
df::plant_raw *type = world->raws.plants.all[plant_id];
@ -89,7 +89,7 @@ bool Kitchen::isPlantCookeryAllowed(int32_t plant_id) {
}
bool Kitchen::isSeedCookeryAllowed(int32_t plant_id) {
if (plant_id < 0 || plant_id >= world->raws.plants.all.size())
if (plant_id < 0 || (size_t)plant_id >= world->raws.plants.all.size())
return false;
df::plant_raw *type = world->raws.plants.all[plant_id];

@ -329,7 +329,7 @@ static void do_cycle(color_ostream &out, int32_t *num_enabled_seed_types, int32_
for (auto &entry : watched_seeds) {
int32_t id = entry.first;
if (id < 0 || id >= world->raws.plants.all.size())
if (id < 0 || (size_t)id >= world->raws.plants.all.size())
continue;
int32_t target = get_config_val(entry.second, SEED_CONFIG_TARGET);
if (accessible_counts[id] <= target &&
@ -359,7 +359,7 @@ static void set_target(color_ostream &out, int32_t id, int32_t target) {
if (target == 0)
remove_seed_config(out, id);
else {
if (id < 0 || id >= world->raws.plants.all.size()) {
if (id < 0 || (size_t)id >= world->raws.plants.all.size()) {
WARN(config,out).print(
"cannot set target for unknown plant id: %d\n", id);
return;