console_cmds.c
changeset 3431 e3b4bc9c4375
parent 3251 31e203063e43
child 3621 5d2e486e7a8b
equal deleted inserted replaced
3430:fcc344e41319 3431:e3b4bc9c4375
    88 #endif /* ENABLE_NETWORK */
    88 #endif /* ENABLE_NETWORK */
    89 
    89 
    90 static void IConsoleHelp(const char *str)
    90 static void IConsoleHelp(const char *str)
    91 {
    91 {
    92 	IConsolePrintF(_icolour_warn, "- %s", str);
    92 	IConsolePrintF(_icolour_warn, "- %s", str);
    93 }
       
    94 
       
    95 DEF_CONSOLE_CMD(ConResetSlots)
       
    96 {
       
    97 	Vehicle *v;
       
    98 	RoadStop *rs;
       
    99 	if (argc == 0) {
       
   100 		IConsoleHelp("Resets all slots in the game. For debugging only. Usage: 'clearslots'");
       
   101 		return true;
       
   102 	}
       
   103 
       
   104 	FOR_ALL_VEHICLES(v) {
       
   105 		if (IsValidVehicle(v)) {
       
   106 			if (v->type == VEH_Road)
       
   107 				ClearSlot(v);
       
   108 		}
       
   109 	}
       
   110 
       
   111 	FOR_ALL_ROADSTOPS(rs) {
       
   112 		int i;
       
   113 		for (i = 0; i < NUM_SLOTS; i++) rs->slot[i] = INVALID_VEHICLE;
       
   114 	}
       
   115 
       
   116 	return true;
       
   117 }
    93 }
   118 
    94 
   119 DEF_CONSOLE_CMD(ConStopAllVehicles)
    95 DEF_CONSOLE_CMD(ConStopAllVehicles)
   120 {
    96 {
   121 	Vehicle* v;
    97 	Vehicle* v;
  1387 	IConsoleCmdRegister("save",         ConSave);
  1363 	IConsoleCmdRegister("save",         ConSave);
  1388 	IConsoleCmdRegister("ls",           ConListFiles);
  1364 	IConsoleCmdRegister("ls",           ConListFiles);
  1389 	IConsoleCmdRegister("cd",           ConChangeDirectory);
  1365 	IConsoleCmdRegister("cd",           ConChangeDirectory);
  1390 	IConsoleCmdRegister("pwd",          ConPrintWorkingDirectory);
  1366 	IConsoleCmdRegister("pwd",          ConPrintWorkingDirectory);
  1391 	IConsoleCmdRegister("clear",        ConClearBuffer);
  1367 	IConsoleCmdRegister("clear",        ConClearBuffer);
  1392 	IConsoleCmdRegister("clearslots",   ConResetSlots);
       
  1393 	IConsoleCmdRegister("stopall",      ConStopAllVehicles);
  1368 	IConsoleCmdRegister("stopall",      ConStopAllVehicles);
  1394 
  1369 
  1395 	IConsoleAliasRegister("dir",      "ls");
  1370 	IConsoleAliasRegister("dir",      "ls");
  1396 	IConsoleAliasRegister("del",      "rm %+");
  1371 	IConsoleAliasRegister("del",      "rm %+");
  1397 	IConsoleAliasRegister("newmap",   "newgame");
  1372 	IConsoleAliasRegister("newmap",   "newgame");