Mercurial > hg > openttd
comparison src/station_cmd.cpp @ 8846:838e1d6a0321 draft
(svn r12596) -Feature: show what cargos a station could be supplied with. Patch by Roujin.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 06 Apr 2008 22:32:20 +0000 |
parents | c3d2f0eb69a1 |
children | 748b998a108e |
comparison
equal
deleted
inserted
replaced
8845:bb04cb5677d8 | 8846:838e1d6a0321 |
---|---|
463 assert(w > 0); | 463 assert(w > 0); |
464 assert(h > 0); | 464 assert(h > 0); |
465 | 465 |
466 for (int yc = y1; yc != y2; yc++) { | 466 for (int yc = y1; yc != y2; yc++) { |
467 for (int xc = x1; xc != x2; xc++) { | 467 for (int xc = x1; xc != x2; xc++) { |
468 if (!(IsInsideBS(xc, x, w) && IsInsideBS(yc, y, h))) { | 468 TileIndex tile = TileXY(xc, yc); |
469 TileIndex tile = TileXY(xc, yc); | 469 |
470 | 470 if (!IsTileType(tile, MP_STATION)) { |
471 GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc; | 471 GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc; |
472 if (gpc != NULL) { | 472 if (gpc != NULL) { |
473 CargoID cargos[2] = { CT_INVALID, CT_INVALID }; | 473 CargoID cargos[256]; // Required for CBID_HOUSE_PRODUCE_CARGO. |
474 memset(cargos, CT_INVALID, 256); | |
474 | 475 |
475 gpc(tile, cargos); | 476 gpc(tile, cargos); |
476 for (uint i = 0; i < lengthof(cargos); ++i) { | 477 for (uint i = 0; i < lengthof(cargos); ++i) { |
477 if (cargos[i] != CT_INVALID) produced[cargos[i]]++; | 478 if (cargos[i] != CT_INVALID) produced[cargos[i]]++; |
478 } | 479 } |