View Single Post
Old 02-19-2016, 11:51 AM   #19
ExFishermanBob
Difficulties Numbing
 
Join Date: Aug 2013
Location: AN19
Posts: 429
Downloads: 43
Uploads: 0


Default

NOTE BENE: these are my guesses that I have used before.

Where in the savegame is this data stored:
+ commander-name of current career
PROBABLY, in {home}/SH3/data/cfg/main.cfg under [Player], entry "Name"

+ current U-Boot and type
{home}/SH3/data/cfg/Careers/{commander}/Patrols_0.cfg entry 'SubName'
There are entries for SubType and SubVersion - these appear to cross-reference entries in:

{program-directory}/Silent Hunter 3/data/Cfg/Basic.cfg with entries like [SUBMARINE0] and sub-entries VersionX

For example:
Code:
[SUBMARINE1]
NrMinOff=3
NrMaxOff=5
NrMinPO=9
NrMaxPO=16
NrMinSeamen=20
NrMaxSeamen=30
NbVersion=4
Version0=0 ; VIIB
Name0=VIIB
Month0=7
Year0=1939
Version1=1 ; VIIC
Name1=VIIC
...etc
+ current location of U-Boot (in what format? PQ XXyy?`)
I use the entry in {home}/SH3/data/cfg/Careers/{commander}/{patrol}/{last-save}.map

IF there is an entry, you can read Waypoint Pt0 (2 values) and dividing them by the magic number 120000 will give you the numbers in digital degress. Negative is South or West.

Here is the python 3 code that I use for conversion: lat_long[0] is latitude, lat_long[1] is longitude (in digital format).
Code:
    def formatted(self, lat_long, with_degree_markers=False):
        s = ''
        if lat_long:
            lat = lat_long[0]
            isNorth = lat >= 0
            lat = abs(lat)
            degrees_lat = int(lat)
            temp_minutes_lat = (lat-degrees_lat)*60
            minutes_lat = int(temp_minutes_lat)
            seconds_lat = round((temp_minutes_lat-minutes_lat) * 60, 2)
            
            long = lat_long[1]
            isEast = long >= 0
            long = abs(long)
            degrees_long = int(long)
            temp_minutes_long = (long-degrees_long)*60
            minutes_long = int(temp_minutes_long)
            seconds_long = round((temp_minutes_long-minutes_long) * 60, 2)        

            latitude_indicator = 'N'
            longitude_indicator = 'E'
            if not isNorth:
                latitude_indicator = 'S'
            if not isEast:
                longitude_indicator = 'W'
            if with_degree_markers:
                s = """{0}{1}′{2}″{3},""".format(degrees_lat, minutes_lat, seconds_lat, latitude_indicator)
                s += """ {0}{1}′{2}″{3}""".format(degrees_long, minutes_long, seconds_long, longitude_indicator)
            else:
                s = """{0} {1} {2} {3},""".format(degrees_lat, minutes_lat, seconds_lat, latitude_indicator)
                s += """ {0} {1} {2} {3}""".format(degrees_long, minutes_long, seconds_long, longitude_indicator)

        return s
You should note that most of these values are saved (written out) at game save or exit, and do not reflect the running program's values.
ExFishermanBob is offline   Reply With Quote