Here is my attemp at coverting the line in question below:

                case 'p': if (to&&obj1) i=can_see_obj(to,obj1);
                else bug("Act: bad code $p for 'to' or 'obj1'",0);
                break;

Here is amother line that is going to be tough:

                case 'd':
                    if ( arg2 == NULL || ((char *) arg2)[0] == '\0' )
                    {
                        i = "door";
                    }
                    else
                    {
                        one_argument( (char *) arg2, fname );
                        i = fname;
                    }
                    break;

I'm trying to convert these two to the format explained below. These are bug
fixes that can cause a crash in stock rom 2.4b6. Please help.


                                 Dantin

----- Original Message -----
From: "Dantin" <[EMAIL PROTECTED]>
To: "Rom Mailing List" <[email protected]>
Sent: Sunday, July 07, 2002 11:17 PM
Subject: $ string problems


>      I got a bug fix document and heres the text that follows:
>
> More $
>
>   Problem
>
>    It seemed that the $-problem in the previous paragraph gave also
>    problems in the act_new()-function, when you get a string with a $
>    dollar in it. Perhaps the previous fix was not enough on it's on, with
>    this is it.
>
>   Cause
>
>    In act_new(), it's assumed that all pointers are valid.
>
>   Checking
>
>    Take a mortal character, let him say "cast 'bless' $p" for about 40
>    times and make sure you have the wiznet-spam option on. If your mud
>    crashes you have to apply the following patch.
>
>   Patch
>
>    Check the pointers before using them:
>
>    case 't': i = (char *) arg1;                            break;
>    case 'T': i = (char *) arg2;                            break;
>    case 'n': i = PERS( ch,  to  );                         break;
>    case 'N': i = PERS( vch, to  );                         break;
>    case 'e': i = he_she  [URANGE(0, ch  ->sex, 2)];        break;
>    etc...
>
>    should become
>
>    case 't': if (arg1) i=(char *)arg1;
>              else bug("Act: bad code $t for 'arg1'",0);
>              break;
>    case 'T': if (arg2) i=(char *)arg2;
>              else bug("Act: bad code $T for 'arg2'",0);
>              break;
>    case 'n': if (ch&&to) i=PERS(ch,to);
>              else bug("Act: bad code $n for 'ch' or 'to'",0);
>              break;
>    case 'N': if (vch&&to) i=PERS(vch,to);
>              else bug("Act: bad code $N for 'ch' or 'to'",0);
>              break;
>    case 'e': if (ch) i=he_she[URANGE(0,ch->sex,2)];
>              else bug("Act: bad code $e for 'ch'",0);
>              break;
>    etc...
>              break;
>              break;
>              break; // BREAK IT! :-)
>
>   Thanks
>
>    Thanks to the guy from primenet for telling me the problem (although
>    it was already fixed in our code :-)
>
> Okay I was doing what it was saying until I came to this area in the
cases:
>
> case 'p':
>                     i = can_see_obj( to, obj1 )
>                             ? obj1->short_descr
>                             : "something";
>                     break;
>
>      How in the heck can I convert this to the format above? I'm stumped.
> Thanks for any help you guys or gals can give me.
>
>
>                                        Dantin
>
>
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>


Reply via email to