At 12:14 AM 9/28/99 CEST, you wrote: >This seems to be similar to the problem i am having too, >when mud crashes when using olc... i can add 2 chars, but >when addin the third the mud crashes.. (using olc) > > >shrug > Hmm whenever I've had crashes from adding new structures/variables it is because I'm too tired and I get sloppy. First off, if you are using binary pfiles and a save structure...wipe the pfiles and make sure anything added to the save structure is fixed length. Next, make sure you are initializing any char * fields to null in init_char(or any pointer fields that will be empty). If you want to copy something to the pointer, check if it is null first...then initialize the memory. When you free a pointer after the free(bleh) set it to NULL because free doesn't automatically do that. Make sure when you load/save chars you throw some sort of dummy character to signify the field is empty and can be set to null, unless you have an ascii pfile format that initializes all the structures and pointers and variables to NULL or 0 or whatever a good default value is, and then scans the pfile and fills in the fields that are entered into the pfile(the really spiffy way of having things...) pretty much ch->desc is null, but it can be null for many reasons. My guess is that instead of descc you put desc in one of your frees. Also if you have overwritten the memory taken up by d->olc, by writing to a pointer that is pointing to unallocated memory, or already allocated memory then doing an if on part of that memory that is written weird and totally invalidated can do weird stuff that right now I am too tired to describe :P An error in a seemingly distant part of the mud with regard to writing on memory that wasn't intended to be written on with a pointer can affect variables that are files away. Therefore, I suggest a good logging system for changes(which hopefully you have). Then you can say...okay my mud was working before I added this, that, these and those, and yet after adding thus and that I remember it working, but these never quite worked 100%. Therfore you recall what the these project was and go over everything by rereading(maybe even printing and deskchecking *cough*). To avoid problems like this, I am going to give the greatest piece of advice I have ever heard as regards programming :P When you first write a subprocedure to do something, you test it thoroughly and make sure it does what it is supposed to do and only what it is supposed to do. In fact, read over it a few times to be totally sure. Then once you know that sub procedure is complete you can make another sub procedure that includes the previous one with confidence that any errors in the new sub procedure will be in the new sub procedure. Then, just keep testing up the changs and including subprocedures into other subprocedures until things are verified and then error checking will be swift. Of course, this procedure is not always feasible when modifying an already written program, but my idea for implementing the procedure would be like this..... 1. Add the new variables and add a procedure to set it to a value. Also, set the values to null when they are supposed to be null. Then, just try to see if you can change the values with an online command. 2. If this works then add in things to save the values and use an online command to change the values and then try saving and quitting and seeing that they change 3. Okay everything has gone perfectly. Just add in the new menu screen(thoroughly testing it) and have it call the procedures to set the values for the new variables. 4. Check everything is working, remove any procedures that unnecessarily display the values for the variable and you are done(almost) 5. Add places in the code where you want to use the value of the variable(using a similar procedure to test them) following this procedure will probably not steer you wrong. Admittedly I do not follow this procedure because I am lazy :P But anyway, following this procedure and constantly testing things could lead to the rock solid mud of legend. You could be the envy of the entire circlemud community!!! Oh well enough of this tiresome arbitrary gossip and time to get back to some even more tiresome arbitrary constants!!!! From, Cervo Ovrec The Beaten.......... +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST