Fixed culling display and added setting to include/exclude carriers from culling area.

This commit is contained in:
Khopa 2020-11-21 17:01:50 +01:00
parent 799b0fae94
commit fcf45554ef
4 changed files with 22 additions and 4 deletions

View File

@ -84,7 +84,8 @@ class Game:
self.ground_planners: Dict[int, GroundPlanner] = {}
self.informations = []
self.informations.append(Information("Game Start", "-" * 40, 0))
self.__culling_points = self.compute_conflicts_position()
self.__culling_points: List[Point] = []
self.compute_conflicts_position()
self.__destroyed_units: List[str] = []
self.savepath = ""
self.budget = PLAYER_BUDGET_INITIAL
@ -239,7 +240,7 @@ class Game:
self.aircraft_inventory.set_from_control_point(cp)
# Plan flights & combat for next turn
self.__culling_points = self.compute_conflicts_position()
self.compute_conflicts_position()
self.ground_planners = {}
self.blue_ato.clear()
self.red_ato.clear()
@ -364,6 +365,14 @@ class Game:
points.append(front_line.control_point_a.position)
points.append(front_line.control_point_b.position)
# If do_not_cull_carrier is enabled, add carriers as culling point
print("------")
print(self.settings.perf_do_not_cull_carrier)
if self.settings.perf_do_not_cull_carrier:
for cp in self.theater.controlpoints:
if cp.is_carrier or cp.is_lha:
points.append(cp.position)
# If there is no conflict take the center point between the two nearest opposing bases
if len(points) == 0:
cpoint = None
@ -387,7 +396,7 @@ class Game:
if len(points) == 0:
points.append(Point(0, 0))
return points
self.__culling_points = points
def add_destroyed_units(self, data):
pos = Point(data["x"], data["z"])

View File

@ -39,6 +39,7 @@ class Settings:
# Performance culling
perf_culling: bool = False
perf_culling_distance: int = 100
perf_do_not_cull_carrier = True
# LUA Plugins system
plugins: Dict[str, bool] = field(default_factory=dict)

View File

@ -296,7 +296,7 @@ class QLiberationMap(QGraphicsView):
# Display Culling
if DisplayOptions.culling and self.game.settings.perf_culling:
self.display_culling()
self.display_culling(scene)
for cp in self.game.theater.controlpoints:

View File

@ -279,6 +279,10 @@ class QSettingsWindow(QDialog):
self.culling_distance.setValue(self.game.settings.perf_culling_distance)
self.culling_distance.valueChanged.connect(self.applySettings)
self.culling_do_not_cull_carrier = QCheckBox()
self.culling_do_not_cull_carrier.setChecked(self.game.settings.perf_do_not_cull_carrier)
self.culling_do_not_cull_carrier.toggled.connect(self.applySettings)
self.performanceLayout.addWidget(QLabel("Smoke visual effect on frontline"), 0, 0)
self.performanceLayout.addWidget(self.smoke, 0, 1, alignment=Qt.AlignRight)
self.performanceLayout.addWidget(QLabel("SAM starts in RED alert mode"), 1, 0)
@ -299,6 +303,8 @@ class QSettingsWindow(QDialog):
self.performanceLayout.addWidget(self.culling, 8, 1, alignment=Qt.AlignRight)
self.performanceLayout.addWidget(QLabel("Culling distance (km)"), 9, 0)
self.performanceLayout.addWidget(self.culling_distance, 9, 1, alignment=Qt.AlignRight)
self.performanceLayout.addWidget(QLabel("Do not cull carrier's surroundings"), 10, 0)
self.performanceLayout.addWidget(self.culling_do_not_cull_carrier, 10, 1, alignment=Qt.AlignRight)
self.generatorLayout.addWidget(self.gameplay)
self.generatorLayout.addWidget(QLabel("Disabling settings below may improve performance, but will impact the overall quality of the experience."))
@ -366,9 +372,11 @@ class QSettingsWindow(QDialog):
self.game.settings.perf_culling = self.culling.isChecked()
self.game.settings.perf_culling_distance = int(self.culling_distance.value())
self.game.settings.perf_do_not_cull_carrier = self.culling_do_not_cull_carrier.isChecked()
self.game.settings.show_red_ato = self.cheat_options.show_red_ato
self.game.compute_conflicts_position()
GameUpdateSignal.get_instance().updateGame(self.game)
def onSelectionChanged(self):