Fixed some weird bugs concerning space and the creation thereof.

This commit is contained in:
Aryn
2014-02-21 07:05:11 -07:00
parent f95d0f9a98
commit 0089ae6282
8 changed files with 48 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
#define CONNECTION_SPACE 4 #define CONNECTION_SPACE 4
#define CONNECTION_INVALID 8 #define CONNECTION_INVALID 8
/turf/simulated/var/tmp/connection_manager/connections = new /turf/var/tmp/connection_manager/connections
/connection_manager/var/connection/N /connection_manager/var/connection/N
@@ -61,6 +61,16 @@
if(check(D)) D.update() if(check(D)) D.update()
#endif #endif
/connection_manager/proc/erase_all()
if(check(N)) N.erase()
if(check(S)) S.erase()
if(check(E)) E.erase()
if(check(W)) W.erase()
#ifdef ZLEVELS
if(check(U)) U.erase()
if(check(D)) D.erase()
#endif
/connection_manager/proc/check(connection/c) /connection_manager/proc/check(connection/c)
return c && c.valid() return c && c.valid()
@@ -92,14 +102,12 @@
edge.add_connection(src) edge.add_connection(src)
/connection/proc/mark_direct() /connection/proc/mark_direct()
edge.remove_connection(src)
state |= CONNECTION_DIRECT state |= CONNECTION_DIRECT
edge.add_connection(src) //world << "Marked direct."
/connection/proc/mark_indirect() /connection/proc/mark_indirect()
edge.remove_connection(src)
state &= ~CONNECTION_DIRECT state &= ~CONNECTION_DIRECT
edge.add_connection(src) //world << "Marked indirect."
/connection/proc/mark_space() /connection/proc/mark_space()
state |= CONNECTION_SPACE state |= CONNECTION_SPACE
@@ -113,6 +121,7 @@
/connection/proc/erase() /connection/proc/erase()
edge.remove_connection(src) edge.remove_connection(src)
state |= CONNECTION_INVALID state |= CONNECTION_INVALID
//world << "Connection Erased: [state]"
/connection/proc/update() /connection/proc/update()
//world << "Updated, \..." //world << "Updated, \..."

View File

@@ -11,10 +11,10 @@
/connection_edge/proc/add_connection(connection/c) /connection_edge/proc/add_connection(connection/c)
coefficient++ coefficient++
//world << "Connection added. Coefficient: [coefficient]" //world << "Connection added: [type] Coefficient: [coefficient]"
/connection_edge/proc/remove_connection(connection/c) /connection_edge/proc/remove_connection(connection/c)
//world << "Connection removed. Coefficient: [coefficient-1]" //world << "Connection removed: [type] Coefficient: [coefficient-1]"
coefficient-- coefficient--
if(coefficient <= 0) if(coefficient <= 0)
erase() erase()
@@ -23,7 +23,7 @@
/connection_edge/proc/erase() /connection_edge/proc/erase()
air_master.remove_edge(src) air_master.remove_edge(src)
//world << "Erased." //world << "[type] Erased."
/connection_edge/proc/tick() /connection_edge/proc/tick()
@@ -130,9 +130,15 @@
/connection_edge/unsimulated/add_connection(connection/c) /connection_edge/unsimulated/add_connection(connection/c)
. = ..() . = ..()
connecting_turfs.Add(c.B) connecting_turfs.Add(c.B)
air.group_multiplier = coefficient
/connection_edge/unsimulated/remove_connection(connection/c) /connection_edge/unsimulated/remove_connection(connection/c)
connecting_turfs.Remove(c.B) connecting_turfs.Remove(c.B)
air.group_multiplier = coefficient
. = ..()
/connection_edge/unsimulated/erase()
A.edges.Remove(src)
. = ..() . = ..()
/connection_edge/unsimulated/contains_zone(zone/Z) /connection_edge/unsimulated/contains_zone(zone/Z)

View File

@@ -190,15 +190,19 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
a_to_b = get_dir(A,B) a_to_b = get_dir(A,B)
b_to_a = get_dir(B,A) b_to_a = get_dir(B,A)
if(!A.connections) A.connections = new
if(!B.connections) B.connections = new
if(A.connections.get(a_to_b)) return if(A.connections.get(a_to_b)) return
if(B.connections.get(b_to_a)) return
if(!space) if(!space)
if(A.zone == B.zone) return if(A.zone == B.zone) return
if(B.connections.get(b_to_a)) return
var/connection/c = new /connection(A,B) var/connection/c = new /connection(A,B)
A.connections.place(c, a_to_b) A.connections.place(c, a_to_b)
if(!space) B.connections.place(c, b_to_a) B.connections.place(c, b_to_a)
if(direct) c.mark_direct() if(direct) c.mark_direct()

View File

@@ -14,6 +14,9 @@ var/image/mark = image('icons/Testing/Zone.dmi', icon_state = "mark")
overlays += img overlays += img
dbg_img = img dbg_img = img
proc/soft_assert(thing,fail)
if(!thing) message_admins(fail)
/turf/simulated/var/verbose = 0 /turf/simulated/var/verbose = 0
/turf/simulated/verb/Verbose() /turf/simulated/verb/Verbose()
set src in world set src in world

View File

@@ -32,6 +32,11 @@
//unsim.dbg(air_blocked, turn(180,d)) //unsim.dbg(air_blocked, turn(180,d))
continue continue
var/r_block = c_airblock(unsim)
if(r_block & AIR_BLOCKED)
continue
if(istype(unsim, /turf/simulated)) if(istype(unsim, /turf/simulated))
var/turf/simulated/sim = unsim var/turf/simulated/sim = unsim
@@ -165,9 +170,7 @@
air_master.connect(src, T) air_master.connect(src, T)
/turf/proc/post_update_air_properties() /turf/proc/post_update_air_properties()
if(connections) connections.update_all()
/turf/simulated/post_update_air_properties()
connections.update_all()
/turf/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air /turf/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air
del(giver) del(giver)

View File

@@ -33,7 +33,7 @@
ASSERT(!invalid) ASSERT(!invalid)
ASSERT(istype(T)) ASSERT(istype(T))
ASSERT(T.zone == src) ASSERT(T.zone == src)
ASSERT(T in contents) soft_assert(T in contents, "Lists are weird broseph")
#endif #endif
contents.Remove(T) contents.Remove(T)
T.zone = null T.zone = null

View File

@@ -21,7 +21,7 @@ air_master.mark_for_update(turf)
*/ */
//#define ZASDBG #define ZASDBG
//#define ZLEVELS //#define ZLEVELS
#define AIR_BLOCKED 1 #define AIR_BLOCKED 1

View File

@@ -216,8 +216,14 @@
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
if(!ispath(N,/turf/simulated) && istype(src,/turf/simulated)) //world << "Replacing [src.type] with [N]"
src:zone:remove(src)
if(connections) connections.erase_all()
if(istype(src,/turf/simulated))
//world << "Removed from zone."
var/turf/simulated/S = src
if(S.zone) S.zone.remove(S)
if(ispath(N, /turf/simulated/floor)) if(ispath(N, /turf/simulated/floor))
//if the old turf had a zone, connect the new turf to it as well - Cael //if the old turf had a zone, connect the new turf to it as well - Cael