13
0

Update triggerbox RNG API calls

This commit is contained in:
Robin Gareus 2021-08-15 16:04:08 +02:00
parent a3b28b4114
commit 55211b8dd6
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -989,7 +989,7 @@ TriggerBox::set_next_trigger (size_t current)
} }
int which_follow_action; int which_follow_action;
int r = _pcg.rand (0, 101); int r = _pcg.rand (100); // 0 .. 99
if (r <= all_triggers[current]->follow_action_probability()) { if (r <= all_triggers[current]->follow_action_probability()) {
which_follow_action = 0; which_follow_action = 0;
@ -1077,7 +1077,7 @@ TriggerBox::set_next_trigger (size_t current)
case Trigger::AnyTrigger: case Trigger::AnyTrigger:
while (true) { while (true) {
n = _pcg.rand (0, all_triggers.size() + 1); n = _pcg.rand (all_triggers.size());
if (!all_triggers[n]->region()) { if (!all_triggers[n]->region()) {
continue; continue;
} }
@ -1091,7 +1091,7 @@ TriggerBox::set_next_trigger (size_t current)
case Trigger::OtherTrigger: case Trigger::OtherTrigger:
while (true) { while (true) {
n = _pcg.rand (0, all_triggers.size() + 1); n = _pcg.rand (all_triggers.size());
if ((size_t) n == current) { if ((size_t) n == current) {
continue; continue;
} }