Fix handymen not watering plants due to tile order.

This commit is contained in:
Duncan Frost 2015-03-30 17:58:14 +01:00
parent c3ca883c77
commit e31019428c
1 changed files with 19 additions and 23 deletions

View File

@ -2784,24 +2784,25 @@ static void peep_update_watering(rct_peep* peep){
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
for (;; map_element++){ do{
if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_SCENERY){ if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY)
if (abs(((int)peep->next_z) - map_element->base_height) <= 4){ continue;
rct_scenery_entry* scenery_entry = g_smallSceneryEntries[map_element->properties.scenery.type];
if (abs(((int)peep->next_z) - map_element->base_height) > 4)
continue;
rct_scenery_entry* scenery_entry = g_smallSceneryEntries[map_element->properties.scenery.type];
if (scenery_entry->small_scenery.flags& SMALL_SCENERY_FLAG6){ if (!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED))
map_element->properties.scenery.age = 0; continue;
gfx_invalidate_scrollingtext(x, y, map_element->base_height * 8, map_element->clearance_height * 8);
peep->staff_gardens_watered++; map_element->properties.scenery.age = 0;
peep->var_45 |= (1 << 4); gfx_invalidate_scrollingtext(x, y, map_element->base_height * 8, map_element->clearance_height * 8);
} peep->staff_gardens_watered++;
} peep->var_45 |= (1 << 4);
} } while (map_element_is_last_for_tile(map_element++));
if (map_element_is_last_for_tile(map_element)) {
peep_state_reset(peep); peep_state_reset(peep);
return;
}
}
} }
} }
@ -3760,32 +3761,27 @@ static int peep_update_patrolling_find_watering(rct_peep* peep){
do { do {
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY){ if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY){
map_element++;
continue; continue;
} }
uint8 z_diff = abs(peep->next_z - map_element->base_height); uint8 z_diff = abs(peep->next_z - map_element->base_height);
if (z_diff >= 4){ if (z_diff >= 4){
map_element++;
continue; continue;
} }
rct_scenery_entry* sceneryEntry = g_smallSceneryEntries[map_element->properties.scenery.type]; rct_scenery_entry* sceneryEntry = g_smallSceneryEntries[map_element->properties.scenery.type];
if (!(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED)){ if (!(sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_CAN_BE_WATERED)){
map_element++;
continue; continue;
} }
if (map_element->properties.scenery.age < 55){ if (map_element->properties.scenery.age < 55){
if (chosen_position >= 4){ if (chosen_position >= 4){
map_element++;
continue; continue;
} }
if (map_element->properties.scenery.age < 40){ if (map_element->properties.scenery.age < 40){
map_element++;
continue; continue;
} }
} }
@ -3801,7 +3797,7 @@ static int peep_update_patrolling_find_watering(rct_peep* peep){
peep->destination_tolerence = 3; peep->destination_tolerence = 3;
return 1; return 1;
} while (!map_element_is_last_for_tile(map_element)); } while (!map_element_is_last_for_tile(map_element++));
} }
return 0; return 0;
} }