tbaMUD 3.54

[Oct 10 2007] - Rumble
  Added OLC menu options for Copying. The Xcopy option is still available for GODs and above.
  Player table is now created if it does not exist. (thanks Rhade)
[Oct 08 2007] - Rumble
  Removed top_shop_offset variable, hopefully fixing the infamous sedit bug.
  Fixed memory leaks from not freeing new zone builders and new zone commands. (thanks Neme)
This commit is contained in:
Rumble 2007-10-12 17:59:17 +00:00
parent 40b643b7d5
commit 0b3748b07a
38 changed files with 12904 additions and 12966 deletions

View file

@ -326,7 +326,7 @@ void list_one_char(struct char_data *i, struct char_data *ch)
};
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && IS_NPC(i)) {
send_to_char(ch, "[%d]", GET_MOB_VNUM(i));
send_to_char(ch, "[%d] ", GET_MOB_VNUM(i));
if (SCRIPT(i))
send_to_char(ch, "[T%d] ", i->proto_script->vnum);
}
@ -501,11 +501,10 @@ void look_at_room(struct char_data *ch, int ignore_brief)
sprintbitarray(ROOM_FLAGS(IN_ROOM(ch)), room_bits, RF_ARRAY_MAX, buf);
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
if (SCRIPT(rm))
if (rm->proto_script)
send_to_char(ch, "[T%d] ", rm->proto_script->vnum);
send_to_char(ch, "%s [ %s]",
world[IN_ROOM(ch)].name, buf);
send_to_char(ch, "%s [ %s]", world[IN_ROOM(ch)].name, buf);
} else
send_to_char(ch, "%s", world[IN_ROOM(ch)].name);
@ -1569,7 +1568,7 @@ void print_object_location(int num, struct obj_data *obj, struct char_data *ch,
send_to_char(ch, "%33s", " - ");
if (obj->proto_script)
send_to_char(ch, "[%d]", obj->proto_script->vnum);
send_to_char(ch, "[T%d]", obj->proto_script->vnum);
if (IN_ROOM(obj) != NOWHERE)
send_to_char(ch, "[%5d] %s%s\r\n", GET_ROOM_VNUM(IN_ROOM(obj)), world[IN_ROOM(obj)].name, QNRM);
@ -1596,20 +1595,20 @@ void perform_immort_where(struct char_data *ch, char *arg)
send_to_char(ch, "Players\r\n-------\r\n");
for (d = descriptor_list; d; d = d->next)
if (IS_PLAYING(d)) {
i = (d->original ? d->original : d->character);
if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) {
if (d->original)
send_to_char(ch, "%-20s%s - [%5d] %s%s (in %s%s)\r\n",
GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)),
world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM);
else
send_to_char(ch, "%-20s%s - [%5d] %s%s\r\n", GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM);
}
i = (d->original ? d->original : d->character);
if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) {
if (d->original)
send_to_char(ch, "%-20s%s - [%5d] %s%s (in %s%s)\r\n",
GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)),
world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM);
else
send_to_char(ch, "%-20s%s - [%5d] %s%s\r\n", GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM);
}
}
} else {
for (i = character_list; i; i = i->next)
if (CAN_SEE(ch, i) && IN_ROOM(i) != NOWHERE && isname(arg, i->player.name)) {
found = 1;
found = 1;
send_to_char(ch, "M%3d. %-25s%s - [%5d] %-25s%s", ++num, GET_NAME(i), QNRM,
GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM);
if (SCRIPT(i))
@ -1618,8 +1617,8 @@ void perform_immort_where(struct char_data *ch, char *arg)
}
for (num = 0, k = object_list; k; k = k->next)
if (CAN_SEE_OBJ(ch, k) && isname(arg, k->name)) {
found = 1;
print_object_location(++num, k, ch, TRUE);
found = 1;
print_object_location(++num, k, ch, TRUE);
}
if (!found)
send_to_char(ch, "Couldn't find any such thing.\r\n");

View file

@ -13,7 +13,7 @@
#include "structs.h"
#include "interpreter.h" /* alias_data */
cpp_extern const char *tbamud_version = "tbaMUD, version 3.53";
cpp_extern const char *tbamud_version = "tbaMUD, version 3.54";
cpp_extern const char *oasisolc_version = "OasisOLC 2.0.6";
cpp_extern const char *ascii_pfiles_version = "ASCII Player Files 3.0.1";

View file

@ -209,6 +209,7 @@ void trigedit_disp_menu(struct descriptor_data *d)
"%s4)%s Numeric Arg : %s%d\r\n"
"%s5)%s Arguments : %s%s\r\n"
"%s6)%s Commands:\r\n%s%s\r\n"
"%sW%s) Copy Trigger\r\n"
"%sQ)%s Quit\r\n"
"Enter Choice :",
@ -219,7 +220,7 @@ void trigedit_disp_menu(struct descriptor_data *d)
grn, nrm, yel, trig->narg, /* numeric arg */
grn, nrm, yel, trig->arglist?trig->arglist:"",/* strict arg */
grn, nrm, cyn, OLC_STORAGE(d), /* the command list */
grn, nrm); /* quit colors */
grn, nrm, grn, nrm); /* quit colors */
OLC_MODE(d) = TRIGEDIT_MAIN_MENU;
}
@ -307,6 +308,11 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
d->mail_to = 0;
OLC_VAL(d) = 1;
break;
case 'w':
case 'W':
write_to_output(d, "Copy what trigger? ");
OLC_MODE(d) = TRIGEDIT_COPY;
break;
default:
trigedit_disp_menu(d);
@ -368,6 +374,13 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
trigedit_disp_types(d);
return;
case TRIGEDIT_COPY:
if ((i = real_room(atoi(arg))) != NOWHERE) {
trigedit_setup_existing(d, i);
} else
write_to_output(d, "That trigger does not exist.\r\n");
break;
case TRIGEDIT_COMMANDS:
break;

