I assumed it was to unset cheated characters… Either way it's not really needed, I removed it from my mud. It may do something other than that, but that's my thoughts on it.
Its primary purpose is to make sure the character's data is correct. A MUD is a pretty complex piece of code, and there are a lot of unexpected things that could happen (like an object being edited while a char happens to be using an object of the same vnum, or maybe something being changed or even removed while the player is not logged in - let alone just some oddity with all the interaction in the game). So they use reset_char() to make sure everything lines up right when the char logs in. It really has little to do with cheating at all.
07 Feb, 2009, David Haley wrote in the 5th comment:
Votes: 0
Could also be useful in the context of all the character object recycling, but that's just a guess on my part not having seen the code.
reset_char strips and resets all affects from a character.
This corrects the added affects. Aswell as correcting other information, such as sex/vs/true_sex values.
Basically it does a giant correct on the players to help ensure everything is good to go.
Eg. Your wearing gear that changes your stats. You logout, those changes aren't saved to your pfile, but what gear you have is, so when you load up, it resets the data, and applies the appropriate value's.
Eg. Your wearing gear that changes your stats. You logout, those changes aren't saved to your pfile, but what gear you have is, so when you load up, it resets the data, and applies the appropriate value's.
Almost. ROM does save stat mods. But, if the gear you're wearing is tweaked while you're gone, fread_char will naturally load the old mods, not the new ones.
hmmm… think I just answered my own question. Thanks, guys. :)
I've noticed no problems on my rom cause it has no players and I don't edit items without removing all instances of that item from myself. That's just an old habit I picked up from the first mud I ever immed on, the owner pretty much demanded it.
Almost. ROM does save stat mods. But, if the gear you're wearing is tweaked while you're gone, fread_char will naturally load the old mods, not the new ones.
ROM has the bad habit of transferring all affects from the object index to the actual object when enchanting it - but reset_char doesn't fix old mods, it's there to assist lazy programmers.
Back when I played a ROM mud I made sure to put one enchant armor on all over powered gear, which payed off whenever the inevitable tweaking started. With unenchanted stuff ROM only saves the object vnum and doesn't save any object stats. In my opinion that's worth getting rid off, and if you care, updating the identify output to merge obj and obj->index bonuses if needed.
Nevermind, it's used slightly differently in Rom than it's on the codebase I'm familiar with.
A good question is, why does Rom save hitroll, damroll, hp, etc, if it's going to recalculate those stats from scratch upon login?
I still think it's a better practice to add the equipment and affect stats on the go as objects and affects are loaded, the way Rom is set up right now you need to maintain two routines which is a bad practice from a maintainability viewpoint.