I'm sorry that it seems the only one me keeps asking questions.
When playing games, there are times when you want to start in a specific area as the world grows.
I want to create a new object in a specific room, and when I order it to register, the game starts in that room when I login.
At this time, if the registration cancellation command is entered, the location of the starting room is initialized to mortal_start_room and immort_start_room according to the user's level.
The following is the code I made, but it doesn't run because many places are wrong. It seems to be because I lack basic knowledge of programming.
I added it to the end of the struct char_data in the structs.h file.
Code:
struct char_data *start_room;
I didn't think I should add it to the reset_char function in the db.c file. Or it seems to be initialized with mortal_start_room and immort_start_room according to the user's level.
In the do_stat_character function of the act.wizard.c file, I can get the room name and show it.
This could be solved by knowing how to define and load a new value in char_data.
I think should initialize the starting room for void init_char(struct char_data *ch) function as well.
Code:
set_startroom(ch, r_mortal_start_room);
Again, this is a mess of code.
If the starting room is set in enter_player_game of the interpreter.c file, the character is connected to the room, and if it is not set, I can login to the room according to the level of the character.
ex) mortal_start_room and immort_start_room
I made the utils.h file to get the character's starting room, but it seems to be wrong.
Code:
#define GET_STARTROOM(ch) (ch->start_room)
I made a function that initializes the starting room in the limits.c file.
Of course it wasn't made right.
Code:
void set_startroom(struct char_data *ch, room_vnum rvnum)
{
zone_rnum zrnum = real_zone_by_thing(rvnum);
room_rnum rrnum = real_room(rvnum);
if (GET_STARTROOM(ch) != NULL)
free(GET_STARTROOM(ch));
if (zrnum == NOWHERE || rrnum == NOWHERE)
GET_STARTROOM(ch) = r_mortal_start_room;
}
Is it correct to make the following when specifying the following in char_data?
Code:
struct char_data *start_room;
start_room is not an int type, it contains the room number.
I want to save and load the location of the starting room just like loading the user's level in utils.h.
Code:
#define GET_LEVEL(ch) ((ch)->player.level)
In my opinion, it doesn't seem to be called and used as below. Are there any documents that can help you learn this?
Code:
#define GET_STARTROOM(ch) (ch->start_room)
The article I wrote was using Google Translator. What I want to say may have been mistranslated into English.