ソースを参照

I do need current_sector, fixed Trade Report bug.

I need current_sector, so I know whether or not I need
to move to get to the planet.

If you trade with StarDock and trade report, it crashes
because it doesn't have a class.  (It is class 0, but
it doesn't show on the trade screen.)  Also the find
next good trade has same issue.  Fixed.
Steve Thielemann 5 年 前
コミット
229478b143
1 ファイル変更15 行追加0 行削除
  1. 15 0
      flexible.py

+ 15 - 0
flexible.py

@@ -1824,6 +1824,10 @@ class ScriptTerror(object):
         for sector in sorted(self.game.gamedata.ports.keys()):
             pd = self.game.gamedata.ports[sector]
             if not GameData.port_burnt(pd):
+                # This happens when you trade with a StarDock
+                if 'class' not in pd:
+                    continue
+
                 pc = pd['class']
 
                 # Ok, let's look into it.
@@ -2000,6 +2004,13 @@ class PlanetUpScript(object):
                 self.deactivate()
                 return
 
+            # I need this to know if I can just land, or need to move to the planet.
+            # Get current sector from the prompt
+            # Command [TL=00:00:00]:[10202] (?=Help)? :
+            _, _, part = prompt.partition(']:[')
+            sector, _, _ = part.partition(']')
+            self.current_sector = int(sector)
+
             # A better default is to ask which planet to upgrade.
 
             tc = merge(Style.BRIGHT + Fore.YELLOW + Back.BLUE)
@@ -2506,6 +2517,10 @@ class ProxyMenu(object):
         for sector in sorted(self.game.gamedata.ports.keys()):
             pd = self.game.gamedata.ports[sector]
             if not GameData.port_burnt(pd):
+                # This happens if you trade with a StarDock.  (It doesn't get the class set.)
+                if 'class' not in pd:
+                    continue
+
                 pc = pd['class']
 
                 # Ok, let's look into it.