» SmaugMuds » Bugfix Lists » AFKMud Bugfix List » AFKMud Bug Archive » [Bug] Ask command has global ...
Pages:<< prev 1 next >>
#1 Dec 3, 2006 1:07 am
Black Hand
GroupAdministrators
Posts3,685
JoinedJan 1, 2002
Bug: Ask command has global scope
Danger: Low - Target for the ask command can be chosen from anywhere in the game.
Discovered in: AFKMud 1.77
Found by: Conner
Fixed by: Samson
---
act_comm.c, do_ask
Locate:
Change to:
Locate:
Replace with:
The ask command is intended to be used to speak directly to one particular target, be they NPC or PC. The command was unnecessarily global in scope, meaning it would pick the intended target from anywhere in the game. It should only have been searching in the room the player was in, and as a result of that, did not need to loop through the occupants either.
Danger: Low - Target for the ask command can be chosen from anywhere in the game.
Discovered in: AFKMud 1.77
Found by: Conner
Fixed by: Samson
---
act_comm.c, do_ask
Locate:
if( ( victim = get_char_world( ch, arg ) ) == NULL || ( IS_NPC( victim ) && victim->in_room != ch->in_room ) ) { send_to_char( "They aren't here.\n\r", ch ); return; }
Change to:
if( ( victim = get_char_room( ch, arg ) ) == NULL || ( IS_NPC( victim ) && victim->in_room != ch->in_room ) ) { send_to_char( "They aren't here.\r\n", ch ); return; }
Locate:
for( vch = ch->in_room->first_person; vch; vch = vch->next_in_room ) { char *sbuf = argument; if( vch == ch ) continue; /* * Check to see if a player on a map is at the same coords as the recipient * don't need to verify the PLR_ONMAP flags here, it's a room occupants check */ if( !is_same_map( ch, vch ) ) continue; /* * Check to see if character is ignoring speaker */ if( is_ignoring( vch, ch ) ) { /* * continue unless speaker is an immortal */ if( !IS_IMMORTAL( ch ) || get_trust( vch ) > get_trust( ch ) ) continue; else ch_printf( vch, "&[ignore]You attempt to ignore %s, but are unable to do so.\n\r", ch->name ); } if( speaking != -1 && ( !IS_NPC( ch ) || ch->speaking ) ) { int speakswell = UMIN( knows_language( vch, ch->speaking, ch ), knows_language( ch, ch->speaking, vch ) ); if( speakswell < 75 ) sbuf = translate( speakswell, argument, lang_names[speaking] ); } sbuf = drunk_speech( sbuf, ch ); MOBtrigger = FALSE; }
Replace with:
char *sbuf = argument; /* * Check to see if a player on a map is at the same coords as the recipient * don't need to verify the PLR_ONMAP flags here, it's a room occupants check */ if( !is_same_map( ch, victim ) ) { send_to_char( "They aren't here.\r\n", ch ); return; } /* * Check to see if character is ignoring speaker */ if( is_ignoring( victim, ch ) ) { if( !IS_IMMORTAL( ch ) || get_trust( victim ) > get_trust( ch ) ) return; else ch_printf( victim, "&[ignore]You attempt to ignore %s, but are unable to do so.\n\r", ch->name ); } if( speaking != -1 && ( !IS_NPC( ch ) || ch->speaking ) ) { int speakswell = UMIN( knows_language( victim, ch->speaking, ch ), knows_language( ch, ch->speaking, victim ) ); if( speakswell < 75 ) sbuf = translate( speakswell, argument, lang_names[speaking] ); } sbuf = drunk_speech( sbuf, ch ); ch->act = actflags; MOBtrigger = FALSE;
The ask command is intended to be used to speak directly to one particular target, be they NPC or PC. The command was unnecessarily global in scope, meaning it would pick the intended target from anywhere in the game. It should only have been searching in the room the player was in, and as a result of that, did not need to loop through the occupants either.
Pages:<< prev 1 next >>