/// <summary> /// Clear the passed map mask flags. /// </summary> /// <param name="flags"></param> public void map_clear_mask(MAP_MASK flags) { int i, j; for (i = 0; i < map_w; i++) for (j = 0; j < map_h; j++) { if ((flags & MAP_MASK.F_FOG) == MAP_MASK.F_FOG) mask [i, j].fog = true; if ((flags & MAP_MASK.F_INVERSE_FOG) == MAP_MASK.F_INVERSE_FOG) mask [i, j].fog = false; if ((flags & MAP_MASK.F_SPOT) == MAP_MASK.F_SPOT) mask [i, j].spot = false; if ((flags & MAP_MASK.F_IN_RANGE) == MAP_MASK.F_IN_RANGE) mask [i, j].in_range = 0; if ((flags & MAP_MASK.F_MOUNT) == MAP_MASK.F_MOUNT) mask [i, j].mount = 0; if ((flags & MAP_MASK.F_SEA_EMBARK) == MAP_MASK.F_SEA_EMBARK) mask [i, j].sea_embark = false; if ((flags & MAP_MASK.F_AUX) == MAP_MASK.F_AUX) mask [i, j].aux = 0; if ((flags & MAP_MASK.F_INFL) == MAP_MASK.F_INFL) mask [i, j].infl = 0; if ((flags & MAP_MASK.F_INFL_AIR) == MAP_MASK.F_INFL_AIR) mask [i, j].air_infl = 0; if ((flags & MAP_MASK.F_VIS_INFL) == MAP_MASK.F_VIS_INFL) mask [i, j].vis_infl = 0; if ((flags & MAP_MASK.F_VIS_INFL_AIR) == MAP_MASK.F_VIS_INFL_AIR) mask [i, j].vis_air_infl = 0; if ((flags & MAP_MASK.F_BLOCKED) == MAP_MASK.F_BLOCKED) mask [i, j].blocked = false; if ((flags & MAP_MASK.F_BACKUP) == MAP_MASK.F_BACKUP) mask [i, j].backup = false; if ((flags & MAP_MASK.F_MERGE_UNIT) == MAP_MASK.F_MERGE_UNIT) mask [i, j].merge_unit = null; if ((flags & MAP_MASK.F_DEPLOY) == MAP_MASK.F_DEPLOY) mask [i, j].deploy = false; if ((flags & MAP_MASK.F_CTRL_GRND) == MAP_MASK.F_CTRL_GRND) mask [i, j].ctrl_grnd = 0; if ((flags & MAP_MASK.F_CTRL_AIR) == MAP_MASK.F_CTRL_AIR) mask [i, j].ctrl_air = 0; if ((flags & MAP_MASK.F_CTRL_SEA) == MAP_MASK.F_CTRL_SEA) mask [i, j].ctrl_sea = 0; if ((flags & MAP_MASK.F_MOVE_COST) == MAP_MASK.F_MOVE_COST) mask [i, j].moveCost = 0; if ((flags & MAP_MASK.F_DISTANCE) == MAP_MASK.F_DISTANCE) mask [i, j].distance = -1; if ((flags & MAP_MASK.F_DANGER) == MAP_MASK.F_DANGER) mask [i, j].danger = false; if ((flags & MAP_MASK.F_SPLIT_UNIT) == MAP_MASK.F_SPLIT_UNIT) { mask [i, j].split_unit = null; mask [i, j].split_okay = false; } } }
/* ==================================================================== Set mask::fog (which is the actual fog of the engine) to either spot mask, in_range mask (covers sea_embark), merge mask, deploy mask. ==================================================================== */ public void map_set_fog(MAP_MASK type) { int x, y; for (y = 0; y < map_h; y++) for (x = 0; x < map_w; x++) { switch (type) { case MAP_MASK.F_SPOT: mask [x, y].fog = !mask [x, y].spot; break; case MAP_MASK.F_IN_RANGE: mask [x, y].fog = ((mask [x, y].in_range == 0 && !mask [x, y].sea_embark) || mask [x, y].blocked); break; case MAP_MASK.F_MERGE_UNIT: mask [x, y].fog = (mask [x, y].merge_unit == null); break; case MAP_MASK.F_SPLIT_UNIT: mask [x, y].fog = (mask [x, y].split_unit == null) && !mask [x, y].split_okay; break; case MAP_MASK.F_DEPLOY: mask [x, y].fog = !mask [x, y].deploy; break; default: mask [x, y].fog = false; break; } } }