ai/testing/ca_testing_move_to_targets.hpp

Go to the documentation of this file.
00001 /* $Id: ca_testing_move_to_targets.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2009 - 2012 by Yurii Chernyi <terraninfo@terraninfo.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 /**
00017  * @file
00018  * Strategic movement routine, for experimentation
00019  */
00020 
00021 #ifndef AI_TESTING_CA_TESTING_MOVE_TO_TARGETS_HPP_INCLUDED
00022 #define AI_TESTING_CA_TESTING_MOVE_TO_TARGETS_HPP_INCLUDED
00023 
00024 #include "../composite/rca.hpp"
00025 
00026 #include "../../unit_map.hpp"
00027 
00028 #ifdef _MSC_VER
00029 #pragma warning(push)
00030 //silence "inherits via dominance" warnings
00031 #pragma warning(disable:4250)
00032 #endif
00033 
00034 namespace pathfind {
00035 
00036 struct plain_route;
00037 
00038 } //of namespace pathfind
00039 
00040 namespace ai {
00041 
00042 namespace testing_ai_default {
00043 
00044 class testing_move_to_targets_phase : public candidate_action {
00045 public:
00046 
00047     testing_move_to_targets_phase( rca_context &context, const config &cfg );
00048 
00049     virtual ~testing_move_to_targets_phase();
00050 
00051     virtual double evaluate();
00052 
00053     virtual void execute();
00054 
00055 protected:
00056     void access_points(const move_map& srcdst, const map_location& u, const map_location& dst, std::vector<map_location>& out);
00057 
00058     std::pair<map_location,map_location> choose_move(std::vector<target>& targets, const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc);
00059 
00060     double compare_groups(const std::set<map_location>& our_group, const std::set<map_location>& their_group, const std::vector<map_location>& battlefield) const;
00061 
00062     void enemies_along_path(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res);
00063 
00064     map_location form_group(const std::vector<map_location>& route, const move_map& dstsrc, std::set<map_location>& res);
00065 
00066     bool move_group(const map_location& dst, const std::vector<map_location>& route, const std::set<map_location>& units);
00067 
00068     double rate_group(const std::set<map_location>& group, const std::vector<map_location>& battlefield) const;
00069 
00070     /**
00071      * rate a target, but can also return the maximal possible rating
00072      * by passing a dummy route
00073     */
00074     double rate_target(const target& tg, const unit_map::iterator& u,
00075             const move_map& dstsrc, const move_map& enemy_dstsrc,
00076             const pathfind::plain_route& rt);
00077 
00078     bool should_retreat(const map_location& loc, const unit_map::const_iterator& un,
00079                 const move_map& srcdst, const move_map& dstsrc, const move_map& enemy_dstsrc,
00080                 double caution);
00081 };
00082 
00083 } // of namespace testing_ai_default
00084 
00085 } // of namespace ai
00086 
00087 #ifdef _MSC_VER
00088 #pragma warning(pop)
00089 #endif
00090 
00091 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Wed May 23 2012 01:02:33 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs