Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mods/persistence/__defines/serializer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define SERIALIZER_TYPE_DATUM "OBJ"
#define SERIALIZER_TYPE_DATUM_FLAT "FLAT_OBJ"
#define SERIALIZER_TYPE_FLAT_REF "FLAT_REF"
#define SERIALIZER_TYPE_DECL "DECL"

/////////////////////////////////////////////////////////
// SQL table names
Expand Down
1 change: 0 additions & 1 deletion mods/persistence/_persistence.dme
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
#include "modules\world_save\wrappers\_wrapper_holder.dm"
#include "modules\world_save\wrappers\area_wrapper.dm"
#include "modules\world_save\wrappers\channel_wrapper.dm"
#include "modules\world_save\wrappers\decl_wrapper.dm"
#include "modules\world_save\wrappers\escrow_holder.dm"
#include "modules\world_save\wrappers\image_wrapper.dm"
#include "modules\world_save\wrappers\map_data_wrapper.dm"
Expand Down
16 changes: 16 additions & 0 deletions mods/persistence/modules/world_save/serializers/json_serializer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
results[V] = "[SERIALIZER_TYPE_PATH]#[VV]"
else if(istext(VV) || isnum(VV) || isnull(VV))
results[V] = VV
else if(istype(VV, /decl))
var/decl/VD = VV
results[V] = "[SERIALIZER_TYPE_DECL]#[VD.type]"
else if(istype(VV, /datum))
if(should_flatten(VV))
if(VV in object_parent)
Expand Down Expand Up @@ -85,6 +88,9 @@
F_K = SerializeList(K, list_parent)
else if(istext(K) || isnum(K) || isnull(K))
F_K = K
else if(istype(K, /decl))
var/decl/KD = K
F_K = "[SERIALIZER_TYPE_DECL]#[KD.type]"
else if(ispath(K))
F_K = "[SERIALIZER_TYPE_PATH]#[K]"
else if(istype(K, /datum))
Expand Down Expand Up @@ -117,6 +123,9 @@
F_V = "[SERIALIZER_TYPE_PATH]#[V]"
else if(istext(V) || isnum(V) || isnull(V))
F_V = V
else if(istype(V, /decl))
var/decl/VD = V
F_V = "[SERIALIZER_TYPE_DECL]#[VD.type]"
else if(istype(V, /datum))
if(should_flatten(V))
if(V in list_parent)
Expand Down Expand Up @@ -158,6 +167,9 @@
if(findtext(encoded_value, "[SERIALIZER_TYPE_PATH]#", 1, 6))
thing.vars[V] = text2path(copytext(encoded_value, 6))
continue
if(findtext(encoded_value, "[SERIALIZER_TYPE_DECL]#", 1, 6))
thing.vars[V] = GET_DECL(text2path(copytext(encoded_value, 6)))
continue
if(findtext(encoded_value, "[SERIALIZER_TYPE_DATUM_FLAT]#", 1, 10))
// This is a flattened object.
thing.vars[V] = QueryAndDeserializeDatum(copytext(encoded_value, 10))
Expand Down Expand Up @@ -190,6 +202,8 @@
key = sql.QueryAndDeserializeDatum(copytext(K, 5))
else if(findtext(K, "[SERIALIZER_TYPE_PATH]#", 1, 6))
key = text2path(copytext(K, 6))
else if(findtext(K, "[SERIALIZER_TYPE_DECL]#", 1, 6))
key = GET_DECL(text2path(copytext(K, 6)))
else if(findtext(K, "[SERIALIZER_TYPE_DATUM_FLAT]#", 1, 10))
key = QueryAndDeserializeDatum(copytext(K, 10))
else if(findtext(K, "[SERIALIZER_TYPE_FLAT_REF]#", 1, 10))
Expand All @@ -211,6 +225,8 @@
V = sql.QueryAndDeserializeDatum(copytext(V, 5))
else if(findtext(V, "[SERIALIZER_TYPE_PATH]#", 1, 6))
V = text2path(copytext(V, 6))
else if(findtext(V, "[SERIALIZER_TYPE_DECL]#", 1, 6))
V = GET_DECL(text2path(copytext(V, 6)))
else if(findtext(V, "[SERIALIZER_TYPE_DATUM_FLAT]#", 1, 10))
V = QueryAndDeserializeDatum(copytext(V, 10))
else if(findtext(V, "[SERIALIZER_TYPE_FLAT_REF]#", 1, 10))
Expand Down
18 changes: 18 additions & 0 deletions mods/persistence/modules/world_save/serializers/sql_serializer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ var/global/list/serialization_time_spent_type
VT = SERIALIZER_TYPE_FILE
else if (isnull(VV))
VT = SERIALIZER_TYPE_NULL
else if(istype(VV, /decl))
var/decl/VD = VV
VT = SERIALIZER_TYPE_DECL
VV = "[VD.type]"
else if(get_wrapper(VV))
VT = SERIALIZER_TYPE_WRAPPER
var/wrapper_path = get_wrapper(VV)
Expand Down Expand Up @@ -305,6 +309,10 @@ var/global/list/serialization_time_spent_type
KV = SERIALIZER_TYPE_LIST_EMPTY
else
KV = SerializeList(key)
else if(istype(key, /decl))
var/decl/key_d = key
KT = SERIALIZER_TYPE_DECL
KV = "[key_d.type]"
else if(get_wrapper(key))
KT = SERIALIZER_TYPE_WRAPPER
var/wrapper_path = get_wrapper(key)
Expand Down Expand Up @@ -351,6 +359,10 @@ var/global/list/serialization_time_spent_type
EV = SERIALIZER_TYPE_LIST_EMPTY
else
EV = SerializeList(EV)
else if(istype(EV, /decl))
var/decl/ED = EV
ET = SERIALIZER_TYPE_DECL
EV = "[ED.type]"
else if(get_wrapper(EV))
ET = SERIALIZER_TYPE_WRAPPER
var/wrapper_path = get_wrapper(EV)
Expand Down Expand Up @@ -442,6 +454,8 @@ var/global/list/serialization_time_spent_type
existing.vars[TV.key] = text2path(TV.value)
if(SERIALIZER_TYPE_NULL)
existing.vars[TV.key] = null
if(SERIALIZER_TYPE_DECL)
existing.vars[TV.key] = GET_DECL(text2path(TV.value))
if(SERIALIZER_TYPE_WRAPPER)
var/datum/wrapper/GD = flattener.QueryAndDeserializeDatum(TV.value)
existing.vars[TV.key] = GD.on_deserialize(src)
Expand Down Expand Up @@ -487,6 +501,8 @@ var/global/list/serialization_time_spent_type
key_value = text2num(LE.key)
if(SERIALIZER_TYPE_PATH)
key_value = text2path(LE.key)
if(SERIALIZER_TYPE_DECL)
key_value = GET_DECL(text2path(LE.key))
if(SERIALIZER_TYPE_WRAPPER)
var/datum/wrapper/GD = flattener.QueryAndDeserializeDatum(LE.key)
key_value = GD.on_deserialize(src)
Expand All @@ -513,6 +529,8 @@ var/global/list/serialization_time_spent_type
existing[key_value] = text2num(LE.value)
if(SERIALIZER_TYPE_PATH)
existing[key_value] = text2path(LE.value)
if(SERIALIZER_TYPE_DECL)
existing[key_value] = GET_DECL(text2path(LE.value))
if(SERIALIZER_TYPE_WRAPPER)
var/datum/wrapper/GD = flattener.QueryAndDeserializeDatum(LE.value)
existing[key_value] = GD.on_deserialize(src)
Expand Down
8 changes: 0 additions & 8 deletions mods/persistence/modules/world_save/wrappers/decl_wrapper.dm

This file was deleted.

2 changes: 1 addition & 1 deletion test/check-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exactly 1 "world.log<< uses" 'world.log<<|world.log[[:space:]]<<'
exactly 18 "<< uses" '(?<!<)<<(?!<)' -P
exactly 10 ">> uses" '>>(?!>)' -P
exactly 0 "incorrect indentations" '^( {4,})' -P
exactly 42 "text2path uses" 'text2path'
exactly 47 "text2path uses" 'text2path'
exactly 5 "update_icon() override" '/update_icon\((.*)\)' -P
exactly 0 "goto uses" 'goto '
exactly 7 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\('
Expand Down