Skip to content

Commit

Permalink
make all remaining classes with Id implement IIdentifiable: Agent and…
Browse files Browse the repository at this point in the history
… GameEvent
  • Loading branch information
Konrad Jamrozik committed Jun 14, 2024
1 parent e437389 commit b113e78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/game-lib/Events/GameEvent.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
namespace UfoGameLib.Events;
using Lib.Json;

public abstract class GameEvent
namespace UfoGameLib.Events;

public abstract class GameEvent : IIdentifiable
{
public readonly int Id;
public int Id { get; }
public readonly string Type;

public GameEvent(int id, string type)
Expand Down
9 changes: 3 additions & 6 deletions src/game-lib/Model/Agent.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System.Text.Json.Serialization;
using Lib.Contracts;
using Lib.Json;

namespace UfoGameLib.Model;

// kja-wishlist I think that yes, it should be IIdentifiable. lib\Json\JsonConverterSupportingReferences.cs:86
// should this implement IIdentifiable the same as MissionSite?
// I think currently it doesn't because Agents are never serialized by reference
// by GameStateJsonConverter, so it doesn't matter if they implement IIdentifiable
public class Agent
public class Agent : IIdentifiable
{
public enum AgentState
{
Expand All @@ -21,7 +18,7 @@ public enum AgentState
Terminated
}

public readonly int Id;
public int Id { get; }

public readonly int TurnHired;
public AgentState CurrentState;
Expand Down

0 comments on commit b113e78

Please sign in to comment.