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

View File

@@ -11,10 +11,10 @@
/connection_edge/proc/add_connection(connection/c)
coefficient++
//world << "Connection added. Coefficient: [coefficient]"
//world << "Connection added: [type] Coefficient: [coefficient]"
/connection_edge/proc/remove_connection(connection/c)
//world << "Connection removed. Coefficient: [coefficient-1]"
//world << "Connection removed: [type] Coefficient: [coefficient-1]"
coefficient--
if(coefficient <= 0)
erase()
@@ -23,7 +23,7 @@
/connection_edge/proc/erase()
air_master.remove_edge(src)
//world << "Erased."
//world << "[type] Erased."
/connection_edge/proc/tick()
@@ -130,9 +130,15 @@
/connection_edge/unsimulated/add_connection(connection/c)
. = ..()
connecting_turfs.Add(c.B)
air.group_multiplier = coefficient
/connection_edge/unsimulated/remove_connection(connection/c)
connecting_turfs.Remove(c.B)
air.group_multiplier = coefficient
. = ..()
/connection_edge/unsimulated/erase()
A.edges.Remove(src)
. = ..()
/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)
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(B.connections.get(b_to_a)) return
if(!space)
if(A.zone == B.zone) return
if(B.connections.get(b_to_a)) return
var/connection/c = new /connection(A,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()

View File

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

View File

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

View File

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

View File

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

View File

@@ -216,8 +216,14 @@
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
if(!ispath(N,/turf/simulated) && istype(src,/turf/simulated))
src:zone:remove(src)
//world << "Replacing [src.type] with [N]"
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 the old turf had a zone, connect the new turf to it as well - Cael