(svn r3520) Remove unused parameters from some functions
authortron
Thu, 02 Feb 2006 07:15:46 +0000
changeset 2958 3f8946daf55f
parent 2957 2bbb4add3410
child 2959 940962dab788
(svn r3520) Remove unused parameters from some functions
aircraft_gui.c
newgrf.c
road_cmd.c
roadveh_gui.c
saveload.c
ship_gui.c
town.h
town_cmd.c
train_gui.c
tree_cmd.c
tunnelbridge_cmd.c
--- a/aircraft_gui.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/aircraft_gui.c	Thu Feb 02 07:15:46 2006 +0000
@@ -764,7 +764,7 @@
 	ResetObjectToPlace();
 }
 
-static void ClonePlaceObj(TileIndex tile, const Window* w)
+static void ClonePlaceObj(const Window* w)
 {
 	const Vehicle* v = CheckMouseOverVehicle();
 
@@ -810,7 +810,7 @@
 		break;
 
 	case WE_PLACE_OBJ: {
-		ClonePlaceObj(e->place.tile, w);
+		ClonePlaceObj(w);
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
--- a/newgrf.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/newgrf.c	Thu Feb 02 07:15:46 2006 +0000
@@ -2575,7 +2575,7 @@
 /* XXX: We consider GRF files trusted. It would be trivial to exploit OTTD by
  * a crafted invalid GRF file. We should tell that to the user somehow, or
  * better make this more robust in the future. */
-static void DecodeSpecialSprite(const char* filename, uint num, uint stage)
+static void DecodeSpecialSprite(uint num, uint stage)
 {
 	/* XXX: There is a difference between staged loading in TTDPatch and
 	 * here.  In TTDPatch, for some reason actions 1 and 2 are carried out
@@ -2671,7 +2671,7 @@
 
 		if (type == 0xFF) {
 			if (_skip_sprites == 0) {
-				DecodeSpecialSprite(filename, num, stage);
+				DecodeSpecialSprite(num, stage);
 				continue;
 			} else {
 				FioSkipBytes(num);
--- a/road_cmd.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/road_cmd.c	Thu Feb 02 07:15:46 2006 +0000
@@ -204,7 +204,7 @@
 	} else if (ti.type == MP_STREET) {
 		// check if you're allowed to remove the street owned by a town
 		// removal allowance depends on difficulty setting
-		if (!CheckforTownRating(tile, flags, t, ROAD_REMOVE)) return CMD_ERROR;
+		if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR;
 
 		// XXX - change cascading ifs to switch when doing rewrite
 		if ((ti.map5 & 0xF0) == 0) { // normal road
--- a/roadveh_gui.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/roadveh_gui.c	Thu Feb 02 07:15:46 2006 +0000
@@ -670,7 +670,7 @@
 	ResetObjectToPlace();
 }
 
-static void ClonePlaceObj(TileIndex tile, const Window* w)
+static void ClonePlaceObj(const Window* w)
 {
 	const Vehicle* v = CheckMouseOverVehicle();
 
@@ -715,7 +715,7 @@
 	} break;
 
 	case WE_PLACE_OBJ: {
-		ClonePlaceObj(e->place.tile, w);
+		ClonePlaceObj(w);
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
--- a/saveload.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/saveload.c	Thu Feb 02 07:15:46 2006 +0000
@@ -445,11 +445,13 @@
 
 /**
  * Return the size in bytes of a certain type of normal/atomic variable
- * @param var The variable the size is being asked of (NOTICE: unused)
  * @param conv @VarType type of variable that is used for calculating the size
  * @return Return the size of this type in byes
  */
-static inline size_t SlCalcConvLen(const void *var, VarType conv) {return _conv_lengths[conv & 0xF];}
+static inline size_t SlCalcConvLen(VarType conv)
+{
+	return _conv_lengths[conv & 0xF];
+}
 
 /**
  * Return the size in bytes of a reference (pointer)
@@ -458,11 +460,13 @@
 
 /**
  * Return the size in bytes of a certain type of atomic array
- * @param array The variable the size is being asked of (NOTICE: unused)
  * @param length The length of the array counted in elements
  * @param conv @VarType type of the variable that is used in calculating the size
  */
-static inline size_t SlCalcArrayLen(const void *array, uint length, VarType conv) {return _conv_lengths[conv & 0xF] * length;}
+static inline size_t SlCalcArrayLen(uint length, VarType conv)
+{
+	return _conv_lengths[conv & 0xF] * length;
+}
 
 /**
  * Save/Load an array.
@@ -476,7 +480,7 @@
 
 	// Automatically calculate the length?
 	if (_sl.need_length != NL_NONE) {
-		SlSetLength(SlCalcArrayLen(array, length, conv));
+		SlSetLength(SlCalcArrayLen(length, conv));
 		// Determine length only?
 		if (_sl.need_length == NL_CALCLENGTH)
 			return;
@@ -509,10 +513,9 @@
 
 /**
  * Calculate the size of an object.
- * @param object Object that needs its length calculated
  * @param sld The @SaveLoad description of the object so we know how to manipulate it
  */
-static size_t SlCalcObjLength(void *object, const SaveLoad *sld)
+static size_t SlCalcObjLength(const SaveLoad *sld)
 {
 	size_t length = 0;
 
@@ -527,17 +530,17 @@
 
 			switch (sld->cmd) {
 			case SL_VAR: case SL_CONDVAR: /* Normal Variable */
-				length += SlCalcConvLen(NULL, sld->type); break;
+				length += SlCalcConvLen(sld->type); break;
 			case SL_REF: case SL_CONDREF:  /* Reference variable */
 				length += SlCalcRefLen(); break;
 			case SL_ARR: case SL_CONDARR: /* Array */
-				length += SlCalcArrayLen(NULL, sld->length, sld->type); break;
+				length += SlCalcArrayLen(sld->length, sld->type); break;
 			default: NOT_REACHED();
 			}
 		} else if (sld->cmd == SL_WRITEBYTE) {
 			length++; // a byte is logically of size 1
 		} else if (sld->cmd == SL_INCLUDE) {
-			length += SlCalcObjLength(NULL, _sl.includes[sld->version_from]);
+			length += SlCalcObjLength(_sl.includes[sld->version_from]);
 		} else
 			assert(sld->cmd == SL_END);
 	}
@@ -553,7 +556,7 @@
 {
 	// Automatically calculate the length?
 	if (_sl.need_length != NL_NONE) {
-		SlSetLength(SlCalcObjLength(object, sld));
+		SlSetLength(SlCalcObjLength(sld));
 		if (_sl.need_length == NL_CALCLENGTH)
 			return;
 	}
@@ -615,7 +618,7 @@
 	for (; desc->address != NULL; desc++) {
 		// Of course the global variable must exist in the sought savegame version
 		if (_sl_version >= desc->from_version && _sl_version <= desc->to_version)
-			length += SlCalcConvLen(NULL, desc->conv);
+			length += SlCalcConvLen(desc->conv);
 	}
 	return length;
 }
--- a/ship_gui.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/ship_gui.c	Thu Feb 02 07:15:46 2006 +0000
@@ -748,7 +748,7 @@
 	ResetObjectToPlace();
 }
 
-static void ClonePlaceObj(TileIndex tile, const Window* w)
+static void ClonePlaceObj(const Window* w)
 {
 	const Vehicle* v = CheckMouseOverVehicle();
 
@@ -793,7 +793,7 @@
 		break;
 
 	case WE_PLACE_OBJ: {
-		ClonePlaceObj(w->window_number, w);
+		ClonePlaceObj(w);
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
--- a/town.h	Wed Feb 01 19:53:17 2006 +0000
+++ b/town.h	Thu Feb 02 07:15:46 2006 +0000
@@ -128,7 +128,7 @@
 	RATING_BRIBE_DOWN_TO = -50 					// XXX SHOULD BE SOMETHING LOWER?
 };
 
-bool CheckforTownRating(TileIndex tile, uint32 flags, Town *t, byte type);
+bool CheckforTownRating(uint32 flags, Town *t, byte type);
 
 VARDEF uint16 *_town_sort;
 
--- a/town_cmd.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/town_cmd.c	Thu Feb 02 07:15:46 2006 +0000
@@ -1118,7 +1118,7 @@
 	return true;
 }
 
-static bool CheckBuildHouseMode(Town *t1, TileIndex tile, uint tileh, int mode)
+static bool CheckBuildHouseMode(TileIndex tile, uint tileh, int mode)
 {
 	int b;
 	uint slope;
@@ -1159,7 +1159,7 @@
 	return smallest;
 }
 
-static bool CheckFree2x2Area(Town *t1, TileIndex tile)
+static bool CheckFree2x2Area(TileIndex tile)
 {
 	int i;
 
@@ -1248,24 +1248,24 @@
 			if (_housetype_extra_flags[house] & 0x12 && slope) continue;
 
 			if (_housetype_extra_flags[house] & 0x10) {
-				if (CheckFree2x2Area(t, tile) ||
-						CheckFree2x2Area(t, (tile += TileDiffXY(-1,  0))) ||
-						CheckFree2x2Area(t, (tile += TileDiffXY( 0, -1))) ||
-						CheckFree2x2Area(t, (tile += TileDiffXY( 1,  0)))) {
+				if (CheckFree2x2Area(tile) ||
+						CheckFree2x2Area(tile += TileDiffXY(-1,  0)) ||
+						CheckFree2x2Area(tile += TileDiffXY( 0, -1)) ||
+						CheckFree2x2Area(tile += TileDiffXY( 1,  0))) {
 					break;
 				}
 				tile += TileDiffXY(0, 1);
 			} else if (_housetype_extra_flags[house] & 4) {
-				if (CheckBuildHouseMode(t, tile + TileDiffXY(1, 0), slope, 0)) break;
+				if (CheckBuildHouseMode(tile + TileDiffXY(1, 0), slope, 0)) break;
 
-				if (CheckBuildHouseMode(t, tile + TileDiffXY(-1, 0), slope, 1)) {
+				if (CheckBuildHouseMode(tile + TileDiffXY(-1, 0), slope, 1)) {
 					tile += TileDiffXY(-1, 0);
 					break;
 				}
 			} else if (_housetype_extra_flags[house] & 8) {
-				if (CheckBuildHouseMode(t, tile + TileDiffXY(0, 1), slope, 2)) break;
+				if (CheckBuildHouseMode(tile + TileDiffXY(0, 1), slope, 2)) break;
 
-				if (CheckBuildHouseMode(t, tile + TileDiffXY(0, -1), slope, 3)) {
+				if (CheckBuildHouseMode(tile + TileDiffXY(0, -1), slope, 3)) {
 					tile += TileDiffXY(0, -1);
 					break;
 				}
@@ -1886,7 +1886,7 @@
 	{ 96, 384, 768},	// Hostile
 };
 
-bool CheckforTownRating(TileIndex tile, uint32 flags, Town *t, byte type)
+bool CheckforTownRating(uint32 flags, Town *t, byte type)
 {
 	int modemod;
 
--- a/train_gui.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/train_gui.c	Thu Feb 02 07:15:46 2006 +0000
@@ -618,7 +618,7 @@
 	ResetObjectToPlace();
 }
 
-static void ClonePlaceObj(TileIndex tile, const Window* w)
+static void ClonePlaceObj(const Window* w)
 {
 	Vehicle* v = CheckMouseOverVehicle();
 
@@ -661,7 +661,7 @@
  	} break;
 
 	case WE_PLACE_OBJ: {
-		ClonePlaceObj(e->place.tile, w);
+		ClonePlaceObj(w);
 	} break;
 
 	case WE_ABORT_PLACE_OBJ: {
--- a/tree_cmd.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/tree_cmd.c	Thu Feb 02 07:15:46 2006 +0000
@@ -36,7 +36,7 @@
 	}
 }
 
-static void PlaceTree(TileIndex tile, uint32 r, byte m5_or)
+static void PlaceTree(TileIndex tile, uint32 r)
 {
 	int tree = GetRandomTreeType(tile, GB(r, 24, 8));
 	byte m5;
@@ -78,7 +78,7 @@
 				IsTileType(cur_tile, MP_CLEAR) &&
 				!IsClearGround(cur_tile, CL_FIELDS) &&
 				!IsClearGround(cur_tile, CL_ROCKS)) {
-			PlaceTree(cur_tile, r, dist <= 6 ? 0xC0 : 0);
+			PlaceTree(cur_tile, r);
 		}
 	}
 }
@@ -102,7 +102,7 @@
 		if (IsTileType(tile, MP_CLEAR) &&
 				!IsClearGround(tile, CL_FIELDS) &&
 				!IsClearGround(tile, CL_ROCKS)) {
-			PlaceTree(tile, r, 0);
+			PlaceTree(tile, r);
 		}
 	} while (--i);
 
@@ -114,7 +114,7 @@
 			uint32 r = Random();
 			TileIndex tile = RandomTileSeed(r);
 			if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) {
-				PlaceTree(tile, r, 0);
+				PlaceTree(tile, r);
 			}
 		} while (--i);
 	}
--- a/tunnelbridge_cmd.c	Wed Feb 01 19:53:17 2006 +0000
+++ b/tunnelbridge_cmd.c	Thu Feb 02 07:15:46 2006 +0000
@@ -663,7 +663,7 @@
 	// check if you're allowed to remove the tunnel owned by a town
 	// removal allowal depends on difficulty settings
 	if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) {
-		if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE)) {
+		if (!CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE)) {
 			SetDParam(0, t->index);
 			return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
 		}
@@ -788,8 +788,7 @@
 	// check if you're allowed to remove the bridge owned by a town.
 	// removal allowal depends on difficulty settings
 	if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) {
-		if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE))
-			return CMD_ERROR;
+		if (!CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE)) return CMD_ERROR;
 	}
 
 	if (flags & DC_EXEC) {