minor turf reservation fix (#38935)

no longer reserves 1 more height+width than necessary, checks against invalid sizes
This commit is contained in:
kevinz000
2018-07-06 09:35:28 -07:00
committed by yogstation13-bot
parent 98b95ff548
commit c5868b545e

View File

@@ -19,7 +19,7 @@
SSmapping.reserve_turfs(v)
/datum/turf_reservation/proc/Reserve(width, height, zlevel)
if(width > world.maxx || height > world.maxy)
if(width > world.maxx || height > world.maxy || width < 1 || height < 1)
return FALSE
var/list/avail = SSmapping.unused_turfs["[zlevel]"]
var/turf/BL
@@ -33,7 +33,7 @@
continue
if(BL.x + width > world.maxx || BL.y + height > world.maxy)
continue
TR = locate(BL.x + width, BL.y + height, BL.z)
TR = locate(BL.x + width - 1, BL.y + height - 1, BL.z)
if(!(TR.flags_1 & UNUSED_RESERVATION_TURF_1))
continue
final = block(BL, TR)