src/newgrf_engine.cpp
branchcustombridgeheads
changeset 5650 aefc131bf5ce
parent 5649 55c8267c933f
child 5852 cb3f71b16e1a
--- a/src/newgrf_engine.cpp	Thu Jan 11 13:41:16 2007 +0000
+++ b/src/newgrf_engine.cpp	Mon Jan 15 20:14:06 2007 +0000
@@ -17,6 +17,7 @@
 #include "newgrf_spritegroup.h"
 #include "newgrf_cargo.h"
 #include "date.h"
+#include "helpers.hpp"
 
 
 
@@ -82,8 +83,7 @@
 
 	wos = &_engine_wagon_overrides[engine];
 	wos->overrides_count++;
-	wos->overrides = realloc(wos->overrides,
-		wos->overrides_count * sizeof(*wos->overrides));
+	ReallocT(&wos->overrides, wos->overrides_count);
 
 	wo = &wos->overrides[wos->overrides_count - 1];
 	/* FIXME: If we are replacing an override, release original SpriteGroup
@@ -92,7 +92,7 @@
 	wo->group = group;
 	wo->cargo = cargo;
 	wo->trains = trains;
-	wo->train_id = malloc(trains);
+	MallocT(&wo->train_id, trains);
 	memcpy(wo->train_id, train_id, trains);
 }
 
@@ -563,7 +563,7 @@
 		}
 
 		*available = false;
-		return -1;
+		return UINT_MAX;
 	}
 
 	/* Calculated vehicle parameters */
@@ -628,7 +628,7 @@
 			return v->owner;
 
 		case 0x44: /* Aircraft information */
-			if (v->type != VEH_Aircraft) return -1;
+			if (v->type != VEH_Aircraft) return UINT_MAX;
 
 			{
 				const Vehicle *w = v->next;
@@ -806,7 +806,7 @@
 	DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, v->type);
 
 	*available = false;
-	return -1;
+	return UINT_MAX;
 }