[Gcblue-commits] gcb_wx/src/ai BlackboardInterface.cpp,1.1,1.2 Brain.cpp,1.2,1.3
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-02-20 18:20:30
|
Update of /cvsroot/gcblue/gcb_wx/src/ai In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23561/src/ai Modified Files: BlackboardInterface.cpp Brain.cpp Log Message: Parallel ai update Index: BlackboardInterface.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/BlackboardInterface.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BlackboardInterface.cpp 16 Feb 2005 23:13:49 -0000 1.1 --- BlackboardInterface.cpp 20 Feb 2005 18:20:19 -0000 1.2 *************** *** 79,82 **** --- 79,87 ---- } + double BlackboardInterface::GetPriority() const + { + return priority; + } + void BlackboardInterface::SetPriority(double priority_) Index: Brain.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/ai/Brain.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Brain.cpp 16 Feb 2005 23:13:49 -0000 1.2 --- Brain.cpp 20 Feb 2005 18:20:19 -0000 1.3 *************** *** 49,52 **** --- 49,102 ---- } + /** + * @return target id for platform + */ + long Brain::GetTarget() const + { + return target; + } + + /** + * Set target id for platform + */ + void Brain::SetTarget(long target_) + { + target = target_; + } + + /** + * @return list of task names + */ + std::vector<std::string> Brain::GetTaskList() + { + std::vector<std::string> taskList; + + std::map<std::string, Task*>::iterator iter = taskMap.begin(); + std::map<std::string, Task*>::iterator& done = taskMap.end(); + for (;iter != done; ++iter) + { + taskList.push_back(iter->first); + } + + return taskList; + } + + /** + * @return priority of task or -1.0 if not found + */ + double Brain::GetTaskPriority(const std::string& taskName) const + { + std::map<std::string, Task*>::const_iterator iter = taskMap.find(taskName); + if (iter != taskMap.end()) + { + wxASSERT(iter->second); + return iter->second->GetPriority(); + } + else + { + return -1.0; + } + } + void Brain::AddTask(const std::string& taskName, double priority_) { *************** *** 105,109 **** : platform(platform_), updateInterval(0.125f), ! nextId(0) { wxASSERT(platform); --- 155,160 ---- : platform(platform_), updateInterval(0.125f), ! nextId(0), ! target(-1) { wxASSERT(platform); |