00001 00002 /* $Id: contexts.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00003 /* 00004 Copyright (C) 2009 - 2012 by Yurii Chernyi <terraninfo@terraninfo.net> 00005 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY. 00013 00014 See the COPYING file for more details. 00015 */ 00016 00017 /** 00018 * @file 00019 * Composite AI contexts 00020 */ 00021 00022 #ifndef AI_COMPOSITE_CONTEXTS_HPP_INCLUDED 00023 #define AI_COMPOSITE_CONTEXTS_HPP_INCLUDED 00024 00025 #include "../default/contexts.hpp" 00026 00027 #ifdef _MSC_VER 00028 #pragma warning(push) 00029 //silence "inherits via dominance" warnings 00030 #pragma warning(disable:4250) 00031 #endif 00032 00033 00034 //============================================================================ 00035 namespace ai { 00036 00037 class ai_context : public virtual default_ai_context { 00038 public: 00039 00040 /** 00041 * Unwrap 00042 */ 00043 virtual ai_context& get_ai_context() = 0; 00044 00045 00046 }; 00047 00048 00049 class rca_context; 00050 class rca_context : public virtual ai_context { 00051 public: 00052 00053 00054 /** 00055 * Constructor 00056 */ 00057 rca_context(); 00058 00059 00060 /** 00061 * Destructor 00062 */ 00063 virtual ~rca_context(); 00064 00065 00066 /** 00067 * Unwrap 00068 */ 00069 virtual rca_context& get_rca_context() = 0; 00070 }; 00071 00072 00073 class candidate_action_context; 00074 class candidate_action_context : public virtual rca_context { 00075 public: 00076 00077 00078 /** 00079 * Constructor 00080 */ 00081 candidate_action_context() {} 00082 00083 00084 /** 00085 * Destructor 00086 */ 00087 virtual ~candidate_action_context() {} 00088 00089 00090 /** 00091 * Unwrap 00092 */ 00093 virtual candidate_action_context& get_candidate_action_context() = 0; 00094 }; 00095 00096 // proxies 00097 class ai_context_proxy : public virtual ai_context, public virtual default_ai_context_proxy { 00098 public: 00099 ai_context_proxy(); 00100 00101 00102 void init_ai_context_proxy(ai_context &target) 00103 { 00104 init_default_ai_context_proxy(target); 00105 target_ = ⌖ 00106 } 00107 00108 00109 virtual ~ai_context_proxy(); 00110 00111 00112 ai_context& get_ai_context() 00113 { 00114 return target_->get_ai_context(); 00115 } 00116 00117 00118 private: 00119 ai_context *target_; 00120 }; 00121 00122 00123 class rca_context_proxy : public virtual rca_context, public virtual ai_context_proxy { 00124 public: 00125 rca_context_proxy(); 00126 00127 00128 virtual ~rca_context_proxy(); 00129 00130 00131 void init_rca_context_proxy(rca_context &target) 00132 { 00133 init_ai_context_proxy(target); 00134 target_ = ⌖ 00135 } 00136 00137 00138 rca_context& get_rca_context() 00139 { 00140 return target_->get_rca_context(); 00141 } 00142 00143 00144 private: 00145 rca_context *target_; 00146 }; 00147 00148 00149 } //end of namespace ai 00150 00151 #ifdef _MSC_VER 00152 #pragma warning(pop) 00153 #endif 00154 00155 00156 #endif
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:02:28 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |