Skip to content

Commit

Permalink
Use hard-coded values for map calibration. Mods may manipulate the
Browse files Browse the repository at this point in the history
values provided by the game.
  • Loading branch information
matzman666 committed Feb 3, 2016
1 parent b5da6f6 commit 48895de
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions widgets/map/globalmapwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 48895de

Please sign in to comment.