/* Set this to the IP address you want to listen on (127.0.0.1 is good for */
/* paranoid types who don't want the 'net at large peeking at their MUD)*/
char *mud_ipaddress = "0.0.0.0";
Mon Nov 30 16:39:38 2009 :: boot_db() - wrote exodus.pid
Mon Nov 30 16:39:38 2009 :: Exodus is ready to rock on port 4000.
#0 0x7c8106f9 in KERNEL32!CreateThread ()
from /cygdrive/c/WINDOWS/system32/kernel32.dll
Cannot access memory at address 0x3
#if defined(unix)
void game_loop_unix (int control, int whosock, int areasock) {
struct timeval last_time;
fd_set in_set, out_set; /* , exc_set; */
DESCRIPTOR_DATA *d;
/* int maxdesc; */
signal (SIGPIPE, SIG_IGN);
gettimeofday (&last_time, NULL);
current_time = (time_t) last_time.tv_sec;
while (!merc_down) {
FD_ZERO (&in_set);
FD_ZERO (&out_set);
/* FD_ZERO(&exc_set); */
FD_SET (control, &in_set);
if (whosock != -1)
FD_SET (whosock, &in_set);
if (areasock != -1)
FD_SET (areasock, &in_set);
/* maxdesc = control; */
for (d = descriptor_list; d; d = d->next) {
/* maxdesc = UMAX(maxdesc, d->descriptor); */
FD_SET (d->descriptor, &in_set);
FD_SET (d->descriptor, &out_set);
/* FD_SET(d->descriptor, &exc_set); */
}
if (select (fdsize, &in_set, &out_set, NULL, NULL) < 0) {
perror ("Game_loop: select: poll");
exit (1);
}
/*
* New connection?
*/
if (FD_ISSET (control, &in_set))
init_descriptor (control);
if (whosock != -1)
if (FD_ISSET (whosock, &in_set))
dump_who (whosock);
if (areasock != -1)
if (FD_ISSET (areasock, &in_set))
dump_areas (areasock);
/*
for (d = descriptor_list; d != NULL; d = d_next)
{
d_next = d->next;
if (FD_ISSET(d->descriptor, &exc_set))
{
FD_CLR(d->descriptor, &in_set);
FD_CLR(d->descriptor, &out_set);
if (d->character && d->character->level > 1)
save_char_obj(d->character);
d->outtop = 0;
close_socket(d);
}
} */
/*
* Process input.
*/
for (d = descriptor_list; d != NULL; d = d_next) {
isorder = FALSE;
d_next = d->next;
d->fcommand = FALSE;
if (FD_ISSET (d->descriptor, &in_set)) {
if (d->character != NULL)
d->character->timer = 0;
if (!read_from_descriptor (d)) {
FD_CLR (d->descriptor, &out_set);
if (d->character != NULL && d->character->level > 1)
save_char_obj (d->character);
d->outtop = 0;
close_socket (d);
continue;
}
}
if (d->character != NULL && d->character->daze > 0)
–d->character->daze;
if (d->character != NULL && d->character->wait > 0) {
–d->character->wait;
continue;
}
read_from_buffer (d);
if (d->incomm[0] != '\0') {
d->fcommand = TRUE;
keepincomm = FALSE;
stop_idling (d->character);
if (d->connected == CON_START_MULTICLASS
|| d->connected == CON_FINISH_MULTICLASS)
multiclass (d, d->incomm);
else if (d->showstr_point)
show_string (d, d->incomm);
else if (d->pString && d->editor == EDIT_MENU)
edit_menu (d->character, d->incomm);
else if (d->pString && d->editor == SEARCH_REPLACE)
search_replace (d->character, d->incomm);
else if (d->pString && d->editor == EDIT_LINE_NUMBER)
edit_line_number (d->character, d->incomm);
else if (d->pString && d->editor == INSERT_LINE_NUMBER)
insert_line_number (d->character, d->incomm);
else if (d->pString && d->editor == DELE_LINE_NUMBER)
dele_line_number (d->character, d->incomm);
else if (d->pString && d->editor == EDIT_NEW_LINE)
edit_new_line (d->character, d->incomm);
else if (d->pString && d->editor == INSERT_NEW_LINE)
insert_new_line (d->character, d->incomm);
else if (d->pString)
string_add (d->character, d->incomm);
/* else if (d->character && d->character->pcdata && d->character->pcdata->cg_state >= CG_START_PM_YT && d->character->pcdata->cg_state <= CG_NYT_D_PM)
cardgame_menu (d->character, d->incomm);*/
else if (d->connected == CON_PLAYING) {
if (!run_olc_editor (d)) {
char mybuf[MAX_STRING_LENGTH];
char *cptr, *cptr2;
bool found, docmd = TRUE;
char *cptr3;
char mycmd[MAX_STRING_LENGTH],
bufcmd[MAX_STRING_LENGTH];
int cmd;
strcpy (mybuf, d->incomm);
cptr = mybuf;
while ((cptr2 = strchr (cptr, ';')) != NULL) {
strcpy (bufcmd, cptr2 + 1);
cptr3 = bufcmd;
while (*cptr3 != '\0') {
if (isalpha (*cptr3))
break;
cptr3++;
}
strcpy (mycmd, cptr3);
cptr3 = mycmd;
while (*cptr3 != '\0') {
if (isspace (*cptr3)) {
*cptr3 = '\0';
break;
}
cptr3++;
}
found = FALSE;
for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++) {
if (mycmd[0] == cmd_table[cmd].name[0]
&& !str_prefix (mycmd,
cmd_table[cmd].name)
&& (cmd_table[cmd].level <=
d->character->
trust || cmd_table[cmd].level <=
d->character->level)) {
found = TRUE;
break;
}
}
if (!found)
for (cmd = 0;
social_table[cmd].name[0] != '\0'; cmd++) {
if (mycmd[0] ==
social_table[cmd].
name[0] && !str_prefix (mycmd,
social_table
[cmd].name)) {
found = TRUE;
break;
}
}
if (found) {
*cptr2 = '\0';
substitute_alias (d, cptr);
docmd = FALSE;
keepincomm = TRUE;
strcpy (d->incomm, cptr2 + 1);
break;
} else
*cptr2 = 7;
}
if (docmd)
substitute_alias (d, d->incomm);
}
} else {
nanny (d, d->incomm);
}
if (!keepincomm)
d->incomm[0] = '\0';
}
}
update_handler ();
for (d = descriptor_list; d != NULL; d = d_next) {
d_next = d->next;
if ((d->fcommand || d->outtop > 0)
&& FD_ISSET (d->descriptor, &out_set)) {
if (!process_output (d, TRUE)) {
if (d->character != NULL && d->character->level > 1) {
save_char_obj (d->character);
}
d->outtop = 0;
close_socket (d);
}
}
}
/*
* Synchronize to a clock.
* Sleep( last_time + 1/PULSE_PER_SECOND - now ).
* Careful here of signed versus unsigned arithmetic.
*/
{
struct timeval now_time;
long secDelta;
long usecDelta;
gettimeofday (&now_time, NULL);
usecDelta =
((int) last_time.tv_usec) -
((int) now_time.tv_usec) + 1000000 / PULSE_PER_SECOND;
secDelta = ((int) last_time.tv_sec) - ((int) now_time.tv_sec);
while (usecDelta < 0) {
usecDelta += 1000000;
secDelta -= 1;
}
while (usecDelta >= 1000000) {
usecDelta -= 1000000;
secDelta += 1;
}
if (secDelta > 0 || (secDelta == 0 && usecDelta > 0)) {
struct timeval stall_time;
stall_time.tv_usec = usecDelta;
stall_time.tv_sec = secDelta;
if (select (0, NULL, NULL, NULL, &stall_time) < 0) {
perror ("Game_loop: select: stall");
//exit (1);
}
}
}
gettimeofday (&last_time, NULL);
current_time = (time_t) last_time.tv_sec;
}
return;
}
#endif /* */
I am wondering how to handle this situation. Before me I have a heavily modified ROM that has many hands touching both stable and drunk since 1996. It's a beautiful M.U.D. with a codebase that looks like a tornado went through the code. How does one clean this up? Do I even bother trying as most the code is poorly commented. Or would it be easier to simply just grab a stock ROM codebase and start re-adding features back into it? I'm not the greatest programmer in the world, but I should be able to get something done.
I do know, I use cygwin to work on things at home on my computer before uploading them to a live server for actual use. The M.U.D. compiles on cygwin, and boots in either gdb or using the startup script. (Can't seem to get the perl start to work) However, nothing happens, it boots it says its ready to rock on port ####, but after that nothing. It acts like it isn't handling connections correctly. I am assuming the issue would be in game_loop_unix? But I'm not quite sure.
– Elervan