Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CleverRaven/Cataclysm-DDA
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3d1cb1a2af0eb1839199c568f9664019c39da68e
Choose a base ref
..
head repository: CleverRaven/Cataclysm-DDA
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9bb884abcafffd08b4b7253cf3f4d5369791b198
Choose a head ref
Showing with 67 additions and 65 deletions.
  1. +2 −1 src/item_factory.cpp
  2. +65 −64 src/itype.h
3 changes: 2 additions & 1 deletion src/item_factory.cpp
Original file line number Diff line number Diff line change
@@ -2482,7 +2482,8 @@ static void apply_optional( T &value, const cata::optional<T> &applied )
// Gets around the issue that cata::optional doesn't support
// the *= and += operators required for "proportional" and "relative".
template<typename T>
static void get_optional( const JsonObject &jo, bool was_loaded, const std::string &member, cata::optional<T> &value )
static void get_optional( const JsonObject &jo, bool was_loaded, const std::string &member,
cata::optional<T> &value )
{
T tmp;
if( value ) {
129 changes: 65 additions & 64 deletions src/itype.h
Original file line number Diff line number Diff line change
@@ -309,77 +309,78 @@ struct armor_portion_data {
};

struct islot_armor {
/**
* Whether this item can be worn on either side of the body
*/
bool sided = false;
/**
* The Non-Functional variant of this item. Currently only applies to ablative plates
*/
itype_id non_functional;
/**
* How much warmth this item provides.
*/
int warmth = 0;
/**
* Factor modifying weight capacity
*/
float weight_capacity_modifier = 1.0f;
/**
* Bonus to weight capacity
*/
units::mass weight_capacity_bonus = 0_gram;
/**
* Whether this is a power armor item.
*/
bool power_armor = false;
/**
* Whether this item has ablative pockets
*/
bool ablative = false;
/**
* Whether this item has pockets that generate additional encumbrance
*/
bool additional_pocket_enc = false;
/**
* Whether this item has pockets that can be ripped off
*/
bool ripoff_chance = false;
/**
* Whether this item has pockets that are noisy
*/
bool noisy = false;
/**
* Whitelisted clothing mods.
* Restricted clothing mods must be listed here by id to be compatible.
*/
std::vector<std::string> valid_mods;
public:
/**
* Whether this item can be worn on either side of the body
*/
bool sided = false;
/**
* The Non-Functional variant of this item. Currently only applies to ablative plates
*/
itype_id non_functional;
/**
* How much warmth this item provides.
*/
int warmth = 0;
/**
* Factor modifying weight capacity
*/
float weight_capacity_modifier = 1.0f;
/**
* Bonus to weight capacity
*/
units::mass weight_capacity_bonus = 0_gram;
/**
* Whether this is a power armor item.
*/
bool power_armor = false;
/**
* Whether this item has ablative pockets
*/
bool ablative = false;
/**
* Whether this item has pockets that generate additional encumbrance
*/
bool additional_pocket_enc = false;
/**
* Whether this item has pockets that can be ripped off
*/
bool ripoff_chance = false;
/**
* Whether this item has pockets that are noisy
*/
bool noisy = false;
/**
* Whitelisted clothing mods.
* Restricted clothing mods must be listed here by id to be compatible.
*/
std::vector<std::string> valid_mods;

/**
* If the item in question has any sub coverage when testing for encumberance
*/
bool has_sub_coverage = false;
/**
* If the item in question has any sub coverage when testing for encumberance
*/
bool has_sub_coverage = false;

// Layer, encumbrance and coverage information for each body part.
// This isn't directly loaded in but is instead generated from the loaded in
// sub_data vector
std::vector<armor_portion_data> data;
// Layer, encumbrance and coverage information for each body part.
// This isn't directly loaded in but is instead generated from the loaded in
// sub_data vector
std::vector<armor_portion_data> data;

// Layer, encumbrance and coverage information for each sub body part.
// This vector can have duplicates for body parts themselves.
std::vector<armor_portion_data> sub_data;
// Layer, encumbrance and coverage information for each sub body part.
// This vector can have duplicates for body parts themselves.
std::vector<armor_portion_data> sub_data;

// all of the layers this item is involved in
std::vector<layer_level> all_layers;
// all of the layers this item is involved in
std::vector<layer_level> all_layers;

bool was_loaded = false;
bool was_loaded = false;

int avg_env_resist() const;
int avg_env_resist_w_filter() const;
float avg_thickness() const;
int avg_env_resist() const;
int avg_env_resist_w_filter() const;
float avg_thickness() const;

void load( const JsonObject &jo );
void deserialize( const JsonObject &jo );
void load( const JsonObject &jo );
void deserialize( const JsonObject &jo );

private:
// Base material thickness, used to derive thickness in sub_data