Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Tools/DynamicTeamTactic/RateableOptions.cpp

Go to the documentation of this file.
00001 #include "RateableOptions.h"
00002 
00003 RateableOptions::OptionInfo  RateableOptions::optionInfos[] = {
00004   // options
00005   //
00006   { noOption,                      "NoOption",                       0, 0, notype       ,1  ,0 }, 
00007   { doNothing,                     "DoNothing",                      0, 0, special      ,1  ,0 },
00008   { stand,                         "Stand",                          0, 0, gotoPos      ,1  ,0 },
00009   { keepOption,                    "KeepOption",                     0, 0, notype       ,1  ,0 },
00010   { intro,                         "Intro",                          0, 0, notype       ,1  ,0 },  
00011   { extro,                         "Extro",                          0, 0, notype       ,1  ,0 },  
00012   { finished,                      "Finished",                       0, 0, notype       ,1  ,0 },  
00013   { gotoBitePos1,                  "GotoBitePos1",                   0, 0, notype       ,1  ,0 },  
00014   { gotoBitePos2,                  "GotoBitePos2",                   0, 0, notype       ,1  ,0 },  
00015   { gotoBitePos3,                  "GotoBitePos3",                   0, 0, notype       ,1  ,0 },  
00016   { gotoBitePos4,                  "GotoBitePos4",                   0, 0, notype       ,1  ,0 },  
00017   { bitePos1,                      "BitePos1",                       0, 0, notype       ,1  ,0 },  
00018   { bitePos2,                      "BitePos2",                       0, 0, notype       ,1  ,0 },  
00019   { bitePos3,                      "BitePos3",                       0, 0, notype       ,1  ,0 },  
00020   { bitePos4,                      "BitePos4",                       0, 0, notype       ,1  ,0 },  
00021   { movePos1,                      "MovePos1",                       0, 0, notype       ,1  ,0 },  
00022   { movePos2,                      "MovePos2",                       0, 0, notype       ,1  ,0 },  
00023   { movePos3,                      "MovePos3",                       0, 0, notype       ,1  ,0 },  
00024   { movePos4,                      "MovePos4",                       0, 0, notype       ,1  ,0 },  
00025   { gotoBridge,                    "GotoBridge",                     0, 0, notype       ,1  ,0 },  
00026   { climbBridge,                   "ClimbBridge",                    0, 0, notype       ,1  ,0 },  
00027   { moveBridge,                    "MoveBridge",                     0, 0, notype       ,1  ,0 },  
00028   { waitForBiteDogs,               "waitForBiteDogs",                0, 0, notype       ,1  ,0 },  
00029 
00030   // we need at least one option class
00031   { doSomething,           "DoSomething",          1, 10, notype ,0  ,0 },  
00032   // end marker
00033   //
00034   { -1, NULL, 0, 0, notype ,0  ,0 }
00035 };
00036 
00037 
00038 int RateableOptions::getNumberOfClassMembers(OptionClassID id)
00039 {
00040   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00041     if (o->id == id)
00042       return o->numOfSubOptions;
00043   }  
00044   return 0;
00045 }
00046 
00047 int RateableOptions::getOptionClassChangeThreshold(OptionClassID id)
00048 {
00049   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00050     if (o->id == id)
00051       return o->changeThreshold;
00052   }  
00053   return 0;
00054 }
00055 
00056 RateableOptions::OptionID RateableOptions::getClassMember(OptionClassID id, int idx)
00057 {
00058   switch (id) {
00059     case doSomething:
00060       switch (idx) {
00061         case 0   : return stand;
00062       }
00063       break;
00064   }
00065 
00066   return noOption;
00067 }
00068 
00069 
00070 /**
00071  * returns names for option and option class ids
00072  */
00073 const char* RateableOptions::getOptionName(int id)
00074 {
00075   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00076     if (o->id == id)
00077       return o->name;
00078   }
00079   return "please edit the RateableOptions::optionInfos array";
00080 }
00081 
00082 
00083 /**
00084  * returns ids for option and option class names
00085  */
00086 int RateableOptions::getOptionID(const char* name)
00087 {
00088   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00089     if (!strcmp(name, o->name))
00090       return o->id;
00091   }
00092   return -1;
00093 };
00094 
00095 /**
00096  * returns types for option ids
00097  */
00098 RateableOptions::OptionType RateableOptions::getOptionType(int id)
00099 {
00100   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00101     if (o->id == id)
00102       return o->optionType;
00103   }
00104   return notype;
00105 };
00106 
00107 /**
00108  * returns SlidingAverageRange for option and option class names
00109  */
00110 int RateableOptions::getSlidingAverageRange(int id)
00111 {
00112   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00113     if (o->id == id)
00114       return o->slidingAverageRange;
00115   }
00116   return -1;
00117 };
00118 
00119 /**
00120  * returns RatingBoost for option and option class names
00121  */
00122 int RateableOptions::getRatingBoost(int id)
00123 {
00124   for (OptionInfo *o=optionInfos; o->id != -1; o++) {
00125     if (o->id == id)
00126       return o->ratingBoost;
00127   }
00128   return -1;
00129 };
00130 
00131 
00132 /**
00133  * returns true, if id is an option class, else false
00134  */
00135 bool RateableOptions::isOptionClass(int id)
00136 {
00137   return getNumberOfClassMembers( (OptionClassID)id ) != noOption;
00138 }
00139 
00140 
00141 /**
00142  * returns true, if Oid is a member of the option class OCid, else false
00143  */
00144 bool RateableOptions::isClassMember(OptionClassID OCid, OptionID Oid)
00145 {
00146   switch (OCid) {
00147     case doSomething:
00148       switch (Oid) {
00149         case stand: return true;
00150       }
00151       break;
00152    
00153   }
00154 
00155   return false;
00156 }
00157 
00158 
00159 /*
00160  * Change log :
00161  * $Log: RateableOptions.cpp,v $
00162  * Revision 1.3  2004/07/22 22:38:34  kerdels
00163  * added DTT used by Open Challenge, RIP and Xabsl-Options will follow
00164  *
00165  *
00166  */

Generated on Thu Sep 23 19:57:37 2004 for GT2004 by doxygen 1.3.6