Skip to content

Commit

Permalink
Further fixes for Loadout parsing exceptions that appear to have be…
Browse files Browse the repository at this point in the history
…en impacting fuel level updates from the Status Monitor.
  • Loading branch information
Tkael committed Jun 23, 2024
1 parent b7f25cb commit ab29fc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Full details of the variables available for each noted event, and VoiceAttack integrations, are available in the individual [event pages](https://github.com/EDCD/EDDI/wiki/Events).

## 4.0.4-b4
* Core
* Further fixes for `Loadout` parsing exceptions that appear to have been impacting fuel level updates from the Status Monitor.
* Cargo Monitor
* Fixed a crash that could occur when viewing the Cargo Monitor while it contains cargo.

Expand Down
9 changes: 6 additions & 3 deletions ShipMonitor/ShipMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ private Ship ParseShipLoadoutEvent(ShipLoadoutEvent @event)
{
// Obtain the ship to which this loadout refers
Logging.Debug("Current Ship Id is: " + currentShipId + ", Loadout Ship Id is " + @event.shipid);
Ship ship = GetShip(@event.shipid);
var ship = GetShip(@event.shipid);

if (ship == null)
{
Expand All @@ -474,13 +474,16 @@ private Ship ParseShipLoadoutEvent(ShipLoadoutEvent @event)
// Save a copy of the raw event so that we can send it to other 3rd party apps
ship.raw = @event.raw;

// Update model (in case it was solely from the edname), name, ident & paintjob if required
ship.model = ship.model.ToLowerInvariant() == ship.EDName.ToLowerInvariant() ? @event.ship : ship.model;
// Update model (in case it was solely from the edname), name, ident, and paintjob if required
ship.model = @event.shipDefinition.model ?? @event.ship ?? @event.edModel;
setShipName(ship, @event.shipname);
setShipIdent(ship, @event.shipident);
ship.paintjob = @event.paintjob;
ship.hot = @event.hot;

// Augment with template values
ship.Augment();

// Write ship value, if given by the loadout event
if (@event.value != null)
{
Expand Down

0 comments on commit ab29fc6

Please sign in to comment.