int upgradeControl(int currentUpgrade) {
// This section returns the value of an upgrade
switch (currentUpgrade) {
case 0: currentUpgrade = 0;
break;
case 1: currentUpgrade = 100;
break;
case 2: currentUpgrade = 300;
break;
case 3: currentUpgrade = 600;
break;
case 4: currentUpgrade = 1000;
break;
case 5: currentUpgrade = 1500;
break;
default: std::cout << "We have an error";
}
}
我需要我的代码将一个新值返回给另一个函数,但是CLion说我的交换机中嵌套的所有内容都无法访问。
答案 0 :(得分:0)
int upgradeControl(int currentUpgrade) {
// This section returns the value of an upgrade
switch (currentUpgrade) {
case 0: currentUpgrade = 0;
break;
case 1: currentUpgrade = 100;
break;
case 2: currentUpgrade = 300;
break;
case 3: currentUpgrade = 600;
break;
case 4: currentUpgrade = 1000;
break;
case 5: currentUpgrade = 1500;
break;
default: std::cout << "We have an error";
}
return currentUpgrade;
}