diff --git a/qt_ui/windows/basemenu/ground_forces/QGroundForcesStrategy.py b/qt_ui/windows/basemenu/ground_forces/QGroundForcesStrategy.py index a9d63eb6..18c55d07 100644 --- a/qt_ui/windows/basemenu/ground_forces/QGroundForcesStrategy.py +++ b/qt_ui/windows/basemenu/ground_forces/QGroundForcesStrategy.py @@ -3,6 +3,7 @@ from collections.abc import Callable from PySide2.QtWidgets import QGroupBox, QLabel, QPushButton, QVBoxLayout from game import Game +from game.server import EventStream from game.sim.gameupdateevents import GameUpdateEvents from game.theater import ControlPoint from qt_ui.windows.GameUpdateSignal import GameUpdateSignal @@ -57,5 +58,7 @@ class QGroundForcesStrategy(QGroupBox): self.cp.base.affect_strength(amount) enemy_point.base.affect_strength(-amount) # Clear the ATO to replan missions affected by the front line. - self.game.initialize_turn(GameUpdateEvents()) + events = GameUpdateEvents() + self.game.initialize_turn(events) + EventStream.put_nowait(events) GameUpdateSignal.get_instance().updateGame(self.game) diff --git a/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py b/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py index 8e1dbc16..b173cf63 100644 --- a/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectBuyMenu.py @@ -1,11 +1,12 @@ -from collections import defaultdict import logging +from collections import defaultdict from dataclasses import dataclass, field from typing import Type from PySide2.QtCore import Signal from PySide2.QtGui import Qt from PySide2.QtWidgets import ( + QCheckBox, QComboBox, QDialog, QGridLayout, @@ -14,7 +15,6 @@ from PySide2.QtWidgets import ( QPushButton, QSpinBox, QVBoxLayout, - QCheckBox, QWidget, ) from dcs.unittype import UnitType @@ -22,20 +22,19 @@ from dcs.unittype import UnitType from game import Game from game.armedforces.forcegroup import ForceGroup from game.data.groups import GroupRole, GroupTask -from game.point_with_heading import PointWithHeading -from game.sim.gameupdateevents import GameUpdateEvents -from game.theater import TheaterGroundObject -from game.theater.theatergroundobject import ( - VehicleGroupGroundObject, - SamGroundObject, - EwrGroundObject, -) -from game.theater.theatergroup import TheaterGroup from game.layout.layout import ( LayoutException, TgoLayout, TgoLayoutGroup, ) +from game.server import EventStream +from game.sim.gameupdateevents import GameUpdateEvents +from game.theater import TheaterGroundObject +from game.theater.theatergroundobject import ( + EwrGroundObject, + SamGroundObject, + VehicleGroupGroundObject, +) from qt_ui.uiconstants import EVENT_ICONS from qt_ui.windows.GameUpdateSignal import GameUpdateSignal @@ -219,7 +218,9 @@ class QGroundObjectTemplateLayout(QGroupBox): ) # Replan redfor missions - self.game.initialize_turn(GameUpdateEvents(), for_red=True, for_blue=False) + events = GameUpdateEvents() + self.game.initialize_turn(events, for_red=True, for_blue=False) + EventStream.put_nowait(events) GameUpdateSignal.get_instance().updateGame(self.game) diff --git a/qt_ui/windows/groundobject/QGroundObjectMenu.py b/qt_ui/windows/groundobject/QGroundObjectMenu.py index c82ddde0..482b8a4e 100644 --- a/qt_ui/windows/groundobject/QGroundObjectMenu.py +++ b/qt_ui/windows/groundobject/QGroundObjectMenu.py @@ -14,13 +14,11 @@ from dcs import Point from game import Game from game.config import REWARDS from game.data.building_data import FORTIFICATION_BUILDINGS +from game.server import EventStream from game.sim.gameupdateevents import GameUpdateEvents from game.theater import ControlPoint, TheaterGroundObject from game.theater.theatergroundobject import ( BuildingGroundObject, - EwrGroundObject, - SamGroundObject, - VehicleGroupGroundObject, ) from qt_ui.uiconstants import EVENT_ICONS from qt_ui.widgets.QBudgetBox import QBudgetBox @@ -210,7 +208,9 @@ class QGroundObjectMenu(QDialog): package.target == self.ground_object for package in self.game.ato_for(player=False).packages ): - self.game.initialize_turn(GameUpdateEvents(), for_red=True, for_blue=False) + events = GameUpdateEvents() + self.game.initialize_turn(events, for_red=True, for_blue=False) + EventStream.put_nowait(events) self.do_refresh_layout() GameUpdateSignal.get_instance().updateGame(self.game)