(svn r2535) Tabs

pull/155/head
tron 19 years ago
parent 11421beed1
commit 1307f90b5e

@ -707,7 +707,7 @@ DEF_CONSOLE_CMD(ConScript)
if (!CloseConsoleLogIfActive()) {
if (argc < 2) return false;
IConsolePrintF(_icolour_def, "file output started to: %s", argv[1]);
IConsolePrintF(_icolour_def, "file output started to: %s", argv[1]);
_iconsole_output_file = fopen(argv[1], "ab");
if (_iconsole_output_file == NULL) IConsoleError("could not open file");
}
@ -902,31 +902,31 @@ DEF_CONSOLE_CMD(ConHelp)
const IConsoleAlias *alias;
cmd = IConsoleCmdGet(argv[1]);
if (cmd != NULL) {
cmd->proc(0, NULL);
return true;
}
alias = IConsoleAliasGet(argv[1]);
if (alias != NULL) {
cmd = IConsoleCmdGet(alias->cmdline);
if (cmd != NULL) {
cmd->proc(0, NULL);
return true;
}
IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline);
return true;
}
var = IConsoleVarGet(argv[1]);
if (var != NULL && var->help != NULL) {
IConsoleHelp(var->help);
return true;
}
IConsoleError("command or variable not found");
return true;
}
if (cmd != NULL) {
cmd->proc(0, NULL);
return true;
}
alias = IConsoleAliasGet(argv[1]);
if (alias != NULL) {
cmd = IConsoleCmdGet(alias->cmdline);
if (cmd != NULL) {
cmd->proc(0, NULL);
return true;
}
IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline);
return true;
}
var = IConsoleVarGet(argv[1]);
if (var != NULL && var->help != NULL) {
IConsoleHelp(var->help);
return true;
}
IConsoleError("command or variable not found");
return true;
}
IConsolePrint(13, " ---- OpenTTD Console Help ---- ");
IConsolePrint( 1, " - variables: [command to list all variables: list_vars]");
@ -1050,7 +1050,7 @@ DEF_CONSOLE_CMD(ConSayClient)
{
if (argc == 0) {
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'");
IConsoleHelp("For client-id's, see the command 'clients'");
IConsoleHelp("For client-id's, see the command 'clients'");
return true;
}
@ -1252,9 +1252,9 @@ void IConsoleStdLibRegister(void)
IConsoleCmdRegister("screenshot", ConScreenShot);
IConsoleCmdRegister("script", ConScript);
IConsoleCmdRegister("scrollto", ConScrollToTile);
IConsoleCmdRegister("alias", ConAlias);
IConsoleCmdRegister("load", ConLoad);
IConsoleCmdRegister("save", ConSave);
IConsoleCmdRegister("alias", ConAlias);
IConsoleCmdRegister("load", ConLoad);
IConsoleCmdRegister("save", ConSave);
IConsoleCmdRegister("ls", ConListFiles);
IConsoleCmdRegister("cd", ConChangeDirectory);
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory);

