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

Clothing Layers #7302

Closed
wants to merge 6 commits into from

Conversation

Projects
None yet
4 participants
@illi-kun
Copy link
Member

commented Apr 19, 2014

Implementation of the clothing layers.
Discussion is here:
http://smf.cataclysmdda.com/index.php?topic=6126.0

@@ -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.

Copy link
@illi-kun

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 illi-kun changed the title Clothing Layers [WIP] [CR] Clothing Layers [CR] Apr 20, 2014

src/item.h Outdated
@@ -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.

Copy link
@kevingranade

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.

Copy link
@illi-kun

illi-kun Apr 20, 2014

Author Member

nice idea, will fix this soon.

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.

Copy link
@kevingranade

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.

Copy link
@illi-kun

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.

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.

Copy link
@kevingranade

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 ) {
@kevingranade

This comment has been minimized.

Copy link
Member

commented Apr 21, 2014

I'm totally happy with it, but I'd like to let other people weigh in.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Apr 21, 2014

Keeping an eye on this, I like!


if (worn_item->has_flag("SKINTIGHT")) {
layer = _("It is the undergarment.");
} else if (worn_item->has_flag("OUTER")) {

This comment has been minimized.

Copy link
@illi-kun

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?

} 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.

Copy link
@KA101

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.

Copy link
@illi-kun

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.

@illi-kun

This comment has been minimized.

Copy link
Member Author

commented Apr 24, 2014

I'm going to move the changes of armor_layers.cpp in separate PR for avoiding of merge conflicts.

@illi-kun illi-kun changed the title Clothing Layers [CR] Clothing Layers Apr 24, 2014

@illi-kun

This comment has been minimized.

Copy link
Member Author

commented Apr 24, 2014

Unmergeable status really pissed me off, so I'll re-make this PR from the scratch.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Apr 25, 2014

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 illi-kun deleted the illi-kun:layers branch Apr 25, 2014

@illi-kun

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2014

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! Hail to Ludd, break the machines!

P.S. Thanks for piece of advice but piles of the text with description of git commands scare me a bit. Maybe next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.