Skip to content

Commit

Permalink
style: Separate methods with curly brackets by space
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 committed Aug 12, 2024
1 parent 8408110 commit 893edf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Application/Players/Ranks/RankCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ internal class RankCollection
private RankCollection() { }
public static int Max => s_ranks.Length;
public static IReadOnlyList<IRank> GetAll() => s_ranks;

public static Result<IRank> GetById(RankId id)
{
if ((int)id < 0 || (int)id >= Max)
Expand All @@ -32,6 +33,7 @@ public static Result<IRank> GetById(RankId id)
Rank rank = s_ranks[(int)id];
return Result<IRank>.Success(rank);
}

public static Result<IRank> GetByRequiredKills(int value)
{
if (value < 0)
Expand All @@ -50,6 +52,7 @@ public static Result<IRank> GetByRequiredKills(int value)
IRank maxRank = s_ranks[Max - 1];
return Result<IRank>.Success(maxRank);
}

public static Result<IRank> GetNextRank(RankId previous)
{
if ((int)previous < 0 || (int)previous >= Max)
Expand Down
3 changes: 3 additions & 0 deletions src/Application/Players/Weapons/GtaWeapons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ internal class GtaWeapons
private GtaWeapons() { }
public static int Max => s_weapons.Length;
public static IReadOnlyList<IWeapon> GetAll() => s_weapons;

public static Result<IWeapon> GetById(Weapon id)
{
GtaWeapon weapon = s_weapons.FirstOrDefault(weapon => weapon.Id == id);
return weapon is null ?
Result<IWeapon>.Failure(Messages.WeaponNotFound) :
Result<IWeapon>.Success(weapon);
}

public static Result<IWeapon> GetByIndex(int index)
{
if(index < 0 || index >= Max)
Expand All @@ -34,6 +36,7 @@ public static Result<IWeapon> GetByIndex(int index)
GtaWeapon weapon = s_weapons[index];
return Result<IWeapon>.Success(weapon);
}

public static Result<IWeapon> GetByName(string weaponName)
{
ArgumentNullException.ThrowIfNull(weaponName);
Expand Down
2 changes: 2 additions & 0 deletions src/Application/Players/Weapons/WeaponPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal class WeaponPack : IEnumerable<IWeapon>
public int Items => _weapons.Count;
public IWeapon this[int index] => _weapons[index];
public bool IsEmpty() => _weapons.Count == 0;

public void Add(IWeapon weapon)
{
ArgumentNullException.ThrowIfNull(weapon);
Expand All @@ -23,6 +24,7 @@ public void Add(IWeapon weapon)
else
_weapons.Add(weapon);
}

public void Remove(IWeapon weapon) => _weapons.Remove(weapon);
public bool Exists(IWeapon weapon) => _weapons.Find(w => w == weapon) is not null;
public void Clear() => _weapons.Clear();
Expand Down

0 comments on commit 893edf7

Please sign in to comment.