1
0
Fork 0

(svn r8990) -Fix: more indenting and variable scoping

release/0.6
peter1138 2007-03-03 10:48:25 +00:00
parent 8f2a554864
commit db2f57e3a1
1 changed files with 29 additions and 32 deletions

View File

@ -41,12 +41,10 @@ static void BuildBridge(Window *w, int i)
static void BuildBridgeWndProc(Window *w, WindowEvent *e) static void BuildBridgeWndProc(Window *w, WindowEvent *e)
{ {
switch (e->event) { switch (e->event) {
case WE_PAINT: { case WE_PAINT:
uint i;
DrawWindowWidgets(w); DrawWindowWidgets(w);
for (i = 0; i < 4 && i + w->vscroll.pos < _bridgedata.count; i++) { for (uint i = 0; i < 4 && i + w->vscroll.pos < _bridgedata.count; i++) {
const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]]; const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]];
SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]); SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
@ -56,7 +54,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
DrawString(44, 15 + i * 22 , STR_500D, 0); DrawString(44, 15 + i * 22 , STR_500D, 0);
} }
} break; break;
case WE_KEYPRESS: { case WE_KEYPRESS: {
uint i = e->we.keypress.keycode - '1'; uint i = e->we.keypress.keycode - '1';
@ -134,12 +132,11 @@ void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
errmsg = _error_message; errmsg = _error_message;
} else { } else {
// check which bridges can be built // check which bridges can be built
int bridge_len; // length of the middle parts of the bridge
int tot_bridgedata_len; // total length of bridge
// get absolute bridge length // get absolute bridge length
bridge_len = GetBridgeLength(start, end); // length of the middle parts of the bridge
tot_bridgedata_len = bridge_len + 2; int bridge_len = GetBridgeLength(start, end);
// total length of bridge
int tot_bridgedata_len = bridge_len + 2;
tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len); tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len);