@ -262,7 +262,7 @@ static void DisasterTick_UFO(Vehicle *v)
// fly around randomly
int x = TileX(v->dest_tile) * 16;
int y = TileY(v->dest_tile) * 16;
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
v->direction = GetDirectionTowards(v, x, y);
GetNewVehiclePos(v, &gp);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@ -331,8 +331,8 @@ static void DestructIndustry(Industry *i)
{
TileIndex tile;
for(tile=0; tile != MapSize(); tile++) {
if (IsTileType(tile, MP_INDUSTRY) && _map2[tile] == i->index) {
for (tile = 0; tile != MapSize(); tile++) {
if (IsTileType(tile, MP_INDUSTRY) && _map2[tile] == i->index) {
_map_owner[tile] = 0;
MarkTileDirtyByTile(tile);
}
@ -563,7 +563,7 @@ static void DisasterTick_4(Vehicle *v)
int x = TileX(v->dest_tile) * 16;
int y = TileY(v->dest_tile) * 16;
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
v->direction = GetDirectionTowards(v, x, y);
GetNewVehiclePos(v, &gp);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@ -907,7 +907,7 @@ static void Disaster7_Init(void)
do {
FOR_ALL_INDUSTRIES(i) {
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
SetDParam(0, i->town->index);
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,

@ -848,7 +848,7 @@ NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientState *cs)
byte type = NetworkRecv_uint8(MY_CLIENT, p);
if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->quited) {
res = _network_client_packet[type](p);
} else {
} else {
res = NETWORK_RECV_STATUS_MALFORMED_PACKET;
DEBUG(net, 0)("[NET][client] Received invalid packet type %d", type);
}

@ -141,7 +141,7 @@ static int NullVideoMainLoop(void)
GameLoop();
_screen.dst_ptr = _null_video_mem;
UpdateWindows();
} while (--i);
} while (--i);
return ML_QUIT;
}
@ -584,7 +584,7 @@ int ttd_main(int argc, char* argv[])
_config_file = strdup(mgo.opt);
break;
case -2:
case 'h':
case 'h':
showhelp();
return 0;
}
@ -751,7 +751,7 @@ static void MakeNewGame(void)
// In a dedicated server, the server does not play
if (_network_dedicated) {
_local_player = OWNER_SPECTATOR;
} else {
} else {
// Create a single player
DoStartupNewPlayer(false);
@ -1220,7 +1220,7 @@ static void UpdateExclusiveRights(void)
Build an array town_blocked[ town_id ][ player_id ]
that stores if at least one station in that town is blocked for a player
2.) Go through that array, if you find a town that is not blocked for
one player, but for all others, then give him exclusivity.
one player, but for all others, then give him exclusivity.
*/
}

