Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upClothing Layers #7302
Conversation
illi-kun
added some commits
Apr 19, 2014
illi-kun
reviewed
Apr 19, 2014
| @@ -390,6 +390,20 @@ void draw_mid_pane(WINDOW *w_sort_middle, item *worn_item) | |||
| } | |||
| } | |||
|
|
|||
| std::string clothing_layer(item *worn_item) | |||
This comment has been minimized.
This comment has been minimized.
illi-kun
Apr 19, 2014
Author
Member
I used an obsolete branch for doing this PR, so maybe this function causes some issues in the merging process, sorry for possible inconvenience.
illi-kun
changed the title
Clothing Layers [WIP] [CR]
Clothing Layers [CR]
Apr 20, 2014
kevingranade
reviewed
Apr 20, 2014
| @@ -43,6 +43,15 @@ struct iteminfo{ | |||
| enum LIQUID_FILL_ERROR {L_ERR_NONE, L_ERR_NO_MIX, L_ERR_NOT_CONTAINER, L_ERR_NOT_WATERTIGHT, | |||
| L_ERR_NOT_SEALED, L_ERR_FULL}; | |||
|
|
|||
|
|
|||
| #define CLOTHING_LAYERS_COUNT 4 | |||
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 20, 2014
Member
The best way to do this is to make an enum at the end like "max_clothing_layer", then you can use that value and it updates automatically.
This comment has been minimized.
This comment has been minimized.
kevingranade
reviewed
Apr 21, 2014
| if( level == underwear && layer[underwear] > 0) { | ||
| // Skintight clothes will negate layering. | ||
| // But only if we aren't wearing more than two. | ||
| if (skintight < 2) { |
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 21, 2014
Member
The distinct layers thing is accomplishing the same thing as this, so this can go away IMO.
This comment has been minimized.
This comment has been minimized.
illi-kun
Apr 21, 2014
Author
Member
At first I was disagree with removing this but then I realized that items with the [FIT] flag and initial zero encumbrance are counted as a half of layer, so now I agree.
kevingranade
reviewed
Apr 21, 2014
| ret += armorenc; | ||
|
|
||
| if (layers > 1) { | ||
| ret += (int(layers) - 1) * (bp == bp_torso ? .75 : 1);// Easier to layer on torso | ||
| for (int i = 0; i < CLOTHING_LAYERS_COUNT; ++i) { |
This comment has been minimized.
This comment has been minimized.
kevingranade
Apr 21, 2014
Member
A nice idiom for iterating over an array like this is to use sizeof(array) / sizeof(array_element), so:
for( size_t i = 0; i < sizeof(layer) / sizeof(layer[0]); ++i ) {
This comment has been minimized.
This comment has been minimized.
|
I'm totally happy with it, but I'd like to let other people weigh in. |
This comment has been minimized.
This comment has been minimized.
|
Keeping an eye on this, I like! |
illi-kun
reviewed
Apr 23, 2014
|
|
||
| if (worn_item->has_flag("SKINTIGHT")) { | ||
| layer = _("It is the undergarment."); | ||
| } else if (worn_item->has_flag("OUTER")) { |
This comment has been minimized.
This comment has been minimized.
illi-kun
Apr 23, 2014
Author
Member
What if I remove 'else' from here and replace int level by the array of boolean variables? This will allow us to apply a few layer tags to a single item. As result, this item will encumber you on the different layers. Is it a step back?
KA101
reviewed
Apr 23, 2014
| } else if (worn_item->has_flag("OUTER")) { | ||
| layer = _("It is the outer garment."); | ||
| } else if (worn_item->has_flag("BELTED")) { | ||
| layer = _("It is the belted layer."); |
This comment has been minimized.
This comment has been minimized.
KA101
Apr 23, 2014
Contributor
These could probably be rephrased: "This is worn (next to the skin, around your waist, over your other clothes, etc)."
This comment has been minimized.
This comment has been minimized.
illi-kun
Apr 24, 2014
Author
Member
Thanks, that's what I'm waiting for a while. One comment here: the belted layer it's not only about waist, it's applicable to backpacks and to everything what's attached to you by straps, strings, etc.
This comment has been minimized.
This comment has been minimized.
|
I'm going to move the changes of armor_layers.cpp in separate PR for avoiding of merge conflicts. |
illi-kun
changed the title
Clothing Layers [CR]
Clothing Layers
Apr 24, 2014
This comment has been minimized.
This comment has been minimized.
|
Unmergeable status really pissed me off, so I'll re-make this PR from the scratch. |
illi-kun
closed this
Apr 24, 2014
illi-kun
referenced this pull request
Apr 24, 2014
Merged
Initial implementation of clothing layers #7390
This comment has been minimized.
This comment has been minimized.
|
FWIW just pulling the master branch into yours and fixing the conflicts works too. But then that's one of the things mergers do, so you're one step closer to having to merge rather than code. ;-P |
illi-kun
deleted the
illi-kun:layers
branch
Apr 25, 2014
This comment has been minimized.
This comment has been minimized.
|
Ha, I saw how the heresy (also known as "git magic") floods too many PRs by the unrelated trash and makes too many developers mad. Trust it? Never! P.S. Thanks for piece of advice but piles of the text with description of git commands scare me a bit. Maybe next time. |
illi-kun commentedApr 19, 2014
Implementation of the clothing layers.
Discussion is here:
http://smf.cataclysmdda.com/index.php?topic=6126.0