View file

@ -22,6 +22,7 @@
#define TRIGEDIT_COMMANDS 6
#define TRIGEDIT_NARG 7
#define TRIGEDIT_ARGUMENT 8
#define TRIGEDIT_COPY 9
#define OLC_SCRIPT_EDIT 82766 /* arbitrary > highest possible room number */
#define SCRIPT_MAIN_MENU 0

View file

@ -82,7 +82,7 @@ int add_mobile(struct char_data *mob, mob_vnum vnum)
/* Update shop keepers. */
if (shop_index)
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
for (shop = 0; shop <= top_shop; shop++)
SHOP_KEEPER(shop) += (SHOP_KEEPER(shop) != NOTHING && SHOP_KEEPER(shop) >= found);
add_to_save_list(zone_table[real_zone_by_thing(vnum)].number, SL_MOB);
@ -150,7 +150,7 @@ int delete_mobile(mob_rnum refpt)
/* Update shop keepers. */
if (shop_index)
for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
for (counter = 0; counter <= top_shop; counter++)
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
save_mobiles(real_zone_by_thing(vnum));

View file

@ -123,7 +123,7 @@ obj_rnum adjust_objects(obj_rnum refpt)
BOARD_RNUM(i) += (BOARD_RNUM(i) >= refpt);
/* Renumber shop produce. */
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
for (shop = 0; shop <= top_shop; shop++)
for (i = 0; SHOP_PRODUCT(shop, i) != NOTHING; i++)
SHOP_PRODUCT(shop, i) += (SHOP_PRODUCT(shop, i) >= refpt);
@ -440,7 +440,7 @@ int delete_object(obj_rnum rnum)
BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);
/* Renumber shop produce. */
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
for (shop = 0; shop <= top_shop; shop++)
for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);

View file

@ -27,7 +27,6 @@
#include "interpreter.h"
int save_config( IDXTYPE nowhere ); /* Exported from cedit.c */
int top_shop_offset = 0;
/* List of zones to be saved. */
struct save_list_data *save_list;

View file

@ -28,7 +28,6 @@ struct save_list_data {
};
extern struct save_list_data *save_list;
extern int top_shop_offset;
/* save_list_data.type */
#define SL_MOB 0

View file

