mirror of
https://github.com/ficed/Braver.git
synced 2024-12-13 07:36:49 +00:00
552641c078
Get basic battle AI memory chunk 4 working Battle action queue basically working
30 lines
859 B
C#
30 lines
859 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ficedula.FF7 {
|
|
public class FFException : Exception {
|
|
public FFException(string msg) : base(msg) { }
|
|
}
|
|
|
|
public static class Util {
|
|
public static T? ValueOrNull<T>(T value, T nullValue) where T : struct {
|
|
return value.Equals(nullValue) ? null : value;
|
|
}
|
|
|
|
public static uint BSwap(uint i) {
|
|
return (i & 0xff00ff00) | ((i & 0xff) << 16) | ((i >> 16) & 0xff);
|
|
}
|
|
|
|
public static int IndexOf<T>(this IReadOnlyList<T> list, T value) where T : class {
|
|
foreach (int i in Enumerable.Range(0, list.Count))
|
|
if (list[i] == value)
|
|
return i;
|
|
return -1;
|
|
}
|
|
|
|
}
|
|
}
|