Changeset - r15052:764ba7e4bb07
[Not reviewed]
master
0 1 0
yexo - 14 years ago 2010-04-20 19:25:29
yexo@openttd.org
(svn r19685) -Fix (r19679): off-by-one error
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -2073,25 +2073,25 @@ static ChangeInfoResult CargoChangeInfo(
 
}
 

	
 

	
 
static ChangeInfoResult SoundEffectChangeInfo(uint sid, int numinfo, int prop, ByteReader *buf)
 
{
 
	ChangeInfoResult ret = CIR_SUCCESS;
 

	
 
	if (_cur_grffile->sound_offset == 0) {
 
		grfmsg(1, "SoundEffectChangeInfo: No effects defined, skipping");
 
		return CIR_INVALID_ID;
 
	}
 

	
 
	if (sid + numinfo - ORIGINAL_SAMPLE_COUNT >= _cur_grffile->num_sounds) {
 
	if (sid + numinfo - ORIGINAL_SAMPLE_COUNT > _cur_grffile->num_sounds) {
 
		grfmsg(1, "SoundEffectChangeInfo: Attemting to change undefined sound effect (%u), max (%u). Ignoring.", sid + numinfo, ORIGINAL_SAMPLE_COUNT + _cur_grffile->num_sounds);
 
		return CIR_INVALID_ID;
 
	}
 

	
 
	for (int i = 0; i < numinfo; i++) {
 
		SoundEntry *sound = GetSound(sid + i + _cur_grffile->sound_offset - ORIGINAL_SAMPLE_COUNT);
 

	
 
		switch (prop) {
 
			case 0x08: // Relative volume
 
				sound->volume = buf->ReadByte();
 
				break;
 

	
0 comments (0 inline, 0 general)