Skip to content

Commit

Permalink
Merge pull request #40162 from jbytheway/improve_itype_layout
Browse files Browse the repository at this point in the history
Improve itype layout
  • Loading branch information
kevingranade authored May 5, 2020
2 parents 46b02d4 + 8fa56b1 commit 781ca2e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ readability-*,\
-readability-magic-numbers,\
-readability-named-parameter,\
-readability-redundant-control-flow,\
-clang-analyzer-optin.performance.Padding,\
"
WarningsAsErrors: '*'
HeaderFilterRegex: '(src|test|tools).*'
Expand Down
66 changes: 33 additions & 33 deletions src/itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -822,39 +822,6 @@ struct itype {
cata::value_ptr<relic> relic_data;
/*@}*/

private:
/** Can item be combined with other identical items? */
bool stackable_ = false;

/** Minimum and maximum amount of damage to an item (state of maximum repair). */
// TODO: create and use a MinMax class or similar to put both values into one object.
/// @{
int damage_min_ = -1000;
int damage_max_ = +4000;
/// @}

protected:
std::string id = "null"; /** unique string identifier for this type */

// private because is should only be accessed through itype::nname!
// nname() is used for display purposes
translation name = no_translation( "none" );

public:
itype() {
melee.fill( 0 );
}

int damage_min() const {
return count_by_charges() ? 0 : damage_min_;
}
int damage_max() const {
return count_by_charges() ? 0 : damage_max_;
}

// used for generic_factory for copy-from
bool was_loaded = false;

// a hint for tilesets: if it doesn't have a tile, what does it look like?
std::string looks_like;

Expand Down Expand Up @@ -993,6 +960,39 @@ struct itype {
*/
float solar_efficiency = 0;

// used for generic_factory for copy-from
bool was_loaded = false;

private:
/** Can item be combined with other identical items? */
bool stackable_ = false;

/** Minimum and maximum amount of damage to an item (state of maximum repair). */
// TODO: create and use a MinMax class or similar to put both values into one object.
/// @{
int damage_min_ = -1000;
int damage_max_ = +4000;
/// @}

protected:
std::string id = "null"; /** unique string identifier for this type */

// private because is should only be accessed through itype::nname!
// nname() is used for display purposes
translation name = no_translation( "none" );

public:
itype() {
melee.fill( 0 );
}

int damage_min() const {
return count_by_charges() ? 0 : damage_min_;
}
int damage_max() const {
return count_by_charges() ? 0 : damage_max_;
}

std::string get_item_type_string() const {
if( tool ) {
return "TOOL";
Expand Down

0 comments on commit 781ca2e

Please sign in to comment.