Converted remaining z_emptys to function calls.

This finally fixes startup segfault with my version of gcc.
This commit is contained in:
Sergey Popov 2011-09-09 11:05:52 +00:00
parent 3189eb4597
commit f1eda25fd4
11 changed files with 82 additions and 87 deletions

View file

@ -1138,7 +1138,7 @@ battle_context_unit_stats::battle_context_unit_stats(const unit &u, const map_lo
// Handle plague.
unit_ability_list plague_specials = weapon->get_specials(z_plague);
plagues = !not_living && !plague_specials.empty() &&
(opp.undead_variation() != z_empty) && !resources::game_map->is_village(opp_loc);
(opp.undead_variation() != n_token::t_token::z_empty()) && !resources::game_map->is_village(opp_loc);
if (plagues) {
plague_type = (*plague_specials.cfgs.front().first)[z_type].str();
@ -1557,7 +1557,7 @@ bool attack::perform_hit(bool attacker_turn, statistics::attack_context &stats)
unit_display::unit_attack(attacker.loc_, defender.loc_, damage,
*attacker_stats->weapon, defender_stats->weapon,
abs_n, float_text.str(), attacker_stats->drains, z_empty);
abs_n, float_text.str(), attacker_stats->drains, n_token::t_token::z_empty());
}
int drains_damage = 0;
@ -2122,7 +2122,7 @@ void calculate_healing(int side, bool update_display)
}
}
if (curing == z_empty && healing==0) {
if (curing == n_token::t_token::z_empty() && healing==0) {
continue;
}

View file

@ -391,7 +391,7 @@ bool terrain_builder::load_images(building_rule &rule)
continue; // ignore missing frames
}
const n_token::t_token modif = (has_tilde ? n_token::t_token((*str).substr(tilde+1)) : z_empty);
const n_token::t_token modif = (has_tilde ? n_token::t_token((*str).substr(tilde+1)) : n_token::t_token::z_empty());
int time = 100;
if(items.size() > 1) {

View file

@ -405,7 +405,7 @@ static void fill_wml_messages_map(std::map<std::string, int>& msg_map, std::stri
break;
}
if(msg == z_empty) {
if(msg == n_token::t_token::z_empty()) {
continue;
}
@ -808,7 +808,7 @@ namespace {
else {
const config & cfg = new_handler.get_config();
config::t_token const & id = cfg[z_id];
if(id != z_empty) {
if(id != n_token::t_token::z_empty()) {
foreach( game_events::event_handler const & eh, active_) {
config const & temp_config( eh.get_config());
if(id == temp_config[z_id]) { return; }
@ -824,7 +824,7 @@ namespace {
* buffering functionality.
*/
void remove_event_handler(config::t_token const & id) {
if(id == z_empty) { return; }
if(id == n_token::t_token::z_empty()) { return; }
if(buffering_) { remove_buffer_.insert(id); }
@ -834,7 +834,7 @@ namespace {
while(i < temp.end()) {
config const & temp_config = (*i).get_config();
config::t_token const &event_id = temp_config[z_id];
if(event_id != z_empty && event_id == id) {
if(event_id != n_token::t_token::z_empty() && event_id == id) {
i = temp.erase(i); }
else {
++i; }
@ -1127,7 +1127,7 @@ WML_HANDLER_FUNCTION(modify_side, /*event_info*/, cfg)
// Modify recruit list (override)
if (!recruit_str.empty()) {
std::vector<config::t_token> recruit = utils::split_token(recruit_str);
if (recruit.size() == 1 && recruit.back() == z_empty)
if (recruit.size() == 1 && recruit.back() == n_token::t_token::z_empty())
recruit.clear();
teams[team_index].set_recruits(std::set<std::string>(recruit.begin(),recruit.end()));
@ -1977,7 +1977,7 @@ WML_HANDLER_FUNCTION(object, event_info, cfg)
config::t_token const &id = cfg[z_id];
// If this item has already been used
if(id != z_empty && used_items.count(id))
if(id != n_token::t_token::z_empty() && used_items.count(id))
return;
config::t_token const & image = cfg[z_image];

View file

@ -500,7 +500,7 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
cfg_summary[z_campaign] = cfg_save[z_campaign];
cfg_summary[z_difficulty] = cfg_save[z_difficulty];
cfg_summary[z_version] = cfg_save[z_version];
cfg_summary[z_corrupt] = z_empty;
cfg_summary[z_corrupt] = n_token::t_token::z_empty();
if(has_snapshot) {
cfg_summary[z_turn] = cfg_snapshot[z_turn_at];
@ -559,7 +559,7 @@ void extract_summary_from_config(config& cfg_save, config& cfg_summary)
cfg_summary[z_leader] = leader;
cfg_summary[z_leader_image] = leader_image;
cfg_summary[z_map_data] = z_empty;
cfg_summary[z_map_data] = n_token::t_token::z_empty();
if(!shrouded) {
if(has_snapshot) {

View file

@ -22,11 +22,6 @@
#include "terrain_translation.hpp"
namespace {
//Static tokens are replacements for string literals in code
//They allow for fast comparison, copying and hashing operations.
static const n_token::t_token z_empty("", false);
}
///this module manages the cache of images. With an image name, you can get
///the surface corresponding to that image.
//

View file

@ -461,7 +461,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) :
set_underlying_id();
overlays_ = utils::parenthetical_split(cfg[z_overlays], ',');
if(overlays_.size() == 1 && overlays_.front() == z_empty) {
if(overlays_.size() == 1 && overlays_.front() == n_token::t_token::z_empty()) {
overlays_.clear();
}
if (const config &variables = cfg.child(z_variables)) {
@ -514,7 +514,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) :
}
if (const config::attribute_value *v = cfg.get(z_profile)) {
config::t_token big = *v, small = cfg[z_small_profile];
adjust_profile(small, big, z_empty);
adjust_profile(small, big, n_token::t_token::z_empty());
cfg_[z_profile] = big;
cfg_[z_small_profile] = small;
}
@ -525,7 +525,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) :
std::vector<config::t_token> temp_advances = utils::split_token(cfg[z_advances_to]);
if(temp_advances.size() == 1 && temp_advances.front() == z_null) {
advances_to_.clear();
}else if(temp_advances.size() >= 1 && temp_advances.front() != z_empty) {
}else if(temp_advances.size() >= 1 && temp_advances.front() != n_token::t_token::z_empty()) {
advances_to_ = temp_advances;
}
@ -1218,7 +1218,7 @@ void unit::end_turn()
}
void unit::new_scenario()
{
ai_special_ = z_empty;
ai_special_ = n_token::t_token::z_empty();
// Set the goto-command to be going to no-where
goto_ = map_location();
@ -1886,10 +1886,10 @@ void unit::set_standing(bool with_bars)
game_display *disp = game_display::get_singleton();
if (preferences::show_standing_animations()&& !incapacitated()) {
start_animation(INT_MAX, choose_animation(*disp, loc_, z_standing),
with_bars, z_empty, 0, STATE_STANDING);
with_bars, n_token::t_token::z_empty(), 0, STATE_STANDING);
} else {
start_animation(INT_MAX, choose_animation(*disp, loc_, z__disabled_),
with_bars, z_empty, 0, STATE_STANDING);
with_bars, n_token::t_token::z_empty(), 0, STATE_STANDING);
}
}
@ -1911,7 +1911,7 @@ void unit::set_idling()
{
game_display *disp = game_display::get_singleton();
start_animation(INT_MAX, choose_animation(*disp, loc_, z_idling),
true, z_empty, 0, STATE_FORGET);
true, n_token::t_token::z_empty(), 0, STATE_FORGET);
}
void unit::set_selecting()
@ -1919,10 +1919,10 @@ void unit::set_selecting()
const game_display *disp = game_display::get_singleton();
if (preferences::show_standing_animations() && !get_state(STATE_PETRIFIED)) {
start_animation(INT_MAX, choose_animation(*disp, loc_, z_selected),
true, z_empty, 0, STATE_FORGET);
true, n_token::t_token::z_empty(), 0, STATE_FORGET);
} else {
start_animation(INT_MAX, choose_animation(*disp, loc_, z__disabled_selected_),
true, z_empty, 0, STATE_FORGET);
true, n_token::t_token::z_empty(), 0, STATE_FORGET);
}
}
@ -2264,7 +2264,7 @@ int unit::defense_modifier(t_translation::t_terrain terrain, gamemap const & gam
bool unit::resistance_filter_matches(const config& cfg, bool attacker, const std::string& damage_name, int res) const
{
if(!(cfg[z_active_on]==z_empty || (attacker && cfg[z_active_on]==z_offense) || (!attacker && cfg[z_active_on]==z_defense))) {
if(!(cfg[z_active_on]==n_token::t_token::z_empty() || (attacker && cfg[z_active_on]==z_offense) || (!attacker && cfg[z_active_on]==z_defense))) {
return false;
}
const std::string& apply_to = cfg[z_apply_to];
@ -2500,7 +2500,7 @@ void unit::add_modification(const config::t_token& type, const config& mod, bool
if (const config::attribute_value *v = effect.get(z_portrait)) {
config::t_token big = *v;
config::t_token small = effect[z_small_portrait];
adjust_profile(small, big, z_empty);
adjust_profile(small, big, n_token::t_token::z_empty());
cfg_[z_profile] = big;
cfg_[z_small_profile] = small;
}
@ -2524,7 +2524,7 @@ void unit::add_modification(const config::t_token& type, const config& mod, bool
for(std::vector<attack_type>::iterator a = attacks_.begin();
a != attacks_.end(); ++a) {
affected = a->apply_modification(effect);
if(affected.first && affected.second != z_empty) {
if(affected.first && affected.second != n_token::t_token::z_empty()) {
if(first_attack) {
first_attack = false;
} else {
@ -2721,7 +2721,7 @@ void unit::add_modification(const config::t_token& type, const config& mod, bool
for(std::vector<attack_type>::iterator a = attacks_.begin();
a != attacks_.end(); ++a) {
std::pair<bool, config::t_token> affected = a->describe_modification(effect);
if(affected.first && affected.second != z_empty) {
if(affected.first && affected.second != n_token::t_token::z_empty()) {
std::string const & desc = affected.second;
if(first_attack) {
first_attack = false;
@ -2942,7 +2942,7 @@ unit& unit::clone(bool is_temporary)
&& static_cast< std::string const &>(id_).find_first_not_of("0123456789", pos+1) == std::string::npos) {
// this appears to be a duplicate of a generic unit, so give it a new id
WRN_UT << "assigning new id to clone of generic unit " << id_ << "\n";
id_ = z_empty;
id_ = n_token::t_token::z_empty();
set_underlying_id();
}
}
@ -3173,7 +3173,7 @@ std::string get_checksum(const unit& u) {
z_undead_variation,
z_upkeep,
z_zoc,
z_empty};
n_token::t_token::z_empty()};
for (int i = 0; !main_keys[i].empty(); ++i)
{
@ -3185,7 +3185,7 @@ std::string get_checksum(const unit& u) {
z_range,
z_damage,
z_number,
z_empty};
n_token::t_token::z_empty()};
foreach (const config &att, unit_config.child_range(z_attack))
{
@ -3218,7 +3218,7 @@ std::string get_checksum(const unit& u) {
child.recursive_clear_value(z_name);
}
const std::string child_keys[] = {z_advance_from, z_defense, z_movement_costs, z_resistance, z_empty};
const std::string child_keys[] = {z_advance_from, z_defense, z_movement_costs, z_resistance, n_token::t_token::z_empty()};
for (int i = 0; !child_keys[i].empty(); ++i)
{

View file

@ -607,7 +607,7 @@ config::t_token attack_type::weapon_specials(bool force) const
{
// log_scope("weapon_specials");
const config &specials = cfg_.child(z_specials);
if (!specials) return z_empty;
if (!specials) return n_token::t_token::z_empty();
std::string res;
foreach (const config::any_child &sp, specials.all_children_range())

View file

@ -473,7 +473,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
}
if( animation_base.empty() )
animation_base.push_back(unit_animation(0,frame_builder().image(default_image).duration(1),z_empty,unit_animation::DEFAULT_ANIM));
animation_base.push_back(unit_animation(0,frame_builder().image(default_image).duration(1),n_token::t_token::z_empty(),unit_animation::DEFAULT_ANIM));
animations.push_back(unit_animation(0,frame_builder().image(default_image).duration(1),z__disabled_,0));
{
@ -495,17 +495,17 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.back().event_ = utils::split_token(z_ghosted);
static const config::t_token z_local_0p9("0.9", false);
animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),particule::UNSET,z_local_0p9,z_empty,0,z_empty,z_empty, z_GS);
animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),particule::UNSET,z_local_0p9,n_token::t_token::z_empty(),0,n_token::t_token::z_empty(),n_token::t_token::z_empty(), z_GS);
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_disabled_ghosted);
static const config::t_token z_local_0p4("0.4", false);
animations.back().unit_anim_.override(0,1,particule::UNSET,z_local_0p4 ,z_empty,0,z_empty,z_empty,z_GS);
animations.back().unit_anim_.override(0,1,particule::UNSET,z_local_0p4 ,n_token::t_token::z_empty(),0,n_token::t_token::z_empty(),n_token::t_token::z_empty(),z_GS);
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_selected);
static const config::t_token z_local_t1("0.0~0.3:100,0.3~0.0:200", false);
animations.back().unit_anim_.override(0,300,particule::UNSET,z_empty,z_local_t1,display::rgb(255,255,255));
animations.back().unit_anim_.override(0,300,particule::UNSET,n_token::t_token::z_empty(),z_local_t1,display::rgb(255,255,255));
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_recruited);
@ -514,12 +514,12 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_levelin);
animations.back().unit_anim_.override(0,600,particule::NO_CYCLE,z_empty,z_local_0_1_600,display::rgb(255,255,255));
animations.back().unit_anim_.override(0,600,particule::NO_CYCLE,n_token::t_token::z_empty(),z_local_0_1_600,display::rgb(255,255,255));
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_levelout);
static const config::t_token z_local_0_1_600_1("0~1:600,1", false);
animations.back().unit_anim_.override(0,600,particule::NO_CYCLE,z_empty, z_local_0_1_600_1,display::rgb(255,255,255));
animations.back().unit_anim_.override(0,600,particule::NO_CYCLE,n_token::t_token::z_empty(), z_local_0_1_600_1,display::rgb(255,255,255));
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_pre_movement);
@ -531,12 +531,12 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.back().event_ = utils::split_token(z_movement);
static const config::t_token z_local_try_and_parse_me("0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,0~1:200,", false);
static const n_token::t_token z_local_move_layer(lexical_cast<std::string>(display::LAYER_UNIT_MOVE_DEFAULT-display::LAYER_UNIT_FIRST), false);
animations.back().unit_anim_.override(0,6800,particule::NO_CYCLE,z_empty,z_empty,0,z_local_try_and_parse_me , z_local_move_layer);
animations.back().unit_anim_.override(0,6800,particule::NO_CYCLE,n_token::t_token::z_empty(),n_token::t_token::z_empty(),0,z_local_try_and_parse_me , z_local_move_layer);
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_defend);
static const config::t_token z_local_t2("0.0,0.5:75,0.0:75,0.5:75,0.0", false);
animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),particule::NO_CYCLE,z_empty, z_local_t2,game_display::rgb(255,0,0));
animations.back().unit_anim_.override(0,animations.back().unit_anim_.get_animation_duration(),particule::NO_CYCLE,n_token::t_token::z_empty(), z_local_t2,game_display::rgb(255,0,0));
animations.back().hits_.push_back(HIT);
animations.back().hits_.push_back(KILL);
@ -546,7 +546,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_attack);
static const config::t_token z_local_t4("0~0.6:150,0.6~0:150", false);
animations.back().unit_anim_.override(-150,300,particule::NO_CYCLE,z_empty,z_empty,0, z_local_t4,z_local_move_layer);
animations.back().unit_anim_.override(-150,300,particule::NO_CYCLE,n_token::t_token::z_empty(),n_token::t_token::z_empty(),0, z_local_t4,z_local_move_layer);
animations.back().primary_attack_filter_.push_back(config());
animations.back().primary_attack_filter_.back()[z_range] = z_melee;
@ -580,7 +580,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_healed);
static const config::t_token z_local_healed("0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30", false);
animations.back().unit_anim_.override(0,300,particule::NO_CYCLE,z_empty,z_local_healed,display::rgb(255,255,255));
animations.back().unit_anim_.override(0,300,particule::NO_CYCLE,n_token::t_token::z_empty(),z_local_healed,display::rgb(255,255,255));
animations.back().sub_anims_[z__healed_sound] = particule();
animations.back().sub_anims_[z__healed_sound].add_frame(1,frame_builder());
animations.back().sub_anims_[z__healed_sound].add_frame(1,frame_builder().sound(z_local_heal_wav),true);
@ -588,7 +588,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
animations.push_back(*itor);
animations.back().event_ = utils::split_token(z_poisoned);
static const config::t_token z_local_pois("0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30", false);
animations.back().unit_anim_.override(0,300,particule::NO_CYCLE,z_empty, z_local_pois,display::rgb(0,255,0));
animations.back().unit_anim_.override(0,300,particule::NO_CYCLE,n_token::t_token::z_empty(), z_local_pois,display::rgb(0,255,0));
animations.back().sub_anims_[z__poison_sound] = particule();
animations.back().sub_anims_[z__poison_sound].add_frame(1,frame_builder());
animations.back().sub_anims_[z__poison_sound].add_frame(1,frame_builder().sound(z_local_pois_sound),true);

View file

@ -120,7 +120,7 @@ static void move_unit_between(const map_location& a, const map_location& b, unit
temp_unit.set_facing(a.get_relative_dir(b));
unit_animator animator;
animator.replace_anim_if_invalid(&temp_unit,z_movement,a,b,step_num,
false,z_empty,0,unit_animation::INVALID,NULL,NULL,step_left);
false,n_token::t_token::z_empty(),0,unit_animation::INVALID,NULL,NULL,step_left);
animator.start_animations();
animator.pause_animation();
disp->scroll_to_tiles(a,b,game_display::ONSCREEN,true,0.0,false);
@ -281,8 +281,8 @@ void unit_draw_weapon(const map_location& loc, unit& attacker,
return;
}
unit_animator animator;
animator.add_animation(&attacker,z_draw_weapon,loc,defender_loc,0,false,z_empty,0,unit_animation::HIT,attack,secondary_attack,0);
animator.add_animation(defender,z_draw_weapon,defender_loc,loc,0,false,z_empty,0,unit_animation::MISS,secondary_attack,attack,0);
animator.add_animation(&attacker,z_draw_weapon,loc,defender_loc,0,false,n_token::t_token::z_empty(),0,unit_animation::HIT,attack,secondary_attack,0);
animator.add_animation(defender,z_draw_weapon,defender_loc,loc,0,false,n_token::t_token::z_empty(),0,unit_animation::MISS,secondary_attack,attack,0);
animator.start_animations();
animator.wait_for_end();
@ -298,10 +298,10 @@ void unit_sheath_weapon(const map_location& primary_loc, unit* primary_unit,
}
unit_animator animator;
if(primary_unit) {
animator.add_animation(primary_unit,z_sheath_weapon,primary_loc,secondary_loc,0,false,z_empty,0,unit_animation::INVALID,primary_attack,secondary_attack,0);
animator.add_animation(primary_unit,z_sheath_weapon,primary_loc,secondary_loc,0,false,n_token::t_token::z_empty(),0,unit_animation::INVALID,primary_attack,secondary_attack,0);
}
if(secondary_unit) {
animator.add_animation(secondary_unit,z_sheath_weapon,secondary_loc,primary_loc,0,false,z_empty,0,unit_animation::INVALID,secondary_attack,primary_attack,0);
animator.add_animation(secondary_unit,z_sheath_weapon,secondary_loc,primary_loc,0,false,n_token::t_token::z_empty(),0,unit_animation::INVALID,secondary_attack,primary_attack,0);
}
if(primary_unit || secondary_unit) {
@ -328,9 +328,9 @@ void unit_die(const map_location& loc, unit& loser,
}
unit_animator animator;
// hide the hp/xp bars of the loser (useless and prevent bars around an erased unit)
animator.add_animation(&loser,z_death,loc,winner_loc,0,false,z_empty,0,unit_animation::KILL,attack,secondary_attack,0);
animator.add_animation(&loser,z_death,loc,winner_loc,0,false,n_token::t_token::z_empty(),0,unit_animation::KILL,attack,secondary_attack,0);
// but show the bars of the winner (avoid blinking and show its xp gain)
animator.add_animation(winner,z_victory,winner_loc,loc,0,true,z_empty,0,
animator.add_animation(winner,z_victory,winner_loc,loc,0,true,n_token::t_token::z_empty(),0,
unit_animation::KILL,secondary_attack,attack,0);
animator.start_animations();
animator.wait_for_end();
@ -420,7 +420,7 @@ void unit_attack(
assert(leader != units.end());
leader->set_facing(itor->second.get_relative_dir(a));
animator.add_animation(&*leader, z_leading, itor->second,
att->get_location(), damage, true, z_empty, 0,
att->get_location(), damage, true, n_token::t_token::z_empty(), 0,
hit_type, &attack, secondary_attack, swing);
}
for (std::vector<std::pair<const config *, map_location> >::iterator itor = helpers.cfgs.begin(); itor != helpers.cfgs.end(); ++itor) {
@ -430,7 +430,7 @@ void unit_attack(
assert(helper != units.end());
helper->set_facing(itor->second.get_relative_dir(b));
animator.add_animation(&*helper, z_resistance, itor->second,
def->get_location(), damage, true, z_empty, 0,
def->get_location(), damage, true, n_token::t_token::z_empty(), 0,
hit_type, &attack, secondary_attack, swing);
}

View file

@ -89,7 +89,7 @@ template <class T>
const T& progressive_discrete<T>::get_current_element(int current_time)const {
int time = 0;
unsigned int sub_halo = 0;
if(data_.empty()) return z_empty;
if(data_.empty()) return n_token::t_token::z_empty();
while(time < current_time&& sub_halo < data_.size()) {
time += data_[sub_halo].second;
++sub_halo; }
@ -200,13 +200,13 @@ frame_parameters::frame_parameters() :
duration(0),
image(),
image_diagonal(),
image_mod(z_empty),
halo(z_empty),
image_mod(n_token::t_token::z_empty()),
halo(n_token::t_token::z_empty()),
halo_x(0),
halo_y(0),
halo_mod(z_empty),
sound(z_empty),
text(z_empty),
halo_mod(n_token::t_token::z_empty()),
sound(n_token::t_token::z_empty()),
text(n_token::t_token::z_empty()),
text_color(0),
blend_with(0),
blend_ratio(0.0),
@ -227,23 +227,23 @@ frame_builder::frame_builder() :
duration_(1),
image_(),
image_diagonal_(),
image_mod_(z_empty),
halo_(z_empty),
halo_x_(z_empty),
halo_y_(z_empty),
halo_mod_(z_empty),
sound_(z_empty),
text_(z_empty),
image_mod_(n_token::t_token::z_empty()),
halo_(n_token::t_token::z_empty()),
halo_x_(n_token::t_token::z_empty()),
halo_y_(n_token::t_token::z_empty()),
halo_mod_(n_token::t_token::z_empty()),
sound_(n_token::t_token::z_empty()),
text_(n_token::t_token::z_empty()),
text_color_(0),
blend_with_(0),
blend_ratio_(z_empty),
highlight_ratio_(z_empty),
offset_(z_empty),
submerge_(z_empty),
x_(z_empty),
y_(z_empty),
directional_x_(z_empty),
directional_y_(z_empty),
blend_ratio_(n_token::t_token::z_empty()),
highlight_ratio_(n_token::t_token::z_empty()),
offset_(n_token::t_token::z_empty()),
submerge_(n_token::t_token::z_empty()),
x_(n_token::t_token::z_empty()),
y_(n_token::t_token::z_empty()),
directional_x_(n_token::t_token::z_empty()),
directional_y_(n_token::t_token::z_empty()),
auto_vflip_(t_unset),
auto_hflip_(t_unset),
primary_frame_(t_unset),
@ -654,12 +654,12 @@ void unit_frame::redraw(const int frame_time,bool first_time,const map_location
if(direction != map_location::NORTH && direction != map_location::SOUTH) {
image_loc = image::locator(current_data.image_diagonal, n_token::t_token(current_data.image_mod)); //todo remove
}
if(image_loc.is_void() || image_loc.get_filename() == z_empty) { // invalid diag image, or not diagonal
if(image_loc.is_void() || image_loc.get_filename() == n_token::t_token::z_empty()) { // invalid diag image, or not diagonal
image_loc = image::locator(current_data.image,n_token::t_token(current_data.image_mod)); //rmove extra contructor
}
surface image;
if(!image_loc.is_void() && image_loc.get_filename() != z_empty) { // invalid diag image, or not diagonal
if(!image_loc.is_void() && image_loc.get_filename() != n_token::t_token::z_empty()) { // invalid diag image, or not diagonal
image=image::get_image(image_loc, image::SCALED_TO_ZOOM);
}
const int x = static_cast<int>(tmp_offset * xdst + (1.0-tmp_offset) * xsrc) + d2;
@ -757,7 +757,7 @@ std::set<map_location> unit_frame::get_overlaped_hex(const int frame_time,const
if(direction != map_location::NORTH && direction != map_location::SOUTH) {
image_loc = image::locator(current_data.image_diagonal, n_token::t_token(current_data.image_mod));
}
if(image_loc.is_void() || image_loc.get_filename() == z_empty) { // invalid diag image, or not diagonal
if(image_loc.is_void() || image_loc.get_filename() == n_token::t_token::z_empty()) { // invalid diag image, or not diagonal
image_loc = image::locator(current_data.image, n_token::t_token(current_data.image_mod));
}
@ -791,7 +791,7 @@ std::set<map_location> unit_frame::get_overlaped_hex(const int frame_time,const
#endif //_OPENMP
{
surface image;
if(!image_loc.is_void() && image_loc.get_filename() != z_empty) { // invalid diag image, or not diagonal
if(!image_loc.is_void() && image_loc.get_filename() != n_token::t_token::z_empty()) { // invalid diag image, or not diagonal
image=image::get_image(image_loc,
image::SCALED_TO_ZOOM
);
@ -866,13 +866,13 @@ const frame_parameters unit_frame::merge_parameters(int current_time,const frame
const bool primary = result.primary_frame;
/** engine provides a default image to use for the unit when none is available */
result.image = current_val.image.is_void() || current_val.image.get_filename() == z_empty ?animation_val.image:current_val.image;
result.image = current_val.image.is_void() || current_val.image.get_filename() == n_token::t_token::z_empty() ?animation_val.image:current_val.image;
if(primary && ( result.image.is_void() || result.image.get_filename().empty())) {
result.image = engine_val.image;
}
/** engine provides a default image to use for the unit when none is available */
result.image_diagonal = current_val.image_diagonal.is_void() || current_val.image_diagonal.get_filename() == z_empty ?animation_val.image_diagonal:current_val.image_diagonal;
result.image_diagonal = current_val.image_diagonal.is_void() || current_val.image_diagonal.get_filename() == n_token::t_token::z_empty() ?animation_val.image_diagonal:current_val.image_diagonal;
if(primary && ( result.image_diagonal.is_void() || result.image_diagonal.get_filename().empty())) {
result.image_diagonal = engine_val.image_diagonal;
}

View file

@ -276,7 +276,7 @@ attack_type::attack_type(const config& cfg) :
description_ = egettext(id().c_str());
if(icon_.empty()){
if (id() != z_empty)
if (id() != n_token::t_token::z_empty())
icon_ = config::t_token("attacks/" + static_cast<std::string const &>(id()) + ".png");
else {
static const config::t_token default_icon("attacks/blank-attack.png", false);
@ -292,7 +292,7 @@ attack_type::~attack_type()
config::t_token attack_type::accuracy_parry_description() const
{
if(accuracy_ == 0 && parry_ == 0) {
return z_empty; }
return n_token::t_token::z_empty(); }
std::ostringstream s;
s << utils::signed_percent(accuracy_);
@ -334,7 +334,7 @@ bool attack_type::matches_filter(const config& cfg,bool self) const
std::pair<bool, config::t_token> attack_type::apply_modification(const config& cfg)
{
if(!matches_filter(cfg,0)) {
return std::make_pair(false, z_empty); }
return std::make_pair(false, n_token::t_token::z_empty()); }
const config::t_token& set_name = cfg[z_set_name];
const t_string& set_desc = cfg[z_set_description];
@ -450,7 +450,7 @@ std::pair<bool, config::t_token> attack_type::apply_modification(const config& c
std::pair<bool, config::t_token> attack_type::describe_modification(const config& cfg)
{
if(!matches_filter(cfg,0)) {
return std::make_pair(false, z_empty); }
return std::make_pair(false, n_token::t_token::z_empty()); }
const config::t_token& increase_damage = cfg[z_increase_damage];
const config::t_token& increase_attacks = cfg[z_increase_attacks];
@ -1066,7 +1066,7 @@ void unit_type::build_created(const movement_type_map &mv_types,
}
const config::t_token& advances_to_val = cfg[z_advances_to];
if(advances_to_val != z_null && advances_to_val != z_empty)
if(advances_to_val != z_null && advances_to_val != n_token::t_token::z_empty())
advances_to_ = utils::split_token(advances_to_val);
DBG_UT << "unit_type '" << id() << "' advances to : " << advances_to_val << "\n";