Renamed mapbuilder_visitor to mapbuilder.

This commit is contained in:
Tommy Schmitz 2011-08-20 08:05:42 +00:00
parent bd5c4f2dee
commit 3f97512688
9 changed files with 29 additions and 29 deletions

View file

@ -6797,7 +6797,7 @@
>
</File>
<File
RelativePath="..\..\src\whiteboard\mapbuilder_visitor.cpp"
RelativePath="..\..\src\whiteboard\mapbuilder.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@ -6825,7 +6825,7 @@
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\whiteboard\mapbuilder_visitor.hpp"
RelativePath="..\..\src\whiteboard\mapbuilder.hpp"
>
</File>
<File

View file

@ -573,7 +573,7 @@ set(wesnoth-main_SRC
whiteboard/attack.cpp
whiteboard/highlight_visitor.cpp
whiteboard/manager.cpp
whiteboard/mapbuilder_visitor.cpp
whiteboard/mapbuilder.cpp
whiteboard/move.cpp
whiteboard/recall.cpp
whiteboard/recruit.cpp

View file

@ -430,7 +430,7 @@ wesnoth_sources = Split("""
whiteboard/attack.cpp
whiteboard/highlight_visitor.cpp
whiteboard/manager.cpp
whiteboard/mapbuilder_visitor.cpp
whiteboard/mapbuilder.cpp
whiteboard/move.cpp
whiteboard/recall.cpp
whiteboard/recruit.cpp

View file

@ -21,7 +21,7 @@
#include "action.hpp"
#include "highlight_visitor.hpp"
#include "mapbuilder_visitor.hpp"
#include "mapbuilder.hpp"
#include "move.hpp"
#include "recruit.hpp"
#include "side_actions.hpp"
@ -337,7 +337,7 @@ void manager::set_planned_unit_map()
{
validate_actions_if_needed();
log_scope2("whiteboard", "Building planned unit map");
mapbuilder_.reset(new mapbuilder_visitor(*resources::units));
mapbuilder_.reset(new mapbuilder(*resources::units));
mapbuilder_->build_map();
planned_unit_map_active_ = true;
}

View file

@ -38,7 +38,7 @@ namespace pathfind {
namespace wb {
class mapbuilder_visitor;
class mapbuilder;
class highlight_visitor;
/**
@ -181,7 +181,7 @@ private:
/** Track whether the gamestate changed and we need to validate actions. */
bool gamestate_mutated_;
boost::scoped_ptr<mapbuilder_visitor> mapbuilder_;
boost::scoped_ptr<mapbuilder> mapbuilder_;
boost::shared_ptr<highlight_visitor> highlighter_;
boost::scoped_ptr<pathfind::marked_route> route_;

View file

@ -17,7 +17,7 @@
* @file
*/
#include "mapbuilder_visitor.hpp"
#include "mapbuilder.hpp"
#include "action.hpp"
#include "side_actions.hpp"
@ -32,7 +32,7 @@
namespace wb
{
mapbuilder_visitor::mapbuilder_visitor(unit_map& unit_map)
mapbuilder::mapbuilder(unit_map& unit_map)
: unit_map_(unit_map)
, applied_actions_()
, resetters_()
@ -40,13 +40,13 @@ mapbuilder_visitor::mapbuilder_visitor(unit_map& unit_map)
{
}
mapbuilder_visitor::~mapbuilder_visitor()
mapbuilder::~mapbuilder()
{
restore_normal_map();
//Remember that the member variable resetters_ is destructed here
}
void mapbuilder_visitor::reset_moves()
void mapbuilder::reset_moves()
{
int current_side = resources::controller->current_side();
foreach(unit& u, *resources::units)
@ -58,13 +58,13 @@ void mapbuilder_visitor::reset_moves()
}
}
void mapbuilder_visitor::build_map()
void mapbuilder::build_map()
{
reset_moves();
visit_all();
}
bool mapbuilder_visitor::visit(size_t, team&, side_actions&, side_actions::iterator itor)
bool mapbuilder::visit(size_t, team&, side_actions&, side_actions::iterator itor)
{
action_ptr act = *itor;
unit* u = act->get_unit();
@ -83,10 +83,10 @@ bool mapbuilder_visitor::visit(size_t, team&, side_actions&, side_actions::itera
return true;
}
bool mapbuilder_visitor::post_visit_team(size_t, team&, side_actions&)
bool mapbuilder::post_visit_team(size_t, team&, side_actions&)
{acted_this_turn_.clear(); return true;}
void mapbuilder_visitor::restore_normal_map()
void mapbuilder::restore_normal_map()
{
//applied_actions_ contain only the actions that we applied to the unit map
BOOST_REVERSE_FOREACH(action_ptr act, applied_actions_)

View file

@ -17,8 +17,8 @@
* @file
*/
#ifndef WB_MAPBUILDER_VISITOR_HPP_
#define WB_MAPBUILDER_VISITOR_HPP_
#ifndef WB_MAPBUILDER_HPP_
#define WB_MAPBUILDER_HPP_
#include <boost/ptr_container/ptr_vector.hpp>
@ -35,14 +35,14 @@ namespace wb
* Visitor that collects and applies unit_map modifications from the actions it visits
* and reverts all changes on destruction.
*/
class mapbuilder_visitor
: private enable_visit_all<mapbuilder_visitor>
class mapbuilder
: private enable_visit_all<mapbuilder>
{
friend class enable_visit_all<mapbuilder_visitor>;
friend class enable_visit_all<mapbuilder>;
public:
mapbuilder_visitor(unit_map& unit_map);
virtual ~mapbuilder_visitor();
mapbuilder(unit_map& unit_map);
virtual ~mapbuilder();
///builds every team's actions as far into the future as possible, in the correct order
void build_map();
@ -73,4 +73,4 @@ private:
}
#endif /* WB_MAPBUILDER_VISITOR_HPP_ */
#endif /* WB_MAPBUILDER_HPP_ */

View file

@ -20,7 +20,7 @@
#ifndef WB_VALIDATE_VISITOR_HPP_
#define WB_VALIDATE_VISITOR_HPP_
#include "mapbuilder_visitor.hpp"
#include "mapbuilder.hpp"
#include "side_actions.hpp"
#include <set>
@ -29,7 +29,7 @@ namespace wb
{
/**
* Works like mapbuilder_visitor, but with these differences:
* Works like mapbuilder, but with these differences:
* * Instead of stopping at viewer_team, it visits all actions of every team.
* * actions are evaluated for validity along the way.
* * Some invalid actions are deleted.
@ -57,10 +57,10 @@ private:
bool no_previous_invalids(side_actions::iterator const&);
struct helper: public mapbuilder_visitor
struct helper: public mapbuilder
{
helper(unit_map& umap, validate_visitor& parent)
: mapbuilder_visitor(umap)
: mapbuilder(umap)
, parent_(parent)
{}
virtual void validate(side_actions::iterator const& itor);

View file

@ -24,7 +24,7 @@
* mechanism for the double dispatch used in the Visitor Pattern:
* action.accept(visitor) calls visitor.visit_***(action)
* Derived classes will usually derive from both of these.
* Example usage is seen is highlight_visitor, mapbuilder_visitor, validate_visitor.
* Example usage is seen is highlight_visitor and mapbuilder.
*/
#ifndef WB_VISITOR_HPP_