Avoid calling rn2(0) when the first room(s) have frequency 0
This probably won't happen in practice, but it is a good safeguard if this ever does happen (it happened for me in debugging when I wished to have no "regular" rooms and only generate themed rooms).
This commit is contained in:
committed by
Pasi Kallinen
parent
999222a8a4
commit
3d4ba4d666
@@ -576,7 +576,8 @@ function themerooms_generate()
|
||||
this_frequency = 1;
|
||||
end
|
||||
total_frequency = total_frequency + this_frequency;
|
||||
if (nh.rn2(total_frequency) < this_frequency) then
|
||||
-- avoid rn2(0) if a room has freq 0
|
||||
if this_frequency > 0 and nh.rn2(total_frequency) < this_frequency then
|
||||
pick = i;
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user