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

add divide to COMPUTE_FLAG #2972

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/lvl_script_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,17 @@ void script_process_value(unsigned long var_index, unsigned long plr_range_id, l
if (operation == SOpr_INCREASE) computed = current_flag_val + sum;
else if (operation == SOpr_DECREASE) computed = current_flag_val - sum;
else if (operation == SOpr_MULTIPLY) computed = current_flag_val * sum;
else if (operation == SOpr_DIVIDE) computed = current_flag_val / sum;
else if (operation == SOpr_DIVIDE)
{
if(sum == 0)
{
WARNMSG("COMPUTE_FLAG tried to divide by 0.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a player creates this in a next_command_reusable, it will still crash the game, but with a 30 minute delay until the log file is too large.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a player creates this in a next_command_reusable, it will still crash the game, but with a 30 minute delay until the log file is too large.

so this need a check to deallocate the script value it so it shows only one time in the log?

return;
}

computed = current_flag_val / sum;
}

SCRIPTDBG(7,"Changing player%d's %d flag from %d to %d based on flag of type %d.", i, val3, current_flag_val, computed, src_flag_type);
set_variable(i, flag_type, val3, computed);
}
Expand Down