diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 62 |
1 files changed, 27 insertions, 35 deletions
@@ -154,14 +154,31 @@ const REGION_NAME = [ "Unavailable", ] -function is_no_place_governor(province) { - return province >= view.support.length -} -function get_support(province) { - return view.support[province] +const BIT_AMPHITHEATER = 1 << 7 +const BIT_BASILICA = 1 << 8 +const BIT_LIMES = 1 << 9 +const BIT_QUAESTOR = 1 << 10 +const BIT_MILITIA = 1 << 11 +const BIT_BREAKAWAY = 1 << 12 +const BIT_SEAT_OF_POWER = 1 << 13 +const BIT_MILITIA_CASTRA = 1 << 14 + +function get_support(where) { return view.provinces[where] & 15 } +function get_mobs(where) { return (view.provinces[where] >> 4) & 7 } +function has_quaestor(where) { return view.provinces[where] & BIT_QUAESTOR } +function has_militia(where) { return view.provinces[where] & BIT_MILITIA } +function has_amphitheater(where) { return view.provinces[where] & BIT_AMPHITHEATER } +function has_basilica(where) { return view.provinces[where] & BIT_BASILICA } +function has_limes(where) { return view.provinces[where] & BIT_LIMES } +function is_breakaway(where) { return view.provinces[where] & BIT_BREAKAWAY } +function is_seat_of_power(where) { return view.provinces[where] & BIT_SEAT_OF_POWER } +function has_militia_castra(where) { return view.provinces[where] & BIT_MILITIA_CASTRA } + +function is_no_place_governor(where) { + return where >= view.provinces.length } function get_rival_emperor_location(id) { - return view.rival_emperors[id] + return view.barbarians[id] & 63 } function get_barbarian_location(id) { return view.barbarians[id] & 63 @@ -188,35 +205,10 @@ function is_general_inside_capital(id) { return view.generals[id] & 64 } function has_general_castra(id) { - return view.castra & (1 << id) -} -function has_militia_castra(province) { - return view.mcastra & (1 << province) -} -function has_quaestor(province) { - return view.quaestor & (1 << province) -} -function has_militia(province) { - return view.militia & (1 << province) -} -function get_mobs(province) { - return view.mobs[province] -} -function has_amphitheater(province) { - return view.amphitheater & (1 << province) -} -function has_basilica(province) { - return view.basilica & (1 << province) -} -function has_limes(province) { - return view.limes & (1 << province) -} -function is_breakaway(province) { - return view.breakaway & (1 << province) -} -function is_seat_of_power(province) { - return view.seat_of_power & (1 << province) + return view.generals[id] & 128 } + + function find_governor(f) { let n = view.legacy.length * 6 for (let id = 0; id < n; ++id) @@ -1144,7 +1136,7 @@ function on_update() { } } - let n = view.mobs[region] + let n = get_mobs(region) layout_mob(region, 0, ui.mobs[region * 3 + 0], n >= 1, n >= 2) layout_mob(region, 1, ui.mobs[region * 3 + 1], n >= 3, n >= 4) layout_mob(region, 2, ui.mobs[region * 3 + 2], n >= 5, n >= 6) |