Re: [Circle] [Newbie] Patching [LONG]

From: Glover, Rick I. (
Date: 05/23/00

-----Original Message-----
From: doomzday [mailto:doomzday@EASYNET.CO.UK]
Sent: Monday, May 22, 2000 10:08 AM
Subject: [CIRCLE] [Circle] [Newbie] Patching

Can somebody please explain the process of manualy patching the circle
source using the information
provided by a .patch file ?


There may be different types of .patch files depending on the parameters
used with the diff command.  I'll go over what I think are the two most
common ones.

The following is a snip from an auction patch:

diff -N -c ../circle30bpl11/src/comm.c src/comm.c
*** ../circle30bpl11/src/comm.c Sun Apr 14 14:28:46 1996
--- src/comm.c  Thu Feb 27 22:17:18 1997
*** 665,676 ****
--- 665,679 ----
  void heartbeat(int pulse)
    static int mins_since_crashsave = 0;
+   void auction_update();

    if (!(pulse % PULSE_ZONE))

    if (!(pulse % (15 * PASSES_PER_SEC)))               /* 15 seconds */
+   if (!(pulse % (15 * PASSES_PER_SEC)))
+     auction_update();

    if (!(pulse % PULSE_MOBILE))

The information here gives you the file name you need to edit, the line
numbers (which will almost always be off because you change your own code)
for an approximate location, the code's text before and after the changes
that take place and + or - where code needs to be added or removed.  You can
open the file for editing, jump down to the line number (665 in the example)
and insert the code that starts with + and remove code that starts with -.
Remove the + in the process of adding the code.  If you have trouble finding
the code with the line numbers given, then search for the code that you see
around the code changes.

Some patches may contain a line such as:

@@ -288,7 +288,7 @@ ACMD(do_bash)

which will give you the line numbers and the function that the code may be

Other patches may not contain any +'s or -'s, but rather have !'s, which
means that the line with the ! had a change in it.  Those patches will show
a before and after, each with the ! as shown below.

diff -pr circle30bpl17/src/act.informative.c
*** circle30bpl17/src/act.informative.c Thu Jan 20 19:16:03 2000
--- bitfields17/src/act.informative.c   Fri Apr 14 19:56:24 2000
*************** void look_at_room(struct char_data * ch,
*** 396,403 ****
    send_to_char(CCCYN(ch, C_NRM), ch);
    if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) {
!     sprintbit(ROOM_FLAGS(ch->in_room), room_bits, buf);
!     sprintf(buf2, "[%5d] %s [ %s]", GET_ROOM_VNUM(IN_ROOM(ch)),
            world[ch->in_room].name, buf);
      send_to_char(buf2, ch);
    } else
--- 396,403 ----
    send_to_char(CCCYN(ch, C_NRM), ch);
    if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) {
!     sprintfield((char*)&ROOM_FLAGS(ch->in_room), room_bits, buf);
!     sprintf(buf2, "[%5d] %s [%s]", GET_ROOM_VNUM(IN_ROOM(ch)),
            world[ch->in_room].name, buf);
      send_to_char(buf2, ch);
    } else

You can cut and paste most all of your hand patching, just remove the !, +
or -.  What you need to pay attention to is whether the code is required, is
from an older bpl version, how it affects the rest of your current code,
etc.  What may be a good idea to do for large patches is to make a define
for the new patch like USE_AUCTION if you were patching a new auction bit of
code and put #if defined(USE_AUCTION) around the new parts of code and #else
use the old code.  In conf.h, add a #define USE_AUCTION 1 when you are ready
to use your new code.  This is handy for code that has many coders so that
they can still compile and run the mud while you are patching it and for
working out the bugs in the new code while still able to run your old code.
If you don't like this method, then just make sure to have a backup before
you start.

Good luck,

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT