| 445 | } |
| 446 | |
| 447 | Weapon* GameMap::getWeaponForTuning(const std::string& name) |
| 448 | { |
| 449 | for (std::pair<const Weapon*,Weapon*>& def : mWeapons) |
| 450 | { |
| 451 | if(def.second != nullptr) |
| 452 | { |
| 453 | if (def.second->getName().compare(name) == 0) |
| 454 | return def.second; |
| 455 | } |
| 456 | else if(def.first->getName().compare(name) == 0) |
| 457 | { |
| 458 | // If the definition is not a copy, we make one because we want to keep the original so we are able |
| 459 | // to save the changes if the map is saved |
| 460 | def.second = new Weapon(*def.first); |
| 461 | return def.second; |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | // It is a new definition |
| 466 | Weapon* def = new Weapon(name); |
| 467 | mWeapons.push_back(std::pair<const Weapon*,Weapon*>(nullptr, def)); |
| 468 | return def; |
| 469 | } |
| 470 | |
| 471 | uint32_t GameMap::numWeapons() |
| 472 | { |
no outgoing calls
no test coverage detected