Whales/Cataclysm2

Skill.cpp

Opened this issue · 3 comments

The switch case in Skill.cpp is gross.

Ok. Any alternative suggestions?

Just a normal switch case without any bizarre syntax changes.

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.