# # Patch name: hourly.172p16 # Patch version: 1 # Author's name: Ari@SpaceMUSH, decompiled by Rak@SpaceMUSH # Author's email: # Version of PennMUSH: 1.7.2p16 # Date patch made: 11/11/1998 # Author is willing to support (yes/no): no # Patch format: context diff # # # This is a contributed PennMUSH patch. Its use is subject to the # same restrictions found in PennMUSH's hdrs/copyrite.h file. # # No warranty is given for this patch. It is not necessarily going # to work on your system, with any version of PennMUSH other than # the one above, etc. # # If the author given above was willing to support the patch, you # should write to the author if you have any questions or problems. Do # *NOT* send email messages to Javelin or any PennMUSH mailing list about # this patch! # # Below this line is the author's description of the patch, # followed by the patch itself. If the patch is in context diff # format, you'll probably apply it by typing: patch < patchfile # in your top-level MUSH directory, unless instructed otherwise # below. # This patch adds an @hourly attribute and an internal HOURLY_FLAG to mark objects with the attribute. Every hour, all @hourly attributes are executed. *** atr_tab.orig Thu Nov 12 00:22:20 1998 --- atr_tab.h Thu Nov 12 01:54:55 1998 *************** *** 55,60 **** --- 55,61 ---- AF_WIZARD | AF_NOCOPY, NULL, 0}, #endif {(char *) "HAVEN", AF_NOPROG, NULL, 0}, + {(char *) "HOURLY", AF_NOPROG | AF_WIZARD, NULL, 0}, {(char *) "IDESCRIBE", AF_NOPROG, NULL, 0}, {(char *) "IDLE", AF_NOPROG, NULL, 0}, {(char *) "INFILTER", AF_NOPROG, NULL, 0}, *** flags.orig Thu Nov 12 02:20:50 1998 --- flags.h Thu Nov 12 02:16:38 1998 *************** *** 90,95 **** --- 90,96 ---- #define GOING_TWICE 0x40000000 /* Marked for destruction, but * spared once. */ /* -- empty slot 0x80000000 -- */ + #define HOURLY_FLAG 0x80000000 /*-------------------------------------------------------------------------- * Player flags *** flags.orig Thu Nov 12 00:15:06 1998 --- flags.c Thu Nov 12 01:57:28 1998 *************** *** 169,174 **** --- 169,175 ---- {"CLOUDY", 'x', TYPE_EXIT, EXIT_CLOUDY, F_ANY, F_ANY}, + {"HOURLY", '\0', NOTYPE, HOURLY_FLAG, F_INTERNAL, F_INTERNAL}, {"ACCESSED", '\0', NOTYPE, ACCESSED, F_INTERNAL | F_DARK, F_INTERNAL | F_DARK}, {"MARKED", '\0', NOTYPE, MARKED, F_INTERNAL | F_DARK, *** attrib.orig Thu Nov 12 00:14:59 1998 --- attrib.c Thu Nov 12 02:19:19 1998 *************** *** 745,751 **** if (type == '$') { flag_mask = AF_COMMAND; ! parent_depth = GoodObject(Parent(thing)); } else { flag_mask = AF_LISTEN; parent_depth = 0; --- 745,751 ---- if (type == '$') { flag_mask = AF_COMMAND; ! parent_depth = Parent(thing) != NOTHING; } else { flag_mask = AF_LISTEN; parent_depth = 0; *************** *** 908,913 **** --- 908,918 ---- Flags(thing) |= STARTUP; else Flags(thing) &= ~STARTUP; + } else if (!strcmp(name, "HOURLY")) { + if (s && *s) + Flags(thing) |= HOURLY_FLAG; + else + Flags(thing) &= ~HOURLY_FLAG; } if ((flags & 0x01) && !Quiet(player) && !Quiet(thing)) notify(player, tprintf("%s/%s - %s.", Name(thing), name, s ? "Set" : "Cleared")); *** local.orig Thu Nov 12 00:15:17 1998 --- local.c Thu Nov 12 01:57:52 1998 *************** *** 56,61 **** --- 56,82 ---- void local_timer() { + static int hourly_ticks = -1; + dbref thing; + ATTR *s; + char *r; + + if(hourly_ticks < 0) + hourly_ticks = time(NULL) % 3600; + hourly_ticks++; + if(hourly_ticks >= 3600) { + for(thing = 0; thing < db_top; thing++) { + if(!Destroyed(thing) && (Flags(thing) & HOURLY_FLAG) && !Halted(thing)) { + s = atr_get_noparent(thing, "HOURLY"); + if(!s) + continue; + r = safe_uncompress(s->value); + parse_que(thing, r, thing); + free((Malloc_t) r); + } + } + hourly_ticks = 0; + } } #ifdef LOCAL_DATA