Merge branch 'cpp-11' into crashlog_improvements

# Conflicts:
#	Makefile.src.in
#	projects/determineversion.vbs
#	source.list
#	src/crashlog.cpp
#	src/misc.cpp
#	src/os/unix/crashlog_unix.cpp
#	src/os/windows/crashlog_win.cpp
#	src/rev.h
#	src/thread/thread.h
#	src/thread/thread_morphos.cpp
#	src/thread/thread_none.cpp
#	src/thread/thread_os2.cpp
#	src/thread/thread_pthread.cpp
#	src/thread/thread_win32.cpp
This commit is contained in:
Jonathan G Rennison
2019-04-09 19:21:39 +01:00
820 changed files with 29187 additions and 22975 deletions

View File

@@ -62,7 +62,7 @@ public:
/**
* (Re-)validate the file storage cache. Only makes a change if the storage was invalid, or if \a force_reload.
* @param Always reload the file storage cache.
* @param force_reload Always reload the file storage cache.
*/
void ValidateFileList(bool force_reload = false)
{
@@ -86,8 +86,6 @@ static ConsoleFileList _console_file_list; ///< File storage cache for the conso
* command hooks
****************/
#ifdef ENABLE_NETWORK
/**
* Check network availability and inform in console about failure of detection.
* @return Network availability.
@@ -159,10 +157,6 @@ DEF_CONSOLE_HOOK(ConHookNoNetwork)
return CHR_ALLOW;
}
#else
# define ConHookNoNetwork NULL
#endif /* ENABLE_NETWORK */
DEF_CONSOLE_HOOK(ConHookNewGRFDeveloperTool)
{
if (_settings_client.gui.newgrf_developer_tools) {
@@ -170,11 +164,7 @@ DEF_CONSOLE_HOOK(ConHookNewGRFDeveloperTool)
if (echo) IConsoleError("This command is only available in game and editor.");
return CHR_DISALLOW;
}
#ifdef ENABLE_NETWORK
return ConHookNoNetwork(echo);
#else
return CHR_ALLOW;
#endif
}
return CHR_HIDE;
}
@@ -256,8 +246,8 @@ DEF_CONSOLE_CMD(ConResetTile)
/**
* Scroll to a tile on the map.
* @param arg1 tile tile number or tile x coordinate.
* @param arg2 optionally tile y coordinate.
* param x tile number or tile x coordinate.
* param y optional y coordinate.
* @note When only one argument is given it is intepreted as the tile number.
* When two arguments are given, they are interpreted as the tile's x
* and y coordinates.
@@ -304,7 +294,7 @@ DEF_CONSOLE_CMD(ConScrollToTile)
/**
* Save the map to a file.
* @param filename the filename to save the map to.
* param filename the filename to save the map to.
* @return True when help was displayed or the file attempted to be saved.
*/
DEF_CONSOLE_CMD(ConSave)
@@ -479,7 +469,6 @@ DEF_CONSOLE_CMD(ConClearBuffer)
/**********************************
* Network Core Console Commands
**********************************/
#ifdef ENABLE_NETWORK
static bool ConKickOrBan(const char *argv, bool ban)
{
@@ -563,21 +552,21 @@ DEF_CONSOLE_CMD(ConUnBan)
/* Try by IP. */
uint index;
for (index = 0; index < _network_ban_list.Length(); index++) {
for (index = 0; index < _network_ban_list.size(); index++) {
if (strcmp(_network_ban_list[index], argv[1]) == 0) break;
}
/* Try by index. */
if (index >= _network_ban_list.Length()) {
if (index >= _network_ban_list.size()) {
index = atoi(argv[1]) - 1U; // let it wrap
}
if (index < _network_ban_list.Length()) {
if (index < _network_ban_list.size()) {
char msg[64];
seprintf(msg, lastof(msg), "Unbanned %s", _network_ban_list[index]);
IConsolePrint(CC_DEFAULT, msg);
free(_network_ban_list[index]);
_network_ban_list.Erase(_network_ban_list.Get(index));
_network_ban_list.erase(_network_ban_list.begin() + index);
} else {
IConsolePrint(CC_DEFAULT, "Invalid list index or IP not in ban-list.");
IConsolePrint(CC_DEFAULT, "For a list of banned IP's, see the command 'banlist'");
@@ -596,8 +585,8 @@ DEF_CONSOLE_CMD(ConBanList)
IConsolePrint(CC_DEFAULT, "Banlist: ");
uint i = 1;
for (char **iter = _network_ban_list.Begin(); iter != _network_ban_list.End(); iter++, i++) {
IConsolePrintF(CC_DEFAULT, " %d) %s", i, *iter);
for (char *entry : _network_ban_list) {
IConsolePrintF(CC_DEFAULT, " %d) %s", i, entry);
}
return true;
@@ -836,7 +825,7 @@ DEF_CONSOLE_CMD(ConResetCompany)
}
/* It is safe to remove this company */
DoCommandP(0, 2 | index << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | index << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "Company deleted.");
return true;
@@ -930,8 +919,6 @@ DEF_CONSOLE_CMD(ConNetworkConnect)
return true;
}
#endif /* ENABLE_NETWORK */
/*********************************
* script file console commands
*********************************/
@@ -1178,7 +1165,7 @@ DEF_CONSOLE_CMD(ConStartAI)
}
/* Start a new AI company */
DoCommandP(0, 1 | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_NEW_AI | INVALID_COMPANY << 16, 0, CMD_COMPANY_CTRL);
return true;
}
@@ -1213,8 +1200,8 @@ DEF_CONSOLE_CMD(ConReloadAI)
}
/* First kill the company of the AI, then start a new one. This should start the current AI again */
DoCommandP(0, 2 | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, 1 | company_id << 16, 0, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0,CMD_COMPANY_CTRL);
DoCommandP(0, CCA_NEW_AI | company_id << 16, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "AI reloaded.");
return true;
@@ -1250,7 +1237,7 @@ DEF_CONSOLE_CMD(ConStopAI)
}
/* Now kill the company of the AI. */
DoCommandP(0, 2 | company_id << 16, CRR_MANUAL, CMD_COMPANY_CTRL);
DoCommandP(0, CCA_DELETE | company_id << 16 | CRR_MANUAL << 24, 0, CMD_COMPANY_CTRL);
IConsolePrint(CC_DEFAULT, "AI stopped, company deleted.");
return true;
@@ -1547,12 +1534,9 @@ DEF_CONSOLE_CMD(ConCompanies)
const char *password_state = "";
if (c->is_ai) {
password_state = "AI";
}
#ifdef ENABLE_NETWORK
else if (_network_server) {
} else if (_network_server) {
password_state = StrEmpty(_network_company_states[c->index].password) ? "unprotected" : "protected";
}
#endif
char colour[512];
GetString(colour, STR_COLOUR_DARK_BLUE + _company_colours[c->index], lastof(colour));
@@ -1569,8 +1553,6 @@ DEF_CONSOLE_CMD(ConCompanies)
return true;
}
#ifdef ENABLE_NETWORK
DEF_CONSOLE_CMD(ConSay)
{
if (argc == 0) {
@@ -1812,7 +1794,6 @@ DEF_CONSOLE_CMD(ConContent)
return false;
}
#endif /* defined(WITH_ZLIB) */
#endif /* ENABLE_NETWORK */
DEF_CONSOLE_CMD(ConSetting)
{
@@ -2005,7 +1986,7 @@ void IConsoleStdLibRegister()
IConsoleAliasRegister("players", "companies");
/* networking functions */
#ifdef ENABLE_NETWORK
/* Content downloading is only available with ZLIB */
#if defined(WITH_ZLIB)
IConsoleCmdRegister("content", ConContent);
@@ -2063,7 +2044,6 @@ void IConsoleStdLibRegister()
IConsoleAliasRegister("restart_game_year", "setting restart_game_year %+");
IConsoleAliasRegister("min_players", "setting min_active_clients %+");
IConsoleAliasRegister("reload_cfg", "setting reload_cfg %+");
#endif /* ENABLE_NETWORK */
/* debugging stuff */
#ifdef _DEBUG