@ -534,7 +534,7 @@ void stat_Hash(Hash* h)
if (usage[i]) {
printf("%d:%d ", i, usage[i]);
/*
if (i>0){
if (i>0){
uint j;
for (j=0;j<(usage[i] * 160 / 800);j++)
printf("#");
@ -566,7 +566,7 @@ void clear_Hash(Hash* h, bool free_values)
HashNode* prev = node;
node = node->next;
if (free_values)
free(prev->value);
free(prev->value);
free(prev);
}
}

@ -218,7 +218,7 @@ int SlIterateArray(void)
next_offs = SlGetOffs() + length;
switch (_sl.block_mode) {
case CH_SPARSE_ARRAY: index = SlReadSparseIndex(); break;
case CH_SPARSE_ARRAY: index = SlReadSparseIndex(); break;
case CH_ARRAY: index = _sl.array_index++; break;
default:
DEBUG(misc, 0) ("SlIterateArray: error");
@ -326,7 +326,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv)
// Write the value to the file and check if its value is in the desired range
switch (conv & 0xF) {
case SLE_FILE_I8: assert(x >= -128 && x <= 127); SlWriteByte(x);break;
case SLE_FILE_U8: assert(x >= 0 && x <= 255); SlWriteByte(x);break;
case SLE_FILE_U8: assert(x >= 0 && x <= 255); SlWriteByte(x);break;
case SLE_FILE_I16:assert(x >= -32768 && x <= 32767); SlWriteUint16(x);break;
case SLE_FILE_STRINGID:
case SLE_FILE_U16:assert(x >= 0 && x <= 65535); SlWriteUint16(x);break;
@ -465,7 +465,7 @@ static size_t SlCalcObjLength(void *object, const SaveLoad *sld)
length++; // a byte is logically of size 1
} else if (sld->cmd == SL_INCLUDE) {
length += SlCalcObjLength(NULL, _sl.includes[sld->version_from]);
} else
} else
assert(sld->cmd == SL_END);
}
return length;
@ -526,7 +526,7 @@ void SlObject(void *object, const SaveLoad *sld)
* include_index: common code to include from _desc_includes[], abused by sld->version_from */
} else if (sld->cmd == SL_INCLUDE) {
SlObject(ptr, _sl.includes[sld->version_from]);
} else
} else
assert(sld->cmd == SL_END);
}
}
@ -941,7 +941,7 @@ static void WriteZlibLoop(z_streamp z, byte *p, uint len, int mode)
do {
z->next_out = buf;
z->avail_out = sizeof(buf);
r = deflate(z, mode);
r = deflate(z, mode);
// bytes were emitted?
if ((n=sizeof(buf) - z->avail_out) != 0) {
if (fwrite(buf, n, 1, _sl.fh) != 1) SlError("file write error");
@ -1437,7 +1437,7 @@ int GetSavegameType(char *file)
f = fopen(file, "rb");
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
printf("Savegame is obsolete or invalid format.\n");
mode = SL_LOAD; // don't try to get filename, just show name as it is written
mode = SL_LOAD; // don't try to get filename, just show name as it is written
}
else {
// see if we have any loader for this type.

@ -399,7 +399,7 @@ static const VkMapping _vk_mapping[] = {
static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
{
const VkMapping *map;
const VkMapping *map;
uint key = 0;
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
if ((uint)(sym->sym - map->vk_from) <= map->vk_count) {
@ -573,7 +573,7 @@ static int SdlVideoMainLoop(void)
while ((i = PollEvent()) == -1) {}
if (i >= 0) return i;
if (_exit_game) return ML_QUIT;
if (_exit_game) return ML_QUIT;
mod = SDL_CALL SDL_GetModState();
keys = SDL_CALL SDL_GetKeyState(&numkeys);
@ -613,7 +613,7 @@ static int SdlVideoMainLoop(void)
CheckPaletteAnim();
pal_tick = 1;
}
DrawSurfaceToScreen();
DrawSurfaceToScreen();
} else {
SDL_CALL SDL_Delay(1);
_screen.dst_ptr = _sdl_screen->pixels;

@ -706,7 +706,7 @@ const void *GetRawSprite(SpriteID sprite)
#if defined(WANT_NEW_LRU)
_sprite_lru_new[sprite] = ++_sprite_lru_counter;
#else
_sprite_lru_cur[sprite] = ++_sprite_lru_counter;
_sprite_lru_cur[sprite] = ++_sprite_lru_counter;
_sprite_lru[sprite] = 0;
#endif
@ -727,7 +727,7 @@ static const char * const _cached_filenames[4] = {
#define OPENTTD_SPRITES_COUNT 98
static const uint16 _openttd_grf_indexes[] = {
SPR_OPENTTD_BASE+0, SPR_OPENTTD_BASE+7, // icons etc
SPR_OPENTTD_BASE + 0, SPR_OPENTTD_BASE + 7, // icons etc
134, 134, // euro symbol medium size
582, 582, // euro symbol large size
358, 358, // euro symbol tiny

@ -72,7 +72,7 @@ static int CDECL StationNameSorter(const void *a, const void *b)
GetString(_bufcache, st->string_id);
}
return strcmp(buf1, _bufcache); // sort by name
return strcmp(buf1, _bufcache); // sort by name
}
static void GlobalSortStationList(void)
@ -93,7 +93,7 @@ static void GlobalSortStationList(void)
if(st->xy && st->owner != OWNER_NONE) {
_station_sort[n].index = st->index;
_station_sort[n++].owner = st->owner;
_num_station_sort[st->owner]++; // add number of stations of player
_num_station_sort[st->owner]++; // add number of stations of player
}
}
@ -117,11 +117,11 @@ static void MakeSortedStationList(byte owner)
uint32 n = 0;
if (owner == 0) { // first element starts at 0th element and has n elements as described above
firstelement = &_station_sort[0];
n = _num_station_sort[0];
} else { // nth element starts at the end of the previous one, and has n elements as described above
firstelement = &_station_sort[_num_station_sort[owner-1]];
n = _num_station_sort[owner] - _num_station_sort[owner-1];
firstelement = &_station_sort[0];
n = _num_station_sort[0];
} else { // nth element starts at the end of the previous one, and has n elements as described above
firstelement = &_station_sort[_num_station_sort[owner - 1]];
n = _num_station_sort[owner] - _num_station_sort[owner - 1];
}
_last_station_idx = 0; // used for "cache" in namesorting
@ -165,18 +165,18 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
byte p = 0;
Station *st;
int x,xb = 2;
int y = 16; // offset from top of widget
int y = 16; // offset from top of widget
int j;
if (w->vscroll.count == 0) { // player has no stations
if (w->vscroll.count == 0) { // player has no stations
DrawString(xb, y, STR_304A_NONE, 0);
return;
}
i += w->vscroll.pos; // offset from sorted station list of current player
i += w->vscroll.pos; // offset from sorted station list of current player
assert(i < _num_station_sort[window_number]); // at least one station must exist
while (i < _num_station_sort[window_number]) { // do until max number of stations of owner
while (i < _num_station_sort[window_number]) { // do until max number of stations of owner
st = GetStation(_station_sort[i].index);
assert(st->xy && st->owner == window_number);
@ -194,7 +194,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
}
}
y += 10;
i++; // next station
i++; // next station
if (++p == w->vscroll.cap) { break;} // max number of stations in 1 window
}
}
@ -211,7 +211,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
{
const byte owner = (byte)w->window_number;
Station *st;
id_v += (owner == 0) ? 0 : _num_station_sort[owner - 1]; // first element in list
id_v += (owner == 0) ? 0 : _num_station_sort[owner - 1]; // first element in list
if (id_v >= _num_station_sort[owner]) { return;} // click out of station bound
@ -470,7 +470,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
SetDParam(0, st->town->townnametype);
SetDParam(1, st->town->townnameparts);
ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number);
} break;
} break;
case 10: { /* Show a list of scheduled trains to this station */
const Station *st = GetStation(w->window_number);

@ -25,7 +25,7 @@ int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
/* Find player that has HQ flooded, and reset their location_of_house */
if (_current_player == OWNER_WATER) {
if (_current_player == OWNER_WATER) {
bool dodelete = false;
FOR_ALL_PLAYERS(p) {
@ -171,7 +171,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
DrawGroundSprite(t->ground_sprite | ormod);
foreach_draw_tile_seq(dtss, t->seq) {
image = dtss->image;
image = dtss->image;
if (_display_opt & DO_TRANS_BUILDINGS) {
image = (image & 0x3FFF) | 0x03224000;
} else {
@ -202,7 +202,7 @@ static int32 ClearTile_Unmovable(TileIndex tile, byte flags)
return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
}
if (m5 == 3) // company owned land
if (m5 == 3) // company owned land
return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
// checks if you're allowed to remove unmovable things
@ -398,7 +398,7 @@ static void ChangeTileOwner_Unmovable(TileIndex tile, byte old_player, byte new_
if (_map5[tile]==3 && new_player != 255) {
SetTileOwner(tile, new_player);
} else {
} else {
DoClearSquare(tile);
}
}

@ -339,7 +339,7 @@ Point GetTileZoomCenterWindow(bool in, Window * w)
vp = w->viewport;
if (in) {
if (in) {
x = ( (_cursor.pos.x - vp->left ) >> 1) + (vp->width >> 2);
y = ( (_cursor.pos.y - vp->top ) >> 1) + (vp->height >> 2);
}

@ -320,7 +320,7 @@ int32 CmdRenameWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
} else {
DeleteName(str);
}
} else {
} else {
if (flags & DC_EXEC) {
wp = GetWaypoint(p1);
if (wp->string != STR_NULL)
@ -434,8 +434,8 @@ static const SaveLoad _waypoint_desc[] = {
SLE_CONDVAR(Waypoint, xy, SLE_UINT32, 6, 255),
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, 255),
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT8, 12, 255),
SLE_VAR(Waypoint,string, SLE_UINT16),
SLE_VAR(Waypoint,deleted, SLE_UINT8),
SLE_VAR(Waypoint, string, SLE_UINT16),
SLE_VAR(Waypoint, deleted, SLE_UINT8),
SLE_CONDVAR(Waypoint, build_date, SLE_UINT16, 3, 255),
SLE_CONDVAR(Waypoint, stat_id, SLE_UINT8, 3, 255),

@ -20,7 +20,7 @@ static Point HandleScrollbarHittest(Scrollbar *sb, int top, int bottom)
count = sb->count;
cap = sb->cap;
if (count != 0) top += height * pos / count;
if (count != 0) top += height * pos / count;
if (cap > count) cap = count;
if (count != 0)
@ -160,7 +160,8 @@ void DrawWindowWidgets(Window *w)
uint32 dparam_backup[20];
uint32 cur_click, cur_disabled, cur_hidden;
if (w->desc_flags & WDF_RESTORE_DPARAM) COPY_OUT_DPARAM(dparam_backup, 0, lengthof(dparam_backup));
if (w->desc_flags & WDF_RESTORE_DPARAM)
COPY_OUT_DPARAM(dparam_backup, 0, lengthof(dparam_backup));
wi = w->widget;
@ -425,7 +426,8 @@ void DrawWindowWidgets(Window *w)
DrawStringCentered( (r.left+r.right+1)>>1, r.top+2, wi->unkA, 0x84);
restore_dparam:;
if (w->desc_flags & WDF_RESTORE_DPARAM) COPY_IN_DPARAM(0, dparam_backup, lengthof(dparam_backup));
if (w->desc_flags & WDF_RESTORE_DPARAM)
COPY_IN_DPARAM(0, dparam_backup, lengthof(dparam_backup));
draw_default:;
if (cur_disabled & 1) {
GfxFillRect(r.left+1, r.top+1, r.right-1, r.bottom-1, _color_list[wi->color&0xF].unk2 | 0x8000);

@ -103,7 +103,7 @@ typedef struct {
#define AS(x, z) {x, 0, z}
#define AM(x, y, z, w) {x, y - x, z}
#ifndef VK_OEM_3
#ifndef VK_OEM_3
#define VK_OEM_3 0xC0
#endif
@ -148,9 +148,9 @@ static uint MapWindowsKey(uint sym)
}
}
if (GetAsyncKeyState(VK_SHIFT)<0) key |= WKC_SHIFT;
if (GetAsyncKeyState(VK_CONTROL)<0) key |= WKC_CTRL;
if (GetAsyncKeyState(VK_MENU)<0) key |= WKC_ALT;
if (GetAsyncKeyState(VK_SHIFT) < 0) key |= WKC_SHIFT;
if (GetAsyncKeyState(VK_CONTROL) < 0) key |= WKC_CTRL;
if (GetAsyncKeyState(VK_MENU) < 0) key |= WKC_ALT;
return key;
}
@ -318,7 +318,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
ClientSizeChanged(_wnd.width, _wnd.height);
MarkWholeScreenDirty();
}
} break;
} break;
case WM_SYSKEYDOWN: /* user presses F10 or Alt, both activating the title-menu */
switch (wParam) {
@ -1073,7 +1073,8 @@ static uint32 *_crc_table;
static void MakeCRCTable(uint32 *table) {
uint32 crc, poly = 0xEDB88320L;
int i, j;
int i;
int j;
_crc_table = table;

@ -155,7 +155,7 @@ void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
while (++v != _last_window) {
if (right > v->left &&
bottom > v->top &&
bottom > v->top &&
left < v->left + v->width &&
top < v->top + v->height) {
@ -660,13 +660,13 @@ Window *AllocateWindowDesc(const WindowDesc *desc)
if (pt.x > _screen.width + 10 - desc->width)
pt.x = (_screen.width + 10 - desc->width) - 20;
pt.y = w->top + 10;
} else if (desc->cls == WC_BUILD_TOOLBAR) { // open Build Toolbars aligned
} else if (desc->cls == WC_BUILD_TOOLBAR) { // open Build Toolbars aligned
/* Override the position if a toolbar is opened according to the place of the maintoolbar
* The main toolbar (WC_MAIN_TOOLBAR) is 640px in width */
switch (_patches.toolbar_pos) {
case 1: pt.x = ((_screen.width + 640) >> 1) - desc->width; break;
case 2: pt.x = _screen.width - desc->width; break;
default: pt.x = 640 - desc->width;
case 1: pt.x = ((_screen.width + 640) >> 1) - desc->width; break;
case 2: pt.x = _screen.width - desc->width; break;
default: pt.x = 640 - desc->width;
}
pt.y = desc->top;
} else {
@ -1641,9 +1641,9 @@ int PositionMainToolbar(Window *w)
w = FindWindowById(WC_MAIN_TOOLBAR, 0);
switch (_patches.toolbar_pos) {
case 1: w->left = (_screen.width - w->width) >> 1; break;
case 2: w->left = _screen.width - w->width; break;
default: w->left = 0;
case 1: w->left = (_screen.width - w->width) >> 1; break;
case 2: w->left = _screen.width - w->width; break;
default: w->left = 0;
}
SetDirtyBlocks(0, 0, _screen.width, w->height); // invalidate the whole top part
return w->left;

Loading…
Cancel
Save