parent
6a10e12a6a
commit
e4c170f249
3 changed files with 18 additions and 1 deletions
|
@ -1110,10 +1110,14 @@ int game_lua_kernel::intf_terrain_mask(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
gamemap mask_map(resources::gameboard->map().tdata(), "");
|
||||
gamemap mask_map(board().map().tdata(), "");
|
||||
mask_map.read(t_str, false);
|
||||
board().map_->overlay(mask_map, loc, rules, is_odd, ignore_special_locations);
|
||||
|
||||
for(team& t : board().teams()) {
|
||||
t.fix_villages(board().map());
|
||||
}
|
||||
|
||||
if (game_display_) {
|
||||
game_display_->needs_rebuild(true);
|
||||
}
|
||||
|
|
12
src/team.cpp
12
src/team.cpp
|
@ -422,6 +422,18 @@ void team::write(config& cfg) const
|
|||
cfg["action_bonus_count"] = action_bonus_count_;
|
||||
}
|
||||
|
||||
void team::fix_villages(const gamemap &map)
|
||||
{
|
||||
for (auto it = villages_.begin(); it != villages_.end(); ) {
|
||||
if (map.is_village(*it)) {
|
||||
++it;
|
||||
}
|
||||
else {
|
||||
it = villages_.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
game_events::pump_result_t team::get_village(const map_location& loc, const int owner_side, game_data* gamedata)
|
||||
{
|
||||
villages_.insert(loc);
|
||||
|
|
|
@ -177,6 +177,7 @@ public:
|
|||
|
||||
void write(config& cfg) const;
|
||||
|
||||
void fix_villages(const gamemap &map);
|
||||
game_events::pump_result_t get_village(const map_location&, const int owner_side, game_data * fire_event); //!< Acquires a village from owner_side. Pointer fire_event should be the game_data for the game if it is desired to fire an event -- a "capture" event with owner_side variable scoped in will be fired. For no event, pass it nullptr. Default is the resources::gamedata pointer
|
||||
void lose_village(const map_location&);
|
||||
void clear_villages() { villages_.clear(); }
|
||||
|
|
Loading…
Add table
Reference in a new issue