mirror of https://github.com/OpenTTD/OpenTTD
(svn r14501) -Codechange: use sizeof(variable) instead of sizeof(type) or hardcoded amounts (magic constant) for memset (Alberth)
parent
122ce41f78
commit
9df75b3f9e
|
@ -425,7 +425,7 @@ static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *c
|
||||||
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
|
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
|
||||||
int w, int h, int rad)
|
int w, int h, int rad)
|
||||||
{
|
{
|
||||||
memset(produced, 0, sizeof(AcceptedCargo));
|
memset(produced, 0, sizeof(produced));
|
||||||
|
|
||||||
int x = TileX(tile);
|
int x = TileX(tile);
|
||||||
int y = TileY(tile);
|
int y = TileY(tile);
|
||||||
|
@ -451,7 +451,7 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
|
||||||
GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
|
GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
|
||||||
if (gpc != NULL) {
|
if (gpc != NULL) {
|
||||||
CargoID cargos[256]; // Required for CBID_HOUSE_PRODUCE_CARGO.
|
CargoID cargos[256]; // Required for CBID_HOUSE_PRODUCE_CARGO.
|
||||||
memset(cargos, CT_INVALID, 256);
|
memset(cargos, CT_INVALID, sizeof(cargos));
|
||||||
|
|
||||||
gpc(tile, cargos);
|
gpc(tile, cargos);
|
||||||
for (uint i = 0; i < lengthof(cargos); ++i) {
|
for (uint i = 0; i < lengthof(cargos); ++i) {
|
||||||
|
@ -474,7 +474,7 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
|
||||||
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile,
|
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile,
|
||||||
int w, int h, int rad)
|
int w, int h, int rad)
|
||||||
{
|
{
|
||||||
memset(accepts, 0, sizeof(AcceptedCargo));
|
memset(accepts, 0, sizeof(accepts));
|
||||||
|
|
||||||
int x = TileX(tile);
|
int x = TileX(tile);
|
||||||
int y = TileY(tile);
|
int y = TileY(tile);
|
||||||
|
|
Loading…
Reference in New Issue