Changeset - r25357:abee1c047419
[Not reviewed]
master
0 1 0
Peter Nelson - 3 years ago 2021-05-01 23:34:17
peter1138@openttd.org
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.
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -5130,6 +5130,10 @@ static void NewSpriteGroup(ByteReader *b
 
			group->lowest_randbit = 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++) {
 
				group->groups.push_back(GetGroupFromGroupID(setid, type, buf->ReadWord()));
 
			}
0 comments (0 inline, 0 general)