From 48895de170c3ca9837936226b746e47e629ab047 Mon Sep 17 00:00:00 2001 From: matzman Date: Wed, 3 Feb 2016 20:01:42 +0100 Subject: [PATCH] Use hard-coded values for map calibration. Mods may manipulate the values provided by the game. --- widgets/map/globalmapwidget.py | 44 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/widgets/map/globalmapwidget.py b/widgets/map/globalmapwidget.py index 4080185..f1e1ffc 100644 --- a/widgets/map/globalmapwidget.py +++ b/widgets/map/globalmapwidget.py @@ -854,6 +854,13 @@ class GlobalMapWidget(widgets.WidgetBase): MAPZOOM_SCALE_MAX = 4.0 MAPZOOM_SCALE_MIN = 0.05 + + MAP_NWX = -135168 + MAP_NWY = 102400 + MAP_NEX = 114688 + MAP_NEY = 102400 + MAP_SWX = -135168 + MAP_SWY = -147456 def __init__(self, handle, controller, parent): super().__init__('Global Map', parent) @@ -1107,17 +1114,13 @@ def _onRootObjectEvent(self, rootObject): def _onPipMapReset(self, caller, value, pathObjs): self.pipMapWorldObject = self.pipMapObject.child('World') if self.pipMapWorldObject: - extents = self.pipMapWorldObject.child('Extents') - if extents: - self.mapCoords.init( - extents.child('NWX').value(), extents.child('NWY').value(), - extents.child('NEX').value(), extents.child('NEY').value(), - extents.child('SWX').value(), extents.child('SWY').value(), - self.mapItem.nw[0], self.mapItem.nw[1], - self.mapItem.ne[0], self.mapItem.ne[1], - self.mapItem.sw[0], self.mapItem.sw[1] ) - else: - self._logger.warn('No "Extents" record found. Map coordinates may be off') + self.mapCoords.init( + self.MAP_NWX, self.MAP_NWY, + self.MAP_NEX, self.MAP_NEY, + self.MAP_SWX, self.MAP_SWY, + self.mapItem.nw[0], self.mapItem.nw[1], + self.mapItem.ne[0], self.mapItem.ne[1], + self.mapItem.sw[0], self.mapItem.sw[1] ) if self.widget.mapColorAutoToggle.isChecked(): self._slotMapColorAutoModeTriggered(True) pipWorldPlayer = self.pipMapWorldObject.child('Player') @@ -1469,18 +1472,13 @@ def _slotMapFileComboTriggered(self, index): self.selectedMapFile = self.mapFileComboItems[index] file = os.path.join('res', mapfile['file']) self.mapItem.setMapFile(file, mapfile['colorable'], mapfile['nw'], mapfile['ne'], mapfile['sw']) - if self.pipMapWorldObject: - extents = self.pipMapWorldObject.child('Extents') - if extents: - self.mapCoords.init( - extents.child('NWX').value(), extents.child('NWY').value(), - extents.child('NEX').value(), extents.child('NEY').value(), - extents.child('SWX').value(), extents.child('SWY').value(), - self.mapItem.nw[0], self.mapItem.nw[1], - self.mapItem.ne[0], self.mapItem.ne[1], - self.mapItem.sw[0], self.mapItem.sw[1] ) - else: - self._logger.warn('No "Extents" record found. Map coordinates may be off') + self.mapCoords.init( + self.MAP_NWX, self.MAP_NWY, + self.MAP_NEX, self.MAP_NEY, + self.MAP_SWX, self.MAP_SWY, + self.mapItem.nw[0], self.mapItem.nw[1], + self.mapItem.ne[0], self.mapItem.ne[1], + self.mapItem.sw[0], self.mapItem.sw[1] ) self.signalMarkerForcePipValueUpdate.emit() self._app.settings.setValue('globalmapwidget/selectedMapFile', self.selectedMapFile)