| 203 | KOTHZone kothzone; |
| 204 | |
| 205 | bool KOTHMapHandler::handle(bz_ApiString object, bz_CustomMapObjectInfo* data) { |
| 206 | if (object != "KOTH" || !data) { |
| 207 | return false; |
| 208 | } |
| 209 | |
| 210 | // parse all the chunks |
| 211 | for (unsigned int i = 0; i < data->data.size(); i++) { |
| 212 | std::string line = data->data.get(i).c_str(); |
| 213 | |
| 214 | bz_APIStringList* nubs = bz_newStringList(); |
| 215 | nubs->tokenize(line.c_str(), " ", 0, true); |
| 216 | |
| 217 | if (nubs->size() > 0) { |
| 218 | std::string key = bz_toupper(nubs->get(0).c_str()); |
| 219 | |
| 220 | if (key == "BBOX" && nubs->size() > 6) { |
| 221 | kothzone.box = true; |
| 222 | kothzone.xMin = (float) atof(nubs->get(1).c_str()); |
| 223 | kothzone.xMax = (float) atof(nubs->get(2).c_str()); |
| 224 | kothzone.yMin = (float) atof(nubs->get(3).c_str()); |
| 225 | kothzone.yMax = (float) atof(nubs->get(4).c_str()); |
| 226 | kothzone.zMin = (float) atof(nubs->get(5).c_str()); |
| 227 | kothzone.zMax = (float) atof(nubs->get(6).c_str()); |
| 228 | } |
| 229 | else if (key == "CYLINDER" && nubs->size() > 5) { |
| 230 | kothzone.box = false; |
| 231 | kothzone.rad = (float) atof(nubs->get(5).c_str()); |
| 232 | kothzone.xMax = (float) atof(nubs->get(1).c_str()); |
| 233 | kothzone.yMax = (float) atof(nubs->get(2).c_str()); |
| 234 | kothzone.zMin = (float) atof(nubs->get(3).c_str()); |
| 235 | kothzone.zMax = (float) atof(nubs->get(4).c_str()); |
| 236 | } |
| 237 | else if (key == "TEAMPLAY") { |
| 238 | koth.teamPlay = true; |
| 239 | } |
| 240 | else if (key == "NOSOUND") { |
| 241 | koth.soundEnabled = false; |
| 242 | } |
| 243 | else if (key == "AUTOTIME" && nubs->size() == 1) { |
| 244 | koth.autoTimeOn = true; |
| 245 | } |
| 246 | else if (key == "AUTOTIME" && nubs->size() > 2) { |
| 247 | double temp1 = (double) atof(nubs->get(1).c_str()); |
| 248 | double temp2 = (double) atof(nubs->get(2).c_str()); |
| 249 | if (temp1 >= 1 && temp1 <= 99) { |
| 250 | koth.timeMult = temp1 / 100; |
| 251 | } |
| 252 | if (temp2 >= 1 && temp2 <= 99) { |
| 253 | koth.timeMultMin = temp2 / 100; |
| 254 | } |
| 255 | koth.autoTimeOn = true; |
| 256 | } |
| 257 | else if (key == "HOLDTIME" && nubs->size() > 1) { |
| 258 | double temp = (double) atof(nubs->get(1).c_str()); |
| 259 | if (temp >= 1 && temp <= 7200) { |
| 260 | koth.TTH = temp; |
| 261 | } |
| 262 | } |
nothing calls this directly
no test coverage detected