00001 #include "RateableOptions.h"
00002
00003 RateableOptions::OptionInfo RateableOptions::optionInfos[] = {
00004
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
00031 { doSomething, "DoSomething", 1, 10, notype ,0 ,0 },
00032
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
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
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
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
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
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
00134
00135 bool RateableOptions::isOptionClass(int id)
00136 {
00137 return getNumberOfClassMembers( (OptionClassID)id ) != noOption;
00138 }
00139
00140
00141
00142
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
00161
00162
00163
00164
00165
00166