mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r3520) Remove unused parameters from some functions
This commit is contained in:
parent
21fb5b5150
commit
b844aa2db3
|
@ -764,7 +764,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
|||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||
static void ClonePlaceObj(const Window* w)
|
||||
{
|
||||
const Vehicle* v = CheckMouseOverVehicle();
|
||||
|
||||
|
@ -810,7 +810,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
|||
break;
|
||||
|
||||
case WE_PLACE_OBJ: {
|
||||
ClonePlaceObj(e->place.tile, w);
|
||||
ClonePlaceObj(w);
|
||||
} break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ: {
|
||||
|
|
4
newgrf.c
4
newgrf.c
|
@ -2575,7 +2575,7 @@ static void CalculateRefitMasks(void)
|
|||
/* 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 @@ static void LoadNewGRFFile(const char* filename, uint file_index, uint stage)
|
|||
|
||||
if (type == 0xFF) {
|
||||
if (_skip_sprites == 0) {
|
||||
DecodeSpecialSprite(filename, num, stage);
|
||||
DecodeSpecialSprite(num, stage);
|
||||
continue;
|
||||
} else {
|
||||
FioSkipBytes(num);
|
||||
|
|
|
@ -204,7 +204,7 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
|||
} 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
|
||||
|
|
|
@ -670,7 +670,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
|||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||
static void ClonePlaceObj(const Window* w)
|
||||
{
|
||||
const Vehicle* v = CheckMouseOverVehicle();
|
||||
|
||||
|
@ -715,7 +715,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
|||
} break;
|
||||
|
||||
case WE_PLACE_OBJ: {
|
||||
ClonePlaceObj(e->place.tile, w);
|
||||
ClonePlaceObj(w);
|
||||
} break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ: {
|
||||
|
|
27
saveload.c
27
saveload.c
|
@ -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
|
||||
* @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 @@ static inline size_t SlCalcRefLen(void) {return 2;}
|
|||
|
||||
/**
|
||||
* 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 @@ void SlArray(void *array, uint length, VarType conv)
|
|||
|
||||
// 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 @@ void SlArray(void *array, uint length, VarType conv)
|
|||
|
||||
/**
|
||||
* 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 @@ static size_t SlCalcObjLength(void *object, const SaveLoad *sld)
|
|||
|
||||
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 @@ void SlObject(void *object, const SaveLoad *sld)
|
|||
{
|
||||
// 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 @@ static size_t SlCalcGlobListLength(const SaveLoadGlobVarList *desc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -748,7 +748,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
|||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||
static void ClonePlaceObj(const Window* w)
|
||||
{
|
||||
const Vehicle* v = CheckMouseOverVehicle();
|
||||
|
||||
|
@ -793,7 +793,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e)
|
|||
break;
|
||||
|
||||
case WE_PLACE_OBJ: {
|
||||
ClonePlaceObj(w->window_number, w);
|
||||
ClonePlaceObj(w);
|
||||
} break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ: {
|
||||
|
|
2
town.h
2
town.h
|
@ -128,7 +128,7 @@ enum {
|
|||
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;
|
||||
|
||||
|
|
22
town_cmd.c
22
town_cmd.c
|
@ -1118,7 +1118,7 @@ bool GenerateTowns(void)
|
|||
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 @@ int GetTownRadiusGroup(const Town *t, TileIndex tile)
|
|||
return smallest;
|
||||
}
|
||||
|
||||
static bool CheckFree2x2Area(Town *t1, TileIndex tile)
|
||||
static bool CheckFree2x2Area(TileIndex tile)
|
||||
{
|
||||
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] & 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 @@ static const int _default_rating_settings [3][3] = {
|
|||
{ 96, 384, 768}, // Hostile
|
||||
};
|
||||
|
||||
bool CheckforTownRating(TileIndex tile, uint32 flags, Town *t, byte type)
|
||||
bool CheckforTownRating(uint32 flags, Town *t, byte type)
|
||||
{
|
||||
int modemod;
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ static void HandleCloneVehClick(const Vehicle* v, const Window* w)
|
|||
ResetObjectToPlace();
|
||||
}
|
||||
|
||||
static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||
static void ClonePlaceObj(const Window* w)
|
||||
{
|
||||
Vehicle* v = CheckMouseOverVehicle();
|
||||
|
||||
|
@ -661,7 +661,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
|||
} break;
|
||||
|
||||
case WE_PLACE_OBJ: {
|
||||
ClonePlaceObj(e->place.tile, w);
|
||||
ClonePlaceObj(w);
|
||||
} break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ: {
|
||||
|
|
|
@ -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));
|
||||
byte m5;
|
||||
|
@ -78,7 +78,7 @@ static void DoPlaceMoreTrees(TileIndex tile)
|
|||
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 @@ void PlaceTreesRandomly(void)
|
|||
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 @@ void PlaceTreesRandomly(void)
|
|||
uint32 r = Random();
|
||||
TileIndex tile = RandomTileSeed(r);
|
||||
if (IsTileType(tile, MP_CLEAR) && GetMapExtraBits(tile) == 2) {
|
||||
PlaceTree(tile, r, 0);
|
||||
PlaceTree(tile, r);
|
||||
}
|
||||
} while (--i);
|
||||
}
|
||||
|
|
|
@ -663,7 +663,7 @@ static int32 DoClearTunnel(TileIndex tile, uint32 flags)
|
|||
// 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 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
|
|||
// 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) {
|
||||
|
|
Loading…
Reference in New Issue