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,21 +155,37 @@ DEF_CONSOLE_CMD(ConStopAllVehicles)
|
|||||||
|
|
||||||
DEF_CONSOLE_CMD(ConScrollToTile)
|
DEF_CONSOLE_CMD(ConScrollToTile)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
switch (argc) {
|
||||||
IConsoleHelp("Center the screen on a given tile. Usage: 'scrollto <tile>'");
|
case 0:
|
||||||
IConsoleHelp("Tile can be either decimal (34161) or hexadecimal (0x4a5B)");
|
IConsoleHelp("Center the screen on a given tile.");
|
||||||
return true;
|
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;
|
uint32 result;
|
||||||
if (GetArgumentInteger(&result, argv[1])) {
|
if (GetArgumentInteger(&result, argv[1])) {
|
||||||
if (result >= MapSize()) {
|
if (result >= MapSize()) {
|
||||||
IConsolePrint(CC_ERROR, "Tile does not exist");
|
IConsolePrint(CC_ERROR, "Tile does not exist");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ScrollMainWindowToTile((TileIndex)result);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ScrollMainWindowToTile((TileIndex)result);
|
break;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user