(svn r3298) Remove unused and write-only variables

This commit is contained in:
tron 2005-12-14 06:28:48 +00:00
parent 23bfc03054
commit bf98086de8
10 changed files with 3 additions and 54 deletions

View File

@ -562,14 +562,11 @@ static void AiFindRandomIndustryRoute(FoundRoute *fr)
static void AiFindRandomPassengerRoute(FoundRoute *fr) static void AiFindRandomPassengerRoute(FoundRoute *fr)
{ {
uint32 r;
Town *source, *dest; Town *source, *dest;
// initially error // initially error
fr->distance = -1; fr->distance = -1;
r = Random();
fr->from = source = AiFindRandomTown(); fr->from = source = AiFindRandomTown();
if (source == NULL || source->population < 400) if (source == NULL || source->population < 400)
return; return;
@ -2964,8 +2961,6 @@ static void AiBuildRoadRecursive(AiRoadFinder *arf, TileIndex tile, int dir)
arf->depth--; arf->depth--;
} }
int sw;
static void AiBuildRoadConstruct(Player *p) 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.start_dir_a, &p->ai.start_dir_b);
swap_byte(&p->ai.cur_dir_a, &p->ai.cur_dir_b); swap_byte(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
sw ^= 1;
return; return;
} }

3
gfx.c
View File

