diff --git a/src/artifact.cpp b/src/artifact.cpp index b7aca7f62e067..b2a8c13236c17 100644 --- a/src/artifact.cpp +++ b/src/artifact.cpp @@ -1160,8 +1160,8 @@ void it_artifact_tool::deserialize( JsonObject &jo ) m_to_hit = jo.get_int( "m_to_hit" ); item_tags = jo.get_tags( "item_flags" ); - tool->max_charges = jo.get_long( "max_charges" ); - tool->def_charges = jo.get_long( "def_charges" ); + tool->max_charges = jo.get_int( "max_charges" ); + tool->def_charges = jo.get_int( "def_charges" ); tool->charges_per_use = jo.get_int( "charges_per_use" ); tool->turns_per_charge = jo.get_int( "turns_per_charge" ); diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 6174ff8985389..40c4904b4b718 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -1307,7 +1307,7 @@ void Item_factory::load( islot_ammo &slot, JsonObject &jo, const std::string &sr assign( jo, "range", slot.range, strict, 0 ); assign( jo, "dispersion", slot.dispersion, strict, 0 ); assign( jo, "recoil", slot.recoil, strict, 0 ); - assign( jo, "count", slot.def_charges, strict, 1L ); + assign( jo, "count", slot.def_charges, strict, 1 ); assign( jo, "loudness", slot.loudness, strict, 0 ); assign( jo, "effects", slot.ammo_effects, strict ); assign( jo, "prop_damage", slot.prop_damage, strict ); @@ -1630,7 +1630,7 @@ void Item_factory::load( islot_comestible &slot, JsonObject &jo, const std::stri assign( jo, "comestible_type", slot.comesttype, strict ); assign( jo, "tool", slot.tool, strict ); - assign( jo, "charges", slot.def_charges, strict, 1L ); + assign( jo, "charges", slot.def_charges, strict, 1 ); assign( jo, "quench", slot.quench, strict ); assign( jo, "fun", slot.fun, strict ); assign( jo, "stim", slot.stim, strict ); diff --git a/src/item_group.h b/src/item_group.h index 67ecc5b055194..70977ad3e7b6c 100644 --- a/src/item_group.h +++ b/src/item_group.h @@ -152,7 +152,7 @@ class Item_modifier * Charges to spawn the item with, if this turns out to * be negative, the default charges are used. */ - std::pair charges; + std::pair charges; /** * Ammo for guns. If NULL the gun spawns without ammo. * This takes @ref charges and @ref with_ammo into account. diff --git a/src/itype.h b/src/itype.h index d221b3fc35cfe..d04920dba0355 100644 --- a/src/itype.h +++ b/src/itype.h @@ -114,7 +114,7 @@ struct islot_comestible { std::string tool = "null"; /** Defaults # of charges (drugs, loaf of bread? etc) */ - long def_charges = 1; + int def_charges = 1; /** effect on character thirst (may be negative) */ int quench = 0; @@ -638,7 +638,7 @@ struct islot_ammo : common_ranged_data { /** * Default charges. */ - long def_charges = 1; + int def_charges = 1; /** * TODO: document me. diff --git a/src/json.cpp b/src/json.cpp index f620c21514e0a..29977cfe07a1d 100644 --- a/src/json.cpp +++ b/src/json.cpp @@ -242,23 +242,6 @@ int JsonObject::get_int( const std::string &name, const int fallback ) return jsin->get_int(); } -long JsonObject::get_long( const std::string &name ) -{ - int pos = verify_position( name ); - jsin->seek( pos ); - return jsin->get_long(); -} - -long JsonObject::get_long( const std::string &name, const long fallback ) -{ - long pos = positions[name]; - if( pos <= start ) { - return fallback; - } - jsin->seek( pos ); - return jsin->get_long(); -} - double JsonObject::get_float( const std::string &name ) { int pos = verify_position( name ); @@ -514,13 +497,6 @@ int JsonArray::next_int() return jsin->get_int(); } -long JsonArray::next_long() -{ - verify_index( index ); - jsin->seek( positions[index++] ); - return jsin->get_long(); -} - double JsonArray::next_float() { verify_index( index ); @@ -571,13 +547,6 @@ int JsonArray::get_int( int i ) return jsin->get_int(); } -long JsonArray::get_long( int i ) -{ - verify_index( i ); - jsin->seek( positions[i] ); - return jsin->get_long(); -} - double JsonArray::get_float( int i ) { verify_index( i ); @@ -1046,13 +1015,6 @@ int JsonIn::get_int() return static_cast( get_float() ); } -long JsonIn::get_long() -{ - // get float value and then convert to int, - // because "1.359e3" is technically a valid integer. - return static_cast( get_float() ); -} - double JsonIn::get_float() { // this could maybe be prettier? @@ -1372,24 +1334,6 @@ bool JsonIn::read( unsigned int &u ) return true; } -bool JsonIn::read( long &l ) -{ - if( !test_number() ) { - return false; - } - l = get_long(); - return true; -} - -bool JsonIn::read( unsigned long &ul ) -{ - if( !test_number() ) { - return false; - } - ul = get_long(); - return true; -} - bool JsonIn::read( float &f ) { if( !test_number() ) { diff --git a/src/json.h b/src/json.h index b319f38080a0a..54cf2cc69be05 100644 --- a/src/json.h +++ b/src/json.h @@ -209,7 +209,6 @@ class JsonIn // data parsing std::string get_string(); // get the next value as a string int get_int(); // get the next value as an int - long get_long(); // get the next value as an long bool get_bool(); // get the next value as a bool double get_float(); // get the next value as a double std::string get_member_name(); // also strips the ':' @@ -259,8 +258,6 @@ class JsonIn bool read( short int &s ); bool read( int &i ); bool read( unsigned int &u ); - bool read( long &l ); - bool read( unsigned long &ul ); bool read( float &f ); bool read( double &d ); bool read( std::string &s ); @@ -686,8 +683,6 @@ class JsonObject bool get_bool( const std::string &name, const bool fallback ); int get_int( const std::string &name ); int get_int( const std::string &name, const int fallback ); - long get_long( const std::string &name ); - long get_long( const std::string &name, const long fallback ); double get_float( const std::string &name ); double get_float( const std::string &name, const double fallback ); std::string get_string( const std::string &name ); @@ -853,7 +848,6 @@ class JsonArray // iterative access bool next_bool(); int next_int(); - long next_long(); double next_float(); std::string next_string(); JsonArray next_array(); @@ -863,7 +857,6 @@ class JsonArray // static access bool get_bool( int index ); int get_int( int index ); - long get_long( int index ); double get_float( int index ); std::string get_string( int index ); JsonArray get_array( int index ); diff --git a/src/mission.h b/src/mission.h index 8631f143995ad..9cac4bcfa65e8 100644 --- a/src/mission.h +++ b/src/mission.h @@ -285,7 +285,7 @@ class mission std::string description; mission_status status; // Cash/Favor value of completing this - unsigned long value; + unsigned int value; // If there's a special reward for completing it npc_favor reward; // Unique ID number, used for referencing elsewhere diff --git a/src/npctalk.cpp b/src/npctalk.cpp index 2db703d54ab76..c129912064d99 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -2828,7 +2828,7 @@ void conditional_t::set_npc_role_nearby( JsonObject &jo ) void conditional_t::set_npc_allies( JsonObject &jo ) { - const unsigned long min_allies = jo.get_int( "npc_allies" ); + const unsigned int min_allies = jo.get_int( "npc_allies" ); condition = [min_allies]( const dialogue & ) { return g->allies().size() >= min_allies; }; @@ -2836,7 +2836,7 @@ void conditional_t::set_npc_allies( JsonObject &jo ) void conditional_t::set_u_has_cash( JsonObject &jo ) { - const signed long min_cash = jo.get_int( "u_has_cash" ); + const int min_cash = jo.get_int( "u_has_cash" ); condition = [min_cash]( const dialogue & d ) { return d.alpha->cash >= min_cash; }; @@ -2924,7 +2924,7 @@ void conditional_t::set_npc_override( JsonObject &jo ) void conditional_t::set_days_since( JsonObject &jo ) { - const unsigned long days = jo.get_int( "days_since_cataclysm" ); + const unsigned int days = jo.get_int( "days_since_cataclysm" ); condition = [days]( const dialogue & ) { return to_turn( calendar::turn ) >= DAYS( days ); }; diff --git a/src/player.h b/src/player.h index 3e1beb53be442..4dc1be104b594 100644 --- a/src/player.h +++ b/src/player.h @@ -1546,7 +1546,7 @@ class player : public Character int blocks_left; int stim; int radiation; - signed long cash; + int cash; int movecounter; std::shared_ptr mounted_creature; bool death_drops;// Turned to false for simulating NPCs on distant missions so they don't drop all their gear in sight diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 1d4445a0d0a8c..75a93cbc3f355 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -2925,7 +2925,7 @@ void map_memory::load( JsonIn &jsin ) p.x = jsin.get_int(); p.y = jsin.get_int(); p.z = jsin.get_int(); - const long symbol = jsin.get_long(); + const int symbol = jsin.get_int(); memorize_symbol( std::numeric_limits::max(), p, symbol ); jsin.end_array(); } @@ -2950,7 +2950,7 @@ void map_memory::load( JsonObject &jsin ) while( map_memory_curses.has_more() ) { JsonObject pmap = map_memory_curses.next_object(); const tripoint p( pmap.get_int( "x" ), pmap.get_int( "y" ), pmap.get_int( "z" ) ); - memorize_symbol( std::numeric_limits::max(), p, pmap.get_long( "symbol" ) ); + memorize_symbol( std::numeric_limits::max(), p, pmap.get_int( "symbol" ) ); } }