Author: tschmitz
Date: Thu Jul 21 21:11:02 2011
New Revision: 50367
URL: http://svn.gna.org/viewcvs/wesnoth?rev=50367&view=rev
Log:
Removed references to "for_pathfinding".
Modified:
trunk/src/whiteboard/manager.cpp
trunk/src/whiteboard/manager.hpp
trunk/src/whiteboard/mapbuilder_visitor.cpp
trunk/src/whiteboard/mapbuilder_visitor.hpp
trunk/src/whiteboard/validate_visitor.cpp
Modified: trunk/src/whiteboard/manager.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.cpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.cpp (original)
+++ trunk/src/whiteboard/manager.cpp Thu Jul 21 21:11:02 2011
@@ -52,7 +52,6 @@
print_help_once_(true),
wait_for_side_init_(true),
planned_unit_map_active_(false),
- is_map_for_pathfinding_(false),
executing_actions_(false),
gamestate_mutated_(false),
mapbuilder_(),
@@ -256,19 +255,15 @@
viewer_actions()->validate_actions();
}
-void manager::set_planned_unit_map(bool for_pathfinding)
+void manager::set_planned_unit_map()
{
if (!executing_actions_ && !wait_for_side_init_)
{
if (!planned_unit_map_active_)
{
validate_actions_if_needed();
- std::string message;
- for_pathfinding ? message = "Building planned unit map
for pathfinding."
- : message = "Building planned unit map";
- log_scope2("whiteboard", message);
- is_map_for_pathfinding_ = for_pathfinding;
- mapbuilder_.reset(new
mapbuilder_visitor(*resources::units, for_pathfinding));
+ log_scope2("whiteboard", "Building planned unit map");
+ mapbuilder_.reset(new
mapbuilder_visitor(*resources::units));
mapbuilder_->build_map();
planned_unit_map_active_ = true;
}
@@ -295,7 +290,6 @@
mapbuilder_.reset();
}
planned_unit_map_active_ = false;
- is_map_for_pathfinding_ = false;
}
else if (!wait_for_side_init_)
{
@@ -825,36 +819,20 @@
}
scoped_planned_unit_map::scoped_planned_unit_map():
-
has_planned_unit_map_(resources::whiteboard->has_planned_unit_map()),
-
is_map_for_pathfinding_(resources::whiteboard->is_map_for_pathfinding())
+
has_planned_unit_map_(resources::whiteboard->has_planned_unit_map())
{
if (!has_planned_unit_map_)
- {
- resources::whiteboard->set_planned_unit_map(true);
- }
- else if (!is_map_for_pathfinding_)
- {
+ resources::whiteboard->set_planned_unit_map();
+}
+
+scoped_planned_unit_map::~scoped_planned_unit_map()
+{
+ if (!has_planned_unit_map_)
resources::whiteboard->set_real_unit_map();
- resources::whiteboard->set_planned_unit_map(true);
- }
-}
-
-scoped_planned_unit_map::~scoped_planned_unit_map()
-{
- if (!has_planned_unit_map_)
- {
- resources::whiteboard->set_real_unit_map();
- }
- else if (is_map_for_pathfinding_ !=
resources::whiteboard->is_map_for_pathfinding())
- {
- resources::whiteboard->set_real_unit_map();
-
resources::whiteboard->set_planned_unit_map(is_map_for_pathfinding_);
- }
}
scoped_real_unit_map::scoped_real_unit_map():
-
has_planned_unit_map_(resources::whiteboard->has_planned_unit_map()),
-
is_map_for_pathfinding_(resources::whiteboard->is_map_for_pathfinding())
+
has_planned_unit_map_(resources::whiteboard->has_planned_unit_map())
{
if (has_planned_unit_map_)
resources::whiteboard->set_real_unit_map();
@@ -863,9 +841,8 @@
scoped_real_unit_map::~scoped_real_unit_map()
{
if (has_planned_unit_map_ &&
- (!resources::whiteboard->has_planned_unit_map() ||
- is_map_for_pathfinding_ !=
resources::whiteboard->is_map_for_pathfinding()))
-
resources::whiteboard->set_planned_unit_map(is_map_for_pathfinding_);
+ !resources::whiteboard->has_planned_unit_map())
+ resources::whiteboard->set_planned_unit_map();
}
bool unit_comparator_predicate::operator()(unit const& unit)
Modified: trunk/src/whiteboard/manager.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/manager.hpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- trunk/src/whiteboard/manager.hpp (original)
+++ trunk/src/whiteboard/manager.hpp Thu Jul 21 21:11:02 2011
@@ -90,15 +90,11 @@
/// Transforms the unit map so that it now reflects the future state of
things,
/// i.e. when all planned actions will have been executed
- /// @param for_pathfinding Whether to include recruits and recalls when
building the future map
- void set_planned_unit_map(bool for_pathfinding = false);
+ void set_planned_unit_map();
/// Restore the regular unit map
void set_real_unit_map();
/// Whether the planned unit map is currently applied
bool has_planned_unit_map() const { return planned_unit_map_active_; }
- /// Whether the planned unit map currently applied (if any) is
- /// the "pathfinding" version, i.e. one that includes future recruits
and recalls
- bool is_map_for_pathfinding() const { return is_map_for_pathfinding_; }
/**
* Callback from the display when drawing hexes, to allow the
whiteboard to
@@ -173,7 +169,6 @@
bool print_help_once_;
bool wait_for_side_init_;
bool planned_unit_map_active_;
- bool is_map_for_pathfinding_;
/** Track whenever we're modifying actions, to avoid dual execution
etc. */
bool executing_actions_;
/** Track whether the gamestate changed and we need to validate
actions. */
@@ -201,7 +196,6 @@
scoped_planned_unit_map();
~scoped_planned_unit_map();
bool has_planned_unit_map_;
- bool is_map_for_pathfinding_;
};
/** Ensures that the real unit map is active for the duration of the struct's
life,
@@ -211,7 +205,6 @@
scoped_real_unit_map();
~scoped_real_unit_map();
bool has_planned_unit_map_;
- bool is_map_for_pathfinding_;
};
/// Predicate that compares the id() of two units. Useful for searches in unit
vectors with std::find_if()
Modified: trunk/src/whiteboard/mapbuilder_visitor.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/mapbuilder_visitor.cpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- trunk/src/whiteboard/mapbuilder_visitor.cpp (original)
+++ trunk/src/whiteboard/mapbuilder_visitor.cpp Thu Jul 21 21:11:02 2011
@@ -36,10 +36,9 @@
namespace wb
{
-mapbuilder_visitor::mapbuilder_visitor(unit_map& unit_map, bool
for_pathfinding)
+mapbuilder_visitor::mapbuilder_visitor(unit_map& unit_map)
: visitor()
, unit_map_(unit_map)
- , for_pathfinding_(for_pathfinding)
, applied_actions_()
, mode_(BUILD_PLANNED_MAP)
, resetters_()
@@ -123,12 +122,9 @@
{
if(mode_ == BUILD_PLANNED_MAP)
{
- if (for_pathfinding_)
- {
- recruit->apply_temp_modifier(unit_map_);
- //remember which actions we applied, so we can unapply
them later
- applied_actions_.push_back(recruit);
- }
+ recruit->apply_temp_modifier(unit_map_);
+ //remember which actions we applied, so we can unapply them
later
+ applied_actions_.push_back(recruit);
}
else if (mode_ == RESTORE_NORMAL_MAP)
{
@@ -140,12 +136,9 @@
{
if(mode_ == BUILD_PLANNED_MAP)
{
- if (for_pathfinding_)
- {
- recall->apply_temp_modifier(unit_map_);
- //remember which actions we applied, so we can unapply
them later
- applied_actions_.push_back(recall);
- }
+ recall->apply_temp_modifier(unit_map_);
+ //remember which actions we applied, so we can unapply them
later
+ applied_actions_.push_back(recall);
}
else if (mode_ == RESTORE_NORMAL_MAP)
{
Modified: trunk/src/whiteboard/mapbuilder_visitor.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/mapbuilder_visitor.hpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- trunk/src/whiteboard/mapbuilder_visitor.hpp (original)
+++ trunk/src/whiteboard/mapbuilder_visitor.hpp Thu Jul 21 21:11:02 2011
@@ -39,7 +39,7 @@
{
public:
- mapbuilder_visitor(unit_map& unit_map, bool include_recruits = false);
+ mapbuilder_visitor(unit_map& unit_map);
~mapbuilder_visitor();
/**
@@ -65,8 +65,6 @@
unit_map& unit_map_;
- bool for_pathfinding_;
-
action_queue applied_actions_;
enum mapbuilder_mode {
Modified: trunk/src/whiteboard/validate_visitor.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/whiteboard/validate_visitor.cpp?rev=50367&r1=50366&r2=50367&view=diff
==============================================================================
--- trunk/src/whiteboard/validate_visitor.cpp (original)
+++ trunk/src/whiteboard/validate_visitor.cpp Thu Jul 21 21:11:02 2011
@@ -38,7 +38,7 @@
{
validate_visitor::validate_visitor(unit_map& unit_map)
- : mapbuilder_visitor(unit_map, true)
+ : mapbuilder_visitor(unit_map)
, viewer_actions_(*viewer_actions())
, actions_to_erase_()
, arg_itor_()
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits