Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed Jun 16, 2014
2 parents b815ac9 + 1d4c0f2 commit b5b287a
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 19 deletions.
5 changes: 3 additions & 2 deletions data/ai/lua/ai_helper.lua
Expand Up @@ -1072,6 +1072,7 @@ function ai_helper.move_unit_out_of_way(ai, unit, cfg)
-- Main rating is the moves the unit still has left after that
-- Other, configurable, parameters are given to function in @cfg:
-- - dx, dy: the direction in which moving out of the way is preferred
-- assumed to be normalized so that dx^2 + dy^2 = 1
-- - labels: if set, display labels of the rating for each hex the unit can reach

cfg = cfg or {}
Expand All @@ -1085,8 +1086,8 @@ function ai_helper.move_unit_out_of_way(ai, unit, cfg)
if (not unit_in_way) then -- also excludes current hex
local rating = loc[3] -- also disfavors hexes next to enemy units for which loc[3] = 0

if cfg.dx then rating = rating + (loc[1] - unit.x) * cfg.dx end
if cfg.dy then rating = rating + (loc[2] - unit.y) * cfg.dy end
if cfg.dx then rating = rating + (loc[1] - unit.x) * cfg.dx * 0.01 end
if cfg.dy then rating = rating + (loc[2] - unit.y) * cfg.dy * 0.01 end

if cfg.labels then reach_map:insert(loc[1], loc[2], rating) end

Expand Down
2 changes: 1 addition & 1 deletion data/themes/classic.cfg
Expand Up @@ -9,7 +9,7 @@
[theme]
id=Classic
name= _ "theme^Classic"
description= _ "The classic pre 1.12 theme."
description= _ "The classic, pre-1.12 theme"

#define DEFAULT_FONT_NORMAL
14 #enddef
Expand Down
2 changes: 1 addition & 1 deletion data/themes/default.cfg
Expand Up @@ -32,7 +32,7 @@
[theme]
id=Default
name= _ "theme^Default"
description= _ "Default theme."
description= _ "The default theme"

[resolution]
id=1024x768
Expand Down
2 changes: 1 addition & 1 deletion data/themes/pandora.cfg
Expand Up @@ -20,7 +20,7 @@
[theme]
id=Pandora
name= _ "theme^Pandora"
description= _ "800x480 theme optimized for Pandora devices."
description= _ "An 800×480 theme optimized for Pandora devices"

[resolution]
id=800x480
Expand Down
2 changes: 1 addition & 1 deletion data/themes/unit_box.cfg
Expand Up @@ -9,7 +9,7 @@
[theme]
id=UnitBox
name= _ "theme^UnitBox"
description= _ "Experimental work-in-progress replacement for the default theme."
description= _ "An experimental work-in-progress replacement for the default theme"

#define DEFAULT_FONT_NORMAL
14 #enddef
Expand Down
2 changes: 1 addition & 1 deletion data/themes/widescreen.cfg
Expand Up @@ -9,7 +9,7 @@
[theme]
id=Widescreen
name= _ "theme^Widescreen"
description= _ "Experimental theme optimized for widescreen resolutions."
description= _ "An experimental theme optimized for widescreen resolutions"

#define DEFAULT_FONT_NORMAL
14 #enddef
Expand Down
2 changes: 1 addition & 1 deletion src/map_location.hpp
Expand Up @@ -252,7 +252,7 @@ inline map_location map_location::get_direction(
return map_location(x,y+n);
}

int x_factor = (dir <= 2u) ? 1 : -1; //whether we go east + or west -
int x_factor = (static_cast<unsigned int> (dir) <= 2u) ? 1 : -1; //whether we go east + or west -

unsigned int tmp_y = dir - 2; //South East => 0, South => 1, South West => 2, North West => 3, North => INT_MAX, North East => INT_MAX - 1
int y_factor = (tmp_y <= 2u) ? 1 : -1; //whether we go south + or north -
Expand Down
11 changes: 0 additions & 11 deletions src/playcampaign.cpp
Expand Up @@ -43,7 +43,6 @@
#include "saved_game.hpp"
#include "sound.hpp"
#include "wml_exception.hpp"
#include "unit_id.hpp"
#include "formula_string_utils.hpp"

#include <boost/foreach.hpp>
Expand Down Expand Up @@ -191,9 +190,6 @@ static LEVEL_RESULT playsingle_scenario(const config& game_config,
LEVEL_RESULT res = playcontroller.play_scenario(story, skip_replay);

end_level = playcontroller.get_end_level_data_const();
config& cfg_end_level = state_of_game.carryover_sides.child_or_add("end_level_data");
state_of_game.carryover_sides["next_underlying_unit_id"] = int(n_unit::id_manager::instance().get_save_id());
end_level.write(cfg_end_level);

if (res != QUIT)
{
Expand Down Expand Up @@ -231,9 +227,6 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
LEVEL_RESULT res = playcontroller.play_scenario(story, skip_replay);

end_level = playcontroller.get_end_level_data_const();
config& cfg_end_level = state_of_game.carryover_sides.child_or_add("end_level_data");
end_level.write(cfg_end_level);
state_of_game.carryover_sides["next_underlying_unit_id"] = int(n_unit::id_manager::instance().get_save_id());

//Check if the player started as mp client and changed to host
if (io_type == IO_CLIENT && playcontroller.is_host())
Expand All @@ -247,10 +240,6 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
//(we want to see that message before entering the linger mode)
show_carryover_message(state_of_game, playcontroller, disp, end_level, res);
}
else
{
state_of_game.carryover_sides_start["next_scenario"] = resources::gamedata->next_scenario();
}
if(!disp.video().faked())
{
try {
Expand Down

0 comments on commit b5b287a

Please sign in to comment.