[May 04 2008] - Rumble

Fixed numerous warnings for gcc -g -O2 -W -Wshadow -Wcast-qual flags.
  Fixed zpurge mudlog to use zone vnum not rnum. (thanks Jamdog)
  Fix to parse_mobile conversion to 128 bits. (thanks Jamdog)
  Changed autorun.sh from 9091 to 4000. (thanks John Smith)
[Apr 27 2008] - Rumble
  Removed some defunct gemote code. (thanks Fizban)
[Apr 26 2008] - Rumble
  Added README.BSD. (thanks Blix)
  Cleaned up act.comm.c, mobs can now use comm channels. (thanks Rhade)
This commit is contained in:
Rumble 2008-05-04 21:49:11 +00:00
parent 84bd1766b2
commit 33e6a8c41b
9 changed files with 169 additions and 35 deletions

View file

@ -1639,7 +1639,7 @@ ACMD(do_where)
ACMD(do_levels)
{
char buf[MAX_STRING_LENGTH], arg[MAX_STRING_LENGTH];
size_t len = 0, nlen;
size_t len = 0, nlen;
int i, ret, min_lev=1, max_lev=LVL_IMMORT, val;
if (IS_NPC(ch)) {

View file

@ -2458,7 +2458,7 @@ ACMD(do_show)
continue;
}
nlen = print_zone_to_buf(buf + len, sizeof(buf) - len, zrn, 0);
if (len + nlen >= sizeof(buf) || nlen < 0)
if (len + nlen >= sizeof(buf))
break;
len += nlen;
}
@ -2553,13 +2553,13 @@ ACMD(do_show)
continue;
if (W_EXIT(i,j)->to_room == 0) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (void ) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), count_color_chars(world[i].name)+40, world[i].name, QNRM, dirs[j]);
if (len + nlen >= sizeof(buf) || nlen < 0)
if (len + nlen >= sizeof(buf))
break;
len += nlen;
}
if (W_EXIT(i,j)->to_room == NOWHERE && !W_EXIT(i,j)->general_description) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: (Nowhere) [%5d] %-*s%s (%s)\r\n", ++k, GET_ROOM_VNUM(i), count_color_chars(world[i].name)+ 40, world[i].name, QNRM, dirs[j]);
if (len + nlen >= sizeof(buf) || nlen < 0)
if (len + nlen >= sizeof(buf))
break;
len += nlen;
}
@ -2573,7 +2573,7 @@ ACMD(do_show)
for (i = 0, j = 0; i <= top_of_world; i++)
if (ROOM_FLAGGED(i, ROOM_DEATH)) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, QNRM);
if (len + nlen >= sizeof(buf) || nlen < 0)
if (len + nlen >= sizeof(buf))
break;
len += nlen;
}
@ -2586,7 +2586,7 @@ ACMD(do_show)
for (i = 0, j = 0; i <= top_of_world; i++)
if (ROOM_FLAGGED(i, ROOM_GODROOM)) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%2d: [%5d] %s%s\r\n", ++j, GET_ROOM_VNUM(i), world[i].name, QNRM);
if (len + nlen >= sizeof(buf) || nlen < 0)
if (len + nlen >= sizeof(buf))
break;
len += nlen;
}
@ -4050,7 +4050,7 @@ ACMD(do_zpurge)
purge_room(real_room(vroom));
}
send_to_char(ch, "Purged zone #%d: %s.\r\n", zone_table[zone].number, zone_table[zone].name);
mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged zone %d (%s)", GET_NAME(ch), zone, zone_table[zone].name);
mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged zone %d (%s)", GET_NAME(ch), zone_table[zone].number, zone_table[zone].name);
}
else {
for (room = 0; room <= top_of_world; room++) {

View file

@ -232,7 +232,7 @@ static void MapArea(room_rnum room, struct char_data *ch, int x, int y, int min,
continue;
}
if ( (pexit = world[room].dir_option[door]) > 0 &&
if ( (pexit = world[room].dir_option[door]) != NULL &&
(pexit->to_room > 0 ) && (pexit->to_room != NOWHERE) &&
(!IS_SET(pexit->exit_info, EX_CLOSED))) { /* A real exit */

View file

@ -462,7 +462,7 @@ void copyover_recover()
}
/* Init sockets, run game, and cleanup sockets */
static void init_game(ush_int port)
static void init_game(ush_int local_port)
{
/* We don't want to restart if we crash before we get up. */
touch(KILLSCRIPT_FILE);
@ -475,7 +475,7 @@ static void init_game(ush_int port)
/* If copyover mother_desc is already set up */
if (!fCopyOver) {
log ("Opening mother connection.");
mother_desc = init_socket (port);
mother_desc = init_socket (local_port);
}
event_init();
@ -523,7 +523,7 @@ static void init_game(ush_int port)
/* init_socket sets up the mother descriptor - creates the socket, sets
* its options up, binds it, and listens. */
static socket_t init_socket(ush_int port)
static socket_t init_socket(ush_int local_port)
{
socket_t s;
struct sockaddr_in sa;
@ -598,7 +598,7 @@ static socket_t init_socket(ush_int port)
memset((char *)&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(port);
sa.sin_port = htons(local_port);
sa.sin_addr = *(get_bind_addr());
if (bind(s, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
@ -694,7 +694,7 @@ static int get_max_players(void)
* new connections, polling existing connections for input, dequeueing
* output and sending it out to players, and calling "heartbeat" functions
* such as mobile_activity(). */
void game_loop(socket_t mother_desc)
void game_loop(socket_t local_mother_desc)
{
fd_set input_set, output_set, exc_set, null_set;
struct timeval last_time, opt_time, process_time, temp_time;
@ -719,8 +719,8 @@ void game_loop(socket_t mother_desc)
if (descriptor_list == NULL) {
log("No connections. Going to sleep.");
FD_ZERO(&input_set);
FD_SET(mother_desc, &input_set);
if (select(mother_desc + 1, &input_set, (fd_set *) 0, (fd_set *) 0, NULL) < 0) {
FD_SET(local_mother_desc, &input_set);
if (select(local_mother_desc + 1, &input_set, (fd_set *) 0, (fd_set *) 0, NULL) < 0) {
if (errno == EINTR)
log("Waking up to process signal.");
else
@ -733,9 +733,9 @@ void game_loop(socket_t mother_desc)
FD_ZERO(&input_set);
FD_ZERO(&output_set);
FD_ZERO(&exc_set);
FD_SET(mother_desc, &input_set);
FD_SET(local_mother_desc, &input_set);
maxdesc = mother_desc;
maxdesc = local_mother_desc;
for (d = descriptor_list; d; d = d->next) {
#ifndef CIRCLE_WINDOWS
if (d->descriptor > maxdesc)
@ -786,8 +786,8 @@ void game_loop(socket_t mother_desc)
return;
}
/* If there are new connections waiting, accept them. */
if (FD_ISSET(mother_desc, &input_set))
new_descriptor(mother_desc);
if (FD_ISSET(local_mother_desc, &input_set))
new_descriptor(local_mother_desc);
/* Kick out the freaky folks in the exception set and marked for close */
for (d = descriptor_list; d; d = next_d) {
@ -1070,7 +1070,7 @@ void echo_on(struct descriptor_data *d)
/* Color replacement arrays. Renx -- 011100 */
#define A "\x1B["
const char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0;31m",
char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0;31m",
A"0;35m",A"0;33m",A"0;37m",A"1;30m",A"1;34m",A"1;32m",A"1;36m",A"1;31m",
A"1;35m",A"1;33m",A"1;37m",A"40m",A"44m",A"42m",A"46m",A"41m",A"45m",
A"43m",A"47m",A"5m",A"4m",A"1m",A"7m"
@ -1090,7 +1090,7 @@ static size_t proc_colors(char *txt, size_t maxlen, int parse)
CREATE(d, char, maxlen);
p = d;
for( ; *s && (d-p < maxlen); ) {
for( ; *s && ((size_t)(d-p) < maxlen); ) {
/* no color code - just copy */
if (*s != '@') {
*d++ = *s++;
@ -1119,7 +1119,7 @@ static size_t proc_colors(char *txt, size_t maxlen, int parse)
if ((*s) == CCODE[i]) { /* if so :*/
/* c now points to the first char in color code*/
for(c = (char *)ANSI[i] ; *c && (d-p < maxlen); )
for(c = ANSI[i] ; *c && ((size_t)(d-p) < maxlen); )
*d++ = *c++;
break;
@ -2696,7 +2696,7 @@ static void circle_sleep(struct timeval *timeout)
static void handle_webster_file(void) {
FILE *fl;
struct char_data *ch = find_char(last_webster_teller);
char info[MAX_STRING_LENGTH], line[READ_SIZE];
char retval[MAX_STRING_LENGTH], line[READ_SIZE];
size_t len = 0, nlen = 0;
last_webster_teller = -1L;
@ -2706,7 +2706,7 @@ static void handle_webster_file(void) {
fl = fopen("websterinfo", "r");
if (!fl) {
send_to_char(ch, "It seems Merriam-Webster is offline..\r\n");
send_to_char(ch, "It seems the dictionary is offline..\r\n");
return;
}
@ -2714,19 +2714,19 @@ static void handle_webster_file(void) {
get_line(fl, line);
while (!feof(fl)) {
nlen = snprintf(info + len, sizeof(info) - len, "%s\r\n", line);
if (len + nlen >= sizeof(info) || nlen < 0)
nlen = snprintf(retval + len, sizeof(retval) - len, "%s\r\n", line);
if (len + nlen >= sizeof(retval))
break;
len += nlen;
get_line(fl, line);
}
if (len >= sizeof(info)) {
if (len >= sizeof(retval)) {
const char *overflow = "\r\n**OVERFLOW**\r\n";
strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */
strcpy(retval + sizeof(retval) - strlen(overflow) - 1, overflow); /* strcpy: OK */
}
fclose(fl);
send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n");
page_string(ch->desc, info, 1);
page_string(ch->desc, retval, 1);
}

View file

@ -1634,7 +1634,7 @@ void parse_mobile(FILE *mob_f, int nr)
exit(1);
}
if (((retval = sscanf(line, "%s %s %s %s %s %s %s %s %d %c", f1, f2, f3, f4, f5, f6, f7, f8, t + 2, &letter)) == 10) && (bitwarning == TRUE)) {
if (((retval = sscanf(line, "%s %s %s %s %s %s %s %s %d %c", f1, f2, f3, f4, f5, f6, f7, f8, t + 2, &letter)) != 10) && (bitwarning == TRUE)) {
/* Let's make the implementor read some, before converting his world files. */
log("WARNING: Conventional mobile files detected. See config.c.");
exit(1);