diff --git a/ai/default/default.c b/ai/default/default.c index 72383ab12e..150e0be92f 100644 --- a/ai/default/default.c +++ b/ai/default/default.c @@ -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; } diff --git a/gfx.c b/gfx.c index cb6650cb7b..7cf3f2dbbc 100644 --- a/gfx.c +++ b/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; diff --git a/main_gui.c b/main_gui.c index 16021fc48c..7adf19c1cd 100644 --- a/main_gui.c +++ b/main_gui.c @@ -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}, diff --git a/misc_gui.c b/misc_gui.c index bc6e529ea4..8517782f8e 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -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; diff --git a/network_gui.c b/network_gui.c index 81a336c602..8da59c644d 100644 --- a/network_gui.c +++ b/network_gui.c @@ -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; diff --git a/rail_cmd.c b/rail_cmd.c index 7264ab9f66..8518e319ce 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -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; diff --git a/road_gui.c b/road_gui.c index b684aed912..4fc159bb62 100644 --- a/road_gui.c +++ b/road_gui.c @@ -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); } diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 0a78127bed..b45fb6e933 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -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) { diff --git a/vehicle.c b/vehicle.c index 4c16195655..b6935b9a3e 100644 --- a/vehicle.c +++ b/vehicle.c @@ -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 diff --git a/vehicle_gui.c b/vehicle_gui.c index 1f135955d4..fbfd7d698c 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -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)) {