Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMud Declaration split amongst multiple files #234

Open
rezalas opened this issue Oct 24, 2023 · 1 comment
Open

CMud Declaration split amongst multiple files #234

rezalas opened this issue Oct 24, 2023 · 1 comment

Comments

@rezalas
Copy link
Owner

rezalas commented Oct 24, 2023

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:

  • bootup.c / bootup.h: Performs core startup loads of area files, GSNs, time, greeting display, and some core options like game_port, base_directory, and player_dir.
  • mud.c / mud.h: the actual declaration for the CMud class along with the primary startup sequence for the mud. This calls the functions declared by the bootup.h but never actually references bootup.h.

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants