Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/
(cherry-picked from commit fc2a58f693
)
This commit is contained in:
parent
2c623ecc92
commit
45f871067f
325 changed files with 1471 additions and 1467 deletions
|
@ -64,7 +64,7 @@ namespace
|
|||
previews.push_back(get_advanced_unit(u, advance));
|
||||
}
|
||||
|
||||
size_t num_real_advances = previews.size();
|
||||
std::size_t num_real_advances = previews.size();
|
||||
bool always_display = false;
|
||||
|
||||
for (const config& advance : u.get_modification_advances()) {
|
||||
|
@ -90,7 +90,7 @@ namespace
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool animate_unit_advancement(const map_location &loc, size_t choice, const bool &fire_event, const bool animate)
|
||||
bool animate_unit_advancement(const map_location &loc, std::size_t choice, const bool &fire_event, const bool animate)
|
||||
{
|
||||
const events::command_disabler cmd_disabler;
|
||||
|
||||
|
|
|
@ -815,7 +815,7 @@ private:
|
|||
const map_location loc_;
|
||||
int weapon_;
|
||||
unit_map& units_;
|
||||
size_t id_; /**< unit.underlying_id() */
|
||||
std::size_t id_; /**< unit.underlying_id() */
|
||||
std::string weap_id_;
|
||||
int orig_attacks_;
|
||||
int n_attacks_; /**< Number of attacks left. */
|
||||
|
@ -1676,7 +1676,7 @@ bool backstab_check(const map_location& attacker_loc,
|
|||
}
|
||||
|
||||
// If sides aren't valid teams, then they are enemies.
|
||||
if(size_t(defender->side() - 1) >= teams.size() || size_t(opp->side() - 1) >= teams.size()) {
|
||||
if(std::size_t(defender->side() - 1) >= teams.size() || std::size_t(opp->side() - 1) >= teams.size()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace { // Helpers for get_recalls()
|
|||
*/
|
||||
void add_leader_filtered_recalls(const unit_const_ptr leader,
|
||||
std::vector< unit_const_ptr > & result,
|
||||
std::set<size_t> * already_added = nullptr)
|
||||
std::set<std::size_t> * already_added = nullptr)
|
||||
{
|
||||
const team& leader_team = resources::gameboard->get_team(leader->side());
|
||||
const std::string& save_id = leader_team.save_id();
|
||||
|
@ -138,7 +138,7 @@ namespace { // Helpers for get_recalls()
|
|||
{
|
||||
const unit & recall_unit = *recall_unit_ptr;
|
||||
// Do not add a unit twice.
|
||||
size_t underlying_id = recall_unit.underlying_id();
|
||||
std::size_t underlying_id = recall_unit.underlying_id();
|
||||
if ( !already_added || already_added->count(underlying_id) == 0 )
|
||||
{
|
||||
// Only units that match the leader's recall filter are valid.
|
||||
|
@ -195,7 +195,7 @@ std::vector<unit_const_ptr > get_recalls(int side, const map_location &recall_lo
|
|||
{
|
||||
unit_map::const_iterator u = resources::gameboard->units().begin(),
|
||||
u_end = resources::gameboard->units().end();
|
||||
std::set<size_t> valid_local_recalls;
|
||||
std::set<std::size_t> valid_local_recalls;
|
||||
|
||||
for(; u != u_end; ++u) {
|
||||
//We only consider leaders on our side.
|
||||
|
@ -213,7 +213,7 @@ std::vector<unit_const_ptr > get_recalls(int side, const map_location &recall_lo
|
|||
|
||||
if ( !leader_in_place )
|
||||
{
|
||||
std::set<size_t> valid_local_recalls;
|
||||
std::set<std::size_t> valid_local_recalls;
|
||||
|
||||
for(auto u = resources::gameboard->units().begin(); u != resources::gameboard->units().end(); ++u) {
|
||||
//We only consider leaders on our side.
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace { // Private helpers for move_unit()
|
|||
const map_location & final_hex() const
|
||||
{ return *move_loc_; }
|
||||
/// The number of hexes actually entered.
|
||||
size_t steps_travelled() const
|
||||
std::size_t steps_travelled() const
|
||||
{ return move_loc_ - begin_; }
|
||||
/// After moving, use this to detect if movement was less than expected.
|
||||
bool stopped_early() const { return expected_end_ != real_end_; }
|
||||
|
@ -327,8 +327,8 @@ namespace { // Private helpers for move_unit()
|
|||
bool sighted_; // Records if sightings were made that could interrupt movement.
|
||||
bool sighted_stop_; // Records if sightings were made that did interrupt movement (the same as sighted_ unless movement ended for another reason).
|
||||
bool teleport_failed_;
|
||||
size_t enemy_count_;
|
||||
size_t friend_count_;
|
||||
std::size_t enemy_count_;
|
||||
std::size_t friend_count_;
|
||||
std::string ambush_string_;
|
||||
std::vector<map_location> ambushers_;
|
||||
std::deque<int> moves_left_; // The front value is what the moving unit's remaining moves should be set to after the next step through the route.
|
||||
|
@ -632,7 +632,7 @@ namespace { // Private helpers for move_unit()
|
|||
const unit_map &units = resources::gameboard->units();
|
||||
|
||||
// Loop through the previously-detected ambushers.
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
while ( i != ambushers_.size() ) {
|
||||
if (units.count(ambushers_[i]) == 0) {
|
||||
// Ambusher is gone.
|
||||
|
@ -838,7 +838,7 @@ namespace { // Private helpers for move_unit()
|
|||
*/
|
||||
void unit_mover::pump_sighted(const route_iterator & from)
|
||||
{
|
||||
const size_t track = resources::game_events->pump().wml_tracking();
|
||||
const std::size_t track = resources::game_events->pump().wml_tracking();
|
||||
|
||||
auto pump_res = clearer_.fire_events();
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ namespace { // Private helpers for move_unit()
|
|||
}//end anonymous namespace
|
||||
|
||||
|
||||
static size_t move_unit_internal(undo_list* undo_stack,
|
||||
static std::size_t move_unit_internal(undo_list* undo_stack,
|
||||
bool show_move,
|
||||
bool* interrupted,
|
||||
unit_mover& mover)
|
||||
|
@ -1249,7 +1249,7 @@ static size_t move_unit_internal(undo_list* undo_stack,
|
|||
* @a steps is not empty (the return value is guaranteed to be less
|
||||
* than steps.size() ).
|
||||
*/
|
||||
size_t move_unit_and_record(const std::vector<map_location> &steps,
|
||||
std::size_t move_unit_and_record(const std::vector<map_location> &steps,
|
||||
undo_list* undo_stack,
|
||||
bool continued_move, bool show_move,
|
||||
bool* interrupted,
|
||||
|
@ -1282,7 +1282,7 @@ size_t move_unit_and_record(const std::vector<map_location> &steps,
|
|||
*/
|
||||
resources::recorder->add_synced_command("move",replay_helper::get_movement(steps, continued_move, skip_ally_sighted));
|
||||
set_scontext_synced sync;
|
||||
size_t r = move_unit_internal(undo_stack, show_move, interrupted, mover);
|
||||
std::size_t r = move_unit_internal(undo_stack, show_move, interrupted, mover);
|
||||
resources::controller->check_victory();
|
||||
resources::controller->maybe_throw_return_to_play_side();
|
||||
sync.do_final_checkup();
|
||||
|
@ -1295,7 +1295,7 @@ size_t move_unit_and_record(const std::vector<map_location> &steps,
|
|||
}
|
||||
}
|
||||
|
||||
size_t move_unit_from_replay(const std::vector<map_location> &steps,
|
||||
std::size_t move_unit_from_replay(const std::vector<map_location> &steps,
|
||||
undo_list* undo_stack,
|
||||
bool continued_move,bool skip_ally_sighted, bool show_move)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ game_events::pump_result_t get_village(const map_location& loc, int side, bool *
|
|||
|
||||
/// Moves a unit across the board.
|
||||
/// And enters the synced context.
|
||||
size_t move_unit_and_record(const std::vector<map_location> &steps,
|
||||
std::size_t move_unit_and_record(const std::vector<map_location> &steps,
|
||||
undo_list* undo_stack,
|
||||
bool continued_move = false,
|
||||
bool show_move = true,
|
||||
|
@ -110,7 +110,7 @@ size_t move_unit_and_record(const std::vector<map_location> &steps,
|
|||
|
||||
/// Moves a unit across the board.
|
||||
/// to be called from replay when we are already in the synced context.
|
||||
size_t move_unit_from_replay(const std::vector<map_location> &steps,
|
||||
std::size_t move_unit_from_replay(const std::vector<map_location> &steps,
|
||||
undo_list* undo_stack,
|
||||
bool continued_move, bool skip_ally_sighted,
|
||||
bool show_move = true);
|
||||
|
|
|
@ -445,11 +445,11 @@ bool undo_list::apply_shroud_changes() const
|
|||
}
|
||||
shroud_clearer clearer;
|
||||
bool cleared_shroud = false;
|
||||
const size_t list_size = undos_.size();
|
||||
const std::size_t list_size = undos_.size();
|
||||
|
||||
|
||||
// Loop through the list of undo_actions.
|
||||
for( size_t i = 0; i != list_size; ++i ) {
|
||||
for( std::size_t i = 0; i != list_size; ++i ) {
|
||||
if (const shroud_clearing_action* action = dynamic_cast<const shroud_clearing_action*>(&undos_[i])) {
|
||||
LOG_NG << "Turning an undo...\n";
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ undo_action::undo_action(const config& cfg)
|
|||
}
|
||||
|
||||
namespace {
|
||||
unit_ptr get_unit(size_t uid, const std::string& id) {
|
||||
unit_ptr get_unit(std::size_t uid, const std::string& id) {
|
||||
assert(resources::gameboard);
|
||||
auto iter = resources::gameboard->units().find(uid);
|
||||
if(!iter.valid() || iter->id() != id) {
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace actions {
|
|||
struct undo_event {
|
||||
config commands, data;
|
||||
map_location loc1, loc2, filter_loc1, filter_loc2;
|
||||
size_t uid1, uid2;
|
||||
std::size_t uid1, uid2;
|
||||
std::string id1, id2;
|
||||
undo_event(const config& cmds, const game_events::queued_event& ctx);
|
||||
undo_event(const config& first, const config& second, const config& weapons, const config& cmds);
|
||||
|
|
|
@ -139,15 +139,15 @@ void clearer_info::write(config & cfg) const
|
|||
* time of the sighting, and the location of the sighted unit.
|
||||
*/
|
||||
struct shroud_clearer::sight_data {
|
||||
sight_data(size_t viewed_id, const map_location & viewed_loc,
|
||||
size_t viewer_id, const map_location & viewer_loc) :
|
||||
sight_data(std::size_t viewed_id, const map_location & viewed_loc,
|
||||
std::size_t viewer_id, const map_location & viewer_loc) :
|
||||
seen_id(viewed_id), seen_loc(viewed_loc),
|
||||
sighter_id(viewer_id), sighter_loc(viewer_loc)
|
||||
{}
|
||||
|
||||
size_t seen_id;
|
||||
std::size_t seen_id;
|
||||
map_location seen_loc;
|
||||
size_t sighter_id;
|
||||
std::size_t sighter_id;
|
||||
map_location sighter_loc;
|
||||
};
|
||||
|
||||
|
@ -157,7 +157,7 @@ struct shroud_clearer::sight_data {
|
|||
*/
|
||||
inline void shroud_clearer::record_sighting(
|
||||
const unit & seen, const map_location & seen_loc,
|
||||
size_t sighter_id, const map_location & sighter_loc)
|
||||
std::size_t sighter_id, const map_location & sighter_loc)
|
||||
{
|
||||
sightings_.emplace_back(seen.underlying_id(), seen_loc, sighter_id, sighter_loc);
|
||||
}
|
||||
|
@ -226,8 +226,8 @@ void shroud_clearer::calculate_jamming(const team * new_team)
|
|||
bool shroud_clearer::clear_loc(team &tm, const map_location &loc,
|
||||
const map_location &view_loc,
|
||||
const map_location &event_non_loc,
|
||||
size_t viewer_id, bool check_units,
|
||||
size_t &enemy_count, size_t &friend_count,
|
||||
std::size_t viewer_id, bool check_units,
|
||||
std::size_t &enemy_count, std::size_t &friend_count,
|
||||
move_unit_spectator * spectator)
|
||||
{
|
||||
const gamemap &map = resources::gameboard->map();
|
||||
|
@ -328,11 +328,11 @@ bool shroud_clearer::clear_loc(team &tm, const map_location &loc,
|
|||
* locations in visual range were fogged/shrouded under shared vision/maps).
|
||||
*/
|
||||
bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
||||
size_t viewer_id, int sight_range, bool slowed,
|
||||
std::size_t viewer_id, int sight_range, bool slowed,
|
||||
const movetype::terrain_costs & costs,
|
||||
const map_location & real_loc,
|
||||
const std::set<map_location>* known_units,
|
||||
size_t * enemy_count, size_t * friend_count,
|
||||
std::size_t * enemy_count, std::size_t * friend_count,
|
||||
move_unit_spectator * spectator, bool instant)
|
||||
{
|
||||
// Give animations a chance to progress; see bug #20324.
|
||||
|
@ -341,7 +341,7 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
|||
|
||||
bool cleared_something = false;
|
||||
// Dummy variables to make some logic simpler.
|
||||
size_t enemies=0, friends=0;
|
||||
std::size_t enemies=0, friends=0;
|
||||
if ( enemy_count == nullptr )
|
||||
enemy_count = &enemies;
|
||||
if ( friend_count == nullptr )
|
||||
|
@ -401,7 +401,7 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
|
|||
bool shroud_clearer::clear_unit(const map_location &view_loc,
|
||||
const unit &viewer, team &view_team,
|
||||
const std::set<map_location>* known_units,
|
||||
size_t * enemy_count, size_t * friend_count,
|
||||
std::size_t * enemy_count, std::size_t * friend_count,
|
||||
move_unit_spectator * spectator, bool instant)
|
||||
{
|
||||
// This is just a translation to the more general interface. It is
|
||||
|
@ -495,7 +495,7 @@ bool shroud_clearer::clear_dest(const map_location &dest, const unit &viewer)
|
|||
{
|
||||
team & viewing_team = resources::gameboard->get_team(viewer.side());
|
||||
// A pair of dummy variables needed to simplify some logic.
|
||||
size_t enemies, friends;
|
||||
std::size_t enemies, friends;
|
||||
|
||||
// Abort if there is nothing to clear.
|
||||
if ( !viewing_team.fog_or_shroud() )
|
||||
|
@ -503,7 +503,7 @@ bool shroud_clearer::clear_dest(const map_location &dest, const unit &viewer)
|
|||
|
||||
// Cache some values.
|
||||
const map_location & real_loc = viewer.get_location();
|
||||
const size_t viewer_id = viewer.underlying_id();
|
||||
const std::size_t viewer_id = viewer.underlying_id();
|
||||
|
||||
// Clear the destination.
|
||||
bool cleared_something = clear_loc(viewing_team, dest, dest, real_loc,
|
||||
|
@ -597,8 +597,8 @@ std::vector<int> get_sides_not_seeing(const unit & target)
|
|||
const std::vector<team> & teams = resources::gameboard->teams();
|
||||
std::vector<int> not_seeing;
|
||||
|
||||
size_t team_size = teams.size();
|
||||
for ( size_t i = 0; i != team_size; ++i)
|
||||
std::size_t team_size = teams.size();
|
||||
for ( std::size_t i = 0; i != team_size; ++i)
|
||||
if ( !target.is_visible_to_team(teams[i], *resources::gameboard, false) )
|
||||
// not_see contains side numbers; i is a team index, so add 1.
|
||||
not_seeing.push_back(i+1);
|
||||
|
@ -631,7 +631,7 @@ game_events::pump_result_t actor_sighted(const unit & target, const std::vector<
|
|||
*/
|
||||
{
|
||||
const std::vector<team> & teams = resources::gameboard->teams();
|
||||
const size_t teams_size = teams.size();
|
||||
const std::size_t teams_size = teams.size();
|
||||
const map_location & target_loc = target.get_location();
|
||||
|
||||
// Determine the teams that (probably) should get events.
|
||||
|
@ -645,20 +645,20 @@ game_events::pump_result_t actor_sighted(const unit & target, const std::vector<
|
|||
// Exclude the target's own team.
|
||||
needs_event[target.side()-1] = false;
|
||||
// Exclude those teams that cannot see the target.
|
||||
for ( size_t i = 0; i != teams_size; ++i )
|
||||
for ( std::size_t i = 0; i != teams_size; ++i )
|
||||
needs_event[i] = needs_event[i] && target.is_visible_to_team(teams[i], *resources::gameboard, false);
|
||||
|
||||
// Cache "jamming".
|
||||
std::vector< std::map<map_location, int>> jamming_cache(teams_size);
|
||||
for ( size_t i = 0; i != teams_size; ++i )
|
||||
for ( std::size_t i = 0; i != teams_size; ++i )
|
||||
if ( needs_event[i] )
|
||||
create_jamming_map(jamming_cache[i], teams[i]);
|
||||
|
||||
// Look for units that can be used as the second unit in sighted events.
|
||||
std::vector<const unit *> second_units(teams_size, nullptr);
|
||||
std::vector<size_t> distances(teams_size, UINT_MAX);
|
||||
std::vector<std::size_t> distances(teams_size, UINT_MAX);
|
||||
for (const unit & viewer : resources::gameboard->units()) {
|
||||
const size_t index = viewer.side() - 1;
|
||||
const std::size_t index = viewer.side() - 1;
|
||||
// Does viewer belong to a team for which we still need a unit?
|
||||
if ( needs_event[index] && distances[index] != 0 ) {
|
||||
if ( can_see(viewer, target_loc, &jamming_cache[index]) ) {
|
||||
|
@ -668,7 +668,7 @@ game_events::pump_result_t actor_sighted(const unit & target, const std::vector<
|
|||
}
|
||||
else {
|
||||
// Consider viewer as a backup if it is close.
|
||||
size_t viewer_distance =
|
||||
std::size_t viewer_distance =
|
||||
distance_between(target_loc, viewer.get_location());
|
||||
if ( viewer_distance < distances[index] ) {
|
||||
second_units[index] = &viewer;
|
||||
|
@ -680,7 +680,7 @@ game_events::pump_result_t actor_sighted(const unit & target, const std::vector<
|
|||
|
||||
// Raise events for the appropriate teams.
|
||||
const game_events::entity_location target_entity(target);
|
||||
for ( size_t i = 0; i != teams_size; ++i )
|
||||
for ( std::size_t i = 0; i != teams_size; ++i )
|
||||
if ( second_units[i] != nullptr ) {
|
||||
resources::game_events->pump().raise(sighted_str, target_entity, game_events::entity_location(*second_units[i]));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace actions {
|
|||
/// (Used by the undo stack as that cannot rely on a unit sticking around, and
|
||||
/// we do not really need to copy the entire unit.)
|
||||
struct clearer_info {
|
||||
size_t underlying_id;
|
||||
std::size_t underlying_id;
|
||||
int sight_range;
|
||||
bool slowed;
|
||||
movetype::terrain_costs costs;
|
||||
|
@ -76,18 +76,18 @@ public:
|
|||
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||
/// based on @a sight_range, @a costs, and @a slowed.
|
||||
bool clear_unit(const map_location &view_loc, team &view_team,
|
||||
size_t viewer_id, int sight_range, bool slowed,
|
||||
std::size_t viewer_id, int sight_range, bool slowed,
|
||||
const movetype::terrain_costs & costs,
|
||||
const map_location & real_loc,
|
||||
const std::set<map_location>* known_units = nullptr,
|
||||
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
||||
std::size_t * enemy_count = nullptr, std::size_t * friend_count = nullptr,
|
||||
move_unit_spectator * spectator = nullptr, bool instant = true);
|
||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||
/// as if @a viewer was standing there.
|
||||
bool clear_unit(const map_location &view_loc,
|
||||
const unit &viewer, team &view_team,
|
||||
const std::set<map_location>* known_units = nullptr,
|
||||
size_t * enemy_count = nullptr, size_t * friend_count = nullptr,
|
||||
std::size_t * enemy_count = nullptr, std::size_t * friend_count = nullptr,
|
||||
move_unit_spectator * spectator = nullptr, bool instant = true);
|
||||
/// Clears shroud (and fog) around the provided location for @a view_team
|
||||
/// as if @a viewer was standing there. Setting @a instant to false
|
||||
|
@ -126,13 +126,13 @@ private:
|
|||
|
||||
/// Clears shroud from a single location.
|
||||
bool clear_loc(team &tm, const map_location &loc, const map_location &view_loc,
|
||||
const map_location &event_non_loc, size_t viewer_id,
|
||||
bool check_units, size_t &enemy_count, size_t &friend_count,
|
||||
const map_location &event_non_loc, std::size_t viewer_id,
|
||||
bool check_units, std::size_t &enemy_count, std::size_t &friend_count,
|
||||
move_unit_spectator * spectator = nullptr);
|
||||
|
||||
/// Convenience wrapper for adding sighting data to the sightings_ vector.
|
||||
inline void record_sighting(const unit & seen, const map_location & seen_loc,
|
||||
size_t sighter_id, const map_location & sighter_loc);
|
||||
std::size_t sighter_id, const map_location & sighter_loc);
|
||||
|
||||
private: // data
|
||||
std::map<map_location, int> jamming_;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool addons_client::upload_addon(const std::string& id, std::string& response_me
|
|||
// if the .pbl file doesn't provide one already
|
||||
if(passphrase.empty()) {
|
||||
passphrase.resize(16);
|
||||
for(size_t n = 0; n < passphrase.size(); ++n) {
|
||||
for(std::size_t n = 0; n < passphrase.size(); ++n) {
|
||||
passphrase[n] = randomness::generator->get_random_int('a', 'z');
|
||||
}
|
||||
cfg["passphrase"] = passphrase;
|
||||
|
@ -530,8 +530,8 @@ struct read_addon_connection_data : public network_transmission::connection_data
|
|||
{
|
||||
read_addon_connection_data(network_asio::connection& conn, addons_client& client)
|
||||
: conn_(conn), client_(client) {}
|
||||
size_t total() override { return conn_.bytes_to_read(); }
|
||||
virtual size_t current() override { return conn_.bytes_read(); }
|
||||
std::size_t total() override { return conn_.bytes_to_read(); }
|
||||
virtual std::size_t current() override { return conn_.bytes_read(); }
|
||||
virtual bool finished() override { return conn_.done(); }
|
||||
virtual void cancel() override { client_.connect(); }
|
||||
virtual void poll() override { conn_.poll(); }
|
||||
|
@ -542,8 +542,8 @@ struct connect_connection_data : public network_transmission::connection_data
|
|||
{
|
||||
connect_connection_data(network_asio::connection& conn, addons_client& client)
|
||||
: conn_(conn), client_(client) {}
|
||||
size_t total() override { return conn_.bytes_to_read(); }
|
||||
size_t current() override { return conn_.bytes_read(); }
|
||||
std::size_t total() override { return conn_.bytes_to_read(); }
|
||||
std::size_t current() override { return conn_.bytes_read(); }
|
||||
bool finished() override { return conn_.done(); }
|
||||
void cancel() override { client_.disconnect(); }
|
||||
void poll() override { conn_.poll(); }
|
||||
|
@ -554,8 +554,8 @@ struct write_addon_connection_data : public network_transmission::connection_dat
|
|||
{
|
||||
write_addon_connection_data(network_asio::connection& conn, addons_client& client)
|
||||
: conn_(conn), client_(client) {}
|
||||
size_t total() override { return conn_.bytes_to_write(); }
|
||||
virtual size_t current() override { return conn_.bytes_written(); }
|
||||
std::size_t total() override { return conn_.bytes_to_write(); }
|
||||
virtual std::size_t current() override { return conn_.bytes_written(); }
|
||||
virtual bool finished() override { return conn_.done(); }
|
||||
virtual void cancel() override { client_.connect(); }
|
||||
virtual void poll() override { conn_.poll(); }
|
||||
|
|
|
@ -197,7 +197,7 @@ static filesystem::blacklist_pattern_list read_ignore_patterns(const std::string
|
|||
std::string line;
|
||||
while (std::getline(*stream, line)) {
|
||||
boost::trim(line);
|
||||
const size_t l = line.size();
|
||||
const std::size_t l = line.size();
|
||||
// .gitignore & WML like comments
|
||||
if (l == 0 || !line.compare(0,2,"# ")) continue;
|
||||
if (line[l - 1] == '/') { // directory; we strip the last /
|
||||
|
@ -296,7 +296,7 @@ void refresh_addon_version_info_cache()
|
|||
std::transform(addons.begin(), addons.end(),
|
||||
addon_info_files.begin(), get_info_file_path);
|
||||
|
||||
for(size_t i = 0; i < addon_info_files.size(); ++i) {
|
||||
for(std::size_t i = 0; i < addon_info_files.size(); ++i) {
|
||||
assert(i < addons.size());
|
||||
|
||||
const std::string& addon = addons[i];
|
||||
|
|
|
@ -274,7 +274,7 @@ std::string encode_binary(const std::string& str)
|
|||
{
|
||||
std::string res;
|
||||
res.resize(str.size());
|
||||
size_t n = 0;
|
||||
std::size_t n = 0;
|
||||
for(std::string::const_iterator j = str.begin(); j != str.end(); ++j) {
|
||||
if(needs_escaping(*j)) {
|
||||
res.resize(res.size()+1);
|
||||
|
@ -292,7 +292,7 @@ std::string unencode_binary(const std::string& str)
|
|||
{
|
||||
std::string res(str.size(), '\0');
|
||||
|
||||
size_t n = 0;
|
||||
std::size_t n = 0;
|
||||
for(std::string::const_iterator j = str.begin(); j != str.end(); ) {
|
||||
char c = *j++;
|
||||
if((c == escape_char) && (j != str.end())) {
|
||||
|
|
|
@ -470,7 +470,7 @@ void move_result::do_execute()
|
|||
move_spectator.set_unit(resources::gameboard->units().find(from_));
|
||||
|
||||
if (from_ != to_) {
|
||||
size_t num_steps = ::actions::move_unit_and_record(
|
||||
std::size_t num_steps = ::actions::move_unit_and_record(
|
||||
/*std::vector<map_location> steps*/ route_->steps,
|
||||
/*::actions::undo_list* undo_stack*/ nullptr,
|
||||
/*bool continue_move*/ true, ///@todo 1.9 set to false after implementing interrupt awareness
|
||||
|
|
|
@ -423,7 +423,7 @@ void readonly_context_impl::calculate_moves(const unit_map& units, std::map<map_
|
|||
|
||||
// Don't take friendly villages
|
||||
if(!enemy && resources::gameboard->map().is_village(dst)) {
|
||||
for(size_t n = 0; n != resources::gameboard->teams().size(); ++n) {
|
||||
for(std::size_t n = 0; n != resources::gameboard->teams().size(); ++n) {
|
||||
if(resources::gameboard->teams()[n].owns_village(dst)) {
|
||||
int side = n + 1;
|
||||
if (get_side() != side && !current_team().is_enemy(side)) {
|
||||
|
@ -983,7 +983,7 @@ const std::set<map_location>& keeps_cache::get()
|
|||
if(map_->is_keep(loc)) {
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(loc,adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
if(map_->is_castle(adj[n])) {
|
||||
keeps_.insert(loc);
|
||||
break;
|
||||
|
|
|
@ -141,7 +141,7 @@ void aspect_attacks_base::do_attack_analysis(
|
|||
|
||||
ai::manager::get_singleton().raise_user_interact();
|
||||
const int default_attack_depth = 5;
|
||||
if(cur_analysis.movements.size() >= size_t(default_attack_depth)) {
|
||||
if(cur_analysis.movements.size() >= std::size_t(default_attack_depth)) {
|
||||
//std::cerr << "ANALYSIS " << cur_analysis.movements.size() << " >= " << get_attack_depth() << "\n";
|
||||
return;
|
||||
}
|
||||
|
@ -150,13 +150,13 @@ void aspect_attacks_base::do_attack_analysis(
|
|||
std::vector<team> &teams_ = resources::gameboard->teams();
|
||||
|
||||
|
||||
const size_t max_positions = 1000;
|
||||
const std::size_t max_positions = 1000;
|
||||
if(result.size() > max_positions && !cur_analysis.movements.empty()) {
|
||||
LOG_AI << "cut analysis short with number of positions\n";
|
||||
return;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i != units.size(); ++i) {
|
||||
for(std::size_t i = 0; i != units.size(); ++i) {
|
||||
const map_location current_unit = units[i];
|
||||
|
||||
unit_map::iterator unit_itor = units_.find(current_unit);
|
||||
|
@ -196,7 +196,7 @@ void aspect_attacks_base::do_attack_analysis(
|
|||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(current_unit, adj.data());
|
||||
|
||||
size_t tile;
|
||||
std::size_t tile;
|
||||
for(tile = 0; tile != 3; ++tile) {
|
||||
|
||||
const unit_map::const_iterator tmp_unit = units_.find(adj[tile]);
|
||||
|
|
|
@ -53,7 +53,7 @@ void attack_analysis::analyze(const gamemap& map, unit_map& units,
|
|||
// See if the target is a threat to our leader or an ally's leader.
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(target,adj.data());
|
||||
size_t tile;
|
||||
std::size_t tile;
|
||||
for(tile = 0; tile < adj.size(); ++tile) {
|
||||
const unit_map::const_iterator leader = units.find(adj[tile]);
|
||||
if(leader != units.end() && leader->can_recruit() && !ai_obj.current_team().is_enemy(leader->side())) {
|
||||
|
@ -76,7 +76,7 @@ void attack_analysis::analyze(const gamemap& map, unit_map& units,
|
|||
// making itself.
|
||||
alternative_terrain_quality = 0.0;
|
||||
double cost_sum = 0.0;
|
||||
for(size_t i = 0; i != movements.size(); ++i) {
|
||||
for(std::size_t i = 0; i != movements.size(); ++i) {
|
||||
const unit_map::const_iterator att = units.find(movements[i].first);
|
||||
const double cost = att->cost();
|
||||
cost_sum += cost;
|
||||
|
@ -345,7 +345,7 @@ wfl::variant attack_analysis::get_value(const std::string& key) const
|
|||
return variant(std::make_shared<location_callable>(target));
|
||||
} else if(key == "movements") {
|
||||
std::vector<variant> res;
|
||||
for(size_t n = 0; n != movements.size(); ++n) {
|
||||
for(std::size_t n = 0; n != movements.size(); ++n) {
|
||||
auto item = std::make_shared<map_formula_callable>(nullptr);
|
||||
item->add("src", variant(std::make_shared<location_callable>(movements[n].first)));
|
||||
item->add("dst", variant(std::make_shared<location_callable>(movements[n].second)));
|
||||
|
@ -355,7 +355,7 @@ wfl::variant attack_analysis::get_value(const std::string& key) const
|
|||
return variant(res);
|
||||
} else if(key == "units") {
|
||||
std::vector<variant> res;
|
||||
for(size_t n = 0; n != movements.size(); ++n) {
|
||||
for(std::size_t n = 0; n != movements.size(); ++n) {
|
||||
res.emplace_back(std::make_shared<location_callable>(movements[n].first));
|
||||
}
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ void get_villages_phase::find_villages(
|
|||
|
||||
const bool passive_leader = get_passive_leader();
|
||||
|
||||
size_t min_distance = 100000;
|
||||
std::size_t min_distance = 100000;
|
||||
const gamemap &map_ = resources::gameboard->map();
|
||||
std::vector<team> &teams_ = resources::gameboard->teams();
|
||||
|
||||
|
@ -676,7 +676,7 @@ void get_villages_phase::find_villages(
|
|||
continue;
|
||||
}
|
||||
|
||||
const size_t distance = distance_between(keep_loc_, current_loc);
|
||||
const std::size_t distance = distance_between(keep_loc_, current_loc);
|
||||
if(distance < min_distance) {
|
||||
min_distance = distance;
|
||||
best_leader_loc_ = current_loc;
|
||||
|
@ -693,7 +693,7 @@ void get_villages_phase::find_villages(
|
|||
}
|
||||
|
||||
bool want_village = true, owned = false;
|
||||
for(size_t n = 0; n != teams_.size(); ++n) {
|
||||
for(std::size_t n = 0; n != teams_.size(); ++n) {
|
||||
owned = teams_[n].owns_village(current_loc);
|
||||
if(owned && !current_team().is_enemy(n+1)) {
|
||||
want_village = false;
|
||||
|
@ -777,7 +777,7 @@ void get_villages_phase::dispatch(treachmap& reachmap, tmoves& moves)
|
|||
// village only one can capture it, so use the first in the list.)
|
||||
// 2. Villages which can only be reached by one unit get that unit dispatched
|
||||
// to them.
|
||||
size_t village_count = 0;
|
||||
std::size_t village_count = 0;
|
||||
bool dispatched = true;
|
||||
while(dispatched) {
|
||||
dispatched = false;
|
||||
|
@ -871,7 +871,7 @@ bool get_villages_phase::dispatch_unit_simple(treachmap& reachmap, tmoves& moves
|
|||
}
|
||||
|
||||
bool get_villages_phase::dispatch_village_simple(
|
||||
treachmap& reachmap, tmoves& moves, size_t& village_count)
|
||||
treachmap& reachmap, tmoves& moves, std::size_t& village_count)
|
||||
{
|
||||
|
||||
bool result = false;
|
||||
|
@ -956,13 +956,13 @@ get_villages_phase::treachmap::iterator get_villages_phase::remove_unit(
|
|||
}
|
||||
|
||||
void get_villages_phase::dispatch_complex(
|
||||
treachmap& reachmap, tmoves& moves, const size_t village_count)
|
||||
treachmap& reachmap, tmoves& moves, const std::size_t village_count)
|
||||
{
|
||||
// ***** ***** Init and dispatch if every unit can reach every village.
|
||||
|
||||
const size_t unit_count = reachmap.size();
|
||||
const std::size_t unit_count = reachmap.size();
|
||||
// The maximum number of villages we can capture with the available units.
|
||||
const size_t max_result = unit_count < village_count ? unit_count : village_count;
|
||||
const std::size_t max_result = unit_count < village_count ? unit_count : village_count;
|
||||
|
||||
assert(unit_count >= 2 && village_count >= 2);
|
||||
|
||||
|
@ -974,28 +974,28 @@ void get_villages_phase::dispatch_complex(
|
|||
}
|
||||
|
||||
std::vector<map_location> units(unit_count);
|
||||
std::vector<size_t> villages_per_unit(unit_count);
|
||||
std::vector<std::size_t> villages_per_unit(unit_count);
|
||||
std::vector<map_location> villages;
|
||||
std::vector<size_t> units_per_village(village_count);
|
||||
std::vector<std::size_t> units_per_village(village_count);
|
||||
|
||||
// We want to test the units, the ones who can reach the least
|
||||
// villages first so this is our lookup map.
|
||||
std::multimap<size_t /* villages_per_unit value*/,
|
||||
size_t /*villages_per_unit index*/> unit_lookup;
|
||||
std::multimap<std::size_t /* villages_per_unit value*/,
|
||||
std::size_t /*villages_per_unit index*/> unit_lookup;
|
||||
|
||||
std::vector</*unit*/boost::dynamic_bitset</*village*/>> matrix(reachmap.size(), boost::dynamic_bitset<>(village_count));
|
||||
|
||||
treachmap::const_iterator itor = reachmap.begin();
|
||||
for(size_t u = 0; u < unit_count; ++u, ++itor) {
|
||||
for(std::size_t u = 0; u < unit_count; ++u, ++itor) {
|
||||
units[u] = itor->first;
|
||||
villages_per_unit[u] = itor->second.size();
|
||||
unit_lookup.emplace(villages_per_unit[u], u);
|
||||
|
||||
assert(itor->second.size() >= 2);
|
||||
|
||||
for(size_t v = 0; v < itor->second.size(); ++v) {
|
||||
for(std::size_t v = 0; v < itor->second.size(); ++v) {
|
||||
|
||||
size_t v_index;
|
||||
std::size_t v_index;
|
||||
// find the index of the v in the villages
|
||||
std::vector<map_location>::const_iterator v_itor =
|
||||
std::find(villages.begin(), villages.end(), itor->second[v]);
|
||||
|
@ -1011,7 +1011,7 @@ void get_villages_phase::dispatch_complex(
|
|||
matrix[u][v_index] = true;
|
||||
}
|
||||
}
|
||||
for(std::vector<size_t>::const_iterator upv_it = units_per_village.begin();
|
||||
for(std::vector<std::size_t>::const_iterator upv_it = units_per_village.begin();
|
||||
upv_it != units_per_village.end(); ++upv_it) {
|
||||
|
||||
assert(*upv_it >=2);
|
||||
|
@ -1020,7 +1020,7 @@ void get_villages_phase::dispatch_complex(
|
|||
if(debug_) {
|
||||
// Print header
|
||||
std::cerr << "Reach matrix:\n\nvillage";
|
||||
size_t u, v;
|
||||
std::size_t u, v;
|
||||
for(v = 0; v < village_count; ++v) {
|
||||
std::cerr << '\t' << villages[v];
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ void get_villages_phase::dispatch_complex(
|
|||
|
||||
// Test the special case, everybody can reach all villages
|
||||
const bool reach_all = ((village_count == unit_count)
|
||||
&& (std::accumulate(villages_per_unit.begin(), villages_per_unit.end(), size_t())
|
||||
&& (std::accumulate(villages_per_unit.begin(), villages_per_unit.end(), std::size_t())
|
||||
== (village_count * unit_count)));
|
||||
|
||||
if(reach_all) {
|
||||
|
@ -1057,12 +1057,12 @@ void get_villages_phase::dispatch_complex(
|
|||
}
|
||||
|
||||
// ***** ***** Find a square
|
||||
std::multimap<size_t /* villages_per_unit value*/, size_t /*villages_per_unit index*/>
|
||||
std::multimap<std::size_t /* villages_per_unit value*/, std::size_t /*villages_per_unit index*/>
|
||||
::const_iterator src_itor = unit_lookup.begin();
|
||||
|
||||
while(src_itor != unit_lookup.end() && src_itor->first == 2) {
|
||||
|
||||
for(std::multimap<size_t, size_t>::const_iterator
|
||||
for(std::multimap<std::size_t, std::size_t>::const_iterator
|
||||
dst_itor = unit_lookup.begin();
|
||||
dst_itor != unit_lookup.end(); ++ dst_itor) {
|
||||
|
||||
|
@ -1072,13 +1072,13 @@ void get_villages_phase::dispatch_complex(
|
|||
}
|
||||
|
||||
boost::dynamic_bitset<> result = matrix[src_itor->second] & matrix[dst_itor->second];
|
||||
size_t matched = result.count();
|
||||
std::size_t matched = result.count();
|
||||
|
||||
// we found a solution, dispatch
|
||||
if(matched == 2) {
|
||||
// Collect data
|
||||
size_t first = result.find_first();
|
||||
size_t second = result.find_next(first);
|
||||
std::size_t first = result.find_first();
|
||||
std::size_t second = result.find_next(first);
|
||||
|
||||
const map_location village1 = villages[first];
|
||||
const map_location village2 = villages[second];
|
||||
|
@ -1139,22 +1139,22 @@ void get_villages_phase::dispatch_complex(
|
|||
// picked. In general we shouldn't reach this point too often if we do
|
||||
// there are a lot of villages which are unclaimed and a lot of units
|
||||
// to claim them.
|
||||
const size_t max_options = 8;
|
||||
const std::size_t max_options = 8;
|
||||
if(unit_count >= max_options && village_count >= max_options) {
|
||||
|
||||
DBG_AI_TESTING_AI_DEFAULT << "Too many units " << unit_count << " and villages "
|
||||
<< village_count<<" found, evaluate only the first "
|
||||
<< max_options << " options;\n";
|
||||
|
||||
std::vector<size_t> perm (max_options, 0);
|
||||
for(size_t i =0; i < max_options; ++i) {
|
||||
std::vector<std::size_t> perm (max_options, 0);
|
||||
for(std::size_t i =0; i < max_options; ++i) {
|
||||
perm[i] = i;
|
||||
}
|
||||
while(std::next_permutation(perm.begin(), perm.end())) {
|
||||
|
||||
// Get result for current permutation.
|
||||
std::vector<std::pair<map_location,map_location>> result;
|
||||
for(size_t u = 0; u < max_options; ++u) {
|
||||
for(std::size_t u = 0; u < max_options; ++u) {
|
||||
if(matrix[u][perm[u]]) {
|
||||
result.emplace_back(villages[perm[u]], units[u]);
|
||||
|
||||
|
@ -1185,14 +1185,14 @@ void get_villages_phase::dispatch_complex(
|
|||
|
||||
DBG_AI_TESTING_AI_DEFAULT << "Unit major\n";
|
||||
|
||||
std::vector<size_t> perm (unit_count, 0);
|
||||
for(size_t i =0; i < unit_count; ++i) {
|
||||
std::vector<std::size_t> perm (unit_count, 0);
|
||||
for(std::size_t i =0; i < unit_count; ++i) {
|
||||
perm[i] = i;
|
||||
}
|
||||
while(std::next_permutation(perm.begin(), perm.end())) {
|
||||
// Get result for current permutation.
|
||||
std::vector<std::pair<map_location,map_location>> result;
|
||||
for(size_t u = 0; u < unit_count; ++u) {
|
||||
for(std::size_t u = 0; u < unit_count; ++u) {
|
||||
if(matrix[u][perm[u]]) {
|
||||
result.emplace_back(villages[perm[u]], units[u]);
|
||||
|
||||
|
@ -1227,14 +1227,14 @@ void get_villages_phase::dispatch_complex(
|
|||
|
||||
DBG_AI_TESTING_AI_DEFAULT << "Village major\n";
|
||||
|
||||
std::vector<size_t> perm (village_count, 0);
|
||||
for(size_t i =0; i < village_count; ++i) {
|
||||
std::vector<std::size_t> perm (village_count, 0);
|
||||
for(std::size_t i =0; i < village_count; ++i) {
|
||||
perm[i] = i;
|
||||
}
|
||||
while(std::next_permutation(perm.begin(), perm.end())) {
|
||||
// Get result for current permutation.
|
||||
std::vector<std::pair<map_location,map_location>> result;
|
||||
for(size_t v = 0; v < village_count; ++v) {
|
||||
for(std::size_t v = 0; v < village_count; ++v) {
|
||||
if(matrix[perm[v]][v]) {
|
||||
result.emplace_back(villages[v], units[perm[v]]);
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ void get_villages_phase::dispatch_complex(
|
|||
void get_villages_phase::full_dispatch(treachmap& reachmap, tmoves& moves)
|
||||
{
|
||||
treachmap::const_iterator itor = reachmap.begin();
|
||||
for(size_t i = 0; i < reachmap.size(); ++i, ++itor) {
|
||||
for(std::size_t i = 0; i < reachmap.size(); ++i, ++itor) {
|
||||
DBG_AI_TESTING_AI_DEFAULT << "Dispatched unit at " << itor->first
|
||||
<< " to village " << itor->second[i] << '\n';
|
||||
moves.emplace_back(itor->second[i], itor->first);
|
||||
|
|
|
@ -153,7 +153,7 @@ private:
|
|||
* Returns true if modified reachmap and reachmap isn't empty.
|
||||
*/
|
||||
bool dispatch_village_simple(
|
||||
treachmap& reachmap, tmoves& moves, size_t& village_count);
|
||||
treachmap& reachmap, tmoves& moves, std::size_t& village_count);
|
||||
|
||||
|
||||
/** Removes a village for all units, returns true if anything is deleted. */
|
||||
|
@ -168,7 +168,7 @@ private:
|
|||
|
||||
/** Dispatches the units to a village after the simple dispatching failed. */
|
||||
void dispatch_complex(
|
||||
treachmap& reachmap, tmoves& moves, const size_t village_count);
|
||||
treachmap& reachmap, tmoves& moves, const std::size_t village_count);
|
||||
|
||||
|
||||
/** Dispatches all units to a village, every unit can reach every village. */
|
||||
|
|
|
@ -666,7 +666,7 @@ void move_to_targets_phase::enemies_along_path(const std::vector<map_location>&
|
|||
for(std::vector<map_location>::const_iterator i = route.begin(); i != route.end(); ++i) {
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(*i,adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
const std::pair<move_map::const_iterator,move_map::const_iterator> itors = dstsrc.equal_range(adj[n]);
|
||||
for(move_map::const_iterator j = itors.first; j != itors.second; ++j) {
|
||||
res.insert(j->second);
|
||||
|
@ -689,7 +689,7 @@ map_location move_to_targets_phase::form_group(const std::vector<map_location>&
|
|||
continue;
|
||||
}
|
||||
|
||||
size_t n = 0, nunits = res.size();
|
||||
std::size_t n = 0, nunits = res.size();
|
||||
|
||||
const std::pair<move_map::const_iterator,move_map::const_iterator> itors = dstsrc.equal_range(*i);
|
||||
for(move_map::const_iterator j = itors.first; j != itors.second; ++j) {
|
||||
|
@ -733,7 +733,7 @@ bool move_to_targets_phase::move_group(const map_location& dst, const std::vecto
|
|||
|
||||
map_location next;
|
||||
|
||||
size_t direction = 0;
|
||||
std::size_t direction = 0;
|
||||
|
||||
//find the direction the group is moving in
|
||||
if(itor+1 != route.end()) {
|
||||
|
@ -805,7 +805,7 @@ bool move_to_targets_phase::move_group(const map_location& dst, const std::vecto
|
|||
//find locations that are 'perpendicular' to the direction of movement for further units to move to.
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(best_loc,adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
if(n != direction && ((n+3)%6) != direction && map_.on_board(adj[n]) &&
|
||||
units_.count(adj[n]) == 0 && std::count(preferred_moves.begin(),preferred_moves.end(),adj[n]) == 0) {
|
||||
preferred_moves.push_front(adj[n]);
|
||||
|
|
|
@ -72,7 +72,7 @@ int default_ai_context_impl::count_free_hexes_in_castle(const map_location &loc,
|
|||
unit_map &units_ = resources::gameboard->units();
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(loc,adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
if (checked_hexes.find(adj[n]) != checked_hexes.end())
|
||||
continue;
|
||||
checked_hexes.insert(adj[n]);
|
||||
|
@ -151,7 +151,7 @@ std::vector<target> default_ai_context_impl::find_targets(const move_map& enemy_
|
|||
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(leader->get_location(), adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
std::pair<move_map::const_iterator,move_map::const_iterator> itors = enemy_dstsrc.equal_range(adj[n]);
|
||||
while(itors.first != itors.second) {
|
||||
if(units_.count(itors.first->second)) {
|
||||
|
@ -185,7 +185,7 @@ std::vector<target> default_ai_context_impl::find_targets(const move_map& enemy_
|
|||
|
||||
assert(map_.on_board(*t));
|
||||
bool ally_village = false;
|
||||
for (size_t i = 0; i != teams_.size(); ++i)
|
||||
for (std::size_t i = 0; i != teams_.size(); ++i)
|
||||
{
|
||||
if (!current_team().is_enemy(i + 1) && teams_[i].owns_village(*t)) {
|
||||
ally_village = true;
|
||||
|
@ -269,7 +269,7 @@ std::vector<target> default_ai_context_impl::find_targets(const move_map& enemy_
|
|||
}
|
||||
|
||||
assert(new_values.size() == targets.size());
|
||||
for(size_t n = 0; n != new_values.size(); ++n) {
|
||||
for(std::size_t n = 0; n != new_values.size(); ++n) {
|
||||
LOG_AI << "target value: " << targets[n].value << " -> " << new_values[n] << "\n";
|
||||
targets[n].value = new_values[n];
|
||||
}
|
||||
|
|
|
@ -1419,7 +1419,7 @@ bool recruitment::remove_job_if_no_blocker(config* job) {
|
|||
*/
|
||||
double recruitment::get_estimated_income(int turns) const {
|
||||
const team& team = resources::gameboard->get_team(get_side());
|
||||
const size_t own_villages = team.villages().size();
|
||||
const std::size_t own_villages = team.villages().size();
|
||||
const double village_gain = get_estimated_village_gain();
|
||||
const double unit_gain = get_estimated_unit_gain();
|
||||
|
||||
|
@ -1603,7 +1603,7 @@ void recruitment::do_similarity_penalty(std::vector<data>* leader_data) const {
|
|||
* Called at the beginning and whenever the recruitment list changes.
|
||||
*/
|
||||
int recruitment::get_cheapest_unit_cost_for_leader(const unit_map::const_iterator& leader) {
|
||||
std::map<size_t, int>::const_iterator it = cheapest_unit_costs_.find(leader->underlying_id());
|
||||
std::map<std::size_t, int>::const_iterator it = cheapest_unit_costs_.find(leader->underlying_id());
|
||||
if (it != cheapest_unit_costs_.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ private:
|
|||
terrain_count_map important_terrain_;
|
||||
int own_units_in_combat_counter_;
|
||||
std::map<map_location, double> average_local_cost_;
|
||||
std::map<size_t, int> cheapest_unit_costs_;
|
||||
std::map<std::size_t, int> cheapest_unit_costs_;
|
||||
cache_table combat_cache_;
|
||||
enum states {NORMAL, SAVE_GOLD, SPEND_ALL_GOLD, LEADER_IN_DANGER};
|
||||
states state_;
|
||||
|
|
|
@ -144,9 +144,9 @@ bool candidate_action_evaluation_loop::do_play_stage()
|
|||
|
||||
void candidate_action_evaluation_loop::remove_completed_cas()
|
||||
{
|
||||
std::vector<size_t> tbr; // indexes of elements to be removed
|
||||
std::vector<std::size_t> tbr; // indexes of elements to be removed
|
||||
|
||||
for (size_t i = 0; i != candidate_actions_.size(); ++i)
|
||||
for (std::size_t i = 0; i != candidate_actions_.size(); ++i)
|
||||
{
|
||||
if (candidate_actions_[i]->to_be_removed())
|
||||
{
|
||||
|
@ -154,10 +154,10 @@ void candidate_action_evaluation_loop::remove_completed_cas()
|
|||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i != tbr.size(); ++i)
|
||||
for (std::size_t i = 0; i != tbr.size(); ++i)
|
||||
{
|
||||
// we should go downwards, so that index shifts don't affect us
|
||||
size_t index = tbr.size() - i - 1; // downcounting for is not possible using unsigned counters, so we hack around
|
||||
std::size_t index = tbr.size() - i - 1; // downcounting for is not possible using unsigned counters, so we hack around
|
||||
std::string path = "stage[" + this->get_id() + "].candidate_action[" + candidate_actions_[tbr[index]]->get_name() + "]";
|
||||
|
||||
config cfg = config();
|
||||
|
|
|
@ -224,7 +224,7 @@ pathfind::plain_route formula_ai::shortest_path_calculator(const map_location &s
|
|||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(destination,adj.data());
|
||||
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
if(resources::gameboard->map().on_board(adj[n]) == false) {
|
||||
continue;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ pathfind::plain_route formula_ai::shortest_path_calculator(const map_location &s
|
|||
continue;
|
||||
}
|
||||
|
||||
static const size_t NDIRECTIONS = map_location::NDIRECTIONS;
|
||||
static const std::size_t NDIRECTIONS = map_location::NDIRECTIONS;
|
||||
unsigned int difference = std::abs(int(preferred - n));
|
||||
if(difference > NDIRECTIONS/2) {
|
||||
difference = NDIRECTIONS - difference;
|
||||
|
@ -386,7 +386,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "allies")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
for( size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
for( std::size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
if ( !current_team().is_enemy( i+1 ) )
|
||||
vars.emplace_back(i);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "enemies")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
for( size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
for( std::size_t i = 0; i < resources::gameboard->teams().size(); ++i) {
|
||||
if ( current_team().is_enemy( i+1 ) )
|
||||
vars.emplace_back(i);
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
|
||||
unit_types.build_all(unit_type::FULL);
|
||||
|
||||
for( size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
for( std::size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
{
|
||||
std::vector<variant> v;
|
||||
tmp.push_back( v );
|
||||
|
@ -447,7 +447,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
}
|
||||
}
|
||||
|
||||
for( size_t i = 0; i<tmp.size(); ++i)
|
||||
for( std::size_t i = 0; i<tmp.size(); ++i)
|
||||
vars.emplace_back(tmp[i]);
|
||||
return variant(vars);
|
||||
|
||||
|
@ -463,7 +463,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
{
|
||||
std::vector<variant> vars;
|
||||
std::vector< std::vector< variant>> tmp;
|
||||
for( size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
for( std::size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
{
|
||||
std::vector<variant> v;
|
||||
tmp.push_back( v );
|
||||
|
@ -471,7 +471,7 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
for(const unit &u : units) {
|
||||
tmp[u.side() - 1].emplace_back(std::make_shared<unit_callable>(u));
|
||||
}
|
||||
for( size_t i = 0; i<tmp.size(); ++i)
|
||||
for( std::size_t i = 0; i<tmp.size(); ++i)
|
||||
vars.emplace_back(tmp[i]);
|
||||
return variant(vars);
|
||||
|
||||
|
@ -541,11 +541,11 @@ variant formula_ai::get_value(const std::string& key) const
|
|||
} else if(key == "villages_of_side")
|
||||
{
|
||||
std::vector<variant> vars;
|
||||
for(size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
for(std::size_t i = 0; i<resources::gameboard->teams().size(); ++i)
|
||||
{
|
||||
vars.emplace_back();
|
||||
}
|
||||
for(size_t i = 0; i<vars.size(); ++i)
|
||||
for(std::size_t i = 0; i<vars.size(); ++i)
|
||||
{
|
||||
vars[i] = villages_from_set(resources::gameboard->teams()[i].villages());
|
||||
}
|
||||
|
@ -602,13 +602,13 @@ variant formula_ai::get_keeps() const
|
|||
{
|
||||
if(keeps_cache_.is_null()) {
|
||||
std::vector<variant> vars;
|
||||
for(size_t x = 0; x != size_t(resources::gameboard->map().w()); ++x) {
|
||||
for(size_t y = 0; y != size_t(resources::gameboard->map().h()); ++y) {
|
||||
for(std::size_t x = 0; x != std::size_t(resources::gameboard->map().w()); ++x) {
|
||||
for(std::size_t y = 0; y != std::size_t(resources::gameboard->map().h()); ++y) {
|
||||
const map_location loc(x,y);
|
||||
if(resources::gameboard->map().is_keep(loc)) {
|
||||
adjacent_loc_array_t adj;
|
||||
get_adjacent_tiles(loc,adj.data());
|
||||
for(size_t n = 0; n < adj.size(); ++n) {
|
||||
for(std::size_t n = 0; n < adj.size(); ++n) {
|
||||
if(resources::gameboard->map().is_castle(adj[n])) {
|
||||
vars.emplace_back(std::make_shared<location_callable>(loc));
|
||||
break;
|
||||
|
|
|
@ -221,9 +221,9 @@ void attack_candidate_action::evaluate(ai::formula_ai* ai, unit_map& units)
|
|||
enemy_units_flt.emplace_back(u_callable);
|
||||
}
|
||||
|
||||
for( size_t my_unit = 0 ; my_unit < my_units_flt.size() ; ++my_unit){
|
||||
for( std::size_t my_unit = 0 ; my_unit < my_units_flt.size() ; ++my_unit){
|
||||
auto my_unit_callable = my_units_flt[my_unit].convert_to<unit_callable>();
|
||||
for( size_t enemy_unit = 0 ; enemy_unit < enemy_units_flt.size() ; ++enemy_unit){
|
||||
for( std::size_t enemy_unit = 0 ; enemy_unit < enemy_units_flt.size() ; ++enemy_unit){
|
||||
auto enemy_unit_callable = enemy_units_flt[enemy_unit].convert_to<unit_callable>();
|
||||
if(ai->can_reach_unit(my_unit_callable->get_location(), enemy_unit_callable->get_location())) {
|
||||
|
||||
|
|
|
@ -273,11 +273,11 @@ DEFINE_FAI_FUNCTION(calculate_map_ownership, 2, 5)
|
|||
if( !units_input.is_list() )
|
||||
return variant();
|
||||
|
||||
size_t number_of_teams = units_input.num_elements();
|
||||
std::size_t number_of_teams = units_input.num_elements();
|
||||
|
||||
std::vector< std::vector<int>> scores( number_of_teams );
|
||||
|
||||
for( size_t i = 0; i< number_of_teams; ++i)
|
||||
for( std::size_t i = 0; i< number_of_teams; ++i)
|
||||
scores[i].resize(w*h);
|
||||
|
||||
/* // TODO: Do we need this?
|
||||
|
@ -288,20 +288,20 @@ DEFINE_FAI_FUNCTION(calculate_map_ownership, 2, 5)
|
|||
}
|
||||
*/
|
||||
|
||||
for(size_t side = 0 ; side < units_input.num_elements() ; ++side) {
|
||||
for(std::size_t side = 0 ; side < units_input.num_elements() ; ++side) {
|
||||
if( leaders_input[side].is_empty() )
|
||||
continue;
|
||||
|
||||
const map_location loc = leaders_input[side][0].convert_to<location_callable>()->loc();
|
||||
const variant units_of_side = units_input[side];
|
||||
|
||||
for(size_t unit_it = 0 ; unit_it < units_of_side.num_elements() ; ++unit_it) {
|
||||
for(std::size_t unit_it = 0 ; unit_it < units_of_side.num_elements() ; ++unit_it) {
|
||||
unit_adapter unit(units_of_side[unit_it]);
|
||||
find_movemap( unit, loc, scores[side], true, ai_ );
|
||||
}
|
||||
}
|
||||
|
||||
size_t index = 0;
|
||||
std::size_t index = 0;
|
||||
for( std::vector< std::vector<int>>::iterator i = scores.begin() ; i != scores.end() ; ++i) {
|
||||
for( std::vector<int>::iterator j = i->begin() ; j != i->end() ; ++j ) {
|
||||
if(units_input[index].num_elements() != 0) {
|
||||
|
@ -316,12 +316,12 @@ DEFINE_FAI_FUNCTION(calculate_map_ownership, 2, 5)
|
|||
//std::vector<variant> res;
|
||||
std::map<variant, variant> res;
|
||||
|
||||
size_t current_side = ai_.get_side() - 1 ;
|
||||
std::size_t current_side = ai_.get_side() - 1 ;
|
||||
|
||||
std::vector<int> enemies;
|
||||
std::vector<int> allies;
|
||||
|
||||
for(size_t side = 0 ; side < units_input.num_elements() ; ++side) {
|
||||
for(std::size_t side = 0 ; side < units_input.num_elements() ; ++side) {
|
||||
if( side == current_side)
|
||||
continue;
|
||||
|
||||
|
@ -382,7 +382,7 @@ DEFINE_WFL_FUNCTION(nearest_loc, 2, 2)
|
|||
int best = 1000000;
|
||||
int best_i = -1;
|
||||
|
||||
for(size_t i = 0; i < items.num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < items.num_elements(); ++i) {
|
||||
|
||||
const map_location move_loc = items[i].convert_to<location_callable>()->loc();
|
||||
int distance = distance_between(loc, move_loc);
|
||||
|
@ -577,7 +577,7 @@ DEFINE_FAI_FUNCTION(close_enemies, 2, 2)
|
|||
WRN_AI << "close_enemies_function: range is negative (" << range_s << ")" << std::endl;
|
||||
range_s = 0;
|
||||
}
|
||||
size_t range = static_cast<size_t>(range_s);
|
||||
std::size_t range = static_cast<std::size_t>(range_s);
|
||||
unit_map::const_iterator un = resources::gameboard->units().begin();
|
||||
unit_map::const_iterator end = resources::gameboard->units().end();
|
||||
while (un != end) {
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
// CONSTANTS
|
||||
// =======================================================================
|
||||
|
||||
static const size_t MAX_HISTORY_SIZE = 200;
|
||||
static const std::size_t MAX_HISTORY_SIZE = 200;
|
||||
|
||||
static const std::string AI_TYPE_COMPOSITE_AI;
|
||||
static const std::string AI_TYPE_SAMPLE_AI;
|
||||
|
|
|
@ -247,7 +247,7 @@ void helper_advance_unit(const map_location& loc){
|
|||
std::vector<config> mod_options = advance_unit->get_modification_advances();
|
||||
int options_num = unit_helper::number_of_possible_advances(*advance_unit);
|
||||
|
||||
size_t advance_choice = randomness::generator->get_random_int(0, options_num-1);
|
||||
std::size_t advance_choice = randomness::generator->get_random_int(0, options_num-1);
|
||||
unit_ptr advanced_unit = (*advance_unit).clone();
|
||||
|
||||
if(advance_choice < options.size()){
|
||||
|
|
|
@ -98,9 +98,9 @@ public:
|
|||
int get_current_frame_duration() const;
|
||||
int get_current_frame_time() const;
|
||||
const T& get_first_frame() const;
|
||||
const T& get_frame(size_t n) const;
|
||||
const T& get_frame(std::size_t n) const;
|
||||
const T& get_last_frame() const;
|
||||
size_t get_frames_count() const;
|
||||
std::size_t get_frames_count() const;
|
||||
|
||||
void force_change()
|
||||
{
|
||||
|
|
|
@ -310,7 +310,7 @@ inline const T& animated<T, T_void_value>::get_first_frame() const
|
|||
}
|
||||
|
||||
template<typename T, typename T_void_value>
|
||||
inline const T& animated<T, T_void_value>::get_frame(size_t n) const
|
||||
inline const T& animated<T, T_void_value>::get_frame(std::size_t n) const
|
||||
{
|
||||
if(n >= frames_.size()) {
|
||||
return void_value_;
|
||||
|
@ -330,7 +330,7 @@ inline const T& animated<T, T_void_value>::get_last_frame() const
|
|||
}
|
||||
|
||||
template<typename T, typename T_void_value>
|
||||
inline size_t animated<T, T_void_value>::get_frames_count() const
|
||||
inline std::size_t animated<T, T_void_value>::get_frames_count() const
|
||||
{
|
||||
return frames_.size();
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ std::vector<optional_feature> optional_features_table()
|
|||
{
|
||||
std::vector<optional_feature> res = versions.features;
|
||||
|
||||
for(size_t k = 0; k < res.size(); ++k) {
|
||||
for(std::size_t k = 0; k < res.size(); ++k) {
|
||||
res[k].name = _(res[k].name.c_str());
|
||||
}
|
||||
return res;
|
||||
|
@ -360,7 +360,7 @@ bool strlen_comparator(const std::string& a, const std::string& b)
|
|||
return a.length() < b.length();
|
||||
}
|
||||
|
||||
size_t max_strlen(const std::vector<std::string>& strs)
|
||||
std::size_t max_strlen(const std::vector<std::string>& strs)
|
||||
{
|
||||
const std::vector<std::string>::const_iterator it =
|
||||
std::max_element(strs.begin(), strs.end(), strlen_comparator);
|
||||
|
@ -374,8 +374,8 @@ std::string library_versions_report()
|
|||
{
|
||||
std::ostringstream o;
|
||||
|
||||
const size_t col2_start = max_strlen(versions.names) + 2;
|
||||
const size_t col3_start = max_strlen(versions.compiled) + 1;
|
||||
const std::size_t col2_start = max_strlen(versions.names) + 2;
|
||||
const std::size_t col3_start = max_strlen(versions.compiled) + 1;
|
||||
|
||||
for(unsigned n = 0; n < LIB_COUNT; ++n)
|
||||
{
|
||||
|
@ -389,7 +389,7 @@ std::string library_versions_report()
|
|||
|
||||
o << name << ": ";
|
||||
|
||||
const size_t pos2 = name.length() + 2;
|
||||
const std::size_t pos2 = name.length() + 2;
|
||||
if(pos2 < col2_start) {
|
||||
o << std::string(col2_start - pos2, ' ');
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ std::string library_versions_report()
|
|||
o << compiled;
|
||||
|
||||
if(!linked.empty()) {
|
||||
const size_t pos3 = compiled.length() + 1;
|
||||
const std::size_t pos3 = compiled.length() + 1;
|
||||
if(pos3 < col3_start) {
|
||||
o << std::string(col3_start - pos3, ' ');
|
||||
}
|
||||
|
@ -416,22 +416,22 @@ std::string optional_features_report()
|
|||
// that the context prefixes are stripped.
|
||||
const std::vector<optional_feature>& features = optional_features_table();
|
||||
|
||||
size_t col2_start = 0;
|
||||
std::size_t col2_start = 0;
|
||||
|
||||
for(size_t k = 0; k < features.size(); ++k)
|
||||
for(std::size_t k = 0; k < features.size(); ++k)
|
||||
{
|
||||
col2_start = std::max(col2_start, features[k].name.length() + 2);
|
||||
}
|
||||
|
||||
std::ostringstream o;
|
||||
|
||||
for(size_t k = 0; k < features.size(); ++k)
|
||||
for(std::size_t k = 0; k < features.size(); ++k)
|
||||
{
|
||||
const optional_feature& f = features[k];
|
||||
|
||||
o << f.name << ": ";
|
||||
|
||||
const size_t pos2 = f.name.length() + 2;
|
||||
const std::size_t pos2 = f.name.length() + 2;
|
||||
if(pos2 < col2_start) {
|
||||
o << std::string(col2_start - pos2, ' ');
|
||||
}
|
||||
|
|
|
@ -75,14 +75,14 @@ bool authenticate(config& campaign, const config::attribute_value& passphrase)
|
|||
return utils::md5(passphrase, campaign["passsalt"]).base64_digest() == campaign["passhash"];
|
||||
}
|
||||
|
||||
std::string generate_salt(size_t len)
|
||||
std::string generate_salt(std::size_t len)
|
||||
{
|
||||
boost::mt19937 mt(time(0));
|
||||
std::string salt = std::string(len, '0');
|
||||
boost::uniform_int<> from_str(0, 63); // 64 possible values for base64
|
||||
boost::variate_generator< boost::mt19937, boost::uniform_int<>> get_char(mt, from_str);
|
||||
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
for(std::size_t i = 0; i < len; i++) {
|
||||
salt[i] = crypt64::encode(get_char());
|
||||
}
|
||||
|
||||
|
@ -893,7 +893,7 @@ void server::handle_delete(const server::request& req)
|
|||
}
|
||||
|
||||
config::child_itors itors = campaigns().child_range("campaign");
|
||||
for(size_t index = 0; !itors.empty(); ++index, itors.pop_front())
|
||||
for(std::size_t index = 0; !itors.empty(); ++index, itors.pop_front())
|
||||
{
|
||||
if(&campaign == &itors.front()) {
|
||||
campaigns().remove_child("campaign", index);
|
||||
|
|
|
@ -85,7 +85,7 @@ private:
|
|||
int compress_level_; /**< Used for add-on archives. */
|
||||
|
||||
/** Default upload size limit in bytes. */
|
||||
static const size_t default_document_size_limit = 100 * 1024 * 1024;
|
||||
static const std::size_t default_document_size_limit = 100 * 1024 * 1024;
|
||||
|
||||
std::map<std::string, std::string> hooks_;
|
||||
request_handlers_table handlers_;
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
/**
|
||||
* Returns the total number of arguments, not including the command itself.
|
||||
*/
|
||||
size_t args_count() const
|
||||
std::size_t args_count() const
|
||||
{
|
||||
return args_.size() - 1;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
*
|
||||
* @throws std::out_of_range @a n exceeds args_count().
|
||||
*/
|
||||
const std::string& operator[](size_t n) const
|
||||
const std::string& operator[](std::size_t n) const
|
||||
{
|
||||
return arg(n);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
*
|
||||
* @throws std::out_of_range @a n exceeds args_count().
|
||||
*/
|
||||
const std::string& arg(size_t n) const
|
||||
const std::string& arg(std::size_t n) const
|
||||
{
|
||||
if(n > args_count()) {
|
||||
throw std::out_of_range("control line argument range exceeded");
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace std
|
|||
template<>
|
||||
struct hash<color_t>
|
||||
{
|
||||
size_t operator()(const color_t& c) const
|
||||
std::size_t operator()(const color_t& c) const
|
||||
{
|
||||
return c.to_rgba_bytes();
|
||||
}
|
||||
|
|
|
@ -432,7 +432,7 @@ config& config::child(config_key_type key, int n)
|
|||
|
||||
if(n < 0)
|
||||
n = i->second.size() + n;
|
||||
if(size_t(n) < i->second.size()) {
|
||||
if(std::size_t(n) < i->second.size()) {
|
||||
return *i->second[n];
|
||||
} else {
|
||||
DBG_CF << "The config object has only »" << i->second.size() << "« children named »" << key
|
||||
|
@ -966,8 +966,8 @@ void config::get_diff(const config& c, config& res) const
|
|||
const child_list& a = itor_a != children_.end() ? itor_a->second : dummy;
|
||||
const child_list& b = itor_b != c.children_.end() ? itor_b->second : dummy;
|
||||
|
||||
size_t ndeletes = 0;
|
||||
size_t ai = 0, bi = 0;
|
||||
std::size_t ndeletes = 0;
|
||||
std::size_t ai = 0, bi = 0;
|
||||
while(ai != a.size() || bi != b.size()) {
|
||||
// If the two elements are the same, nothing needs to be done.
|
||||
if(ai < a.size() && bi < b.size() && *a[ai] == *b[bi]) {
|
||||
|
@ -1038,7 +1038,7 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
}
|
||||
|
||||
for(const config& i : diff.child_range("change_child")) {
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
const std::size_t index = lexical_cast<std::size_t>(i["index"].str());
|
||||
for(const any_child& item : i.all_children_range()) {
|
||||
if(item.key.empty()) {
|
||||
continue;
|
||||
|
@ -1054,7 +1054,7 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
}
|
||||
|
||||
for(const config& i : diff.child_range("insert_child")) {
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
const std::size_t index = lexical_cast<std::size_t>(i["index"].str());
|
||||
for(const any_child& item : i.all_children_range()) {
|
||||
config& inserted = add_child_at(item.key, item.cfg, index);
|
||||
if(track) {
|
||||
|
@ -1064,7 +1064,7 @@ void config::apply_diff(const config& diff, bool track /* = false */)
|
|||
}
|
||||
|
||||
for(const config& i : diff.child_range("delete_child")) {
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
const std::size_t index = lexical_cast<std::size_t>(i["index"].str());
|
||||
for(const any_child& item : i.all_children_range()) {
|
||||
if(!track) {
|
||||
remove_child(item.key, index);
|
||||
|
@ -1084,14 +1084,14 @@ void config::clear_diff_track(const config& diff)
|
|||
{
|
||||
remove_attribute(diff_track_attribute);
|
||||
for(const config& i : diff.child_range("delete_child")) {
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
const std::size_t index = lexical_cast<std::size_t>(i["index"].str());
|
||||
for(const any_child& item : i.all_children_range()) {
|
||||
remove_child(item.key, index);
|
||||
}
|
||||
}
|
||||
|
||||
for(const config& i : diff.child_range("change_child")) {
|
||||
const size_t index = lexical_cast<size_t>(i["index"].str());
|
||||
const std::size_t index = lexical_cast<std::size_t>(i["index"].str());
|
||||
for(const any_child& item : i.all_children_range()) {
|
||||
if(item.key.empty()) {
|
||||
continue;
|
||||
|
|
|
@ -291,9 +291,9 @@ unsigned config_attribute_value::to_unsigned(unsigned def) const
|
|||
return apply_visitor(attribute_numeric_visitor<unsigned>(def));
|
||||
}
|
||||
|
||||
size_t config_attribute_value::to_size_t(size_t def) const
|
||||
std::size_t config_attribute_value::to_size_t(std::size_t def) const
|
||||
{
|
||||
return apply_visitor(attribute_numeric_visitor<size_t>(def));
|
||||
return apply_visitor(attribute_numeric_visitor<std::size_t>(def));
|
||||
}
|
||||
|
||||
time_t config_attribute_value::to_time_t(time_t def) const
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
int to_int(int def = 0) const;
|
||||
long long to_long_long(long long def = 0) const;
|
||||
unsigned to_unsigned(unsigned def = 0) const;
|
||||
size_t to_size_t(size_t def = 0) const;
|
||||
std::size_t to_size_t(std::size_t def = 0) const;
|
||||
time_t to_time_t(time_t def = 0) const;
|
||||
double to_double(double def = 0.) const;
|
||||
std::string str(const std::string& fallback = "") const;
|
||||
|
|
|
@ -93,9 +93,9 @@ SDL_Cursor* create_cursor(surface surf)
|
|||
// The width must be a multiple of 8 (SDL requirement)
|
||||
|
||||
#ifdef __APPLE__
|
||||
size_t cursor_width = 16;
|
||||
std::size_t cursor_width = 16;
|
||||
#else
|
||||
size_t cursor_width = nsurf->w;
|
||||
std::size_t cursor_width = nsurf->w;
|
||||
if((cursor_width % 8) != 0) {
|
||||
cursor_width += 8 - (cursor_width % 8);
|
||||
}
|
||||
|
@ -111,12 +111,12 @@ SDL_Cursor* create_cursor(surface surf)
|
|||
|
||||
for(int y = 0; y != nsurf->h; ++y) {
|
||||
for(int x = 0; x != nsurf->w; ++x) {
|
||||
if(static_cast<size_t>(x) < cursor_width) {
|
||||
if(static_cast<std::size_t>(x) < cursor_width) {
|
||||
uint8_t r, g, b, a;
|
||||
SDL_GetRGBA(pixels[y * nsurf->w + x], nsurf->format, &r, &g, &b, &a);
|
||||
|
||||
const size_t index = y * cursor_width + x;
|
||||
const size_t shift = 7 - (index % 8);
|
||||
const std::size_t index = y * cursor_width + x;
|
||||
const std::size_t shift = 7 - (index % 8);
|
||||
|
||||
const uint8_t trans = (a < 128 ? 0 : 1) << shift;
|
||||
const uint8_t black = (trans == 0 || (r + g + b) / 3 > 128 ? 0 : 1) << shift;
|
||||
|
|
|
@ -90,7 +90,7 @@ DBusHandlerResult filter_dbus_signal(DBusConnection *, DBusMessage *buf, void *)
|
|||
DBUS_TYPE_UINT32, &id,
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
size_t num_erased = notifications.get<by_id>().erase(id);
|
||||
std::size_t num_erased = notifications.get<by_id>().erase(id);
|
||||
LOG_DU << "Erased " << num_erased << " notifications records matching id=" << id;
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
|
@ -200,7 +200,7 @@ uint32_t send_dbus_notification(DBusConnection *connection, uint32_t replaces_id
|
|||
|
||||
namespace dbus {
|
||||
|
||||
const size_t MAX_MSG_LINES = 5;
|
||||
const std::size_t MAX_MSG_LINES = 5;
|
||||
|
||||
void send_notification(const std::string & owner, const std::string & message, bool with_history)
|
||||
{
|
||||
|
@ -215,8 +215,8 @@ void send_notification(const std::string & owner, const std::string & message, b
|
|||
if (with_history) {
|
||||
i->message = message + "\n" + i->message;
|
||||
|
||||
size_t endl_pos = i->message.find('\n');
|
||||
size_t ctr = 1;
|
||||
std::size_t endl_pos = i->message.find('\n');
|
||||
std::size_t ctr = 1;
|
||||
|
||||
while (ctr < MAX_MSG_LINES && endl_pos != std::string::npos) {
|
||||
endl_pos = i->message.find('\n', endl_pos+1);
|
||||
|
|
|
@ -196,7 +196,7 @@ void windows_tray_notification::switch_to_wesnoth_window()
|
|||
SetForegroundWindow(window);
|
||||
}
|
||||
|
||||
std::wstring windows_tray_notification::string_to_wstring(const std::string& string, size_t maxlength)
|
||||
std::wstring windows_tray_notification::string_to_wstring(const std::string& string, std::size_t maxlength)
|
||||
{
|
||||
utf16::string u16_string = unicode_cast<utf16::string>(string);
|
||||
if(u16_string.size() > maxlength) {
|
||||
|
|
|
@ -65,8 +65,8 @@ private:
|
|||
static bool message_reset;
|
||||
static const int ICON_ID = 1007; // just a random number
|
||||
static const unsigned int WM_TRAYNOTIFY = 32868; // WM_APP+100
|
||||
static const size_t MAX_TITLE_LENGTH = 63; // 64 including the terminating null character
|
||||
static const size_t MAX_MESSAGE_LENGTH = 255; // 256 including the terminating null character
|
||||
static const std::size_t MAX_TITLE_LENGTH = 63; // 64 including the terminating null character
|
||||
static const std::size_t MAX_MESSAGE_LENGTH = 255; // 256 including the terminating null character
|
||||
|
||||
static bool create_tray_icon();
|
||||
static void destroy_tray_icon();
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
static void adjust_length(std::string& title, std::string& message);
|
||||
static HWND get_window_handle();
|
||||
static void switch_to_wesnoth_window();
|
||||
static std::wstring string_to_wstring(const std::string& string, size_t maxlength);
|
||||
static std::wstring string_to_wstring(const std::string& string, std::size_t maxlength);
|
||||
|
||||
explicit windows_tray_notification();
|
||||
windows_tray_notification(const windows_tray_notification& w);
|
||||
|
|
|
@ -301,7 +301,7 @@ void display::init_flags() {
|
|||
image::set_team_colors(&side_colors);
|
||||
}
|
||||
|
||||
void display::reinit_flags_for_side(size_t side)
|
||||
void display::reinit_flags_for_side(std::size_t side)
|
||||
{
|
||||
if (!dc_ || side >= dc_->teams().size()) {
|
||||
ERR_DP << "Cannot rebuild flags for inexistent or unconfigured side " << side << '\n';
|
||||
|
@ -311,7 +311,7 @@ void display::reinit_flags_for_side(size_t side)
|
|||
init_flags_for_side_internal(side, dc_->teams()[side].color());
|
||||
}
|
||||
|
||||
void display::init_flags_for_side_internal(size_t n, const std::string& side_color)
|
||||
void display::init_flags_for_side_internal(std::size_t n, const std::string& side_color)
|
||||
{
|
||||
assert(dc_ != nullptr);
|
||||
assert(n < dc_->teams().size());
|
||||
|
@ -384,7 +384,7 @@ surface display::get_flag(const map_location& loc)
|
|||
return surface(nullptr);
|
||||
}
|
||||
|
||||
void display::set_team(size_t teamindex, bool show_everything)
|
||||
void display::set_team(std::size_t teamindex, bool show_everything)
|
||||
{
|
||||
assert(teamindex < dc_->teams().size());
|
||||
currentTeam_ = teamindex;
|
||||
|
@ -403,7 +403,7 @@ void display::set_team(size_t teamindex, bool show_everything)
|
|||
w->on_viewer_change(teamindex);
|
||||
}
|
||||
|
||||
void display::set_playing_team(size_t teamindex)
|
||||
void display::set_playing_team(std::size_t teamindex)
|
||||
{
|
||||
assert(teamindex < dc_->teams().size());
|
||||
activeTeam_ = teamindex;
|
||||
|
@ -817,7 +817,7 @@ surface display::screenshot(bool map_screenshot)
|
|||
|
||||
std::shared_ptr<gui::button> display::find_action_button(const std::string& id)
|
||||
{
|
||||
for (size_t i = 0; i < action_buttons_.size(); ++i) {
|
||||
for (std::size_t i = 0; i < action_buttons_.size(); ++i) {
|
||||
if(action_buttons_[i]->id() == id) {
|
||||
return action_buttons_[i];
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ std::shared_ptr<gui::button> display::find_action_button(const std::string& id)
|
|||
|
||||
std::shared_ptr<gui::button> display::find_menu_button(const std::string& id)
|
||||
{
|
||||
for (size_t i = 0; i < menu_buttons_.size(); ++i) {
|
||||
for (std::size_t i = 0; i < menu_buttons_.size(); ++i) {
|
||||
if(menu_buttons_[i]->id() == id) {
|
||||
return menu_buttons_[i];
|
||||
}
|
||||
|
@ -945,7 +945,7 @@ gui::button::TYPE display::string_to_button_type(std::string type)
|
|||
return res;
|
||||
}
|
||||
|
||||
static const std::string& get_direction(size_t n)
|
||||
static const std::string& get_direction(std::size_t n)
|
||||
{
|
||||
static const std::array<std::string, 6> dirs {{ "-n", "-ne", "-se", "-s", "-sw", "-nw" }};
|
||||
return dirs[n >= dirs.size() ? 0 : n];
|
||||
|
@ -1504,12 +1504,16 @@ static void draw_background(surface screen, const SDL_Rect& area, const std::str
|
|||
}
|
||||
|
||||
void display::draw_text_in_hex(const map_location& loc,
|
||||
const drawing_layer layer, const std::string& text,
|
||||
size_t font_size, color_t color, double x_in_hex, double y_in_hex)
|
||||
const drawing_layer layer,
|
||||
const std::string& text,
|
||||
std::size_t font_size,
|
||||
color_t color,
|
||||
double x_in_hex,
|
||||
double y_in_hex)
|
||||
{
|
||||
if (text.empty()) return;
|
||||
|
||||
const size_t font_sz = static_cast<size_t>(font_size * get_zoom_factor());
|
||||
const std::size_t font_sz = static_cast<std::size_t>(font_size * get_zoom_factor());
|
||||
|
||||
surface text_surf = font::get_rendered_text(text, font_sz, color);
|
||||
surface back_surf = font::get_rendered_text(text, font_sz, font::BLACK_COLOR);
|
||||
|
@ -1711,7 +1715,7 @@ const theme::action* display::action_pressed()
|
|||
{
|
||||
for(auto i = action_buttons_.begin(); i != action_buttons_.end(); ++i) {
|
||||
if((*i)->pressed()) {
|
||||
const size_t index = std::distance(action_buttons_.begin(), i);
|
||||
const std::size_t index = std::distance(action_buttons_.begin(), i);
|
||||
if(index >= theme_.actions().size()) {
|
||||
assert(false);
|
||||
return nullptr;
|
||||
|
@ -1727,7 +1731,7 @@ const theme::menu* display::menu_pressed()
|
|||
{
|
||||
for(auto i = menu_buttons_.begin(); i != menu_buttons_.end(); ++i) {
|
||||
if((*i)->pressed()) {
|
||||
const size_t index = std::distance(menu_buttons_.begin(), i);
|
||||
const std::size_t index = std::distance(menu_buttons_.begin(), i);
|
||||
if(index >= theme_.menus().size()) {
|
||||
assert(false);
|
||||
return nullptr;
|
||||
|
@ -1748,7 +1752,7 @@ void display::enable_menu(const std::string& item, bool enable)
|
|||
);
|
||||
|
||||
if(hasitem != menu->items().end()) {
|
||||
const size_t index = std::distance(theme_.menus().begin(), menu);
|
||||
const std::size_t index = std::distance(theme_.menus().begin(), menu);
|
||||
if(index >= menu_buttons_.size()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -3104,7 +3108,7 @@ void display::invalidate_animations()
|
|||
open_mp_list.push_back(u);
|
||||
}
|
||||
|
||||
// openMP can't iterate over size_t
|
||||
// openMP can't iterate over std::size_t
|
||||
const int omp_iterations = open_mp_list.size();
|
||||
//#pragma omp parallel for shared(open_mp_list)
|
||||
//this loop must not be parallelized. refresh is not thread-safe,
|
||||
|
|
|
@ -93,24 +93,24 @@ public:
|
|||
const std::vector<team>& get_teams() const {return dc_->teams();}
|
||||
|
||||
/** The playing team is the team whose turn it is. */
|
||||
size_t playing_team() const { return activeTeam_; }
|
||||
std::size_t playing_team() const { return activeTeam_; }
|
||||
|
||||
bool team_valid() const;
|
||||
|
||||
/** The viewing team is the team currently viewing the game. */
|
||||
size_t viewing_team() const { return currentTeam_; }
|
||||
std::size_t viewing_team() const { return currentTeam_; }
|
||||
int viewing_side() const { return currentTeam_ + 1; }
|
||||
|
||||
/**
|
||||
* Sets the team controlled by the player using the computer.
|
||||
* Data from this team will be displayed in the game status.
|
||||
*/
|
||||
void set_team(size_t team, bool observe=false);
|
||||
void set_team(std::size_t team, bool observe=false);
|
||||
|
||||
/**
|
||||
* set_playing_team sets the team whose turn it currently is
|
||||
*/
|
||||
void set_playing_team(size_t team);
|
||||
void set_playing_team(std::size_t team);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -637,13 +637,13 @@ public:
|
|||
void init_flags();
|
||||
|
||||
/** Rebuild the flag list (not team colors) for a single side. */
|
||||
void reinit_flags_for_side(size_t side);
|
||||
void reinit_flags_for_side(std::size_t side);
|
||||
void reset_reports(reports& reports_object)
|
||||
{
|
||||
reports_object_ = &reports_object;
|
||||
}
|
||||
private:
|
||||
void init_flags_for_side_internal(size_t side, const std::string& side_color);
|
||||
void init_flags_for_side_internal(std::size_t side, const std::string& side_color);
|
||||
|
||||
int blindfold_ctr_;
|
||||
|
||||
|
@ -727,7 +727,7 @@ protected:
|
|||
static const std::string& get_variant(const std::vector<std::string>& variants, const map_location &loc);
|
||||
|
||||
CVideo& screen_;
|
||||
size_t currentTeam_;
|
||||
std::size_t currentTeam_;
|
||||
bool dont_show_all_; //const team *viewpoint_;
|
||||
int xpos_, ypos_;
|
||||
bool view_locked_;
|
||||
|
@ -873,13 +873,13 @@ public:
|
|||
* The font size is adjusted to the zoom factor.
|
||||
*/
|
||||
void draw_text_in_hex(const map_location& loc,
|
||||
const drawing_layer layer, const std::string& text, size_t font_size,
|
||||
const drawing_layer layer, const std::string& text, std::size_t font_size,
|
||||
color_t color, double x_in_hex=0.5, double y_in_hex=0.5);
|
||||
|
||||
protected:
|
||||
|
||||
//TODO sort
|
||||
size_t activeTeam_;
|
||||
std::size_t activeTeam_;
|
||||
|
||||
/**
|
||||
* In order to render a hex properly it needs to be rendered per row. On
|
||||
|
|
|
@ -110,7 +110,7 @@ bool display_context::unit_can_move(const unit &u) const
|
|||
int display_context::village_owner(const map_location& loc) const
|
||||
{
|
||||
const std::vector<team> & t = teams();
|
||||
for(size_t i = 0; i != t.size(); ++i) {
|
||||
for(std::size_t i = 0; i != t.size(); ++i) {
|
||||
if(t[i].owns_village(loc))
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ void editor_controller::do_screenshot(const std::string& screenshot_filename /*
|
|||
bool editor_controller::quit_confirm()
|
||||
{
|
||||
std::string modified;
|
||||
size_t amount = context_manager_->modified_maps(modified);
|
||||
std::size_t amount = context_manager_->modified_maps(modified);
|
||||
|
||||
std::string message;
|
||||
if (amount == 0) {
|
||||
|
@ -544,7 +544,7 @@ hotkey::ACTION_STATE editor_controller::get_action_state(hotkey::HOTKEY_COMMAND
|
|||
return index == get_current_map_context().get_active_area()
|
||||
? ACTION_SELECTED : ACTION_DESELECTED;
|
||||
case editor::SIDE:
|
||||
return static_cast<size_t>(index) == gui_->playing_team()
|
||||
return static_cast<std::size_t>(index) == gui_->playing_team()
|
||||
? ACTION_SELECTED : ACTION_DESELECTED;
|
||||
case editor::TIME:
|
||||
return index == get_current_map_context().get_time_manager()->get_current_time()
|
||||
|
|
|
@ -157,7 +157,7 @@ bool context_manager::toggle_update_transitions()
|
|||
return false;
|
||||
}
|
||||
|
||||
size_t context_manager::modified_maps(std::string& message)
|
||||
std::size_t context_manager::modified_maps(std::string& message)
|
||||
{
|
||||
std::vector<std::string> modified;
|
||||
for(auto& mc : map_contexts_) {
|
||||
|
@ -280,7 +280,7 @@ void context_manager::expand_open_maps_menu(std::vector<config>& items, int i)
|
|||
auto pos = items.erase(items.begin() + i);
|
||||
std::vector<config> contexts;
|
||||
|
||||
for(size_t mci = 0; mci < map_contexts_.size(); ++mci) {
|
||||
for(std::size_t mci = 0; mci < map_contexts_.size(); ++mci) {
|
||||
map_context& mc = *map_contexts_[mci];
|
||||
|
||||
std::string filename;
|
||||
|
@ -356,7 +356,7 @@ void context_manager::expand_areas_menu(std::vector<config>& items, int i)
|
|||
|
||||
std::vector<std::string> area_ids = tod->get_area_ids();
|
||||
|
||||
for(size_t mci = 0; mci < area_ids.size(); ++mci) {
|
||||
for(std::size_t mci = 0; mci < area_ids.size(); ++mci) {
|
||||
const std::string& area = area_ids[mci];
|
||||
|
||||
std::stringstream ss;
|
||||
|
@ -369,7 +369,7 @@ void context_manager::expand_areas_menu(std::vector<config>& items, int i)
|
|||
}
|
||||
|
||||
const bool changed =
|
||||
mci == static_cast<size_t>(get_map_context().get_active_area())
|
||||
mci == static_cast<std::size_t>(get_map_context().get_active_area())
|
||||
&& tod->get_area_by_index(mci) != get_map_context().map().selection();
|
||||
|
||||
const std::string label = ss.str();
|
||||
|
@ -386,7 +386,7 @@ void context_manager::expand_sides_menu(std::vector<config>& items, int i)
|
|||
auto pos = items.erase(items.begin() + i);
|
||||
std::vector<config> contexts;
|
||||
|
||||
for(size_t mci = 0; mci < get_map_context().teams().size(); ++mci) {
|
||||
for(std::size_t mci = 0; mci < get_map_context().teams().size(); ++mci) {
|
||||
|
||||
const team& t = get_map_context().teams()[mci];
|
||||
const std::string& teamname = t.user_team_name();
|
||||
|
@ -732,7 +732,7 @@ void context_manager::save_all_maps(bool auto_save_windows)
|
|||
{
|
||||
int current = current_context_index_;
|
||||
saved_windows_.clear();
|
||||
for(size_t i = 0; i < map_contexts_.size(); ++i) {
|
||||
for(std::size_t i = 0; i < map_contexts_.size(); ++i) {
|
||||
switch_context(i);
|
||||
std::string name = get_map_context().get_filename();
|
||||
if(auto_save_windows) {
|
||||
|
@ -770,7 +770,7 @@ void context_manager::save_map()
|
|||
|
||||
bool context_manager::save_scenario_as(const std::string& filename)
|
||||
{
|
||||
size_t is_open = check_open_map(filename);
|
||||
std::size_t is_open = check_open_map(filename);
|
||||
if(is_open < map_contexts_.size() && is_open != static_cast<unsigned>(current_context_index_)) {
|
||||
gui2::show_transient_message(_("This scenario is already open."), filename);
|
||||
return false;
|
||||
|
@ -793,7 +793,7 @@ bool context_manager::save_scenario_as(const std::string& filename)
|
|||
|
||||
bool context_manager::save_map_as(const std::string& filename)
|
||||
{
|
||||
size_t is_open = check_open_map(filename);
|
||||
std::size_t is_open = check_open_map(filename);
|
||||
if(is_open < map_contexts_.size() && is_open != static_cast<unsigned>(current_context_index_)) {
|
||||
gui2::show_transient_message(_("This map is already open."), filename);
|
||||
return false;
|
||||
|
@ -844,9 +844,9 @@ bool context_manager::write_map(bool display_confirmation)
|
|||
return true;
|
||||
}
|
||||
|
||||
size_t context_manager::check_open_map(const std::string& fn) const
|
||||
std::size_t context_manager::check_open_map(const std::string& fn) const
|
||||
{
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
while(i < map_contexts_.size() && map_contexts_[i]->get_filename() != fn) {
|
||||
++i;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ size_t context_manager::check_open_map(const std::string& fn) const
|
|||
|
||||
bool context_manager::check_switch_open_map(const std::string& fn)
|
||||
{
|
||||
size_t i = check_open_map(fn);
|
||||
std::size_t i = check_open_map(fn);
|
||||
if(i < map_contexts_.size()) {
|
||||
gui2::show_transient_message(_("This map is already open."), fn);
|
||||
switch_context(i);
|
||||
|
@ -1028,7 +1028,7 @@ void context_manager::close_current_context()
|
|||
|
||||
void context_manager::switch_context(const int index, const bool force)
|
||||
{
|
||||
if(index < 0 || static_cast<size_t>(index) >= map_contexts_.size()) {
|
||||
if(index < 0 || static_cast<std::size_t>(index) >= map_contexts_.size()) {
|
||||
WRN_ED << "Invalid index in switch map context: " << index << std::endl;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
bool is_active_transitions_hotkey(const std::string& item);
|
||||
|
||||
size_t modified_maps(std::string& modified);
|
||||
std::size_t modified_maps(std::string& modified);
|
||||
|
||||
void set_update_transitions_mode(int mode)
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
return current_context_index_;
|
||||
}
|
||||
|
||||
size_t open_maps(void)
|
||||
std::size_t open_maps(void)
|
||||
{
|
||||
return map_contexts_.size();
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
/** Display a load map dialog and process user input. */
|
||||
void resize_map_dialog();
|
||||
|
||||
size_t size()
|
||||
std::size_t size()
|
||||
{
|
||||
return map_contexts_.size();
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ private:
|
|||
* @return index of the map context containing the given filename,
|
||||
* or map_contexts_.size() if not found.
|
||||
*/
|
||||
size_t check_open_map(const std::string& fn) const;
|
||||
std::size_t check_open_map(const std::string& fn) const;
|
||||
|
||||
/**
|
||||
* Check if a map is already open. If yes, switch to it
|
||||
|
|
|
@ -65,7 +65,7 @@ editor_map editor_map::from_string(const config& terrain_cfg, const std::string&
|
|||
}
|
||||
}
|
||||
|
||||
editor_map::editor_map(const config& terrain_cfg, size_t width, size_t height, const t_translation::terrain_code & filler)
|
||||
editor_map::editor_map(const config& terrain_cfg, std::size_t width, std::size_t height, const t_translation::terrain_code & filler)
|
||||
: gamemap(std::make_shared<terrain_type_data>(terrain_cfg), t_translation::write_game_map(t_translation::ter_map(width + 2, height + 2, filler)))
|
||||
, selection_()
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
/**
|
||||
* Create an editor map with the given dimensions and filler terrain
|
||||
*/
|
||||
editor_map(const config& terrain_cfg, size_t width, size_t height, const t_translation::terrain_code & filler);
|
||||
editor_map(const config& terrain_cfg, std::size_t width, std::size_t height, const t_translation::terrain_code & filler);
|
||||
|
||||
/**
|
||||
* Create an editor_map by upgrading an existing gamemap. The map data is
|
||||
|
|
|
@ -51,7 +51,7 @@ editor_team_info::editor_team_info(const team& t)
|
|||
{
|
||||
}
|
||||
|
||||
const size_t map_context::max_action_stack_size_ = 100;
|
||||
const std::size_t map_context::max_action_stack_size_ = 100;
|
||||
|
||||
map_context::map_context(const editor_map& map, bool pure_map, const config& schedule)
|
||||
: filename_()
|
||||
|
|
|
@ -452,7 +452,7 @@ protected:
|
|||
/**
|
||||
* Action stack (i.e. undo and redo) maximum size
|
||||
*/
|
||||
static const size_t max_action_stack_size_;
|
||||
static const std::size_t max_action_stack_size_;
|
||||
|
||||
/**
|
||||
* Number of actions performed since the map was saved. Zero means the map was not modified.
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
virtual void draw() = 0;
|
||||
|
||||
//group
|
||||
virtual void set_group(size_t index) = 0;
|
||||
virtual void set_group(std::size_t index) = 0;
|
||||
virtual void next_group() = 0;
|
||||
virtual void prev_group() = 0;
|
||||
virtual const std::vector<item_group>& get_groups() const = 0;
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
|
||||
//item
|
||||
virtual int num_items() = 0;
|
||||
virtual size_t start_num() = 0;
|
||||
virtual void set_start_item(size_t index) = 0;
|
||||
virtual std::size_t start_num() = 0;
|
||||
virtual void set_start_item(std::size_t index) = 0;
|
||||
|
||||
virtual bool supports_swap() { return true; }
|
||||
virtual void swap() = 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ void editor_palette<Item>::expand_palette_groups_menu(std::vector<config>& items
|
|||
std::vector<config> groups;
|
||||
const std::vector<item_group>& item_groups = get_groups();
|
||||
|
||||
for (size_t mci = 0; mci < item_groups.size(); ++mci) {
|
||||
for (std::size_t mci = 0; mci < item_groups.size(); ++mci) {
|
||||
std::string groupname = item_groups[mci].name;
|
||||
if (groupname.empty()) {
|
||||
groupname = _("(Unknown Group)");
|
||||
|
@ -145,23 +145,23 @@ void editor_palette<Item>::set_group(const std::string& id)
|
|||
}
|
||||
|
||||
template<class Item>
|
||||
void editor_palette<Item>::set_group(size_t index)
|
||||
void editor_palette<Item>::set_group(std::size_t index)
|
||||
{
|
||||
assert(groups_.size() > index);
|
||||
set_group(groups_[index].id);
|
||||
}
|
||||
|
||||
template<class Item>
|
||||
size_t editor_palette<Item>::active_group_index()
|
||||
std::size_t editor_palette<Item>::active_group_index()
|
||||
{
|
||||
assert(!active_group_.empty());
|
||||
|
||||
for (size_t i = 0 ; i < groups_.size(); i++) {
|
||||
for (std::size_t i = 0 ; i < groups_.size(); i++) {
|
||||
if (groups_[i].id == active_group_)
|
||||
return i;
|
||||
}
|
||||
|
||||
return static_cast<size_t>(-1);
|
||||
return static_cast<std::size_t>(-1);
|
||||
}
|
||||
|
||||
template<class Item>
|
||||
|
|
|
@ -28,7 +28,7 @@ class editor_palette : public tristate_palette {
|
|||
public:
|
||||
|
||||
editor_palette(editor_display &gui, const config& /*cfg*/
|
||||
, size_t item_size, size_t item_width, editor_toolkit &toolkit)
|
||||
, std::size_t item_size, std::size_t item_width, editor_toolkit &toolkit)
|
||||
: tristate_palette(gui.video())
|
||||
, groups_()
|
||||
, gui_(gui)
|
||||
|
@ -57,14 +57,14 @@ public:
|
|||
|
||||
virtual sdl_handler_vector handler_members() override;
|
||||
|
||||
void set_start_item(size_t index) override { items_start_ = index; }
|
||||
void set_start_item(std::size_t index) override { items_start_ = index; }
|
||||
|
||||
size_t start_num(void) override { return items_start_; }
|
||||
std::size_t start_num(void) override { return items_start_; }
|
||||
|
||||
/** Menu expanding for palette group list */
|
||||
void expand_palette_groups_menu(std::vector<config>& items, int i) override;
|
||||
|
||||
void set_group(size_t index) override;
|
||||
void set_group(std::size_t index) override;
|
||||
// int active_group();
|
||||
|
||||
const std::vector<item_group>& get_groups() const override { return groups_; }
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
size_t active_group_index();
|
||||
std::size_t active_group_index();
|
||||
|
||||
virtual void draw_item(const Item& item, surface& item_image, std::stringstream& tooltip) = 0;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
std::vector<gui::widget>* get_widgets() { return nullptr; }
|
||||
|
||||
//group
|
||||
virtual void set_group(size_t /*index*/) override {}
|
||||
virtual void set_group(std::size_t /*index*/) override {}
|
||||
virtual void next_group() override {}
|
||||
virtual void prev_group() override {}
|
||||
virtual const std::vector<item_group>& get_groups() const override { static const std::vector<item_group> empty; return empty; }
|
||||
|
@ -70,8 +70,8 @@ public:
|
|||
|
||||
//item
|
||||
virtual int num_items() override {return 0;}
|
||||
virtual size_t start_num() override {return 0;}
|
||||
virtual void set_start_item(size_t /*index*/) override {}
|
||||
virtual std::size_t start_num() override {return 0;}
|
||||
virtual void set_start_item(std::size_t /*index*/) override {}
|
||||
virtual bool supports_swap() override { return false; }
|
||||
virtual void swap() override {}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ public:
|
|||
|
||||
virtual sdl_handler_vector handler_members() override;
|
||||
|
||||
void set_start_item(size_t index) override { items_start_ = index; }
|
||||
void set_start_item(std::size_t index) override { items_start_ = index; }
|
||||
|
||||
size_t start_num(void) override { return items_start_; }
|
||||
std::size_t start_num(void) override { return items_start_; }
|
||||
|
||||
/** Menu expanding for palette group list */
|
||||
void expand_palette_groups_menu(std::vector<config>& items, int i) override
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
items.erase(items.begin() + i);
|
||||
}
|
||||
|
||||
virtual void set_group(size_t /*index*/) override {}
|
||||
virtual void set_group(std::size_t /*index*/) override {}
|
||||
virtual void next_group() override {}
|
||||
virtual void prev_group() override {}
|
||||
virtual const std::vector<item_group>& get_groups() const override { static const std::vector<item_group> empty; return empty; }
|
||||
|
|
|
@ -39,7 +39,7 @@ palette_manager::palette_manager(editor_display& gui, const config& cfg
|
|||
item_palette_->setup(cfg);
|
||||
}
|
||||
|
||||
void palette_manager::set_group(size_t index)
|
||||
void palette_manager::set_group(std::size_t index)
|
||||
{
|
||||
active_palette().set_group(index);
|
||||
scroll_top();
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
palette_manager(editor_display &gui, const config& cfg
|
||||
, editor_toolkit &toolkit);
|
||||
|
||||
void set_group(size_t index);
|
||||
void set_group(std::size_t index);
|
||||
|
||||
/** Scroll the editor-palette up one step if possible. */
|
||||
void scroll_up();
|
||||
|
|
|
@ -238,7 +238,7 @@ struct file_tree_checksum
|
|||
void write(config& cfg) const;
|
||||
void reset() {nfiles = 0;modified = 0;sum_size=0;}
|
||||
// @todo make variables private!
|
||||
size_t nfiles, sum_size;
|
||||
std::size_t nfiles, sum_size;
|
||||
time_t modified;
|
||||
bool operator==(const file_tree_checksum &rhs) const;
|
||||
bool operator!=(const file_tree_checksum &rhs) const
|
||||
|
|
|
@ -81,9 +81,9 @@ namespace {
|
|||
char_t_to*& to_next;
|
||||
char_t_to* to_end;
|
||||
|
||||
bool can_push(size_t count) const
|
||||
bool can_push(std::size_t count) const
|
||||
{
|
||||
return static_cast<size_t>(to_end - to_next) > count;
|
||||
return static_cast<std::size_t>(to_end - to_next) > count;
|
||||
}
|
||||
|
||||
void push(char_t_to val)
|
||||
|
@ -864,11 +864,11 @@ void write_file(const std::string& fname, const std::string& data)
|
|||
scoped_ostream os = ostream_file(fname);
|
||||
os->exceptions(std::ios_base::goodbit);
|
||||
|
||||
const size_t block_size = 4096;
|
||||
const std::size_t block_size = 4096;
|
||||
char buf[block_size];
|
||||
|
||||
for(size_t i = 0; i < data.size(); i += block_size) {
|
||||
const size_t bytes = std::min<size_t>(block_size,data.size() - i);
|
||||
for(std::size_t i = 0; i < data.size(); i += block_size) {
|
||||
const std::size_t bytes = std::min<std::size_t>(block_size,data.size() - i);
|
||||
std::copy(data.begin() + i, data.begin() + i + bytes,buf);
|
||||
|
||||
os->write(buf, bytes);
|
||||
|
|
|
@ -32,10 +32,10 @@ static int64_t ifs_size (struct SDL_RWops * context);
|
|||
static int64_t ofs_size (struct SDL_RWops * context);
|
||||
static int64_t SDLCALL ifs_seek(struct SDL_RWops *context, int64_t offset, int whence);
|
||||
static int64_t SDLCALL ofs_seek(struct SDL_RWops *context, int64_t offset, int whence);
|
||||
static size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
|
||||
static size_t SDLCALL ofs_read(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum);
|
||||
static size_t SDLCALL ifs_write(struct SDL_RWops *context, const void *ptr, size_t size, size_t num);
|
||||
static size_t SDLCALL ofs_write(struct SDL_RWops *context, const void *ptr, size_t size, size_t num);
|
||||
static std::size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, std::size_t size, std::size_t maxnum);
|
||||
static std::size_t SDLCALL ofs_read(struct SDL_RWops *context, void *ptr, std::size_t size, std::size_t maxnum);
|
||||
static std::size_t SDLCALL ifs_write(struct SDL_RWops *context, const void *ptr, std::size_t size, std::size_t num);
|
||||
static std::size_t SDLCALL ofs_write(struct SDL_RWops *context, const void *ptr, std::size_t size, std::size_t num);
|
||||
static int SDLCALL ifs_close(struct SDL_RWops *context);
|
||||
static int SDLCALL ofs_close(struct SDL_RWops *context);
|
||||
|
||||
|
@ -160,7 +160,7 @@ static int64_t SDLCALL ofs_seek(struct SDL_RWops *context, int64_t offset, int w
|
|||
return static_cast<int>(pos);
|
||||
}
|
||||
|
||||
static size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, size_t size, size_t maxnum) {
|
||||
static std::size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, std::size_t size, std::size_t maxnum) {
|
||||
std::istream *ifs = static_cast<std::istream*>(context->hidden.unknown.data1);
|
||||
|
||||
// This seems overly simplistic, but it's the same as mem_read's implementation
|
||||
|
@ -173,16 +173,16 @@ static size_t SDLCALL ifs_read(struct SDL_RWops *context, void *ptr, size_t size
|
|||
|
||||
return static_cast<int>(num);
|
||||
}
|
||||
static size_t SDLCALL ofs_read(struct SDL_RWops * /*context*/, void * /*ptr*/, size_t /*size*/, size_t /*maxnum*/) {
|
||||
static std::size_t SDLCALL ofs_read(struct SDL_RWops * /*context*/, void * /*ptr*/, std::size_t /*size*/, std::size_t /*maxnum*/) {
|
||||
SDL_SetError("Reading not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static size_t SDLCALL ifs_write(struct SDL_RWops * /*context*/, const void * /*ptr*/, size_t /*size*/, size_t /*num*/) {
|
||||
static std::size_t SDLCALL ifs_write(struct SDL_RWops * /*context*/, const void * /*ptr*/, std::size_t /*size*/, std::size_t /*num*/) {
|
||||
SDL_SetError("Writing not implemented");
|
||||
return 0;
|
||||
}
|
||||
static size_t SDLCALL ofs_write(struct SDL_RWops *context, const void *ptr, size_t size, size_t num) {
|
||||
static std::size_t SDLCALL ofs_write(struct SDL_RWops *context, const void *ptr, std::size_t size, std::size_t num) {
|
||||
std::ostream *ofs = static_cast<std::ostream*>(context->hidden.unknown.data1);
|
||||
|
||||
const std::streampos before = ofs->tellp();
|
||||
|
|
|
@ -75,7 +75,7 @@ void floating_label::move(double xmove, double ymove)
|
|||
ypos_ += ymove;
|
||||
}
|
||||
|
||||
int floating_label::xpos(size_t width) const
|
||||
int floating_label::xpos(std::size_t width) const
|
||||
{
|
||||
int xpos = int(xpos_);
|
||||
if(align_ == font::CENTER_ALIGN) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
int xpos(size_t width) const;
|
||||
int xpos(std::size_t width) const;
|
||||
surface surf_, buf_;
|
||||
std::string text_;
|
||||
int font_size_;
|
||||
|
|
|
@ -29,7 +29,7 @@ const int
|
|||
SIZE_XLARGE = 24 * SIZE_NORMAL / 14
|
||||
;
|
||||
|
||||
const size_t max_text_line_width = 4096;
|
||||
const std::size_t max_text_line_width = 4096;
|
||||
|
||||
const std::string
|
||||
ellipsis = "...",
|
||||
|
|
|
@ -32,7 +32,7 @@ inline int relative_size(int size)
|
|||
}
|
||||
|
||||
// GUI1 built-in maximum
|
||||
extern const size_t max_text_line_width;
|
||||
extern const std::size_t max_text_line_width;
|
||||
|
||||
// String constants
|
||||
extern const std::string
|
||||
|
|
|
@ -58,11 +58,11 @@ struct subset_descriptor
|
|||
for (const std::string & i : ranges) {
|
||||
std::vector<std::string> r = utils::split(i, '-');
|
||||
if(r.size() == 1) {
|
||||
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
|
||||
std::size_t r1 = lexical_cast_default<std::size_t>(r[0], 0);
|
||||
present_codepoints.emplace_back(r1, r1);
|
||||
} else if(r.size() == 2) {
|
||||
size_t r1 = lexical_cast_default<size_t>(r[0], 0);
|
||||
size_t r2 = lexical_cast_default<size_t>(r[1], 0);
|
||||
std::size_t r1 = lexical_cast_default<std::size_t>(r[0], 0);
|
||||
std::size_t r2 = lexical_cast_default<std::size_t>(r[1], 0);
|
||||
|
||||
present_codepoints.emplace_back(r1, r2);
|
||||
}
|
||||
|
|
|
@ -404,8 +404,8 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
|
|||
utf8::iterator ch(unwrapped_text);
|
||||
std::string current_word;
|
||||
std::string current_line;
|
||||
size_t line_width = 0;
|
||||
size_t current_height = 0;
|
||||
std::size_t line_width = 0;
|
||||
std::size_t current_height = 0;
|
||||
bool line_break = false;
|
||||
bool first = true;
|
||||
bool start_of_line = true;
|
||||
|
@ -470,7 +470,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
|
|||
start_of_line = true;
|
||||
} else {
|
||||
|
||||
const size_t word_width = line_size(current_word, preferences::font_scaled(font_sz), style).w;
|
||||
const std::size_t word_width = line_size(current_word, preferences::font_scaled(font_sz), style).w;
|
||||
|
||||
line_width += word_width;
|
||||
|
||||
|
@ -490,7 +490,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
|
|||
|
||||
if(line_break || (current_word.empty() && ch == end)) {
|
||||
SDL_Rect size = line_size(current_line, preferences::font_scaled(font_sz), style);
|
||||
if(max_height > 0 && current_height + size.h >= size_t(max_height)) {
|
||||
if(max_height > 0 && current_height + size.h >= std::size_t(max_height)) {
|
||||
return wrapped_text;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ TTF_Font* sdl_ttf::get_font(font_id id)
|
|||
|
||||
// There's no record, so we need to try to find a solution for this font
|
||||
// and make a record of it. If the indices are out of bounds don't bother though.
|
||||
if(id.subset < 0 || size_t(id.subset) >= font_names.size()) {
|
||||
if(id.subset < 0 || std::size_t(id.subset) >= font_names.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ static surface render_text(const std::string& text, int fontsize, const color_t&
|
|||
const std::vector<std::string> lines = utils::split(text, '\n', 0);
|
||||
std::vector<std::vector<surface>> surfaces;
|
||||
surfaces.reserve(lines.size());
|
||||
size_t width = 0, height = 0;
|
||||
std::size_t width = 0, height = 0;
|
||||
|
||||
for(std::vector< std::string >::const_iterator ln = lines.begin(), ln_end = lines.end(); ln != ln_end; ++ln) {
|
||||
|
||||
|
@ -294,7 +294,7 @@ static surface render_text(const std::string& text, int fontsize, const color_t&
|
|||
|
||||
if (!res.empty()) {
|
||||
surfaces.push_back(res);
|
||||
width = std::max<size_t>(cached_surf.width(), width);
|
||||
width = std::max<std::size_t>(cached_surf.width(), width);
|
||||
height += cached_surf.height();
|
||||
}
|
||||
}
|
||||
|
@ -309,10 +309,10 @@ static surface render_text(const std::string& text, int fontsize, const color_t&
|
|||
if (res.null())
|
||||
return res;
|
||||
|
||||
size_t ypos = 0;
|
||||
std::size_t ypos = 0;
|
||||
for(std::vector< std::vector<surface>>::iterator i = surfaces.begin(),
|
||||
i_end = surfaces.end(); i != i_end; ++i) {
|
||||
size_t xpos = 0;
|
||||
std::size_t xpos = 0;
|
||||
height = 0;
|
||||
|
||||
for(std::vector<surface>::iterator j = i->begin(),
|
||||
|
@ -320,7 +320,7 @@ static surface render_text(const std::string& text, int fontsize, const color_t&
|
|||
SDL_Rect dstrect = sdl::create_rect(xpos, ypos, 0, 0);
|
||||
blit_surface(*j, nullptr, res, &dstrect);
|
||||
xpos += (*j)->w;
|
||||
height = std::max<size_t>((*j)->h, height);
|
||||
height = std::max<std::size_t>((*j)->h, height);
|
||||
}
|
||||
ypos += height;
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ void sdl_ttf::set_font_list(const std::vector<subset_descriptor>& fontlist)
|
|||
|
||||
DBG_FT << "Set the font list. The styled font families are:\n";
|
||||
|
||||
for (size_t i = 0; i < font_names.size(); ++i) {
|
||||
for (std::size_t i = 0; i < font_names.size(); ++i) {
|
||||
DBG_FT << "[" << i << "]:\t\tbase:\t'" << font_names[i] << "'\tbold:\t'" << bold_names[i] << "'\titalic:\t'" << italic_names[i] << "'\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,13 +166,13 @@ point pango_text::get_cursor_position(
|
|||
return point(0, 0);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < line; ++i) {
|
||||
for(std::size_t i = 0; i < line; ++i) {
|
||||
pango_layout_iter_next_line(itor.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Go the wanted column.
|
||||
for(size_t i = 0; i < column; ++i) {
|
||||
for(std::size_t i = 0; i < column; ++i) {
|
||||
if(!pango_layout_iter_next_char(itor.get())) {
|
||||
// It seems that the documentation is wrong and causes and off by
|
||||
// one error... the result should be false if already at the end of
|
||||
|
@ -195,7 +195,7 @@ point pango_text::get_cursor_position(
|
|||
return point(PANGO_PIXELS(rect.x), PANGO_PIXELS(rect.y));
|
||||
}
|
||||
|
||||
size_t pango_text::get_maximum_length() const
|
||||
std::size_t pango_text::get_maximum_length() const
|
||||
{
|
||||
return maximum_length_;
|
||||
}
|
||||
|
@ -215,16 +215,16 @@ std::string pango_text::get_token(const point & position, const char * delim) co
|
|||
|
||||
std::string d(delim);
|
||||
|
||||
if (index < 0 || (static_cast<size_t>(index) >= txt.size()) || d.find(txt.at(index)) != std::string::npos) {
|
||||
if (index < 0 || (static_cast<std::size_t>(index) >= txt.size()) || d.find(txt.at(index)) != std::string::npos) {
|
||||
return ""; // if the index is out of bounds, or the index character is a delimiter, return nothing
|
||||
}
|
||||
|
||||
size_t l = index;
|
||||
std::size_t l = index;
|
||||
while (l > 0 && (d.find(txt.at(l-1)) == std::string::npos)) {
|
||||
--l;
|
||||
}
|
||||
|
||||
size_t r = index + 1;
|
||||
std::size_t r = index + 1;
|
||||
while (r < txt.size() && (d.find(txt.at(r)) == std::string::npos)) {
|
||||
++r;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ point pango_text::get_column_line(const point& position) const
|
|||
* text is available. Haven't found what the best thing to do would be.
|
||||
* Until that time leave it as is.
|
||||
*/
|
||||
for(size_t i = 0; ; ++i) {
|
||||
for(std::size_t i = 0; ; ++i) {
|
||||
const int pos = this->get_cursor_position(i, line).x;
|
||||
|
||||
if(pos == offset) {
|
||||
|
@ -434,7 +434,7 @@ pango_text &pango_text::set_alignment(const PangoAlignment alignment)
|
|||
return *this;
|
||||
}
|
||||
|
||||
pango_text& pango_text::set_maximum_length(const size_t maximum_length)
|
||||
pango_text& pango_text::set_maximum_length(const std::size_t maximum_length)
|
||||
{
|
||||
if(maximum_length != maximum_length_) {
|
||||
maximum_length_ = maximum_length;
|
||||
|
@ -616,7 +616,7 @@ static void from_cairo_format(uint32_t & c)
|
|||
c = (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16) | (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b);
|
||||
}
|
||||
|
||||
void pango_text::render(PangoLayout& layout, const PangoRectangle& rect, const size_t surface_buffer_offset, const unsigned stride)
|
||||
void pango_text::render(PangoLayout& layout, const PangoRectangle& rect, const std::size_t surface_buffer_offset, const unsigned stride)
|
||||
{
|
||||
int width = rect.x + rect.width;
|
||||
int height = rect.y + rect.height;
|
||||
|
@ -728,7 +728,7 @@ void pango_text::rerender(const bool force)
|
|||
}
|
||||
}
|
||||
|
||||
void pango_text::create_surface_buffer(const size_t size) const
|
||||
void pango_text::create_surface_buffer(const std::size_t size) const
|
||||
{
|
||||
// Clear surface.
|
||||
surface_.assign(nullptr);
|
||||
|
@ -769,7 +769,7 @@ std::vector<std::string> pango_text::find_links(utils::string_view text) const {
|
|||
std::vector<std::string> links;
|
||||
|
||||
int last_delim = -1;
|
||||
for (size_t index = 0; index < text.size(); ++index) {
|
||||
for (std::size_t index = 0; index < text.size(); ++index) {
|
||||
if (delim.find(text[index]) != std::string::npos) {
|
||||
// want to include chars from range since last token, don't want to include any delimiters
|
||||
utils::string_view token = text.substr(last_delim + 1, index - last_delim - 1);
|
||||
|
|
|
@ -163,7 +163,7 @@ public:
|
|||
* @returns The maximum length of the text. The length of text
|
||||
* should not exceed this value.
|
||||
*/
|
||||
size_t get_maximum_length() const;
|
||||
std::size_t get_maximum_length() const;
|
||||
|
||||
/**
|
||||
* Gets the largest collection of characters, including the token at position,
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
* The text set is UTF-8 so the length of the string might not be the length
|
||||
* of the text.
|
||||
*/
|
||||
size_t get_length() const { return length_; }
|
||||
std::size_t get_length() const { return length_; }
|
||||
|
||||
/**
|
||||
* Sets the text to render.
|
||||
|
@ -241,7 +241,7 @@ public:
|
|||
|
||||
pango_text& set_alignment(const PangoAlignment alignment);
|
||||
|
||||
pango_text& set_maximum_length(const size_t maximum_length);
|
||||
pango_text& set_maximum_length(const std::size_t maximum_length);
|
||||
|
||||
bool link_aware() const { return link_aware_; }
|
||||
|
||||
|
@ -341,7 +341,7 @@ private:
|
|||
PangoAlignment alignment_;
|
||||
|
||||
/** The maximum length of the text. */
|
||||
size_t maximum_length_;
|
||||
std::size_t maximum_length_;
|
||||
|
||||
/**
|
||||
* The text has two dirty states:
|
||||
|
@ -353,7 +353,7 @@ private:
|
|||
mutable bool calculation_dirty_;
|
||||
|
||||
/** Length of the text. */
|
||||
mutable size_t length_;
|
||||
mutable std::size_t length_;
|
||||
|
||||
/**
|
||||
* Recalculates the text layout.
|
||||
|
@ -381,7 +381,7 @@ private:
|
|||
void rerender(const bool force = false);
|
||||
|
||||
void render(PangoLayout& layout, const PangoRectangle& rect,
|
||||
const size_t surface_buffer_offset, const unsigned stride);
|
||||
const std::size_t surface_buffer_offset, const unsigned stride);
|
||||
|
||||
/**
|
||||
* Buffer to store the image on.
|
||||
|
@ -404,7 +404,7 @@ private:
|
|||
*
|
||||
* @param size The required size of the buffer.
|
||||
*/
|
||||
void create_surface_buffer(const size_t size) const;
|
||||
void create_surface_buffer(const std::size_t size) const;
|
||||
|
||||
/**
|
||||
* Sets the markup'ed text.
|
||||
|
|
|
@ -36,7 +36,7 @@ void text_cache::resize(unsigned int size)
|
|||
|
||||
text_surface &text_cache::find(const text_surface& t)
|
||||
{
|
||||
static size_t lookup_ = 0, hit_ = 0;
|
||||
static std::size_t lookup_ = 0, hit_ = 0;
|
||||
text_list::iterator it_bgn = cache_.begin(), it_end = cache_.end();
|
||||
text_list::iterator it = std::find(it_bgn, it_end, t);
|
||||
if (it != it_end) {
|
||||
|
|
|
@ -148,7 +148,7 @@ void text_surface::measure() const
|
|||
}
|
||||
}
|
||||
|
||||
size_t text_surface::width() const
|
||||
std::size_t text_surface::width() const
|
||||
{
|
||||
if (w_ == -1) {
|
||||
if(chunks_.empty())
|
||||
|
@ -158,7 +158,7 @@ size_t text_surface::width() const
|
|||
return w_;
|
||||
}
|
||||
|
||||
size_t text_surface::height() const
|
||||
std::size_t text_surface::height() const
|
||||
{
|
||||
if (h_ == -1) {
|
||||
if(chunks_.empty())
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
void set_text(const std::string& str);
|
||||
|
||||
void measure() const;
|
||||
size_t width() const;
|
||||
size_t height() const;
|
||||
std::size_t width() const;
|
||||
std::size_t height() const;
|
||||
#ifdef HAVE_FRIBIDI
|
||||
bool is_rtl() const { return is_rtl_; } // Right-To-Left alignment
|
||||
#endif
|
||||
|
|
|
@ -327,7 +327,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
private:
|
||||
size_t level_;
|
||||
std::size_t level_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -354,7 +354,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
private:
|
||||
size_t level_;
|
||||
std::size_t level_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -474,9 +474,9 @@ public:
|
|||
} else if(key == "word" || key == "words") {
|
||||
std::vector<variant> words;
|
||||
const std::string& str = string_.as_string();
|
||||
size_t next_space = 0;
|
||||
std::size_t next_space = 0;
|
||||
do {
|
||||
size_t last_space = next_space;
|
||||
std::size_t last_space = next_space;
|
||||
next_space = str.find_first_of(" \t", next_space);
|
||||
words.emplace_back(str.substr(last_space, next_space - last_space));
|
||||
next_space = str.find_first_not_of(" \t", next_space);
|
||||
|
@ -1046,7 +1046,7 @@ private:
|
|||
}
|
||||
|
||||
std::string res = str_.as_string();
|
||||
for(size_t i = 0; i < subs_.size(); ++i) {
|
||||
for(std::size_t i = 0; i < subs_.size(); ++i) {
|
||||
const int j = subs_.size() - i - 1;
|
||||
const substitution& sub = subs_[i];
|
||||
add_debug_info(fdb, j, "[string subst]");
|
||||
|
|
|
@ -110,7 +110,7 @@ DEFINE_WFL_FUNCTION(dir, 1, 1)
|
|||
formula_input_vector inputs = callable->inputs();
|
||||
|
||||
std::vector<variant> res;
|
||||
for(size_t i = 0; i < inputs.size(); ++i) {
|
||||
for(std::size_t i = 0; i < inputs.size(); ++i) {
|
||||
const formula_input& input = inputs[i];
|
||||
res.emplace_back(input.name);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ DEFINE_WFL_FUNCTION(dir, 1, 1)
|
|||
|
||||
DEFINE_WFL_FUNCTION(if, 2, -1)
|
||||
{
|
||||
for(size_t n = 0; n < args().size() - 1; n += 2) {
|
||||
for(std::size_t n = 0; n < args().size() - 1; n += 2) {
|
||||
if(args()[n]->evaluate(variables, fdb).as_bool()) {
|
||||
return args()[n + 1]->evaluate(variables, fdb);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ DEFINE_WFL_FUNCTION(switch, 3, -1)
|
|||
{
|
||||
variant var = args()[0]->evaluate(variables, fdb);
|
||||
|
||||
for(size_t n = 1; n < args().size() - 1; n += 2) {
|
||||
for(std::size_t n = 1; n < args().size() - 1; n += 2) {
|
||||
variant val = args()[n]->evaluate(variables, fdb);
|
||||
|
||||
if(val == var) {
|
||||
|
@ -175,7 +175,7 @@ DEFINE_WFL_FUNCTION(min, 1, -1)
|
|||
res = *std::min_element(res.begin(), res.end());
|
||||
}
|
||||
|
||||
for(size_t n = 1; n < args().size(); ++n) {
|
||||
for(std::size_t n = 1; n < args().size(); ++n) {
|
||||
variant v = args()[n]->evaluate(variables, fdb);
|
||||
|
||||
if(v.is_list()) {
|
||||
|
@ -205,7 +205,7 @@ DEFINE_WFL_FUNCTION(max, 1, -1)
|
|||
res = *std::max_element(res.begin(), res.end());
|
||||
}
|
||||
|
||||
for(size_t n = 1; n < args().size(); ++n) {
|
||||
for(std::size_t n = 1; n < args().size(); ++n) {
|
||||
variant v = args()[n]->evaluate(variables, fdb);
|
||||
|
||||
if(v.is_list()) {
|
||||
|
@ -355,7 +355,7 @@ DEFINE_WFL_FUNCTION(tomap, 1, 2)
|
|||
return variant();
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < var_1.num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < var_1.num_elements(); ++i) {
|
||||
tmp[var_1[i]] = var_2[i];
|
||||
}
|
||||
} else {
|
||||
|
@ -389,7 +389,7 @@ DEFINE_WFL_FUNCTION(substring, 2, 3)
|
|||
offset = 0;
|
||||
}
|
||||
} else {
|
||||
if(static_cast<size_t>(offset) >= result.size()) {
|
||||
if(static_cast<std::size_t>(offset) >= result.size()) {
|
||||
return variant(std::string());
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ DEFINE_WFL_FUNCTION(replace, 3, 4)
|
|||
offset = 0;
|
||||
}
|
||||
} else {
|
||||
if(static_cast<size_t>(offset) >= result.size()) {
|
||||
if(static_cast<std::size_t>(offset) >= result.size()) {
|
||||
return variant(result);
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ DEFINE_WFL_FUNCTION(insert, 3, 3)
|
|||
if(offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
} else if(static_cast<size_t>(offset) >= result.size()) {
|
||||
} else if(static_cast<std::size_t>(offset) >= result.size()) {
|
||||
return variant(result + insert);
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ DEFINE_WFL_FUNCTION(index_of, 2, 2)
|
|||
const variant value = args()[0]->evaluate(variables, fdb);
|
||||
const variant list = args()[1]->evaluate(variables, fdb);
|
||||
|
||||
for(size_t i = 0; i < list.num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < list.num_elements(); ++i) {
|
||||
if(list[i] == value) {
|
||||
return variant(i);
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ DEFINE_WFL_FUNCTION(sort, 1, 2)
|
|||
std::vector<variant> vars;
|
||||
vars.reserve(list.num_elements());
|
||||
|
||||
for(size_t n = 0; n != list.num_elements(); ++n) {
|
||||
for(std::size_t n = 0; n != list.num_elements(); ++n) {
|
||||
vars.push_back(list[n]);
|
||||
}
|
||||
|
||||
|
@ -775,7 +775,7 @@ DEFINE_WFL_FUNCTION(find_string, 2, 2)
|
|||
const std::string str = args()[0]->evaluate(variables, fdb).as_string();
|
||||
const std::string key = args()[1]->evaluate(variables, fdb).as_string();
|
||||
|
||||
size_t pos = str.find(key);
|
||||
std::size_t pos = str.find(key);
|
||||
return variant(static_cast<int>(pos));
|
||||
}
|
||||
|
||||
|
@ -916,7 +916,7 @@ namespace
|
|||
{
|
||||
struct indexer
|
||||
{
|
||||
explicit indexer(size_t i)
|
||||
explicit indexer(std::size_t i)
|
||||
: i(i)
|
||||
{
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ struct indexer
|
|||
}
|
||||
}
|
||||
|
||||
size_t i;
|
||||
std::size_t i;
|
||||
};
|
||||
|
||||
/** @todo: replace with lambda? */
|
||||
|
@ -970,10 +970,10 @@ DEFINE_WFL_FUNCTION(zip, 1, -1)
|
|||
|
||||
// So basically this does [[a,b,c],[d,e,f],[x,y,z]] -> [[a,d,x],[b,e,y],[c,f,z]]
|
||||
// Or [[a,b,c,d],[x,y,z]] -> [[a,x],[b,y],[c,z],[d,null()]]
|
||||
size_t max_i = std::max_element(input.begin(), input.end(), comparator())->num_elements();
|
||||
std::size_t max_i = std::max_element(input.begin(), input.end(), comparator())->num_elements();
|
||||
output.reserve(max_i);
|
||||
|
||||
for(size_t i = 0; i < max_i; i++) {
|
||||
for(std::size_t i = 0; i < max_i; i++) {
|
||||
std::vector<variant> elem(input.size());
|
||||
std::transform(input.begin(), input.end(), elem.begin(), indexer(i));
|
||||
output.emplace_back(elem);
|
||||
|
@ -1036,7 +1036,7 @@ DEFINE_WFL_FUNCTION(sum, 1, 2)
|
|||
}
|
||||
}
|
||||
|
||||
for(size_t n = 0; n != items.num_elements(); ++n) {
|
||||
for(std::size_t n = 0; n != items.num_elements(); ++n) {
|
||||
res = res + items[n];
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ DEFINE_WFL_FUNCTION(size, 1, 1)
|
|||
DEFINE_WFL_FUNCTION(null, 0, -1)
|
||||
{
|
||||
if(!args().empty()) {
|
||||
for(size_t i = 0; i < args().size(); ++i) {
|
||||
for(std::size_t i = 0; i < args().size(); ++i) {
|
||||
args()[i]->evaluate(variables, fdb);
|
||||
}
|
||||
}
|
||||
|
@ -1367,7 +1367,7 @@ formula_function_expression::formula_function_expression(const std::string& name
|
|||
, arg_names_(arg_names)
|
||||
, star_arg_(-1)
|
||||
{
|
||||
for(size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
for(std::size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
if(arg_names_.empty() == false && arg_names_[n][arg_names_[n].size() - 1] == '*') {
|
||||
arg_names_[n].resize(arg_names_[n].size() - 1);
|
||||
star_arg_ = n;
|
||||
|
@ -1386,7 +1386,7 @@ variant formula_function_expression::execute(const formula_callable& variables,
|
|||
const int begin_time = SDL_GetTicks();
|
||||
map_formula_callable callable;
|
||||
|
||||
for(size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
for(std::size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
variant var = args()[n]->evaluate(variables, fdb);
|
||||
callable.add(arg_names_[n], var);
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ variant formula_function_expression::execute(const formula_callable& variables,
|
|||
if(!precondition_->evaluate(callable, fdb).as_bool()) {
|
||||
DBG_NG << "FAILED function precondition for function '" << formula_->str() << "' with arguments: ";
|
||||
|
||||
for(size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
for(std::size_t n = 0; n != arg_names_.size(); ++n) {
|
||||
DBG_NG << " arg " << (n + 1) << ": " << args()[n]->evaluate(variables, fdb).to_debug_string() << "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,11 +103,11 @@ public:
|
|||
: formula_expression(name)
|
||||
, args_(args)
|
||||
{
|
||||
if(min_args >= 0 && args_.size() < static_cast<size_t>(min_args)) {
|
||||
if(min_args >= 0 && args_.size() < static_cast<std::size_t>(min_args)) {
|
||||
throw formula_error("Too few arguments", "", "", 0);
|
||||
}
|
||||
|
||||
if(max_args >= 0 && args_.size() > static_cast<size_t>(max_args)) {
|
||||
if(max_args >= 0 && args_.size() > static_cast<std::size_t>(max_args)) {
|
||||
throw formula_error("Too many arguments", "", "", 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ DEFINE_WFL_FUNCTION(locations_in_radius, 2, 2)
|
|||
v.reserve(res.size() + 1);
|
||||
v.emplace_back(std::make_shared<location_callable>(loc));
|
||||
|
||||
for(size_t n = 0; n != res.size(); ++n) {
|
||||
for(std::size_t n = 0; n != res.size(); ++n) {
|
||||
if(resources::gameboard->map().on_board(res[n])) {
|
||||
v.emplace_back(std::make_shared<location_callable>(res[n]));
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ std::string format_conjunct_list(const t_string& empty, const std::vector<t_stri
|
|||
// TRANSLATORS: Formats the first two elements of a conjunctive list.
|
||||
std::string prefix = VGETTEXT("conjunct start^$first, $second", {{"first", elems[0]}, {"second", elems[1]}});
|
||||
// For size=3 this loop is not entered
|
||||
for(size_t i = 2; i < elems.size() - 1; i++) {
|
||||
for(std::size_t i = 2; i < elems.size() - 1; i++) {
|
||||
// TRANSLATORS: Formats successive elements of a conjunctive list.
|
||||
prefix = VGETTEXT("conjunct mid^$prefix, $next", {{"prefix", prefix}, {"next", elems[i]}});
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ std::string format_disjunct_list(const t_string& empty, const std::vector<t_stri
|
|||
// TRANSLATORS: Formats the first two elements of a disjunctive list.
|
||||
std::string prefix = VGETTEXT("disjunct start^$first, $second", {{"first", elems[0]}, {"second", elems[1]}});
|
||||
// For size=3 this loop is not entered
|
||||
for(size_t i = 2; i < elems.size() - 1; i++) {
|
||||
for(std::size_t i = 2; i < elems.size() - 1; i++) {
|
||||
// TRANSLATORS: Formats successive elements of a disjunctive list.
|
||||
prefix = VGETTEXT("disjunct mid^$prefix, $next", {{"prefix", prefix}, {"next", elems[i]}});
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ variant& variant::operator=(const variant& v)
|
|||
return *this;
|
||||
}
|
||||
|
||||
variant variant::operator[](size_t n) const
|
||||
variant variant::operator[](std::size_t n) const
|
||||
{
|
||||
if(is_callable()) {
|
||||
return *this;
|
||||
|
@ -219,7 +219,7 @@ variant variant::operator[](const variant& v) const
|
|||
} else if(is_list()) {
|
||||
if(v.is_list()) {
|
||||
std::vector<variant> slice;
|
||||
for(size_t i = 0; i < v.num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < v.num_elements(); ++i) {
|
||||
slice.push_back((*this)[v[i]]);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ bool variant::is_empty() const
|
|||
return value_->is_empty();
|
||||
}
|
||||
|
||||
size_t variant::num_elements() const
|
||||
std::size_t variant::num_elements() const
|
||||
{
|
||||
if(!is_list() && !is_map()) {
|
||||
throw type_error(was_expecting("a list or a map", *this));
|
||||
|
@ -572,11 +572,11 @@ variant variant::concatenate(const variant& v) const
|
|||
std::vector<variant> res;
|
||||
res.reserve(num_elements() + v.num_elements());
|
||||
|
||||
for(size_t i = 0; i < num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < num_elements(); ++i) {
|
||||
res.push_back((*this)[i]);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < v.num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < v.num_elements(); ++i) {
|
||||
res.push_back(v[i]);
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ variant variant::execute_variant(const variant& var)
|
|||
{
|
||||
std::stack<variant> vars;
|
||||
if(var.is_list()) {
|
||||
for(size_t n = 1; n <= var.num_elements(); ++n) {
|
||||
for(std::size_t n = 1; n <= var.num_elements(); ++n) {
|
||||
vars.push(var[var.num_elements() - n]);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -46,10 +46,10 @@ public:
|
|||
|
||||
variant& operator=(const variant& v);
|
||||
|
||||
variant operator[](size_t n) const;
|
||||
variant operator[](std::size_t n) const;
|
||||
variant operator[](const variant& v) const;
|
||||
|
||||
size_t num_elements() const;
|
||||
std::size_t num_elements() const;
|
||||
bool is_empty() const;
|
||||
|
||||
variant get_member(const std::string& name) const;
|
||||
|
|
|
@ -301,7 +301,7 @@ variant variant_list::list_op(value_base_ptr second, std::function<variant(varia
|
|||
std::vector<variant> res;
|
||||
res.reserve(num_elements());
|
||||
|
||||
for(size_t i = 0; i < num_elements(); ++i) {
|
||||
for(std::size_t i = 0; i < num_elements(); ++i) {
|
||||
res.push_back(op_func(get_container()[i], other_list->get_container()[i]));
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ bool variant_list::equals(variant_value_base& other) const
|
|||
return false;
|
||||
}
|
||||
|
||||
for(size_t n = 0; n < num_elements(); ++n) {
|
||||
for(std::size_t n = 0; n < num_elements(); ++n) {
|
||||
if(get_container()[n] != other_container[n]) {
|
||||
return false;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ bool variant_list::less_than(variant_value_base& other) const
|
|||
{
|
||||
const auto& other_container = value_ref_cast<variant_list>(other).get_container();
|
||||
|
||||
for(size_t n = 0; n != num_elements() && n != other.num_elements(); ++n) {
|
||||
for(std::size_t n = 0; n != num_elements() && n != other.num_elements(); ++n) {
|
||||
if(get_container()[n] < other_container[n]) {
|
||||
return true;
|
||||
} else if(get_container()[n] > other_container[n]) {
|
||||
|
|
|
@ -90,7 +90,7 @@ class variant_value_base
|
|||
{
|
||||
public:
|
||||
/** Returns the number of elements in a type. Not relevant for every derivative. */
|
||||
virtual size_t num_elements() const
|
||||
virtual std::size_t num_elements() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
return callable_ != nullptr;
|
||||
}
|
||||
|
||||
virtual size_t num_elements() const override
|
||||
virtual std::size_t num_elements() const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ public:
|
|||
return container_.empty();
|
||||
}
|
||||
|
||||
virtual size_t num_elements() const override
|
||||
virtual std::size_t num_elements() const override
|
||||
{
|
||||
return container_.size();
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ void game_board::check_victory(bool & continue_level, bool & found_player, bool
|
|||
}
|
||||
|
||||
for (std::set<unsigned>::iterator n = not_defeated.begin(); n != not_defeated.end(); ++n) {
|
||||
size_t side = *n - 1;
|
||||
std::size_t side = *n - 1;
|
||||
|
||||
DBG_EE << "Side " << (side+1) << " is a not-defeated team" << std::endl;
|
||||
|
||||
|
|
|
@ -164,9 +164,9 @@ public:
|
|||
// Global accessor from unit.hpp
|
||||
|
||||
unit_map::iterator find_visible_unit(const map_location &loc, const team& current_team, bool see_all = false);
|
||||
unit_map::iterator find_visible_unit(const map_location & loc, size_t team, bool see_all = false) { return find_visible_unit(loc, teams_[team], see_all); }
|
||||
unit_map::iterator find_visible_unit(const map_location & loc, std::size_t team, bool see_all = false) { return find_visible_unit(loc, teams_[team], see_all); }
|
||||
bool has_visible_unit (const map_location & loc, const team & team, bool see_all = false) const;
|
||||
bool has_visible_unit (const map_location & loc, size_t team, bool see_all = false) const { return has_visible_unit(loc, teams_[team], see_all); }
|
||||
bool has_visible_unit (const map_location & loc, std::size_t team, bool see_all = false) const { return has_visible_unit(loc, teams_[team], see_all); }
|
||||
|
||||
unit* get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all = false); //TODO: can this not return a pointer?
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ unsigned lobby_refresh = 4000;
|
|||
|
||||
const std::string observer_team_name = "observer";
|
||||
|
||||
const size_t max_loop = 65536;
|
||||
const std::size_t max_loop = 65536;
|
||||
|
||||
std::vector<server_info> server_list;
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace game_config
|
|||
* as maximum in wml loops.
|
||||
* WARNING : This should not be set to less than the max map area
|
||||
*/
|
||||
extern const size_t max_loop;
|
||||
extern const std::size_t max_loop;
|
||||
|
||||
namespace sounds {
|
||||
extern std::string turn_bell, timer_bell, public_message,
|
||||
|
|
|
@ -473,7 +473,7 @@ void game_config_manager::load_addons_cfg()
|
|||
}
|
||||
}
|
||||
if(error_addons.empty() == false) {
|
||||
const size_t n = error_addons.size();
|
||||
const std::size_t n = error_addons.size();
|
||||
const std::string& msg1 =
|
||||
_n("The following add-on had errors and could not be loaded:",
|
||||
"The following add-ons had errors and could not be loaded:",
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace { // Support functions
|
|||
std::string variation = cfg["variation"];
|
||||
std::string img_mods = cfg["image_mods"];
|
||||
|
||||
size_t side_num = cfg["side"].to_int(1);
|
||||
std::size_t side_num = cfg["side"].to_int(1);
|
||||
if (!resources::gameboard->has_team(side_num)) {
|
||||
side_num = 1;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ namespace { // Support functions
|
|||
std::vector<map_location> path;
|
||||
map_location src;
|
||||
map_location dst;
|
||||
for(size_t i = 0; i != std::min(xvals.size(),yvals.size()); ++i) {
|
||||
for(std::size_t i = 0; i != std::min(xvals.size(),yvals.size()); ++i) {
|
||||
if(i==0){
|
||||
try {
|
||||
src.set_wml_x(std::stoi(xvals[i]));
|
||||
|
@ -402,7 +402,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
|
|||
LOG_NG << "Processing [move_units_fake]\n";
|
||||
|
||||
const vconfig::child_list unit_cfgs = cfg.get_children("fake_unit");
|
||||
size_t num_units = unit_cfgs.size();
|
||||
std::size_t num_units = unit_cfgs.size();
|
||||
std::vector<fake_unit_ptr > units;
|
||||
units.reserve(num_units);
|
||||
std::vector<std::vector<map_location>> paths;
|
||||
|
@ -410,7 +410,7 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
|
|||
|
||||
LOG_NG << "Moving " << num_units << " units\n";
|
||||
|
||||
size_t longest_path = 0;
|
||||
std::size_t longest_path = 0;
|
||||
|
||||
for (const vconfig& config : unit_cfgs) {
|
||||
const std::vector<std::string> xvals = utils::split(config["x"]);
|
||||
|
@ -432,9 +432,9 @@ WML_HANDLER_FUNCTION(move_units_fake,, cfg)
|
|||
|
||||
std::vector<map_location> path_step(2);
|
||||
path_step.resize(2);
|
||||
for(size_t step = 1; step < longest_path; ++step) {
|
||||
for(std::size_t step = 1; step < longest_path; ++step) {
|
||||
DBG_NG << "Doing step " << step << "...\n";
|
||||
for(size_t un = 0; un < num_units; ++un) {
|
||||
for(std::size_t un = 0; un < num_units; ++un) {
|
||||
if(step >= paths[un].size() || paths[un][step - 1] == paths[un][step])
|
||||
continue;
|
||||
DBG_NG << "Moving unit " << un << ", doing step " << step << '\n';
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace builtin_conditions {
|
|||
if(counts == default_counts && match_count) {
|
||||
break;
|
||||
}
|
||||
for(size_t t = 0; t < team.recall_list().size(); ++t) {
|
||||
for(std::size_t t = 0; t < team.recall_list().size(); ++t) {
|
||||
if(counts == default_counts && match_count) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ const entity_location entity_location::null_entity(map_location::null_location()
|
|||
* Can also be used if the event has a unit and the caller already has the
|
||||
* unit's location and underlying ID.
|
||||
*/
|
||||
entity_location::entity_location(const map_location &loc, size_t id)
|
||||
entity_location::entity_location(const map_location &loc, std::size_t id)
|
||||
: map_location(loc), id_(id), filter_loc_(loc)
|
||||
{}
|
||||
|
||||
|
@ -44,7 +44,7 @@ entity_location::entity_location(const map_location &loc, size_t id)
|
|||
* Constructor for when an event has a unit that needs to be filtered as if
|
||||
* it was in a different location.
|
||||
*/
|
||||
entity_location::entity_location(const map_location &loc, size_t id,
|
||||
entity_location::entity_location(const map_location &loc, std::size_t id,
|
||||
const map_location & filter_loc)
|
||||
: map_location(loc), id_(id), filter_loc_(filter_loc)
|
||||
{}
|
||||
|
|
|
@ -29,8 +29,8 @@ class vconfig;
|
|||
namespace game_events
|
||||
{
|
||||
struct entity_location : public map_location {
|
||||
entity_location(const map_location &loc, size_t id = 0);
|
||||
entity_location(const map_location &loc, size_t id,
|
||||
entity_location(const map_location &loc, std::size_t id = 0);
|
||||
entity_location(const map_location &loc, std::size_t id,
|
||||
const map_location &filter_loc);
|
||||
explicit entity_location(const unit &);
|
||||
entity_location(const unit &u, const map_location &filter_loc);
|
||||
|
@ -46,7 +46,7 @@ namespace game_events
|
|||
private:
|
||||
/// The underlying ID of the unit associated with this.
|
||||
/// Set to 0 if there is no associated unit.
|
||||
size_t id_;
|
||||
std::size_t id_;
|
||||
|
||||
/// This map_location allows a unit to be filtered as if it were
|
||||
/// somewhere other than where it is. (Use the parent struct if
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
const handler_ptr get_event_handler_by_id(const std::string& id);
|
||||
|
||||
/** The number of active event handlers. */
|
||||
size_t size() const
|
||||
std::size_t size() const
|
||||
{
|
||||
return active_.size();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ struct pump_impl
|
|||
std::vector<queued_event> events_queue;
|
||||
|
||||
/// The value returned by wml_tracking();
|
||||
size_t internal_wml_tracking;
|
||||
std::size_t internal_wml_tracking;
|
||||
|
||||
std::stringstream wml_messages_stream;
|
||||
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
std::vector<queued_event> queue_;
|
||||
|
||||
/** Tracks how many events have been processed. */
|
||||
size_t pumped_count_;
|
||||
std::size_t pumped_count_;
|
||||
};
|
||||
} // end anonymous namespace (types)
|
||||
|
||||
|
@ -547,7 +547,7 @@ pump_result_t wml_event_pump::operator()()
|
|||
DBG_EH << "processing queued events: " << ss.str() << "\n";
|
||||
}
|
||||
|
||||
const size_t old_wml_track = impl_->internal_wml_tracking;
|
||||
const std::size_t old_wml_track = impl_->internal_wml_tracking;
|
||||
|
||||
// Ensure the whiteboard doesn't attempt to build its future unit map
|
||||
// while events are being processed.
|
||||
|
@ -642,7 +642,7 @@ void wml_event_pump::flush_messages()
|
|||
* from caching some aspect of the game state and that cannot rely on
|
||||
* [allow_undo] not being used when that state changes.
|
||||
*/
|
||||
size_t wml_event_pump::wml_tracking()
|
||||
std::size_t wml_event_pump::wml_tracking()
|
||||
{
|
||||
return impl_->internal_wml_tracking;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
void flush_messages();
|
||||
|
||||
/** This function can be used to detect when no WML/Lua has been executed. */
|
||||
size_t wml_tracking();
|
||||
std::size_t wml_tracking();
|
||||
|
||||
private:
|
||||
bool filter_event(const event_handler& handler, const queued_event& ev);
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
void set_menu_items(const config& cfg);
|
||||
|
||||
/** Gets the number of menu items owned. */
|
||||
size_t size() const
|
||||
std::size_t size() const
|
||||
{
|
||||
return wml_menu_items_.size();
|
||||
}
|
||||
|
|
|
@ -760,7 +760,7 @@ std::pair<bool, bool> connect_engine::process_network_data(const config& data)
|
|||
|
||||
int connect_engine::find_user_side_index_by_id(const std::string& id) const
|
||||
{
|
||||
size_t i = 0;
|
||||
std::size_t i = 0;
|
||||
for(side_engine_ptr side : side_engines_) {
|
||||
if(side->player_id() == id) {
|
||||
break;
|
||||
|
@ -901,7 +901,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine, const
|
|||
cfg_["side"] = index_ + 1;
|
||||
|
||||
// Check if this side should give its control to some other side.
|
||||
const size_t side_cntr_index = cfg_["controller"].to_int(-1) - 1;
|
||||
const std::size_t side_cntr_index = cfg_["controller"].to_int(-1) - 1;
|
||||
if(side_cntr_index < parent_.side_engines().size()) {
|
||||
// Remove this attribute to avoid locking side
|
||||
// to non-existing controller type.
|
||||
|
|
|
@ -518,7 +518,7 @@ const create_engine::extras_metadata& create_engine::current_era() const
|
|||
return *get_const_extras_by_type(ERA)[current_era_index_];
|
||||
}
|
||||
|
||||
void create_engine::set_current_level(const size_t index)
|
||||
void create_engine::set_current_level(const std::size_t index)
|
||||
{
|
||||
try {
|
||||
current_level_index_ = type_map_.at(current_level_type_.v).games_filtered.at(index);
|
||||
|
@ -542,7 +542,7 @@ void create_engine::set_current_level(const size_t index)
|
|||
}
|
||||
}
|
||||
|
||||
void create_engine::set_current_era_index(const size_t index, bool force)
|
||||
void create_engine::set_current_era_index(const std::size_t index, bool force)
|
||||
{
|
||||
current_era_index_ = index;
|
||||
|
||||
|
@ -652,7 +652,7 @@ void create_engine::init_all_levels()
|
|||
|
||||
// User maps.
|
||||
int dep_index_offset = 0;
|
||||
for(size_t i = 0; i < user_map_names_.size(); i++)
|
||||
for(std::size_t i = 0; i < user_map_names_.size(); i++)
|
||||
{
|
||||
config user_map_data = gen_mp_data;
|
||||
user_map_data["map_data"] = filesystem::read_map(user_map_names_[i]);
|
||||
|
@ -686,7 +686,7 @@ void create_engine::init_all_levels()
|
|||
|
||||
// User made scenarios.
|
||||
dep_index_offset = 0;
|
||||
for(size_t i = 0; i < user_scenario_names_.size(); i++)
|
||||
for(std::size_t i = 0; i < user_scenario_names_.size(); i++)
|
||||
{
|
||||
config data;
|
||||
try {
|
||||
|
@ -810,14 +810,14 @@ std::vector<create_engine::level_ptr> create_engine::get_levels_by_type(level::T
|
|||
auto& g_list = type_map_.at(type.v);
|
||||
|
||||
std::vector<level_ptr> levels;
|
||||
for(size_t level : g_list.games_filtered) {
|
||||
for(std::size_t level : g_list.games_filtered) {
|
||||
levels.push_back(g_list.games[level]);
|
||||
}
|
||||
|
||||
return levels;
|
||||
}
|
||||
|
||||
std::vector<size_t> create_engine::get_filtered_level_indices(level::TYPE type) const
|
||||
std::vector<std::size_t> create_engine::get_filtered_level_indices(level::TYPE type) const
|
||||
{
|
||||
return type_map_.at(type.v).games_filtered;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue