Adding Room Flags to Redit

  • Chime
  • Chime's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 weeks ago #7963 by Chime
Adding Room Flags to Redit was created by Chime
Hello all. I'm trying to make it so I can set HOUSE and HCRSH on a room exterior to hcontrol. For the life of me I cannot figure out where I might be able to add them as options in redit. Do we have a guide for this somewhere, or does someone know off-hand how it's done?

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

  • Chime
  • Chime's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 weeks ago #7964 by Chime
Replied by Chime on topic Adding Room Flags to Redit
Err, not HCRSH. I think I see what that's doing. Just the ROOM_HOUSE flag.

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

More
3 years 3 weeks ago - 3 years 3 weeks ago #7967 by lacrc
Replied by lacrc on topic Adding Room Flags to Redit
I don't think ROOM_HOUSE or ROOM_HOUSE_CRASH should be manually set in any room. They are both reserved flags that are used by the housing system. Why would you want to manually add that flag to another room? Are you trying to add the ROOM_HOUSE flag to another room adjacent to a house to also save it?

Unrequested info about the flags:
- The ROOM_HOUSE flag represents a room that is a house and was created by the "HCONTROL BUILD" command. It is used to check if the room is a house (ikr, duh hehe) and therefore needs additional saving and permission checks for entry (like teleporting) and also if a player can execute housing commands inside that room.
- The ROOM_ATRIUM flag represents an entrance to a house, it is used by the movement functions to check if a player is trying to enter a room with the HOUSE flag and, in if that's the case, check if the player have permissions to do so
- The ROOM_HOUSE_CRASH (HCRASH) flag (not sure if I'm writing this one correctly hehe) is used in the same way as the PLR_CRASH flag is for players, marking a room that needs to be saved (something was dropped or removed from the room).

Regardless of the flags being set, they only work if the house have a valid owner and a valid entry in hcontrol, a room with HOUSE but no entry in hcontrol won't be saved and attempts to use house commands will result in "Um.. this house seems to be screwed up." messages.
Last edit: 3 years 3 weeks ago by lacrc.
The following user(s) said Thank You: thomas, Chime

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

  • Chime
  • Chime's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 weeks ago - 3 years 3 weeks ago #7969 by Chime
Replied by Chime on topic Adding Room Flags to Redit

Are you trying to add the ROOM_HOUSE flag to another room adjacent to a house to also save it?


Exactly this, yeah! For houses that are more than one room, trying to make sure they all have crash save protection.

Thank you so much for the information on the flags. I was planning on spending awhile today figuring out what ATRIUM was about. Saving your post for when I inevitably forget again...

Edit: What is the * flag for?
Last edit: 3 years 3 weeks ago by Chime.

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

More
3 years 3 weeks ago - 3 years 3 weeks ago #7970 by lacrc
Replied by lacrc on topic Adding Room Flags to Redit
Well then just to reiterate what I mentioned earlier, simply adding the ROOM_HOUSE flag to a room won't cause it to be crash saved since the housing system requires an entry in the hcontrol file with a valid owner for it to be saved.

You can see more details in house.c (look for the functions House_save_all() and House_boot()) but basically they both have a loop that runs through all houses registered in hcontrol and save/load them accordingly. The House_boot() function has more checks to see if the house should be loaded so beware of that.

So to have circle save additional rooms you should start there, maybe you could change the saving functions in house.c to look for adjacent rooms with ROOM_HOUSE or change the structure of the system to support multiple rooms in one house entry.

Or you could get away with building another house inside a currently valid house (it's dirty but it works heh).
You would have three rooms (the -> represent exits):
ATRIUM -> HOUSE & ATRIUM -> HOUSE.
Again, it's dirty but it works since hcontrol will create an entry on hcontrol file, and the owner would even be able to determine permissions per room.

The '*' flag is the ROOM_BFS_MARK and it's used in the tracking and hunting functions located in graph.c to determine valid paths to characters. To help identify flags you need to lookup their names in constants.c and then match their defines in structs.h, in the case of room flags it's the "room_bits[]" array.
Last edit: 3 years 3 weeks ago by lacrc.
The following user(s) said Thank You: thomas, Chime

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

  • Chime
  • Chime's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 weeks ago #7973 by Chime
Replied by Chime on topic Adding Room Flags to Redit
Thank you! That explanation is great to know.

For adding room flags to redit in general, though, rather than strictly those ones - I'm attempting to add an OOC room flag now, for instance, that will do various things - how is that done?

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

More
3 years 3 weeks ago #7975 by thomas
Replied by thomas on topic Adding Room Flags to Redit
To add a new flag is realtively easy. Add it in structs.h (along with the others), remember to adjust the max, and add the name to the list of flag names in constants.c, in the corresponding spot.
The following user(s) said Thank You: Chime

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

  • Chime
  • Chime's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 3 weeks ago #7979 by Chime
Replied by Chime on topic Adding Room Flags to Redit
Thank you, Thomas!

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

Time to create page: 0.106 seconds