void handle_miss(cache_line *current_line, uint64_t tag, char rw, struct cache_stats_t *stats) { cache_block *ava_block = NULL; int i; stats -> misses++; for (i = 0; i < my_cache -> num_blocks_set;i++) { if (!(current_line -> blocks[i].valid)) { ava_block = &(current_line -> blocks[i]); } } if (ava_block == NULL) { ava_block = get_victim(current_line, tag, rw, stats); } if (rw == READ) { stats -> read_misses++; ava_block -> tag = tag; ava_block -> valid = 1; ava_block -> time_stamp = my_cache -> timer; } else if (rw == WRITE) { stats -> write_misses++; ava_block -> tag = tag; ava_block -> valid = 1; ava_block -> dirty = 1; ava_block -> time_stamp = my_cache -> timer; } }
void do_bash( char_data* ch, char* argument ) { char arg [ MAX_INPUT_LENGTH ]; char_data* victim; // int door; obj_data* chest; obj_data* bludgeon; if( is_confused_pet( ch ) || is_mounted( ch ) || is_entangled( ch, "bash" ) ) return; if( *argument == '\0' ) { if( ( victim = opponent( ch ) ) == NULL ) { send( ch, "Who or what do you want to bash?\n\r" ); return; } char_bash( ch, victim ); return; } if( ( victim = get_victim( ch, argument, empty_string ) ) != NULL ) { char_bash( ch, victim ); return; } /* if( ( door = find_door( ch, argument, FALSE ) ) >= 0 ) { door_bash( ch, door ); return; } if( door == -1 ) { send( ch, "There isn't a door there for you to bash.\n\r" ); return; } */ argument = one_argument( argument, arg ); if( ( chest = one_object( ch, arg, "bash", ch->array ) ) == NULL ) return; if( *argument == '\0' ) { send( ch, "With what do you wish to bash %s?\n\r", chest ); return; } if( ( bludgeon = one_object( ch, argument, "use as a bludgeon", &ch->contents ) ) == NULL ) return; obj_bash( ch, chest, bludgeon ); return; }
/* Banzaii. Makes a character banzaii on attackers of the castle staff. Used * by Guards, Tim, Tom, Dick, David, Peter, Master, and the King. */ int banzaii(struct char_data *ch) { struct char_data *chOpponent; if (!AWAKE(ch) || GET_POS(ch) == POS_FIGHTING || !(chOpponent = get_victim(ch))) return (FALSE); act("$n roars: 'Protect the Kingdom of Great King Welmar! BANZAIIII!!!'", FALSE, ch, 0, 0, TO_ROOM); hit(ch, chOpponent, TYPE_UNDEFINED); return (TRUE); }
bool Tag_Store::access(uint64_t addr) { if(contains(addr)){ touch(addr); return true; } else if(contains_but_not_valid(addr)){ touch(addr); return false; } else { get_victim(addr); return false; } }
/* Used by King Welmar */ void fry_victim(struct char_data * ch) { struct char_data *tch; if (ch->points.mana < 10) return; /* Find someone suitable to fry ! */ if (!(tch = get_victim(ch))) return; switch (number(0, 8)) { case 1: case 2: case 3: act("You raise your hand in a dramatical gesture.", 1, ch, 0, 0, TO_CHAR); act("$n raises $s hand in a dramatical gesture.", 1, ch, 0, 0, TO_ROOM); cast_spell(ch, tch, 0, SPELL_COLOR_SPRAY); break; case 4: case 5: act("You concentrate and mumble to yourself.", 1, ch, 0, 0, TO_CHAR); act("$n concentrates, and mumbles to $mself.", 1, ch, 0, 0, TO_ROOM); cast_spell(ch, tch, 0, SPELL_HARM); break; case 6: case 7: act("You look deeply into the eyes of $N.", 1, ch, 0, tch, TO_CHAR); act("$n looks deeply into the eyes of $N.", 1, ch, 0, tch, TO_NOTVICT); act("You see an ill-boding flame in the eye of $n.", 1, ch, 0, tch, TO_VICT); cast_spell(ch, tch, 0, SPELL_FIREBALL); break; default: if (!number(0, 1)) cast_spell(ch, ch, 0, SPELL_HEAL); break; } ch->points.mana -= 10; return; }