Matt Read <mjr@doc.ic.ac.uk> writes: > The situation is this: > I want to change the obj_index.number (which is normally the number of each > object existing in the game at any time) to be the number of each object > existing in the game and in the rent files at any time. > > My dilemma is this: > There are a number of ways I can check this, I can either > a) search the rent files at boot time and only at boot time; > b) search the rent files every x pulses while game is running; or > c) search the rent files whenever a new instance of an object is > going to be brought into the game. > > My opinion is that option c) would provide the most accurate means of > controlling the number of objects in the game but I think it would involve > an awful lot of time spent searching rent files. The other options obviously > have their pros and cons - so tell me, which shall I use? I've actually coded a solution to this, and I used option a because I only have to do the search once, and I can keep accurate numbers after that. Basically, you need to go into objsave.c and when a new user comes into the game, SUBTRACT one instance of the object as it is being created, because the creation routine will add one back in. When a player exits the game, ADD one instance of the object, since the purge routine subtracts one. All the numbers will end up balancing fine, and will only change if someone junks something, a zone resets, a God creates a new item, a shop produces something, or create food gets cast (there's probably more). The best part is that this technique only modifies the code in 3 places, and the rest work fine. I'll be submitting my code to Jeremy for version 3.1, because I don't want to slow down 3.0 production. I think the code is really useful because players can't race to mobs to find maxxed out equipment after a crash... because it won't be there. -Jeff
This archive was generated by hypermail 2b30 : 12/07/00 PST