@ -255,7 +255,7 @@ shop_rnum real_shop(shop_vnum vnum)
int bot, top, mid;
bot = 0;
top = top_shop - top_shop_offset;
top = top_shop;
/* perform binary search on shop_table */
while (bot < top) {
@ -307,9 +307,9 @@ int add_shop(struct shop_data *nshp)
}
top_shop++;
RECREATE(shop_index, struct shop_data, top_shop - top_shop_offset + 1);
RECREATE(shop_index, struct shop_data, top_shop + 1);
for (rshop = top_shop - top_shop_offset; rshop > 0; rshop--) {
for (rshop = top_shop; rshop > 0; rshop--) {
if (nshp->vnum > SHOP_NUM(rshop - 1)) {
found = rshop;

View file

@ -228,7 +228,7 @@ int delete_room(room_rnum rnum)
}
/* Remove this room from all shop lists. */
for (i = 0;i < top_shop;i++) {
for (i = 0; i < top_shop; i++) {
for (j = 0;SHOP_ROOM(i, j) != NOWHERE;j++) {
if (SHOP_ROOM(i, j) == world[rnum].number)
SHOP_ROOM(i, j) = 0; /* set to the void */

View file

@ -484,7 +484,7 @@ void remove_cmd_from_list(struct reset_com **list, int pos)
int new_command(struct zone_data *zone, int pos)
{
int subcmd = 0;
struct reset_com *new_com;
struct reset_com new_com;
/* Error check to ensure users hasn't given too large an index. */
while (zone->cmd[subcmd].command != 'S')
@ -494,9 +494,8 @@ int new_command(struct zone_data *zone, int pos)
return 0;
/* Ok, let's add a new (blank) command. */
CREATE(new_com, struct reset_com, 1);
new_com->command = 'N';
add_cmd_to_list(&zone->cmd, new_com, pos);
new_com.command = 'N';
add_cmd_to_list(&zone->cmd, &new_com, pos);
return 1;
}

View file

@ -420,7 +420,8 @@ void medit_disp_menu(struct descriptor_data *d)
"%sL%s) NPC Flags : %s%s\r\n"
"%sM%s) AFF Flags : %s%s\r\n"
"%sS%s) Script : %s%s\r\n"
"%sX%s) Delete mob\r\n"
"%sW%s) Copy mob\r\n"
"%sX%s) Delete mob\r\n"
"%sQ%s) Quit\r\n"
"Enter choice : ",
@ -431,6 +432,7 @@ void medit_disp_menu(struct descriptor_data *d)
grn, nrm, cyn, flag2,
grn, nrm, cyn, OLC_SCRIPT(d) ?"Set.":"Not Set.",
grn, nrm,
grn, nrm,
grn, nrm
);
@ -603,6 +605,11 @@ void medit_parse(struct descriptor_data *d, char *arg)
OLC_MODE(d) = MEDIT_AFF_FLAGS;
medit_disp_aff_flags(d);
return;
case 'w':
case 'W':
write_to_output(d, "Copy what mob? ");
OLC_MODE(d) = MEDIT_COPY;
return;
case 'x':
case 'X':
write_to_output(d, "Are you sure you want to delete this mobile? ");
@ -769,6 +776,13 @@ void medit_parse(struct descriptor_data *d, char *arg)
GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
break;
case MEDIT_COPY:
if ((i = real_mobile(atoi(arg))) != NOWHERE) {
medit_setup_existing(d, i);
} else
write_to_output(d, "That mob does not exist.\r\n");
break;
case MEDIT_DELETE:
if (*arg == 'y' || *arg == 'Y') {
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))) != NOBODY)

View file

@ -110,8 +110,12 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
/* Check for a zone. cleanup_type is irrelevant here, free() everything. */
if (OLC_ZONE(d)) {
free(OLC_ZONE(d)->name);
free(OLC_ZONE(d)->cmd);
if (OLC_ZONE(d)->builders)
free(OLC_ZONE(d)->builders);
if (OLC_ZONE(d)->name)
free(OLC_ZONE(d)->name);
if (OLC_ZONE(d)->cmd)
free(OLC_ZONE(d)->cmd);
free(OLC_ZONE(d));
}

View file

@ -194,7 +194,8 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OEDIT_EXTRADESC_MENU 24
#define OEDIT_LEVEL 25
#define OEDIT_PERM 26
#define OEDIT_DELETE 27
#define OEDIT_DELETE 27
#define OEDIT_COPY 28
/* Submodes of REDIT connectedness. */
#define REDIT_MAIN_MENU 1
@ -214,6 +215,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define REDIT_EXTRADESC_KEY 15
#define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17
#define REDIT_COPY 18
/* Submodes of ZEDIT connectedness. */
#define ZEDIT_MAIN_MENU 0
@ -264,6 +266,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define MEDIT_LEVEL 25
#define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27
#define MEDIT_COPY 28
/* Submodes of SEDIT connectedness. */
#define SEDIT_MAIN_MENU 0
@ -279,8 +282,8 @@ extern const char *nrm, *grn, *cyn, *yel;
#define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14
#define SEDIT_COPY 15
/* Numerical responses. */
#define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22

View file

@ -665,7 +665,8 @@ void oedit_disp_menu(struct descriptor_data *d)
"%sM%s) Min Level : %s%d\r\n"
"%sP%s) Perm Affects: %s%s\r\n"
"%sS%s) Script : %s%s\r\n"
"%sX%s) Delete object\r\n"
"%sW%s) Copy object\r\n"
"%sX%s) Delete object\r\n"
"%sQ%s) Quit\r\n"
"Enter choice : ",
@ -682,6 +683,7 @@ void oedit_disp_menu(struct descriptor_data *d)
grn, nrm, cyn, GET_OBJ_LEVEL(obj),
grn, nrm, cyn, buf2,
grn, nrm, cyn, OLC_SCRIPT(d) ? "Set." : "Not Set.",
grn, nrm,
grn, nrm,
grn, nrm
);
@ -830,6 +832,11 @@ void oedit_parse(struct descriptor_data *d, char *arg)
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
dg_script_menu(d);
return;
case 'w':
case 'W':
write_to_output(d, "Copy what object? ");
OLC_MODE(d) = OEDIT_COPY;
break;
case 'x':
case 'X':
write_to_output(d, "Are you sure you want to delete this object? ");
@ -1174,6 +1181,14 @@ void oedit_parse(struct descriptor_data *d, char *arg)
return;
}
break;
case OEDIT_COPY:
if ((number = real_object(atoi(arg))) != NOWHERE) {
oedit_setup_existing(d, number);
} else
write_to_output(d, "That object does not exist.\r\n");
break;
case OEDIT_DELETE:
if (*arg == 'y' || *arg == 'Y') {
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))) != NOTHING)

