[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src Makefile.am actions.cpp ai.cpp ai_a...
From: |
Isaac Clerencia |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src Makefile.am actions.cpp ai.cpp ai_a... |
Date: |
Fri, 31 Dec 2004 16:33:45 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Isaac Clerencia <address@hidden> 04/12/31 21:01:38
Modified files:
src : Makefile.am actions.cpp ai.cpp ai_attack.cpp
ai_move.cpp builder.cpp cavegen.cpp config.cpp
config.hpp dialogs.cpp display.cpp events.cpp
game.cpp game_events.cpp halo.cpp help.cpp
image.cpp log.cpp map.cpp
multiplayer_client.cpp multiplayer_connect.cpp
multiplayer_lobby.cpp network.cpp
network_worker.cpp pathfind.cpp playturn.cpp
replay.cpp reports.cpp sdl_utils.cpp
show_dialog.cpp team.cpp team.hpp terrain.cpp
theme.cpp unit.cpp unit_display.cpp
unit_types.cpp
src/editor : editor_palettes.cpp
src/server : game.cpp server.cpp
Added files:
src : wassert.cpp wassert.hpp
Log message:
/tmp/cvsQHuac1
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/wassert.cpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/wassert.hpp?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/Makefile.am.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.178&tr2=1.179&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.128&tr2=1.129&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_attack.cpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai_move.cpp.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.cpp.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cavegen.cpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.118&tr2=1.119&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.283&tr2=1.284&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/events.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.178&tr2=1.179&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.cpp.diff?tr1=1.116&tr2=1.117&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/halo.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/image.cpp.diff?tr1=1.68&tr2=1.69&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/log.cpp.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.cpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.92&tr2=1.93&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network.cpp.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/network_worker.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/pathfind.cpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.313&tr2=1.314&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/replay.cpp.diff?tr1=1.87&tr2=1.88&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.cpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.106&tr2=1.107&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.cpp.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.hpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/terrain.cpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.109&tr2=1.110&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_display.cpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/game.cpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/server.cpp.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
Patches:
Index: wesnoth/src/Makefile.am
diff -u wesnoth/src/Makefile.am:1.63 wesnoth/src/Makefile.am:1.64
--- wesnoth/src/Makefile.am:1.63 Sun Nov 21 00:32:26 2004
+++ wesnoth/src/Makefile.am Fri Dec 31 21:01:37 2004
@@ -90,6 +90,7 @@
unit_display.cpp \
unit_types.cpp \
video.cpp \
+ wassert.cpp \
widgets/button.cpp \
widgets/combo.cpp \
widgets/label.cpp \
@@ -171,6 +172,7 @@
unit_types.hpp \
util.hpp \
video.hpp \
+ wassert.hpp \
widgets/button.hpp \
widgets/combo.hpp \
widgets/label.hpp \
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.178 wesnoth/src/actions.cpp:1.179
--- wesnoth/src/actions.cpp:1.178 Fri Dec 31 14:36:53 2004
+++ wesnoth/src/actions.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.178 2004/12/31 14:36:53 Sirp Exp $ */
+/* $Id: actions.cpp,v 1.179 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,6 +32,7 @@
#include "statistics.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "widgets/menu.hpp"
#include <cmath>
@@ -204,8 +205,8 @@
const std::map<gamemap::location,unit>::iterator a =
units.find(attacker);
const std::map<gamemap::location,unit>::iterator d =
units.find(defender);
- assert(a != units.end());
- assert(d != units.end());
+ wassert(a != units.end());
+ wassert(d != units.end());
const gamemap::TERRAIN attacker_terrain = attacker_terrain_override ?
attacker_terrain_override :
map[attacker.x][attacker.y];
@@ -217,7 +218,7 @@
const std::vector<attack_type>& attacker_attacks = a->second.attacks();
const std::vector<attack_type>& defender_attacks = d->second.attacks();
- assert((unsigned)attack_with < attacker_attacks.size());
+ wassert((unsigned)attack_with < attacker_attacks.size());
const attack_type& attack = attacker_attacks[attack_with];
res.attacker_special = attack.special();
@@ -277,7 +278,7 @@
res.ndefends = 0;
for(int defend_option = 0; defend_option !=
int(defender_attacks.size()); ++defend_option) {
if(defender_attacks[defend_option].range() == attack.range()) {
- const double rating =
a->second.damage_against(defender_attacks[defend_option])
+ const double rating =
a->second.damage_against(defender_attacks[defend_option])
*defender_attacks[defend_option].damage()
*defender_attacks[defend_option].num_attacks()
*defender_attacks[defend_option].defense_weight();
@@ -904,9 +905,9 @@
d->second.get_experience(defenderxp);
}
- gui.invalidate_unit();
- gui.invalidate(attacker);
- gui.invalidate(defender);
+ gui.invalidate_unit();
+ gui.invalidate(attacker);
+ gui.invalidate(defender);
gui.draw(true,true);
}
@@ -1107,7 +1108,7 @@
if(!gets_healed[j])
continue;
- assert(units.find(adjacent[j]) != units.end());
+ wassert(units.find(adjacent[j]) != units.end());
healed_units[adjacent[j]]
= minimum(max_healing[adjacent[j]],
@@ -1155,7 +1156,7 @@
const gamemap::location& loc = h->first;
- assert(units.count(loc) == 1);
+ wassert(units.count(loc) == 1);
unit& u = units.find(loc)->second;
@@ -1176,7 +1177,7 @@
//iterate over any units that are healing this unit,
and make them
//enter their healing frame
for(healer_itor i = healer_itors.first; i !=
healer_itors.second; ++i) {
- assert(units.count(i->second));
+ wassert(units.count(i->second));
unit& healer = units.find(i->second)->second;
const std::string& halo_image =
healer.type().image_halo_healing();
@@ -1279,7 +1280,7 @@
if(show_healing) {
for(healer_itor i = healer_itors.first; i !=
healer_itors.second; ++i) {
- assert(units.count(i->second));
+ wassert(units.count(i->second));
unit& healer = units.find(i->second)->second;
healer.set_healing(false);
@@ -1351,7 +1352,7 @@
for(size_t n = 0; n != seen_leaders.size(); ++n) {
const size_t side = seen_leaders[n]-1;
- assert(side < teams.size());
+ wassert(side < teams.size());
for(size_t m = n+1; m != seen_leaders.size(); ++m) {
if(side < teams.size() &&
teams[side].is_enemy(seen_leaders[m])) {
@@ -1500,10 +1501,10 @@
for(std::vector<gamemap::location>::const_iterator it =
cleared_locations.begin(); it != cleared_locations.end(); ++it) {
-
+
const unit_map::const_iterator sighted = units.find(*it);
- if(sighted != units.end() &&
-
(sighted->second.invisible(map.underlying_terrain(map[it->x][it->y]),status.get_time_of_day().lawful_bonus,*it,units,teams)
== false
+ if(sighted != units.end() &&
+
(sighted->second.invisible(map.underlying_terrain(map[it->x][it->y]),status.get_time_of_day().lawful_bonus,*it,units,teams)
== false
|| teams[team].is_enemy(sighted->second.side()) == false)) {
if(seen_units == NULL || known_units == NULL) {
static const std::string sighted("sighted");
@@ -1573,15 +1574,15 @@
std::vector<gamemap::location> route,
replay* move_recorder, undo_list* undo_stack,
gamemap::location *next_unit, bool continue_move, bool
should_clear_shroud)
-{
- assert(route.empty() == false);
+{
+ wassert(route.empty() == false);
//stop the user from issuing any commands while the unit is moving
const command_disabler disable_commands;
unit_map::iterator ui = units.find(route.front());
- assert(ui != units.end());
+ wassert(ui != units.end());
ui->second.set_goto(gamemap::location());
@@ -1680,7 +1681,7 @@
steps.pop_back();
}
- assert(steps.size() <= route.size());
+ wassert(steps.size() <= route.size());
if (next_unit != NULL)
*next_unit = steps.back();
@@ -1756,7 +1757,7 @@
for(std::set<gamemap::location>::const_iterator i =
seen_units.begin(); i != seen_units.end(); ++i) {
LOG_NG << "processing unit at " << (i->x+1) <<
"," << (i->y+1) << "\n";
const unit_map::const_iterator u =
units.find(*i);
- assert(u != units.end());
+ wassert(u != units.end());
if(team.is_enemy(u->second.side())) {
++nenemies;
} else {
@@ -1818,7 +1819,7 @@
game_events::fire("sighted",*seen,steps.back());
}
- assert(steps.size() <= route.size());
+ wassert(steps.size() <= route.size());
return steps.size();
}
@@ -1827,7 +1828,7 @@
const gamemap& map, const std::vector<team>& teams)
{
const unit_map::const_iterator u_it = units.find(loc);
- assert(u_it != units.end());
+ wassert(u_it != units.end());
const unit& u = u_it->second;
const team& current_team = teams[u.side()-1];
Index: wesnoth/src/ai.cpp
diff -u wesnoth/src/ai.cpp:1.128 wesnoth/src/ai.cpp:1.129
--- wesnoth/src/ai.cpp:1.128 Sun Dec 5 22:14:29 2004
+++ wesnoth/src/ai.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: ai.cpp,v 1.128 2004/12/05 22:14:29 silene Exp $ */
+/* $Id: ai.cpp,v 1.129 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,6 +32,7 @@
#include "statistics.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <iostream>
@@ -103,7 +104,7 @@
int choose_weapon(const location& attacker, const location& defender) {
const unit_map::const_iterator att =
get_info().units.find(attacker);
- assert(att != get_info().units.end());
+ wassert(att != get_info().units.end());
const std::vector<attack_type>& attacks = att->second.attacks();
@@ -349,7 +350,7 @@
//stop the user from issuing any commands while the unit is moving
const command_disabler disable_commands;
- assert(info_.units.find(to) == info_.units.end() || from == to);
+ wassert(info_.units.find(to) == info_.units.end() || from == to);
info_.disp.select_hex(from);
info_.disp.update_display();
@@ -358,7 +359,7 @@
unit_map::iterator u_it = info_.units.find(from);
if(u_it == info_.units.end()) {
lg::err(lg::ai) << "Could not find unit at " << from.x << ", "
<< from.y << "\n";
- assert(false);
+ wassert(false);
return location();
}
@@ -1275,7 +1276,7 @@
LOG_AI << "choosing move...\n";
std::pair<location,location> move =
choose_move(targets,srcdst,dstsrc,enemy_srcdst,enemy_dstsrc);
for(std::vector<target>::const_iterator ittg = targets.begin();
ittg != targets.end(); ++ittg) {
- assert(map_.on_board(ittg->loc));
+ wassert(map_.on_board(ittg->loc));
}
if(move.first.valid() == false) {
@@ -1621,7 +1622,7 @@
const std::vector<std::string>& options =
current_team().recruitment_pattern();
if(options.empty()) {
- assert(false);
+ wassert(false);
return;
}
Index: wesnoth/src/ai_attack.cpp
diff -u wesnoth/src/ai_attack.cpp:1.57 wesnoth/src/ai_attack.cpp:1.58
--- wesnoth/src/ai_attack.cpp:1.57 Sun Dec 5 18:37:36 2004
+++ wesnoth/src/ai_attack.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: ai_attack.cpp,v 1.57 2004/12/05 18:37:36 silene Exp $ */
+/* $Id: ai_attack.cpp,v 1.58 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -19,9 +19,9 @@
#include "log.hpp"
#include "pathfind.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
-#include <cassert>
#include <cstdlib>
#include <iostream>
#include <set>
@@ -67,7 +67,7 @@
double rating_to_beat = cur_rating;
if(!cur_analysis.movements.empty()) {
- assert(cur_analysis.movements.size() < 6);
+ wassert(cur_analysis.movements.size() < 6);
double& best_res =
best_results[cur_analysis.movements.size()-1];
rating_to_beat = best_res = maximum(best_res,cur_rating);
}
@@ -76,7 +76,7 @@
const location current_unit = units[i];
const unit_map::const_iterator unit_itor =
units_.find(current_unit);
- assert(unit_itor != units_.end());
+ wassert(unit_itor != units_.end());
//see if the unit has the backstab ability -- units with
backstab
//will want to try to have a friendly unit opposite the
position they move to
@@ -251,7 +251,7 @@
const std::set<battle_type>::const_iterator cache_itor =
weapon_choice_cache.find(battle);
if(cache_itor != weapon_choice_cache.end()) {
- assert(*cache_itor == battle);
+ wassert(*cache_itor == battle);
++cache_hits;
cur_stats = cache_itor->stats;
@@ -261,7 +261,7 @@
<< "/" << itor->second.attacks().size() <<
"\n";
}
- assert(size_t(cache_itor->weapon) <
itor->second.attacks().size());
+ wassert(size_t(cache_itor->weapon) <
itor->second.attacks().size());
return cache_itor->weapon;
}
@@ -274,7 +274,7 @@
int current_choice = -1;
double current_rating = 0.0;
const std::vector<attack_type>& attacks = itor->second.attacks();
- assert(!attacks.empty());
+ wassert(!attacks.empty());
const unit_map::const_iterator d_itor = units_.find(def);
int d_hitpoints = d_itor->second.hitpoints();
@@ -297,7 +297,7 @@
}
}
- assert(size_t(current_choice) < attacks.size());
+ wassert(size_t(current_choice) < attacks.size());
battle.stats = cur_stats;
battle.weapon = current_choice;
@@ -311,7 +311,7 @@
const ai::move_map& enemy_dstsrc, const
ai::move_map& enemy_srcdst)
{
const unit_map::const_iterator defend_it = units.find(target);
- assert(defend_it != units.end());
+ wassert(defend_it != units.end());
//see if the target is a threat to our leader or an ally's leader
gamemap::location adj[6];
@@ -354,7 +354,7 @@
battle_stats bat_stats;
const int weapon = ai_obj.choose_weapon(m->first,target,
bat_stats, map[m->second.x][m->second.y],true);
- assert(weapon != -1);
+ wassert(weapon != -1);
weapons.push_back(weapon);
stats.push_back(bat_stats);
Index: wesnoth/src/ai_move.cpp
diff -u wesnoth/src/ai_move.cpp:1.53 wesnoth/src/ai_move.cpp:1.54
--- wesnoth/src/ai_move.cpp:1.53 Sun Dec 5 22:14:29 2004
+++ wesnoth/src/ai_move.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: ai_move.cpp,v 1.53 2004/12/05 22:14:29 silene Exp $ */
+/* $Id: ai_move.cpp,v 1.54 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -19,6 +19,7 @@
#include "log.hpp"
#include "map.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <iostream>
@@ -67,7 +68,7 @@
if(units_.count(loc))
res *= 4.0;
- assert(res > 0);
+ wassert(res > 0);
return res;
}
@@ -110,7 +111,7 @@
}
}
- assert(threats.empty() == false);
+ wassert(threats.empty() == false);
const double value = threat/double(threats.size());
for(std::set<gamemap::location>::const_iterator i =
threats.begin(); i != threats.end(); ++i) {
@@ -122,7 +123,7 @@
if(has_leader && current_team().village_value() > 0.0) {
const std::vector<location>& villages = map_.villages();
for(std::vector<location>::const_iterator t = villages.begin();
t != villages.end(); ++t) {
- assert(map_.on_board(*t));
+ wassert(map_.on_board(*t));
bool get_village = true;
for(size_t i = 0; i != teams_.size(); ++i) {
if(!current_team().is_enemy(i+1) &&
teams_[i].owns_village(*t)) {
@@ -145,7 +146,7 @@
//is an enemy leader
if(u->second.can_recruit() &&
current_team().is_enemy(u->second.side())) {
- assert(map_.on_board(u->first));
+ wassert(map_.on_board(u->first));
targets.push_back(target(u->first,current_team().leader_value(),target::LEADER));
}
@@ -177,7 +178,7 @@
}
}
- assert(new_values.size() == targets.size());
+ wassert(new_values.size() == targets.size());
for(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];
@@ -385,7 +386,7 @@
std::vector<target>::const_iterator ittg;
for(ittg = targets.begin(); ittg != targets.end(); ++ittg) {
- assert(map_.on_board(ittg->loc));
+ wassert(map_.on_board(ittg->loc));
}
paths::route best_route;
@@ -423,7 +424,7 @@
user_interact();
- assert(map_.on_board(tg->loc));
+ wassert(map_.on_board(tg->loc));
const paths::route cur_route = a_star_search(u->first,tg->loc,
minimum(tg->value/best_rating,500.0),
&cost_calc);
@@ -532,10 +533,10 @@
LOG_AI << "best unit: " << (best->first.x+1) << "," <<
(best->first.y+1) << "\n";
- assert(best_target >= targets.begin() && best_target < targets.end());
+ wassert(best_target >= targets.begin() && best_target < targets.end());
for(ittg = targets.begin(); ittg != targets.end(); ++ittg) {
- assert(map_.on_board(ittg->loc));
+ wassert(map_.on_board(ittg->loc));
}
//if our target is a position to support, then we
Index: wesnoth/src/builder.cpp
diff -u wesnoth/src/builder.cpp:1.39 wesnoth/src/builder.cpp:1.40
--- wesnoth/src/builder.cpp:1.39 Thu Nov 18 22:00:12 2004
+++ wesnoth/src/builder.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: builder.cpp,v 1.39 2004/11/18 22:00:12 ydirson Exp $ */
+/* $Id: builder.cpp,v 1.40 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -18,6 +18,7 @@
#include "log.hpp"
#include "terrain.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#define ERR_NG lg::err(lg::engine)
@@ -122,14 +123,14 @@
terrain_builder::tile& terrain_builder::tilemap::operator[](const
gamemap::location &loc)
{
- assert(on_map(loc));
+ wassert(on_map(loc));
return map_[(loc.x+1) + (loc.y+1)*(x_+2)];
}
const terrain_builder::tile& terrain_builder::tilemap::operator[] (const
gamemap::location &loc) const
{
- assert(on_map(loc));
+ wassert(on_map(loc));
return map_[(loc.x+1) + (loc.y+1)*(x_+2)];
}
@@ -331,7 +332,7 @@
{ 1./2. , 3./4., -1., 1./2. },
};
- assert(angle >= 0);
+ wassert(angle >= 0);
angle %= 6;
terrain_constraint ret = constraint;
Index: wesnoth/src/cavegen.cpp
diff -u wesnoth/src/cavegen.cpp:1.10 wesnoth/src/cavegen.cpp:1.11
--- wesnoth/src/cavegen.cpp:1.10 Sun Dec 5 22:14:29 2004
+++ wesnoth/src/cavegen.cpp Fri Dec 31 21:01:37 2004
@@ -4,6 +4,7 @@
#include "log.hpp"
#include "pathfind.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#define LOG_NG lg::info(lg::engine)
@@ -188,7 +189,7 @@
if(itor == chamber_ids_.end())
continue;
- assert(itor->second < chambers_.size());
+ wassert(itor->second < chambers_.size());
passages_.push_back(passage(new_chamber.center,chambers_[itor->second].center,**p));
}
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.118 wesnoth/src/config.cpp:1.119
--- wesnoth/src/config.cpp:1.118 Fri Dec 31 00:46:41 2004
+++ wesnoth/src/config.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.118 2004/12/31 00:46:41 Sirp Exp $ */
+/* $Id: config.cpp,v 1.119 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -14,7 +14,6 @@
#include "global.hpp"
#include <algorithm>
-#include <cassert>
#include <cctype>
#include <fstream>
#include <iostream>
@@ -29,6 +28,7 @@
#include "gettext.hpp"
#include "log.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "wesconfig.h"
#define ERR_CF lg::err(lg::config)
@@ -500,7 +500,7 @@
case ELEMENT_NAME:
if(c == ']') {
if(value == "end" || value.empty() ==
false && value[0] == '/') {
- assert(!elements.empty());
+ wassert(!elements.empty());
if(value[0] == '/' &&
std::string("/" +
element_names.top()) != value) {
@@ -832,7 +832,7 @@
res.resize(write_size());
const std::string::iterator i = write_internal(res.begin());
- assert(i == res.end());
+ wassert(i == res.end());
if(i != res.end()) {
ERR_CF << "size of config buffer: " << (i - res.begin()) << "/"
<< res.size() << "\n";
}
@@ -1115,36 +1115,36 @@
ordered_children.push_back(child_pos(children.find(key),v.size()-1));
return *v.back();
}
-
-config& config::add_child_at(const std::string& key, const config& val, size_t
index)
-{
- child_list& v = children[key];
- if(index > v.size()) {
- throw error("illegal index to add child at");
- }
-
- v.insert(v.begin()+index,new config(val));
-
- bool inserted = false;
-
- const child_pos value(children.find(key),index);
-
- std::vector<child_pos>::iterator ord = ordered_children.begin();
- for(; ord != ordered_children.end(); ++ord) {
- if(!inserted && ord->index == index && ord->pos->first == key) {
- ord = ordered_children.insert(ord,value);
- inserted = true;
- } else if(ord->index >= index && ord->pos->first == key) {
- ord->index++;
- }
- }
-
- if(!inserted) {
- ordered_children.push_back(value);
- }
-
- return *v[index];
-}
+
+config& config::add_child_at(const std::string& key, const config& val, size_t
index)
+{
+ child_list& v = children[key];
+ if(index > v.size()) {
+ throw error("illegal index to add child at");
+ }
+
+ v.insert(v.begin()+index,new config(val));
+
+ bool inserted = false;
+
+ const child_pos value(children.find(key),index);
+
+ std::vector<child_pos>::iterator ord = ordered_children.begin();
+ for(; ord != ordered_children.end(); ++ord) {
+ if(!inserted && ord->index == index && ord->pos->first == key) {
+ ord = ordered_children.insert(ord,value);
+ inserted = true;
+ } else if(ord->index >= index && ord->pos->first == key) {
+ ord->index++;
+ }
+ }
+
+ if(!inserted) {
+ ordered_children.push_back(value);
+ }
+
+ return *v[index];
+}
struct remove_ordered {
remove_ordered(const std::string& key) : key_(key) {}
@@ -1176,7 +1176,7 @@
//remove from the child map
child_list& v = children[key];
- assert(index < v.size());
+ wassert(index < v.size());
config* const res = v[index];
v.erase(v.begin()+index);
delete res;
@@ -1661,7 +1661,7 @@
for(i = child_inserts.begin(); i != child_inserts.end(); ++i) {
const size_t index = atoi((**i)["index"].c_str());
for(all_children_iterator j = (*i)->ordered_begin(); j !=
(*i)->ordered_end(); ++j) {
- const std::pair<const std::string*,const config*> item
= *j;
+ const std::pair<const std::string*,const config*> item
= *j;
add_child_at(*item.first,*item.second,index);
}
}
@@ -1671,7 +1671,7 @@
const size_t index = atoi((**i)["index"].c_str());
for(all_children_iterator j = (*i)->ordered_begin(); j !=
(*i)->ordered_end(); ++j) {
const std::pair<const std::string*,const config*> item
= *j;
-
+
remove_child(*item.first,index);
}
}
Index: wesnoth/src/config.hpp
diff -u wesnoth/src/config.hpp:1.51 wesnoth/src/config.hpp:1.52
--- wesnoth/src/config.hpp:1.51 Fri Dec 31 00:46:41 2004
+++ wesnoth/src/config.hpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: config.hpp,v 1.51 2004/12/31 00:46:41 Sirp Exp $ */
+/* $Id: config.hpp,v 1.52 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -13,7 +13,6 @@
#ifndef CONFIG_HPP_INCLUDED
#define CONFIG_HPP_INCLUDED
-#include <cassert>
#include <map>
#include <sstream>
#include <string>
@@ -59,12 +58,12 @@
preproc_define(const std::string& val, const std::vector<std::string>&
args)
: value(val), arguments(args) {}
std::string value;
- std::vector<std::string> arguments;
+ std::vector<std::string> arguments;
};
-typedef std::map<std::string,preproc_define> preproc_map;
-
-inline bool operator==(const preproc_define& a, const preproc_define& b) {
return a.value == b.value && a.arguments == b.arguments; }
+typedef std::map<std::string,preproc_define> preproc_map;
+
+inline bool operator==(const preproc_define& a, const preproc_define& b) {
return a.value == b.value && a.arguments == b.arguments; }
inline bool operator!=(const preproc_define& a, const preproc_define& b) {
return !operator==(a,b); }
//function to use the WML preprocessor on a file, and returns the resulting
@@ -132,7 +131,7 @@
config* child(const std::string& key);
const config* child(const std::string& key) const;
config& add_child(const std::string& key);
- config& add_child(const std::string& key, const config& val);
+ config& add_child(const std::string& key, const config& val);
config& add_child_at(const std::string& key, const config& val, size_t
index);
std::string& operator[](const std::string& key);
const std::string& operator[](const std::string& key) const;
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.78 wesnoth/src/dialogs.cpp:1.79
--- wesnoth/src/dialogs.cpp:1.78 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/dialogs.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.78 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: dialogs.cpp,v 1.79 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -26,6 +26,7 @@
#include "replay.hpp"
#include "show_dialog.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "widgets/menu.hpp"
#include "widgets/progressbar.hpp"
@@ -214,7 +215,7 @@
NULL,NULL,"",NULL,-1,NULL,&options);
//see if the user doesn't want to be asked this again
- assert(options.empty() == false);
+ wassert(options.empty() == false);
if(options.front().checked) {
preferences::set_ask_delete_saves(false);
}
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.283 wesnoth/src/display.cpp:1.284
--- wesnoth/src/display.cpp:1.283 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/display.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.283 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: display.cpp,v 1.284 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,11 +32,11 @@
#include "tooltips.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "SDL_image.h"
#include <algorithm>
-#include <cassert>
#include <cmath>
#include <iostream>
#include <sstream>
@@ -286,32 +286,32 @@
x_modifier = 1;
y_modifier = 0;
}
- }
-
- const gamemap::location res(x_base + x_modifier, y_base + y_modifier);
-
- if(nearest_hex != NULL) {
- const int westx = (get_location_x(res) - map_area().x + xpos_)
+ hex_size()/3;
- const int eastx = westx + hex_size()/3;
- const int centery = (get_location_y(res) - map_area().y +
ypos_) + hex_size()/2;
-
- const bool west = x < westx;
- const bool east = x > eastx;
- const bool north = y < centery;
-
- if(north && west) {
- *nearest_hex = gamemap::location::NORTH_WEST;
- } else if(north && east) {
- *nearest_hex = gamemap::location::NORTH_EAST;
- } else if(north) {
- *nearest_hex = gamemap::location::NORTH;
- } else if(west) {
- *nearest_hex = gamemap::location::SOUTH_WEST;
- } else if(east) {
- *nearest_hex = gamemap::location::SOUTH_EAST;
- } else {
- *nearest_hex = gamemap::location::SOUTH;
- }
+ }
+
+ const gamemap::location res(x_base + x_modifier, y_base + y_modifier);
+
+ if(nearest_hex != NULL) {
+ const int westx = (get_location_x(res) - map_area().x + xpos_)
+ hex_size()/3;
+ const int eastx = westx + hex_size()/3;
+ const int centery = (get_location_y(res) - map_area().y +
ypos_) + hex_size()/2;
+
+ const bool west = x < westx;
+ const bool east = x > eastx;
+ const bool north = y < centery;
+
+ if(north && west) {
+ *nearest_hex = gamemap::location::NORTH_WEST;
+ } else if(north && east) {
+ *nearest_hex = gamemap::location::NORTH_EAST;
+ } else if(north) {
+ *nearest_hex = gamemap::location::NORTH;
+ } else if(west) {
+ *nearest_hex = gamemap::location::SOUTH_WEST;
+ } else if(east) {
+ *nearest_hex = gamemap::location::SOUTH_EAST;
+ } else {
+ *nearest_hex = gamemap::location::SOUTH;
+ }
}
return res;
@@ -1149,7 +1149,7 @@
}
}
- assert(energy_file != NULL);
+ wassert(energy_file != NULL);
if(energy_file == NULL) {
ERR_DP << "energy file is NULL\n";
return;
@@ -2001,7 +2001,7 @@
void display::set_team(size_t team)
{
- assert(team < teams_.size());
+ wassert(team < teams_.size());
currentTeam_ = team;
labels().recalculate_shroud();
@@ -2009,7 +2009,7 @@
void display::set_playing_team(size_t team)
{
- assert(team < teams_.size());
+ wassert(team < teams_.size());
activeTeam_ = team;
invalidate_game_status();
}
@@ -2055,7 +2055,7 @@
void display::debug_highlight(const gamemap::location& loc, double amount)
{
- assert(game_config::debug);
+ wassert(game_config::debug);
debugHighlights_[loc] += amount;
}
@@ -2106,7 +2106,7 @@
for(std::vector<gui::button>::iterator i = buttons_.begin(); i !=
buttons_.end(); ++i) {
if(i->pressed()) {
const size_t index = i - buttons_.begin();
- assert(index < theme_.menus().size());
+ wassert(index < theme_.menus().size());
return &theme_.menus()[index];
}
}
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.22
wesnoth/src/editor/editor_palettes.cpp:1.23
--- wesnoth/src/editor/editor_palettes.cpp:1.22 Tue Nov 30 21:41:19 2004
+++ wesnoth/src/editor/editor_palettes.cpp Fri Dec 31 21:01:38 2004
@@ -21,8 +21,8 @@
#include "../reports.hpp"
#include "../language.hpp"
#include "../util.hpp"
+#include "../wassert.hpp"
-#include <cassert>
namespace map_editor {
Index: wesnoth/src/events.cpp
diff -u wesnoth/src/events.cpp:1.26 wesnoth/src/events.cpp:1.27
--- wesnoth/src/events.cpp:1.26 Thu Nov 18 04:08:32 2004
+++ wesnoth/src/events.cpp Fri Dec 31 21:01:37 2004
@@ -6,11 +6,11 @@
#include "mouse.hpp"
#include "preferences.hpp"
#include "video.hpp"
+#include "wassert.hpp"
#include "SDL.h"
#include <algorithm>
-#include <cassert>
#include <deque>
#include <utility>
#include <vector>
@@ -141,7 +141,7 @@
event_context::~event_context()
{
if(create_) {
- assert(event_contexts.empty() == false);
+ wassert(event_contexts.empty() == false);
event_contexts.pop_back();
}
@@ -155,7 +155,7 @@
handler::~handler()
{
- assert(event_contexts.empty() == false);
+ wassert(event_contexts.empty() == false);
for(std::deque<context>::reverse_iterator i = event_contexts.rbegin();
i != event_contexts.rend(); ++i) {
if(i->remove_handler(this)) {
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.178 wesnoth/src/game.cpp:1.179
--- wesnoth/src/game.cpp:1.178 Fri Dec 31 02:21:00 2004
+++ wesnoth/src/game.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.178 2004/12/31 02:21:00 ydirson Exp $ */
+/* $Id: game.cpp,v 1.179 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -51,6 +51,7 @@
#include "unit_types.hpp"
#include "unit.hpp"
#include "video.hpp"
+#include "wassert.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
@@ -1128,7 +1129,7 @@
//force a reload of configuration information
const bool old_cache = use_caching_;
- use_caching_ = false;
+ use_caching_ = false;
old_defines_map_.clear();
refresh_game_cfg();
use_caching_ = old_cache;
Index: wesnoth/src/game_events.cpp
diff -u wesnoth/src/game_events.cpp:1.116 wesnoth/src/game_events.cpp:1.117
--- wesnoth/src/game_events.cpp:1.116 Sun Dec 5 22:14:29 2004
+++ wesnoth/src/game_events.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: game_events.cpp,v 1.116 2004/12/05 22:14:29 silene Exp $ */
+/* $Id: game_events.cpp,v 1.117 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -24,6 +24,7 @@
#include "sound.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <cstdlib>
#include <deque>
@@ -1010,7 +1011,7 @@
//implement the consequences of the choice
if(options.empty() == false) {
- assert(size_t(option_chosen) < menu_items.size());
+ wassert(size_t(option_chosen) < menu_items.size());
for(config::const_child_itors events =
option_events[option_chosen];
events.first != events.second; ++events.first) {
Index: wesnoth/src/halo.cpp
diff -u wesnoth/src/halo.cpp:1.12 wesnoth/src/halo.cpp:1.13
--- wesnoth/src/halo.cpp:1.12 Thu Nov 18 04:08:32 2004
+++ wesnoth/src/halo.cpp Fri Dec 31 21:01:37 2004
@@ -5,9 +5,9 @@
#include "preferences.hpp"
#include "sdl_utils.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
-#include <cassert>
#include <map>
namespace halo
@@ -55,7 +55,7 @@
: images_(img), reverse_(orientation == REVERSE), origx_(xpos), origy_(ypos),
x_(xpos), y_(ypos),
origzoom_(disp->zoom()), zoom_(disp->zoom()), surf_(NULL), buffer_(NULL),
rect_(empty_rect)
{
- assert(disp != NULL);
+ wassert(disp != NULL);
// std::cerr << "Constructing halo sequence from image " << img << "\n";
set_location(xpos,ypos);
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.63 wesnoth/src/help.cpp:1.64
--- wesnoth/src/help.cpp:1.63 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/help.cpp Fri Dec 31 21:01:37 2004
@@ -24,12 +24,12 @@
#include "show_dialog.hpp"
#include "unit.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
#include "widgets/scrollbar.hpp"
#include "widgets/widget.hpp"
-#include <cassert>
#include <algorithm>
#include <iostream>
#include <list>
@@ -1204,7 +1204,7 @@
preferences::encountered_terrains().begin(),
terrain_end =
preferences::encountered_terrains().end();
terrain_it != terrain_end; terrain_it++) {
- assert(terrain_it->size() > 0);
+ wassert(terrain_it->size() > 0);
const gamemap::TERRAIN terrain =
(*terrain_it)[0];
if (terrain == gamemap::FOGGED || terrain ==
gamemap::VOID_TERRAIN)
continue;
@@ -1258,7 +1258,7 @@
} else if (desc_type == FULL_DESCRIPTION) {
unit_topic.text = new unit_topic_generator(type);
} else {
- assert(false);
+ wassert(false);
}
topics.push_back(unit_topic);
}
@@ -1327,7 +1327,7 @@
preferences::encountered_terrains().begin();
terrain_it !=
preferences::encountered_terrains().end();
terrain_it++) {
- assert(terrain_it->size() > 0);
+ wassert(terrain_it->size() > 0);
const gamemap::TERRAIN terrain = (*terrain_it)[0];
show_info_about.push_back(terrain);
}
Index: wesnoth/src/image.cpp
diff -u wesnoth/src/image.cpp:1.68 wesnoth/src/image.cpp:1.69
--- wesnoth/src/image.cpp:1.68 Mon Dec 27 23:25:29 2004
+++ wesnoth/src/image.cpp Fri Dec 31 21:01:37 2004
@@ -10,6 +10,7 @@
#include "sdl_utils.hpp"
#include "team.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "SDL_image.h"
@@ -246,7 +247,7 @@
default:
return surface(NULL);
}
- assert(false);
+ wassert(false);
}
#if 0
@@ -595,7 +596,7 @@
res = locator(alternative, i_locator.get_loc());
break;
default:
- assert(false);
+ wassert(false);
}
i_locator.add_to_cache(alternative_images_, res);
@@ -691,7 +692,7 @@
surf =
surface(adjust_surface_colour(surf,-50,-50,-50));
}
- assert(surf != NULL);
+ wassert(surf != NULL);
SDL_Rect maprect = {x*scale*3/4,y*scale +
(is_odd(x) ? scale/2 : 0),0,0};
SDL_BlitSurface(surf, NULL, minimap, &maprect);
Index: wesnoth/src/log.cpp
diff -u wesnoth/src/log.cpp:1.18 wesnoth/src/log.cpp:1.19
--- wesnoth/src/log.cpp:1.18 Thu Nov 18 22:00:12 2004
+++ wesnoth/src/log.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: log.cpp,v 1.18 2004/11/18 22:00:12 ydirson Exp $ */
+/* $Id: log.cpp,v 1.19 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
2004 by Guillaume Melquiond <address@hidden>
@@ -19,7 +19,6 @@
#include "log.hpp"
#include <algorithm>
-#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
Index: wesnoth/src/map.cpp
diff -u wesnoth/src/map.cpp:1.44 wesnoth/src/map.cpp:1.45
--- wesnoth/src/map.cpp:1.44 Wed Dec 8 02:09:56 2004
+++ wesnoth/src/map.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: map.cpp,v 1.44 2004/12/08 02:09:56 Sirp Exp $ */
+/* $Id: map.cpp,v 1.45 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,9 +17,9 @@
#include "map.hpp"
#include "pathfind.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
-#include <cassert>
#include <cctype>
#include <cstdlib>
#include <iostream>
@@ -155,7 +155,7 @@
case SOUTH_WEST: return gamemap::location(x-1,y+is_odd(x));
case NORTH_WEST: return gamemap::location(x-1,y-is_even(x));
default:
- assert(false);
+ wassert(false);
return gamemap::location();
}
}
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.81
wesnoth/src/multiplayer_client.cpp:1.82
--- wesnoth/src/multiplayer_client.cpp:1.81 Sun Dec 26 21:59:19 2004
+++ wesnoth/src/multiplayer_client.cpp Fri Dec 31 21:01:37 2004
@@ -11,6 +11,7 @@
#include "scoped_resource.hpp"
#include "show_dialog.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <sstream>
@@ -485,7 +486,7 @@
leader = leader_selector.get_selected_leader();
}
- assert(choice < possible_sides.size());
+ wassert(choice < possible_sides.size());
const config& chosen_side = *possible_sides[choice];
team_name = response["name"] = chosen_side["name"];
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.92
wesnoth/src/multiplayer_connect.cpp:1.93
--- wesnoth/src/multiplayer_connect.cpp:1.92 Fri Dec 31 19:31:13 2004
+++ wesnoth/src/multiplayer_connect.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.92 2004/12/31 19:31:13 Sirp Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.93 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -28,6 +28,7 @@
#include "replay.hpp"
#include "show_dialog.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "widgets/textbox.hpp"
#include "widgets/button.hpp"
#include "widgets/combo.hpp"
@@ -146,7 +147,7 @@
(*level_ptr)["turns"] = turns.str();
}
- assert(level_ptr != NULL);
+ wassert(level_ptr != NULL);
if(scenario_data["era"].empty()) {
era_ = era;
@@ -414,8 +415,11 @@
scroll_pane_.set_location(scroll_pane_rect);
config::child_iterator sd;
+ std::cerr << "Getting here :P" << std::endl;
+
for(sd = sides.first; sd != sides.second; ++sd) {
const int side_num = sd - sides.first;
+ std::cerr << "Side num: " << side_num << std::endl;
//Player number
player_numbers_.push_back(gui::label(*disp_,
(*sd)->values["side"],
@@ -479,7 +483,7 @@
scroll_pane_.add_widget(&sliders_gold_[side_num], 490, 5 +
spos);
scroll_pane_.add_widget(&labels_gold_[side_num], 500 +
sliders_gold_[side_num].width(), 5 + spos);
- player_leaders_[side_num].set_combo(&combos_leader_[side_num]);
+ player_leaders_[side_num].set_combo(&combos_leader_[side_num]);
}
std::cerr << "done set_area()\n";
@@ -1035,15 +1039,15 @@
return full;
}
-
-size_t mp_connect::combo_index_to_team(size_t index) const
-{
- //in the case of loading a game, we may have the same team repeated
multiple times in the list
- //of team options. This function maps all such indexes to the same
number, by using the first
- //team of that name.
- if(index >= player_teams_.size()) {
- return 0;
- }
-
- return
std::find(player_teams_.begin(),player_teams_.end(),player_teams_[index]) -
player_teams_.begin();
+
+size_t mp_connect::combo_index_to_team(size_t index) const
+{
+ //in the case of loading a game, we may have the same team repeated
multiple times in the list
+ //of team options. This function maps all such indexes to the same
number, by using the first
+ //team of that name.
+ if(index >= player_teams_.size()) {
+ return 0;
+ }
+
+ return
std::find(player_teams_.begin(),player_teams_.end(),player_teams_[index]) -
player_teams_.begin();
}
\ No newline at end of file
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.56
wesnoth/src/multiplayer_lobby.cpp:1.57
--- wesnoth/src/multiplayer_lobby.cpp:1.56 Fri Dec 31 15:45:53 2004
+++ wesnoth/src/multiplayer_lobby.cpp Fri Dec 31 21:01:37 2004
@@ -14,6 +14,7 @@
#include "show_dialog.hpp"
#include "statistics.hpp"
#include "sound.hpp"
+#include "wassert.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
#include "widgets/textbox.hpp"
@@ -31,105 +32,105 @@
int yscale(display& disp, int y)
{
return (y*disp.y())/768;
-}
-
-const config* generate_game_options(const config& terrain_data, const config&
game_data, int& game_selection,
-
std::vector<std::string>& options, std::vector<bool>& game_vacant_slots,
std::vector<bool>& game_observers)
-{
- const config* const gamelist = game_data.child("gamelist");
-
- // Game List GUI
- if(gamelist == NULL) {
- return gamelist;
- }
-
- options.clear();
- game_vacant_slots.clear();
- game_observers.clear();
-
- config::const_child_itors i;
- for(i = gamelist->child_range("game"); i.first != i.second; ++i.first) {
-
- std::cerr << "game data here:" << (**i.first).write() << "end
game data here\n";
-
- std::stringstream str;
-
- //if this is the item that should be selected, make it selected
by default
- if(game_selection-- == 0) {
- str << DEFAULT_ITEM;
- }
-
- std::string map_data = (**i.first)["map_data"];
- if(map_data == "") {
- map_data = read_map((**i.first)["map"]);
- }
-
- if(map_data != "") {
- try {
- gamemap map(terrain_data,map_data);
- const surface
mini(image::getMinimap(100,100,map,0));
-
- //generate a unique id to show the map as
- char buf[50];
- sprintf(buf,"addr %p", (SDL_Surface*)mini);
-
- image::register_image(buf,mini);
-
- str << IMAGE_PREFIX << buf << COLUMN_SEPARATOR;
- } catch(gamemap::incorrect_format_exception& e) {
- std::cerr << "illegal map: " << e.msg_ << "\n";
- }
- } else {
- str << '(' << _("Shroud") << ')' << COLUMN_SEPARATOR;
- }
-
- std::string name = (**i.first)["name"];
- if(name.size() > 30)
- name.resize(30);
-
- str << name;
-
- const std::string& turn = (**i.first)["turn"];
- const std::string& slots = (**i.first)["slots"];
- if (!turn.empty()) {
- str << COLUMN_SEPARATOR << _("Turn") << ' ' << turn;
- } else if(!slots.empty()) {
- str << COLUMN_SEPARATOR << slots << ' '
- << gettext(slots == "1" ? N_("Vacant Slot") :
N_("Vacant Slots"));
- }
-
- options.push_back(str.str());
- game_vacant_slots.push_back(turn.empty() && slots != "" &&
slots != "0");
- game_observers.push_back((**i.first)["observer"] != "no");
- }
-
- return gamelist;
-}
-
-void generate_user_list(const config& game_data, std::vector<std::string>&
users, int& user_selection)
-{
- users.clear();
-
- for(config::const_child_itors i = game_data.child_range("user");
i.first != i.second; ++i.first) {
- std::string name = (**i.first)["name"];
- if(name.size() > 30)
- name.resize(30);
-
- const std::string avail = (**i.first)["available"];
-
- //display unavailable players in red
- if(avail == "no") {
- name.insert(name.begin(),'#');
- }
-
- //if this user should be selected
- if(user_selection-- == 0) {
- name.insert(name.begin(), DEFAULT_ITEM);
- }
-
- users.push_back(name);
- }
-}
+}
+
+const config* generate_game_options(const config& terrain_data, const config&
game_data, int& game_selection,
+
std::vector<std::string>& options, std::vector<bool>& game_vacant_slots,
std::vector<bool>& game_observers)
+{
+ const config* const gamelist = game_data.child("gamelist");
+
+ // Game List GUI
+ if(gamelist == NULL) {
+ return gamelist;
+ }
+
+ options.clear();
+ game_vacant_slots.clear();
+ game_observers.clear();
+
+ config::const_child_itors i;
+ for(i = gamelist->child_range("game"); i.first != i.second; ++i.first) {
+
+ std::cerr << "game data here:" << (**i.first).write() << "end
game data here\n";
+
+ std::stringstream str;
+
+ //if this is the item that should be selected, make it selected
by default
+ if(game_selection-- == 0) {
+ str << DEFAULT_ITEM;
+ }
+
+ std::string map_data = (**i.first)["map_data"];
+ if(map_data == "") {
+ map_data = read_map((**i.first)["map"]);
+ }
+
+ if(map_data != "") {
+ try {
+ gamemap map(terrain_data,map_data);
+ const surface
mini(image::getMinimap(100,100,map,0));
+
+ //generate a unique id to show the map as
+ char buf[50];
+ sprintf(buf,"addr %p", (SDL_Surface*)mini);
+
+ image::register_image(buf,mini);
+
+ str << IMAGE_PREFIX << buf << COLUMN_SEPARATOR;
+ } catch(gamemap::incorrect_format_exception& e) {
+ std::cerr << "illegal map: " << e.msg_ << "\n";
+ }
+ } else {
+ str << '(' << _("Shroud") << ')' << COLUMN_SEPARATOR;
+ }
+
+ std::string name = (**i.first)["name"];
+ if(name.size() > 30)
+ name.resize(30);
+
+ str << name;
+
+ const std::string& turn = (**i.first)["turn"];
+ const std::string& slots = (**i.first)["slots"];
+ if (!turn.empty()) {
+ str << COLUMN_SEPARATOR << _("Turn") << ' ' << turn;
+ } else if(!slots.empty()) {
+ str << COLUMN_SEPARATOR << slots << ' '
+ << gettext(slots == "1" ? N_("Vacant Slot") :
N_("Vacant Slots"));
+ }
+
+ options.push_back(str.str());
+ game_vacant_slots.push_back(turn.empty() && slots != "" &&
slots != "0");
+ game_observers.push_back((**i.first)["observer"] != "no");
+ }
+
+ return gamelist;
+}
+
+void generate_user_list(const config& game_data, std::vector<std::string>&
users, int& user_selection)
+{
+ users.clear();
+
+ for(config::const_child_itors i = game_data.child_range("user");
i.first != i.second; ++i.first) {
+ std::string name = (**i.first)["name"];
+ if(name.size() > 30)
+ name.resize(30);
+
+ const std::string avail = (**i.first)["available"];
+
+ //display unavailable players in red
+ if(avail == "no") {
+ name.insert(name.begin(),'#');
+ }
+
+ //if this user should be selected
+ if(user_selection-- == 0) {
+ name.insert(name.begin(), DEFAULT_ITEM);
+ }
+
+ users.push_back(name);
+ }
+}
}
@@ -185,17 +186,17 @@
gui::textbox chat_textbox(disp,chat_area.w,"",false);
std::vector<std::string> options;
- std::vector<bool> game_vacant_slots, game_observers;
-
+ std::vector<bool> game_vacant_slots, game_observers;
+
const config* gamelist = NULL;
- if(dlg == NULL) {
- gamelist =
generate_game_options(terrain_data,game_data,game_selection,options,game_vacant_slots,game_observers);
- if(gamelist == NULL) {
- std::cerr << "ERROR: could not find gamelist\n";
- return QUIT;
- }
- }
+ if(dlg == NULL) {
+ gamelist =
generate_game_options(terrain_data,game_data,game_selection,options,game_vacant_slots,game_observers);
+ if(gamelist == NULL) {
+ std::cerr << "ERROR: could not find gamelist\n";
+ return QUIT;
+ }
+ }
if(dlg == NULL && options.empty()) {
options.push_back(_("<no games open>"));
@@ -215,7 +216,7 @@
}
if(games_menu.selection() >= 0 && games_menu.selection() <
int(game_vacant_slots.size())) {
- assert(game_vacant_slots.size() ==
game_observers.size());
+ wassert(game_vacant_slots.size() ==
game_observers.size());
join_game.hide(!game_vacant_slots[games_menu.selection()]);
observe_game.hide(!game_observers[games_menu.selection()]);
@@ -225,8 +226,8 @@
}
std::vector<std::string> users;
-
- generate_user_list(game_data,users,user_selection);
+
+ generate_user_list(game_data,users,user_selection);
if(users.empty()) {
users.push_back(preferences::login());
@@ -239,9 +240,9 @@
users.push_back("error");
}
- gui::menu users_menu(disp,users);
-
- games_menu.set_numeric_keypress_selection(false);
+ gui::menu users_menu(disp,users);
+
+ games_menu.set_numeric_keypress_selection(false);
users_menu.set_numeric_keypress_selection(false);
// Set GUI locations
@@ -312,14 +313,14 @@
}
users_menu.process();
-
+
const bool games_available = game_vacant_slots.empty()
== false;
const bool double_click = games_menu.double_clicked();
const bool observe = observe_game.pressed() ||
games_available && double_click && join_game.hidden();
if(games_available && (observe || join_game.pressed()
|| double_click)) {
const size_t index =
size_t(games_menu.selection());
const config::const_child_itors i =
gamelist->child_range("game");
- assert(index < size_t(i.second - i.first));
+ wassert(index < size_t(i.second - i.first));
const std::string& id =
(**(i.first+index))["id"];
config response;
@@ -392,38 +393,38 @@
if(data.child("gamelist")) {
game_data = data;
break;
- } else if(data.child("gamelist_diff")) {
- const config old_gamelist =
game_data.child("gamelist") != NULL ? *game_data.child("gamelist") : config();
+ } else if(data.child("gamelist_diff")) {
+ const config old_gamelist =
game_data.child("gamelist") != NULL ? *game_data.child("gamelist") : config();
const int old_users =
game_data.get_children("user").size();
game_data.apply_diff(*data.child("gamelist_diff"));
- const int new_users =
game_data.get_children("user").size();
-
+ const int new_users =
game_data.get_children("user").size();
+
const config new_gamelist =
game_data.child("gamelist") != NULL ? *game_data.child("gamelist") : config();
if(new_users < old_users) {
sound::play_sound(game_config::sounds::user_leave);
} else if(new_users > old_users) {
sound::play_sound(game_config::sounds::user_arrive);
- }
-
-
generate_user_list(game_data,users,user_selection);
- users_menu.set_items(users);
-
- gamelist = game_data.child("gamelist");
- if(gamelist == NULL) {
- std::cerr << "ERROR: could not
find game list\n";
- return QUIT;
- }
-
- if(dlg == NULL && *gamelist !=
old_gamelist) {
-
generate_game_options(terrain_data,game_data,game_selection,options,game_vacant_slots,game_observers);
- }
-
- if(dlg == NULL && options.empty()) {
- options.push_back(_("<no games
open>"));
- }
-
- games_menu.set_items(options);
+ }
+
+
generate_user_list(game_data,users,user_selection);
+ users_menu.set_items(users);
+
+ gamelist = game_data.child("gamelist");
+ if(gamelist == NULL) {
+ std::cerr << "ERROR: could not
find game list\n";
+ return QUIT;
+ }
+
+ if(dlg == NULL && *gamelist !=
old_gamelist) {
+
generate_game_options(terrain_data,game_data,game_selection,options,game_vacant_slots,game_observers);
+ }
+
+ if(dlg == NULL && options.empty()) {
+ options.push_back(_("<no games
open>"));
+ }
+
+ games_menu.set_items(options);
} else if(data.child("error")) {
throw
network::error((*data.child("error"))["message"]);
} else if(data.child("message")) {
Index: wesnoth/src/network.cpp
diff -u wesnoth/src/network.cpp:1.48 wesnoth/src/network.cpp:1.49
--- wesnoth/src/network.cpp:1.48 Thu Dec 9 19:52:46 2004
+++ wesnoth/src/network.cpp Fri Dec 31 21:01:37 2004
@@ -4,11 +4,11 @@
#include "network.hpp"
#include "network_worker.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "SDL_net.h"
#include <algorithm>
-#include <cassert>
#include <cerrno>
#include <queue>
#include <iostream>
@@ -372,7 +372,7 @@
{
if(s == 0) {
while(sockets.empty() == false) {
- assert(sockets.back() != 0);
+ wassert(sockets.back() != 0);
disconnect(sockets.back());
}
@@ -527,7 +527,7 @@
}
const schema_map::iterator schema =
schemas.find(*i);
- assert(schema != schemas.end());
+ wassert(schema != schemas.end());
cfg.read_compressed(buffer,schema->second.incoming);
@@ -587,7 +587,7 @@
}
const schema_map::iterator schema = schemas.find(connection_num);
- assert(schema != schemas.end());
+ wassert(schema != schemas.end());
const std::string& value =
cfg.write_compressed(schema->second.outgoing);
@@ -600,7 +600,7 @@
buf.back() = 0;
const connection_map::iterator info = connections.find(connection_num);
- assert(info != connections.end());
+ wassert(info != connections.end());
network_worker_pool::queue_data(info->second.sock,buf);
}
Index: wesnoth/src/network_worker.cpp
diff -u wesnoth/src/network_worker.cpp:1.13 wesnoth/src/network_worker.cpp:1.14
--- wesnoth/src/network_worker.cpp:1.13 Thu Nov 18 04:08:32 2004
+++ wesnoth/src/network_worker.cpp Fri Dec 31 21:01:37 2004
@@ -4,8 +4,8 @@
#include "network_worker.hpp"
#include "network.hpp"
#include "thread.hpp"
+#include "wassert.hpp"
-#include <cassert>
#include <cerrno>
#include <iostream>
#include <map>
@@ -52,7 +52,7 @@
buffer_set::iterator itor = bufs.begin(),
itor_end = bufs.end();
for(; itor != itor_end; ++itor) {
socket_state_map::iterator lock_it =
sockets_locked.find((*itor)->sock);
- assert(lock_it != sockets_locked.end());
+ wassert(lock_it !=
sockets_locked.end());
if(lock_it->second == SOCKET_READY) {
lock_it->second = SOCKET_LOCKED;
break;
@@ -95,7 +95,7 @@
{
const threading::lock lock(*global_mutex);
socket_state_map::iterator lock_it =
sockets_locked.find(sent_buf->sock);
- assert(lock_it != sockets_locked.end());
+ wassert(lock_it != sockets_locked.end());
lock_it->second = result;
if(result == SOCKET_ERROR) {
++socket_errors;
Index: wesnoth/src/pathfind.cpp
diff -u wesnoth/src/pathfind.cpp:1.50 wesnoth/src/pathfind.cpp:1.51
--- wesnoth/src/pathfind.cpp:1.50 Fri Dec 10 23:43:29 2004
+++ wesnoth/src/pathfind.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: pathfind.cpp,v 1.50 2004/12/10 23:43:29 silene Exp $ */
+/* $Id: pathfind.cpp,v 1.51 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,6 +17,7 @@
#include "log.hpp"
#include "pathfind.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <cmath>
#include <iostream>
@@ -87,10 +88,10 @@
std::vector<location> locs;
while(!open_list.empty()) {
- assert(open_list.size() == open_list_ordered.size());
+ wassert(open_list.size() == open_list_ordered.size());
const list_map::iterator lowest_in_open =
open_list.find(open_list_ordered.begin()->second);
- assert(lowest_in_open != open_list.end());
+ wassert(lowest_in_open != open_list.end());
//move the lowest element from the open list to the closed list
closed_list.erase(lowest_in_open->first);
@@ -120,7 +121,7 @@
list_map::const_iterator itor =
open_list.find(loc);
if(itor == open_list.end()) {
itor = closed_list.find(loc);
- assert(itor !=
closed_list.end());
+ wassert(itor !=
closed_list.end());
}
loc = itor->second.parent;
@@ -130,7 +131,7 @@
rt.steps.push_back(dst);
rt.move_left = int(lowest_gcost +
obj->cost(dst, lowest_gcost));
- assert(rt.steps.front() == src);
+ wassert(rt.steps.front() == src);
LOG_PF << "exiting a* search (solved)\n";
@@ -454,7 +455,7 @@
int turns = 0, movement = u.movement_left();
for(std::vector<gamemap::location>::const_iterator i =
rt.steps.begin()+1;
i != rt.steps.end(); ++i) {
- assert(map.on_board(*i));
+ wassert(map.on_board(*i));
const int move_cost = u.movement_cost(map,map[i->x][i->y]);
movement -= move_cost;
if(movement < 0) {
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.313 wesnoth/src/playturn.cpp:1.314
--- wesnoth/src/playturn.cpp:1.313 Thu Dec 30 13:57:23 2004
+++ wesnoth/src/playturn.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.313 2004/12/30 13:57:23 Sirp Exp $ */
+/* $Id: playturn.cpp,v 1.314 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -33,6 +33,7 @@
#include "unit.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include "widgets/menu.hpp"
#include <cmath>
@@ -264,11 +265,11 @@
}
void turn_info::mouse_motion(const SDL_MouseMotionEvent& event)
-{
- mouse_motion(event.x,event.y);
-}
-
-void turn_info::mouse_motion(int x, int y)
+{
+ mouse_motion(event.x,event.y);
+}
+
+void turn_info::mouse_motion(int x, int y)
{
if(minimap_scrolling_) {
//if the game is run in a window, we could miss a LMB/MMB up
event
@@ -289,7 +290,7 @@
}
if(minimap_scrolling_) return;
}
-
+
gamemap::location::DIRECTION nearest_hex;
const team& current_team = teams_[team_num_-1];
const gamemap::location new_hex = gui_.hex_clicked_on(x,y,&nearest_hex);
@@ -310,7 +311,7 @@
const unit_map::const_iterator mouseover_unit =
find_unit(new_hex);
gamemap::location attack_from;
- if(selected_unit != units_.end() && mouseover_unit !=
units_.end()) {
+ if(selected_unit != units_.end() && mouseover_unit !=
units_.end()) {
const gamemap::location preferred =
new_hex.get_direction(nearest_hex);
attack_from =
current_unit_attacks_from(new_hex,&preferred);
}
@@ -385,7 +386,7 @@
}
}
- last_hex_ = new_hex;
+ last_hex_ = new_hex;
last_nearest_ = nearest_hex;
}
@@ -450,8 +451,8 @@
} //end anonymous namespace
void turn_info::mouse_press(const SDL_MouseButtonEvent& event)
-{
- mouse_motion(event.x,event.y);
+{
+ mouse_motion(event.x,event.y);
if(is_left_click(event) && event.state == SDL_RELEASED) {
minimap_scrolling_ = false;
@@ -731,7 +732,7 @@
redo_stack_.clear();
- assert(moves <= steps.size());
+ wassert(moves <= steps.size());
const gamemap::location& dst = steps[moves-1];
const unit_map::const_iterator u = units_.find(dst);
@@ -772,7 +773,7 @@
gui_.scroll_to_tile(loc.x,loc.y,display::WARP,false);
return;
}
-
+
gamemap::location::DIRECTION nearest_hex;
gamemap::location hex =
gui_.hex_clicked_on(event.x,event.y,&nearest_hex);
@@ -790,12 +791,12 @@
current_paths_.routes.find(hex);
unit_map::iterator enemy = find_unit(hex);
-
- const gamemap::location src = selected_hex_;
- paths orig_paths = current_paths_;
+
+ const gamemap::location src = selected_hex_;
+ paths orig_paths = current_paths_;
//see if we're trying to do a move-and-attack
- if(!browse_ && u != units_.end() && enemy != units_.end()) {
+ if(!browse_ && u != units_.end() && enemy != units_.end()) {
const gamemap::location preferred =
hex.get_direction(nearest_hex);
const gamemap::location& attack_from =
current_unit_attacks_from(hex,&preferred);
if(attack_from.valid()) {
@@ -806,10 +807,10 @@
enemy != units_.end() &&
current_team().is_enemy(enemy->second.side())) {
if(attack_enemy(u,enemy) == false) {
undo();
- selected_hex_ = src;
- gui_.select_hex(src);
- current_paths_ = orig_paths;
- gui_.set_paths(¤t_paths_);
+ selected_hex_ = src;
+ gui_.select_hex(src);
+ current_paths_ = orig_paths;
+ gui_.set_paths(¤t_paths_);
return;
}
}
@@ -946,7 +947,7 @@
void turn_info::move_unit_to_loc(const unit_map::const_iterator& ui, const
gamemap::location& target, bool continue_move)
{
- assert(ui != units_.end());
+ wassert(ui != units_.end());
unit u = ui->second;
const shortest_path_calculator
calc(u,current_team(),visible_units(),teams_,map_,status_);
@@ -965,7 +966,7 @@
if(route.steps.empty())
return;
- assert(route.steps.front() == ui->first);
+ wassert(route.steps.front() == ui->first);
route.move_left = route_turns_to_complete(ui->second,map_,route);
gui_.set_route(&route);
@@ -1429,7 +1430,7 @@
std::vector<gamemap::location> route = action.route;
const unit_map::iterator u = units_.find(route.front());
if(u == units_.end()) {
- assert(false);
+ wassert(false);
return;
}
@@ -1797,7 +1798,7 @@
const std::map<std::string,unit_type>::const_iterator
u_type = gameinfo_.unit_types.find(name);
- assert(u_type != gameinfo_.unit_types.end());
+ wassert(u_type != gameinfo_.unit_types.end());
if(u_type->second.cost() > current_team.gold()) {
gui::show_dialog(gui_,NULL,"",
Index: wesnoth/src/replay.cpp
diff -u wesnoth/src/replay.cpp:1.87 wesnoth/src/replay.cpp:1.88
--- wesnoth/src/replay.cpp:1.87 Sat Nov 27 08:41:49 2004
+++ wesnoth/src/replay.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: replay.cpp,v 1.87 2004/11/27 08:41:49 silene Exp $ */
+/* $Id: replay.cpp,v 1.88 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -29,6 +29,7 @@
#include "statistics.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <cstdio>
#include <cstdlib>
@@ -499,13 +500,13 @@
const config* replay::get_random_results() const
{
- assert(random_ != NULL);
+ wassert(random_ != NULL);
return random_->child("results");
}
void replay::set_random_results(const config& cfg)
{
- assert(random_ != NULL);
+ wassert(random_ != NULL);
random_->clear_children("results");
random_->add_child("results",cfg);
}
Index: wesnoth/src/reports.cpp
diff -u wesnoth/src/reports.cpp:1.55 wesnoth/src/reports.cpp:1.56
--- wesnoth/src/reports.cpp:1.55 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/reports.cpp Fri Dec 31 21:01:37 2004
@@ -5,8 +5,8 @@
#include "game_config.hpp"
#include "language.hpp"
#include "reports.hpp"
+#include "wassert.hpp"
-#include <cassert>
#include <map>
#include <set>
#include <sstream>
@@ -25,8 +25,8 @@
const std::string& report_name(TYPE type)
{
- assert(sizeof(report_names)/sizeof(*report_names) == NUM_REPORTS);
- assert(type < NUM_REPORTS);
+ wassert(sizeof(report_names)/sizeof(*report_names) == NUM_REPORTS);
+ wassert(type < NUM_REPORTS);
return report_names[type];
}
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.67 wesnoth/src/sdl_utils.cpp:1.68
--- wesnoth/src/sdl_utils.cpp:1.67 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/sdl_utils.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.67 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: sdl_utils.cpp,v 1.68 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -24,6 +24,7 @@
#include "show_dialog.hpp"
#include "util.hpp"
#include "video.hpp"
+#include "wassert.hpp"
bool point_in_rect(int x, int y, const SDL_Rect& rect)
{
@@ -549,7 +550,7 @@
Uint8* line_dest = dest + y * rpitch;
size_t size = r.w + r.x <= surf->w ? r.w : surf->w - r.x;
- assert(rpitch >= r.w * rbpp);
+ wassert(rpitch >= r.w * rbpp);
memcpy(line_dest, line_src, size * rbpp);
}
Index: wesnoth/src/server/game.cpp
diff -u wesnoth/src/server/game.cpp:1.22 wesnoth/src/server/game.cpp:1.23
--- wesnoth/src/server/game.cpp:1.22 Thu Dec 2 01:59:05 2004
+++ wesnoth/src/server/game.cpp Fri Dec 31 21:01:38 2004
@@ -2,8 +2,8 @@
#include "game.hpp"
#include "../util.hpp"
+#include "../wassert.hpp"
-#include <cassert>
#include <iostream>
int game::id_num = 1;
@@ -13,7 +13,7 @@
bool game::is_owner(network::connection player) const
{
- assert(!players_.empty());
+ wassert(!players_.empty());
return player == players_.front();
}
@@ -24,7 +24,7 @@
bool game::is_needed(network::connection player) const
{
- assert(!players_.empty());
+ wassert(!players_.empty());
return player == players_.front();
}
@@ -116,7 +116,7 @@
bool game::take_side(network::connection player, const config& cfg)
{
- assert(is_member(player));
+ wassert(is_member(player));
const std::string& side = cfg["side"];
Index: wesnoth/src/server/server.cpp
diff -u wesnoth/src/server/server.cpp:1.62 wesnoth/src/server/server.cpp:1.63
--- wesnoth/src/server/server.cpp:1.62 Thu Dec 9 19:52:47 2004
+++ wesnoth/src/server/server.cpp Fri Dec 31 21:01:38 2004
@@ -4,6 +4,7 @@
#include "../game_config.hpp"
#include "../network.hpp"
#include "../util.hpp"
+#include "../wassert.hpp"
#include "SDL.h"
@@ -13,7 +14,6 @@
#include "player.hpp"
#include <algorithm>
-#include <cassert>
#include <cstdlib>
#include <iostream>
#include <map>
@@ -441,7 +441,7 @@
config* const message =
data.child("message");
if(message != NULL) {
const
player_map::const_iterator p = players_.find(sock);
- assert(p != players_.end());
+ wassert(p != players_.end());
(*message)["sender"] =
p->second.name();
truncate_message((*message)["message"]);
@@ -621,7 +621,7 @@
//delete the game's
description
config* const gamelist
= initial_response_.child("gamelist");
- assert(gamelist !=
NULL);
+ wassert(gamelist !=
NULL);
const
config::child_itors vg = gamelist->child_range("game");
const
config::child_iterator desc = std::find(vg.first,vg.second,g->description());
@@ -709,7 +709,7 @@
//force the description
to be correct to prevent
//spoofing of messages
const
player_map::const_iterator pl = players_.find(sock);
- assert(pl !=
players_.end());
+ wassert(pl !=
players_.end());
(*speak)["description"]
= pl->second.name();
if((*speak)["team_name"] == "") {
@@ -799,7 +799,7 @@
//delete the game's configuration
config* const gamelist = initial_response_.child("gamelist");
- assert(gamelist != NULL);
+ wassert(gamelist != NULL);
const config::child_itors vg = gamelist->child_range("game");
const config::child_list::iterator g =
std::find(vg.first,vg.second,i->description());
if(g != vg.second) {
Index: wesnoth/src/show_dialog.cpp
diff -u wesnoth/src/show_dialog.cpp:1.106 wesnoth/src/show_dialog.cpp:1.107
--- wesnoth/src/show_dialog.cpp:1.106 Fri Dec 31 00:46:41 2004
+++ wesnoth/src/show_dialog.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.cpp,v 1.106 2004/12/31 00:46:41 Sirp Exp $ */
+/* $Id: show_dialog.cpp,v 1.107 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -31,6 +31,7 @@
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
#include "widgets/textbox.hpp"
+#include "wassert.hpp"
#include "SDL_ttf.h"
@@ -447,8 +448,8 @@
text_widget_height = text_widget.location().h +
message_font_size;
}
- menu menu_(disp,menu_items,type == MESSAGE);
-
+ menu menu_(disp,menu_items,type == MESSAGE);
+
menu_.set_numeric_keypress_selection(use_textbox == false);
#ifdef USE_TINY_GUI
@@ -874,7 +875,7 @@
(*options)[n].checked =
check_buttons[n].checked();
} else if(pressed) {
const size_t options_size = options == NULL ? 0
: options->size();
- assert(action_buttons != NULL &&
action_buttons->size() > n - options_size);
+ wassert(action_buttons != NULL &&
action_buttons->size() > n - options_size);
const dialog_button_action::RESULT res =
(*action_buttons)[n - options_size].handler->button_pressed(menu_.selection());
if(res == dialog_button_action::DELETE_ITEM) {
Index: wesnoth/src/team.cpp
diff -u wesnoth/src/team.cpp:1.75 wesnoth/src/team.cpp:1.76
--- wesnoth/src/team.cpp:1.75 Sat Dec 4 15:14:09 2004
+++ wesnoth/src/team.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: team.cpp,v 1.75 2004/12/04 15:14:09 silene Exp $ */
+/* $Id: team.cpp,v 1.76 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -21,6 +21,7 @@
#include "replay.hpp"
#include "team.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
#include <cstdlib>
@@ -221,7 +222,7 @@
case HUMAN: cfg["controller"] = "human"; break;
case NETWORK: cfg["controller"] = "network"; break;
case EMPTY: cfg["controller"] = "null"; break;
- default: assert(false);
+ default: wassert(false);
}
sprintf(buf,"%d",villages_per_scout);
Index: wesnoth/src/team.hpp
diff -u wesnoth/src/team.hpp:1.50 wesnoth/src/team.hpp:1.51
--- wesnoth/src/team.hpp:1.50 Mon Sep 13 03:16:19 2004
+++ wesnoth/src/team.hpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: team.hpp,v 1.50 2004/09/13 03:16:19 Sirp Exp $ */
+/* $Id: team.hpp,v 1.51 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -16,7 +16,6 @@
#include "config.hpp"
#include "map.hpp"
-#include <cassert>
#include <set>
#include <string>
#include <vector>
Index: wesnoth/src/terrain.cpp
diff -u wesnoth/src/terrain.cpp:1.24 wesnoth/src/terrain.cpp:1.25
--- wesnoth/src/terrain.cpp:1.24 Thu Nov 18 22:00:12 2004
+++ wesnoth/src/terrain.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: terrain.cpp,v 1.24 2004/11/18 22:00:12 ydirson Exp $ */
+/* $Id: terrain.cpp,v 1.25 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -15,7 +15,6 @@
#include "terrain.hpp"
-#include <cassert>
#include <cstdlib>
#include <iostream>
Index: wesnoth/src/theme.cpp
diff -u wesnoth/src/theme.cpp:1.28 wesnoth/src/theme.cpp:1.29
--- wesnoth/src/theme.cpp:1.28 Mon Dec 27 21:03:18 2004
+++ wesnoth/src/theme.cpp Fri Dec 31 21:01:37 2004
@@ -6,6 +6,7 @@
#include "sdl_utils.hpp"
#include "theme.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <cstdlib>
#include <sstream>
@@ -284,7 +285,7 @@
relative_loc_.w = (loc_.w*screen.w)/XDim;
break;
default:
- assert(false);
+ wassert(false);
}
switch(yanchor_) {
@@ -305,7 +306,7 @@
relative_loc_.h = (loc_.h*screen.h)/YDim;
break;
default:
- assert(false);
+ wassert(false);
}
relative_loc_.x = minimum<int>(relative_loc_.x,screen.w);
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.109 wesnoth/src/unit.cpp:1.110
--- wesnoth/src/unit.cpp:1.109 Thu Dec 30 02:52:37 2004
+++ wesnoth/src/unit.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.109 2004/12/30 02:52:37 Sirp Exp $ */
+/* $Id: unit.cpp,v 1.110 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -23,6 +23,7 @@
#include "replay.hpp"
#include "unit.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
#include <cstdlib>
@@ -150,34 +151,34 @@
return;
//calculate the unit's traits
- std::vector<config*> candidate_traits = type().possible_traits();
- std::vector<config*> traits;
-
- const size_t num_traits = type().num_traits();
- for(size_t n = 0; n != num_traits && candidate_traits.empty() == false;
++n) {
- const int num = get_random()%candidate_traits.size();
- traits.push_back(candidate_traits[num]);
- candidate_traits.erase(candidate_traits.begin()+num);
- }
-
+ std::vector<config*> candidate_traits = type().possible_traits();
+ std::vector<config*> traits;
+
+ const size_t num_traits = type().num_traits();
+ for(size_t n = 0; n != num_traits && candidate_traits.empty() == false;
++n) {
+ const int num = get_random()%candidate_traits.size();
+ traits.push_back(candidate_traits[num]);
+ candidate_traits.erase(candidate_traits.begin()+num);
+ }
+
std::vector<std::string> description;
-
- for(std::vector<config*>::const_iterator j = traits.begin(); j !=
traits.end(); ++j) {
- add_modification("trait",**j);
- description.push_back((**j)["name"]);
- }
-
- traitsDescription_ = "";
-
- //we want to make sure the description always has a consistent ordering
- std::sort(description.begin(),description.end());
- for(std::vector<std::string>::const_iterator i = description.begin(); i
!= description.end(); ++i) {
- if(i != description.begin()) {
- traitsDescription_ += ",";
- }
-
- traitsDescription_ += gettext(i->c_str());
- }
+
+ for(std::vector<config*>::const_iterator j = traits.begin(); j !=
traits.end(); ++j) {
+ add_modification("trait",**j);
+ description.push_back((**j)["name"]);
+ }
+
+ traitsDescription_ = "";
+
+ //we want to make sure the description always has a consistent ordering
+ std::sort(description.begin(),description.end());
+ for(std::vector<std::string>::const_iterator i = description.begin(); i
!= description.end(); ++i) {
+ if(i != description.begin()) {
+ traitsDescription_ += ",";
+ }
+
+ traitsDescription_ += gettext(i->c_str());
+ }
}
const unit_type& unit::type() const
@@ -598,7 +599,7 @@
}
void unit::read(const game_data& data, const config& cfg)
-{
+{
const std::string& type = cfg["type"];
std::map<std::string,unit_type>::const_iterator i =
data.unit_types.find(cfg["type"]);
if(i != data.unit_types.end())
@@ -606,7 +607,7 @@
else
throw gamestatus::load_game_failed("Unit not found: '" +
cfg["type"] + "'");
- assert(type_ != NULL);
+ wassert(type_ != NULL);
const std::string& gender = preferences::show_unit_genders() ?
cfg["gender"] : "";
if(gender == "male") {
@@ -835,16 +836,16 @@
switch(state_) {
case STATE_NORMAL: return type_->image();
case STATE_DEFENDING_LONG:
- case STATE_DEFENDING_SHORT: {
- if(get_animation()) {
- const std::string& res =
anim_.get_current_frame().image;
- if(res != "") {
- return res;
- }
- }
-
- const attack_type::RANGE range = (state_ ==
STATE_DEFENDING_LONG) ? attack_type::LONG_RANGE : attack_type::SHORT_RANGE;
- return type_->image_defensive(range);
+ case STATE_DEFENDING_SHORT: {
+ if(get_animation()) {
+ const std::string& res =
anim_.get_current_frame().image;
+ if(res != "") {
+ return res;
+ }
+ }
+
+ const attack_type::RANGE range = (state_ ==
STATE_DEFENDING_LONG) ? attack_type::LONG_RANGE : attack_type::SHORT_RANGE;
+ return type_->image_defensive(range);
}
case STATE_ATTACKING: {
if(attackType_ == NULL)
@@ -863,44 +864,44 @@
default: return type_->image();
}
-}
-
-const unit_animation* unit::get_animation() const
-{
- switch(state_) {
- case STATE_DEFENDING_LONG:
- case STATE_DEFENDING_SHORT: {
- const attack_type::RANGE range = (state_ ==
STATE_DEFENDING_LONG) ? attack_type::LONG_RANGE : attack_type::SHORT_RANGE;
- const unit_animation* const anim =
type_->defend_animation(getsHit_,range);
- return anim;
- }
- default:
- return NULL;
- }
-}
-
-void unit::set_standing()
-{
- state_ = STATE_NORMAL;
-}
+}
+
+const unit_animation* unit::get_animation() const
+{
+ switch(state_) {
+ case STATE_DEFENDING_LONG:
+ case STATE_DEFENDING_SHORT: {
+ const attack_type::RANGE range = (state_ ==
STATE_DEFENDING_LONG) ? attack_type::LONG_RANGE : attack_type::SHORT_RANGE;
+ const unit_animation* const anim =
type_->defend_animation(getsHit_,range);
+ return anim;
+ }
+ default:
+ return NULL;
+ }
+}
+
+void unit::set_standing()
+{
+ state_ = STATE_NORMAL;
+}
void unit::set_defending(bool hits, attack_type::RANGE range, int start_frame,
int acceleration)
{
- state_ = range == attack_type::LONG_RANGE ? STATE_DEFENDING_LONG :
STATE_DEFENDING_SHORT;
- getsHit_ = hits;
-
- const unit_animation* const anim = get_animation();
- if(anim != NULL) {
- anim_ = *anim;
-
anim_.start_animation(start_frame,unit_animation::UNIT_FRAME,acceleration);
- }
-}
-
-void unit::update_defending_frame()
-{
- if(get_animation()) {
- anim_.update_current_frames();
- }
+ state_ = range == attack_type::LONG_RANGE ? STATE_DEFENDING_LONG :
STATE_DEFENDING_SHORT;
+ getsHit_ = hits;
+
+ const unit_animation* const anim = get_animation();
+ if(anim != NULL) {
+ anim_ = *anim;
+
anim_.start_animation(start_frame,unit_animation::UNIT_FRAME,acceleration);
+ }
+}
+
+void unit::update_defending_frame()
+{
+ if(get_animation()) {
+ anim_.update_current_frames();
+ }
}
void unit::set_attacking(bool newval, const attack_type* type, int ms)
@@ -1219,7 +1220,7 @@
case UPKEEP_FREE: return 0;
case UPKEEP_LOYAL: return minimum<int>(1,type().level());
case UPKEEP_FULL_PRICE: return type().level();
- default: assert(false); return 0;
+ default: wassert(false); return 0;
}
}
Index: wesnoth/src/unit_display.cpp
diff -u wesnoth/src/unit_display.cpp:1.44 wesnoth/src/unit_display.cpp:1.45
--- wesnoth/src/unit_display.cpp:1.44 Thu Dec 30 14:22:01 2004
+++ wesnoth/src/unit_display.cpp Fri Dec 31 21:01:37 2004
@@ -11,6 +11,7 @@
#include "sound.hpp"
#include "unit_display.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#define LOG_DP lg::info(lg::display)
@@ -316,7 +317,7 @@
unit_map::iterator leader = units.end();
if(leader_loc.valid()) {
leader = units.find(leader_loc);
- assert(leader != units.end());
+ wassert(leader != units.end());
leader->second.set_leading(true);
}
@@ -374,8 +375,8 @@
attack_anim.update_current_frames();
int animation_time = attack_anim.get_animation_time();
-
- def->second.set_defending(hits, attack_type::LONG_RANGE,
animation_time, acceleration);
+
+ def->second.set_defending(hits, attack_type::LONG_RANGE,
animation_time, acceleration);
while(animation_time < end_at) {
@@ -559,7 +560,7 @@
// ticks = SDL_GetTicks();
- attack_anim.update_current_frames();
+ attack_anim.update_current_frames();
def->second.update_defending_frame();
animation_time = attack_anim.get_animation_time();
events::pump();
@@ -585,8 +586,8 @@
disp.draw_tile(a.x,a.y);
disp.draw_tile(b.x,b.y);
-
- def->second.set_standing();
+
+ def->second.set_standing();
if(leader_loc.valid()){
disp.draw_tile(leader_loc.x,leader_loc.y);
@@ -627,12 +628,12 @@
log_scope("unit_attack");
const unit_map::iterator att = units.find(a);
- assert(att != units.end());
+ wassert(att != units.end());
unit& attacker = att->second;
const unit_map::iterator def = units.find(b);
- assert(def != units.end());
+ wassert(def != units.end());
if(b.x > a.x) {
att->second.set_facing_left(true);
@@ -664,7 +665,7 @@
if(leader_loc.valid()){
LOG_DP << "found leader at " << (leader_loc.x+1) << "," <<
(leader_loc.y+1) << "\n";
leader = units.find(leader_loc);
- assert(leader != units.end());
+ wassert(leader != units.end());
leader->second.set_leading(true);
}
@@ -706,9 +707,9 @@
attack_anim.start_animation(begin_at, unit_animation::UNIT_FRAME,
acceleration);
- int animation_time = attack_anim.get_animation_time();
-
- def->second.set_defending(hits, attack_type::SHORT_RANGE,
animation_time, acceleration);
+ int animation_time = attack_anim.get_animation_time();
+
+ def->second.set_defending(hits, attack_type::SHORT_RANGE,
animation_time, acceleration);
while(animation_time < end_at) {
@@ -823,7 +824,7 @@
ticks = SDL_GetTicks();
- attack_anim.update_current_frames();
+ attack_anim.update_current_frames();
def->second.update_defending_frame();
animation_time = attack_anim.get_animation_time();
events::pump();
@@ -853,8 +854,8 @@
if(leader_loc.valid()) {
disp.draw_tile(leader_loc.x,leader_loc.y);
}
-
- def->second.set_standing();
+
+ def->second.set_standing();
if(dead) {
unit_display::unit_die(disp,def->first,def->second);
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.73 wesnoth/src/unit_types.cpp:1.74
--- wesnoth/src/unit_types.cpp:1.73 Thu Dec 30 02:07:52 2004
+++ wesnoth/src/unit_types.cpp Fri Dec 31 21:01:37 2004
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.73 2004/12/30 02:07:52 Sirp Exp $ */
+/* $Id: unit_types.cpp,v 1.74 2004/12/31 21:01:37 isaaccp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -19,9 +19,9 @@
#include "log.hpp"
#include "unit_types.hpp"
#include "util.hpp"
+#include "wassert.hpp"
#include <algorithm>
-#include <cassert>
#include <cstdlib>
#include <iostream>
@@ -40,9 +40,9 @@
halo = cfg["halo"];
halo_x = atoi(cfg["halo_x"].c_str());
halo_y = atoi(cfg["halo_y"].c_str());
-}
-
-unit_animation::unit_animation()
+}
+
+unit_animation::unit_animation()
{}
unit_animation::unit_animation(const config& cfg)
@@ -227,7 +227,7 @@
const unit_animation& attack_type::animation() const
{
- assert(animation_.empty() == false);
+ wassert(animation_.empty() == false);
return animation_[rand()%animation_.size()];
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src Makefile.am actions.cpp ai.cpp ai_a...,
Isaac Clerencia <=