[CF-Devel] PATCH: inscription couldn't write spells, and prepended garbage to text

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Tue Mar 4 18:05:11 CST 2003


Hi!

This small patch does two things:

1) When writing a text message, it prevents the binary garbage at the start of
the written message by initializing the *buf = 0 before strcpying into it.

2) When no message is given to use_skill, write the current spell into the
scroll. This previously depended on the type of the marked scroll, though it
should depend on what the user wanted. As if it isn't confusing enough that
we have scrolls with type==book. If you try to write a spell into a book or a
message into a scroll, you'll get an appropriate message anyway.


Bye
Jochen

---------------  patch  ----------------------

Index: skills.c
===================================================================
RCS file: /cvsroot/crossfire/crossfire/server/skills.c,v
retrieving revision 1.38
diff -u -r1.38 skills.c
--- skills.c    21 Feb 2003 07:55:37 -0000      1.38
+++ skills.c    4 Mar 2003 23:58:22 -0000
@@ -1098,7 +1098,7 @@
                "You had better pay for that before you write on it.");
            return 0;
        }
-       switch(item->type) {
+       switch(msgtype) {
            case SCROLL:
                return write_scroll(pl,item);
                break;
@@ -1161,6 +1161,8 @@
         return strlen(msg);
     }
    }
+
+  buf[0] = 0;
   if(!book_overflow(item->msg,msg,BOOK_BUF)) { /* add msg string to book */
     if(item->msg) {
       strcpy(buf,item->msg);


-- 
Jochen Suckfuell  ---  
     
     http://www.suckfuell.net/jochen/
     
       ---

_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list