mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Removes all locate() calls in block() (#25772)
* Removes all `locate()` calls in `block()` * Maybe actually push fixes * Revert bad merge master * Forgot this one * Maybe actually push fixes --------- Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
@@ -111,17 +111,17 @@
|
||||
|
||||
#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \
|
||||
block( \
|
||||
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), CENTER.z, \
|
||||
max(CENTER.x - (H_RADIUS), 1), max(CENTER.y - (V_RADIUS), 1), CENTER.z, \
|
||||
min(CENTER.x + (H_RADIUS), world.maxx), min(CENTER.y + (V_RADIUS), world.maxy), CENTER.z \
|
||||
)
|
||||
|
||||
/// Returns the turfs on the edge of a square with CENTER in the middle and with the given RADIUS. If used near the edge of the map, will still work fine.
|
||||
// order of the additions: top edge + bottom edge + left edge + right edge
|
||||
#define RANGE_EDGE_TURFS(RADIUS, CENTER)\
|
||||
(CENTER.y + RADIUS < world.maxy ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS, world.maxy), CENTER.z) : list()) +\
|
||||
(CENTER.y - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS, 1), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS, 1), CENTER.z) : list()) +\
|
||||
(CENTER.x - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list()) +\
|
||||
(CENTER.x + RADIUS < world.maxx ? block(min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list())
|
||||
(CENTER.y + RADIUS < world.maxy ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS, world.maxy), CENTER.z) : list()) +\
|
||||
(CENTER.y - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS, 1), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS, 1), CENTER.z) : list()) +\
|
||||
(CENTER.x - RADIUS > 1 ? block(max(CENTER.x - RADIUS, 1), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, max(CENTER.x - RADIUS, 1), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list()) +\
|
||||
(CENTER.x + RADIUS < world.maxx ? block(min(CENTER.x + RADIUS, world.maxx), min(CENTER.y + RADIUS - 1, world.maxy), CENTER.z, min(CENTER.x + RADIUS, world.maxx), max(CENTER.y - RADIUS + 1, 1), CENTER.z) : list())
|
||||
|
||||
#define FOR_DVIEW(type, range, center, invis_flags) \
|
||||
GLOB.dview_mob.loc = center; \
|
||||
|
||||
@@ -384,7 +384,7 @@ DEFINE_BITFIELD(smoothing_junction, list(
|
||||
|
||||
//Icon smoothing helpers
|
||||
/proc/smooth_zlevel(zlevel, now = FALSE)
|
||||
var/list/away_turfs = block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel))
|
||||
var/list/away_turfs = block(1, 1, zlevel, world.maxx, world.maxy, zlevel)
|
||||
for(var/V in away_turfs)
|
||||
var/turf/T = V
|
||||
if(T.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
var/turf/center = locate((destination.x + xoffset), (destination.y + yoffset), location.z) // So now, find the new center.
|
||||
|
||||
// Now to find a box from center location and make that our destination.
|
||||
for(var/turf/T in block(locate(center.x + b1xerror, center.y + b1yerror, location.z), locate(center.x + b2xerror, center.y + b2yerror, location.z)))
|
||||
for(var/turf/T in block(center.x + b1xerror, center.y + b1yerror, location.z, center.x + b2xerror, center.y + b2yerror, location.z))
|
||||
if(density && T.density)
|
||||
continue
|
||||
if(T.x > world.maxx || T.x < 1 || T.y > world.maxy || T.y < 1)
|
||||
|
||||
@@ -163,7 +163,7 @@ SUBSYSTEM_DEF(mapping)
|
||||
)
|
||||
|
||||
for(var/z_level in space_z_levels)
|
||||
var/list/turf/z_level_turfs = block(locate(1, 1, z_level), locate(world.maxx, world.maxy, z_level))
|
||||
var/list/turf/z_level_turfs = block(1, 1, z_level, world.maxx, world.maxy, z_level)
|
||||
for(var/z_level_turf in z_level_turfs)
|
||||
var/turf/T = z_level_turf
|
||||
var/area/A = get_area(T)
|
||||
|
||||
@@ -93,8 +93,7 @@
|
||||
|
||||
var/max_x = min_x + width-1
|
||||
var/max_y = min_y + height-1
|
||||
placement = locate(max(min_x,1), max(min_y,1), placement.z)
|
||||
return block(placement, locate(min(max_x, world.maxx), min(max_y, world.maxy), placement.z))
|
||||
return block(max(min_x, 1), max(min_y, 1), placement.z, min(max_x, world.maxx), min(max_y, world.maxy), placement.z)
|
||||
|
||||
/datum/map_template/proc/fits_in_map_bounds(turf/T, centered = 0)
|
||||
var/turf/placement = T
|
||||
@@ -107,9 +106,9 @@
|
||||
var/max_x = min_x + width-1
|
||||
var/max_y = min_y + height-1
|
||||
if(min_x < 1 || min_y < 1 || max_x > world.maxx || max_y > world.maxy)
|
||||
return 0
|
||||
return FALSE
|
||||
else
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
|
||||
/proc/preloadTemplates(path = "_maps/map_files/templates/") //see master controller setup
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
var/watch = start_watch()
|
||||
log_debug("Counting station atoms")
|
||||
var/station_zlevel = level_name_to_num(MAIN_STATION)
|
||||
for(var/turf/T in block(locate(1, 1, station_zlevel), locate(world.maxx, world.maxy, station_zlevel)))
|
||||
for(var/turf/T in block(1, 1, station_zlevel, world.maxx, world.maxy, station_zlevel))
|
||||
|
||||
if(istype(T, /turf/simulated/floor))
|
||||
var/turf/simulated/floor/T2 = T
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
/datum/river_spawner/proc/generate(nodes = 4, min_x = RIVER_MIN_X, min_y = RIVER_MIN_Y, max_x = RIVER_MAX_X, max_y = RIVER_MAX_Y)
|
||||
var/list/river_nodes = list()
|
||||
var/num_spawned = 0
|
||||
var/list/possible_locs = block(locate(min_x, min_y, target_z), locate(max_x, max_y, target_z))
|
||||
var/list/possible_locs = block(min_x, min_y, target_z, max_x, max_y, target_z)
|
||||
while(num_spawned < nodes && length(possible_locs))
|
||||
var/turf/T = pick(possible_locs)
|
||||
var/area/A = get_area(T)
|
||||
|
||||
@@ -159,7 +159,7 @@ GLOBAL_DATUM_INIT(_preloader, /datum/dmm_suite/preloader, new())
|
||||
CRASH("Bad Map bounds in [fname], Min x: [bounds[MAP_MINX]], Min y: [bounds[MAP_MINY]], Min z: [bounds[MAP_MINZ]], Max x: [bounds[MAP_MAXX]], Max y: [bounds[MAP_MAXY]], Max z: [bounds[MAP_MAXZ]]")
|
||||
else
|
||||
if(!measureOnly)
|
||||
for(var/t in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])))
|
||||
for(var/t in block(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]))
|
||||
var/turf/T = t
|
||||
// we do this after we load everything in. if we don't; we'll have weird atmos bugs regarding atmos adjacent turfs
|
||||
T.AfterChange(TRUE, keep_cabling = TRUE)
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
/proc/empty_rect(low_x,low_y, hi_x,hi_y, z)
|
||||
var/timer = start_watch()
|
||||
log_debug("Emptying region: ([low_x], [low_y]) to ([hi_x], [hi_y]) on z '[z]'")
|
||||
empty_region(block(locate(low_x, low_y, z), locate(hi_x, hi_y, z)))
|
||||
empty_region(block(low_x, low_y, z, hi_x, hi_y, z))
|
||||
log_debug("Took [stop_watch(timer)]s")
|
||||
|
||||
/proc/empty_region(list/turfs)
|
||||
|
||||
@@ -361,7 +361,7 @@
|
||||
/mob/camera/blob/proc/rally_spores(turf/T)
|
||||
to_chat(src, "You rally your spores.")
|
||||
|
||||
var/list/surrounding_turfs = block(locate(T.x - 1, T.y - 1, T.z), locate(T.x + 1, T.y + 1, T.z))
|
||||
var/list/surrounding_turfs = block(T.x - 1, T.y - 1, T.z, T.x + 1, T.y + 1, T.z)
|
||||
if(!length(surrounding_turfs))
|
||||
return
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
for(var/obj/machinery/camera/c in urange(half_chunk + CAMERA_VIEW_DISTANCE, locate(x + half_chunk, y + half_chunk, z)))
|
||||
add_camera(c)
|
||||
|
||||
for(var/turf/t in block(locate(max(x, 1), max(y, 1), max(z, 1)), locate(min(x + CAMERA_CHUNK_SIZE - 1, world.maxx), min(y + CAMERA_CHUNK_SIZE - 1, world.maxy), z)))
|
||||
for(var/turf/t in block(max(x, 1), max(y, 1), max(z, 1), min(x + CAMERA_CHUNK_SIZE - 1, world.maxx), min(y + CAMERA_CHUNK_SIZE - 1, world.maxy), z))
|
||||
turfs[t] = t
|
||||
|
||||
for(var/obj/machinery/camera/c as anything in active_cameras)
|
||||
|
||||
@@ -123,7 +123,7 @@ GLOBAL_LIST_EMPTY(gravity_generators)
|
||||
/obj/machinery/gravity_generator/main/proc/setup_parts()
|
||||
var/turf/our_turf = get_turf(src)
|
||||
// 9x9 block obtained from the bottom left of the block
|
||||
var/list/spawn_turfs = block(locate(our_turf.x + 2, our_turf.y + 2, our_turf.z), locate(our_turf.x, our_turf.y, our_turf.z))
|
||||
var/list/spawn_turfs = block(our_turf.x + 2, our_turf.y + 2, our_turf.z, our_turf.x, our_turf.y, our_turf.z)
|
||||
var/count = 10
|
||||
for(var/turf/T in spawn_turfs)
|
||||
count--
|
||||
|
||||
@@ -425,13 +425,13 @@
|
||||
var/list/L2 = list()
|
||||
switch(destination.dir)
|
||||
if(NORTH)
|
||||
L2 = block(locate(destination.x-9, destination.y+36, destination.z), locate(destination.x+9, 255, destination.z))
|
||||
L2 = block(destination.x-9, destination.y+36, destination.z, destination.x+9, 255, destination.z)
|
||||
if(SOUTH)
|
||||
L2 = block(locate(destination.x-9, 1, destination.z), locate(destination.x+9, destination.y-36, destination.z))
|
||||
L2 = block(destination.x-9, 1, destination.z, destination.x+9, destination.y-36, destination.z)
|
||||
if(EAST)
|
||||
L2 = block(locate(destination.x+36, destination.y-9, destination.z), locate(255, destination.y+9, destination.z))
|
||||
L2 = block(destination.x+36, destination.y-9, destination.z, 255, destination.y+9, destination.z)
|
||||
if(WEST)
|
||||
L2 = block(locate(1, destination.y-9, destination.z), locate(destination.x-36, destination.y+9, destination.z))
|
||||
L2 = block(1, destination.y-9, destination.z, destination.x-36, destination.y+9, destination.z)
|
||||
create_lance_ripples(L2, destination)
|
||||
|
||||
switch(mode)
|
||||
|
||||
@@ -64,13 +64,13 @@
|
||||
var/list/L2 = list()
|
||||
switch(dest_dir)
|
||||
if(NORTH)
|
||||
L2 = block(locate(port.x - 9, port.y + 36, port.z), locate(port.x + 9, 255, port.z))
|
||||
L2 = block(port.x - 9, port.y + 36, port.z, port.x + 9, 255, port.z)
|
||||
if(SOUTH)
|
||||
L2 = block(locate(port.x - 9, 1, port.z), locate(port.x + 9, port.y - 36, port.z))
|
||||
L2 = block(port.x - 9, 1, port.z, port.x + 9, port.y - 36, port.z)
|
||||
if(EAST)
|
||||
L2 = block(locate(port.x + 36, port.y - 9, port.z), locate(255, port.y + 9, port.z))
|
||||
L2 = block(port.x + 36, port.y - 9, port.z, 255, port.y + 9, port.z)
|
||||
if(WEST)
|
||||
L2 = block(locate(1, port.y - 9, port.z), locate(port.x - 36, port.y + 9, port.z))
|
||||
L2 = block(1, port.y - 9, port.z, port.x - 36, port.y + 9, port.z)
|
||||
for(var/turf/BT in L2)
|
||||
for(var/obj/Ohno in BT.contents)
|
||||
if((istype(Ohno, /obj/machinery/atmospherics/supermatter_crystal) || istype(Ohno, /obj/singularity)) && !emagged)
|
||||
|
||||
@@ -500,13 +500,13 @@
|
||||
var/list/L2 = list()
|
||||
switch(S1.dir)
|
||||
if(NORTH)
|
||||
L2 = block(locate(S1.x-9, S1.y+36, S1.z), locate(S1.x+9, 255, S1.z))
|
||||
L2 = block(S1.x-9, S1.y+36, S1.z, S1.x+9, 255, S1.z)
|
||||
if(SOUTH)
|
||||
L2 = block(locate(S1.x-9, 1, S1.z), locate(S1.x+9, S1.y-36, S1.z))
|
||||
L2 = block(S1.x-9, 1, S1.z, S1.x+9, S1.y-36, S1.z)
|
||||
if(EAST)
|
||||
L2 = block(locate(S1.x+36, S1.y-9, S1.z), locate(255, S1.y+9, S1.z))
|
||||
L2 = block(S1.x+36, S1.y-9, S1.z, 255, S1.y+9, S1.z)
|
||||
if(WEST)
|
||||
L2 = block(locate(1, S1.y-9, S1.z), locate(S1.x-36, S1.y+9, S1.z))
|
||||
L2 = block(1, S1.y-9, S1.z, S1.x-36, S1.y+9, S1.z)
|
||||
mobile_port.shuttle_smash(L2, S1)
|
||||
mobile_port.roadkill(L0, L1, S1.dir)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
if(C.zpos != zpos)
|
||||
return
|
||||
C.set_occupied(FALSE)
|
||||
for(var/turf/T in block(locate(C.x, C.y, C.zpos), locate(C.x+C.width-1, C.y+C.height-1, C.zpos)))
|
||||
for(var/turf/T in block(C.x, C.y, C.zpos, C.x + C.width - 1, C.y + C.height - 1, C.zpos))
|
||||
for(var/atom/movable/M in T)
|
||||
if(isobserver(M))
|
||||
continue
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
|
||||
/datum/space_level/proc/get_turfs()
|
||||
return block(locate(1, 1, zpos), locate(world.maxx, world.maxy, zpos))
|
||||
return block(1, 1, zpos, world.maxx, world.maxy, zpos)
|
||||
|
||||
/datum/space_level/proc/set_linkage(transition_type)
|
||||
if(linkage == transition_type)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
test_logs[I] = list()
|
||||
durations[I] = 0
|
||||
|
||||
for(var/turf/T in block(locate(1, 1, z_level), locate(world.maxx, world.maxy, z_level)))
|
||||
for(var/turf/T in block(1, 1, z_level, world.maxx, world.maxy, z_level))
|
||||
for(var/datum/map_per_tile_test/test in tests)
|
||||
if(test.failure_count < MAX_MAP_TEST_FAILURE_COUNT)
|
||||
var/duration = REALTIMEOFDAY
|
||||
|
||||
Reference in New Issue
Block a user