Functions | |
| FLOAT | abs (FLOAT num) |
| FLOAT | distXY (Vec3D &a, Vec3D &b) |
| string | serialize (Vec3D vec) |
| Vec3D | unserializeVec3D (stringstream &sstr) |
| FLOAT | radiansToDegrees (FLOAT rad) |
| string | toLower (string str) |
| string | eatEarlyWhiteSpace (string input) |
| Vec3D | playerNumberToPlayerColor (int num) |
| |
| int | totalCitiesForPlayer (Vec3D playerColor) |
| Player * | playerNumberToPlayerPointer (int num) |
| |
| int | playerColorToPlayerNumber (Vec3D color) |
| |
| string | playerColorToPlayerName (Vec3D color) |
| |
| void | printPlayerNameToScreen (Vec3D playerColor, Vec2D location, FLOAT scale) |
| |
| int | totalUnitsForPlayer (Vec3D playerColor) |
| int | totalUnitsBeingBuiltForPlayer (Vec3D playerColor) |
| int | maintenanceMultiplier (Vec3D playerColor, int amount) |
|
|
Definition at line 28 of file HelperFunctions.cpp. Referenced by distXY(), Jet::move(), and renderSponsor().
00028 {
00029 if(num < 0) return -1 * num;
00030 else return num;
00031 }
|
|
||||||||||||
|
Definition at line 33 of file HelperFunctions.cpp. References abs().
|
|
|
Definition at line 69 of file HelperFunctions.cpp. Referenced by Overhead::processCommand().
00070 {
00071 while(input[0] == ' ') input = input.substr(1);
00072 return input;
00073 }
|
|
||||||||||||
|
Definition at line 159 of file HelperFunctions.cpp. References totalUnitsForPlayer().
00160 {
00161 FLOAT tmp;
00162 int totalUnits(totalUnitsForPlayer(playerColor));
00163 if (totalUnits < 15) return amount;
00164 else if (totalUnits < 25) tmp = amount * 0.5f;
00165 else tmp = amount * 0.1f;
00166 int result(static_cast<int>(tmp));
00167 if (result > 0) return result;
00168 else return 1;
00169 }
|
|
|
Definition at line 122 of file HelperFunctions.cpp. References net_getPlayerNameUsingNum(), and playerColorToPlayerNumber(). Referenced by City::changeOwner(), Overhead::doCollisionDetection(), Overhead::printPlayerList(), and printPlayerNameToScreen().
00123 {
00124 unsigned int num(playerColorToPlayerNumber(color));
00125 return net_getPlayerNameUsingNum(num);
00126 }
|
|
|
Definition at line 105 of file HelperFunctions.cpp. References sys_console(). Referenced by playerColorToPlayerName().
00106 {
00107 if (color == Colors::red) return 0;
00108 else if (color == Colors::blue) return 1;
00109 else if (color == Colors::green) return 2;
00110 else if (color == Colors::yellow) return 3;
00111 else if (color == Colors::cyan) return 4;
00112 else if (color == Colors::white) return 5;
00113 else if (color == Colors::black) return 6;
00114 else if (color == Colors::magenta) return 7;
00115 else {
00116 sys_console() << "ERROR! invalid color given" << endl;
00117 return 0;
00118 }
00119 }
|
|
|
Definition at line 76 of file HelperFunctions.cpp. References Vec3D. Referenced by playerNumberToPlayerPointer(), and Overhead::printPlayerList().
|
|
|
Definition at line 94 of file HelperFunctions.cpp. References playerNumberToPlayerColor(), GameState::players(), and Vec3D.
00095 {
00096 Vec3D playerColor(playerNumberToPlayerColor(num));
00097 for(vector<Player*>::iterator iter(GameState::players().begin()); iter != GameState::players().end(); ++iter)
00098 {
00099 if ((*iter)->color() == playerColor) return *iter;
00100 }
00101 return 0;
00102 }
|
|
||||||||||||||||
|
Definition at line 129 of file HelperFunctions.cpp. References overlay_text(), overlay_textOut(), and playerColorToPlayerName(). Referenced by Overhead::overheadRender().
00130 {
00131 overlay_text() << playerColorToPlayerName(playerColor);
00132 overlay_textOut(location, scale, playerColor);
00133 }
|
|
|
Definition at line 53 of file HelperFunctions.cpp.
00054 {
00055 const FLOAT PI(3.15159f);
00056 FLOAT degrees(rad/PI*180);
00057 return degrees;
00058 }
|
|
|
Definition at line 38 of file HelperFunctions.cpp. Referenced by HUD::processMiniMapInput(), and Overhead::processOverheadInput().
00039 {
00040 stringstream sstr;
00041 sstr << vec.x << " " << vec.y << " " << vec.z;
00042 return sstr.str();
00043 }
|
|
|
Definition at line 60 of file HelperFunctions.cpp. Referenced by NetworkSubsystem::processNetworkData().
00061 {
00062 for(unsigned int i=0; i < str.size(); ++i)
00063 {
00064 str[i] = tolower(str[i]);
00065 }
00066 return str;
00067 }
|
|
|
Definition at line 83 of file HelperFunctions.cpp. References GameState::cities(). Referenced by Overhead::playerStrength().
00084 {
00085 int total = 0;
00086 for(vector<City*>::iterator iter(GameState::cities().begin()); iter != GameState::cities().end(); ++iter)
00087 {
00088 if ((*iter)->color() == playerColor) ++total;
00089 }
00090 return total;
00091 }
|
|
|
Definition at line 149 of file HelperFunctions.cpp. References GameState::cities(). Referenced by Overhead::playerStrength(), and City::trainUnit().
00150 {
00151 int total = 0;
00152 for(vector<City*>::iterator iter(GameState::cities().begin()); iter != GameState::cities().end(); ++iter)
00153 {
00154 if ((*iter)->color() == playerColor) total += static_cast<int>((*iter)->trainees().size());
00155 }
00156 return total;
00157 }
|
|
|
Definition at line 135 of file HelperFunctions.cpp. References GameState::battles(), and GameState::units(). Referenced by maintenanceMultiplier(), Overhead::playerStrength(), and City::trainUnit().
00136 {
00137 int totalUnits = 0;
00138 for(vector<MilitaryUnit*>::iterator iter(GameState::units().begin()); iter != GameState::units().end(); ++iter)
00139 {
00140 if ((*iter)->color() == playerColor) ++totalUnits;
00141 }
00142 for(vector<BattleEntry*>::iterator iter(GameState::battles().begin()); iter != GameState::battles().end(); ++iter)
00143 {
00144 totalUnits += (*iter)->countGroupsBelongingToPlayer(playerColor);
00145 }
00146 return totalUnits;
00147 }
|
|
|
Definition at line 45 of file HelperFunctions.cpp. References Vec3D. Referenced by NetworkSubsystem::processNetworkData().
|
1.3-rc2