static void update_map_data(Game_Unit unit, bool through_doors = false, bool ignore_doors = false) { Unit_Locs.Clear(); Doors.Clear(); // Goes through all units and sets a passable tag for the tile that unit is on // This should probably refer to the map's unit location data instead of figuring things out itself //Yeti foreach (Game_Unit test_unit in Global.game_map.units.Values.Where(x => !x.is_rescued && !x.is_dead)) { Vector2 loc = test_unit.pathfinding_loc; if (test_unit != unit && !Global.game_map.is_off_map(loc)) { #if DEBUG if (!Global.game_system.is_interpreter_running) { // if the location is already occupied, problems Debug.Assert(!Unit_Locs.ContainsKey(loc), string.Format( "Two units share a location when trying to start pathfinding\n\n{0}\n{1}", unit, test_unit)); } Unit_Locs[loc] = tile_unit_passability(unit, loc, test_unit); #else if (!Unit_Locs.ContainsKey(loc)) { Unit_Locs.Add(loc, tile_unit_passability(unit, loc, test_unit)); } #endif } } foreach (LightRune rune in Global.game_map.enumerate_light_runes()) { Vector2 loc = rune.loc; if (!Global.game_map.is_off_map(loc)) { Unit_Locs[loc] = tile_unit_passability(unit, loc, rune); } } Units_Ignored_Last_Time = Ignore_Units; Evented_Move_Last_Time = unit.is_evented_move; Ignore_Units = false; // Doors if (through_doors) { if ((unit.can_open_door() || ignore_doors) && !unit.is_player_team) { foreach (var door in Global.game_map.door_locations) { Doors.Add(door.Key); } } } }