EA just open sourced Command & Conquer, Red Alert, Renegade and Generals

I can't quite believe it either. Command & Conquer, Red Alert, Command & Conquer Renegade and Command & Conquer Generals (inc. Zero Hour) have their code officially open sourced.

GamingOnLinux

From the Command & Conquer Generals source code.

"Lets discuss how Windows is a flaming pile of poo"

Oh how that gave me a chuckle 😂

https://github.com/electronicarts/CnC_Generals_Zero_Hour/blob/main/Generals/Code/Main/WinMain.cpp#L615

CnC_Generals_Zero_Hour/Generals/Code/Main/WinMain.cpp at main · electronicarts/CnC_Generals_Zero_Hour

Command and Conquer: Generals - Zero Hour. Contribute to electronicarts/CnC_Generals_Zero_Hour development by creating an account on GitHub.

GitHub
CnC_Generals_Zero_Hour/GeneralsMD/Code/GameEngine/Source/Common/System/Xfer.cpp at 0a05454d8574207440a5fb15241b98ad0b435590 · electronicarts/CnC_Generals_Zero_Hour

Command and Conquer: Generals - Zero Hour. Contribute to electronicarts/CnC_Generals_Zero_Hour development by creating an account on GitHub.

GitHub
@gamingonlinux the fact that is inside a "#if 0" and clearly a relict from early development makes it a bit less funny though.
@gamingonlinux some things never change

@gamingonlinux

Hmm.

It looks like Microsoft wanted DEV_BROADCAST_HDR to be a discriminated union, but with the different variants having different sizes, presumably so that they could introduce new variants later without breaking existing code.

This is the correct way to accomplish that.

#Rust does something similar for trait object downcasting: check if the desired type is the same as the actual type, and if so, cast the pointer.

Check: https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#225
Cast: https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#294

any.rs - source

Source of the Rust file `library/core/src/any.rs`.