From 6e3b29930da4ad927bcf9a205096f6a3198fa96c Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 16 Feb 2018 15:12:46 -0500 Subject: [PATCH] Avoid crash in dwarfvet due to negative width/height Partial fix for #1227 --- plugins/dwarfvet.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/dwarfvet.cpp b/plugins/dwarfvet.cpp index 46247bb87..604f399a7 100644 --- a/plugins/dwarfvet.cpp +++ b/plugins/dwarfvet.cpp @@ -135,8 +135,8 @@ AnimalHospital::AnimalHospital(df::building * building, color_ostream &out) { z = building->z; // Determine how many spots we have for animals - this->length = x2-x1; - this->height = y2-y1; + this->length = x2-x1+1; + this->height = y2-y1+1; // And calculate the hospital! this->calculateHospital(true, out); @@ -321,8 +321,8 @@ void AnimalHospital::calculateHospital(bool force, color_ostream &out) { spot_cur += building_offset_x; /* Start marking! */ - for (int i = 0; i != building_height; i++) { - for (int j = 0; j != building_length; j++) { + for (int i = 0; i < building_height; i++) { + for (int j = 0; j < building_length; j++) { spots_in_use[spot_cur+j] = true; }