mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-23 18:50:13 +01:00
Fixed several warnings and a little cleanup.
This commit is contained in:
parent
5986794156
commit
55253bdf61
6 changed files with 17 additions and 31 deletions
|
|
@ -4263,10 +4263,10 @@ ACMD(do_file)
|
|||
FILE *req_file; /* Pointer to file to be read. */
|
||||
size_t req_file_size = 0; /* Size of file to be read. */
|
||||
int req_file_lines = 0; /* Number of total lines in file to be read. */
|
||||
int lines_read = 0; /* Counts total number of lines read from the file. */
|
||||
int req_lines = 0; /* Number of lines requested to be displayed. */
|
||||
int i, j; /* Generic loop counters. */
|
||||
int l; /* Marks choice of file in fields array. */
|
||||
int lines_read = 0; /* Counts total number of lines read from the file. */
|
||||
int req_lines = 0; /* Number of lines requested to be displayed. */
|
||||
int i, j; /* Generic loop counters. */
|
||||
int l; /* Marks choice of file in fields array. */
|
||||
char field[MAX_INPUT_LENGTH]; /* Holds users choice of file to be read. */
|
||||
char value[MAX_INPUT_LENGTH]; /* Holds # lines to be read, if requested. */
|
||||
char buf[MAX_STRING_LENGTH]; /* Display buffer for req_file. */
|
||||
|
|
@ -4357,9 +4357,7 @@ ACMD(do_file)
|
|||
/* Must be able to access the file on disk. */
|
||||
if (!(req_file=fopen(fields[l].file,"r"))) {
|
||||
send_to_char(ch, "The file %s can not be opened.\r\n", fields[l].file);
|
||||
mudlog(BRF, LVL_IMPL, TRUE,
|
||||
"SYSERR: Error opening file %s using 'file' command.",
|
||||
fields[l].file);
|
||||
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: Error opening file %s using 'file' command.", fields[l].file);
|
||||
return;
|
||||
}
|
||||
/**/
|
||||
|
|
@ -4389,7 +4387,7 @@ ACMD(do_file)
|
|||
lines_read = file_head( req_file, buf, sizeof(buf), req_lines );
|
||||
}
|
||||
|
||||
/** Since file_head and file_tail will add the overflow message, we
|
||||
/* Since file_head and file_tail will add the overflow message, we
|
||||
* don't check for status here. */
|
||||
if ( lines_read == req_file_lines )
|
||||
{
|
||||
|
|
@ -4580,7 +4578,7 @@ ACMD(do_wizupdate)
|
|||
bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_name)
|
||||
{
|
||||
struct char_data *temp_ch=NULL;
|
||||
int plr_i = 0, i, j, k;
|
||||
int plr_i = 0, i, k;
|
||||
char old_name[MAX_NAME_LENGTH], old_pfile[50], new_pfile[50], buf[MAX_STRING_LENGTH];
|
||||
|
||||
if (!ch)
|
||||
|
|
@ -4603,7 +4601,7 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// Check that someone with new_name isn't already logged in
|
||||
/* Check that someone with new_name isn't already logged in */
|
||||
if ((temp_ch = get_player_vis(ch, new_name, NULL, FIND_CHAR_WORLD)) != NULL) {
|
||||
send_to_char(ch, "Sorry, the new name already exists.\r\n");
|
||||
return FALSE;
|
||||
|
|
@ -4655,7 +4653,6 @@ bool change_player_name(struct char_data *ch, struct char_data *vict, char *new_
|
|||
|
||||
/* Rename the player's pfile */
|
||||
sprintf(buf, "mv %s %s", old_pfile, new_pfile);
|
||||
j = system(buf);
|
||||
|
||||
/* Save the changed player index - the pfile is saved by perform_set */
|
||||
save_player_index();
|
||||
|
|
|
|||
5
src/db.c
5
src/db.c
|
|
@ -172,8 +172,9 @@ char *fread_action(FILE *fl, int nr)
|
|||
|
||||
parse_at(buf);
|
||||
|
||||
/* Some clients interpret '\r' the same as { '\r' '\n' }, so the original way of just
|
||||
replacing '\n' with '\0' would appear as 2 new lines following the action */
|
||||
/* Some clients interpret '\r' the same as { '\r' '\n' }, so the original way
|
||||
* of just replacing '\n' with '\0' would appear as 2 new lines following the
|
||||
* action */
|
||||
for (i = 0; buf[i] != '\0'; i++)
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
buf[i] = '\0';
|
||||
|
|
|
|||
17
src/genolc.c
17
src/genolc.c
|
|
@ -310,12 +310,10 @@ ACMD(do_export_zone)
|
|||
zone_vnum zvnum;
|
||||
char sysbuf[MAX_INPUT_LENGTH];
|
||||
char zone_name[MAX_INPUT_LENGTH], *f;
|
||||
int success, i;
|
||||
int success;
|
||||
|
||||
/* system command locations are relative to
|
||||
* where the binary IS, not where it was run
|
||||
* from, thus we act like we are in the bin
|
||||
* folder, because we are*/
|
||||
/* system command locations are relative to where the binary IS, not where it
|
||||
* was run from, thus we act like we are in the bin folder, because we are*/
|
||||
char *path = "../lib/world/export/";
|
||||
|
||||
if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL)
|
||||
|
|
@ -335,12 +333,10 @@ ACMD(do_export_zone)
|
|||
return;
|
||||
}
|
||||
|
||||
/* If we fail, it might just be because the
|
||||
* directory didn't exist. Can't hurt to try
|
||||
* again. Do it silently though ( no logs ). */
|
||||
/* If we fail, it might just be because the directory didn't exist. Can't
|
||||
* hurt to try again. Do it silently though ( no logs ). */
|
||||
if (!export_info_file(zrnum)) {
|
||||
sprintf(sysbuf, "mkdir %s", path);
|
||||
i = system(sysbuf);
|
||||
}
|
||||
|
||||
if (!(success = export_info_file(zrnum)))
|
||||
|
|
@ -371,15 +367,12 @@ ACMD(do_export_zone)
|
|||
|
||||
/* Remove the old copy. */
|
||||
sprintf(sysbuf, "rm %s%s.tar.gz", path, f);
|
||||
i = system(sysbuf);
|
||||
|
||||
/* Tar the new copy. */
|
||||
sprintf(sysbuf, "tar -cf %s%s.tar %sqq.info %sqq.wld %sqq.zon %sqq.mob %sqq.obj %sqq.trg %sqq.shp", path, f, path, path, path, path, path, path, path);
|
||||
i = system(sysbuf);
|
||||
|
||||
/* Gzip it. */
|
||||
sprintf(sysbuf, "gzip %s%s.tar", path, f);
|
||||
i = system(sysbuf);
|
||||
|
||||
send_to_char(ch, "Files tar'ed to \"%s%s.tar.gz\"\r\n", path, f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ void run_autowiz(void)
|
|||
if (CONFIG_USE_AUTOWIZ) {
|
||||
size_t res;
|
||||
char buf[256];
|
||||
int i;
|
||||
|
||||
#if defined(CIRCLE_UNIX)
|
||||
res = snprintf(buf, sizeof(buf), "nice ../bin/autowiz %d %s %d %s %d &",
|
||||
|
|
@ -211,7 +210,6 @@ void run_autowiz(void)
|
|||
/* Abusing signed -> unsigned conversion to avoid '-1' check. */
|
||||
if (res < sizeof(buf)) {
|
||||
mudlog(CMP, LVL_IMMORT, FALSE, "Initiating autowiz.");
|
||||
i = system(buf);
|
||||
reboot_wizlists();
|
||||
} else
|
||||
log("Cannot run autowiz: command-line doesn't fit in buffer.");
|
||||
|
|
|
|||
|
|
@ -354,10 +354,8 @@ static void sedit_no_trade_menu(struct descriptor_data *d)
|
|||
|
||||
static void sedit_types_menu(struct descriptor_data *d)
|
||||
{
|
||||
struct shop_data *shop;
|
||||
int i, count = 0;
|
||||
|
||||
shop = OLC_SHOP(d);
|
||||
get_char_colors(d->character);
|
||||
|
||||
clear_screen(d);
|
||||
|
|
|
|||
|
|
@ -412,13 +412,12 @@ bool zedit_get_levels(struct descriptor_data *d, char *buf)
|
|||
/* the main menu */
|
||||
static void zedit_disp_menu(struct descriptor_data *d)
|
||||
{
|
||||
int subcmd = 0, room, counter = 0;
|
||||
int subcmd = 0, counter = 0;
|
||||
char buf1[MAX_STRING_LENGTH], lev_string[50];
|
||||
bool levels_set = FALSE;
|
||||
|
||||
get_char_colors(d->character);
|
||||
clear_screen(d);
|
||||
room = real_room(OLC_NUM(d));
|
||||
|
||||
sprintbitarray(OLC_ZONE(d)->zone_flags, zone_bits, ZN_ARRAY_MAX, buf1);
|
||||
levels_set = zedit_get_levels(d, lev_string);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue