flood_lmax = autocvar_g_chat_flood_lmax;
flood_field = floodcontrol_chat;
}
+ // to match cvar descriptions, a value of 3 must allow three-line bursts and not four!
flood_burst = max(0, flood_burst - 1);
- // to match explanation in default.cfg, a value of 3 must allow three-line bursts and not four!
+ int lines = -1;
mod_time = gettime(GETTIME_FRAMESTART) + flood_burst * flood_spl;
// do flood control for the default line size
if(msgstr != "")
{
getWrappedLine_remaining = msgstr;
msgstr = "";
- int lines = 0;
+ lines = 0;
while(getWrappedLine_remaining && (!flood_lmax || lines <= flood_lmax))
{
msgstr = strcat(msgstr, " ", getWrappedLineLen(82.4289758859709, strlennocol)); // perl averagewidth.pl < gfx/vera-sans.width
msgstr = strcat(msgstr, "\n");
flood = 2;
}
+ }
- if (mod_time >= source.(flood_field))
- {
- source.(flood_field) = max(gettime(GETTIME_FRAMESTART), source.(flood_field)) + lines * flood_spl;
- }
- else
- {
- flood = 1;
- msgstr = fullmsgstr;
- }
+ if (mod_time >= source.(flood_field))
+ {
+ if (lines > 1)
+ flood_spl *= lines;
+ source.(flood_field) = max(gettime(GETTIME_FRAMESTART), source.(flood_field)) + flood_spl;
}
else
{
- if (mod_time >= source.(flood_field))
- source.(flood_field) = max(gettime(GETTIME_FRAMESTART), source.(flood_field)) + flood_spl;
- else
- flood = 1;
+ if (lines >= 0) // if true msgstr was modified
+ msgstr = fullmsgstr;
+ flood = 1;
}
}