mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-11 02:24:21 +01:00
Major: Backport to rvn 241, with the addition of all previously found bug fixes.
This commit is contained in:
parent
e4cdc51eb1
commit
479dbb6cbd
86 changed files with 3771 additions and 7913 deletions
103
src/comm.c
103
src/comm.c
|
|
@ -163,7 +163,6 @@ static sigfunc *my_signal(int signo, sigfunc *func);
|
|||
static RETSIGTYPE websterlink(int sig);
|
||||
static size_t proc_colors(char *txt, size_t maxlen, int parse);
|
||||
static void handle_webster_file();
|
||||
static void msdp_update(void);
|
||||
|
||||
/* externally defined functions, used locally */
|
||||
#ifdef __CXREF__
|
||||
|
|
@ -467,7 +466,7 @@ void copyover_recover()
|
|||
/* Add to the list of 'recent' players (since last reboot) with copyover flag */
|
||||
if (AddRecentPlayer(GET_NAME(d->character), d->host, FALSE, TRUE) == FALSE)
|
||||
{
|
||||
mudlog(BRF, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE, "Failure to AddRecentPlayer (returned FALSE).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -917,13 +916,13 @@ void game_loop(socket_t local_mother_desc)
|
|||
/* Check for any signals we may have received. */
|
||||
if (reread_wizlist) {
|
||||
reread_wizlist = FALSE;
|
||||
mudlog(CMP, ADMLVL_IMMORT, TRUE, "Signal received - rereading wizlists.");
|
||||
mudlog(CMP, LVL_IMMORT, TRUE, "Signal received - rereading wizlists.");
|
||||
reboot_wizlists();
|
||||
}
|
||||
/* Orphaned right now as signal trapping is used for Webster lookup
|
||||
if (emergency_unban) {
|
||||
emergency_unban = FALSE;
|
||||
mudlog(BRF, ADMLVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)");
|
||||
mudlog(BRF, LVL_IMMORT, TRUE, "Received SIGUSR2 - completely unrestricting game (emergent)");
|
||||
ban_list = NULL;
|
||||
circle_restrict = 0;
|
||||
num_invalid = 0;
|
||||
|
|
@ -966,9 +965,6 @@ void heartbeat(int heart_pulse)
|
|||
if (!(heart_pulse % PULSE_VIOLENCE))
|
||||
perform_violence();
|
||||
|
||||
if (!(heart_pulse % PASSES_PER_SEC))
|
||||
msdp_update();
|
||||
|
||||
if (!(heart_pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC))) { /* Tick ! */
|
||||
next_tick = SECS_PER_MUD_HOUR; /* Reset tick coundown */
|
||||
weather_and_time(1);
|
||||
|
|
@ -1339,12 +1335,6 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
|
|||
return (0);
|
||||
|
||||
wantsize = size = vsnprintf(txt, sizeof(txt), format, args);
|
||||
|
||||
strcpy(txt, ProtocolOutput( t, txt, (int*)&wantsize ));
|
||||
size = wantsize;
|
||||
if ( t->pProtocol->WriteOOB > 0 )
|
||||
--t->pProtocol->WriteOOB;
|
||||
|
||||
if (t->character)
|
||||
wantsize = size = proc_colors(txt, sizeof(txt), COLOR_ON(t->character));
|
||||
/* If exceeding the size of the buffer, truncate it for the overflow message */
|
||||
|
|
@ -1509,7 +1499,6 @@ static void init_descriptor (struct descriptor_data *newd, int desc)
|
|||
if (++last_desc == 1000)
|
||||
last_desc = 1;
|
||||
newd->desc_num = last_desc;
|
||||
newd->pProtocol = ProtocolCreate();
|
||||
}
|
||||
|
||||
static int new_descriptor(socket_t s)
|
||||
|
|
@ -1569,7 +1558,7 @@ static int new_descriptor(socket_t s)
|
|||
/* determine if the site is banned */
|
||||
if (isbanned(newd->host) == BAN_ALL) {
|
||||
CLOSE_SOCKET(desc);
|
||||
mudlog(CMP, ADMLVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host);
|
||||
mudlog(CMP, LVL_GOD, TRUE, "Connection attempt denied from [%s]", newd->host);
|
||||
free(newd);
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -1581,8 +1570,6 @@ static int new_descriptor(socket_t s)
|
|||
newd->next = descriptor_list;
|
||||
descriptor_list = newd;
|
||||
|
||||
ProtocolNegotiate(newd); /* <--- Add this line */
|
||||
|
||||
/* This is where the greetings are actually sent to the new player */
|
||||
/* Adjusted by Jamdog to show color codes on the greetings page */
|
||||
*greet_copy = '\0';
|
||||
|
|
@ -1616,16 +1603,14 @@ static int process_output(struct descriptor_data *t)
|
|||
|
||||
/* add the extra CRLF if the person isn't in compact mode */
|
||||
if (STATE(t) == CON_PLAYING && t->character && !IS_NPC(t->character) && !PRF_FLAGGED(t->character, PRF_COMPACT))
|
||||
if ( !t->pProtocol->WriteOOB )
|
||||
strcat(osb, "\r\n"); /* strcpy: OK (osb:MAX_SOCK_BUF-2 reserves space) */
|
||||
|
||||
/* add a prompt */
|
||||
if ( !t->pProtocol->WriteOOB )
|
||||
strcat(i, make_prompt(t)); /* strcpy: OK (i:MAX_SOCK_BUF reserves space) */
|
||||
|
||||
/* now, send the output. If this is an 'interruption', use the prepended
|
||||
* CRLF, otherwise send the straight output sans CRLF. */
|
||||
if (t->has_prompt && !t->pProtocol->WriteOOB) {
|
||||
if (t->has_prompt) {
|
||||
t->has_prompt = FALSE;
|
||||
result = write_to_descriptor(t->descriptor, i);
|
||||
if (result >= 2)
|
||||
|
|
@ -1875,9 +1860,6 @@ static int process_input(struct descriptor_data *t)
|
|||
size_t space_left;
|
||||
char *ptr, *read_point, *write_point, *nl_pos = NULL;
|
||||
char tmp[MAX_INPUT_LENGTH];
|
||||
|
||||
static char read_buf[PROTOCOL_BUFFER];
|
||||
read_buf[0] = '\0';
|
||||
|
||||
/* first, find the point where we left off reading data */
|
||||
buf_length = strlen(t->inbuf);
|
||||
|
|
@ -1890,14 +1872,7 @@ static int process_input(struct descriptor_data *t)
|
|||
return (-1);
|
||||
}
|
||||
|
||||
bytes_read = perform_socket_read(t->descriptor, read_buf, 2048);
|
||||
|
||||
if ( bytes_read >= 0 )
|
||||
{
|
||||
read_buf[bytes_read] = '\0';
|
||||
ProtocolInput( t, read_buf, bytes_read, t->inbuf );
|
||||
bytes_read = strlen(t->inbuf);
|
||||
}
|
||||
bytes_read = perform_socket_read(t->descriptor, read_point, space_left);
|
||||
|
||||
if (bytes_read < 0) /* Error, disconnect them. */
|
||||
return (-1);
|
||||
|
|
@ -2122,13 +2097,13 @@ void close_socket(struct descriptor_data *d)
|
|||
/* We are guaranteed to have a person. */
|
||||
act("$n has lost $s link.", TRUE, link_challenged, 0, 0, TO_ROOM);
|
||||
save_char(link_challenged);
|
||||
mudlog(NRM, MAX(ADMLVL_IMMORT, GET_INVIS_LEV(link_challenged)), TRUE, "Closing link to: %s.", GET_NAME(link_challenged));
|
||||
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(link_challenged)), TRUE, "Closing link to: %s.", GET_NAME(link_challenged));
|
||||
} else {
|
||||
mudlog(CMP, ADMLVL_IMMORT, TRUE, "Losing player: %s.", GET_NAME(d->character) ? GET_NAME(d->character) : "<null>");
|
||||
mudlog(CMP, LVL_IMMORT, TRUE, "Losing player: %s.", GET_NAME(d->character) ? GET_NAME(d->character) : "<null>");
|
||||
free_char(d->character);
|
||||
}
|
||||
} else
|
||||
mudlog(CMP, ADMLVL_IMMORT, TRUE, "Losing descriptor without char.");
|
||||
mudlog(CMP, LVL_IMMORT, TRUE, "Losing descriptor without char.");
|
||||
|
||||
/* JE 2/22/95 -- part of my unending quest to make switch stable */
|
||||
if (d->original && d->original->desc)
|
||||
|
|
@ -2148,8 +2123,6 @@ void close_socket(struct descriptor_data *d)
|
|||
if (d->showstr_count)
|
||||
free(d->showstr_vector);
|
||||
|
||||
ProtocolDestroy( d->pProtocol );
|
||||
|
||||
/*. Kill any OLC stuff .*/
|
||||
switch (d->connected) {
|
||||
case CON_OEDIT:
|
||||
|
|
@ -2821,61 +2794,3 @@ static void handle_webster_file(void) {
|
|||
send_to_char(ch, "You get this feedback from Merriam-Webster:\r\n");
|
||||
page_string(ch->desc, retval, 1);
|
||||
}
|
||||
|
||||
static void msdp_update( void )
|
||||
{
|
||||
struct descriptor_data *d;
|
||||
int PlayerCount = 0;
|
||||
|
||||
for (d = descriptor_list; d; d = d->next)
|
||||
{
|
||||
struct char_data *ch = d->character;
|
||||
if ( ch && !IS_NPC(ch) && d->connected == CON_PLAYING )
|
||||
{
|
||||
struct char_data *pOpponent = FIGHTING(ch);
|
||||
++PlayerCount;
|
||||
|
||||
MSDPSetString( d, eMSDP_CHARACTER_NAME, GET_NAME(ch) );
|
||||
MSDPSetNumber( d, eMSDP_ALIGNMENT, GET_ALIGNMENT(ch) );
|
||||
MSDPSetNumber( d, eMSDP_EXPERIENCE, GET_EXP(ch) );
|
||||
|
||||
MSDPSetNumber( d, eMSDP_HEALTH, GET_HIT(ch) );
|
||||
MSDPSetNumber( d, eMSDP_HEALTH_MAX, GET_MAX_HIT(ch) );
|
||||
MSDPSetNumber( d, eMSDP_LEVEL, GET_LEVEL(ch) );
|
||||
|
||||
MSDPSetNumber( d, eMSDP_CLASS, GET_CLASS(ch) );
|
||||
|
||||
MSDPSetNumber( d, eMSDP_MANA, GET_MANA(ch) );
|
||||
MSDPSetNumber( d, eMSDP_MANA_MAX, GET_MAX_MANA(ch) );
|
||||
MSDPSetNumber( d, eMSDP_WIMPY, GET_WIMP_LEV(ch) );
|
||||
MSDPSetNumber( d, eMSDP_MONEY, GET_GOLD(ch) );
|
||||
MSDPSetNumber( d, eMSDP_MOVEMENT, GET_MOVE(ch) );
|
||||
MSDPSetNumber( d, eMSDP_MOVEMENT_MAX, GET_MAX_MOVE(ch) );
|
||||
MSDPSetNumber( d, eMSDP_AC, compute_armor_class(ch) );
|
||||
|
||||
/* This would be better moved elsewhere */
|
||||
if ( pOpponent != NULL )
|
||||
{
|
||||
int hit_points = (GET_HIT(pOpponent) * 100) / GET_MAX_HIT(pOpponent);
|
||||
MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH, hit_points );
|
||||
MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH_MAX, 100 );
|
||||
MSDPSetNumber( d, eMSDP_OPPONENT_LEVEL, GET_LEVEL(pOpponent) );
|
||||
MSDPSetString( d, eMSDP_OPPONENT_NAME, PERS(pOpponent, ch) );
|
||||
}
|
||||
else /* Clear the values */
|
||||
{
|
||||
MSDPSetNumber( d, eMSDP_OPPONENT_HEALTH, 0 );
|
||||
MSDPSetNumber( d, eMSDP_OPPONENT_LEVEL, 0 );
|
||||
MSDPSetString( d, eMSDP_OPPONENT_NAME, "" );
|
||||
}
|
||||
|
||||
MSDPUpdate( d );
|
||||
}
|
||||
|
||||
/* Ideally this should be called once at startup, and again whenever
|
||||
* someone leaves or joins the mud. But this works, and it keeps the
|
||||
* snippet simple. Optimise as you see fit.
|
||||
*/
|
||||
MSSPSetPlayers( PlayerCount );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue