Refactor the map loader (#39567)

* Remove duplicate initTemplateBounds method

* Move dmmRegex var to the type that actually uses it

* Keep a single, static map_loader datum

* Combine maploader into parsed_map

* Remove some redundant parameters from parsed_map/load

* Move file2text into parsed_map/New

* Narrow the scope of the map loading lock

* Remove redundant xcrdStart var

* Fix argument names in station reloader

* Move offsets from parsing to loading only

* Tidy argument handling on parsed_map/load

* Store modelCache, track nonexistent atom paths

* Use raw strings to specify the regexes

* Remove cropMap from parsed_map/New

* Don't parse maps twice when checking multi-z validity

Speeds up SSmapping init by approximately 10%.

* Bring the documentation (somewhat) up to speed

* No, I don't know why this fixes it
This commit is contained in:
Tad Hardesty
2018-08-09 19:49:38 -07:00
committed by yogstation13-bot
parent 8efac61b1e
commit 33e92f0ab7
7 changed files with 205 additions and 227 deletions

View File

@@ -21,13 +21,12 @@
return
var/datum/mapGenerator/repair/reload_station_map/mother1 = mother
GLOB.reloading_map = TRUE
var/static/datum/maploader/reloader = new
// This is kind of finicky on multi-Z maps but the reader would need to be
// changed to allow Z cropping and that's a mess
var/z_offset = SSmapping.station_start
var/list/bounds
for (var/path in SSmapping.config.GetFullMapPaths())
var/datum/parsed_map/parsed = reloader.load_map(file(path), measureOnly = FALSE, no_changeturf = FALSE,x_offset = 0, y_offset = 0, z_offset = z_offset, cropMap=TRUE, lower_crop_x = mother1.x_low, lower_crop_y = mother1.y_low, upper_crop_x = mother1.x_high, upper_crop_y = mother1.y_high)
var/datum/parsed_map/parsed = load_map(file(path), 1, 1, z_offset, measureOnly = FALSE, no_changeturf = FALSE, cropMap=TRUE, x_lower = mother1.x_low, y_lower = mother1.y_low, x_upper = mother1.x_high, y_upper = mother1.y_high)
bounds = parsed?.bounds
z_offset += bounds[MAP_MAXZ] - bounds[MAP_MINZ] + 1