rezalas / riftshadow

Dedicated to the preservation of the game and modernization of a classic mud codebase.
MIT License
18 stars 14 forks source link

CMud Declaration split amongst multiple files #234

Open rezalas opened 1 year ago

rezalas commented 1 year ago

While analyzing the bootup sequence to combine the config files into a single file I noticed that CMud:: declarations are being performed in multiple files:

I'm wondering if we should migrate these into a single class declaration. I'm honestly not sure how it's working given that there is no direct reference anywhere. As far as I can find, nothing references bootup.h beyond bootup.c. I did however find that inside mud.h there is a call to extern CMud RS; which may be the reason the seemingly lack of any tie-in it works.

sean-gilliam commented 1 year ago

Yes, it's the extern CMud RS; statement that is the magic sauce. The extern keyword instructs the compiler to add a reference to CMud for the linker to later resolve. When the linker gets invoked, it takes that reference and replaces it with calls to the CMud class.

We should definitely combine all the CMud functions into one file like you mentioned though. It would follow modern practices as well as be easier to maintain.