changes:

Fixes a regression in GetAbove/GetBelow() that caused passing an atom that wasn't directly on the map to return a false negative.
Fixes runtime's broken Z1 MZ by moving it to Z2.
Fixes some outdated Z-level defines on Runtime.
Moves z_levels global to SSatlas for easier debugging.
Atlas will now list the size of the world in its MC entry.
Map diffs are fucked up because of the index shift, nothing on the maps themselves was actually changed beyond adding a blank Z at the bottom.

Fixes #4692.
This commit is contained in:
Lohikar
2018-06-26 15:16:23 -05:00
committed by Erki
parent faa639bdfa
commit b4fdd35a1e
9 changed files with 29 additions and 17 deletions

View File

@@ -1,6 +1,5 @@
// If you add a more comprehensive system, just untick this file.
// WARNING: Only works for up to 17 z-levels!
var/z_levels = 0 // Each bit represents a connection between adjacent levels. So the first bit means levels 1 and 2 are connected.
// If the height is more than 1, we mark all contained levels as connected.
/obj/effect/landmark/map_data/New()
@@ -10,7 +9,7 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
ASSERT(height <= z)
// Due to the offsets of how connections are stored v.s. how z-levels are indexed, some magic number silliness happened.
for(var/i = (z - height) to (z - 2))
z_levels |= (1 << i)
SSatlas.z_levels |= (1 << i)
qdel(src)
/obj/effect/landmark/map_data/Destroy()
@@ -26,9 +25,13 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
// Thankfully, no bitwise magic is needed here.
/proc/GetAbove(atom/A)
if (!A.z)
A = get_turf(A)
return A ? GET_ABOVE(A) : null
/proc/GetBelow(atom/A)
if (!A.z)
A = get_turf(A)
return A ? GET_BELOW(A) : null
/proc/GetConnectedZlevels(z)
@@ -57,7 +60,11 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
return new_entry[zB]
/proc/get_zstep(ref, dir)
/proc/get_zstep(atom/ref, dir)
if (!isloc(ref))
CRASH("Expected atom.")
if (!ref.z)
ref = get_turf(ref)
switch (dir)
if (UP)
. = GET_ABOVE(ref)