1
0
Fork 0

(svn r3520) Remove unused parameters from some functions

release/0.5
tron 2006-02-02 07:15:46 +00:00
parent 21fb5b5150
commit b844aa2db3
11 changed files with 44 additions and 42 deletions

View File

@ -764,7 +764,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
ResetObjectToPlace(); ResetObjectToPlace();
} }
static void ClonePlaceObj(TileIndex tile, const Window* w) static void ClonePlaceObj(const Window* w)
{ {
const Vehicle* v = CheckMouseOverVehicle(); const Vehicle* v = CheckMouseOverVehicle();
@ -810,7 +810,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
break; break;
case WE_PLACE_OBJ: { case WE_PLACE_OBJ: {
ClonePlaceObj(e->place.tile, w); ClonePlaceObj(w);
} break; } break;
case WE_ABORT_PLACE_OBJ: { case WE_ABORT_PLACE_OBJ: {

View File

@ -2575,7 +2575,7 @@ static void CalculateRefitMasks(void)
/* XXX: We consider GRF files trusted. It would be trivial to exploit OTTD by /* 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 * a crafted invalid GRF file. We should tell that to the user somehow, or
* better make this more robust in the future. */ * 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 /* XXX: There is a difference between staged loading in TTDPatch and
* here. In TTDPatch, for some reason actions 1 and 2 are carried out * here. In TTDPatch, for some reason actions 1 and 2 are carried out
@ -2671,7 +2671,7 @@ static void LoadNewGRFFile(const char* filename, uint file_index, uint stage)
if (type == 0xFF) { if (type == 0xFF) {
if (_skip_sprites == 0) { if (_skip_sprites == 0) {
DecodeSpecialSprite(filename, num, stage); DecodeSpecialSprite(num, stage);
continue; continue;
} else { } else {
FioSkipBytes(num); FioSkipBytes(num);

View File

@ -204,7 +204,7 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
} else if (ti.type == MP_STREET) { } else if (ti.type == MP_STREET) {
// check if you're allowed to remove the street owned by a town // check if you're allowed to remove the street owned by a town
// removal allowance depends on difficulty setting // 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 // XXX - change cascading ifs to switch when doing rewrite
if ((ti.map5 & 0xF0) == 0) { // normal road if ((ti.map5 & 0xF0) == 0) { // normal road

View File

@ -670,7 +670,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
ResetObjectToPlace(); ResetObjectToPlace();
} }
static void ClonePlaceObj(TileIndex tile, const Window* w) static void ClonePlaceObj(const Window* w)
{ {
const Vehicle* v = CheckMouseOverVehicle(); const Vehicle* v = CheckMouseOverVehicle();
@ -715,7 +715,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
} break; } break;
case WE_PLACE_OBJ: { case WE_PLACE_OBJ: {
ClonePlaceObj(e->place.tile, w); ClonePlaceObj(w);
} break; } break;
case WE_ABORT_PLACE_OBJ: { case WE_ABORT_PLACE_OBJ: {

View File

@ -445,11 +445,13 @@ static const byte _conv_lengths[] = {1, 1, 2, 2, 4, 4, 8, 8, 2};
/** /**
* Return the size in bytes of a certain type of normal/atomic variable * 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 * @param conv @VarType type of variable that is used for calculating the size
* @return Return the size of this type in byes * @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) * Return the size in bytes of a reference (pointer)
@ -458,11 +460,13 @@ static inline size_t SlCalcRefLen(void) {return 2;}
/** /**
* Return the size in bytes of a certain type of atomic array * 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 length The length of the array counted in elements
* @param conv @VarType type of the variable that is used in calculating the size * @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. * Save/Load an array.
@ -476,7 +480,7 @@ void SlArray(void *array, uint length, VarType conv)
// Automatically calculate the length? // Automatically calculate the length?
if (_sl.need_length != NL_NONE) { if (_sl.need_length != NL_NONE) {
SlSetLength(SlCalcArrayLen(array, length, conv)); SlSetLength(SlCalcArrayLen(length, conv));
// Determine length only? // Determine length only?
if (_sl.need_length == NL_CALCLENGTH) if (_sl.need_length == NL_CALCLENGTH)
return; return;
@ -509,10 +513,9 @@ void SlArray(void *array, uint length, VarType conv)
/** /**
* Calculate the size of an object. * 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 * @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; size_t length = 0;
@ -527,17 +530,17 @@ static size_t SlCalcObjLength(void *object, const SaveLoad *sld)
switch (sld->cmd) { switch (sld->cmd) {
case SL_VAR: case SL_CONDVAR: /* Normal Variable */ 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 */ case SL_REF: case SL_CONDREF: /* Reference variable */
length += SlCalcRefLen(); break; length += SlCalcRefLen(); break;
case SL_ARR: case SL_CONDARR: /* Array */ 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(); default: NOT_REACHED();
} }
} else if (sld->cmd == SL_WRITEBYTE) { } else if (sld->cmd == SL_WRITEBYTE) {
length++; // a byte is logically of size 1 length++; // a byte is logically of size 1
} else if (sld->cmd == SL_INCLUDE) { } else if (sld->cmd == SL_INCLUDE) {
length += SlCalcObjLength(NULL, _sl.includes[sld->version_from]); length += SlCalcObjLength(_sl.includes[sld->version_from]);
} else } else
assert(sld->cmd == SL_END); assert(sld->cmd == SL_END);
} }
@ -553,7 +556,7 @@ void SlObject(void *object, const SaveLoad *sld)
{ {
// Automatically calculate the length? // Automatically calculate the length?
if (_sl.need_length != NL_NONE) { if (_sl.need_length != NL_NONE) {
SlSetLength(SlCalcObjLength(object, sld)); SlSetLength(SlCalcObjLength(sld));
if (_sl.need_length == NL_CALCLENGTH) if (_sl.need_length == NL_CALCLENGTH)
return; return;
} }
@ -615,7 +618,7 @@ static size_t SlCalcGlobListLength(const SaveLoadGlobVarList *desc)
for (; desc->address != NULL; desc++) { for (; desc->address != NULL; desc++) {
// Of course the global variable must exist in the sought savegame version // Of course the global variable must exist in the sought savegame version
if (_sl_version >= desc->from_version && _sl_version <= desc->to_version) if (_sl_version >= desc->from_version && _sl_version <= desc->to_version)
length += SlCalcConvLen(NULL, desc->conv); length += SlCalcConvLen(desc->conv);
} }
return length; return length;
} }