View file

@ -101,6 +101,7 @@ int create_entry(char *name)
if (top_of_p_table == -1) { /* no table */
pos = top_of_p_table = 0;
CREATE(player_table, struct player_index_element, 1);
} else if ((pos = get_ptable_by_name(name)) == -1) { /* new name */
i = ++top_of_p_table + 1;

View file

@ -426,7 +426,8 @@ void redit_disp_menu(struct descriptor_data *d)
"%sA%s) Exit down : %s%d\r\n"
"%sB%s) Extra descriptions menu\r\n"
"%sS%s) Script : %s%s\r\n"
"%sX%s) Delete Room\r\n"
"%sW%s) Copy Room\r\n"
"%sX%s) Delete Room\r\n"
"%sQ%s) Quit\r\n"
"Enter choice : ",
@ -457,6 +458,7 @@ void redit_disp_menu(struct descriptor_data *d)
grn, nrm,
grn, nrm, cyn, OLC_SCRIPT(d) ? "Set." : "Not Set.",
grn, nrm,
grn, nrm,
grn, nrm
);
@ -564,6 +566,11 @@ void redit_parse(struct descriptor_data *d, char *arg)
OLC_DESC(d) = OLC_ROOM(d)->ex_description;
redit_disp_extradesc_menu(d);
break;
case 'w':
case 'W':
write_to_output(d, "Copy what room? ");
OLC_MODE(d) = REDIT_COPY;
break;
case 'x':
case 'X':
/* Delete the room, prompt first. */
@ -783,6 +790,13 @@ void redit_parse(struct descriptor_data *d, char *arg)
}
break;
case REDIT_COPY:
if ((number = real_room(atoi(arg))) != NOWHERE) {
redit_setup_existing(d, number);
} else
write_to_output(d, "That room does not exist.\r\n");
break;
case REDIT_DELETE:
if (*arg == 'y' || *arg == 'Y') {
if (delete_room(real_room(OLC_ROOM(d)->number)))

View file

@ -403,6 +403,7 @@ void sedit_disp_menu(struct descriptor_data *d)
"%sR%s) Rooms Menu\r\n"
"%sP%s) Products Menu\r\n"
"%sT%s) Accept Types Menu\r\n"
"%sW%s) Copy Shop\r\n"
"%sQ%s) Quit\r\n"
"Enter Choice : ",
@ -424,7 +425,7 @@ void sedit_disp_menu(struct descriptor_data *d)
grn, nrm, yel, S_SELL(shop),
grn, nrm, cyn, buf1,
grn, nrm, cyn, buf2,
grn, nrm, grn, nrm, grn, nrm, grn, nrm
grn, nrm, grn, nrm, grn, nrm, grn, nrm, grn, nrm
);
OLC_MODE(d) = SEDIT_MAIN_MENU;
@ -471,6 +472,11 @@ void sedit_parse(struct descriptor_data *d, char *arg)
case SEDIT_MAIN_MENU:
i = 0;
switch (*arg) {
case 'w':
case 'W':
write_to_output(d, "Copy what shop? ");
OLC_MODE(d) = SEDIT_COPY;
return;
case 'q':
case 'Q':
if (OLC_VAL(d)) { /* Anything been changed? */
@ -759,6 +765,12 @@ void sedit_parse(struct descriptor_data *d, char *arg)
return;
}
break;
case SEDIT_COPY:
if ((i = real_room(atoi(arg))) != NOWHERE) {
sedit_setup_existing(d, i);
} else
write_to_output(d, "That shop does not exist.\r\n");
break;
default:
/* We should never get here. */

View file

@ -14,7 +14,7 @@
* account the version and supply their own definition for the macro if used
* on an older version. You are supposed to compare this with the macro
* TBAMUD_VERSION() in utils.h. */
#define _TBAMUD 0x030530 /* Major/Minor/Patchlevel - MMmmPP */
#define _TBAMUD 0x030540 /* Major/Minor/Patchlevel - MMmmPP */
/* If you want equipment to be automatically equipped to the same place
* it was when players rented, set the define below to 1. */

View file

@ -658,33 +658,33 @@ int room_is_dark(room_rnum room)
}
int levenshtein_distance(char *s1, char *s2)
{
{
int s1_len = strlen(s1), s2_len = strlen(s2);
int *d = NULL;
int i, j, k;
int **d, i, j;
s1_len++;
s2_len++;
CREATE(d, int *, s1_len + 1);
CREATE(d, int, (s1_len * s2_len));
for (i = 0; i <= s1_len; i++) {
CREATE(d[i], int, s2_len + 1);
d[i][0] = i;
}
for (i = 0; i < s1_len; i++)
d[i] = i;
for (j = 0; j < s2_len; j++)
d[j*s1_len] = j;
for (j = 0; j <= s2_len; j++)
d[0][j] = j;
for (i = 1; i <= s1_len; i++)
for (j = 1; j <= s2_len; j++)
d[i][j] = MIN(d[i - 1][j] + 1, MIN(d[i][j - 1] + 1,
d[i - 1][j - 1] + ((s1[i - 1] == s2[j - 1]) ? 0 : 1)));
for (i = 1; i < s1_len; i++)
for (j = 1; j < s2_len; j++)
d[(j*s1_len)+i] = MIN(d[(j*s1_len) + i - 1] + 1, MIN(d[i+((j-1)*s1_len)]
+ 1, d[((j-1)*s1_len) + i - 1] + ((s1[i - 1] == s2[j - 1]) ? 0 : 1)));
i = d[s1_len][s2_len];
k = d[s1_len*s2_len-1];
free (d);
return k;
}
for (j = 0; j <= s1_len; j++)
free(d[j]);
free(d);
return i;
}
void char_from_furniture(struct char_data *ch)
{
struct obj_data *furniture;