Changeset - r3614:29226732c21c
[Not reviewed]
master
0 2 0
peter1138 - 18 years ago 2006-04-21 20:59:04
peter1138@openttd.org
(svn r4510) - NewGRF bounds checking:
- check Engine ID is within range
- don't try setting a vehicle name if the string id is not a valid Engine ID
2 files changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
newgrf.c
Show inline comments
 
@@ -1761,9 +1761,11 @@ static void VehicleNewName(byte *buf, in
 
				case GSF_TRAIN:
 
				case GSF_ROAD:
 
				case GSF_SHIP:
 
				case GSF_AIRCRAFT:
 
					SetCustomEngineName(id, AddGRFString(_cur_grffile->grfid, id, lang, name));
 
				case GSF_AIRCRAFT: {
 
					StringID string = AddGRFString(_cur_grffile->grfid, id, lang, name);
 
					if (id < TOTAL_NUM_ENGINES) SetCustomEngineName(id, string);
 
					break;
 
				}
 

	
 
#if 0
 
				case GSF_STATION:
newgrf_engine.c
Show inline comments
 
@@ -102,6 +102,7 @@ static SpriteGroup *engine_custom_sprite
 

	
 
void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group)
 
{
 
	assert(engine < TOTAL_NUM_ENGINES);
 
	if (engine_custom_sprites[engine][cargo] != NULL) {
 
		DEBUG(grf, 6)("SetCustomEngineSprites: engine `%d' cargo `%d' already has group -- replacing.", engine, cargo);
 
	}
 
@@ -610,6 +611,7 @@ StringID _engine_custom_names[TOTAL_NUM_
 

	
 
void SetCustomEngineName(EngineID engine, StringID name)
 
{
 
	assert(engine < lengthof(_engine_custom_names));
 
	_engine_custom_names[engine] = name;
 
}
 

	
0 comments (0 inline, 0 general)