Fix for loops with no-op initialization

code-review-i
Dave Vandervies 4 years ago
parent d22c184965
commit 820be05b0d
  1. 10
      character.c

@ -21,8 +21,9 @@ int hp;
int dieroll(int num,int sides){
int total = 0;
for(num;num>0;num--){
while (num > 0) {
total = total + arc4random_uniform(sides)+1;
num--;
}
return total;
}
@ -60,10 +61,9 @@ void classProfs(unsigned long* classprofs, int count, int num){
classprofs[i]=local;
}
//Grab the first N elements, based on the class's value, but first, if we have more profs than available profs, get some random ones
if(num > count){
for(count;num > count;count--){
addProf(1lu << arc4random_uniform(18));
}
while (num > count){
addProf(1lu << arc4random_uniform(18));
count--;
}
for(int i=0;i<=num;i++){
addProf(classprofs[num]);

Loading…
Cancel
Save