Codechange: Warn if randomaction2 group count is not a power of 2.
Previously noted by a comment, this does not need to be guarded against as non-powers of 2 will not cause issues beyond the choice of results being reduced.
(cherry picked from commit 18fb1c3866
)
This commit is contained in:

committed by
Jonathan G Rennison

parent
02a62e4c98
commit
0b4d45af93
@@ -5275,6 +5275,10 @@ static void NewSpriteGroup(ByteReader *buf)
|
|||||||
group->lowest_randbit = buf->ReadByte();
|
group->lowest_randbit = buf->ReadByte();
|
||||||
|
|
||||||
byte num_groups = buf->ReadByte();
|
byte num_groups = buf->ReadByte();
|
||||||
|
if (!HasExactlyOneBit(num_groups)) {
|
||||||
|
grfmsg(1, "NewSpriteGroup: Random Action 2 nrand should be power of 2");
|
||||||
|
}
|
||||||
|
|
||||||
for (uint i = 0; i < num_groups; i++) {
|
for (uint i = 0; i < num_groups; i++) {
|
||||||
group->groups.push_back(GetGroupFromGroupID(setid, type, buf->ReadWord()));
|
group->groups.push_back(GetGroupFromGroupID(setid, type, buf->ReadWord()));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user