mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-09 19:10:38 +00:00
(svn r16432) -Feature(tte): use 'scrollto x y' in console to scroll to tile with given coordinates
This commit is contained in:
parent
272722f12f
commit
795231995d
@ -155,13 +155,14 @@ DEF_CONSOLE_CMD(ConStopAllVehicles)
|
||||
|
||||
DEF_CONSOLE_CMD(ConScrollToTile)
|
||||
{
|
||||
if (argc == 0) {
|
||||
IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'");
|
||||
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)");
|
||||
switch (argc) {
|
||||
case 0:
|
||||
IConsoleHelp("Center the screen on a given tile.");
|
||||
IConsoleHelp("Usage: 'scrollto <tile>' or 'scrollto <x> <y>'");
|
||||
IConsoleHelp("Numbers can be either decimal (34161) or hexadecimal (0x4a5B).");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
case 2: {
|
||||
uint32 result;
|
||||
if (GetArgumentInteger(&result, argv[1])) {
|
||||
if (result >= MapSize()) {
|
||||
@ -171,6 +172,21 @@ DEF_CONSOLE_CMD(ConScrollToTile)
|
||||
ScrollMainWindowToTile((TileIndex)result);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
uint32 x, y;
|
||||
if (GetArgumentInteger(&x, argv[1]) && GetArgumentInteger(&y, argv[2])) {
|
||||
if (x >= MapSizeX() || y >= MapSizeY()) {
|
||||
IConsolePrint(CC_ERROR, "Tile does not exist");
|
||||
return true;
|
||||
}
|
||||
ScrollMainWindowToTile(TileXY(x, y));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user