@ -484,7 +484,7 @@ void DrawStringMultiLine(int x, int y, StringID str, int maxw)
{ {
char buffer[512]; char buffer[512];
uint32 tmp; uint32 tmp;
int num, w, mt; int num, mt;
const char *src; const char *src;
byte c; byte c;
@ -502,7 +502,6 @@ void DrawStringMultiLine(int x, int y, StringID str, int maxw)
src = buffer; src = buffer;
for(;;) { for(;;) {
w = GetStringWidth(src);
DoDrawString(src, x, y, 0xFE); DoDrawString(src, x, y, 0xFE);
_stringwidth_base = _stringwidth_out; _stringwidth_base = _stringwidth_out;

View File

@ -1986,14 +1986,6 @@ static const WindowDesc _toolb_normal_desc = {
MainToolbarWndProc 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[] = { static const Widget _toolb_scen_widgets[] = {
{ WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME}, { WWT_PANEL, RESIZE_NONE, 14, 0, 21, 0, 21, 0x2D6, STR_0171_PAUSE_GAME},

View File

@ -29,7 +29,6 @@
static bool _fios_path_changed; static bool _fios_path_changed;
static bool _savegame_sort_dirty; static bool _savegame_sort_dirty;
static bool _query_string_active;
typedef struct LandInfoData { typedef struct LandInfoData {
Town *town; Town *town;
@ -1024,7 +1023,6 @@ press_ok:;
parent->wndproc(parent, &e); parent->wndproc(parent, &e);
} }
} }
_query_string_active = false;
CLRBIT(_no_scroll, SCROLL_EDIT); CLRBIT(_no_scroll, SCROLL_EDIT);
break; 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.maxwidth = maxwidth;
WP(w, querystr_d).text.buf = _edit_str_buf; WP(w, querystr_d).text.buf = _edit_str_buf;
UpdateTextBufferSize(&WP(w, querystr_d).text); UpdateTextBufferSize(&WP(w, querystr_d).text);
_query_string_active = true;
} }
static const Widget _load_dialog_1_widgets[] = { 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 // pause is only used in single-player, non-editor mode, non menu mode
if(!_networking && (_game_mode != GM_EDITOR) && (_game_mode != GM_MENU)) if(!_networking && (_game_mode != GM_EDITOR) && (_game_mode != GM_MENU))
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
_query_string_active = false;
FiosFreeSavegameList(); FiosFreeSavegameList();
CLRBIT(_no_scroll, SCROLL_SAVE); CLRBIT(_no_scroll, SCROLL_SAVE);
break; break;

View File

@ -694,7 +694,6 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
if (_selected_company_item != -1) { // if a company is selected... if (_selected_company_item != -1) { // if a company is selected...
// show company info // show company info
const uint x = 183; const uint x = 183;
uint xm;
y = 65; y = 65;
SetDParamStr(0, _network_player_info[_selected_company_item].company_name); SetDParamStr(0, _network_player_info[_selected_company_item].company_name);
@ -738,7 +737,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
y += 10; y += 10;
SetDParamStr(0, _network_player_info[_selected_company_item].players); 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; y += 10;
} }
} break; } break;

View File

@ -410,7 +410,6 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
{ {
Track track = (Track)p2; Track track = (Track)p2;
TrackBits trackbit; TrackBits trackbit;
uint tileh;
TileIndex tile; TileIndex tile;
byte m5; byte m5;
int32 cost = _price.remove_rail; 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); SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
tile = TileVirtXY(x, y); tile = TileVirtXY(x, y);
tileh = GetTileSlope(tile, NULL);
if (!IsTileType(tile, MP_TUNNELBRIDGE) && !IsTileType(tile, MP_STREET) && !IsTileType(tile, MP_RAILWAY)) if (!IsTileType(tile, MP_TUNNELBRIDGE) && !IsTileType(tile, MP_STREET) && !IsTileType(tile, MP_RAILWAY))
return CMD_ERROR; return CMD_ERROR;
@ -726,7 +724,6 @@ int32 CmdBuildSingleSignal(int x, int y, uint32 flags, uint32 p1, uint32 p2)
bool semaphore; bool semaphore;
bool pre_signal; bool pre_signal;
Track track = (Track)(p1 & 0x7); Track track = (Track)(p1 & 0x7);
byte m5;
int32 cost; int32 cost;
// Same bit, used in different contexts // 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 */ /* Protect against invalid signal copying */
if (p2 != 0 && (p2 & SignalOnTrack(track)) == 0) return CMD_ERROR; 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 */ /* You can only build signals on plain rail tiles, and the selected track must exist */
if (!IsPlainRailTile(tile) || !HasTrack(tile, track)) return CMD_ERROR; if (!IsPlainRailTile(tile) || !HasTrack(tile, track)) return CMD_ERROR;

View File

@ -23,7 +23,6 @@ static void ShowTruckStationPicker(void);
static void ShowRoadDepotPicker(void); static void ShowRoadDepotPicker(void);
static bool _remove_button_clicked; static bool _remove_button_clicked;
static bool _build_road_flag;
static byte _place_road_flag; static byte _place_road_flag;
@ -111,13 +110,11 @@ typedef void OnButtonClick(Window *w);
static void BuildRoadClick_NE(Window *w) static void BuildRoadClick_NE(Window *w)
{ {
_build_road_flag = 0;
HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE); HandlePlacePushButton(w, 3, SPR_CURSOR_ROAD_NESW, 1, PlaceRoad_NE);
} }
static void BuildRoadClick_NW(Window *w) static void BuildRoadClick_NW(Window *w)
{ {
_build_road_flag = 0;
HandlePlacePushButton(w, 4, SPR_CURSOR_ROAD_NWSE, 1, PlaceRoad_NW); 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) static void BuildRoadClick_Bridge(Window *w)
{ {
_build_road_flag = 0;
HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge); HandlePlacePushButton(w, 9, SPR_CURSOR_BRIDGE, 1, PlaceRoad_Bridge);
} }
static void BuildRoadClick_Tunnel(Window *w) static void BuildRoadClick_Tunnel(Window *w)
{ {
_build_road_flag = 0;
HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel); HandlePlacePushButton(w, 10, SPR_CURSOR_ROAD_TUNNEL, 3, PlaceRoad_Tunnel);
} }

View File

