Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix callsign generator #3467

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)