mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
(svn r3298) Remove unused and write-only variables
This commit is contained in:
parent
23bfc03054
commit
bf98086de8
@ -562,14 +562,11 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
|
||||
|
||||
static void AiFindRandomPassengerRoute(FoundRoute *fr)
|
||||
{
|
||||
uint32 r;
|
||||
Town *source, *dest;
|
||||
|
||||
// initially error
|
||||
fr->distance = -1;
|
||||
|
||||
r = Random();
|
||||
|
||||
fr->from = source = AiFindRandomTown();
|
||||
if (source == NULL || source->population < 400)
|
||||
return;
|
||||
@ -2964,8 +2961,6 @@ static void AiBuildRoadRecursive(AiRoadFinder *arf, TileIndex tile, int dir)
|
||||
arf->depth--;
|
||||
}
|
||||
|
||||
int sw;
|
||||
|
||||
|
||||
static void AiBuildRoadConstruct(Player *p)
|
||||
{
|
||||
@ -3122,7 +3117,6 @@ static void AiStateBuildRoad(Player *p)
|
||||
swap_byte(&p->ai.start_dir_a, &p->ai.start_dir_b);
|
||||
swap_byte(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
|
||||
|
||||
sw ^= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
3
gfx.c
3
gfx.c
@ -484,7 +484,7 @@ void DrawStringMultiLine(int x, int y, StringID str, int maxw)
|
||||
{
|
||||
char buffer[512];
|
||||
uint32 tmp;
|
||||
int num, w, mt;
|
||||
int num, mt;
|
||||
const char *src;
|
||||
byte c;
|
||||
|
||||
@ -502,7 +502,6 @@ void DrawStringMultiLine(int x, int y, StringID str, int maxw)
|
||||
src = buffer;
|
||||
|
||||
for(;;) {
|
||||
w = GetStringWidth(src);
|
||||
DoDrawString(src, x, y, 0xFE);
|
||||
_stringwidth_base = _stringwidth_out;
|
||||
|
||||
|
@ -1986,14 +1986,6 @@ static const WindowDesc _toolb_normal_desc = {
|
||||
MainToolbarWndProc
|
||||
};
|
||||
|
||||
static const WindowDesc _toolb_intro_desc = {
|
||||
0, -22, 640, 22,
|
||||
WC_MAIN_TOOLBAR,0,
|
||||
WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
|
||||
_toolb_normal_widgets,
|
||||
MainToolbarWndProc
|
||||
};
|
||||
|
||||
|
||||
static const Widget _toolb_scen_widgets[] = {
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME},
|
||||
|
@ -29,7 +29,6 @@
|
||||
static bool _fios_path_changed;
|
||||
static bool _savegame_sort_dirty;
|
||||
|
||||
static bool _query_string_active;
|
||||
|
||||
typedef struct LandInfoData {
|
||||
Town *town;
|
||||
@ -1024,7 +1023,6 @@ press_ok:;
|
||||
parent->wndproc(parent, &e);
|
||||
}
|
||||
}
|
||||
_query_string_active = false;
|
||||
CLRBIT(_no_scroll, SCROLL_EDIT);
|
||||
break;
|
||||
}
|
||||
@ -1082,8 +1080,6 @@ void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth,
|
||||
WP(w, querystr_d).text.maxwidth = maxwidth;
|
||||
WP(w, querystr_d).text.buf = _edit_str_buf;
|
||||
UpdateTextBufferSize(&WP(w, querystr_d).text);
|
||||
|
||||
_query_string_active = true;
|
||||
}
|
||||
|
||||
static const Widget _load_dialog_1_widgets[] = {
|
||||
@ -1380,7 +1376,6 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
|
||||
// pause is only used in single-player, non-editor mode, non menu mode
|
||||
if(!_networking && (_game_mode != GM_EDITOR) && (_game_mode != GM_MENU))
|
||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
||||
_query_string_active = false;
|
||||
FiosFreeSavegameList();
|
||||
CLRBIT(_no_scroll, SCROLL_SAVE);
|
||||
break;
|
||||
|
@ -694,7 +694,6 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
|
||||
if (_selected_company_item != -1) { // if a company is selected...
|
||||
// show company info
|
||||
const uint x = 183;
|
||||
uint xm;
|
||||
y = 65;
|
||||
|
||||
SetDParamStr(0, _network_player_info[_selected_company_item].company_name);
|
||||
@ -738,7 +737,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
|
||||
y += 10;
|
||||
|
||||
SetDParamStr(0, _network_player_info[_selected_company_item].players);
|
||||
xm = DrawString(x, y, STR_NETWORK_PLAYERS, 2); // players
|
||||
DrawString(x, y, STR_NETWORK_PLAYERS, 2); // players
|
||||
y += 10;
|
||||
}
|
||||
} break;
|
||||
|
@ -410,7 +410,6 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
Track track = (Track)p2;
|
||||
TrackBits trackbit;
|
||||
uint tileh;
|
||||
TileIndex tile;
|
||||
byte m5;
|
||||
int32 cost = _price.remove_rail;
|
||||
@ -421,7 +420,6 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
tile = TileVirtXY(x, y);
|
||||
tileh = GetTileSlope(tile, NULL);
|
||||
|
||||
if (!IsTileType(tile, MP_TUNNELBRIDGE) && !IsTileType(tile, MP_STREET) && !IsTileType(tile, MP_RAILWAY))
|
||||
return CMD_ERROR;
|
||||
@ -726,7 +724,6 @@ int32 CmdBuildSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
bool semaphore;
|
||||
bool pre_signal;
|
||||
Track track = (Track)(p1 & 0x7);
|
||||
byte m5;
|
||||
int32 cost;
|
||||
|
||||
// Same bit, used in different contexts
|
||||
@ -738,8 +735,6 @@ int32 CmdBuildSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
/* Protect against invalid signal copying */
|
||||
if (p2 != 0 && (p2 & SignalOnTrack(track)) == 0) return CMD_ERROR;
|
||||
|
||||
m5 = _m[tile].m5;
|
||||
|
||||
/* You can only build signals on plain rail tiles, and the selected track must exist */
|
||||
if (!IsPlainRailTile(tile) || !HasTrack(tile, track)) return CMD_ERROR;
|
||||
|
||||
|
@ -23,7 +23,6 @@ static void ShowTruckStationPicker(void);
|
||||
static void ShowRoadDepotPicker(void);
|
||||
|
||||
static bool _remove_button_clicked;
|
||||
static bool _build_road_flag;
|
||||
|
||||
static byte _place_road_flag;
|
||||
|
||||
@ -111,13 +110,11 @@ typedef void OnButtonClick(Window *w);
|
||||
|
||||
static void BuildRoadClick_NE(Window *w)
|
||||
{
|
||||
_build_road_flag = 0;
|
||||
HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE);
|
||||
}
|
||||
|
||||
static void BuildRoadClick_NW(Window *w)
|
||||
{
|
||||
_build_road_flag = 0;
|
||||
HandlePlacePushButton(w, 4, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW);
|
||||
}
|
||||
|
||||
@ -147,13 +144,11 @@ static void BuildRoadClick_TruckStation(Window *w)
|
||||
|
||||
static void BuildRoadClick_Bridge(Window *w)
|
||||
{
|
||||
_build_road_flag = 0;
|
||||
HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
|
||||
}
|
||||
|
||||
static void BuildRoadClick_Tunnel(Window *w)
|
||||
{
|
||||
_build_road_flag = 0;
|
||||
HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel);
|
||||
}
|
||||
|
||||
|
@ -664,12 +664,10 @@ static void ProcessRoadVehOrder(Vehicle *v)
|
||||
|
||||
{
|
||||
uint mindist = 0xFFFFFFFF;
|
||||
int num;
|
||||
RoadStopType type;
|
||||
RoadStop *rs;
|
||||
|
||||
type = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK;
|
||||
num = GetNumRoadStops(st, type);
|
||||
rs = GetPrimaryRoadStop(st, type);
|
||||
|
||||
if (rs == NULL) {
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#define CMD_BUILD_VEH(x) _veh_build_proc_table[ x - VEH_Train]
|
||||
#define CMD_SELL_VEH(x) _veh_sell_proc_table[ x - VEH_Train]
|
||||
#define CMD_STARTSTOP_VEH(x) _veh_start_stop_proc_table[ x - VEH_Train]
|
||||
#define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
|
||||
|
||||
static const uint32 _veh_build_proc_table[] = {
|
||||
@ -52,12 +51,7 @@ static const uint32 _veh_sell_proc_table[] = {
|
||||
CMD_SELL_SHIP,
|
||||
CMD_SELL_AIRCRAFT,
|
||||
};
|
||||
static const uint32 _veh_start_stop_proc_table[] = {
|
||||
CMD_START_STOP_TRAIN,
|
||||
CMD_START_STOP_ROADVEH,
|
||||
CMD_START_STOP_SHIP,
|
||||
CMD_START_STOP_AIRCRAFT,
|
||||
};
|
||||
|
||||
static const uint32 _veh_refit_proc_table[] = {
|
||||
CMD_REFIT_RAIL_VEHICLE,
|
||||
0, // road vehicles can't be refitted
|
||||
|
@ -498,11 +498,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
int num = NUM_ROAD_ENGINES;
|
||||
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
||||
byte cargo;
|
||||
const EngineInfo* info;
|
||||
engine_id = ROAD_ENGINES_INDEX;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
if (sel[0] == 0) selected_id[0] = engine_id;
|
||||
count++;
|
||||
@ -531,11 +529,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
int num = NUM_SHIP_ENGINES;
|
||||
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
byte cargo, refittable;
|
||||
const EngineInfo* info;
|
||||
engine_id = SHIP_ENGINES_INDEX;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
if (sel[0] == 0) selected_id[0] = engine_id;
|
||||
count++;
|
||||
@ -566,11 +562,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
|
||||
int num = NUM_AIRCRAFT_ENGINES;
|
||||
byte subtype;
|
||||
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||
const EngineInfo* info;
|
||||
engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
count++;
|
||||
if (sel[0] == 0) selected_id[0] = engine_id;
|
||||
@ -643,13 +637,11 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
|
||||
EngineID engine_id = ROAD_ENGINES_INDEX;
|
||||
byte cargo;
|
||||
const EngineInfo* info;
|
||||
|
||||
if (selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] < SHIP_ENGINES_INDEX) {
|
||||
cargo = RoadVehInfo(selected_id[0])->cargo_type;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
|
||||
DrawString(x+59, y+2, GetCustomEngineName(engine_id), sel[0]==0 ? 0xC : 0x10);
|
||||
@ -679,14 +671,12 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
EngineID engine_id = SHIP_ENGINES_INDEX;
|
||||
byte cargo, refittable;
|
||||
const EngineInfo* info;
|
||||
|
||||
if (selected_id[0] != INVALID_ENGINE) {
|
||||
cargo = ShipVehInfo(selected_id[0])->cargo_type;
|
||||
refittable = ShipVehInfo(selected_id[0])->refittable;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
|
||||
DrawString(x+75, y+7, GetCustomEngineName(engine_id), sel[0]==0 ? 0xC : 0x10);
|
||||
@ -718,10 +708,8 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
|
||||
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
|
||||
EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
|
||||
byte subtype = AircraftVehInfo(selected_id[0])->subtype;
|
||||
const EngineInfo* info;
|
||||
|
||||
do {
|
||||
info = &_engine_info[engine_id];
|
||||
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
|
||||
if (sel[0] == 0) selected_id[0] = engine_id;
|
||||
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
|
||||
|
Loading…
Reference in New Issue
Block a user