Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve itype layout #40162

Merged
merged 2 commits into from
May 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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