(probably long) GET_NUMBER problem..

From: The Merciless lord of Everything (serces@MUD.DK)
Date: 01/05/98

Hi All..

Seems like something went wrong last time I sent this letter, so
I'll just try again. It's very simple, I'm trying to do a look <item>
on <person> and look <item> in <container>, the second part is
working nicely. But the first one doesn't. I can get it to work when
I only want to do 'look ring on serces' no problem.. even 'look ring
on 2.guard' but when I do 'look 2.ring on serces' it will not work.
The loop I started with said 'Serces isn't equipped with 2.ring'. So
I started looking at what the different things did, and I figured out
that I could grap some code from get_person_vis (or something like
that), that resulted in this :

--- start insertion
void look_on_something(struct char_data * ch, char *object,
char *victim) {
 struct char_data *found_char = NULL;
 struct char_data *lame_char =  NULL;
struct obj_data *f_obj = NULL;
 int bits, found = FALSE, j, i = 0, number;
 char *desc;
 char tmpname[MAX_INPUT_LENGTH];
 char *tmp = tmpname;

 strcpy(tmp, object);
 bits = generic_find(victim, FIND_CHAR_ROOM, ch,
                &found_char,  &f_obj);

 if(!found_char && GET_LEVEL(ch) >= LVL_IMMORT)
  bits = generic_find(victim, FIND_CHAR_WORLD, ch,
        &found_char,  &f_obj);

 if (!found_char) {
   send_to_char("Sorry, but you can't see that person anywhere in your
   send_to_char("Seems like that person isn't logged in!\r\n", ch);

 number = get_number(&tmp);
------- end insertion
and here it crashes, it could be that I have made my pointers go
wrong somehow.

GDB reports:
Program received signal SIGSEGV, Segmentation fault.
show_obj_to_char (object=0x0, ch=0x8301a28, mode=5) at
act.informative.c:169 169       else if (object->short_description &&
((mode == 1) ||

Not that I can see anywhere that I call show_obj_to_char..  a
Backtrace tells me :

#0  show_obj_to_char (object=0x0, ch=0x8301a28, mode=5)
    at act.informative.c:169
#1  0x805278f in look_on_something (ch=0x8301a28, object=0x8100c34
    victim=0x80f50b0 "serces") at act.informative.c:987
#2  0x805289d in look_onin_target (ch=0x8301a28, arg1=0x8100c34
    arg2=0x80f50b0 "serces", arg3=0x80f51b0 "") at
#3  0x8052ae9 in do_look (ch=0x8301a28, argument=0xbffff851 " 2.staff
    cmd=164, subcmd=0) at act.informative.c:1056
#4  0x8086c51 in command_interpreter (ch=0x8301a28,
    argument=0xbffff850 "l 2.staff serces") at interpreter.c:788
#5  0x804a2a0 in game_loop (mother_desc=11) at comm.c:661
#6  0x8049964 in init_game (port=5000) at comm.c:301
#7  0x80498ea in main (argc=1, argv=0xbffffdc4) at comm.c:271
#8  0x80493eb in ___crt_dummy__ ()

I'm tired of that code and can't think clearly
(which means that I probably will find the solution in 30 seconds)..
Anyone who can see the flaw?? Hope someone can.. I can't..

S. P. Skou
Serces@mud.dk - Implementor at The Realm of Chaos (chaos.mud.dk 4000)

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |

This archive was generated by hypermail 2b30 : 12/15/00 PST