(svn r939) -Fix: Fixed compiler errors
authortruelight
Sat, 04 Dec 2004 15:02:45 +0000
changeset 542 2f35c4770b06
parent 541 e1cd34389f79
child 543 e3b43338096b
(svn r939) -Fix: Fixed compiler errors
engine.c
newgrf.c
--- a/engine.c	Sat Dec 04 09:26:39 2004 +0000
+++ b/engine.c	Sat Dec 04 15:02:45 2004 +0000
@@ -545,8 +545,9 @@
 		rsg = TriggerVehicleSpriteGroup(&_engine_custom_sprites[veh->engine_type][29], veh,
 						(resolve_callback) TriggerVehicleSpriteGroup);
 	}
+	new_random_bits = Random();
 	veh->random_bits &= ~_vsg_bits_to_reseed;
-	veh->random_bits |= (first ? (new_random_bits = Random()) : base_random_bits) & _vsg_bits_to_reseed;
+	veh->random_bits |= (first ? new_random_bits : base_random_bits) & _vsg_bits_to_reseed;
 
 	switch (trigger) {
 		case VEHICLE_TRIGGER_NEW_CARGO:
--- a/newgrf.c	Sat Dec 04 09:26:39 2004 +0000
+++ b/newgrf.c	Sat Dec 04 15:02:45 2004 +0000
@@ -855,6 +855,7 @@
 						stat->platforms[l] = number;
 					}
 
+					p = 0;
 					layout = malloc(length * number);
 					for (l = 0; l < length; l++)
 						for (p = 0; p < number; p++)
@@ -862,6 +863,7 @@
 
 					l--;
 					p--;
+					assert(p >= 0);
 					free(stat->layouts[l][p]);
 					stat->layouts[l][p] = layout;
 				}
@@ -949,7 +951,7 @@
 	uint8 numprops;
 	uint8 numinfo;
 	byte engine;
-	EngineInfo *ei;
+	EngineInfo *ei = NULL;
 
 	if (len == 1) {
 		DEBUG(grf, 8) ("Silently ignoring one-byte special sprite 0x00.");
@@ -972,6 +974,8 @@
 
 	if (feature != GSF_STATION)
 		ei = &_engine_info[engine + _vehshifts[feature]];
+	/* XXX - Should there not be a check to see if 'ei' is NULL
+	    when it is used in the switch below?? -- TrueLight */
 
 	buf += 5;