[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src actions.cpp dialogs.cpp display.cpp...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src actions.cpp dialogs.cpp display.cpp... |
Date: |
Wed, 29 Dec 2004 22:04:18 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 04/12/30 02:52:38
Modified files:
src : actions.cpp dialogs.cpp display.cpp help.cpp
mapgen.cpp playturn.cpp reports.cpp
sdl_utils.cpp unit.cpp config.hpp display.hpp
playturn.hpp unit.hpp
Log message:
made it so that click-to-attack makes the unit move to the nearest hex
to the cursor
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.174&tr2=1.175&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.77&tr2=1.78&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.282&tr2=1.283&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.311&tr2=1.312&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.cpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.108&tr2=1.109&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.88&tr2=1.89&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.hpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.hpp.diff?tr1=1.56&tr2=1.57&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.174 wesnoth/src/actions.cpp:1.175
--- wesnoth/src/actions.cpp:1.174 Wed Dec 29 19:22:13 2004
+++ wesnoth/src/actions.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.174 2004/12/29 19:22:13 Sirp Exp $ */
+/* $Id: actions.cpp,v 1.175 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -194,10 +194,6 @@
gamemap::TERRAIN attacker_terrain_override,
battle_stats_strings *strings)
{
- //if these are both genuine positions, work out the range
- //combat is taking place at
- const int combat_range = attacker_terrain_override == 0 ?
distance_between(attacker,defender) : 1;
-
battle_stats res;
res.attack_with = attack_with;
@@ -280,8 +276,7 @@
int defend_with = -1;
res.ndefends = 0;
for(int defend_option = 0; defend_option !=
int(defender_attacks.size()); ++defend_option) {
- if(defender_attacks[defend_option].range() == attack.range() &&
- defender_attacks[defend_option].hexes() >=
combat_range) {
+ if(defender_attacks[defend_option].range() == attack.range()) {
const double rating =
a->second.damage_against(defender_attacks[defend_option])
*defender_attacks[defend_option].damage()
*defender_attacks[defend_option].num_attacks()
Index: wesnoth/src/config.hpp
diff -u wesnoth/src/config.hpp:1.48 wesnoth/src/config.hpp:1.49
--- wesnoth/src/config.hpp:1.48 Fri Dec 3 07:15:47 2004
+++ wesnoth/src/config.hpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: config.hpp,v 1.48 2004/12/03 07:15:47 silene Exp $ */
+/* $Id: config.hpp,v 1.49 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -65,12 +65,13 @@
preproc_define(const std::string& val, const std::vector<std::string>&
args)
: value(val), arguments(args) {}
std::string value;
- std::vector<std::string> arguments;
- bool operator==(preproc_define const &p) const
- { return value == p.value && arguments == p.arguments; }
+ std::vector<std::string> arguments;
};
-typedef std::map<std::string,preproc_define> preproc_map;
+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
//preprocessed file data. defines is a map of symbols defined. src is used
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.77 wesnoth/src/dialogs.cpp:1.78
--- wesnoth/src/dialogs.cpp:1.77 Thu Dec 2 22:30:38 2004
+++ wesnoth/src/dialogs.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.77 2004/12/02 22:30:38 silene Exp $ */
+/* $Id: dialogs.cpp,v 1.78 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -690,10 +690,6 @@
details << "\n"
<< at_it->damage() << "-" <<
at_it->num_attacks() << " -- "
<< (at_it->range() == attack_type::SHORT_RANGE
? _("melee") : _("ranged"));
-
- if(at_it->hexes() > 1) {
- details << " (" << at_it->hexes() << ")";
- }
}
}
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.282 wesnoth/src/display.cpp:1.283
--- wesnoth/src/display.cpp:1.282 Mon Dec 20 21:48:35 2004
+++ wesnoth/src/display.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.282 2004/12/20 21:48:35 isaaccp Exp $ */
+/* $Id: display.cpp,v 1.283 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -237,7 +237,7 @@
invalidate_unit();
}
-gamemap::location display::hex_clicked_on(int xclick, int yclick)
+gamemap::location display::hex_clicked_on(int xclick, int yclick,
gamemap::location::DIRECTION* nearest_hex)
{
const SDL_Rect& rect = map_area();
if(point_in_rect(xclick,yclick,rect) == false) {
@@ -247,10 +247,10 @@
xclick -= rect.x;
yclick -= rect.y;
- return pixel_position_to_hex(xpos_ + xclick, ypos_ + yclick);
+ return pixel_position_to_hex(xpos_ + xclick, ypos_ + yclick,
nearest_hex);
}
-gamemap::location display::pixel_position_to_hex(int x, int y)
+gamemap::location display::pixel_position_to_hex(int x, int y,
gamemap::location::DIRECTION* nearest_hex)
{
const int s = hex_size();
const int tesselation_x_size = s * 3 / 2;
@@ -260,8 +260,8 @@
const int y_base = y / tesselation_y_size;
const int y_mod = y % tesselation_y_size;
- int x_modifier;
- int y_modifier;
+ int x_modifier = 0;
+ int y_modifier = 0;
if (y_mod < tesselation_y_size / 2) {
if ((x_mod * 2 + y_mod) < (s / 2)) {
@@ -286,9 +286,35 @@
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;
+ }
}
- return gamemap::location(x_base + x_modifier, y_base + y_modifier);
+ return res;
}
int display::get_location_x(const gamemap::location& loc) const
@@ -952,11 +978,7 @@
<< (at_it->range() == attack_type::SHORT_RANGE ?
_("melee") :
_("ranged"));
-
- if(at_it->hexes() > 1) {
- details << " (" << at_it->hexes() << ")";
- }
-
+
details << "\n\n";
}
Index: wesnoth/src/display.hpp
diff -u wesnoth/src/display.hpp:1.88 wesnoth/src/display.hpp:1.89
--- wesnoth/src/display.hpp:1.88 Thu Dec 2 07:59:49 2004
+++ wesnoth/src/display.hpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: display.hpp,v 1.88 2004/12/02 07:59:49 silene Exp $ */
+/* $Id: display.hpp,v 1.89 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -138,12 +138,12 @@
//given x,y co-ordinates of an onscreen pixel, will return the
//location of the hex that this pixel corresponds to. Returns an
//invalid location is the mouse isn't over any valid location.
- gamemap::location hex_clicked_on(int x, int y);
+ gamemap::location hex_clicked_on(int x, int y,
gamemap::location::DIRECTION* nearest_hex);
//given x,y co-ordinates of a pixel on the map, will return the
//location of the hex that this pixel corresponds to. Returns an
//invalid location is the mouse isn't over any valid location.
- gamemap::location pixel_position_to_hex(int x, int y);
+ gamemap::location pixel_position_to_hex(int x, int y,
gamemap::location::DIRECTION* nearest_hex);
//given x,y co-ordinates of the mouse, will return the location of the
//hex in the minimap that the mouse is currently over, or an invalid
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.62 wesnoth/src/help.cpp:1.63
--- wesnoth/src/help.cpp:1.62 Sun Dec 26 13:02:35 2004
+++ wesnoth/src/help.cpp Thu Dec 30 02:52:37 2004
@@ -1549,7 +1549,7 @@
}
int help_menu::process() {
- int res = gui::menu::process();
+ int res = menu::process();
if (double_clicked())
res = selection();
if (!visible_items_.empty() && (unsigned)res < visible_items_.size()) {
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.48 wesnoth/src/mapgen.cpp:1.49
--- wesnoth/src/mapgen.cpp:1.48 Sun Dec 26 22:01:12 2004
+++ wesnoth/src/mapgen.cpp Thu Dec 30 02:52:37 2004
@@ -133,7 +133,7 @@
if(island_size != 0) {
const size_t diffx = abs(x1 - int(center_x));
const size_t diffy = abs(y1 - int(center_y));
- const size_t dist = size_t(std::sqrt(double(diffx*diffx
+ diffy*diffy)));
+ const size_t dist = size_t(sqrt(double(diffx*diffx +
diffy*diffy)));
is_valley = dist > island_size;
}
@@ -149,7 +149,7 @@
const int xdiff = (x2-x1);
const int ydiff = (y2-y1);
- const int height = radius -
int(std::sqrt(double(xdiff*xdiff + ydiff*ydiff)));
+ const int height = radius -
int(sqrt(double(xdiff*xdiff + ydiff*ydiff)));
if(height > 0) {
if(is_valley) {
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.311 wesnoth/src/playturn.cpp:1.312
--- wesnoth/src/playturn.cpp:1.311 Mon Dec 20 01:49:19 2004
+++ wesnoth/src/playturn.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.311 2004/12/20 01:49:19 isaaccp Exp $ */
+/* $Id: playturn.cpp,v 1.312 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -145,7 +145,7 @@
key_(key), gui_(gui), map_(map), teams_(teams), team_num_(team_num),
units_(units), browse_(mode != PLAY_TURN), allow_network_commands_(mode ==
BROWSE_NETWORKED),
left_button_(false), right_button_(false), middle_button_(false),
- minimap_scrolling_(false), enemy_paths_(false),
+ minimap_scrolling_(false), enemy_paths_(false),
last_nearest_(gamemap::location::NORTH),
path_turns_(0), end_turn_(false), start_ncmd_(-1), textbox_(textbox),
replay_sender_(replay_sender)
{
enemies_visible_ = enemies_visible();
@@ -284,11 +284,12 @@
}
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(event.x,event.y);
+ const gamemap::location new_hex =
gui_.hex_clicked_on(event.x,event.y,&nearest_hex);
- if(new_hex != last_hex_) {
+ if(new_hex != last_hex_ || nearest_hex != last_nearest_) {
if(new_hex.valid() == false) {
current_route_.steps.clear();
gui_.set_route(NULL);
@@ -304,8 +305,9 @@
const unit_map::const_iterator mouseover_unit =
find_unit(new_hex);
gamemap::location attack_from;
- if(selected_unit != units_.end() && mouseover_unit !=
units_.end()) {
- attack_from = current_unit_attacks_from(new_hex);
+ 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);
}
if(selected_unit != units_.end() &&
(current_paths_.routes.count(new_hex) ||
@@ -330,8 +332,7 @@
if(new_hex == selected_hex_) {
current_route_.steps.clear();
gui_.set_route(NULL);
- } else if(new_hex != last_hex_ &&
- !current_paths_.routes.empty() &&
map_.on_board(selected_hex_) &&
+ } else if(!current_paths_.routes.empty() &&
map_.on_board(selected_hex_) &&
map_.on_board(new_hex)) {
const gamemap::location& dest = attack_from.valid() ?
attack_from : new_hex;
@@ -339,7 +340,7 @@
unit_map::const_iterator un = find_unit(selected_hex_);
const unit_map::const_iterator dest_un =
find_unit(dest);
- if(un != units_.end() && dest_un == units_.end()) {
+ if((new_hex != last_hex_ || attack_from.valid()) && un
!= units_.end() && dest_un == units_.end()) {
const shortest_path_calculator
calc(un->second,current_team,
visible_units(),teams_,map_,status_);
const bool can_teleport =
un->second.type().teleports();
@@ -379,7 +380,8 @@
}
}
- last_hex_ = new_hex;
+ last_hex_ = new_hex;
+ last_nearest_ = nearest_hex;
}
namespace {
@@ -575,7 +577,6 @@
std::vector<std::string> items;
const int range = distance_between(attacker->first,defender->first);
- std::vector<int> attacks_in_range;
int best_weapon_index = -1;
simple_attack_rating best_weapon_rating;
@@ -583,10 +584,6 @@
attack_calculations_displayer::stats_vector stats;
for(size_t a = 0; a != attacks.size(); ++a) {
- if(attacks[a].hexes() < range)
- continue;
-
- attacks_in_range.push_back(a);
battle_stats_strings sts;
battle_stats st = evaluate_battle_stats(map_, attacker_loc,
defender_loc,
@@ -650,8 +647,7 @@
cursor::set(cursor::NORMAL);
- if(size_t(res) < attacks_in_range.size()) {
- res = attacks_in_range[res];
+ if(size_t(res) < attacks.size()) {
attacker->second.set_goto(gamemap::location());
clear_undo_stack();
@@ -769,8 +765,9 @@
gui_.scroll_to_tile(loc.x,loc.y,display::WARP,false);
return;
}
-
- gamemap::location hex = gui_.hex_clicked_on(event.x,event.y);
+
+ gamemap::location::DIRECTION nearest_hex;
+ gamemap::location hex =
gui_.hex_clicked_on(event.x,event.y,&nearest_hex);
unit_map::iterator u = find_unit(selected_hex_);
@@ -786,10 +783,14 @@
current_paths_.routes.find(hex);
unit_map::iterator enemy = find_unit(hex);
+
+ 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()) {
- const gamemap::location& attack_from =
current_unit_attacks_from(hex);
+ 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()) {
if(move_unit_along_current_route(false)) { //move the
unit without updating shroud
u = find_unit(attack_from);
@@ -798,6 +799,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_);
return;
}
}
@@ -883,16 +888,15 @@
if(u == units_.end() || u->second.can_attack() == false)
return;
- const int range = u->second.longest_range();
for(unit_map::const_iterator target = units_.begin(); target !=
units_.end(); ++target) {
if(current_team.is_enemy(target->second.side()) &&
- distance_between(target->first,u->first) <= range &&
!target->second.stone()) {
+ distance_between(target->first,u->first) == 1 &&
!target->second.stone()) {
current_paths_.routes[target->first] = paths::route();
}
}
}
-gamemap::location turn_info::current_unit_attacks_from(const
gamemap::location& loc) const
+gamemap::location turn_info::current_unit_attacks_from(const
gamemap::location& loc, const gamemap::location* preferred) const
{
const unit_map::const_iterator current = find_unit(selected_hex_);
if(current == units_.end() || current->second.side() != team_num_) {
@@ -922,7 +926,7 @@
}
if(current_paths_.routes.count(adj[n])) {
- const int defense =
current->second.defense_modifier(map_,map_.get_terrain(loc));
+ const int defense = preferred != NULL && *preferred ==
adj[n] ? 0 : current->second.defense_modifier(map_,map_.get_terrain(loc));
if(defense < best_defense || res.valid() == false) {
best_defense = defense;
res = adj[n];
Index: wesnoth/src/playturn.hpp
diff -u wesnoth/src/playturn.hpp:1.58 wesnoth/src/playturn.hpp:1.59
--- wesnoth/src/playturn.hpp:1.58 Mon Dec 20 01:49:19 2004
+++ wesnoth/src/playturn.hpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: playturn.hpp,v 1.58 2004/12/20 01:49:19 isaaccp Exp $ */
+/* $Id: playturn.hpp,v 1.59 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -189,7 +189,7 @@
//function which, given the location of a potential enemy to attack,
will return the location
//that the currently selected unit would move to and attack it from
this turn. Returns an
//invalid location if not possible.
- gamemap::location current_unit_attacks_from(const gamemap::location&
loc) const;
+ gamemap::location current_unit_attacks_from(const gamemap::location&
loc, const gamemap::location* preferred) const;
bool attack_enemy(unit_map::iterator attacker, unit_map::iterator
defender);
bool move_unit_along_current_route(bool check_shroud=true);
@@ -226,7 +226,8 @@
paths current_paths_, all_paths_;
paths::route current_route_;
bool enemy_paths_;
- gamemap::location last_hex_;
+ gamemap::location last_hex_;
+ gamemap::location::DIRECTION last_nearest_;
gamemap::location selected_hex_;
undo_list undo_stack_;
undo_list redo_stack_;
Index: wesnoth/src/reports.cpp
diff -u wesnoth/src/reports.cpp:1.54 wesnoth/src/reports.cpp:1.55
--- wesnoth/src/reports.cpp:1.54 Sun Nov 28 11:46:57 2004
+++ wesnoth/src/reports.cpp Thu Dec 30 02:52:37 2004
@@ -233,10 +233,6 @@
tooltip << at_it->damage() << " " << _("damage") << ", "
<< at_it->num_attacks() << " " <<
_("attacks");
- if(at_it->hexes() > 1) {
- str << " (" << at_it->hexes() << ")";
- tooltip << ", " << at_it->hexes() << " " <<
_("hexes");
- }
str << "\n";
res.add_text(str,tooltip);
}
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.66 wesnoth/src/sdl_utils.cpp:1.67
--- wesnoth/src/sdl_utils.cpp:1.66 Sun Dec 26 22:01:12 2004
+++ wesnoth/src/sdl_utils.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.66 2004/12/26 22:01:12 silene Exp $ */
+/* $Id: sdl_utils.cpp,v 1.67 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -186,12 +186,12 @@
//we now have a rectangle,
(xsrc,ysrc,xratio,yratio) which we
//want to derive the pixel from
for(double xloc = xsrc; xloc < xsrc+xratio;
xloc += 1.0) {
- const double xsize =
minimum<double>(std::floor(xloc+1.0)-xloc,xsrc+xratio-xloc);
+ const double xsize =
minimum<double>(floor(xloc+1.0)-xloc,xsrc+xratio-xloc);
for(double yloc = ysrc; yloc <
ysrc+yratio; yloc += 1.0) {
const int xsrcint =
maximum<int>(0,minimum<int>(src->w-1,static_cast<int>(xsrc)));
const int ysrcint =
maximum<int>(0,minimum<int>(src->h-1,static_cast<int>(ysrc)));
- const double ysize =
minimum<double>(std::floor(yloc+1.0)-yloc,ysrc+yratio-yloc);
+ const double ysize =
minimum<double>(floor(yloc+1.0)-yloc,ysrc+yratio-yloc);
Uint8 r,g,b,a;
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.108 wesnoth/src/unit.cpp:1.109
--- wesnoth/src/unit.cpp:1.108 Wed Dec 29 23:11:45 2004
+++ wesnoth/src/unit.cpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.108 2004/12/29 23:11:45 Sirp Exp $ */
+/* $Id: unit.cpp,v 1.109 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -800,29 +800,6 @@
return attacks_;
}
-int unit::longest_range() const
-{
- int res = 0;
- for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i !=
attacks_.end(); ++i) {
- if(i->hexes() >= res) {
- res = i->hexes();
- }
- }
-
- return res;
-}
-
-std::vector<attack_type> unit::attacks_at_range(int range) const
-{
- std::vector<attack_type> res;
- for(std::vector<attack_type>::const_iterator i = attacks_.begin(); i !=
attacks_.end(); ++i) {
- if(i->hexes() >= range)
- res.push_back(*i);
- }
-
- return res;
-}
-
int unit::movement_cost(const gamemap& map, gamemap::TERRAIN terrain) const
{
//don't allow level 0 units to take villages - removed until AI
Index: wesnoth/src/unit.hpp
diff -u wesnoth/src/unit.hpp:1.56 wesnoth/src/unit.hpp:1.57
--- wesnoth/src/unit.hpp:1.56 Wed Dec 29 23:11:45 2004
+++ wesnoth/src/unit.hpp Thu Dec 30 02:52:37 2004
@@ -1,4 +1,4 @@
-/* $Id: unit.hpp,v 1.56 2004/12/29 23:11:45 Sirp Exp $ */
+/* $Id: unit.hpp,v 1.57 2004/12/30 02:52:37 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -106,8 +106,6 @@
void assign_role(const std::string& role);
const std::vector<attack_type>& attacks() const;
- int longest_range() const;
- std::vector<attack_type> attacks_at_range(int range) const;
int movement_cost(const gamemap& map, gamemap::TERRAIN terrain) const;
int defense_modifier(const gamemap& map, gamemap::TERRAIN terrain)
const;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src actions.cpp dialogs.cpp display.cpp...,
David White <=