forked from awgil/ffxiv_bossmod
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #612 from FFXIV-CombatReborn/mergeWIP
code analyzer fix
- Loading branch information
Showing
3 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,55 @@ | ||
namespace BossMod.Global.DeepDungeon; | ||
|
||
public record class Floor<T>(uint DungeonId, uint Floorset, Tileset<T> RoomsA, Tileset<T> RoomsB) | ||
public sealed record class Floor<T>(uint DungeonId, uint Floorset, Tileset<T> RoomsA, Tileset<T> RoomsB) | ||
{ | ||
public Floor<M> Map<M>(Func<T, M> Mapping) => new(DungeonId, Floorset, RoomsA.Map(Mapping), RoomsB.Map(Mapping)); | ||
} | ||
|
||
public record class Tileset<T>(RoomData<T>[] Rooms) | ||
public sealed record class Tileset<T> | ||
{ | ||
private readonly RoomData<T>[] _rooms; | ||
|
||
public Tileset(RoomData<T>[] rooms) | ||
{ | ||
_rooms = rooms; | ||
} | ||
|
||
public IReadOnlyList<RoomData<T>> Rooms => _rooms; | ||
|
||
public Tileset<M> Map<M>(Func<T, M> Mapping) | ||
{ | ||
var len = Rooms.Length; | ||
var len = _rooms.Length; | ||
var mappedRooms = new RoomData<M>[len]; | ||
for (var i = 0; i < len; ++i) | ||
{ | ||
mappedRooms[i] = Rooms[i].Map(Mapping); | ||
mappedRooms[i] = _rooms[i].Map(Mapping); | ||
} | ||
return new Tileset<M>(mappedRooms); | ||
} | ||
|
||
public RoomData<T> this[int index] => Rooms[index]; | ||
public RoomData<T> this[int index] => _rooms[index]; | ||
|
||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("Tileset { Rooms = ["); | ||
var len = Rooms.Length; | ||
var len = _rooms.Length; | ||
for (var i = 0; i < len; ++i) | ||
{ | ||
if (i > 0) | ||
{ | ||
sb.Append(", "); | ||
} | ||
sb.Append(Rooms[i].ToString()); | ||
sb.Append(_rooms[i].ToString()); | ||
} | ||
sb.Append("] }"); | ||
return sb.ToString(); | ||
} | ||
} | ||
|
||
public record class RoomData<T>(T Center, T North, T South, T West, T East) | ||
public sealed record class RoomData<T>(T Center, T North, T South, T West, T East) | ||
{ | ||
public RoomData<M> Map<M>(Func<T, M> F) => new(F(Center), F(North), F(South), F(West), F(East)); | ||
} | ||
|
||
public record struct Wall(WPos Position, float Depth); | ||
public readonly record struct Wall(WPos Position, float Depth); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters