My mistake for assuming that the function was a basic dicethrower. Here's my suggested change:
int randomissue(bool core_only)
{
int interest_array[VIEWNUM];
int i;
int total_interest=0;
int CCSisDead = 0;
if(!core_only && endgamestate>=ENDGAME_CCS_DEFEATED){CCSisDead = 1;}
for(i=0;i<VIEWNUM-(core_only*5)-CCSisDead;i++)
{
interest_array[i]=public_interest[i]+total_interest+25;
total_interest+=public_interest[i]+25;
}
int roll = LCSrandom(total_interest);
for(i=0;i<VIEWNUM-(core_only*5)-CCSisDead;i++)
{
if(roll<interest_array[i])
return i;
}
return -1;
}
"Something else like that" might be this from recruit.cpp:
if(pool[p]->skill_check(SKILL_PERSUASION,difficulty))
{
success=1;
set_color(COLOR_CYAN,COLOR_BLACK,1);
r.level++;
r.eagerness1++;
move(y++,0);
addstr(r.recruit->name);
addstr(" found ");
addstr(pool[p]->name);
addstr("'s views to be insightful.");
move(y++,0);
addstr("They'll definitely meet again tomorrow.");
}
else if(pool[p]->skill_check(SKILL_PERSUASION,difficulty)) // Second chance to not fail horribly
{
r.level++;
r.eagerness1--;
move(y++,0);
addstr(r.recruit->name);
addstr(" is skeptical about some of ");
addstr(pool[p]->name);
addstr("'s arguments.");
move(y++,0);
addstr("They'll meet again tomorrow.");
}
There's no overflow containment on "r.level" and "r.eagerness". A success at 127 brings it down to -128. I want to change it to
if(r.level<127){r.level++;}
if(r.eagerness<127){r.eagerness++;}