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

Skill.cpp #47

Open
Verifiable opened this issue Jun 4, 2014 · 3 comments
Open

Skill.cpp #47

Verifiable opened this issue Jun 4, 2014 · 3 comments

Comments

@Verifiable
Copy link

The switch case in Skill.cpp is gross.

@Whales
Copy link
Owner

Whales commented Jul 30, 2014

Ok. Any alternative suggestions?

@Verifiable
Copy link
Author

Just a normal switch case without any bizarre syntax changes.

@Whales
Copy link
Owner

Whales commented Jul 30, 2014

It's pretty standard to write a switch like this for a function that has a 1:1 relationship between its single parameter and its return value.

For me it's a lot more readable to inline it than to break stuff out:

switch (type) {
  case SKILL_MELEE:    return "melee";
  case SKILL_BASH:     return "bashing_weapons";
}

is far nicer & more readable than

switch (type) {
  case SKILL_MELEE:
    return "melee";
    break;
  case SKILL_BASH:
    return "bashing_weapons";
    break;
}

in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants