ported from perforce
This commit is contained in:
22
RobotAndDonkey.Game/Execution/Requests/Request.cs
Normal file
22
RobotAndDonkey.Game/Execution/Requests/Request.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using RobotAndDonkey.Game.Execution.Commands;
|
||||
|
||||
namespace RobotAndDonkey.Game.Execution.Requests;
|
||||
|
||||
public abstract record Request(Guid RequestId)
|
||||
{
|
||||
public bool IsCommandCompatible(Command command)
|
||||
{
|
||||
foreach (var requestType in command.RequestTypes)
|
||||
{
|
||||
if (requestType == GetType())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static readonly EmptyRequest s_Empty = new();
|
||||
}
|
||||
|
||||
public sealed record EmptyRequest() : Request(Guid.Empty);
|
||||
Reference in New Issue
Block a user