src/console_cmds.cpp
branchNewGRF_ports
changeset 6719 4cc327ad39d5
parent 6585 7da94b26498a
child 6720 35756db7e577
equal deleted inserted replaced
6718:5a8b295aa345 6719:4cc327ad39d5
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "console.h"
     7 #include "console.h"
     8 #include "debug.h"
     8 #include "debug.h"
     9 #include "engine.h"
     9 #include "engine.h"
    10 #include "functions.h"
    10 #include "functions.h"
       
    11 #include "landscape.h"
    11 #include "saveload.h"
    12 #include "saveload.h"
    12 #include "string.h"
    13 #include "string.h"
    13 #include "variables.h"
    14 #include "variables.h"
    14 #include "network/network_data.h"
    15 #include "network/network_data.h"
    15 #include "network/network_client.h"
    16 #include "network/network_client.h"
   139 	}
   140 	}
   140 
   141 
   141 	FOR_ALL_VEHICLES(v) {
   142 	FOR_ALL_VEHICLES(v) {
   142 		/* Code ripped from CmdStartStopTrain. Can't call it, because of
   143 		/* Code ripped from CmdStartStopTrain. Can't call it, because of
   143 		 * ownership problems, so we'll duplicate some code, for now */
   144 		 * ownership problems, so we'll duplicate some code, for now */
   144 		if (v->type == VEH_TRAIN)
       
   145 			v->u.rail.days_since_order_progr = 0;
       
   146 		v->vehstatus |= VS_STOPPED;
   145 		v->vehstatus |= VS_STOPPED;
   147 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
   146 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
   148 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   147 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
   149 	}
   148 	}
   150 	return true;
   149 	return true;
  1231 	FOR_ALL_PLAYERS(p) {
  1230 	FOR_ALL_PLAYERS(p) {
  1232 		char buffer[512];
  1231 		char buffer[512];
  1233 
  1232 
  1234 		if (!p->is_active) continue;
  1233 		if (!p->is_active) continue;
  1235 
  1234 
       
  1235 		const NetworkPlayerInfo *npi = &_network_player_info[p->index];
       
  1236 
  1236 		GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index], lastof(buffer));
  1237 		GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index], lastof(buffer));
  1237 		IConsolePrintF(8, "#:%d(%s) Company Name: '%s'  Year Founded: %d  Money: %d  Loan: %d  Value: %" OTTD_PRINTF64 "d  (T:%d, R:%d, P:%d, S:%d)",
  1238 		IConsolePrintF(8, "#:%d(%s) Company Name: '%s'  Year Founded: %d  Money: %d  Loan: %d  Value: %" OTTD_PRINTF64 "d  (T:%d, R:%d, P:%d, S:%d) %sprotected",
  1238 			p->index + 1, buffer, _network_player_info[p->index].company_name, p->inaugurated_year, p->player_money, p->current_loan, CalculateCompanyValue(p),
  1239 			p->index + 1, buffer, npi->company_name, p->inaugurated_year, p->player_money, p->current_loan, CalculateCompanyValue(p),
  1239 			/* trains      */ _network_player_info[p->index].num_vehicle[0],
  1240 			/* trains      */ npi->num_vehicle[0],
  1240 			/* lorry + bus */ _network_player_info[p->index].num_vehicle[1] + _network_player_info[p->index].num_vehicle[2],
  1241 			/* lorry + bus */ npi->num_vehicle[1] + npi->num_vehicle[2],
  1241 			/* planes      */ _network_player_info[p->index].num_vehicle[3],
  1242 			/* planes      */ npi->num_vehicle[3],
  1242 			/* ships       */ _network_player_info[p->index].num_vehicle[4]);
  1243 			/* ships       */ npi->num_vehicle[4],
       
  1244 			/* protected   */ StrEmpty(npi->password) ? "un" : "");
  1243 	}
  1245 	}
  1244 
  1246 
  1245 	return true;
  1247 	return true;
  1246 }
  1248 }
  1247 
  1249 
  1411 				IConsoleError("This command/variable is only available to a network server.");
  1413 				IConsoleError("This command/variable is only available to a network server.");
  1412 			}
  1414 			}
  1413 		}
  1415 		}
  1414 	}
  1416 	}
  1415 
  1417 
       
  1418 	return true;
       
  1419 }
       
  1420 
       
  1421 DEF_CONSOLE_CMD(ConListPatches)
       
  1422 {
       
  1423 	if (argc == 0) {
       
  1424 		IConsoleHelp("List patch options. Usage: 'list_patches'");
       
  1425 		return true;
       
  1426 	}
       
  1427 
       
  1428 	if (argc != 1) return false;
       
  1429 
       
  1430 	IConsoleListPatches();
  1416 	return true;
  1431 	return true;
  1417 }
  1432 }
  1418 
  1433 
  1419 DEF_CONSOLE_CMD(ConListDumpVariables)
  1434 DEF_CONSOLE_CMD(ConListDumpVariables)
  1420 {
  1435 {
  1495 	IConsoleCmdRegister("ls",           ConListFiles);
  1510 	IConsoleCmdRegister("ls",           ConListFiles);
  1496 	IConsoleCmdRegister("cd",           ConChangeDirectory);
  1511 	IConsoleCmdRegister("cd",           ConChangeDirectory);
  1497 	IConsoleCmdRegister("pwd",          ConPrintWorkingDirectory);
  1512 	IConsoleCmdRegister("pwd",          ConPrintWorkingDirectory);
  1498 	IConsoleCmdRegister("clear",        ConClearBuffer);
  1513 	IConsoleCmdRegister("clear",        ConClearBuffer);
  1499 	IConsoleCmdRegister("patch",        ConPatch);
  1514 	IConsoleCmdRegister("patch",        ConPatch);
       
  1515 	IConsoleCmdRegister("list_patches", ConListPatches);
  1500 
  1516 
  1501 	IConsoleAliasRegister("dir",      "ls");
  1517 	IConsoleAliasRegister("dir",      "ls");
  1502 	IConsoleAliasRegister("del",      "rm %+");
  1518 	IConsoleAliasRegister("del",      "rm %+");
  1503 	IConsoleAliasRegister("newmap",   "newgame");
  1519 	IConsoleAliasRegister("newmap",   "newgame");
  1504 	IConsoleAliasRegister("new_map",  "newgame");
  1520 	IConsoleAliasRegister("new_map",  "newgame");