1 #pragma once 2 3 #include <string_theory/string> 4 5 #include <map> 6 #include <stdexcept> 7 #include <stdint.h> 8 9 class JsonObject; 10 class JsonObjectReader; 11 12 #define NOAMMO (0) 13 14 struct CalibreModel 15 { 16 CalibreModel(uint16_t index, 17 ST::string internalName, 18 ST::string burstSoundString, 19 bool showInHelpText, 20 bool monsterWeapon, 21 int silencerSound 22 ); 23 24 // This could be default in C++11 25 virtual ~CalibreModel(); 26 27 const ST::string* getName() const; 28 29 virtual void serializeTo(JsonObject &obj) const; 30 static CalibreModel* deserialize(JsonObjectReader &obj); 31 32 static const CalibreModel* getNoCalibreObject(); 33 34 uint16_t index; 35 ST::string internalName; 36 ST::string burstSoundString; 37 bool showInHelpText; 38 bool monsterWeapon; 39 int silencerSound; 40 }; 41 42 const CalibreModel* getCalibre(const ST::string& calibreName, 43 const std::map<ST::string, const CalibreModel*> &calibreMap); 44