I agree that it's a pretty amazing program. To properly design an OO program takes time. And as you stated, the race to beat the next patch does effect things.
Now with that said, i have started porting over the code from EQEmuSharedMem to C#. Mostly converting packet structs to C# structs. It's a great way to learn the innerds of the program.
C# struct have some limitations that can be overcome with interop.
Example:
C++
Code:
struct NameApproval
{
char name[64];
int32 race;
int32 class_;
int32 deity;
};
C#
Code:
[StructLayout( LayoutKind.Sequential )]
public struct NameApproval
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)]
public char[] name;
public int race;
public int class_;
public int diety;
}
Unions
C++
Code:
struct Color_Struct
{
union
{
struct
{
int8 blue;
int8 green;
int8 red;
uint8 use_tint; // if there's a tint this is FF
} rgb;
uint32 color;
};
};
C#
Code:
/// <summary>
/// RGB_Struct
/// Size: 4 Bytes
/// **Used internally in Color_Struct**
/// </summary>
[StructLayout( LayoutKind.Sequential )]
public struct RGB_Struct
{
public sbyte blue;
public sbyte green;
public sbyte red;
public byte use_tint;
}
/// <summary>
/// Color_Struct (Union)
/// Size: 4 bytes
/// Used for convenience
/// Note: Orginal source used an anonymous union (rgb).
/// </summary>
[StructLayout( LayoutKind.Explicit, Size=4, CharSet=CharSet.Unicode, Pack=1)]
public struct Color_Struct
{
[FieldOffset( 0 )]
public RGB_Struct rgb;
[FieldOffset( 0 )]
public uint color;
}
Also C# does not natively support bitfields. But i found a working bitfield class (i didn't write) for that.
I am not writing this because i think it will be superior to C++ release. I am writing it so i can get a deeper understanding of the code. Once i do this, I will analyze the structure and try to implement proper OO design.
Regardless of patches,The fact is some things that do not change. Players still run, cast spells, Meditate, interact with mobs, chat, ect. How those actions get implemented should be done at a lower layer.
I think redesign is a great idea. But i do understand the limited time and resources peope have so i won' t hold my breath
:lol: