#include "copyright.h"
Include dependency graph for match.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | match_state |
Defines | |
#define | MAT_NO_EXITS 1 |
#define | MAT_EXIT_PARENTS 2 |
#define | MAT_NUMERIC 4 |
#define | MAT_HOME 8 |
Typedefs | |
typedef match_state | MSTATE |
Functions | |
void | init_match (dbref, const char *, int) |
void | init_match_check_keys (dbref, const char *, int) |
void | match_player (void) |
void | match_absolute (void) |
void | match_me (void) |
void | match_here (void) |
void | match_possession (void) |
void | match_neighbor (void) |
void | match_exit (void) |
void | match_exit_with_parents (void) |
void | match_carried_exit (void) |
void | match_carried_exit_with_parents (void) |
void | match_master_exit (void) |
void | match_everything (int) |
dbref | match_result (void) |
dbref | last_match_result (void) |
dbref | match_status (dbref, dbref) |
dbref | noisy_match_result (void) |
void | save_match_state (MSTATE *) |
void | restore_match_state (MSTATE *) |
void | match_zone_exit (void) |
dbref | match_thing (dbref player, char *name) |
dbref | match_thing_quiet (dbref player, char *name) |
void | safe_match_result (dbref it, char *buff, char **bufc) |
#define MAT_EXIT_PARENTS 2 |
Definition at line 58 of file match.h.
Referenced by do_decomp(), do_entrances(), do_examine(), do_lock(), do_setattr(), do_verb(), FUNCTION(), match_controlled_handler(), match_everything(), match_thing(), match_thing_quiet(), parse_attrib_wild(), parse_boolexp_L(), and parse_thing_slash().
#define MAT_HOME 8 |
#define MAT_NO_EXITS 1 |
Definition at line 57 of file match.h.
Referenced by do_link(), match_everything(), and parse_linkable_room().
#define MAT_NUMERIC 4 |
typedef struct match_state MSTATE |
void init_match | ( | dbref | , | |
const char * | , | |||
int | ||||
) |
Definition at line 603 of file match.cpp.
References match_state::absolute_form, absolute_name(), match_state::check_keys, match_state::confidence, match_state::count, match_state::match, md, munge_space_for_match(), NOTHING, match_state::player, match_state::pref_type, and match_state::string.
Referenced by do_boot(), do_chopen(), do_chown(), do_chownall(), do_chzone(), do_clone(), do_decomp(), do_destroy(), do_drop(), do_enter(), do_entrances(), do_examine(), do_fixdb(), do_give(), do_kill(), do_link(), do_lock(), do_look(), do_mail_debug(), do_mail_stats(), do_notify(), do_parent(), do_pemit_single(), do_setattr(), do_teleport(), do_teleport_single(), do_toad(), do_unlink(), do_use(), do_verb(), do_wait(), FUNCTION(), give_thing(), init_match_check_keys(), match_controlled_handler(), match_possessed(), match_thing(), match_thing_quiet(), parse_attrib_wild(), parse_boolexp_L(), parse_linkable_room(), and parse_thing_slash().
00604 { 00605 md.confidence = -1; 00606 md.count = 0; 00607 md.check_keys = false; 00608 md.pref_type = type; 00609 md.match = NOTHING; 00610 md.player = player; 00611 md.string = munge_space_for_match((char *)name); 00612 md.absolute_form = absolute_name(true); 00613 }
void init_match_check_keys | ( | dbref | , | |
const char * | , | |||
int | ||||
) |
Definition at line 615 of file match.cpp.
References match_state::check_keys, init_match(), and md.
Referenced by do_get(), do_move(), FUNCTION(), and process_command().
00616 { 00617 init_match(player, name, type); 00618 md.check_keys = true; 00619 }
dbref last_match_result | ( | void | ) |
Definition at line 548 of file match.cpp.
References match_state::match, and md.
Referenced by do_destroy(), FUNCTION(), and process_command().
void match_absolute | ( | void | ) |
Definition at line 202 of file match.cpp.
References match_state::absolute_form, CON_DBREF, match_state::confidence, Good_obj, md, and promote_match().
Referenced by do_boot(), do_chown(), do_chownall(), do_enter(), do_get(), do_give(), do_kill(), do_look(), do_mail_debug(), do_mail_stats(), do_toad(), do_use(), FUNCTION(), and match_everything().
00203 { 00204 if (md.confidence >= CON_DBREF) 00205 { 00206 return; 00207 } 00208 if (Good_obj(md.absolute_form)) 00209 { 00210 promote_match(md.absolute_form, CON_DBREF); 00211 } 00212 }
void match_carried_exit | ( | void | ) |
Definition at line 429 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Good_obj, Has_exits, match_exit_internal(), md, and match_state::player.
Referenced by do_drop(), and match_everything().
00430 { 00431 if (md.confidence >= CON_DBREF) 00432 { 00433 return; 00434 } 00435 if ( Good_obj(md.player) 00436 && Has_exits(md.player)) 00437 { 00438 (void)match_exit_internal(md.player, md.player, CON_LOCAL); 00439 } 00440 }
void match_carried_exit_with_parents | ( | void | ) |
Definition at line 442 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Good_obj, Has_exits, ITER_PARENTS, match_exit_internal(), md, and match_state::player.
Referenced by FUNCTION(), and match_everything().
00443 { 00444 if (md.confidence >= CON_DBREF) 00445 { 00446 return; 00447 } 00448 if ( Good_obj(md.player) 00449 && Has_exits(md.player)) 00450 { 00451 dbref parent; 00452 int lev; 00453 ITER_PARENTS(md.player, parent, lev) 00454 { 00455 if (match_exit_internal(parent, md.player, CON_LOCAL)) 00456 { 00457 break; 00458 } 00459 } 00460 } 00461 }
void match_everything | ( | int | ) |
Definition at line 489 of file match.cpp.
References CON_TOKEN, match_state::confidence, MAT_EXIT_PARENTS, MAT_HOME, MAT_NO_EXITS, MAT_NUMERIC, match_absolute(), match_carried_exit(), match_carried_exit_with_parents(), match_exit(), match_exit_with_parents(), match_here(), match_home(), match_me(), match_neighbor(), match_numeric(), match_player(), match_possession(), and md.
Referenced by do_chopen(), do_chzone(), do_clone(), do_decomp(), do_entrances(), do_examine(), do_fixdb(), do_link(), do_lock(), do_notify(), do_parent(), do_pemit_single(), do_setattr(), do_teleport(), do_teleport_single(), do_unlink(), do_verb(), do_wait(), FUNCTION(), match_controlled_handler(), match_thing(), match_thing_quiet(), parse_attrib_wild(), parse_boolexp_L(), parse_linkable_room(), and parse_thing_slash().
00490 { 00491 /* 00492 * Try matching me, then here, then absolute, then player FIRST, since 00493 * this will hit most cases. STOP if we get something, since those are 00494 * exact matches. 00495 */ 00496 00497 match_me(); 00498 match_here(); 00499 match_absolute(); 00500 if (key & MAT_NUMERIC) 00501 { 00502 match_numeric(); 00503 } 00504 if (key & MAT_HOME) 00505 { 00506 match_home(); 00507 } 00508 match_player(); 00509 if (md.confidence >= CON_TOKEN) 00510 { 00511 return; 00512 } 00513 00514 if (!(key & MAT_NO_EXITS)) 00515 { 00516 if (key & MAT_EXIT_PARENTS) 00517 { 00518 match_carried_exit_with_parents(); 00519 match_exit_with_parents(); 00520 } 00521 else 00522 { 00523 match_carried_exit(); 00524 match_exit(); 00525 } 00526 } 00527 match_neighbor(); 00528 match_possession(); 00529 }
void match_exit | ( | void | ) |
Definition at line 392 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Good_obj, Has_location, Location, match_exit_internal(), md, and match_state::player.
Referenced by do_chown(), do_destroy(), do_get(), do_move(), and match_everything().
00393 { 00394 if (md.confidence >= CON_DBREF) 00395 { 00396 return; 00397 } 00398 00399 dbref loc = Location(md.player); 00400 if ( Good_obj(md.player) 00401 && Has_location(md.player)) 00402 { 00403 (void)match_exit_internal(loc, loc, CON_LOCAL); 00404 } 00405 }
void match_exit_with_parents | ( | void | ) |
Definition at line 407 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Good_obj, Has_location, ITER_PARENTS, Location, match_exit_internal(), md, and match_state::player.
Referenced by do_look(), FUNCTION(), match_everything(), and process_command().
00408 { 00409 if (md.confidence >= CON_DBREF) 00410 { 00411 return; 00412 } 00413 if ( Good_obj(md.player) 00414 && Has_location(md.player)) 00415 { 00416 dbref parent; 00417 int lev; 00418 dbref loc = Location(md.player); 00419 ITER_PARENTS(loc, parent, lev) 00420 { 00421 if (match_exit_internal(parent, loc, CON_LOCAL)) 00422 { 00423 break; 00424 } 00425 } 00426 } 00427 }
void match_here | ( | void | ) |
Definition at line 259 of file match.cpp.
References match_state::absolute_form, CON_COMPLETE, CON_DBREF, CON_LOCAL, CON_TOKEN, match_state::confidence, Good_obj, Has_location, Location, md, match_state::player, promote_match(), PureName(), match_state::string, and string_compare().
Referenced by do_chown(), do_kill(), do_look(), do_use(), FUNCTION(), and match_everything().
00260 { 00261 if (md.confidence >= CON_DBREF) 00262 { 00263 return; 00264 } 00265 if ( Good_obj(md.player) 00266 && Has_location(md.player)) 00267 { 00268 dbref loc = Location(md.player); 00269 if (Good_obj(loc)) 00270 { 00271 if (loc == md.absolute_form) 00272 { 00273 promote_match(loc, CON_DBREF | CON_LOCAL); 00274 } 00275 else if (!string_compare(md.string, "here")) 00276 { 00277 promote_match(loc, CON_TOKEN | CON_LOCAL); 00278 } 00279 else if (!string_compare(md.string, PureName(loc))) 00280 { 00281 promote_match(loc, CON_COMPLETE | CON_LOCAL); 00282 } 00283 } 00284 } 00285 }
void match_master_exit | ( | void | ) |
Definition at line 463 of file match.cpp.
References CON_DBREF, match_state::confidence, Good_obj, Has_exits, confdata::master_room, match_exit_internal(), md, mudconf, and match_state::player.
Referenced by do_look(), and process_command().
00464 { 00465 if (md.confidence >= CON_DBREF) 00466 { 00467 return; 00468 } 00469 if ( Good_obj(md.player) 00470 && Has_exits(md.player)) 00471 { 00472 (void)match_exit_internal(mudconf.master_room, mudconf.master_room, 0); 00473 } 00474 }
void match_me | ( | void | ) |
Definition at line 227 of file match.cpp.
References match_state::absolute_form, CON_DBREF, CON_LOCAL, CON_TOKEN, match_state::confidence, Good_obj, md, match_state::player, promote_match(), match_state::string, and string_compare().
Referenced by do_chown(), do_give(), do_kill(), do_look(), do_use(), FUNCTION(), give_thing(), and match_everything().
00228 { 00229 if (md.confidence >= CON_DBREF) 00230 { 00231 return; 00232 } 00233 if ( Good_obj(md.absolute_form) 00234 && md.absolute_form == md.player) 00235 { 00236 promote_match(md.player, CON_DBREF | CON_LOCAL); 00237 return; 00238 } 00239 if (!string_compare(md.string, "me")) 00240 { 00241 promote_match(md.player, CON_TOKEN | CON_LOCAL); 00242 } 00243 return; 00244 }
void match_neighbor | ( | void | ) |
Definition at line 331 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Contents, Good_obj, Has_location, Location, match_list(), md, and match_state::player.
Referenced by do_boot(), do_chownall(), do_enter(), do_get(), do_give(), do_kill(), do_look(), do_toad(), do_use(), FUNCTION(), match_everything(), and match_possessed().
00332 { 00333 if (md.confidence >= CON_DBREF) 00334 { 00335 return; 00336 } 00337 if ( Good_obj(md.player) 00338 && Has_location(md.player)) 00339 { 00340 dbref loc = Location(md.player); 00341 if (Good_obj(loc)) 00342 { 00343 match_list(Contents(loc), CON_LOCAL); 00344 } 00345 } 00346 }
void match_player | ( | void | ) |
Definition at line 151 of file match.cpp.
References match_state::absolute_form, CON_DBREF, CON_TOKEN, match_state::confidence, Good_obj, isPlayer, lookup_player(), LOOKUP_TOKEN, match(), md, mux_isspace, NOTHING, promote_match(), and match_state::string.
Referenced by do_boot(), do_chown(), do_chownall(), do_give(), do_kill(), do_look(), do_toad(), do_use(), FUNCTION(), and match_everything().
00152 { 00153 if (md.confidence >= CON_DBREF) 00154 { 00155 return; 00156 } 00157 if (Good_obj(md.absolute_form) && isPlayer(md.absolute_form)) 00158 { 00159 promote_match(md.absolute_form, CON_DBREF); 00160 return; 00161 } 00162 if (*md.string == LOOKUP_TOKEN) 00163 { 00164 char *p; 00165 for (p = md.string + 1; mux_isspace(*p); p++) 00166 { 00167 ; // Nothing. 00168 } 00169 dbref match = lookup_player(NOTHING, p, true); 00170 if (Good_obj(match)) 00171 { 00172 promote_match(match, CON_TOKEN); 00173 } 00174 } 00175 }
void match_possession | ( | void | ) |
Definition at line 319 of file match.cpp.
References CON_DBREF, CON_LOCAL, match_state::confidence, Contents, Good_obj, Has_contents, match_list(), md, and match_state::player.
Referenced by do_chown(), do_destroy(), do_drop(), do_give(), do_look(), do_use(), FUNCTION(), give_thing(), match_everything(), and match_possessed().
00320 { 00321 if (md.confidence >= CON_DBREF) 00322 { 00323 return; 00324 } 00325 if (Good_obj(md.player) && Has_contents(md.player)) 00326 { 00327 match_list(Contents(md.player), CON_LOCAL); 00328 } 00329 }
dbref match_result | ( | void | ) |
Definition at line 531 of file match.cpp.
References AMBIGUOUS, match_state::count, match_state::match, md, and NOTHING.
Referenced by do_chopen(), do_chown(), do_drop(), do_get(), do_give(), do_kill(), do_lock(), do_look(), do_mail_debug(), do_mail_stats(), do_move(), do_pemit_single(), do_teleport_single(), do_unlink(), FUNCTION(), give_thing(), match_controlled_handler(), match_possessed(), match_thing_quiet(), noisy_match_result(), parse_attrib_wild(), parse_boolexp_L(), parse_linkable_room(), and parse_thing_slash().
00532 { 00533 switch (md.count) 00534 { 00535 case 0: 00536 return NOTHING; 00537 00538 case 1: 00539 return md.match; 00540 00541 default: 00542 return AMBIGUOUS; 00543 } 00544 }
Definition at line 553 of file match.cpp.
References AMBIGUOUS, AMBIGUOUS_MESSAGE, NOMATCH_MESSAGE, NOPERM, NOPERM_MESSAGE, NOTHING, and notify.
Referenced by do_destroy(), do_get(), do_look(), FUNCTION(), and noisy_match_result().
00554 { 00555 switch (match) 00556 { 00557 case NOTHING: 00558 notify(player, NOMATCH_MESSAGE); 00559 return NOTHING; 00560 00561 case AMBIGUOUS: 00562 notify(player, AMBIGUOUS_MESSAGE); 00563 return NOTHING; 00564 00565 case NOPERM: 00566 notify(player, NOPERM_MESSAGE); 00567 return NOTHING; 00568 } 00569 return match; 00570 }
Definition at line 621 of file match.cpp.
References init_match(), MAT_EXIT_PARENTS, match_everything(), noisy_match_result(), and NOTYPE.
Referenced by do_chboot(), do_halt(), do_moniker(), do_prog(), do_quitprog(), and FUNCTION().
00622 { 00623 init_match(player, name, NOTYPE); 00624 match_everything(MAT_EXIT_PARENTS); 00625 return noisy_match_result(); 00626 }
Definition at line 628 of file match.cpp.
References init_match(), MAT_EXIT_PARENTS, match_everything(), match_result(), and NOTYPE.
Referenced by do_icmd(), FUNCTION(), get_obj_and_lock(), grep_handler(), handle_flaglists(), hasattr_handler(), internalPlayerFind(), process_sex(), and scan_zone().
00629 { 00630 init_match(player, name, NOTYPE); 00631 match_everything(MAT_EXIT_PARENTS); 00632 return match_result(); 00633 }
void match_zone_exit | ( | void | ) |
Definition at line 476 of file match.cpp.
References CON_DBREF, match_state::confidence, Good_obj, Has_exits, match_exit_internal(), md, match_state::player, and Zone.
Referenced by process_command().
00477 { 00478 if (md.confidence >= CON_DBREF) 00479 { 00480 return; 00481 } 00482 if ( Good_obj(md.player) 00483 && Has_exits(md.player)) 00484 { 00485 (void)match_exit_internal(Zone(md.player), Zone(md.player), 0); 00486 } 00487 }
dbref noisy_match_result | ( | void | ) |
Definition at line 572 of file match.cpp.
References match_result(), match_status(), md, and match_state::player.
Referenced by do_boot(), do_chownall(), do_chzone(), do_clone(), do_decomp(), do_enter(), do_entrances(), do_examine(), do_fixdb(), do_link(), do_notify(), do_parent(), do_setattr(), do_teleport(), do_toad(), do_use(), do_verb(), do_wait(), FUNCTION(), match_controlled_handler(), and match_thing().
00573 { 00574 return match_status(md.player, match_result()); 00575 }
void restore_match_state | ( | MSTATE * | ) |
Definition at line 590 of file match.cpp.
References match_state::absolute_form, match_state::check_keys, match_state::confidence, match_state::count, free_lbuf, match_state::match, md, match_state::player, match_state::pref_type, and match_state::string.
Referenced by parse_boolexp_L(), and promote_match().
00591 { 00592 md.confidence = mstate->confidence; 00593 md.count = mstate->count; 00594 md.pref_type = mstate->pref_type; 00595 md.check_keys = mstate->check_keys; 00596 md.absolute_form = mstate->absolute_form; 00597 md.match = mstate->match; 00598 md.player = mstate->player; 00599 strcpy(md.string, mstate->string); 00600 free_lbuf(mstate->string); 00601 }
void safe_match_result | ( | dbref | it, | |
char * | buff, | |||
char ** | bufc | |||
) |
Definition at line 635 of file match.cpp.
References AMBIGUOUS, safe_ambiguous, and safe_notfound.
Referenced by FUNCTION(), get_obj_and_lock(), grep_handler(), hasattr_handler(), internalPlayerFind(), process_sex(), and scan_zone().
00636 { 00637 if (it == AMBIGUOUS) 00638 { 00639 safe_ambiguous(buff, bufc); 00640 } 00641 else 00642 { 00643 safe_notfound(buff, bufc); 00644 } 00645 }
void save_match_state | ( | MSTATE * | ) |
Definition at line 577 of file match.cpp.
References match_state::absolute_form, alloc_lbuf, match_state::check_keys, match_state::confidence, match_state::count, match_state::match, md, match_state::player, match_state::pref_type, and match_state::string.
Referenced by parse_boolexp_L(), and promote_match().
00578 { 00579 mstate->confidence = md.confidence; 00580 mstate->count = md.count; 00581 mstate->pref_type = md.pref_type; 00582 mstate->check_keys = md.check_keys; 00583 mstate->absolute_form = md.absolute_form; 00584 mstate->match = md.match; 00585 mstate->player = md.player; 00586 mstate->string = alloc_lbuf("save_match_state"); 00587 strcpy(mstate->string, md.string); 00588 }