1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Don't modify Journal FSDJump/Location entry Factions in-place

Fixes #375
This commit is contained in:
Jonathan Harris 2019-01-06 23:23:38 +00:00
parent 582542cfff
commit 22c94d0c5c

View File

@ -403,9 +403,9 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
# strip out properties disallowed by the schema
for thing in ['ActiveFine', 'CockpitBreach', 'BoostUsed', 'FuelLevel', 'FuelUsed', 'JumpDist', 'Latitude', 'Longitude', 'Wanted']:
entry.pop(thing, None)
for faction in entry.get('Factions', []):
for thing in ['HappiestSystem', 'HomeSystem', 'MyReputation', 'SquadronFaction']:
faction.pop(thing, None)
if 'Factions' in entry:
# Filter faction state. `entry` is a shallow copy so replace 'Factions' value rather than modify in-place.
entry['Factions'] = [ {k: v for k, v in f.iteritems() if k not in ['HappiestSystem', 'HomeSystem', 'MyReputation', 'SquadronFaction']} for f in entry['Factions']]
# add planet to Docked event for planetary stations if known
if entry['event'] == 'Docked' and this.planet: