On Sun, 25 Feb 1996, Hades wrote: > I keep getting tons of objects located in nowhere... and can't seem to track > Does anyone have any suggestions as to where I could look to see if I can > find why these objects are getting lost? Weeell, try the shops? We had about the same problem and it was a badly entered shop file. You never know of course... Else, you could perhaps log every obj_to_room when the room is nowhere. Of course, you would get too much, but you could gdb and put a breakpoint on that code... Whatever. Be creative :) > At one point after 24 hours uptide I had 772 objects in nowhere. I quickly > added the: purge nowhereobjs option :) Smart move :) > char *num_to_char(unsigned long i) > { > int x, ctr = 0; > char txt[MAX_INPUT_LENGTH] = ""; > char ab[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', > 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', > 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' }; Why do you define 34 flags for 32 bits? > > if(i == 0) { > strcpy(buf, "0"); > return buf; > } And why do you use buf when you have txt available? What if someone else was using it already? You know how long you can look for bugs of that nature? Better still: Require the caller to give you a 33 byte buffer. If not, just define txt as char txt[MAX...] = "0";, saves you a strcpy and you overwrite the 0 anyway... You return txt then, so it should be static, of course... > for(x = 0; x <= 31; x++) { > if(i < (1 << x)) > continue; > if(i & (1 << x)) { > txt[ctr] = ab[x]; > ctr++; > } > } > strcat(txt, "\0"); > strcpy(buf, txt); > return buf; > } I would just do: for (x=0; x<32; x++) { if (i & 1) txt[ctr++] = ab[x]; i= i >> 1; } txt[ctr] = '\0'; return txt; /* NEEDS TO BE STATIC */ But that's just me I suppose... The everlasting unreadable code writer :) (And remember the thing I said above..... It's good for you, trust me...) Gekke Eekhoorn of BUGMUD.
This archive was generated by hypermail 2b30 : 12/07/00 PST