! ScoreMatchL scores the match list for quality in terms of what the ! player has vaguely asked for. Points are awarded for conforming with ! requirements like "my", and so on. Remove from the match list any ! entries which fail the basic requirements of the descriptors. ! ---------------------------------------------------------------------------- [ ScoreMatchL context its_owner its_score obj i j threshold met a_s l_s; ! if (indef_type & OTHER_BIT ~= 0) threshold++; if (indef_type & MY_BIT ~= 0) threshold++; if (indef_type & THAT_BIT ~= 0) threshold++; if (indef_type & LIT_BIT ~= 0) threshold++; if (indef_type & UNLIT_BIT ~= 0) threshold++; if (indef_owner ~= nothing) threshold++; #ifdef DEBUG; if (parser_trace>=4) print " Scoring match list: indef mode ", indef_mode, " type ", indef_type, ", satisfying ", threshold, " requirements:^"; #endif; a_s = SCORE__NEXTBESTLOC; l_s = SCORE__BESTLOC; if (context == HELD_TOKEN or MULTIHELD_TOKEN or MULTIEXCEPT_TOKEN) { a_s = SCORE__BESTLOC; l_s = SCORE__NEXTBESTLOC; } for (i=0: ii; its_owner = parent(obj); its_score=0; ! if (indef_type & OTHER_BIT ~=0 ! && obj~=itobj or himobj or herobj) met++; if (indef_type & MY_BIT ~=0 && its_owner==actor) met++; if (indef_type & THAT_BIT ~=0 && its_owner==actors_location) met++; if (indef_type & LIT_BIT ~=0 && obj has light) met++; if (indef_type & UNLIT_BIT ~=0 && obj hasnt light) met++; if (indef_owner~=0 && its_owner == indef_owner) met++; if (met < threshold) { #ifdef DEBUG; if (parser_trace >= 4) print " ", (The) match_list-->i, " (", match_list-->i, ") in ", (the) its_owner, " is rejected (doesn't match descriptors)^"; #endif; match_list-->i=-1; } else { its_score = 0; if (obj hasnt concealed) its_score = SCORE__UNCONCEALED; if (its_owner==actor) its_score = its_score + a_s; else if (its_owner==actors_location) its_score = its_score + l_s; else if (its_owner~=compass) its_score = its_score + SCORE__NOTCOMPASS; its_score = its_score + SCORE__CHOOSEOBJ * ChooseObjects(obj, 2); if (obj hasnt scenery) its_score = its_score + SCORE__NOTSCENERY; if (obj ~= actor) its_score = its_score + SCORE__NOTACTOR; ! A small bonus for having the correct GNA, ! for sorting out ambiguous articles and the like. if (indef_cases & (PowersOfTwo_TB-->(GetGNAOfObject(obj)))) its_score = its_score + SCORE__GNA; match_scores-->i = match_scores-->i + its_score; #ifdef DEBUG; if (parser_trace >= 4) print " ", (The) match_list-->i, " (", match_list-->i, ") in ", (the) its_owner, " : ", match_scores-->i, " points^"; #endif; } } for (i=0:ii == -1) { if (i == number_matched-1) { number_matched--; break; } for (j=i:jj = match_list-->(j+1); match_scores-->j = match_scores-->(j+1); } number_matched--; } } ];