Fixes error if next_map.json is missing (#34222)

This commit is contained in:
Jordan Brown
2018-01-11 01:53:42 -08:00
committed by CitadelStationBot
parent b2021912d7
commit d8c3157741
2 changed files with 6 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ SUBSYSTEM_DEF(mapping)
#ifdef FORCE_MAP #ifdef FORCE_MAP
config = new(FORCE_MAP) config = new(FORCE_MAP)
#else #else
config = new config = new(error_if_missing = FALSE)
#endif #endif
return ..() return ..()

View File

@@ -31,16 +31,17 @@
var/voteweight = 1 var/voteweight = 1
var/allow_custom_shuttles = TRUE var/allow_custom_shuttles = TRUE
/datum/map_config/New(filename = "data/next_map.json", default_to_box, delete_after) /datum/map_config/New(filename = "data/next_map.json", default_to_box, delete_after, error_if_missing = TRUE)
if(default_to_box) if(default_to_box)
return return
LoadConfig(filename) LoadConfig(filename, error_if_missing)
if(delete_after) if(delete_after)
fdel(filename) fdel(filename)
/datum/map_config/proc/LoadConfig(filename) /datum/map_config/proc/LoadConfig(filename, error_if_missing)
if(!fexists(filename)) if(!fexists(filename))
log_world("map_config not found: [filename]") if(error_if_missing)
log_world("map_config not found: [filename]")
return return
var/json = file(filename) var/json = file(filename)