Skip to content

Commit

Permalink
Fix bug where CallsignGenerator fails when player faction uses Easter…
Browse files Browse the repository at this point in the history
…n callsigns
  • Loading branch information
zhexu14 committed Nov 29, 2024
1 parent f7da2cf commit 793c338
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 12.1.0

Saves from 12.x are not compatible with 12.1.0.

## Features/Improvements



## Fixes

* **[Data]** Added/updated CBU weapons data.
* **[Mission Generation]** Fixed crash when using factions that have Eastern callsign conventions.

# 12.0.0

Saves from 11.x are not compatible with 12.0.0.
Expand Down
20 changes: 10 additions & 10 deletions game/callsigns/callsigngenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,19 @@ def release_callsign(self, callsign: Callsign) -> None:
class FlightCallsignGenerator:

def __init__(self, country: str):
self._generators: dict[
bool, WesternFlightCallsignGenerator | EasternFlightCallsignGenerator
] = {
True: WesternFlightCallsignGenerator(country),
False: EasternFlightCallsignGenerator(),
}
self._use_western_callsigns = countries_by_name[country]().use_western_callsigns
use_western_callsigns = countries_by_name[country]().use_western_callsigns
if use_western_callsigns:
self._generator: (
WesternFlightCallsignGenerator | EasternFlightCallsignGenerator
) = WesternFlightCallsignGenerator(country)
else:
self._generator = EasternFlightCallsignGenerator()

def reset(self) -> None:
self._generators[self._use_western_callsigns].reset()
self._generator.reset()

def alloc_callsign(self, flight: Flight) -> Callsign:
return self._generators[self._use_western_callsigns].alloc_callsign(flight)
return self._generator.alloc_callsign(flight)

def release_callsign(self, callsign: Callsign) -> None:
self._generators[self._use_western_callsigns].release_callsign(callsign)
self._generator.release_callsign(callsign)

0 comments on commit 793c338

Please sign in to comment.