@ -664,12 +664,10 @@ static void ProcessRoadVehOrder(Vehicle *v)
{ {
uint mindist = 0xFFFFFFFF; uint mindist = 0xFFFFFFFF;
int num;
RoadStopType type; RoadStopType type;
RoadStop *rs; RoadStop *rs;
type = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK; type = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK;
num = GetNumRoadStops(st, type);
rs = GetPrimaryRoadStop(st, type); rs = GetPrimaryRoadStop(st, type);
if (rs == NULL) { if (rs == NULL) {

View File

@ -37,7 +37,6 @@
#define CMD_BUILD_VEH(x) _veh_build_proc_table[ x - VEH_Train] #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_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] #define CMD_REFIT_VEH(x) _veh_refit_proc_table[ x - VEH_Train]
static const uint32 _veh_build_proc_table[] = { static const uint32 _veh_build_proc_table[] = {
@ -52,12 +51,7 @@ static const uint32 _veh_sell_proc_table[] = {
CMD_SELL_SHIP, CMD_SELL_SHIP,
CMD_SELL_AIRCRAFT, 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[] = { static const uint32 _veh_refit_proc_table[] = {
CMD_REFIT_RAIL_VEHICLE, CMD_REFIT_RAIL_VEHICLE,
0, // road vehicles can't be refitted 0, // road vehicles can't be refitted

View File

@ -498,11 +498,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
int num = NUM_ROAD_ENGINES; int num = NUM_ROAD_ENGINES;
const Engine* e = GetEngine(ROAD_ENGINES_INDEX); const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
byte cargo; byte cargo;
const EngineInfo* info;
engine_id = ROAD_ENGINES_INDEX; engine_id = ROAD_ENGINES_INDEX;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
if (sel[0] == 0) selected_id[0] = engine_id; if (sel[0] == 0) selected_id[0] = engine_id;
count++; count++;
@ -531,11 +529,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
int num = NUM_SHIP_ENGINES; int num = NUM_SHIP_ENGINES;
const Engine* e = GetEngine(SHIP_ENGINES_INDEX); const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
byte cargo, refittable; byte cargo, refittable;
const EngineInfo* info;
engine_id = SHIP_ENGINES_INDEX; engine_id = SHIP_ENGINES_INDEX;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
if (sel[0] == 0) selected_id[0] = engine_id; if (sel[0] == 0) selected_id[0] = engine_id;
count++; count++;
@ -566,11 +562,9 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
int num = NUM_AIRCRAFT_ENGINES; int num = NUM_AIRCRAFT_ENGINES;
byte subtype; byte subtype;
const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX); const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
const EngineInfo* info;
engine_id = AIRCRAFT_ENGINES_INDEX; engine_id = AIRCRAFT_ENGINES_INDEX;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
count++; count++;
if (sel[0] == 0) selected_id[0] = engine_id; 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); const Engine* e = GetEngine(ROAD_ENGINES_INDEX);
EngineID engine_id = ROAD_ENGINES_INDEX; EngineID engine_id = ROAD_ENGINES_INDEX;
byte cargo; byte cargo;
const EngineInfo* info;
if (selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] < SHIP_ENGINES_INDEX) { if (selected_id[0] >= ROAD_ENGINES_INDEX && selected_id[0] < SHIP_ENGINES_INDEX) {
cargo = RoadVehInfo(selected_id[0])->cargo_type; cargo = RoadVehInfo(selected_id[0])->cargo_type;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) { if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
DrawString(x+59, y+2, GetCustomEngineName(engine_id), sel[0]==0 ? 0xC : 0x10); 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); const Engine* e = GetEngine(SHIP_ENGINES_INDEX);
EngineID engine_id = SHIP_ENGINES_INDEX; EngineID engine_id = SHIP_ENGINES_INDEX;
byte cargo, refittable; byte cargo, refittable;
const EngineInfo* info;
if (selected_id[0] != INVALID_ENGINE) { if (selected_id[0] != INVALID_ENGINE) {
cargo = ShipVehInfo(selected_id[0])->cargo_type; cargo = ShipVehInfo(selected_id[0])->cargo_type;
refittable = ShipVehInfo(selected_id[0])->refittable; refittable = ShipVehInfo(selected_id[0])->refittable;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) { if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
DrawString(x+75, y+7, GetCustomEngineName(engine_id), sel[0]==0 ? 0xC : 0x10); 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); const Engine* e = GetEngine(AIRCRAFT_ENGINES_INDEX);
EngineID engine_id = AIRCRAFT_ENGINES_INDEX; EngineID engine_id = AIRCRAFT_ENGINES_INDEX;
byte subtype = AircraftVehInfo(selected_id[0])->subtype; byte subtype = AircraftVehInfo(selected_id[0])->subtype;
const EngineInfo* info;
do { do {
info = &_engine_info[engine_id];
if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) { if (_player_num_engines[engine_id] > 0 || EngineHasReplacement(p, engine_id)) {
if (sel[0] == 0) selected_id[0] = engine_id; if (sel[0] == 0) selected_id[0] = engine_id;
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) { if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {