Welcome to the Builder Academy

Question PWIPE

More
03 Oct 2016 14:42 #6194 by JTP
PWIPE was created by JTP
Renaming MAGIC_USER to MAGE will that need a pwipe ?

Please Log in or Create an account to join the conversation.

More
03 Oct 2016 20:43 #6195 by thomas
Replied by thomas on topic PWIPE
Short answer: no. Changing the macro (the #define) will not change the underlying code. Changing the number will.

Long answer: Most of the .h-files and some of the .c files contain a lot of lines starting with #define. These are called preprocessor macros, and are primarily a reading/coding aid.

When you compile your code, it is actually run through a series of steps. At first, your code is passed through the preprocessor, then the code is compiled, and lastly it is linked. During the preprocessor step, #define's are replaced, literally, in the codebase. So, all commands are transformed from "ACMD(do_stuff)" to the #define'd replacement, "void do_stuff(struct char_data *ch, char *argument, int cmd, int subcmd)". This substitution is literal. So, your CLASS_MAGIC_USER will be translated to the number it is defined to, before it is ever compiled.


I am curious, though - you realise that changing the MAGIC_USER macro doesn't alter what the players see? To alter that, look in constants.c.

Please Log in or Create an account to join the conversation.

More
03 Oct 2016 20:51 #6196 by JTP
Replied by JTP on topic PWIPE
I want to change the entire code from MAGIC_USER TO MAGE

Since i want the class to be called mage

Thought maybe that the p files would get corupted

Please Log in or Create an account to join the conversation.

More
03 Oct 2016 21:27 #6197 by thomas
Replied by thomas on topic PWIPE
As I wrote, as long as you don't alter the number, it will just work.

Please Log in or Create an account to join the conversation.

Time to create page: 0.193 seconds