savefile corruption screen and escort RTB waypoints

This commit is contained in:
Vasyl Horbachenko 2018-06-30 06:18:05 +03:00
parent 8b0ef52721
commit b2458ac244
5 changed files with 55 additions and 33 deletions

View File

@ -9,6 +9,7 @@ import theater.nevada
import ui.window
import ui.mainmenu
import ui.newgamemenu
import ui.corruptedsavemenu
from game.game import Game
from theater import start_generator
@ -23,6 +24,7 @@ def proceed_to_main_menu(game: Game):
w = ui.window.Window()
try:
game = persistency.restore_game()
if not game:
new_game_menu = None # type: NewGameMenu
@ -56,6 +58,8 @@ if not game:
new_game_menu.display()
else:
proceed_to_main_menu(game)
except Exception as e:
ui.corruptedsavemenu.CorruptedSaveMenu(w).display()
w.run()

View File

@ -31,7 +31,8 @@ For example, player accessible Hornet is called `FA_18C_hornet`, and MANPAD Igla
"""
Prices for the aircraft.
This defines both price for the player and prioritization for the enemy (i.e. less important bases will receive units with lower price)
This defines both price for the player (although only aircraft listed in CAP/CAS/Transport/Armor/AirDefense roles will be purchasable)
and prioritization for the enemy (i.e. less important bases will receive units with lower price)
"""
PRICES = {
# fighter
@ -164,15 +165,13 @@ UNIT_BY_TASK = {
PinpointStrike: [Armor.MBT_T_90, Armor.MBT_T_80U, Armor.MBT_T_55, Armor.MBT_M1A2_Abrams, Armor.MBT_M60A3_Patton, Armor.ATGM_M1134_Stryker, Armor.APC_BTR_80, ],
AirDefence: [
AirDefence.AAA_Vulcan_M163,
# those are listed multiple times here to balance prioritization more into lower tier AAs
AirDefence.AAA_Vulcan_M163,
AirDefence.AAA_Vulcan_M163,
AirDefence.SAM_Avenger_M1097,
AirDefence.SAM_Avenger_M1097,
AirDefence.SAM_Patriot_ICC,
AirDefence.AAA_ZU_23_on_Ural_375,
AirDefence.AAA_ZU_23_on_Ural_375,
AirDefence.AAA_ZU_23_on_Ural_375,
AirDefence.AAA_ZU_23_on_Ural_375,
AirDefence.SAM_SA_18_Igla_MANPADS,

View File

@ -190,6 +190,9 @@ class AircraftConflictGenerator:
for group in self.escort_targets:
wayp.tasks.append(EscortTaskAction(group.id, engagement_max_dist=ESCORT_ENGAGEMENT_MAX_DIST))
group.add_waypoint(self.conflict.from_cp.position, RTB_ALTITUDE)
group.land_at(self.conflict.from_cp.at)
groups.append(group)
return groups

17
ui/corruptedsavemenu.py Normal file
View File

@ -0,0 +1,17 @@
from tkinter import *
from tkinter.ttk import *
from ui.window import *
class CorruptedSaveMenu(Menu):
def __init__(self, window: Window):
super(CorruptedSaveMenu, self).__init__(window, None, None)
self.frame = window.right_pane
def display(self):
self.window.clear_right_pane()
Label(text="Your save game was corrupted!").grid(row=0, column=0)
Label(text="Please restore it by replacing \"liberation_save\" file with \"liberation_save_tmp\" to restore last saved copy.").grid(row=1, column=0)
Label(text="You can find those files under user DCS directory.").grid(row=2, column=0)

View File

@ -28,8 +28,7 @@ def restore_game():
with open(_save_file(), "rb") as f:
return pickle.load(f)
except Exception as e:
print(e)
return None
raise e
def save_game(game) -> bool: