mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2535) Tabs
This commit is contained in:
parent
83f72f696a
commit
1b4a0897b6
|
@ -707,7 +707,7 @@ DEF_CONSOLE_CMD(ConScript)
|
||||||
if (!CloseConsoleLogIfActive()) {
|
if (!CloseConsoleLogIfActive()) {
|
||||||
if (argc < 2) return false;
|
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");
|
_iconsole_output_file = fopen(argv[1], "ab");
|
||||||
if (_iconsole_output_file == NULL) IConsoleError("could not open file");
|
if (_iconsole_output_file == NULL) IConsoleError("could not open file");
|
||||||
}
|
}
|
||||||
|
@ -902,31 +902,31 @@ DEF_CONSOLE_CMD(ConHelp)
|
||||||
const IConsoleAlias *alias;
|
const IConsoleAlias *alias;
|
||||||
|
|
||||||
cmd = IConsoleCmdGet(argv[1]);
|
cmd = IConsoleCmdGet(argv[1]);
|
||||||
if (cmd != NULL) {
|
if (cmd != NULL) {
|
||||||
cmd->proc(0, NULL);
|
cmd->proc(0, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
alias = IConsoleAliasGet(argv[1]);
|
alias = IConsoleAliasGet(argv[1]);
|
||||||
if (alias != NULL) {
|
if (alias != NULL) {
|
||||||
cmd = IConsoleCmdGet(alias->cmdline);
|
cmd = IConsoleCmdGet(alias->cmdline);
|
||||||
if (cmd != NULL) {
|
if (cmd != NULL) {
|
||||||
cmd->proc(0, NULL);
|
cmd->proc(0, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline);
|
IConsolePrintF(_icolour_err, "ERROR: alias is of special type, please see its execution-line: '%s'", alias->cmdline);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var = IConsoleVarGet(argv[1]);
|
var = IConsoleVarGet(argv[1]);
|
||||||
if (var != NULL && var->help != NULL) {
|
if (var != NULL && var->help != NULL) {
|
||||||
IConsoleHelp(var->help);
|
IConsoleHelp(var->help);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IConsoleError("command or variable not found");
|
IConsoleError("command or variable not found");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IConsolePrint(13, " ---- OpenTTD Console Help ---- ");
|
IConsolePrint(13, " ---- OpenTTD Console Help ---- ");
|
||||||
IConsolePrint( 1, " - variables: [command to list all variables: list_vars]");
|
IConsolePrint( 1, " - variables: [command to list all variables: list_vars]");
|
||||||
|
@ -1050,7 +1050,7 @@ DEF_CONSOLE_CMD(ConSayClient)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("Chat to a certain player in a multiplayer game. Usage: 'say_client <client-no> \"<msg>\"'");
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,9 +1252,9 @@ void IConsoleStdLibRegister(void)
|
||||||
IConsoleCmdRegister("screenshot", ConScreenShot);
|
IConsoleCmdRegister("screenshot", ConScreenShot);
|
||||||
IConsoleCmdRegister("script", ConScript);
|
IConsoleCmdRegister("script", ConScript);
|
||||||
IConsoleCmdRegister("scrollto", ConScrollToTile);
|
IConsoleCmdRegister("scrollto", ConScrollToTile);
|
||||||
IConsoleCmdRegister("alias", ConAlias);
|
IConsoleCmdRegister("alias", ConAlias);
|
||||||
IConsoleCmdRegister("load", ConLoad);
|
IConsoleCmdRegister("load", ConLoad);
|
||||||
IConsoleCmdRegister("save", ConSave);
|
IConsoleCmdRegister("save", ConSave);
|
||||||
IConsoleCmdRegister("ls", ConListFiles);
|
IConsoleCmdRegister("ls", ConListFiles);
|
||||||
IConsoleCmdRegister("cd", ConChangeDirectory);
|
IConsoleCmdRegister("cd", ConChangeDirectory);
|
||||||
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory);
|
IConsoleCmdRegister("pwd", ConPrintWorkingDirectory);
|
||||||
|
|
|
@ -262,7 +262,7 @@ static void DisasterTick_UFO(Vehicle *v)
|
||||||
// fly around randomly
|
// fly around randomly
|
||||||
int x = TileX(v->dest_tile) * 16;
|
int x = TileX(v->dest_tile) * 16;
|
||||||
int y = TileY(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);
|
v->direction = GetDirectionTowards(v, x, y);
|
||||||
GetNewVehiclePos(v, &gp);
|
GetNewVehiclePos(v, &gp);
|
||||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||||
|
@ -331,8 +331,8 @@ static void DestructIndustry(Industry *i)
|
||||||
{
|
{
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
|
|
||||||
for(tile=0; tile != MapSize(); tile++) {
|
for (tile = 0; tile != MapSize(); tile++) {
|
||||||
if (IsTileType(tile, MP_INDUSTRY) && _map2[tile] == i->index) {
|
if (IsTileType(tile, MP_INDUSTRY) && _map2[tile] == i->index) {
|
||||||
_map_owner[tile] = 0;
|
_map_owner[tile] = 0;
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ static void DisasterTick_4(Vehicle *v)
|
||||||
|
|
||||||
int x = TileX(v->dest_tile) * 16;
|
int x = TileX(v->dest_tile) * 16;
|
||||||
int y = TileY(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);
|
v->direction = GetDirectionTowards(v, x, y);
|
||||||
GetNewVehiclePos(v, &gp);
|
GetNewVehiclePos(v, &gp);
|
||||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||||
|
@ -907,7 +907,7 @@ static void Disaster7_Init(void)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
FOR_ALL_INDUSTRIES(i) {
|
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);
|
SetDParam(0, i->town->index);
|
||||||
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
|
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
|
||||||
|
|
|
@ -848,7 +848,7 @@ NetworkRecvStatus NetworkClient_ReadPackets(NetworkClientState *cs)
|
||||||
byte type = NetworkRecv_uint8(MY_CLIENT, p);
|
byte type = NetworkRecv_uint8(MY_CLIENT, p);
|
||||||
if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->quited) {
|
if (type < PACKET_END && _network_client_packet[type] != NULL && !MY_CLIENT->quited) {
|
||||||
res = _network_client_packet[type](p);
|
res = _network_client_packet[type](p);
|
||||||
} else {
|
} else {
|
||||||
res = NETWORK_RECV_STATUS_MALFORMED_PACKET;
|
res = NETWORK_RECV_STATUS_MALFORMED_PACKET;
|
||||||
DEBUG(net, 0)("[NET][client] Received invalid packet type %d", type);
|
DEBUG(net, 0)("[NET][client] Received invalid packet type %d", type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ static int NullVideoMainLoop(void)
|
||||||
GameLoop();
|
GameLoop();
|
||||||
_screen.dst_ptr = _null_video_mem;
|
_screen.dst_ptr = _null_video_mem;
|
||||||
UpdateWindows();
|
UpdateWindows();
|
||||||
} while (--i);
|
} while (--i);
|
||||||
return ML_QUIT;
|
return ML_QUIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ int ttd_main(int argc, char* argv[])
|
||||||
_config_file = strdup(mgo.opt);
|
_config_file = strdup(mgo.opt);
|
||||||
break;
|
break;
|
||||||
case -2:
|
case -2:
|
||||||
case 'h':
|
case 'h':
|
||||||
showhelp();
|
showhelp();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +751,7 @@ static void MakeNewGame(void)
|
||||||
// In a dedicated server, the server does not play
|
// In a dedicated server, the server does not play
|
||||||
if (_network_dedicated) {
|
if (_network_dedicated) {
|
||||||
_local_player = OWNER_SPECTATOR;
|
_local_player = OWNER_SPECTATOR;
|
||||||
} else {
|
} else {
|
||||||
// Create a single player
|
// Create a single player
|
||||||
DoStartupNewPlayer(false);
|
DoStartupNewPlayer(false);
|
||||||
|
|
||||||
|
@ -1220,7 +1220,7 @@ static void UpdateExclusiveRights(void)
|
||||||
Build an array town_blocked[ town_id ][ player_id ]
|
Build an array town_blocked[ town_id ][ player_id ]
|
||||||
that stores if at least one station in that town is blocked for a player
|
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
|
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.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
queue.c
4
queue.c
|
@ -534,7 +534,7 @@ void stat_Hash(Hash* h)
|
||||||
if (usage[i]) {
|
if (usage[i]) {
|
||||||
printf("%d:%d ", i, usage[i]);
|
printf("%d:%d ", i, usage[i]);
|
||||||
/*
|
/*
|
||||||
if (i>0){
|
if (i>0){
|
||||||
uint j;
|
uint j;
|
||||||
for (j=0;j<(usage[i] * 160 / 800);j++)
|
for (j=0;j<(usage[i] * 160 / 800);j++)
|
||||||
printf("#");
|
printf("#");
|
||||||
|
@ -566,7 +566,7 @@ void clear_Hash(Hash* h, bool free_values)
|
||||||
HashNode* prev = node;
|
HashNode* prev = node;
|
||||||
node = node->next;
|
node = node->next;
|
||||||
if (free_values)
|
if (free_values)
|
||||||
free(prev->value);
|
free(prev->value);
|
||||||
free(prev);
|
free(prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
saveload.c
12
saveload.c
|
@ -218,7 +218,7 @@ int SlIterateArray(void)
|
||||||
next_offs = SlGetOffs() + length;
|
next_offs = SlGetOffs() + length;
|
||||||
|
|
||||||
switch (_sl.block_mode) {
|
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;
|
case CH_ARRAY: index = _sl.array_index++; break;
|
||||||
default:
|
default:
|
||||||
DEBUG(misc, 0) ("SlIterateArray: error");
|
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
|
// Write the value to the file and check if its value is in the desired range
|
||||||
switch (conv & 0xF) {
|
switch (conv & 0xF) {
|
||||||
case SLE_FILE_I8: assert(x >= -128 && x <= 127); SlWriteByte(x);break;
|
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_I16:assert(x >= -32768 && x <= 32767); SlWriteUint16(x);break;
|
||||||
case SLE_FILE_STRINGID:
|
case SLE_FILE_STRINGID:
|
||||||
case SLE_FILE_U16:assert(x >= 0 && x <= 65535); SlWriteUint16(x);break;
|
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
|
length++; // a byte is logically of size 1
|
||||||
} else if (sld->cmd == SL_INCLUDE) {
|
} else if (sld->cmd == SL_INCLUDE) {
|
||||||
length += SlCalcObjLength(NULL, _sl.includes[sld->version_from]);
|
length += SlCalcObjLength(NULL, _sl.includes[sld->version_from]);
|
||||||
} else
|
} else
|
||||||
assert(sld->cmd == SL_END);
|
assert(sld->cmd == SL_END);
|
||||||
}
|
}
|
||||||
return length;
|
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 */
|
* include_index: common code to include from _desc_includes[], abused by sld->version_from */
|
||||||
} else if (sld->cmd == SL_INCLUDE) {
|
} else if (sld->cmd == SL_INCLUDE) {
|
||||||
SlObject(ptr, _sl.includes[sld->version_from]);
|
SlObject(ptr, _sl.includes[sld->version_from]);
|
||||||
} else
|
} else
|
||||||
assert(sld->cmd == SL_END);
|
assert(sld->cmd == SL_END);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ static void WriteZlibLoop(z_streamp z, byte *p, uint len, int mode)
|
||||||
do {
|
do {
|
||||||
z->next_out = buf;
|
z->next_out = buf;
|
||||||
z->avail_out = sizeof(buf);
|
z->avail_out = sizeof(buf);
|
||||||
r = deflate(z, mode);
|
r = deflate(z, mode);
|
||||||
// bytes were emitted?
|
// bytes were emitted?
|
||||||
if ((n=sizeof(buf) - z->avail_out) != 0) {
|
if ((n=sizeof(buf) - z->avail_out) != 0) {
|
||||||
if (fwrite(buf, n, 1, _sl.fh) != 1) SlError("file write error");
|
if (fwrite(buf, n, 1, _sl.fh) != 1) SlError("file write error");
|
||||||
|
@ -1437,7 +1437,7 @@ int GetSavegameType(char *file)
|
||||||
f = fopen(file, "rb");
|
f = fopen(file, "rb");
|
||||||
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
|
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
|
||||||
printf("Savegame is obsolete or invalid format.\n");
|
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 {
|
else {
|
||||||
// see if we have any loader for this type.
|
// see if we have any loader for this type.
|
||||||
|
|
6
sdl.c
6
sdl.c
|
@ -399,7 +399,7 @@ static const VkMapping _vk_mapping[] = {
|
||||||
|
|
||||||
static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
|
static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
|
||||||
{
|
{
|
||||||
const VkMapping *map;
|
const VkMapping *map;
|
||||||
uint key = 0;
|
uint key = 0;
|
||||||
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
|
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
|
||||||
if ((uint)(sym->sym - map->vk_from) <= map->vk_count) {
|
if ((uint)(sym->sym - map->vk_from) <= map->vk_count) {
|
||||||
|
@ -573,7 +573,7 @@ static int SdlVideoMainLoop(void)
|
||||||
while ((i = PollEvent()) == -1) {}
|
while ((i = PollEvent()) == -1) {}
|
||||||
if (i >= 0) return i;
|
if (i >= 0) return i;
|
||||||
|
|
||||||
if (_exit_game) return ML_QUIT;
|
if (_exit_game) return ML_QUIT;
|
||||||
|
|
||||||
mod = SDL_CALL SDL_GetModState();
|
mod = SDL_CALL SDL_GetModState();
|
||||||
keys = SDL_CALL SDL_GetKeyState(&numkeys);
|
keys = SDL_CALL SDL_GetKeyState(&numkeys);
|
||||||
|
@ -613,7 +613,7 @@ static int SdlVideoMainLoop(void)
|
||||||
CheckPaletteAnim();
|
CheckPaletteAnim();
|
||||||
pal_tick = 1;
|
pal_tick = 1;
|
||||||
}
|
}
|
||||||
DrawSurfaceToScreen();
|
DrawSurfaceToScreen();
|
||||||
} else {
|
} else {
|
||||||
SDL_CALL SDL_Delay(1);
|
SDL_CALL SDL_Delay(1);
|
||||||
_screen.dst_ptr = _sdl_screen->pixels;
|
_screen.dst_ptr = _sdl_screen->pixels;
|
||||||
|
|
|
@ -706,7 +706,7 @@ const void *GetRawSprite(SpriteID sprite)
|
||||||
#if defined(WANT_NEW_LRU)
|
#if defined(WANT_NEW_LRU)
|
||||||
_sprite_lru_new[sprite] = ++_sprite_lru_counter;
|
_sprite_lru_new[sprite] = ++_sprite_lru_counter;
|
||||||
#else
|
#else
|
||||||
_sprite_lru_cur[sprite] = ++_sprite_lru_counter;
|
_sprite_lru_cur[sprite] = ++_sprite_lru_counter;
|
||||||
_sprite_lru[sprite] = 0;
|
_sprite_lru[sprite] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ static const char * const _cached_filenames[4] = {
|
||||||
|
|
||||||
#define OPENTTD_SPRITES_COUNT 98
|
#define OPENTTD_SPRITES_COUNT 98
|
||||||
static const uint16 _openttd_grf_indexes[] = {
|
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
|
134, 134, // euro symbol medium size
|
||||||
582, 582, // euro symbol large size
|
582, 582, // euro symbol large size
|
||||||
358, 358, // euro symbol tiny
|
358, 358, // euro symbol tiny
|
||||||
|
|
|
@ -72,7 +72,7 @@ static int CDECL StationNameSorter(const void *a, const void *b)
|
||||||
GetString(_bufcache, st->string_id);
|
GetString(_bufcache, st->string_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return strcmp(buf1, _bufcache); // sort by name
|
return strcmp(buf1, _bufcache); // sort by name
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GlobalSortStationList(void)
|
static void GlobalSortStationList(void)
|
||||||
|
@ -93,7 +93,7 @@ static void GlobalSortStationList(void)
|
||||||
if(st->xy && st->owner != OWNER_NONE) {
|
if(st->xy && st->owner != OWNER_NONE) {
|
||||||
_station_sort[n].index = st->index;
|
_station_sort[n].index = st->index;
|
||||||
_station_sort[n++].owner = st->owner;
|
_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;
|
uint32 n = 0;
|
||||||
|
|
||||||
if (owner == 0) { // first element starts at 0th element and has n elements as described above
|
if (owner == 0) { // first element starts at 0th element and has n elements as described above
|
||||||
firstelement = &_station_sort[0];
|
firstelement = &_station_sort[0];
|
||||||
n = _num_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
|
} 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]];
|
firstelement = &_station_sort[_num_station_sort[owner - 1]];
|
||||||
n = _num_station_sort[owner] - _num_station_sort[owner-1];
|
n = _num_station_sort[owner] - _num_station_sort[owner - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
_last_station_idx = 0; // used for "cache" in namesorting
|
_last_station_idx = 0; // used for "cache" in namesorting
|
||||||
|
@ -165,18 +165,18 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||||
byte p = 0;
|
byte p = 0;
|
||||||
Station *st;
|
Station *st;
|
||||||
int x,xb = 2;
|
int x,xb = 2;
|
||||||
int y = 16; // offset from top of widget
|
int y = 16; // offset from top of widget
|
||||||
int j;
|
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);
|
DrawString(xb, y, STR_304A_NONE, 0);
|
||||||
return;
|
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
|
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);
|
st = GetStation(_station_sort[i].index);
|
||||||
|
|
||||||
assert(st->xy && st->owner == window_number);
|
assert(st->xy && st->owner == window_number);
|
||||||
|
@ -194,7 +194,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
y += 10;
|
y += 10;
|
||||||
i++; // next station
|
i++; // next station
|
||||||
if (++p == w->vscroll.cap) { break;} // max number of stations in 1 window
|
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;
|
const byte owner = (byte)w->window_number;
|
||||||
Station *st;
|
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
|
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(0, st->town->townnametype);
|
||||||
SetDParam(1, st->town->townnameparts);
|
SetDParam(1, st->town->townnameparts);
|
||||||
ShowQueryString(st->string_id, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number);
|
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 */
|
case 10: { /* Show a list of scheduled trains to this station */
|
||||||
const Station *st = GetStation(w->window_number);
|
const Station *st = GetStation(w->window_number);
|
||||||
|
|
|
@ -25,7 +25,7 @@ int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
|
||||||
SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
|
SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
|
||||||
|
|
||||||
/* Find player that has HQ flooded, and reset their location_of_house */
|
/* 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;
|
bool dodelete = false;
|
||||||
|
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
|
@ -171,7 +171,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
||||||
DrawGroundSprite(t->ground_sprite | ormod);
|
DrawGroundSprite(t->ground_sprite | ormod);
|
||||||
|
|
||||||
foreach_draw_tile_seq(dtss, t->seq) {
|
foreach_draw_tile_seq(dtss, t->seq) {
|
||||||
image = dtss->image;
|
image = dtss->image;
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) {
|
if (_display_opt & DO_TRANS_BUILDINGS) {
|
||||||
image = (image & 0x3FFF) | 0x03224000;
|
image = (image & 0x3FFF) | 0x03224000;
|
||||||
} else {
|
} else {
|
||||||
|
@ -202,7 +202,7 @@ static int32 ClearTile_Unmovable(TileIndex tile, byte flags)
|
||||||
return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
|
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);
|
return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
|
||||||
|
|
||||||
// checks if you're allowed to remove unmovable things
|
// 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) {
|
if (_map5[tile]==3 && new_player != 255) {
|
||||||
SetTileOwner(tile, new_player);
|
SetTileOwner(tile, new_player);
|
||||||
} else {
|
} else {
|
||||||
DoClearSquare(tile);
|
DoClearSquare(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,7 @@ Point GetTileZoomCenterWindow(bool in, Window * w)
|
||||||
|
|
||||||
vp = w->viewport;
|
vp = w->viewport;
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
x = ( (_cursor.pos.x - vp->left ) >> 1) + (vp->width >> 2);
|
x = ( (_cursor.pos.x - vp->left ) >> 1) + (vp->width >> 2);
|
||||||
y = ( (_cursor.pos.y - vp->top ) >> 1) + (vp->height >> 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 {
|
} else {
|
||||||
DeleteName(str);
|
DeleteName(str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
wp = GetWaypoint(p1);
|
wp = GetWaypoint(p1);
|
||||||
if (wp->string != STR_NULL)
|
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, xy, SLE_UINT32, 6, 255),
|
||||||
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, 255),
|
SLE_CONDVAR(Waypoint, town_index, SLE_UINT16, 12, 255),
|
||||||
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT8, 12, 255),
|
SLE_CONDVAR(Waypoint, town_cn, SLE_UINT8, 12, 255),
|
||||||
SLE_VAR(Waypoint,string, SLE_UINT16),
|
SLE_VAR(Waypoint, string, SLE_UINT16),
|
||||||
SLE_VAR(Waypoint,deleted, SLE_UINT8),
|
SLE_VAR(Waypoint, deleted, SLE_UINT8),
|
||||||
|
|
||||||
SLE_CONDVAR(Waypoint, build_date, SLE_UINT16, 3, 255),
|
SLE_CONDVAR(Waypoint, build_date, SLE_UINT16, 3, 255),
|
||||||
SLE_CONDVAR(Waypoint, stat_id, SLE_UINT8, 3, 255),
|
SLE_CONDVAR(Waypoint, stat_id, SLE_UINT8, 3, 255),
|
||||||
|
|
8
widget.c
8
widget.c
|
@ -20,7 +20,7 @@ static Point HandleScrollbarHittest(Scrollbar *sb, int top, int bottom)
|
||||||
count = sb->count;
|
count = sb->count;
|
||||||
cap = sb->cap;
|
cap = sb->cap;
|
||||||
|
|
||||||
if (count != 0) top += height * pos / count;
|
if (count != 0) top += height * pos / count;
|
||||||
|
|
||||||
if (cap > count) cap = count;
|
if (cap > count) cap = count;
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
|
@ -160,7 +160,8 @@ void DrawWindowWidgets(Window *w)
|
||||||
uint32 dparam_backup[20];
|
uint32 dparam_backup[20];
|
||||||
uint32 cur_click, cur_disabled, cur_hidden;
|
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;
|
wi = w->widget;
|
||||||
|
|
||||||
|
@ -425,7 +426,8 @@ void DrawWindowWidgets(Window *w)
|
||||||
|
|
||||||
DrawStringCentered( (r.left+r.right+1)>>1, r.top+2, wi->unkA, 0x84);
|
DrawStringCentered( (r.left+r.right+1)>>1, r.top+2, wi->unkA, 0x84);
|
||||||
restore_dparam:;
|
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:;
|
draw_default:;
|
||||||
if (cur_disabled & 1) {
|
if (cur_disabled & 1) {
|
||||||
GfxFillRect(r.left+1, r.top+1, r.right-1, r.bottom-1, _color_list[wi->color&0xF].unk2 | 0x8000);
|
GfxFillRect(r.left+1, r.top+1, r.right-1, r.bottom-1, _color_list[wi->color&0xF].unk2 | 0x8000);
|
||||||
|
|
13
win32.c
13
win32.c
|
@ -103,7 +103,7 @@ typedef struct {
|
||||||
#define AS(x, z) {x, 0, z}
|
#define AS(x, z) {x, 0, z}
|
||||||
#define AM(x, y, z, w) {x, y - x, z}
|
#define AM(x, y, z, w) {x, y - x, z}
|
||||||
|
|
||||||
#ifndef VK_OEM_3
|
#ifndef VK_OEM_3
|
||||||
#define VK_OEM_3 0xC0
|
#define VK_OEM_3 0xC0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ static uint MapWindowsKey(uint sym)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetAsyncKeyState(VK_SHIFT)<0) key |= WKC_SHIFT;
|
if (GetAsyncKeyState(VK_SHIFT) < 0) key |= WKC_SHIFT;
|
||||||
if (GetAsyncKeyState(VK_CONTROL)<0) key |= WKC_CTRL;
|
if (GetAsyncKeyState(VK_CONTROL) < 0) key |= WKC_CTRL;
|
||||||
if (GetAsyncKeyState(VK_MENU)<0) key |= WKC_ALT;
|
if (GetAsyncKeyState(VK_MENU) < 0) key |= WKC_ALT;
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
ClientSizeChanged(_wnd.width, _wnd.height);
|
ClientSizeChanged(_wnd.width, _wnd.height);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_SYSKEYDOWN: /* user presses F10 or Alt, both activating the title-menu */
|
case WM_SYSKEYDOWN: /* user presses F10 or Alt, both activating the title-menu */
|
||||||
switch (wParam) {
|
switch (wParam) {
|
||||||
|
@ -1073,7 +1073,8 @@ static uint32 *_crc_table;
|
||||||
|
|
||||||
static void MakeCRCTable(uint32 *table) {
|
static void MakeCRCTable(uint32 *table) {
|
||||||
uint32 crc, poly = 0xEDB88320L;
|
uint32 crc, poly = 0xEDB88320L;
|
||||||
int i, j;
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
_crc_table = table;
|
_crc_table = table;
|
||||||
|
|
||||||
|
|
16
window.c
16
window.c
|
@ -155,7 +155,7 @@ void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
|
||||||
|
|
||||||
while (++v != _last_window) {
|
while (++v != _last_window) {
|
||||||
if (right > v->left &&
|
if (right > v->left &&
|
||||||
bottom > v->top &&
|
bottom > v->top &&
|
||||||
left < v->left + v->width &&
|
left < v->left + v->width &&
|
||||||
top < v->top + v->height) {
|
top < v->top + v->height) {
|
||||||
|
|
||||||
|
@ -660,13 +660,13 @@ Window *AllocateWindowDesc(const WindowDesc *desc)
|
||||||
if (pt.x > _screen.width + 10 - desc->width)
|
if (pt.x > _screen.width + 10 - desc->width)
|
||||||
pt.x = (_screen.width + 10 - desc->width) - 20;
|
pt.x = (_screen.width + 10 - desc->width) - 20;
|
||||||
pt.y = w->top + 10;
|
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
|
/* 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 */
|
* The main toolbar (WC_MAIN_TOOLBAR) is 640px in width */
|
||||||
switch (_patches.toolbar_pos) {
|
switch (_patches.toolbar_pos) {
|
||||||
case 1: pt.x = ((_screen.width + 640) >> 1) - desc->width; break;
|
case 1: pt.x = ((_screen.width + 640) >> 1) - desc->width; break;
|
||||||
case 2: pt.x = _screen.width - desc->width; break;
|
case 2: pt.x = _screen.width - desc->width; break;
|
||||||
default: pt.x = 640 - desc->width;
|
default: pt.x = 640 - desc->width;
|
||||||
}
|
}
|
||||||
pt.y = desc->top;
|
pt.y = desc->top;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1641,9 +1641,9 @@ int PositionMainToolbar(Window *w)
|
||||||
w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
||||||
|
|
||||||
switch (_patches.toolbar_pos) {
|
switch (_patches.toolbar_pos) {
|
||||||
case 1: w->left = (_screen.width - w->width) >> 1; break;
|
case 1: w->left = (_screen.width - w->width) >> 1; break;
|
||||||
case 2: w->left = _screen.width - w->width; break;
|
case 2: w->left = _screen.width - w->width; break;
|
||||||
default: w->left = 0;
|
default: w->left = 0;
|
||||||
}
|
}
|
||||||
SetDirtyBlocks(0, 0, _screen.width, w->height); // invalidate the whole top part
|
SetDirtyBlocks(0, 0, _screen.width, w->height); // invalidate the whole top part
|
||||||
return w->left;
|
return w->left;
|
||||||
|
|
Loading…
Reference in New Issue