View File

@ -748,7 +748,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
ResetObjectToPlace(); ResetObjectToPlace();
} }
static void ClonePlaceObj(TileIndex tile, const Window* w) static void ClonePlaceObj(const Window* w)
{ {
const Vehicle* v = CheckMouseOverVehicle(); const Vehicle* v = CheckMouseOverVehicle();
@ -793,7 +793,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e)
break; break;
case WE_PLACE_OBJ: { case WE_PLACE_OBJ: {
ClonePlaceObj(w->window_number, w); ClonePlaceObj(w);
} break; } break;
case WE_ABORT_PLACE_OBJ: { case WE_ABORT_PLACE_OBJ: {

2
town.h
View File

@ -128,7 +128,7 @@ enum {
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? 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; VARDEF uint16 *_town_sort;

View File

@ -1118,7 +1118,7 @@ bool GenerateTowns(void)
return true; return true;
} }
static bool CheckBuildHouseMode(Town *t1, TileIndex tile, uint tileh, int mode) static bool CheckBuildHouseMode(TileIndex tile, uint tileh, int mode)
{ {
int b; int b;
uint slope; uint slope;
@ -1159,7 +1159,7 @@ int GetTownRadiusGroup(const Town *t, TileIndex tile)
return smallest; return smallest;
} }
static bool CheckFree2x2Area(Town *t1, TileIndex tile) static bool CheckFree2x2Area(TileIndex tile)
{ {
int i; int i;
@ -1248,24 +1248,24 @@ static void DoBuildTownHouse(Town *t, TileIndex tile)
if (_housetype_extra_flags[house] & 0x12 && slope) continue; if (_housetype_extra_flags[house] & 0x12 && slope) continue;
if (_housetype_extra_flags[house] & 0x10) { if (_housetype_extra_flags[house] & 0x10) {
if (CheckFree2x2Area(t, tile) || if (CheckFree2x2Area(tile) ||
CheckFree2x2Area(t, (tile += TileDiffXY(-1, 0))) || CheckFree2x2Area(tile += TileDiffXY(-1, 0)) ||
CheckFree2x2Area(t, (tile += TileDiffXY( 0, -1))) || CheckFree2x2Area(tile += TileDiffXY( 0, -1)) ||
CheckFree2x2Area(t, (tile += TileDiffXY( 1, 0)))) { CheckFree2x2Area(tile += TileDiffXY( 1, 0))) {
break; break;
} }
tile += TileDiffXY(0, 1); tile += TileDiffXY(0, 1);
} else if (_housetype_extra_flags[house] & 4) { } 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); tile += TileDiffXY(-1, 0);
break; break;
} }
} else if (_housetype_extra_flags[house] & 8) { } 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); tile += TileDiffXY(0, -1);
break; break;
} }
@ -1886,7 +1886,7 @@ static const int _default_rating_settings [3][3] = {
{ 96, 384, 768}, // Hostile { 96, 384, 768}, // Hostile
}; };
bool CheckforTownRating(TileIndex tile, uint32 flags, Town *t, byte type) bool CheckforTownRating(uint32 flags, Town *t, byte type)
{ {
int modemod; int modemod;

View File

@ -618,7 +618,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
ResetObjectToPlace(); ResetObjectToPlace();
} }
static void ClonePlaceObj(TileIndex tile, const Window* w) static void ClonePlaceObj(const Window* w)
{ {
Vehicle* v = CheckMouseOverVehicle(); Vehicle* v = CheckMouseOverVehicle();
@ -661,7 +661,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
} break; } break;
case WE_PLACE_OBJ: { case WE_PLACE_OBJ: {
ClonePlaceObj(e->place.tile, w); ClonePlaceObj(w);
} break; } break;
case WE_ABORT_PLACE_OBJ: { case WE_ABORT_PLACE_OBJ: {

View File

@ -36,7 +36,7 @@ static int GetRandomTreeType(TileIndex tile, uint seed)
} }
} }
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)); int tree = GetRandomTreeType(tile, GB(r, 24, 8));
byte m5; byte m5;
@ -78,7 +78,7 @@ static void DoPlaceMoreTrees(TileIndex tile)
IsTileType(cur_tile, MP_CLEAR) && IsTileType(cur_tile, MP_CLEAR) &&
!IsClearGround(cur_tile, CL_FIELDS) && !IsClearGround(cur_tile, CL_FIELDS) &&
!IsClearGround(cur_tile, CL_ROCKS)) { !IsClearGround(cur_tile, CL_ROCKS)) {
PlaceTree(cur_tile, r, dist <= 6 ? 0xC0 : 0); PlaceTree(cur_tile, r);
} }
} }
} }
@ -102,7 +102,7 @@ void PlaceTreesRandomly(void)
if (IsTileType(tile, MP_CLEAR) && if (IsTileType(tile, MP_CLEAR) &&
!IsClearGround(tile, CL_FIELDS) && !IsClearGround(tile, CL_FIELDS) &&
!IsClearGround(tile, CL_ROCKS)) { !IsClearGround(tile, CL_ROCKS)) {
PlaceTree(tile, r, 0); PlaceTree(tile, r);
} }
} while (--i); } while (--i);
@ -114,7 +114,7 @@ void PlaceTreesRandomly(void)
uint32 r = Random(); uint32 r = Random();
TileIndex tile = RandomTileSeed(r); TileIndex tile = RandomTileSeed(r);
if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) { if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) {
PlaceTree(tile, r, 0); PlaceTree(tile, r);
} }
} while (--i); } while (--i);
} }

View File

@ -663,7 +663,7 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags)
// check if you're allowed to remove the tunnel owned by a town // check if you're allowed to remove the tunnel owned by a town
// removal allowal depends on difficulty settings // removal allowal depends on difficulty settings
if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) { 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); SetDParam(0, t->index);
return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES); return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
} }
@ -788,8 +788,7 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
// check if you're allowed to remove the bridge owned by a town. // check if you're allowed to remove the bridge owned by a town.
// removal allowal depends on difficulty settings // removal allowal depends on difficulty settings
if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) { if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR) {
if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE)) if (!CheckforTownRating(flags, t, TUNNELBRIDGE_REMOVE)) return CMD_ERROR;
return CMD_ERROR;
} }
if (flags & DC_EXEC) { if (flags & DC_EXEC) {