dfool added back in, hopefully with all needed files this time
This commit is contained in:
parent
df8d998494
commit
b961679caf
3 changed files with 34 additions and 3 deletions
|
@ -32,6 +32,7 @@ wesnoth_SOURCES = \
|
|||
about.cpp \
|
||||
actions.cpp \
|
||||
ai.cpp \
|
||||
ai_dfool.cpp \
|
||||
ai_attack.cpp \
|
||||
ai_move.cpp \
|
||||
animated.cpp \
|
||||
|
@ -134,6 +135,7 @@ wesnoth_SOURCES = \
|
|||
about.hpp \
|
||||
actions.hpp \
|
||||
ai.hpp \
|
||||
ai_dfool.hpp \
|
||||
ai2.hpp \
|
||||
ai_interface.hpp \
|
||||
animated.hpp \
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "actions.hpp"
|
||||
#include "ai.hpp"
|
||||
#include "ai2.hpp"
|
||||
//#include "ai_dfool.hpp"
|
||||
#include "ai_dfool.hpp"
|
||||
//#include "advanced_ai.hpp"
|
||||
#include "dialogs.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
@ -194,8 +194,8 @@ ai_interface* create_ai(const std::string& name, ai_interface::info& info)
|
|||
return new sample_ai(info);
|
||||
else if(name == "idle_ai")
|
||||
return new idle_ai(info);
|
||||
// else if(name == "dfool_ai")
|
||||
// return new dfool::dfool_ai(info);
|
||||
else if(name == "dfool_ai")
|
||||
return new dfool::dfool_ai(info);
|
||||
//else if(name == "advanced_ai")
|
||||
// return new advanced_ai(info);
|
||||
else if(name == "ai2")
|
||||
|
|
29
src/ai_dfool.cpp
Normal file
29
src/ai_dfool.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include "ai_dfool.hpp"
|
||||
|
||||
namespace dfool {
|
||||
assignment::assignment(config cfg, unit_map my_units)
|
||||
{
|
||||
config::child_list alist = cfg.get_children("assignment");
|
||||
for(config::child_list::const_iterator a = alist.begin(); a != alist.end(); ++a) {
|
||||
LOG_STREAM(info, ai)<<"\t\tchecking for existing assignments\n";
|
||||
bool found=false;
|
||||
std::string unit_id=(**a)["unit_id"];
|
||||
for(unit_map::const_iterator i = my_units.begin(); i != my_units.end(); ++i) {
|
||||
|
||||
LOG_STREAM(info, ai)<<"\t\tcomparing "<<i->second.underlying_description() <<" to "<<(**a)["unit_id"] << " \n";
|
||||
|
||||
if(i->second.underlying_description()==unit_id){
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found){
|
||||
LOG_STREAM(info, ai)<<"\tfound an existing assignments\n";
|
||||
unit_assignment[unit_id]=(**a)["order"];
|
||||
}else{//assigned unit no longer on map
|
||||
//need to remove units no longer on map.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}//end namespace dfool
|
Loading…
Add table
Reference in a new issue