Changeset - r25655:1030dcb7eb52
[Not reviewed]
master
! ! !
rubidium42 - 3 years ago 2021-06-12 07:10:17
rubidium@openttd.org
Codechange: convert printf DEBUG statements to fmt Debug statements
131 files changed with 601 insertions and 601 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_core.cpp
Show inline comments
 
@@ -207,7 +207,7 @@
 
	for (CompanyID c = COMPANY_FIRST; c < MAX_COMPANIES; c++) {
 
		if (_settings_game.ai_config[c] != nullptr && _settings_game.ai_config[c]->HasScript()) {
 
			if (!_settings_game.ai_config[c]->ResetInfo(true)) {
 
				DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
 
				Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
 
				_settings_game.ai_config[c]->Change(nullptr);
 
				if (Company::IsValidAiID(c)) {
 
					/* The code belonging to an already running AI was deleted. We can only do
 
@@ -224,7 +224,7 @@
 
		}
 
		if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
 
			if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
 
				DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
 
				Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
 
				_settings_newgame.ai_config[c]->Change(nullptr);
 
			}
 
		}
src/ai/ai_info.cpp
Show inline comments
 
@@ -89,7 +89,7 @@ template <> const char *GetClassName<AII
 
	if (info->engine->MethodExists(*info->SQ_instance, "GetAPIVersion")) {
 
		if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
 
		if (!CheckAPIVersion(info->api_version)) {
 
			DEBUG(script, 1, "Loading info.nut from (%s.%d): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
 
			Debug(script, 1, "Loading info.nut from ({}.{}): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
 
			return SQ_ERROR;
 
		}
 
	} else {
src/ai/ai_scanner.cpp
Show inline comments
 
@@ -66,7 +66,7 @@ AIInfo *AIScannerInfo::SelectRandomAI() 
 
	}
 

	
 
	if (num_random_ais == 0) {
 
		DEBUG(script, 0, "No suitable AI found, loading 'dummy' AI.");
 
		Debug(script, 0, "No suitable AI found, loading 'dummy' AI.");
 
		return this->info_dummy;
 
	}
 

	
src/aircraft_cmd.cpp
Show inline comments
 
@@ -1786,7 +1786,7 @@ static bool AirportMove(Aircraft *v, con
 
{
 
	/* error handling */
 
	if (v->pos >= apc->nofelements) {
 
		DEBUG(misc, 0, "[Ap] position %d is not valid for current airport. Max position is %d", v->pos, apc->nofelements-1);
 
		Debug(misc, 0, "[Ap] position {} is not valid for current airport. Max position is {}", v->pos, apc->nofelements-1);
 
		assert(v->pos < apc->nofelements);
 
	}
 

	
 
@@ -1825,7 +1825,7 @@ static bool AirportMove(Aircraft *v, con
 
		current = current->next;
 
	} while (current != nullptr);
 

	
 
	DEBUG(misc, 0, "[Ap] cannot move further on Airport! (pos %d state %d) for vehicle %d", v->pos, v->state, v->index);
 
	Debug(misc, 0, "[Ap] cannot move further on Airport! (pos {} state {}) for vehicle {}", v->pos, v->state, v->index);
 
	NOT_REACHED();
 
}
 

	
src/base_media_func.h
Show inline comments
 
@@ -22,8 +22,8 @@
 
#define fetch_metadata(name) \
 
	item = metadata->GetItem(name, false); \
 
	if (item == nullptr || !item->value.has_value() || item->value->empty()) { \
 
		DEBUG(grf, 0, "Base " SET_TYPE "set detail loading: %s field missing.", name); \
 
		DEBUG(grf, 0, "  Is %s readable for the user running OpenTTD?", full_filename); \
 
		Debug(grf, 0, "Base " SET_TYPE "set detail loading: {} field missing.", name); \
 
		Debug(grf, 0, "  Is {} readable for the user running OpenTTD?", full_filename); \
 
		return false; \
 
	}
 

	
 
@@ -74,7 +74,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
		/* Find the filename first. */
 
		item = files->GetItem(BaseSet<T, Tnum_files, Tsearch_in_tars>::file_names[i], false);
 
		if (item == nullptr || (!item->value.has_value() && !allow_empty_filename)) {
 
			DEBUG(grf, 0, "No " SET_TYPE " file for: %s (in %s)", BaseSet<T, Tnum_files, Tsearch_in_tars>::file_names[i], full_filename);
 
			Debug(grf, 0, "No " SET_TYPE " file for: {} (in {})", BaseSet<T, Tnum_files, Tsearch_in_tars>::file_names[i], full_filename);
 
			return false;
 
		}
 

	
 
@@ -92,7 +92,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
		/* Then find the MD5 checksum */
 
		item = md5s->GetItem(filename, false);
 
		if (item == nullptr || !item->value.has_value()) {
 
			DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
 
			Debug(grf, 0, "No MD5 checksum specified for: {} (in {})", filename, full_filename);
 
			return false;
 
		}
 
		const char *c = item->value->c_str();
 
@@ -105,7 +105,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
			} else if ('A' <= *c && *c <= 'F') {
 
				j = *c - 'A' + 10;
 
			} else {
 
				DEBUG(grf, 0, "Malformed MD5 checksum specified for: %s (in %s)", filename, full_filename);
 
				Debug(grf, 0, "Malformed MD5 checksum specified for: {} (in {})", filename, full_filename);
 
				return false;
 
			}
 
			if (i % 2 == 0) {
 
@@ -119,7 +119,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
		item = origin->GetItem(filename, false);
 
		if (item == nullptr) item = origin->GetItem("default", false);
 
		if (item == nullptr || !item->value.has_value()) {
 
			DEBUG(grf, 1, "No origin warning message specified for: %s", filename);
 
			Debug(grf, 1, "No origin warning message specified for: {}", filename);
 
			file->missing_warning = stredup("");
 
		} else {
 
			file->missing_warning = stredup(item->value->c_str());
 
@@ -136,12 +136,12 @@ bool BaseSet<T, Tnum_files, Tsearch_in_t
 
				break;
 

	
 
			case MD5File::CR_MISMATCH:
 
				DEBUG(grf, 1, "MD5 checksum mismatch for: %s (in %s)", filename, full_filename);
 
				Debug(grf, 1, "MD5 checksum mismatch for: {} (in {})", filename, full_filename);
 
				this->found_files++;
 
				break;
 

	
 
			case MD5File::CR_NO_FILE:
 
				DEBUG(grf, 1, "The file %s specified in %s is missing", filename, full_filename);
 
				Debug(grf, 1, "The file {} specified in {} is missing", filename, full_filename);
 
				break;
 
		}
 
	}
 
@@ -153,7 +153,7 @@ template <class Tbase_set>
 
bool BaseMedia<Tbase_set>::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename)
 
{
 
	bool ret = false;
 
	DEBUG(grf, 1, "Checking %s for base " SET_TYPE " set", filename.c_str());
 
	Debug(grf, 1, "Checking {} for base " SET_TYPE " set", filename);
 

	
 
	Tbase_set *set = new Tbase_set();
 
	IniFile *ini = new IniFile();
 
@@ -179,7 +179,7 @@ bool BaseMedia<Tbase_set>::AddFile(const
 
			/* The more complete set takes precedence over the version number. */
 
			if ((duplicate->valid_files == set->valid_files && duplicate->version >= set->version) ||
 
					duplicate->valid_files > set->valid_files) {
 
				DEBUG(grf, 1, "Not adding %s (%i) as base " SET_TYPE " set (duplicate, %s)", set->name.c_str(), set->version,
 
				Debug(grf, 1, "Not adding {} ({}) as base " SET_TYPE " set (duplicate, {})", set->name, set->version,
 
						duplicate->valid_files > set->valid_files ? "less valid files" : "lower version");
 
				set->next = BaseMedia<Tbase_set>::duplicate_sets;
 
				BaseMedia<Tbase_set>::duplicate_sets = set;
 
@@ -195,7 +195,7 @@ bool BaseMedia<Tbase_set>::AddFile(const
 
				 * version number until a new game is started which isn't a big problem */
 
				if (BaseMedia<Tbase_set>::used_set == duplicate) BaseMedia<Tbase_set>::used_set = set;
 

	
 
				DEBUG(grf, 1, "Removing %s (%i) as base " SET_TYPE " set (duplicate, %s)", duplicate->name.c_str(), duplicate->version,
 
				Debug(grf, 1, "Removing {} ({}) as base " SET_TYPE " set (duplicate, {})", duplicate->name, duplicate->version,
 
						duplicate->valid_files < set->valid_files ? "less valid files" : "lower version");
 
				duplicate->next = BaseMedia<Tbase_set>::duplicate_sets;
 
				BaseMedia<Tbase_set>::duplicate_sets = duplicate;
 
@@ -209,7 +209,7 @@ bool BaseMedia<Tbase_set>::AddFile(const
 
			ret = true;
 
		}
 
		if (ret) {
 
			DEBUG(grf, 1, "Adding %s (%i) as base " SET_TYPE " set", set->name.c_str(), set->version);
 
			Debug(grf, 1, "Adding {} ({}) as base " SET_TYPE " set", set->name, set->version);
 
		}
 
	} else {
 
		delete set;
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -307,7 +307,7 @@ void Blitter_32bppAnim::DrawColourMappin
 
		return;
 
	}
 

	
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
 
	Debug(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('{}')", pal);
 
}
 

	
 
void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
src/blitter/32bpp_simple.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ void Blitter_32bppSimple::DrawColourMapp
 
		return;
 
	}
 

	
 
	DEBUG(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('%d')", pal);
 
	Debug(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('{}')", pal);
 
}
 

	
 
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
src/blitter/factory.hpp
Show inline comments
 
@@ -70,7 +70,7 @@ protected:
 
			 */
 
			blitters.insert(Blitters::value_type(this->name, this));
 
		} else {
 
			DEBUG(driver, 1, "Not registering blitter %s as it is not usable", name);
 
			Debug(driver, 1, "Not registering blitter {} as it is not usable", name);
 
		}
 
	}
 

	
 
@@ -104,7 +104,7 @@ public:
 
		delete *GetActiveBlitter();
 
		*GetActiveBlitter() = newb;
 

	
 
		DEBUG(driver, 1, "Successfully %s blitter '%s'", name.empty() ? "probed" : "loaded", newb->GetName());
 
		Debug(driver, 1, "Successfully {} blitter '{}'", name.empty() ? "probed" : "loaded", newb->GetName());
 
		return newb;
 
	}
 

	
src/command.cpp
Show inline comments
 
@@ -696,7 +696,7 @@ CommandCost DoCommandPInternal(TileIndex
 
		if (!_networking || _generating_world || (cmd & CMD_NETWORK_COMMAND) != 0) {
 
			/* Log the failed command as well. Just to be able to be find
 
			 * causes of desyncs due to bad command test implementations. */
 
			DEBUG(desync, 1, "cmdf: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text.c_str(), GetCommandName(cmd));
 
			Debug(desync, 1, "cmdf: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
 
		}
 
		cur_company.Restore();
 
		return_dcpi(res);
 
@@ -716,7 +716,7 @@ CommandCost DoCommandPInternal(TileIndex
 
		 * reset the storages as we've not executed the command. */
 
		return_dcpi(CommandCost());
 
	}
 
	DEBUG(desync, 1, "cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text.c_str(), GetCommandName(cmd));
 
	Debug(desync, 1, "cmd: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
 

	
 
	/* Actually try and execute the command. If no cost-type is given
 
	 * use the construction one */
src/console.cpp
Show inline comments
 
@@ -271,7 +271,7 @@ static void IConsoleAliasExec(const ICon
 
	char  alias_buffer[ICON_MAX_STREAMSIZE] = { '\0' };
 
	char *alias_stream = alias_buffer;
 

	
 
	DEBUG(console, 6, "Requested command is an alias; parsing...");
 
	Debug(console, 6, "Requested command is an alias; parsing...");
 

	
 
	if (recurse_count > ICON_MAX_RECURSE) {
 
		IConsoleError("Too many alias expansions, recursion limit reached. Aborting");
 
@@ -372,7 +372,7 @@ void IConsoleCmdExec(const char *cmdstr,
 
		}
 
	}
 

	
 
	DEBUG(console, 4, "Executing cmdline: '%s'", cmdstr);
 
	Debug(console, 4, "Executing cmdline: '{}'", cmdstr);
 

	
 
	memset(&tokens, 0, sizeof(tokens));
 
	memset(&tokenstream, 0, sizeof(tokenstream));
 
@@ -432,7 +432,7 @@ void IConsoleCmdExec(const char *cmdstr,
 
	}
 

	
 
	for (uint i = 0; i < lengthof(tokens) && tokens[i] != nullptr; i++) {
 
		DEBUG(console, 8, "Token %d is: '%s'", i, tokens[i]);
 
		Debug(console, 8, "Token {} is: '{}'", i, tokens[i]);
 
	}
 

	
 
	if (StrEmpty(tokens[0])) return; // don't execute empty commands
src/core/backup_type.hpp
Show inline comments
 
@@ -51,7 +51,7 @@ struct Backup {
 
		{
 
			/* We cannot assert here, as missing restoration is 'normal' when exceptions are thrown.
 
			 * Exceptions are especially used to abort world generation. */
 
			DEBUG(misc, 0, "%s:%d: Backed-up value was not restored!", this->file, this->line);
 
			Debug(misc, 0, "{}:{}: Backed-up value was not restored!", this->file, this->line);
 
			this->Restore();
 
		}
 
	}
src/core/random_func.cpp
Show inline comments
 
@@ -72,7 +72,7 @@ void SetRandomSeed(uint32 seed)
 
uint32 DoRandom(int line, const char *file)
 
{
 
	if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) {
 
		DEBUG(random, 0, "%08x; %02x; %04x; %02x; %s:%d", _date, _date_fract, _frame_counter, (byte)_current_company, file, line);
 
		Debug(random, 0, "{:08x}; {:02x}; {:04x}; {:02x}; {}:{}", _date, _date_fract, _frame_counter, (byte)_current_company, file, line);
 
	}
 

	
 
	return _random.Next();
src/debug.h
Show inline comments
 
@@ -105,7 +105,7 @@ const char *GetDebugString();
 
#define TOC(str, count)\
 
	_sum_ += ottd_rdtsc() - _xxx_;\
 
	if (++_i_ == count) {\
 
		DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " [avg: %.1f]", str, _sum_, _sum_/(double)_i_);\
 
		Debug(misc, 0, "[{}] {} [avg: {:.1f}]", str, _sum_, _sum_/(double)_i_);\
 
		_i_ = 0;\
 
		_sum_ = 0;\
 
	}\
 
@@ -120,7 +120,7 @@ const char *GetDebugString();
 
#define TOCC(str, _count_)\
 
	_sum_ += (std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - _start_)).count();\
 
	if (++_i_ == _count_) {\
 
		DEBUG(misc, 0, "[%s] " OTTD_PRINTF64 " us [avg: %.1f us]", str, _sum_, _sum_/(double)_i_);\
 
		Debug(misc, 0, "[{}] {} us [avg: {:.1f} us]", str, _sum_, _sum_/(double)_i_);\
 
		_i_ = 0;\
 
		_sum_ = 0;\
 
	}\
src/driver.cpp
Show inline comments
 
@@ -121,13 +121,13 @@ bool DriverFactoryBase::SelectDriverImpl
 

	
 
				const char *err = newd->Start({});
 
				if (err == nullptr) {
 
					DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name);
 
					Debug(driver, 1, "Successfully probed {} driver '{}'", GetDriverTypeName(type), d->name);
 
					delete oldd;
 
					return true;
 
				}
 

	
 
				*GetActiveDriver(type) = oldd;
 
				DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err);
 
				Debug(driver, 1, "Probing {} driver '{}' failed with error: {}", GetDriverTypeName(type), d->name, err);
 
				delete newd;
 

	
 
				if (type == Driver::DT_VIDEO && _video_hw_accel && d->UsesHardwareAcceleration()) {
 
@@ -170,7 +170,7 @@ bool DriverFactoryBase::SelectDriverImpl
 
				usererror("Unable to load driver '%s'. The error was: %s", d->name, err);
 
			}
 

	
 
			DEBUG(driver, 1, "Successfully loaded %s driver '%s'", GetDriverTypeName(type), d->name);
 
			Debug(driver, 1, "Successfully loaded {} driver '{}'", GetDriverTypeName(type), d->name);
 
			delete *GetActiveDriver(type);
 
			*GetActiveDriver(type) = newd;
 
			return true;
src/fileio.cpp
Show inline comments
 
@@ -418,7 +418,7 @@ uint TarScanner::DoScan(Subdirectory sd)
 

	
 
/* static */ uint TarScanner::DoScan(TarScanner::Mode mode)
 
{
 
	DEBUG(misc, 1, "Scanning for tars");
 
	Debug(misc, 1, "Scanning for tars");
 
	TarScanner fs;
 
	uint num = 0;
 
	if (mode & TarScanner::BASESET) {
 
@@ -439,7 +439,7 @@ uint TarScanner::DoScan(Subdirectory sd)
 
		num += fs.DoScan(SCENARIO_DIR);
 
		num += fs.DoScan(HEIGHTMAP_DIR);
 
	}
 
	DEBUG(misc, 1, "Scan complete, found %d files", num);
 
	Debug(misc, 1, "Scan complete, found {} files", num);
 
	return num;
 
}
 

	
 
@@ -518,7 +518,7 @@ bool TarScanner::AddFile(const std::stri
 
			/* If we have only zeros in the block, it can be an end-of-file indicator */
 
			if (memcmp(&th, &empty[0], 512) == 0) continue;
 

	
 
			DEBUG(misc, 0, "The file '%s' isn't a valid tar-file", filename.c_str());
 
			Debug(misc, 0, "The file '{}' isn't a valid tar-file", filename);
 
			fclose(f);
 
			return false;
 
		}
 
@@ -555,7 +555,7 @@ bool TarScanner::AddFile(const std::stri
 
				/* Convert to lowercase and our PATHSEPCHAR */
 
				SimplifyFileName(name);
 

	
 
				DEBUG(misc, 6, "Found file in tar: %s (" PRINTF_SIZE " bytes, " PRINTF_SIZE " offset)", name, skip, pos);
 
				Debug(misc, 6, "Found file in tar: {} ({} bytes, {} offset)", name, skip, pos);
 
				if (_tar_filelist[this->subdir].insert(TarFileList::value_type(name, entry)).second) num++;
 

	
 
				break;
 
@@ -574,7 +574,7 @@ bool TarScanner::AddFile(const std::stri
 

	
 
				/* Only allow relative links */
 
				if (link[0] == PATHSEPCHAR) {
 
					DEBUG(misc, 1, "Ignoring absolute link in tar: %s -> %s", name, link);
 
					Debug(misc, 1, "Ignoring absolute link in tar: {} -> {}", name, link);
 
					break;
 
				}
 

	
 
@@ -600,7 +600,7 @@ bool TarScanner::AddFile(const std::stri
 
					} else if (strcmp(pos, "..") == 0) {
 
						/* level up */
 
						if (dest[0] == '\0') {
 
							DEBUG(misc, 1, "Ignoring link pointing outside of data directory: %s -> %s", name, link);
 
							Debug(misc, 1, "Ignoring link pointing outside of data directory: {} -> {}", name, link);
 
							break;
 
						}
 

	
 
@@ -616,7 +616,7 @@ bool TarScanner::AddFile(const std::stri
 
					}
 

	
 
					if (destpos >= lastof(dest)) {
 
						DEBUG(misc, 0, "The length of a link in tar-file '%s' is too large (malformed?)", filename.c_str());
 
						Debug(misc, 0, "The length of a link in tar-file '{}' is too large (malformed?)", filename);
 
						fclose(f);
 
						return false;
 
					}
 
@@ -625,7 +625,7 @@ bool TarScanner::AddFile(const std::stri
 
				}
 

	
 
				/* Store links in temporary list */
 
				DEBUG(misc, 6, "Found link in tar: %s -> %s", name, dest);
 
				Debug(misc, 6, "Found link in tar: {} -> {}", name, dest);
 
				links.insert(TarLinkList::value_type(name, dest));
 

	
 
				break;
 
@@ -636,7 +636,7 @@ bool TarScanner::AddFile(const std::stri
 
				SimplifyFileName(name);
 

	
 
				/* Store the first directory name we detect */
 
				DEBUG(misc, 6, "Found dir in tar: %s", name);
 
				Debug(misc, 6, "Found dir in tar: {}", name);
 
				if (_tar_list[this->subdir][filename].empty()) _tar_list[this->subdir][filename] = name;
 
				break;
 

	
 
@@ -648,14 +648,14 @@ bool TarScanner::AddFile(const std::stri
 
		/* Skip to the next block.. */
 
		skip = Align(skip, 512);
 
		if (fseek(f, skip, SEEK_CUR) < 0) {
 
			DEBUG(misc, 0, "The file '%s' can't be read as a valid tar-file", filename.c_str());
 
			Debug(misc, 0, "The file '{}' can't be read as a valid tar-file", filename);
 
			fclose(f);
 
			return false;
 
		}
 
		pos += skip;
 
	}
 

	
 
	DEBUG(misc, 1, "Found tar '%s' with " PRINTF_SIZE " new files", filename.c_str(), num);
 
	Debug(misc, 1, "Found tar '{}' with {} new files", filename, num);
 
	fclose(f);
 

	
 
	/* Resolve file links and store directory links.
 
@@ -693,7 +693,7 @@ bool ExtractTar(const std::string &tar_f
 

	
 
	/* The file doesn't have a sub directory! */
 
	if (dirname.empty()) {
 
		DEBUG(misc, 1, "Extracting %s failed; archive rejected, the contents must be in a sub directory", tar_filename.c_str());
 
		Debug(misc, 1, "Extracting {} failed; archive rejected, the contents must be in a sub directory", tar_filename);
 
		return false;
 
	}
 

	
 
@@ -703,7 +703,7 @@ bool ExtractTar(const std::string &tar_f
 
	if (p == std::string::npos) return false;
 

	
 
	filename.replace(p + 1, std::string::npos, dirname);
 
	DEBUG(misc, 8, "Extracting %s to directory %s", tar_filename.c_str(), filename.c_str());
 
	Debug(misc, 8, "Extracting {} to directory {}", tar_filename, filename);
 
	FioCreateDirectory(filename);
 

	
 
	for (TarFileList::iterator it2 = _tar_filelist[subdir].begin(); it2 != _tar_filelist[subdir].end(); it2++) {
 
@@ -711,20 +711,20 @@ bool ExtractTar(const std::string &tar_f
 

	
 
		filename.replace(p + 1, std::string::npos, it2->first);
 

	
 
		DEBUG(misc, 9, "  extracting %s", filename.c_str());
 
		Debug(misc, 9, "  extracting {}", filename);
 

	
 
		/* First open the file in the .tar. */
 
		size_t to_copy = 0;
 
		std::unique_ptr<FILE, FileDeleter> in(FioFOpenFileTar(it2->second, &to_copy));
 
		if (!in) {
 
			DEBUG(misc, 6, "Extracting %s failed; could not open %s", filename.c_str(), tar_filename.c_str());
 
			Debug(misc, 6, "Extracting {} failed; could not open {}", filename, tar_filename);
 
			return false;
 
		}
 

	
 
		/* Now open the 'output' file. */
 
		std::unique_ptr<FILE, FileDeleter> out(fopen(filename.c_str(), "wb"));
 
		if (!out) {
 
			DEBUG(misc, 6, "Extracting %s failed; could not open %s", filename.c_str(), filename.c_str());
 
			Debug(misc, 6, "Extracting {} failed; could not open {}", filename, filename);
 
			return false;
 
		}
 

	
 
@@ -737,12 +737,12 @@ bool ExtractTar(const std::string &tar_f
 
		}
 

	
 
		if (to_copy != 0) {
 
			DEBUG(misc, 6, "Extracting %s failed; still %i bytes to copy", filename.c_str(), (int)to_copy);
 
			Debug(misc, 6, "Extracting {} failed; still {} bytes to copy", filename, to_copy);
 
			return false;
 
		}
 
	}
 

	
 
	DEBUG(misc, 9, "  extraction successful");
 
	Debug(misc, 9, "  extraction successful");
 
	return true;
 
}
 

	
 
@@ -778,7 +778,7 @@ static bool ChangeWorkingDirectoryToExec
 
	if (s != nullptr) {
 
		*s = '\0';
 
		if (chdir(tmp) != 0) {
 
			DEBUG(misc, 0, "Directory with the binary does not exist?");
 
			Debug(misc, 0, "Directory with the binary does not exist?");
 
		} else {
 
			success = true;
 
		}
 
@@ -937,7 +937,7 @@ void DetermineBasePaths(const char *exe)
 
	if (cwd[0] != '\0') {
 
		/* Go back to the current working directory. */
 
		if (chdir(cwd) != 0) {
 
			DEBUG(misc, 0, "Failed to return to working directory!");
 
			Debug(misc, 0, "Failed to return to working directory!");
 
		}
 
	}
 

	
 
@@ -990,7 +990,7 @@ void DeterminePaths(const char *exe, boo
 

	
 
	for (Searchpath sp : _valid_searchpaths) {
 
		if (sp == SP_WORKING_DIR && !_do_scan_working_directory) continue;
 
		DEBUG(misc, 4, "%s added as search path", _searchpaths[sp].c_str());
 
		Debug(misc, 4, "{} added as search path", _searchpaths[sp]);
 
	}
 

	
 
	std::string config_dir;
 
@@ -1023,7 +1023,7 @@ void DeterminePaths(const char *exe, boo
 
		_config_file = config_dir + "openttd.cfg";
 
	}
 

	
 
	DEBUG(misc, 3, "%s found as config directory", config_dir.c_str());
 
	Debug(misc, 3, "{} found as config directory", config_dir);
 

	
 
	_highscore_file = config_dir + "hs.dat";
 
	extern std::string _hotkeys_file;
 
@@ -1055,7 +1055,7 @@ void DeterminePaths(const char *exe, boo
 
	FioCreateDirectory(_personal_dir);
 
#endif
 

	
 
	DEBUG(misc, 3, "%s found as personal directory", _personal_dir.c_str());
 
	Debug(misc, 3, "{} found as personal directory", _personal_dir);
 

	
 
	static const Subdirectory default_subdirs[] = {
 
		SAVE_DIR, AUTOSAVE_DIR, SCENARIO_DIR, HEIGHTMAP_DIR, BASESET_DIR, NEWGRF_DIR, AI_DIR, AI_LIBRARY_DIR, GAME_DIR, GAME_LIBRARY_DIR, SCREENSHOT_DIR
 
@@ -1067,7 +1067,7 @@ void DeterminePaths(const char *exe, boo
 

	
 
	/* If we have network we make a directory for the autodownloading of content */
 
	_searchpaths[SP_AUTODOWNLOAD_DIR] = _personal_dir + "content_download" PATHSEP;
 
	DEBUG(misc, 4, "%s added as search path", _searchpaths[SP_AUTODOWNLOAD_DIR].c_str());
 
	Debug(misc, 4, "{} added as search path", _searchpaths[SP_AUTODOWNLOAD_DIR]);
 
	FioCreateDirectory(_searchpaths[SP_AUTODOWNLOAD_DIR]);
 
	FillValidSearchPaths(only_local_path);
 

	
src/fontcache.cpp
Show inline comments
 
@@ -259,16 +259,16 @@ TrueTypeFontCache::GlyphEntry *TrueTypeF
 
void TrueTypeFontCache::SetGlyphPtr(GlyphID key, const GlyphEntry *glyph, bool duplicate)
 
{
 
	if (this->glyph_to_sprite == nullptr) {
 
		DEBUG(freetype, 3, "Allocating root glyph cache for size %u", this->fs);
 
		Debug(freetype, 3, "Allocating root glyph cache for size {}", this->fs);
 
		this->glyph_to_sprite = CallocT<GlyphEntry*>(256);
 
	}
 

	
 
	if (this->glyph_to_sprite[GB(key, 8, 8)] == nullptr) {
 
		DEBUG(freetype, 3, "Allocating glyph cache for range 0x%02X00, size %u", GB(key, 8, 8), this->fs);
 
		Debug(freetype, 3, "Allocating glyph cache for range 0x{:02X}00, size {}", GB(key, 8, 8), this->fs);
 
		this->glyph_to_sprite[GB(key, 8, 8)] = CallocT<GlyphEntry>(256);
 
	}
 

	
 
	DEBUG(freetype, 4, "Set glyph for unicode character 0x%04X, size %u", key, this->fs);
 
	Debug(freetype, 4, "Set glyph for unicode character 0x{:04X}, size {}", key, this->fs);
 
	this->glyph_to_sprite[GB(key, 8, 8)][GB(key, 0, 8)].sprite = glyph->sprite;
 
	this->glyph_to_sprite[GB(key, 8, 8)][GB(key, 0, 8)].width = glyph->width;
 
	this->glyph_to_sprite[GB(key, 8, 8)][GB(key, 0, 8)].duplicate = duplicate;
 
@@ -468,7 +468,7 @@ void FreeTypeFontCache::SetFontSize(Font
 
		this->height       = this->ascender - this->descender;
 
	} else {
 
		/* Both FT_Set_Pixel_Sizes and FT_Select_Size failed. */
 
		DEBUG(freetype, 0, "Font size selection failed. Using FontCache defaults.");
 
		Debug(freetype, 0, "Font size selection failed. Using FontCache defaults.");
 
	}
 
}
 

	
 
@@ -498,7 +498,7 @@ static void LoadFreeTypeFont(FontSize fs
 
			return;
 
		}
 

	
 
		DEBUG(freetype, 2, "Initialized");
 
		Debug(freetype, 2, "Initialized");
 
	}
 

	
 
	const char *font_name = settings->font.c_str();
 
@@ -527,7 +527,7 @@ static void LoadFreeTypeFont(FontSize fs
 
	if (error != FT_Err_Ok) error = GetFontByFaceName(font_name, &face);
 

	
 
	if (error == FT_Err_Ok) {
 
		DEBUG(freetype, 2, "Requested '%s', using '%s %s'", font_name, face->family_name, face->style_name);
 
		Debug(freetype, 2, "Requested '{}', using '{} {}'", font_name, face->family_name, face->style_name);
 

	
 
		/* Attempt to select the unicode character map */
 
		error = FT_Select_Charmap(face, ft_encoding_unicode);
src/game/game_core.cpp
Show inline comments
 
@@ -169,7 +169,7 @@
 
	 *  the GameConfig. If not, remove the Game from the list. */
 
	if (_settings_game.game_config != nullptr && _settings_game.game_config->HasScript()) {
 
		if (!_settings_game.game_config->ResetInfo(true)) {
 
			DEBUG(script, 0, "After a reload, the GameScript by the name '%s' was no longer found, and removed from the list.", _settings_game.game_config->GetName());
 
			Debug(script, 0, "After a reload, the GameScript by the name '{}' was no longer found, and removed from the list.", _settings_game.game_config->GetName());
 
			_settings_game.game_config->Change(nullptr);
 
			if (Game::instance != nullptr) {
 
				delete Game::instance;
 
@@ -182,7 +182,7 @@
 
	}
 
	if (_settings_newgame.game_config != nullptr && _settings_newgame.game_config->HasScript()) {
 
		if (!_settings_newgame.game_config->ResetInfo(false)) {
 
			DEBUG(script, 0, "After a reload, the GameScript by the name '%s' was no longer found, and removed from the list.", _settings_newgame.game_config->GetName());
 
			Debug(script, 0, "After a reload, the GameScript by the name '{}' was no longer found, and removed from the list.", _settings_newgame.game_config->GetName());
 
			_settings_newgame.game_config->Change(nullptr);
 
		}
 
	}
src/game/game_info.cpp
Show inline comments
 
@@ -75,7 +75,7 @@ template <> const char *GetClassName<Gam
 
	if (!info->CheckMethod("GetAPIVersion")) return SQ_ERROR;
 
	if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetAPIVersion", &info->api_version, MAX_GET_OPS)) return SQ_ERROR;
 
	if (!CheckAPIVersion(info->api_version)) {
 
		DEBUG(script, 1, "Loading info.nut from (%s.%d): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
 
		Debug(script, 1, "Loading info.nut from ({}.{}): GetAPIVersion returned invalid version", info->GetName(), info->GetVersion());
 
		return SQ_ERROR;
 
	}
 

	
src/game/game_text.cpp
Show inline comments
 
@@ -32,7 +32,7 @@ void CDECL strgen_warning(const char *s,
 
	va_start(va, s);
 
	vseprintf(buf, lastof(buf), s, va);
 
	va_end(va);
 
	DEBUG(script, 0, "%s:%d: warning: %s", _file, _cur_line, buf);
 
	Debug(script, 0, "{}:{}: warning: {}", _file, _cur_line, buf);
 
	_warnings++;
 
}
 

	
 
@@ -43,7 +43,7 @@ void CDECL strgen_error(const char *s, .
 
	va_start(va, s);
 
	vseprintf(buf, lastof(buf), s, va);
 
	va_end(va);
 
	DEBUG(script, 0, "%s:%d: error: %s", _file, _cur_line, buf);
 
	Debug(script, 0, "{}:{}: error: {}", _file, _cur_line, buf);
 
	_errors++;
 
}
 

	
 
@@ -54,7 +54,7 @@ void NORETURN CDECL strgen_fatal(const c
 
	va_start(va, s);
 
	vseprintf(buf, lastof(buf), s, va);
 
	va_end(va);
 
	DEBUG(script, 0, "%s:%d: FATAL: %s", _file, _cur_line, buf);
 
	Debug(script, 0, "{}:{}: FATAL: {}", _file, _cur_line, buf);
 
	throw std::exception();
 
}
 

	
src/gamelog.cpp
Show inline comments
 
@@ -356,7 +356,7 @@ static int _gamelog_print_level = 0; ///
 

	
 
static void GamelogPrintDebugProc(const char *s)
 
{
 
	DEBUG(gamelog, _gamelog_print_level, "%s", s);
 
	Debug(gamelog, _gamelog_print_level, "{}", s);
 
}
 

	
 

	
src/genworld.cpp
Show inline comments
 
@@ -91,7 +91,7 @@ static void _GenerateWorld()
 

	
 
	try {
 
		_generating_world = true;
 
		if (_network_dedicated) DEBUG(net, 3, "Generating map, please wait...");
 
		if (_network_dedicated) Debug(net, 3, "Generating map, please wait...");
 
		/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
 
		if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
 
		_random.SetSeed(_settings_game.game_creation.generation_seed);
 
@@ -188,8 +188,8 @@ static void _GenerateWorld()
 

	
 
		ShowNewGRFError();
 

	
 
		if (_network_dedicated) DEBUG(net, 3, "Map generated, starting game");
 
		DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed);
 
		if (_network_dedicated) Debug(net, 3, "Map generated, starting game");
 
		Debug(desync, 1, "new_map: {:08x}", _settings_game.game_creation.generation_seed);
 

	
 
		if (_debug_desync_level > 0) {
 
			char name[MAX_PATH];
 
@@ -204,7 +204,7 @@ static void _GenerateWorld()
 

	
 
		if (_network_dedicated) {
 
			/* Exit the game to prevent a return to main menu.  */
 
			DEBUG(net, 0, "Generating map failed; closing server");
 
			Debug(net, 0, "Generating map failed; closing server");
 
			_exit_game = true;
 
		} else {
 
			SwitchToMode(_switch_mode);
src/genworld_gui.cpp
Show inline comments
 
@@ -1458,7 +1458,7 @@ static void _SetGeneratingWorldProgress(
 
		/* Never show steps smaller than 2%, even if it is a mod 5% */
 
		if (_gws.percent <= last_percent + 2) return;
 

	
 
		DEBUG(net, 3, "Map generation percentage complete: %d", _gws.percent);
 
		Debug(net, 3, "Map generation percentage complete: {}", _gws.percent);
 
		last_percent = _gws.percent;
 

	
 
		return;
src/gfx.cpp
Show inline comments
 
@@ -1915,7 +1915,7 @@ bool ToggleFullScreen(bool fs)
 
{
 
	bool result = VideoDriver::GetInstance()->ToggleFullscreen(fs);
 
	if (_fullscreen != fs && _resolutions.empty()) {
 
		DEBUG(driver, 0, "Could not find a suitable fullscreen resolution");
 
		Debug(driver, 0, "Could not find a suitable fullscreen resolution");
 
	}
 
	return result;
 
}
src/gfx_layout.cpp
Show inline comments
 
@@ -696,7 +696,7 @@ Layouter::Layouter(const char *str, int 
 
			if (line.layout == nullptr) {
 
				static bool warned = false;
 
				if (!warned) {
 
					DEBUG(misc, 0, "ICU layouter bailed on the font. Falling back to the fallback layouter");
 
					Debug(misc, 0, "ICU layouter bailed on the font. Falling back to the fallback layouter");
 
					warned = true;
 
				}
 

	
src/gfxinit.cpp
Show inline comments
 
@@ -49,7 +49,7 @@ static uint LoadGrfFile(const char *file
 

	
 
	SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
 

	
 
	DEBUG(sprite, 2, "Reading grf-file '%s'", filename);
 
	Debug(sprite, 2, "Reading grf-file '{}'", filename);
 

	
 
	byte container_ver = file.GetContainerVersion();
 
	if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename);
 
@@ -67,7 +67,7 @@ static uint LoadGrfFile(const char *file
 
			usererror("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
 
		}
 
	}
 
	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
 
	Debug(sprite, 2, "Currently {} sprites are loaded", load_index);
 

	
 
	return load_index - load_index_org;
 
}
 
@@ -86,7 +86,7 @@ static void LoadGrfFileIndexed(const cha
 

	
 
	SpriteFile &file = OpenCachedSpriteFile(filename, BASESET_DIR, needs_palette_remap);
 

	
 
	DEBUG(sprite, 2, "Reading indexed grf-file '%s'", filename);
 
	Debug(sprite, 2, "Reading indexed grf-file '{}'", filename);
 

	
 
	byte container_ver = file.GetContainerVersion();
 
	if (container_ver == 0) usererror("Base grf '%s' is corrupt", filename);
 
@@ -119,7 +119,7 @@ void CheckExternalFiles()
 

	
 
	const GraphicsSet *used_set = BaseGraphics::GetUsedSet();
 

	
 
	DEBUG(grf, 1, "Using the %s base graphics set", used_set->name.c_str());
 
	Debug(grf, 1, "Using the {} base graphics set", used_set->name);
 

	
 
	static const size_t ERROR_MESSAGE_LENGTH = 256;
 
	static const size_t MISSING_FILE_MESSAGE_LENGTH = 128;
 
@@ -223,7 +223,7 @@ static void LoadSpriteTables()
 

	
 
	uint total_extra_graphics = SPR_NEWGRFS_BASE - SPR_OPENTTD_BASE;
 
	_missing_extra_graphics = GetSpriteCountForFile(master_filename, SPR_OPENTTD_BASE, SPR_NEWGRFS_BASE);
 
	DEBUG(sprite, 1, "%u extra sprites, %u from baseset, %u from fallback", total_extra_graphics, total_extra_graphics - _missing_extra_graphics, _missing_extra_graphics);
 
	Debug(sprite, 1, "{} extra sprites, {} from baseset, {} from fallback", total_extra_graphics, total_extra_graphics - _missing_extra_graphics, _missing_extra_graphics);
 

	
 
	/* The original baseset extra graphics intentionally make use of the fallback graphics.
 
	 * Let's say everything which provides less than 500 sprites misses the rest intentionally. */
 
@@ -241,10 +241,10 @@ static void RealChangeBlitter(const char
 
	const char *cur_blitter = BlitterFactory::GetCurrentBlitter()->GetName();
 
	if (strcmp(cur_blitter, repl_blitter) == 0) return;
 

	
 
	DEBUG(driver, 1, "Switching blitter from '%s' to '%s'... ", cur_blitter, repl_blitter);
 
	Debug(driver, 1, "Switching blitter from '{}' to '{}'... ", cur_blitter, repl_blitter);
 
	Blitter *new_blitter = BlitterFactory::SelectBlitter(repl_blitter);
 
	if (new_blitter == nullptr) NOT_REACHED();
 
	DEBUG(driver, 1, "Successfully switched to %s.", repl_blitter);
 
	Debug(driver, 1, "Successfully switched to {}.", repl_blitter);
 

	
 
	if (!VideoDriver::GetInstance()->AfterBlitterChange()) {
 
		/* Failed to switch blitter, let's hope we can return to the old one. */
 
@@ -343,7 +343,7 @@ void CheckBlitter()
 
/** Initialise and load all the sprites. */
 
void GfxLoadSprites()
 
{
 
	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
 
	Debug(sprite, 2, "Loading sprite set {}", _settings_game.game_creation.landscape);
 

	
 
	SwitchNewGRFBlitter();
 
	VideoDriver::GetInstance()->ClearSystemSprites();
src/highscore.cpp
Show inline comments
 
@@ -138,7 +138,7 @@ void SaveToHighScore()
 
						fwrite(hs->company, length, 1, fp)           >  1 || // Yes... could be 0 bytes too
 
						fwrite(&hs->score, sizeof(hs->score), 1, fp) != 1 ||
 
						fwrite("  ", 2, 1, fp)                       != 1) { // XXX - placeholder for hs->title, not saved anymore; compatibility
 
					DEBUG(misc, 1, "Could not save highscore.");
 
					Debug(misc, 1, "Could not save highscore.");
 
					i = SP_SAVED_HIGHSCORE_END;
 
					break;
 
				}
 
@@ -166,7 +166,7 @@ void LoadFromHighScore()
 
						fread(hs->company, std::min<int>(lengthof(hs->company), length), 1, fp) >   1 || // Yes... could be 0 bytes too
 
						fread(&hs->score, sizeof(hs->score), 1, fp)                        !=  1 ||
 
						fseek(fp, 2, SEEK_CUR)                                             == -1) { // XXX - placeholder for hs->title, not saved anymore; compatibility
 
					DEBUG(misc, 1, "Highscore corrupted");
 
					Debug(misc, 1, "Highscore corrupted");
 
					i = SP_SAVED_HIGHSCORE_END;
 
					break;
 
				}
src/ini.cpp
Show inline comments
 
@@ -112,7 +112,7 @@ bool IniFile::SaveToDisk(const std::stri
 
	SHFileOperation(&shfopt);
 
#else
 
	if (rename(file_new.c_str(), filename.c_str()) < 0) {
 
		DEBUG(misc, 0, "Renaming %s to %s failed; configuration not saved", file_new.c_str(), filename.c_str());
 
		Debug(misc, 0, "Renaming {} to {} failed; configuration not saved", file_new, filename);
 
	}
 
#endif
 

	
src/map.cpp
Show inline comments
 
@@ -47,7 +47,7 @@ void AllocateMap(uint size_x, uint size_
 
		error("Invalid map size");
 
	}
 

	
 
	DEBUG(map, 1, "Allocating map of size %dx%d", size_x, size_y);
 
	Debug(map, 1, "Allocating map of size {}x{}", size_x, size_y);
 

	
 
	_map_log_x = FindFirstBit(size_x);
 
	_map_log_y = FindFirstBit(size_y);
src/misc_gui.cpp
Show inline comments
 
@@ -117,17 +117,17 @@ public:
 
#else
 
#	define LANDINFOD_LEVEL 1
 
#endif
 
		DEBUG(misc, LANDINFOD_LEVEL, "TILE: %#x (%i,%i)", tile, TileX(tile), TileY(tile));
 
		DEBUG(misc, LANDINFOD_LEVEL, "type   = %#x", _m[tile].type);
 
		DEBUG(misc, LANDINFOD_LEVEL, "height = %#x", _m[tile].height);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m1     = %#x", _m[tile].m1);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m2     = %#x", _m[tile].m2);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m3     = %#x", _m[tile].m3);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m4     = %#x", _m[tile].m4);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m5     = %#x", _m[tile].m5);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m6     = %#x", _me[tile].m6);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m7     = %#x", _me[tile].m7);
 
		DEBUG(misc, LANDINFOD_LEVEL, "m8     = %#x", _me[tile].m8);
 
		Debug(misc, LANDINFOD_LEVEL, "TILE: {:#x} ({},{})", tile, TileX(tile), TileY(tile));
 
		Debug(misc, LANDINFOD_LEVEL, "type   = {:#x}", _m[tile].type);
 
		Debug(misc, LANDINFOD_LEVEL, "height = {:#x}", _m[tile].height);
 
		Debug(misc, LANDINFOD_LEVEL, "m1     = {:#x}", _m[tile].m1);
 
		Debug(misc, LANDINFOD_LEVEL, "m2     = {:#x}", _m[tile].m2);
 
		Debug(misc, LANDINFOD_LEVEL, "m3     = {:#x}", _m[tile].m3);
 
		Debug(misc, LANDINFOD_LEVEL, "m4     = {:#x}", _m[tile].m4);
 
		Debug(misc, LANDINFOD_LEVEL, "m5     = {:#x}", _m[tile].m5);
 
		Debug(misc, LANDINFOD_LEVEL, "m6     = {:#x}", _me[tile].m6);
 
		Debug(misc, LANDINFOD_LEVEL, "m7     = {:#x}", _me[tile].m7);
 
		Debug(misc, LANDINFOD_LEVEL, "m8     = {:#x}", _me[tile].m8);
 
#undef LANDINFOD_LEVEL
 
	}
 

	
src/music.cpp
Show inline comments
 
@@ -141,7 +141,7 @@ bool MusicSet::FillSetDetails(IniFile *i
 
				this->songinfo[i].cat_index = atoi(item->value->c_str());
 
				char *songname = GetMusicCatEntryName(filename, this->songinfo[i].cat_index);
 
				if (songname == nullptr) {
 
					DEBUG(grf, 0, "Base music set song missing from CAT file: %s/%d", filename, this->songinfo[i].cat_index);
 
					Debug(grf, 0, "Base music set song missing from CAT file: {}/{}", filename, this->songinfo[i].cat_index);
 
					this->songinfo[i].songname[0] = '\0';
 
					continue;
 
				}
 
@@ -168,7 +168,7 @@ bool MusicSet::FillSetDetails(IniFile *i
 
				if (item != nullptr && item->value.has_value() && !item->value->empty()) {
 
					strecpy(this->songinfo[i].songname, item->value->c_str(), lastof(this->songinfo[i].songname));
 
				} else {
 
					DEBUG(grf, 0, "Base music set song name missing: %s", filename);
 
					Debug(grf, 0, "Base music set song name missing: {}", filename);
 
					return false;
 
				}
 
			}
src/music/allegro_m.cpp
Show inline comments
 
@@ -29,20 +29,20 @@ extern int _allegro_instance_count;
 
const char *MusicDriver_Allegro::Start(const StringList &param)
 
{
 
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
 
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
 
		Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error);
 
		return "Failed to set up Allegro";
 
	}
 
	_allegro_instance_count++;
 

	
 
	/* Initialise the sound */
 
	if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, nullptr) != 0) {
 
		DEBUG(driver, 0, "allegro: install_sound failed '%s'", allegro_error);
 
		Debug(driver, 0, "allegro: install_sound failed '{}'", allegro_error);
 
		return "Failed to set up Allegro sound";
 
	}
 

	
 
	/* Okay, there's no soundcard */
 
	if (midi_card == MIDI_NONE) {
 
		DEBUG(driver, 0, "allegro: no midi card found");
 
		Debug(driver, 0, "allegro: no midi card found");
 
		return "No sound card found";
 
	}
 

	
src/music/cocoa_m.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ static void DoSetVolume()
 
		}
 
	}
 
	if (output_unit == nullptr) {
 
		DEBUG(driver, 1, "cocoa_m: Failed to get output node to set volume");
 
		Debug(driver, 1, "cocoa_m: Failed to get output node to set volume");
 
		return;
 
	}
 

	
 
@@ -119,7 +119,7 @@ void MusicDriver_Cocoa::PlaySong(const M
 
{
 
	std::string filename = MidiFile::GetSMFFile(song);
 

	
 
	DEBUG(driver, 2, "cocoa_m: trying to play '%s'", filename.c_str());
 
	Debug(driver, 2, "cocoa_m: trying to play '{}'", filename);
 

	
 
	this->StopSong();
 
	if (_sequence != nullptr) {
 
@@ -130,7 +130,7 @@ void MusicDriver_Cocoa::PlaySong(const M
 
	if (filename.empty()) return;
 

	
 
	if (NewMusicSequence(&_sequence) != noErr) {
 
		DEBUG(driver, 0, "cocoa_m: Failed to create music sequence");
 
		Debug(driver, 0, "cocoa_m: Failed to create music sequence");
 
		return;
 
	}
 

	
 
@@ -138,7 +138,7 @@ void MusicDriver_Cocoa::PlaySong(const M
 
	CFAutoRelease<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8*)os_file.c_str(), os_file.length(), false));
 

	
 
	if (MusicSequenceFileLoad(_sequence, url.get(), kMusicSequenceFile_AnyType, 0) != noErr) {
 
		DEBUG(driver, 0, "cocoa_m: Failed to load MIDI file");
 
		Debug(driver, 0, "cocoa_m: Failed to load MIDI file");
 
		return;
 
	}
 

	
 
@@ -148,7 +148,7 @@ void MusicDriver_Cocoa::PlaySong(const M
 
	MusicSequenceGetAUGraph(_sequence, &graph);
 
	AUGraphOpen(graph);
 
	if (AUGraphInitialize(graph) != noErr) {
 
		DEBUG(driver, 0, "cocoa_m: Failed to initialize AU graph");
 
		Debug(driver, 0, "cocoa_m: Failed to initialize AU graph");
 
		return;
 
	}
 

	
 
@@ -173,7 +173,7 @@ void MusicDriver_Cocoa::PlaySong(const M
 
	if (MusicPlayerStart(_player) != noErr) return;
 
	_playing = true;
 

	
 
	DEBUG(driver, 3, "cocoa_m: playing '%s'", filename.c_str());
 
	Debug(driver, 3, "cocoa_m: playing '{}'", filename);
 
}
 

	
 

	
src/music/dmusic.cpp
Show inline comments
 
@@ -229,7 +229,7 @@ bool DLSFile::ReadDLSRegion(FILE *f, DWO
 
				break;
 

	
 
			default:
 
				DEBUG(driver, 7, "DLS: Ignoring unknown chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				fseek(f, chunk.length, SEEK_CUR);
 
				break;
 
		}
 
@@ -252,11 +252,11 @@ bool DLSFile::ReadDLSRegionList(FILE *f,
 
			if (list_type == FOURCC_RGN) {
 
				this->ReadDLSRegion(f, chunk.length - sizeof(list_type), instrument.regions);
 
			} else {
 
				DEBUG(driver, 7, "DLS: Ignoring unknown list chunk of type %c%c%c%c", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown list chunk of type {}{}{}{}", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				fseek(f, chunk.length - sizeof(list_type), SEEK_CUR);
 
			}
 
		} else {
 
			DEBUG(driver, 7, "DLS: Ignoring chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			Debug(driver, 7, "DLS: Ignoring chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			fseek(f, chunk.length, SEEK_CUR);
 
		}
 
	}
 
@@ -299,7 +299,7 @@ bool DLSFile::ReadDLSInstrument(FILE *f,
 
				break;
 

	
 
			default:
 
				DEBUG(driver, 7, "DLS: Ignoring unknown chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				fseek(f, chunk.length, SEEK_CUR);
 
				break;
 
		}
 
@@ -320,15 +320,15 @@ bool DLSFile::ReadDLSInstrumentList(FILE
 
			if (fread(&list_type, sizeof(list_type), 1, f) != 1) return false;
 

	
 
			if (list_type == FOURCC_INS) {
 
				DEBUG(driver, 6, "DLS: Reading instrument %d", (int)instruments.size());
 
				Debug(driver, 6, "DLS: Reading instrument {}", (int)instruments.size());
 

	
 
				if (!this->ReadDLSInstrument(f, chunk.length - sizeof(list_type))) return false;
 
			} else {
 
				DEBUG(driver, 7, "DLS: Ignoring unknown list chunk of type %c%c%c%c", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown list chunk of type {}{}{}{}", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				fseek(f, chunk.length - sizeof(list_type), SEEK_CUR);
 
			}
 
		} else {
 
			DEBUG(driver, 7, "DLS: Ignoring chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			Debug(driver, 7, "DLS: Ignoring chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			fseek(f, chunk.length, SEEK_CUR);
 
		}
 
	}
 
@@ -387,7 +387,7 @@ bool DLSFile::ReadDLSWave(FILE *f, DWORD
 
				break;
 

	
 
			default:
 
				DEBUG(driver, 7, "DLS: Ignoring unknown chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				fseek(f, chunk.length, SEEK_CUR);
 
				break;
 
		}
 
@@ -412,15 +412,15 @@ bool DLSFile::ReadDLSWaveList(FILE *f, D
 
			if (fread(&list_type, sizeof(list_type), 1, f) != 1) return false;
 

	
 
			if (list_type == FOURCC_wave) {
 
				DEBUG(driver, 6, "DLS: Reading wave %d", (int)waves.size());
 
				Debug(driver, 6, "DLS: Reading wave {}", waves.size());
 

	
 
				if (!this->ReadDLSWave(f, chunk.length - sizeof(list_type), chunk_offset - base_offset)) return false;
 
			} else {
 
				DEBUG(driver, 7, "DLS: Ignoring unknown list chunk of type %c%c%c%c", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown list chunk of type {}{}{}{}", (char)(list_type & 0xFF), (char)((list_type >> 8) & 0xFF), (char)((list_type >> 16) & 0xFF), (char)((list_type >> 24) & 0xFF));
 
				fseek(f, chunk.length - sizeof(list_type), SEEK_CUR);
 
			}
 
		} else {
 
			DEBUG(driver, 7, "DLS: Ignoring chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			Debug(driver, 7, "DLS: Ignoring chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
			fseek(f, chunk.length, SEEK_CUR);
 
		}
 
	}
 
@@ -430,7 +430,7 @@ bool DLSFile::ReadDLSWaveList(FILE *f, D
 

	
 
bool DLSFile::LoadFile(const wchar_t *file)
 
{
 
	DEBUG(driver, 2, "DMusic: Try to load DLS file %s", FS2OTTD(file).c_str());
 
	Debug(driver, 2, "DMusic: Try to load DLS file {}", FS2OTTD(file));
 

	
 
	FILE *f = _wfopen(file, L"rb");
 
	if (f == nullptr) return false;
 
@@ -446,7 +446,7 @@ bool DLSFile::LoadFile(const wchar_t *fi
 

	
 
	hdr.length -= sizeof(FOURCC);
 

	
 
	DEBUG(driver, 2, "DMusic: Parsing DLS file");
 
	Debug(driver, 2, "DMusic: Parsing DLS file");
 

	
 
	DLSHEADER header;
 
	MemSetT(&header, 0);
 
@@ -495,7 +495,7 @@ bool DLSFile::LoadFile(const wchar_t *fi
 
				break;
 

	
 
			default:
 
				DEBUG(driver, 7, "DLS: Ignoring unknown chunk %c%c%c%c", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				Debug(driver, 7, "DLS: Ignoring unknown chunk {}{}{}{}", (char)(chunk.type & 0xFF), (char)((chunk.type >> 8) & 0xFF), (char)((chunk.type >> 16) & 0xFF), (char)((chunk.type >> 24) & 0xFF));
 
				fseek(f, chunk.length, SEEK_CUR);
 
				break;
 
		}
 
@@ -585,7 +585,7 @@ static void TransmitNotesOff(IDirectMusi
 

	
 
static void MidiThreadProc()
 
{
 
	DEBUG(driver, 2, "DMusic: Entering playback thread");
 
	Debug(driver, 2, "DMusic: Entering playback thread");
 

	
 
	REFERENCE_TIME last_volume_time = 0; // timestamp of the last volume change
 
	REFERENCE_TIME block_time = 0;       // timestamp of the last block sent to the port
 
@@ -617,7 +617,7 @@ static void MidiThreadProc()
 
		}
 

	
 
		if (_playback.do_stop) {
 
			DEBUG(driver, 2, "DMusic thread: Stopping playback");
 
			Debug(driver, 2, "DMusic thread: Stopping playback");
 

	
 
			/* Turn all notes off and wait a bit to allow the messages to be handled. */
 
			clock->GetTime(&cur_time);
 
@@ -632,7 +632,7 @@ static void MidiThreadProc()
 

	
 
		if (wfso == WAIT_OBJECT_0) {
 
			if (_playback.do_start) {
 
				DEBUG(driver, 2, "DMusic thread: Starting playback");
 
				Debug(driver, 2, "DMusic thread: Starting playback");
 
				{
 
					/* New scope to limit the time the mutex is locked. */
 
					std::lock_guard<std::mutex> lock(_thread_mutex);
 
@@ -669,14 +669,14 @@ static void MidiThreadProc()
 
					preload_bytes += block.data.size();
 
					if (block.ticktime >= current_segment.start) {
 
						if (current_segment.loop) {
 
							DEBUG(driver, 2, "DMusic: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime) / 1000.0, (int)preload_bytes);
 
							Debug(driver, 2, "DMusic: timer: loop from block {} (ticktime {}, realtime {:.3f}, bytes {})", bl, block.ticktime, ((int)block.realtime) / 1000.0, preload_bytes);
 
							current_segment.start_block = bl;
 
							break;
 
						} else {
 
							/* Skip the transmission delay compensation performed in the Win32 MIDI driver.
 
							 * The DMusic driver will most likely be used with the MS softsynth, which is not subject to transmission delays.
 
							 */
 
							DEBUG(driver, 2, "DMusic: timer: start from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime) / 1000.0, (int)preload_bytes);
 
							Debug(driver, 2, "DMusic: timer: start from block {} (ticktime {}, realtime {:.3f}, bytes {})", bl, block.ticktime, ((int)block.realtime) / 1000.0, preload_bytes);
 
							playback_start_time -= block.realtime * MIDITIME_TO_REFTIME;
 
							break;
 
						}
 
@@ -691,7 +691,7 @@ static void MidiThreadProc()
 
			/* Check for volume change. */
 
			if (current_volume != _playback.new_volume) {
 
				if (current_time - last_volume_time > 10 * MS_TO_REFTIME) {
 
					DEBUG(driver, 2, "DMusic thread: volume change");
 
					Debug(driver, 2, "DMusic thread: volume change");
 
					current_volume = _playback.new_volume;
 
					last_volume_time = current_time;
 
					for (int ch = 0; ch < 16; ch++) {
 
@@ -709,7 +709,7 @@ static void MidiThreadProc()
 
				/* check that block isn't at end-of-song override */
 
				if (current_segment.end > 0 && block.ticktime >= current_segment.end) {
 
					if (current_segment.loop) {
 
						DEBUG(driver, 2, "DMusic thread: Looping song");
 
						Debug(driver, 2, "DMusic thread: Looping song");
 
						current_block = current_segment.start_block;
 
						playback_start_time = current_time - current_file.blocks[current_block].realtime * MIDITIME_TO_REFTIME;
 
					} else {
 
@@ -723,13 +723,13 @@ static void MidiThreadProc()
 
				if (block.realtime * MIDITIME_TO_REFTIME > playback_time +  3 *_playback.preload_time * MS_TO_REFTIME) {
 
					/* Stop the thread loop until we are at the preload time of the next block. */
 
					next_timeout = Clamp(((int64)block.realtime * MIDITIME_TO_REFTIME - playback_time) / MS_TO_REFTIME - _playback.preload_time, 0, 1000);
 
					DEBUG(driver, 9, "DMusic thread: Next event in %lu ms (music %u, ref " OTTD_PRINTF64 ")", next_timeout, block.realtime * MIDITIME_TO_REFTIME, playback_time);
 
					Debug(driver, 9, "DMusic thread: Next event in {} ms (music {}, ref {})", next_timeout, block.realtime * MIDITIME_TO_REFTIME, playback_time);
 
					break;
 
				}
 

	
 
				/* Timestamp of the current block. */
 
				block_time = playback_start_time + block.realtime * MIDITIME_TO_REFTIME;
 
				DEBUG(driver, 9, "DMusic thread: Streaming block " PRINTF_SIZE " (cur=" OTTD_PRINTF64 ", block=" OTTD_PRINTF64 ")", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
 
				Debug(driver, 9, "DMusic thread: Streaming block {} (cur={}, block={})", current_block, (long long)(current_time / MS_TO_REFTIME), (long long)(block_time / MS_TO_REFTIME));
 

	
 
				const byte *data = block.data.data();
 
				size_t remaining = block.data.size();
 
@@ -822,7 +822,7 @@ static void MidiThreadProc()
 
		}
 
	}
 

	
 
	DEBUG(driver, 2, "DMusic: Exiting playback thread");
 
	Debug(driver, 2, "DMusic: Exiting playback thread");
 

	
 
	/* Turn all notes off and wait a bit to allow the messages to be handled by real hardware. */
 
	clock->GetTime(&cur_time);
 
@@ -867,7 +867,7 @@ static const char *LoadDefaultDLSFile(co
 
				if (SUCCEEDED(RegQueryValueEx(hkDM, L"GMFilePath", nullptr, nullptr, (LPBYTE)dls_path, &buf_size))) {
 
					wchar_t expand_path[MAX_PATH * 2];
 
					ExpandEnvironmentStrings(dls_path, expand_path, lengthof(expand_path));
 
					if (!dls_file.LoadFile(expand_path)) DEBUG(driver, 1, "Failed to load default GM DLS file from registry");
 
					if (!dls_file.LoadFile(expand_path)) Debug(driver, 1, "Failed to load default GM DLS file from registry");
 
				}
 
				RegCloseKey(hkDM);
 
			}
 
@@ -1100,10 +1100,10 @@ const char *MusicDriver_DMusic::Start(co
 
		MemSetT(&caps, 0);
 
		caps.dwSize = sizeof(DMUS_PORTCAPS);
 

	
 
		DEBUG(driver, 1, "Detected DirectMusic ports:");
 
		Debug(driver, 1, "Detected DirectMusic ports:");
 
		for (int i = 0; _music->EnumPort(i, &caps) == S_OK; i++) {
 
			if (caps.dwClass == DMUS_PC_OUTPUTCLASS) {
 
				DEBUG(driver, 1, " %d: %s%s", i, convert_from_fs(caps.wszDescription, desc, lengthof(desc)), i == pIdx ? " (selected)" : "");
 
				Debug(driver, 1, " {}: {}{}", i, convert_from_fs(caps.wszDescription, desc, lengthof(desc)), i == pIdx ? " (selected)" : "");
 
			}
 
		}
 
	}
src/music/extmidi.cpp
Show inline comments
 
@@ -110,7 +110,7 @@ bool MusicDriver_ExtMidi::IsSongPlaying(
 

	
 
void MusicDriver_ExtMidi::SetVolume(byte vol)
 
{
 
	DEBUG(driver, 1, "extmidi: set volume not implemented");
 
	Debug(driver, 1, "extmidi: set volume not implemented");
 
}
 

	
 
void MusicDriver_ExtMidi::DoPlay()
 
@@ -127,7 +127,7 @@ void MusicDriver_ExtMidi::DoPlay()
 
		}
 

	
 
		case -1:
 
			DEBUG(driver, 0, "extmidi: couldn't fork: %s", strerror(errno));
 
			Debug(driver, 0, "extmidi: couldn't fork: {}", strerror(errno));
 
			FALLTHROUGH;
 

	
 
		default:
 
@@ -153,7 +153,7 @@ void MusicDriver_ExtMidi::DoStop()
 
		CSleep(10);
 
	}
 

	
 
	DEBUG(driver, 0, "extmidi: gracefully stopping failed, trying the hard way");
 
	Debug(driver, 0, "extmidi: gracefully stopping failed, trying the hard way");
 
	/* Gracefully stopping failed. Do it the hard way
 
	 * and wait till the process finally died. */
 
	kill(this->pid, SIGKILL);
src/music/fluidsynth.cpp
Show inline comments
 
@@ -65,7 +65,7 @@ const char *MusicDriver_FluidSynth::Star
 
	const char *sfont_name = GetDriverParam(param, "soundfont");
 
	int sfont_id;
 

	
 
	DEBUG(driver, 1, "Fluidsynth: sf %s", sfont_name);
 
	Debug(driver, 1, "Fluidsynth: sf {}", sfont_name);
 

	
 
	/* Create the settings. */
 
	_midi.settings = new_fluid_settings();
 
@@ -76,7 +76,7 @@ const char *MusicDriver_FluidSynth::Star
 
	/* Install the music render routine and set up the samplerate */
 
	uint32 samplerate = MxSetMusicSource(RenderMusicStream);
 
	fluid_settings_setnum(_midi.settings, "synth.sample-rate", samplerate);
 
	DEBUG(driver, 1, "Fluidsynth: samplerate %.0f", (float)samplerate);
 
	Debug(driver, 1, "Fluidsynth: samplerate {:.0f}", (float)samplerate);
 

	
 
	/* Create the synthesizer. */
 
	_midi.synth = new_fluid_synth(_midi.settings);
 
@@ -143,18 +143,18 @@ void MusicDriver_FluidSynth::PlaySong(co
 

	
 
	_midi.player = new_fluid_player(_midi.synth);
 
	if (_midi.player == nullptr) {
 
		DEBUG(driver, 0, "Could not create midi player");
 
		Debug(driver, 0, "Could not create midi player");
 
		return;
 
	}
 

	
 
	if (fluid_player_add(_midi.player, filename.c_str()) != FLUID_OK) {
 
		DEBUG(driver, 0, "Could not open music file");
 
		Debug(driver, 0, "Could not open music file");
 
		delete_fluid_player(_midi.player);
 
		_midi.player = nullptr;
 
		return;
 
	}
 
	if (fluid_player_play(_midi.player) != FLUID_OK) {
 
		DEBUG(driver, 0, "Could not start midi player");
 
		Debug(driver, 0, "Could not start midi player");
 
		delete_fluid_player(_midi.player);
 
		_midi.player = nullptr;
 
		return;
 
@@ -194,6 +194,6 @@ void MusicDriver_FluidSynth::SetVolume(b
 
	 * and 0.2. */
 
	double gain = (1.0 * vol) / (128.0 * 5.0);
 
	if (fluid_settings_setnum(_midi.settings, "synth.gain", gain) != FLUID_OK) {
 
		DEBUG(driver, 0, "Could not set volume");
 
		Debug(driver, 0, "Could not set volume");
 
	}
 
}
src/music/win32_m.cpp
Show inline comments
 
@@ -115,7 +115,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 

	
 
	/* check for stop */
 
	if (_midi.do_stop) {
 
		DEBUG(driver, 2, "Win32-MIDI: timer: do_stop is set");
 
		Debug(driver, 2, "Win32-MIDI: timer: do_stop is set");
 
		midiOutReset(_midi.midi_out);
 
		_midi.playing = false;
 
		_midi.do_stop = false;
 
@@ -128,7 +128,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 
		if (timeGetTime() - _midi.playback_start_time < 50) {
 
			return;
 
		}
 
		DEBUG(driver, 2, "Win32-MIDI: timer: do_start step %d", _midi.do_start);
 
		Debug(driver, 2, "Win32-MIDI: timer: do_start step {}", _midi.do_start);
 

	
 
		if (_midi.do_start == 1) {
 
			/* Send "all notes off" */
 
@@ -165,7 +165,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 
		}
 
	} else if (!_midi.playing) {
 
		/* not playing, stop the timer */
 
		DEBUG(driver, 2, "Win32-MIDI: timer: not playing, stopping timer");
 
		Debug(driver, 2, "Win32-MIDI: timer: not playing, stopping timer");
 
		timeKillEvent(uTimerID);
 
		_midi.timer_id = 0;
 
		return;
 
@@ -175,7 +175,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 
	static int volume_throttle = 0;
 
	if (_midi.current_volume != _midi.new_volume) {
 
		if (volume_throttle == 0) {
 
			DEBUG(driver, 2, "Win32-MIDI: timer: volume change");
 
			Debug(driver, 2, "Win32-MIDI: timer: volume change");
 
			_midi.current_volume = _midi.new_volume;
 
			volume_throttle = 20 / _midi.time_period;
 
			for (int ch = 0; ch < 16; ch++) {
 
@@ -198,7 +198,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 
			preload_bytes += block.data.size();
 
			if (block.ticktime >= _midi.current_segment.start) {
 
				if (_midi.current_segment.loop) {
 
					DEBUG(driver, 2, "Win32-MIDI: timer: loop from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime)/1000.0, (int)preload_bytes);
 
					Debug(driver, 2, "Win32-MIDI: timer: loop from block {} (ticktime {}, realtime {:.3f}, bytes {})", bl, block.ticktime, ((int)block.realtime)/1000.0, preload_bytes);
 
					_midi.current_segment.start_block = bl;
 
					break;
 
				} else {
 
@@ -207,7 +207,7 @@ void CALLBACK TimerCallback(UINT uTimerI
 
					 * which have a bitrate of 31,250 bits/sec, and transmit 1+8+1 start/data/stop bits per byte.
 
					 * The delay compensation is needed to avoid time-compression of following messages.
 
					 */
 
					DEBUG(driver, 2, "Win32-MIDI: timer: start from block %d (ticktime %d, realtime %.3f, bytes %d)", (int)bl, (int)block.ticktime, ((int)block.realtime) / 1000.0, (int)preload_bytes);
 
					Debug(driver, 2, "Win32-MIDI: timer: start from block {} (ticktime {}, realtime {:.3f}, bytes {})", bl, block.ticktime, ((int)block.realtime) / 1000.0, preload_bytes);
 
					_midi.playback_start_time -= block.realtime / 1000 - (DWORD)(preload_bytes * 1000 / 3125);
 
					break;
 
				}
 
@@ -320,11 +320,11 @@ void CALLBACK TimerCallback(UINT uTimerI
 

	
 
void MusicDriver_Win32::PlaySong(const MusicSongInfo &song)
 
{
 
	DEBUG(driver, 2, "Win32-MIDI: PlaySong: entry");
 
	Debug(driver, 2, "Win32-MIDI: PlaySong: entry");
 

	
 
	MidiFile new_song;
 
	if (!new_song.LoadSong(song)) return;
 
	DEBUG(driver, 2, "Win32-MIDI: PlaySong: Loaded song");
 
	Debug(driver, 2, "Win32-MIDI: PlaySong: Loaded song");
 

	
 
	std::lock_guard<std::mutex> mutex_lock(_midi.lock);
 

	
 
@@ -333,21 +333,21 @@ void MusicDriver_Win32::PlaySong(const M
 
	_midi.next_segment.end = song.override_end;
 
	_midi.next_segment.loop = song.loop;
 

	
 
	DEBUG(driver, 2, "Win32-MIDI: PlaySong: setting flag");
 
	Debug(driver, 2, "Win32-MIDI: PlaySong: setting flag");
 
	_midi.do_stop = _midi.playing;
 
	_midi.do_start = 1;
 

	
 
	if (_midi.timer_id == 0) {
 
		DEBUG(driver, 2, "Win32-MIDI: PlaySong: starting timer");
 
		Debug(driver, 2, "Win32-MIDI: PlaySong: starting timer");
 
		_midi.timer_id = timeSetEvent(_midi.time_period, _midi.time_period, TimerCallback, (DWORD_PTR)this, TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
 
	}
 
}
 

	
 
void MusicDriver_Win32::StopSong()
 
{
 
	DEBUG(driver, 2, "Win32-MIDI: StopSong: entry");
 
	Debug(driver, 2, "Win32-MIDI: StopSong: entry");
 
	std::lock_guard<std::mutex> mutex_lock(_midi.lock);
 
	DEBUG(driver, 2, "Win32-MIDI: StopSong: setting flag");
 
	Debug(driver, 2, "Win32-MIDI: StopSong: setting flag");
 
	_midi.do_stop = true;
 
}
 

	
 
@@ -364,7 +364,7 @@ void MusicDriver_Win32::SetVolume(byte v
 

	
 
const char *MusicDriver_Win32::Start(const StringList &parm)
 
{
 
	DEBUG(driver, 2, "Win32-MIDI: Start: initializing");
 
	Debug(driver, 2, "Win32-MIDI: Start: initializing");
 

	
 
	int resolution = GetDriverParamInt(parm, "resolution", 5);
 
	uint port = (uint)GetDriverParamInt(parm, "port", UINT_MAX);
 
@@ -373,7 +373,7 @@ const char *MusicDriver_Win32::Start(con
 
	/* Enumerate ports either for selecting port by name, or for debug output */
 
	if (portname != nullptr || _debug_driver_level > 0) {
 
		uint numports = midiOutGetNumDevs();
 
		DEBUG(driver, 1, "Win32-MIDI: Found %d output devices:", numports);
 
		Debug(driver, 1, "Win32-MIDI: Found {} output devices:", numports);
 
		for (uint tryport = 0; tryport < numports; tryport++) {
 
			MIDIOUTCAPS moc{};
 
			if (midiOutGetDevCaps(tryport, &moc, sizeof(moc)) == MMSYSERR_NOERROR) {
 
@@ -384,7 +384,7 @@ const char *MusicDriver_Win32::Start(con
 
				 * If multiple ports have the same name, this will select the last matching port, and the debug output will be confusing. */
 
				if (portname != nullptr && strncmp(tryportname, portname, lengthof(tryportname)) == 0) port = tryport;
 

	
 
				DEBUG(driver, 1, "MIDI port %2d: %s%s", tryport, tryportname, (tryport == port) ? " [selected]" : "");
 
				Debug(driver, 1, "MIDI port {:2d}: {}{}", tryport, tryportname, (tryport == port) ? " [selected]" : "");
 
			}
 
		}
 
	}
 
@@ -410,7 +410,7 @@ const char *MusicDriver_Win32::Start(con
 
		_midi.time_period = std::min(std::max((UINT)resolution, timecaps.wPeriodMin), timecaps.wPeriodMax);
 
		if (timeBeginPeriod(_midi.time_period) == MMSYSERR_NOERROR) {
 
			/* success */
 
			DEBUG(driver, 2, "Win32-MIDI: Start: timer resolution is %d", (int)_midi.time_period);
 
			Debug(driver, 2, "Win32-MIDI: Start: timer resolution is {}", _midi.time_period);
 
			return nullptr;
 
		}
 
	}
src/network/core/address.cpp
Show inline comments
 
@@ -247,9 +247,9 @@ SOCKET NetworkAddress::Resolve(int famil
 
	auto end = std::chrono::steady_clock::now();
 
	std::chrono::seconds duration = std::chrono::duration_cast<std::chrono::seconds>(end - start);
 
	if (!_resolve_timeout_error_message_shown && duration >= std::chrono::seconds(5)) {
 
		DEBUG(net, 0, "getaddrinfo for hostname \"%s\", port %s, address family %s and socket type %s took %i seconds",
 
				this->hostname.c_str(), port_name, AddressFamilyAsString(family), SocketTypeAsString(socktype), (int)duration.count());
 
		DEBUG(net, 0, "  this is likely an issue in the DNS name resolver's configuration causing it to time out");
 
		Debug(net, 0, "getaddrinfo for hostname \"{}\", port {}, address family {} and socket type {} took {} seconds",
 
				this->hostname, port_name, AddressFamilyAsString(family), SocketTypeAsString(socktype), duration.count());
 
		Debug(net, 0, "  this is likely an issue in the DNS name resolver's configuration causing it to time out");
 
		_resolve_timeout_error_message_shown = true;
 
	}
 

	
 
@@ -258,8 +258,8 @@ SOCKET NetworkAddress::Resolve(int famil
 

	
 
	if (e != 0) {
 
		if (func != ResolveLoopProc) {
 
			DEBUG(net, 0, "getaddrinfo for hostname \"%s\", port %s, address family %s and socket type %s failed: %s",
 
				this->hostname.c_str(), port_name, AddressFamilyAsString(family), SocketTypeAsString(socktype), FS2OTTD(gai_strerror(e)).c_str());
 
			Debug(net, 0, "getaddrinfo for hostname \"{}\", port {}, address family {} and socket type {} failed: {}",
 
				this->hostname, port_name, AddressFamilyAsString(family), SocketTypeAsString(socktype), FS2OTTD(gai_strerror(e)));
 
		}
 
		return INVALID_SOCKET;
 
	}
 
@@ -317,35 +317,35 @@ static SOCKET ListenLoopProc(addrinfo *r
 
	if (sock == INVALID_SOCKET) {
 
		const char *type = NetworkAddress::SocketTypeAsString(runp->ai_socktype);
 
		const char *family = NetworkAddress::AddressFamilyAsString(runp->ai_family);
 
		DEBUG(net, 0, "Could not create %s %s socket: %s", type, family, NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Could not create {} {} socket: {}", type, family, NetworkError::GetLast().AsString());
 
		return INVALID_SOCKET;
 
	}
 

	
 
	if (runp->ai_socktype == SOCK_STREAM && !SetNoDelay(sock)) {
 
		DEBUG(net, 1, "Setting no-delay mode failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 1, "Setting no-delay mode failed: {}", NetworkError::GetLast().AsString());
 
	}
 

	
 
	int on = 1;
 
	/* The (const char*) cast is needed for windows!! */
 
	if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) == -1) {
 
		DEBUG(net, 0, "Setting reuse-address mode failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Setting reuse-address mode failed: {}", NetworkError::GetLast().AsString());
 
	}
 

	
 
#ifndef __OS2__
 
	if (runp->ai_family == AF_INET6 &&
 
			setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&on, sizeof(on)) == -1) {
 
		DEBUG(net, 3, "Could not disable IPv4 over IPv6: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 3, "Could not disable IPv4 over IPv6: {}", NetworkError::GetLast().AsString());
 
	}
 
#endif
 

	
 
	if (bind(sock, runp->ai_addr, (int)runp->ai_addrlen) != 0) {
 
		DEBUG(net, 0, "Could not bind socket on %s: %s", address.c_str(), NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Could not bind socket on {}: {}", address, NetworkError::GetLast().AsString());
 
		closesocket(sock);
 
		return INVALID_SOCKET;
 
	}
 

	
 
	if (runp->ai_socktype != SOCK_DGRAM && listen(sock, 1) != 0) {
 
		DEBUG(net, 0, "Could not listen on socket: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Could not listen on socket: {}", NetworkError::GetLast().AsString());
 
		closesocket(sock);
 
		return INVALID_SOCKET;
 
	}
 
@@ -353,10 +353,10 @@ static SOCKET ListenLoopProc(addrinfo *r
 
	/* Connection succeeded */
 

	
 
	if (!SetNonBlocking(sock)) {
 
		DEBUG(net, 0, "Setting non-blocking mode failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Setting non-blocking mode failed: {}", NetworkError::GetLast().AsString());
 
	}
 

	
 
	DEBUG(net, 3, "Listening on %s", address.c_str());
 
	Debug(net, 3, "Listening on {}", address);
 
	return sock;
 
}
 

	
src/network/core/core.cpp
Show inline comments
 
@@ -27,9 +27,9 @@ bool NetworkCoreInitialize()
 
#ifdef _WIN32
 
	{
 
		WSADATA wsa;
 
		DEBUG(net, 5, "Loading windows socket library");
 
		Debug(net, 5, "Loading windows socket library");
 
		if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) {
 
			DEBUG(net, 0, "WSAStartup failed, network unavailable");
 
			Debug(net, 0, "WSAStartup failed, network unavailable");
 
			return false;
 
		}
 
	}
src/network/core/game_info.cpp
Show inline comments
 
@@ -51,7 +51,7 @@ const char *GetNetworkRevisionString()
 

	
 
		/* Tag names are not mangled further. */
 
		if (_openttd_revision_tagged) {
 
			DEBUG(net, 3, "Network revision name: %s", network_revision);
 
			Debug(net, 3, "Network revision name: {}", network_revision);
 
			return network_revision;
 
		}
 

	
 
@@ -71,7 +71,7 @@ const char *GetNetworkRevisionString()
 
		/* Replace the git hash in revision string. */
 
		strecpy(network_revision + hashofs, githash_suffix, network_revision + NETWORK_REVISION_LENGTH);
 
		assert(strlen(network_revision) < NETWORK_REVISION_LENGTH); // strlen does not include terminator, constant does, hence strictly less than
 
		DEBUG(net, 3, "Network revision name: %s", network_revision);
 
		Debug(net, 3, "Network revision name: {}", network_revision);
 
	}
 

	
 
	return network_revision;
src/network/core/host.cpp
Show inline comments
 
@@ -131,10 +131,10 @@ void NetworkFindBroadcastIPs(NetworkAddr
 
	NetworkFindBroadcastIPsInternal(broadcast);
 

	
 
	/* Now display to the debug all the detected ips */
 
	DEBUG(net, 3, "Detected broadcast addresses:");
 
	Debug(net, 3, "Detected broadcast addresses:");
 
	int i = 0;
 
	for (NetworkAddress &addr : *broadcast) {
 
		addr.SetPort(NETWORK_DEFAULT_PORT);
 
		DEBUG(net, 3, "  %d) %s", i++, addr.GetHostname());
 
		Debug(net, 3, "  {}) {}", i++, addr.GetHostname());
 
	}
 
}
src/network/core/tcp.cpp
Show inline comments
 
@@ -112,7 +112,7 @@ SendPacketsState NetworkTCPSocketHandler
 
			if (!err.WouldBlock()) {
 
				/* Something went wrong.. close client! */
 
				if (!closing_down) {
 
					DEBUG(net, 0, "Send failed: %s", err.AsString());
 
					Debug(net, 0, "Send failed: {}", err.AsString());
 
					this->CloseConnection();
 
				}
 
				return SPS_CLOSED;
 
@@ -161,7 +161,7 @@ Packet *NetworkTCPSocketHandler::Receive
 
				NetworkError err = NetworkError::GetLast();
 
				if (!err.WouldBlock()) {
 
					/* Something went wrong... */
 
					if (!err.IsConnectionReset()) DEBUG(net, 0, "Recv failed: %s", err.AsString());
 
					if (!err.IsConnectionReset()) Debug(net, 0, "Recv failed: {}", err.AsString());
 
					this->CloseConnection();
 
					return nullptr;
 
				}
 
@@ -189,7 +189,7 @@ Packet *NetworkTCPSocketHandler::Receive
 
			NetworkError err = NetworkError::GetLast();
 
			if (!err.WouldBlock()) {
 
				/* Something went wrong... */
 
				if (!err.IsConnectionReset()) DEBUG(net, 0, "Recv failed: %s", err.AsString());
 
				if (!err.IsConnectionReset()) Debug(net, 0, "Recv failed: {}", err.AsString());
 
				this->CloseConnection();
 
				return nullptr;
 
			}
src/network/core/tcp_admin.cpp
Show inline comments
 
@@ -87,9 +87,9 @@ NetworkRecvStatus NetworkAdminSocketHand
 

	
 
		default:
 
			if (this->HasClientQuit()) {
 
				DEBUG(net, 0, "[tcp/admin] Received invalid packet type %d from '%s' (%s)", type, this->admin_name.c_str(), this->admin_version.c_str());
 
				Debug(net, 0, "[tcp/admin] Received invalid packet type {} from '{}' ({})", type, this->admin_name, this->admin_version);
 
			} else {
 
				DEBUG(net, 0, "[tcp/admin] Received illegal packet from '%s' (%s)", this->admin_name.c_str(), this->admin_version.c_str());
 
				Debug(net, 0, "[tcp/admin] Received illegal packet from '{}' ({})", this->admin_name, this->admin_version);
 
			}
 

	
 
			this->CloseConnection();
 
@@ -123,7 +123,7 @@ NetworkRecvStatus NetworkAdminSocketHand
 
 */
 
NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket(PacketAdminType type)
 
{
 
	DEBUG(net, 0, "[tcp/admin] Received illegal packet type %d from admin %s (%s)", type, this->admin_name.c_str(), this->admin_version.c_str());
 
	Debug(net, 0, "[tcp/admin] Received illegal packet type {} from admin {} ({})", type, this->admin_name, this->admin_version);
 
	return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
}
 

	
src/network/core/tcp_connect.cpp
Show inline comments
 
@@ -56,25 +56,25 @@ void TCPConnecter::Connect(addrinfo *add
 
{
 
	SOCKET sock = socket(address->ai_family, address->ai_socktype, address->ai_protocol);
 
	if (sock == INVALID_SOCKET) {
 
		DEBUG(net, 0, "Could not create %s %s socket: %s", NetworkAddress::SocketTypeAsString(address->ai_socktype), NetworkAddress::AddressFamilyAsString(address->ai_family), NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Could not create {} {} socket: {}", NetworkAddress::SocketTypeAsString(address->ai_socktype), NetworkAddress::AddressFamilyAsString(address->ai_family), NetworkError::GetLast().AsString());
 
		return;
 
	}
 

	
 
	if (!SetNoDelay(sock)) {
 
		DEBUG(net, 1, "Setting TCP_NODELAY failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 1, "Setting TCP_NODELAY failed: {}", NetworkError::GetLast().AsString());
 
	}
 
	if (!SetNonBlocking(sock)) {
 
		DEBUG(net, 0, "Setting non-blocking mode failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 0, "Setting non-blocking mode failed: {}", NetworkError::GetLast().AsString());
 
	}
 

	
 
	NetworkAddress network_address = NetworkAddress(address->ai_addr, (int)address->ai_addrlen);
 
	DEBUG(net, 5, "Attempting to connect to %s", network_address.GetAddressAsString().c_str());
 
	Debug(net, 5, "Attempting to connect to {}", network_address.GetAddressAsString());
 

	
 
	int err = connect(sock, address->ai_addr, (int)address->ai_addrlen);
 
	if (err != 0 && !NetworkError::GetLast().IsConnectInProgress()) {
 
		closesocket(sock);
 

	
 
		DEBUG(net, 1, "Could not connect to %s: %s", network_address.GetAddressAsString().c_str(), NetworkError::GetLast().AsString());
 
		Debug(net, 1, "Could not connect to {}: {}", network_address.GetAddressAsString(), NetworkError::GetLast().AsString());
 
		return;
 
	}
 

	
 
@@ -150,9 +150,9 @@ void TCPConnecter::OnResolved(addrinfo *
 
	}
 

	
 
	if (_debug_net_level >= 6) {
 
		DEBUG(net, 6, "%s resolved in:", this->connection_string.c_str());
 
		Debug(net, 6, "{} resolved in:", this->connection_string);
 
		for (const auto &address : this->addresses) {
 
			DEBUG(net, 6, "- %s", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString().c_str());
 
			Debug(net, 6, "- {}", NetworkAddress(address->ai_addr, (int)address->ai_addrlen).GetAddressAsString());
 
		}
 
	}
 

	
 
@@ -188,13 +188,13 @@ void TCPConnecter::Resolve()
 
	auto end = std::chrono::steady_clock::now();
 
	auto duration = std::chrono::duration_cast<std::chrono::seconds>(end - start);
 
	if (!getaddrinfo_timeout_error_shown && duration >= std::chrono::seconds(5)) {
 
		DEBUG(net, 0, "getaddrinfo() for address \"%s\" took %i seconds", this->connection_string.c_str(), (int)duration.count());
 
		DEBUG(net, 0, "  This is likely an issue in the DNS name resolver's configuration causing it to time out");
 
		Debug(net, 0, "getaddrinfo() for address \"{}\" took {} seconds", this->connection_string, duration.count());
 
		Debug(net, 0, "  This is likely an issue in the DNS name resolver's configuration causing it to time out");
 
		getaddrinfo_timeout_error_shown = true;
 
	}
 

	
 
	if (error != 0) {
 
		DEBUG(net, 0, "Failed to resolve DNS for %s", this->connection_string.c_str());
 
		Debug(net, 0, "Failed to resolve DNS for {}", this->connection_string);
 
		this->status = Status::FAILURE;
 
		return;
 
	}
 
@@ -272,7 +272,7 @@ bool TCPConnecter::CheckActivity()
 
	/* select() failed; hopefully next try it doesn't. */
 
	if (n < 0) {
 
		/* select() normally never fails; so hopefully it works next try! */
 
		DEBUG(net, 1, "select() failed: %s", NetworkError::GetLast().AsString());
 
		Debug(net, 1, "select() failed: {}", NetworkError::GetLast().AsString());
 
		return false;
 
	}
 

	
 
@@ -289,7 +289,7 @@ bool TCPConnecter::CheckActivity()
 

	
 
		/* More than 3 seconds no socket reported activity, and there are no
 
		 * more address to try. Timeout the attempt. */
 
		DEBUG(net, 0, "Timeout while connecting to %s", this->connection_string.c_str());
 
		Debug(net, 0, "Timeout while connecting to {}", this->connection_string);
 

	
 
		for (const auto &socket : this->sockets) {
 
			closesocket(socket);
 
@@ -305,7 +305,7 @@ bool TCPConnecter::CheckActivity()
 
	for (auto it = this->sockets.begin(); it != this->sockets.end(); /* nothing */) {
 
		NetworkError socket_error = GetSocketError(*it);
 
		if (socket_error.HasError()) {
 
			DEBUG(net, 1, "Could not connect to %s: %s", this->sock_to_address[*it].GetAddressAsString().c_str(), socket_error.AsString());
 
			Debug(net, 1, "Could not connect to {}: {}", this->sock_to_address[*it].GetAddressAsString(), socket_error.AsString());
 
			closesocket(*it);
 
			this->sock_to_address.erase(*it);
 
			it = this->sockets.erase(it);
 
@@ -338,9 +338,9 @@ bool TCPConnecter::CheckActivity()
 
	}
 
	assert(connected_socket != INVALID_SOCKET);
 

	
 
	DEBUG(net, 3, "Connected to %s", this->connection_string.c_str());
 
	Debug(net, 3, "Connected to {}", this->connection_string);
 
	if (_debug_net_level >= 5) {
 
		DEBUG(net, 5, "- using %s", NetworkAddress::GetPeerName(connected_socket).c_str());
 
		Debug(net, 5, "- using {}", NetworkAddress::GetPeerName(connected_socket));
 
	}
 

	
 
	this->OnConnect(connected_socket);
src/network/core/tcp_content.cpp
Show inline comments
 
@@ -114,9 +114,9 @@ bool NetworkContentSocketHandler::Handle
 

	
 
		default:
 
			if (this->HasClientQuit()) {
 
				DEBUG(net, 0, "[tcp/content] Received invalid packet type %d", type);
 
				Debug(net, 0, "[tcp/content] Received invalid packet type {}", type);
 
			} else {
 
				DEBUG(net, 0, "[tcp/content] Received illegal packet");
 
				Debug(net, 0, "[tcp/content] Received illegal packet");
 
			}
 
			return false;
 
	}
 
@@ -167,7 +167,7 @@ bool NetworkContentSocketHandler::Receiv
 
 */
 
bool NetworkContentSocketHandler::ReceiveInvalidPacket(PacketContentType type)
 
{
 
	DEBUG(net, 0, "[tcp/content] Received illegal packet type %d", type);
 
	Debug(net, 0, "[tcp/content] Received illegal packet type {}", type);
 
	return false;
 
}
 

	
src/network/core/tcp_game.cpp
Show inline comments
 
@@ -117,9 +117,9 @@ NetworkRecvStatus NetworkGameSocketHandl
 
			this->CloseConnection();
 

	
 
			if (this->HasClientQuit()) {
 
				DEBUG(net, 0, "[tcp/game] Received invalid packet type %d from client %d", type, this->client_id);
 
				Debug(net, 0, "[tcp/game] Received invalid packet type {} from client {}", type, this->client_id);
 
			} else {
 
				DEBUG(net, 0, "[tcp/game] Received illegal packet from client %d", this->client_id);
 
				Debug(net, 0, "[tcp/game] Received illegal packet from client {}", this->client_id);
 
			}
 
			return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
	}
 
@@ -151,7 +151,7 @@ NetworkRecvStatus NetworkGameSocketHandl
 
 */
 
NetworkRecvStatus NetworkGameSocketHandler::ReceiveInvalidPacket(PacketGameType type)
 
{
 
	DEBUG(net, 0, "[tcp/game] Received illegal packet type %d from client %d", type, this->client_id);
 
	Debug(net, 0, "[tcp/game] Received illegal packet type {} from client {}", type, this->client_id);
 
	return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
}
 

	
src/network/core/tcp_http.cpp
Show inline comments
 
@@ -45,7 +45,7 @@ NetworkHTTPSocketHandler::NetworkHTTPSoc
 
	size_t bufferSize = strlen(url) + strlen(host) + strlen(GetNetworkRevisionString()) + (data == nullptr ? 0 : strlen(data)) + 128;
 
	char *buffer = AllocaM(char, bufferSize);
 

	
 
	DEBUG(net, 5, "[tcp/http] Requesting %s%s", host, url);
 
	Debug(net, 5, "[tcp/http] Requesting {}{}", host, url);
 
	if (data != nullptr) {
 
		seprintf(buffer, buffer + bufferSize - 1, "POST %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: OpenTTD/%s\r\nContent-Type: text/plain\r\nContent-Length: %d\r\n\r\n%s\r\n", url, host, GetNetworkRevisionString(), (int)strlen(data), data);
 
	} else {
 
@@ -86,7 +86,7 @@ void NetworkHTTPSocketHandler::CloseSock
 
 * Helper to simplify the error handling.
 
 * @param msg the error message to show.
 
 */
 
#define return_error(msg) { DEBUG(net, 1, msg); return -1; }
 
#define return_error(msg) { Debug(net, 1, msg); return -1; }
 

	
 
static const char * const NEWLINE        = "\r\n";             ///< End of line marker
 
static const char * const END_OF_HEADER  = "\r\n\r\n";         ///< End of header marker
 
@@ -142,7 +142,7 @@ int NetworkHTTPSocketHandler::HandleHead
 
		 * wrong. You can't have gzips of 0 bytes! */
 
		if (len == 0) return_error("[tcp/http] Refusing to download 0 bytes");
 

	
 
		DEBUG(net, 7, "[tcp/http] Downloading %i bytes", len);
 
		Debug(net, 7, "[tcp/http] Downloading {} bytes", len);
 
		return len;
 
	}
 

	
 
@@ -155,7 +155,7 @@ int NetworkHTTPSocketHandler::HandleHead
 
		/* Search the end of the line. This is safe because the header will
 
		 * always end with two newlines. */
 
		*strstr(status, NEWLINE) = '\0';
 
		DEBUG(net, 1, "[tcp/http] Unhandled status reply %s", status);
 
		Debug(net, 1, "[tcp/http] Unhandled status reply {}", status);
 
		return -1;
 
	}
 

	
 
@@ -172,7 +172,7 @@ int NetworkHTTPSocketHandler::HandleHead
 
	char *end_of_line = strstr(uri, NEWLINE);
 
	*end_of_line = '\0';
 

	
 
	DEBUG(net, 7, "[tcp/http] Redirecting to %s", uri);
 
	Debug(net, 7, "[tcp/http] Redirecting to {}", uri);
 

	
 
	int ret = NetworkHTTPSocketHandler::Connect(uri, this->callback, this->data, this->redirect_depth + 1);
 
	if (ret != 0) return ret;
 
@@ -229,7 +229,7 @@ int NetworkHTTPSocketHandler::Receive()
 
			NetworkError err = NetworkError::GetLast();
 
			if (!err.WouldBlock()) {
 
				/* Something went wrong... */
 
				if (!err.IsConnectionReset()) DEBUG(net, 0, "Recv failed: %s", err.AsString());
 
				if (!err.IsConnectionReset()) Debug(net, 0, "Recv failed: {}", err.AsString());
 
				return -1;
 
			}
 
			/* Connection would block, so stop for now */
 
@@ -257,7 +257,7 @@ int NetworkHTTPSocketHandler::Receive()
 

	
 
			if (end_of_header == nullptr) {
 
				if (read == lengthof(this->recv_buffer)) {
 
					DEBUG(net, 1, "[tcp/http] Header too big");
 
					Debug(net, 1, "[tcp/http] Header too big");
 
					return -1;
 
				}
 
				this->recv_pos = read;
src/network/core/tcp_listen.h
Show inline comments
 
@@ -49,7 +49,7 @@ public:
 
			SetNonBlocking(s); // XXX error handling?
 

	
 
			NetworkAddress address(sin, sin_len);
 
			DEBUG(net, 3, "[%s] Client connected from %s on frame %d", Tsocket::GetName(), address.GetHostname(), _frame_counter);
 
			Debug(net, 3, "[{}] Client connected from {} on frame {}", Tsocket::GetName(), address.GetHostname(), _frame_counter);
 

	
 
			SetNoDelay(s); // XXX error handling?
 

	
 
@@ -61,10 +61,10 @@ public:
 
					Packet p(Tban_packet);
 
					p.PrepareToSend();
 

	
 
					DEBUG(net, 2, "[%s] Banned ip tried to join (%s), refused", Tsocket::GetName(), entry.c_str());
 
					Debug(net, 2, "[{}] Banned ip tried to join ({}), refused", Tsocket::GetName(), entry);
 

	
 
					if (p.TransferOut<int>(send, s, 0) < 0) {
 
						DEBUG(net, 0, "[%s] send failed: %s", Tsocket::GetName(), NetworkError::GetLast().AsString());
 
						Debug(net, 0, "[{}] send failed: {}", Tsocket::GetName(), NetworkError::GetLast().AsString());
 
					}
 
					closesocket(s);
 
					break;
 
@@ -81,7 +81,7 @@ public:
 
				p.PrepareToSend();
 

	
 
				if (p.TransferOut<int>(send, s, 0) < 0) {
 
					DEBUG(net, 0, "[%s] send failed: %s", Tsocket::GetName(), NetworkError::GetLast().AsString());
 
					Debug(net, 0, "[{}] send failed: {}", Tsocket::GetName(), NetworkError::GetLast().AsString());
 
				}
 
				closesocket(s);
 

	
 
@@ -150,7 +150,7 @@ public:
 
		}
 

	
 
		if (sockets.size() == 0) {
 
			DEBUG(net, 0, "Could not start network: could not create listening socket");
 
			Debug(net, 0, "Could not start network: could not create listening socket");
 
			ShowNetworkError(STR_NETWORK_ERROR_SERVER_START);
 
			return false;
 
		}
 
@@ -165,7 +165,7 @@ public:
 
			closesocket(s.second);
 
		}
 
		sockets.clear();
 
		DEBUG(net, 5, "[%s] Closed listeners", Tsocket::GetName());
 
		Debug(net, 5, "[{}] Closed listeners", Tsocket::GetName());
 
	}
 
};
 

	
src/network/core/udp.cpp
Show inline comments
 
@@ -89,16 +89,16 @@ void NetworkUDPSocketHandler::SendPacket
 
			/* Enable broadcast */
 
			unsigned long val = 1;
 
			if (setsockopt(s.second, SOL_SOCKET, SO_BROADCAST, (char *) &val, sizeof(val)) < 0) {
 
				DEBUG(net, 1, "Setting broadcast mode failed: %s", NetworkError::GetLast().AsString());
 
				Debug(net, 1, "Setting broadcast mode failed: {}", NetworkError::GetLast().AsString());
 
			}
 
		}
 

	
 
		/* Send the buffer */
 
		ssize_t res = p->TransferOut<int>(sendto, s.second, 0, (const struct sockaddr *)send.GetAddress(), send.GetAddressLength());
 
		DEBUG(net, 7, "sendto(%s)", send.GetAddressAsString().c_str());
 
		Debug(net, 7, "sendto({})", send.GetAddressAsString());
 

	
 
		/* Check for any errors, but ignore it otherwise */
 
		if (res == -1) DEBUG(net, 1, "sendto(%s) failed: %s", send.GetAddressAsString().c_str(), NetworkError::GetLast().AsString());
 
		if (res == -1) Debug(net, 1, "sendto({}) failed: {}", send.GetAddressAsString(), NetworkError::GetLast().AsString());
 

	
 
		if (!all) break;
 
	}
 
@@ -134,7 +134,7 @@ void NetworkUDPSocketHandler::ReceivePac
 
			/* If the size does not match the packet must be corrupted.
 
			 * Otherwise it will be marked as corrupted later on. */
 
			if (!p.ParsePacketSize() || (size_t)nbytes != p.Size()) {
 
				DEBUG(net, 1, "Received a packet with mismatching size from %s", address.GetAddressAsString().c_str());
 
				Debug(net, 1, "Received a packet with mismatching size from {}", address.GetAddressAsString());
 
				continue;
 
			}
 
			p.PrepareToRead();
 
@@ -175,9 +175,9 @@ void NetworkUDPSocketHandler::HandleUDPP
 

	
 
		default:
 
			if (this->HasClientQuit()) {
 
				DEBUG(net, 0, "[udp] Received invalid packet type %d from %s", type, client_addr->GetAddressAsString().c_str());
 
				Debug(net, 0, "[udp] Received invalid packet type {} from {}", type, client_addr->GetAddressAsString());
 
			} else {
 
				DEBUG(net, 0, "[udp] Received illegal packet from %s", client_addr->GetAddressAsString().c_str());
 
				Debug(net, 0, "[udp] Received illegal packet from {}", client_addr->GetAddressAsString());
 
			}
 
			break;
 
	}
 
@@ -190,7 +190,7 @@ void NetworkUDPSocketHandler::HandleUDPP
 
 */
 
void NetworkUDPSocketHandler::ReceiveInvalidPacket(PacketUDPType type, NetworkAddress *client_addr)
 
{
 
	DEBUG(net, 0, "[udp] Received packet type %d on wrong port from %s", type, client_addr->GetAddressAsString().c_str());
 
	Debug(net, 0, "[udp] Received packet type {} on wrong port from {}", type, client_addr->GetAddressAsString());
 
}
 

	
 
void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); }
src/network/network.cpp
Show inline comments
 
@@ -264,7 +264,7 @@ void NetworkTextMessage(NetworkAction ac
 
	char *msg_ptr = message + Utf8Encode(message, _current_text_dir == TD_LTR ? CHAR_TD_LRM : CHAR_TD_RLM);
 
	GetString(msg_ptr, strid, lastof(message));
 

	
 
	DEBUG(desync, 1, "msg: %08x; %02x; %s", _date, _date_fract, message);
 
	Debug(desync, 1, "msg: {:08x}; {:02x}; {}", _date, _date_fract, message);
 
	IConsolePrintF(colour, "%s", message);
 
	NetworkAddChatMessage((TextColour)colour, _settings_client.gui.network_chat_timeout, message);
 
}
 
@@ -877,14 +877,14 @@ static void CheckClientAndServerName()
 
	static const std::string fallback_client_name = "Unnamed Client";
 
	StrTrimInPlace(_settings_client.network.client_name);
 
	if (_settings_client.network.client_name.empty() || _settings_client.network.client_name.compare(fallback_client_name) == 0) {
 
		DEBUG(net, 1, "No \"client_name\" has been set, using \"%s\" instead. Please set this now using the \"name <new name>\" command", fallback_client_name.c_str());
 
		Debug(net, 1, "No \"client_name\" has been set, using \"{}\" instead. Please set this now using the \"name <new name>\" command", fallback_client_name);
 
		_settings_client.network.client_name = fallback_client_name;
 
	}
 

	
 
	static const std::string fallback_server_name = "Unnamed Server";
 
	StrTrimInPlace(_settings_client.network.server_name);
 
	if (_settings_client.network.server_name.empty() || _settings_client.network.server_name.compare(fallback_server_name) == 0) {
 
		DEBUG(net, 1, "No \"server_name\" has been set, using \"%s\" instead. Please set this now using the \"server_name <new name>\" command", fallback_server_name.c_str());
 
		Debug(net, 1, "No \"server_name\" has been set, using \"{}\" instead. Please set this now using the \"server_name <new name>\" command", fallback_server_name);
 
		_settings_client.network.server_name = fallback_server_name;
 
	}
 
}
 
@@ -902,17 +902,17 @@ bool NetworkServerStart()
 

	
 
	NetworkDisconnect(false, false);
 
	NetworkInitialize(false);
 
	DEBUG(net, 5, "Starting listeners for clients");
 
	Debug(net, 5, "Starting listeners for clients");
 
	if (!ServerNetworkGameSocketHandler::Listen(_settings_client.network.server_port)) return false;
 

	
 
	/* Only listen for admins when the password isn't empty. */
 
	if (!_settings_client.network.admin_password.empty()) {
 
		DEBUG(net, 5, "Starting listeners for admins");
 
		Debug(net, 5, "Starting listeners for admins");
 
		if (!ServerNetworkAdminSocketHandler::Listen(_settings_client.network.server_admin_port)) return false;
 
	}
 

	
 
	/* Try to start UDP-server */
 
	DEBUG(net, 5, "Starting listeners for incoming server queries");
 
	Debug(net, 5, "Starting listeners for incoming server queries");
 
	NetworkUDPServerListen();
 

	
 
	_network_company_states = new NetworkCompanyState[MAX_COMPANIES];
 
@@ -1049,7 +1049,7 @@ void NetworkGameLoop()
 
			/* We don't want to log multiple times if paused. */
 
			static Date last_log;
 
			if (last_log != _date) {
 
				DEBUG(desync, 1, "sync: %08x; %02x; %08x; %08x", _date, _date_fract, _random.state[0], _random.state[1]);
 
				Debug(desync, 1, "sync: {:08x}; {:02x}; {:08x}; {:08x}", _date, _date_fract, _random.state[0], _random.state[1]);
 
				last_log = _date;
 
			}
 
		}
 
@@ -1063,7 +1063,7 @@ void NetworkGameLoop()
 
		static bool check_sync_state = false;
 
		static uint32 sync_state[2];
 
		if (f == nullptr && next_date == 0) {
 
			DEBUG(desync, 0, "Cannot open commands.log");
 
			Debug(desync, 0, "Cannot open commands.log");
 
			next_date = 1;
 
		}
 

	
 
@@ -1071,15 +1071,15 @@ void NetworkGameLoop()
 
			if (_date == next_date && _date_fract == next_date_fract) {
 
				if (cp != nullptr) {
 
					NetworkSendCommand(cp->tile, cp->p1, cp->p2, cp->cmd & ~CMD_FLAGS_MASK, nullptr, cp->text, cp->company);
 
					DEBUG(desync, 0, "Injecting: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text.c_str(), GetCommandName(cp->cmd));
 
					Debug(desync, 0, "Injecting: {:08x}; {:02x}; {:02x}; {:06x}; {:08x}; {:08x}; {:08x}; \"{}\" ({})", _date, _date_fract, (int)_current_company, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text, GetCommandName(cp->cmd));
 
					delete cp;
 
					cp = nullptr;
 
				}
 
				if (check_sync_state) {
 
					if (sync_state[0] == _random.state[0] && sync_state[1] == _random.state[1]) {
 
						DEBUG(desync, 0, "Sync check: %08x; %02x; match", _date, _date_fract);
 
						Debug(desync, 0, "Sync check: {:08x}; {:02x}; match", _date, _date_fract);
 
					} else {
 
						DEBUG(desync, 0, "Sync check: %08x; %02x; mismatch expected {%08x, %08x}, got {%08x, %08x}",
 
						Debug(desync, 0, "Sync check: {:08x}; {:02x}; mismatch expected {{:08x}, {:08x}}, got {{:08x}, {:08x}}",
 
									_date, _date_fract, sync_state[0], sync_state[1], _random.state[0], _random.state[1]);
 
						NOT_REACHED();
 
					}
 
@@ -1121,7 +1121,7 @@ void NetworkGameLoop()
 
				/* Manually insert a pause when joining; this way the client can join at the exact right time. */
 
				int ret = sscanf(p + 6, "%x; %x", &next_date, &next_date_fract);
 
				assert(ret == 2);
 
				DEBUG(desync, 0, "Injecting pause for join at %08x:%02x; please join when paused", next_date, next_date_fract);
 
				Debug(desync, 0, "Injecting pause for join at {:08x}:{:02x}; please join when paused", next_date, next_date_fract);
 
				cp = new CommandPacket();
 
				cp->company = COMPANY_SPECTATOR;
 
				cp->cmd = CMD_PAUSE;
 
@@ -1137,16 +1137,16 @@ void NetworkGameLoop()
 
				/* A message that is not very important to the log playback, but part of the log. */
 
#ifndef DEBUG_FAILED_DUMP_COMMANDS
 
			} else if (strncmp(p, "cmdf: ", 6) == 0) {
 
				DEBUG(desync, 0, "Skipping replay of failed command: %s", p + 6);
 
				Debug(desync, 0, "Skipping replay of failed command: {}", p + 6);
 
#endif
 
			} else {
 
				/* Can't parse a line; what's wrong here? */
 
				DEBUG(desync, 0, "Trying to parse: %s", p);
 
				Debug(desync, 0, "Trying to parse: {}", p);
 
				NOT_REACHED();
 
			}
 
		}
 
		if (f != nullptr && feof(f)) {
 
			DEBUG(desync, 0, "End of commands.log");
 
			Debug(desync, 0, "End of commands.log");
 
			fclose(f);
 
			f = nullptr;
 
		}
 
@@ -1233,12 +1233,12 @@ public:
 

	
 
	void OnFailure() override
 
	{
 
		DEBUG(net, 0, "Failed to open connection to %s for redirecting DEBUG()", this->connection_string.c_str());
 
		Debug(net, 0, "Failed to open connection to {} for redirecting Debug()", this->connection_string);
 
	}
 

	
 
	void OnConnect(SOCKET s) override
 
	{
 
		DEBUG(net, 3, "Redirecting DEBUG() to %s", this->connection_string.c_str());
 
		Debug(net, 3, "Redirecting Debug() to {}", this->connection_string);
 

	
 
		extern SOCKET _debug_socket;
 
		_debug_socket = s;
 
@@ -1253,7 +1253,7 @@ void NetworkStartDebugLog(const std::str
 
/** This tries to launch the network for a given OS */
 
void NetworkStartUp()
 
{
 
	DEBUG(net, 3, "Starting network");
 
	Debug(net, 3, "Starting network");
 

	
 
	/* Network is available */
 
	_network_available = NetworkCoreInitialize();
 
@@ -1266,7 +1266,7 @@ void NetworkStartUp()
 
	_network_game_info = {};
 

	
 
	NetworkInitialize();
 
	DEBUG(net, 3, "Network online, multiplayer available");
 
	Debug(net, 3, "Network online, multiplayer available");
 
	NetworkFindBroadcastIPs(&_broadcast_list);
 
}
 

	
 
@@ -1276,7 +1276,7 @@ void NetworkShutDown()
 
	NetworkDisconnect(true);
 
	NetworkUDPClose();
 

	
 
	DEBUG(net, 3, "Shutting down network");
 
	Debug(net, 3, "Shutting down network");
 

	
 
	_network_available = false;
 

	
src/network/network_admin.cpp
Show inline comments
 
@@ -74,7 +74,7 @@ ServerNetworkAdminSocketHandler::ServerN
 
ServerNetworkAdminSocketHandler::~ServerNetworkAdminSocketHandler()
 
{
 
	_network_admins_connected--;
 
	DEBUG(net, 3, "[admin] '%s' (%s) has disconnected", this->admin_name.c_str(), this->admin_version.c_str());
 
	Debug(net, 3, "[admin] '{}' ({}) has disconnected", this->admin_name, this->admin_version);
 
	if (_redirect_console_to_admin == this->index) _redirect_console_to_admin = INVALID_ADMIN_ID;
 
}
 

	
 
@@ -97,7 +97,7 @@ ServerNetworkAdminSocketHandler::~Server
 
{
 
	for (ServerNetworkAdminSocketHandler *as : ServerNetworkAdminSocketHandler::Iterate()) {
 
		if (as->status == ADMIN_STATUS_INACTIVE && std::chrono::steady_clock::now() > as->connect_time + ADMIN_AUTHORISATION_TIMEOUT) {
 
			DEBUG(net, 2, "[admin] Admin did not send its authorisation within %d seconds", (uint32)std::chrono::duration_cast<std::chrono::seconds>(ADMIN_AUTHORISATION_TIMEOUT).count());
 
			Debug(net, 2, "[admin] Admin did not send its authorisation within {} seconds", std::chrono::duration_cast<std::chrono::seconds>(ADMIN_AUTHORISATION_TIMEOUT).count());
 
			as->CloseConnection(true);
 
			continue;
 
		}
 
@@ -135,7 +135,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	std::string error_message = GetString(GetNetworkErrorMsg(error));
 

	
 
	DEBUG(net, 1, "[admin] The admin '%s' (%s) made an error and has been disconnected: '%s'", this->admin_name.c_str(), this->admin_version.c_str(), error_message.c_str());
 
	Debug(net, 1, "[admin] The admin '{}' ({}) made an error and has been disconnected: '{}'", this->admin_name, this->admin_version, error_message);
 

	
 
	return this->CloseConnection(true);
 
}
 
@@ -500,7 +500,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	std::string command = p->Recv_string(NETWORK_RCONCOMMAND_LENGTH);
 

	
 
	DEBUG(net, 3, "[admin] Rcon command from '%s' (%s): %s", this->admin_name.c_str(), this->admin_version.c_str(), command.c_str());
 
	Debug(net, 3, "[admin] Rcon command from '{}' ({}): {}", this->admin_name, this->admin_version, command);
 

	
 
	_redirect_console_to_admin = this->index;
 
	IConsoleCmdExec(command.c_str());
 
@@ -514,7 +514,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	std::string json = p->Recv_string(NETWORK_GAMESCRIPT_JSON_LENGTH);
 

	
 
	DEBUG(net, 6, "[admin] GameScript JSON from '%s' (%s): %s", this->admin_name.c_str(), this->admin_version.c_str(), json.c_str());
 
	Debug(net, 6, "[admin] GameScript JSON from '{}' ({}): {}", this->admin_name, this->admin_version, json);
 

	
 
	Game::NewEvent(new ScriptEventAdminPort(json));
 
	return NETWORK_RECV_STATUS_OKAY;
 
@@ -526,7 +526,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	uint32 d1 = p->Recv_uint32();
 

	
 
	DEBUG(net, 6, "[admin] Ping from '%s' (%s): %d", this->admin_name.c_str(), this->admin_version.c_str(), d1);
 
	Debug(net, 6, "[admin] Ping from '{}' ({}): {}", this->admin_name, this->admin_version, d1);
 

	
 
	return this->SendPong(d1);
 
}
 
@@ -662,7 +662,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	this->status = ADMIN_STATUS_ACTIVE;
 

	
 
	DEBUG(net, 3, "[admin] '%s' (%s) has connected", this->admin_name.c_str(), this->admin_version.c_str());
 
	Debug(net, 3, "[admin] '{}' ({}) has connected", this->admin_name, this->admin_version);
 

	
 
	return this->SendProtocol();
 
}
 
@@ -682,7 +682,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
	if (type >= ADMIN_UPDATE_END || (_admin_update_type_frequencies[type] & freq) != freq) {
 
		/* The server does not know of this UpdateType. */
 
		DEBUG(net, 1, "[admin] Not supported update frequency %d (%d) from '%s' (%s)", type, freq, this->admin_name.c_str(), this->admin_version.c_str());
 
		Debug(net, 1, "[admin] Not supported update frequency {} ({}) from '{}' ({})", type, freq, this->admin_name, this->admin_version);
 
		return this->SendError(NETWORK_ERROR_ILLEGAL_PACKET);
 
	}
 

	
 
@@ -750,7 +750,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 

	
 
		default:
 
			/* An unsupported "poll" update type. */
 
			DEBUG(net, 1, "[admin] Not supported poll %d (%d) from '%s' (%s).", type, d1, this->admin_name.c_str(), this->admin_version.c_str());
 
			Debug(net, 1, "[admin] Not supported poll {} ({}) from '{}' ({}).", type, d1, this->admin_name, this->admin_version);
 
			return this->SendError(NETWORK_ERROR_ILLEGAL_PACKET);
 
	}
 

	
 
@@ -776,7 +776,7 @@ NetworkRecvStatus ServerNetworkAdminSock
 
			break;
 

	
 
		default:
 
			DEBUG(net, 1, "[admin] Invalid chat action %d from admin '%s' (%s).", action, this->admin_name.c_str(), this->admin_version.c_str());
 
			Debug(net, 1, "[admin] Invalid chat action {} from admin '{}' ({}).", action, this->admin_name, this->admin_version);
 
			return this->SendError(NETWORK_ERROR_ILLEGAL_PACKET);
 
	}
 

	
 
@@ -852,7 +852,7 @@ void NetworkAdminClientError(ClientID cl
 
void NetworkAdminCompanyInfo(const Company *company, bool new_company)
 
{
 
	if (company == nullptr) {
 
		DEBUG(net, 1, "[admin] Empty company given for update");
 
		Debug(net, 1, "[admin] Empty company given for update");
 
		return;
 
	}
 

	
src/network/network_client.cpp
Show inline comments
 
@@ -136,7 +136,7 @@ void ClientNetworkEmergencySave()
 
	if (!_networking) return;
 

	
 
	const char *filename = "netsave.sav";
 
	DEBUG(net, 3, "Performing emergency save: %s", filename);
 
	Debug(net, 3, "Performing emergency save: {}", filename);
 
	SaveOrLoad(filename, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false);
 
}
 

	
 
@@ -173,7 +173,7 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	 */
 
	if (this->sock == INVALID_SOCKET) return status;
 

	
 
	DEBUG(net, 3, "Closed client connection %d", this->client_id);
 
	Debug(net, 3, "Closed client connection {}", this->client_id);
 

	
 
	this->SendPackets(true);
 

	
 
@@ -285,8 +285,8 @@ void ClientNetworkGameSocketHandler::Cli
 
			if (_sync_seed_1 != _random.state[0]) {
 
#endif
 
				ShowNetworkError(STR_NETWORK_ERROR_DESYNC);
 
				DEBUG(desync, 1, "sync_err: %08x; %02x", _date, _date_fract);
 
				DEBUG(net, 0, "Sync error detected");
 
				Debug(desync, 1, "sync_err: {:08x}; {:02x}", _date, _date_fract);
 
				Debug(net, 0, "Sync error detected");
 
				my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
 
				return false;
 
			}
 
@@ -301,7 +301,7 @@ void ClientNetworkGameSocketHandler::Cli
 

	
 
			_sync_frame = 0;
 
		} else if (_sync_frame < _frame_counter) {
 
			DEBUG(net, 1, "Missed frame for sync-test: %d / %d", _sync_frame, _frame_counter);
 
			Debug(net, 1, "Missed frame for sync-test: {} / {}", _sync_frame, _frame_counter);
 
			_sync_frame = 0;
 
		}
 
	}
 
@@ -777,7 +777,7 @@ NetworkRecvStatus ClientNetworkGameSocke
 
			/* We do not know this GRF, bail out of initialization */
 
			char buf[sizeof(c.md5sum) * 2 + 1];
 
			md5sumToString(buf, lastof(buf), c.md5sum);
 
			DEBUG(grf, 0, "NewGRF %08X not found; checksum %s", BSWAP32(c.grfid), buf);
 
			Debug(grf, 0, "NewGRF {:08X} not found; checksum {}", BSWAP32(c.grfid), buf);
 
			ret = NETWORK_RECV_STATUS_NEWGRF_MISMATCH;
 
		}
 
	}
 
@@ -974,13 +974,13 @@ NetworkRecvStatus ClientNetworkGameSocke
 
	/* Receive the token. */
 
	if (p->CanReadFromPacket(sizeof(uint8))) this->token = p->Recv_uint8();
 

	
 
	DEBUG(net, 7, "Received FRAME %d", _frame_counter_server);
 
	Debug(net, 7, "Received FRAME {}", _frame_counter_server);
 

	
 
	/* Let the server know that we received this frame correctly
 
	 *  We do this only once per day, to save some bandwidth ;) */
 
	if (!_network_first_time && last_ack_frame < _frame_counter) {
 
		last_ack_frame = _frame_counter + DAY_TICKS;
 
		DEBUG(net, 7, "Sent ACK at %d", _frame_counter);
 
		Debug(net, 7, "Sent ACK at {}", _frame_counter);
 
		SendAck();
 
	}
 

	
 
@@ -1096,7 +1096,7 @@ NetworkRecvStatus ClientNetworkGameSocke
 
		NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, ci->client_name, "", STR_NETWORK_MESSAGE_CLIENT_LEAVING);
 
		delete ci;
 
	} else {
 
		DEBUG(net, 1, "Unknown client (%d) is leaving the game", client_id);
 
		Debug(net, 1, "Unknown client ({}) is leaving the game", client_id);
 
	}
 

	
 
	InvalidateWindowData(WC_CLIENT_LIST, 0);
 
@@ -1175,7 +1175,7 @@ NetworkRecvStatus ClientNetworkGameSocke
 

	
 
	if (client_id == 0) {
 
		/* definitely an invalid client id, debug message and do nothing. */
 
		DEBUG(net, 1, "Received invalid client index = 0");
 
		Debug(net, 1, "Received invalid client index = 0");
 
		return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
	}
 

	
src/network/network_command.cpp
Show inline comments
 
@@ -332,7 +332,7 @@ void NetworkGameSocketHandler::SendComma
 
	}
 

	
 
	if (callback == lengthof(_callback_table)) {
 
		DEBUG(net, 0, "Unknown callback for command; no callback sent (command: %d)", cp->cmd);
 
		Debug(net, 0, "Unknown callback for command; no callback sent (command: {})", cp->cmd);
 
		callback = 0; // _callback_table[0] == nullptr
 
	}
 
	p->Send_uint8 (callback);
src/network/network_server.cpp
Show inline comments
 
@@ -283,7 +283,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 
	}
 

	
 
	NetworkAdminClientError(this->client_id, NETWORK_ERROR_CONNECTION_LOST);
 
	DEBUG(net, 3, "Closed client connection %d", this->client_id);
 
	Debug(net, 3, "Closed client connection {}", this->client_id);
 

	
 
	/* We just lost one client :( */
 
	if (this->status >= STATUS_AUTHORIZED) _network_game_info.clients_on--;
 
@@ -445,7 +445,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 

	
 
		this->GetClientName(client_name, lastof(client_name));
 

	
 
		DEBUG(net, 1, "'%s' made an error and has been disconnected: %s", client_name, GetString(strid).c_str());
 
		Debug(net, 1, "'{}' made an error and has been disconnected: {}", client_name, GetString(strid));
 

	
 
		if (error == NETWORK_ERROR_KICKED && !reason.empty()) {
 
			NetworkTextMessage(NETWORK_ACTION_KICKED, CC_DEFAULT, false, client_name, reason, strid);
 
@@ -466,7 +466,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 

	
 
		NetworkAdminClientError(this->client_id, error);
 
	} else {
 
		DEBUG(net, 1, "Client %d made an error and has been disconnected: %s", this->client_id, GetString(strid).c_str());
 
		Debug(net, 1, "Client {} made an error and has been disconnected: {}", this->client_id, GetString(strid));
 
	}
 

	
 
	/* The client made a mistake, so drop the connection now! */
 
@@ -925,7 +925,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 
	ci->join_date = _date;
 
	ci->client_name = client_name;
 
	ci->client_playas = playas;
 
	DEBUG(desync, 1, "client: %08x; %02x; %02x; %02x", _date, _date_fract, (int)ci->client_playas, (int)ci->index);
 
	Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:02x}", _date, _date_fract, (int)ci->client_playas, (int)ci->index);
 

	
 
	/* Make sure companies to which people try to join are not autocleaned */
 
	if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0;
 
@@ -1133,7 +1133,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 

	
 
	StringID strid = GetNetworkErrorMsg(errorno);
 

	
 
	DEBUG(net, 1, "'%s' reported an error and is closing its connection: %s", client_name, GetString(strid).c_str());
 
	Debug(net, 1, "'{}' reported an error and is closing its connection: {}", client_name, GetString(strid));
 

	
 
	NetworkTextMessage(NETWORK_ACTION_LEAVE, CC_DEFAULT, false, client_name, "", strid);
 

	
 
@@ -1323,7 +1323,7 @@ void NetworkServerSendChat(NetworkAction
 
			break;
 
		}
 
		default:
 
			DEBUG(net, 1, "Received unknown chat destination type %d; doing broadcast instead", desttype);
 
			Debug(net, 1, "Received unknown chat destination type {}; doing broadcast instead", desttype);
 
			FALLTHROUGH;
 

	
 
		case DESTTYPE_BROADCAST:
 
@@ -1425,11 +1425,11 @@ NetworkRecvStatus ServerNetworkGameSocke
 
	std::string command = p->Recv_string(NETWORK_RCONCOMMAND_LENGTH);
 

	
 
	if (_settings_client.network.rcon_password.compare(password) != 0) {
 
		DEBUG(net, 1, "[rcon] Wrong password from client-id %d", this->client_id);
 
		Debug(net, 1, "[rcon] Wrong password from client-id {}", this->client_id);
 
		return NETWORK_RECV_STATUS_OKAY;
 
	}
 

	
 
	DEBUG(net, 3, "[rcon] Client-id %d executed: %s", this->client_id, command.c_str());
 
	Debug(net, 3, "[rcon] Client-id {} executed: {}", this->client_id, command);
 

	
 
	_redirect_console_to_client = this->client_id;
 
	IConsoleCmdExec(command.c_str());
 
@@ -1453,7 +1453,7 @@ NetworkRecvStatus ServerNetworkGameSocke
 

	
 
		/* Incorrect password sent, return! */
 
		if (_network_company_states[company_id].password.compare(password) != 0) {
 
			DEBUG(net, 2, "Wrong password from client-id #%d for company #%d", this->client_id, company_id + 1);
 
			Debug(net, 2, "Wrong password from client-id #{} for company #{}", this->client_id, company_id + 1);
 
			return NETWORK_RECV_STATUS_OKAY;
 
		}
 
	}
 
@@ -1561,7 +1561,7 @@ void NetworkUpdateClientInfo(ClientID cl
 

	
 
	if (ci == nullptr) return;
 

	
 
	DEBUG(desync, 1, "client: %08x; %02x; %02x; %04x", _date, _date_fract, (int)ci->client_playas, client_id);
 
	Debug(desync, 1, "client: {:08x}; {:02x}; {:02x}; {:04x}", _date, _date_fract, (int)ci->client_playas, client_id);
 

	
 
	for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
 
		if (cs->status >= ServerNetworkGameSocketHandler::STATUS_AUTHORIZED) {
 
@@ -1576,7 +1576,7 @@ void NetworkUpdateClientInfo(ClientID cl
 
static void NetworkCheckRestartMap()
 
{
 
	if (_settings_client.network.restart_game_year != 0 && _cur_year >= _settings_client.network.restart_game_year) {
 
		DEBUG(net, 3, "Auto-restarting map: year %d reached", _cur_year);
 
		Debug(net, 3, "Auto-restarting map: year {} reached", _cur_year);
 

	
 
		_settings_newgame.game_creation.generation_seed = GENERATE_NEW_SEED;
 
		switch(_file_to_saveload.abstract_ftype) {
src/network/network_udp.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ struct UDPSocket {
 
		std::unique_lock<std::mutex> lock(mutex, std::defer_lock);
 
		if (!lock.try_lock()) {
 
			if (++receive_iterations_locked % 32 == 0) {
 
				DEBUG(net, 0, "%s background UDP loop processing appears to be blocked. Your OS may be low on UDP send buffers.", name.c_str());
 
				Debug(net, 0, "{} background UDP loop processing appears to be blocked. Your OS may be low on UDP send buffers.", name);
 
			}
 
			return;
 
		}
 
@@ -133,7 +133,7 @@ public:
 
void MasterNetworkUDPSocketHandler::Receive_MASTER_ACK_REGISTER(Packet *p, NetworkAddress *client_addr)
 
{
 
	_network_advertise_retries = 0;
 
	DEBUG(net, 3, "Advertising on master server successful (%s)", NetworkAddress::AddressFamilyAsString(client_addr->GetAddress()->ss_family));
 
	Debug(net, 3, "Advertising on master server successful ({})", NetworkAddress::AddressFamilyAsString(client_addr->GetAddress()->ss_family));
 

	
 
	/* We are advertised, but we don't want to! */
 
	if (!_settings_client.network.server_advertise) NetworkUDPRemoveAdvertise(false);
 
@@ -142,7 +142,7 @@ void MasterNetworkUDPSocketHandler::Rece
 
void MasterNetworkUDPSocketHandler::Receive_MASTER_SESSION_KEY(Packet *p, NetworkAddress *client_addr)
 
{
 
	_session_key = p->Recv_uint64();
 
	DEBUG(net, 6, "Received new session key from master server (%s)", NetworkAddress::AddressFamilyAsString(client_addr->GetAddress()->ss_family));
 
	Debug(net, 6, "Received new session key from master server ({})", NetworkAddress::AddressFamilyAsString(client_addr->GetAddress()->ss_family));
 
}
 

	
 
///*** Communication with clients (we are server) ***/
 
@@ -175,7 +175,7 @@ void ServerNetworkUDPSocketHandler::Rece
 
	/* Let the client know that we are here */
 
	this->SendPacket(&packet, client_addr);
 

	
 
	DEBUG(net, 7, "Queried from %s", client_addr->GetHostname());
 
	Debug(net, 7, "Queried from {}", client_addr->GetHostname());
 
}
 

	
 
void ServerNetworkUDPSocketHandler::Receive_CLIENT_DETAIL_INFO(Packet *p, NetworkAddress *client_addr)
 
@@ -252,7 +252,7 @@ void ServerNetworkUDPSocketHandler::Rece
 
	uint8 in_reply_count = 0;
 
	size_t packet_len = 0;
 

	
 
	DEBUG(net, 7, "NewGRF data request from %s", client_addr->GetAddressAsString().c_str());
 
	Debug(net, 7, "NewGRF data request from {}", client_addr->GetAddressAsString());
 

	
 
	num_grfs = p->Recv_uint8 ();
 
	if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
 
@@ -314,7 +314,7 @@ void ClientNetworkUDPSocketHandler::Rece
 
	/* Just a fail-safe.. should never happen */
 
	if (_network_udp_server) return;
 

	
 
	DEBUG(net, 3, "Server response from %s", client_addr->GetAddressAsString().c_str());
 
	Debug(net, 3, "Server response from {}", client_addr->GetAddressAsString());
 

	
 
	/* Find next item */
 
	item = NetworkGameListAddItem(client_addr->GetAddressAsString(false));
 
@@ -409,7 +409,7 @@ void ClientNetworkUDPSocketHandler::Rece
 
	uint8 num_grfs;
 
	uint i;
 

	
 
	DEBUG(net, 7, "NewGRF data reply from %s", client_addr->GetAddressAsString().c_str());
 
	Debug(net, 7, "NewGRF data reply from {}", client_addr->GetAddressAsString());
 

	
 
	num_grfs = p->Recv_uint8 ();
 
	if (num_grfs > NETWORK_MAX_GRF_COUNT) return;
 
@@ -440,7 +440,7 @@ static void NetworkUDPBroadCast(NetworkU
 
	for (NetworkAddress &addr : _broadcast_list) {
 
		Packet p(PACKET_UDP_CLIENT_FIND_SERVER);
 

	
 
		DEBUG(net, 5, "Broadcasting to %s", addr.GetHostname());
 
		Debug(net, 5, "Broadcasting to {}", addr.GetHostname());
 

	
 
		socket->SendPacket(&p, &addr, true, true);
 
	}
 
@@ -460,7 +460,7 @@ void NetworkUDPQueryMasterServer()
 
	std::lock_guard<std::mutex> lock(_udp_client.mutex);
 
	_udp_client.socket->SendPacket(&p, &out_addr, true);
 

	
 
	DEBUG(net, 6, "Master server queried at %s", out_addr.GetAddressAsString().c_str());
 
	Debug(net, 6, "Master server queried at {}", out_addr.GetAddressAsString());
 
}
 

	
 
/** Find all servers */
 
@@ -469,7 +469,7 @@ void NetworkUDPSearchGame()
 
	/* We are still searching.. */
 
	if (_network_udp_broadcast > 0) return;
 

	
 
	DEBUG(net, 3, "Searching server");
 
	Debug(net, 3, "Searching server");
 

	
 
	NetworkUDPBroadCast(_udp_client.socket);
 
	_network_udp_broadcast = 300; // Stay searching for 300 ticks
 
@@ -480,7 +480,7 @@ void NetworkUDPSearchGame()
 
 */
 
static void NetworkUDPRemoveAdvertiseThread()
 
{
 
	DEBUG(net, 3, "Removing advertise from master server");
 
	Debug(net, 3, "Removing advertise from master server");
 

	
 
	/* Find somewhere to send */
 
	NetworkAddress out_addr(NETWORK_MASTER_SERVER_HOST, NETWORK_MASTER_SERVER_PORT);
 
@@ -517,22 +517,22 @@ static void NetworkUDPAdvertiseThread()
 
	/* Find somewhere to send */
 
	NetworkAddress out_addr(NETWORK_MASTER_SERVER_HOST, NETWORK_MASTER_SERVER_PORT);
 

	
 
	DEBUG(net, 3, "Advertising to master server");
 
	Debug(net, 3, "Advertising to master server");
 

	
 
	/* Add a bit more messaging when we cannot get a session key */
 
	static byte session_key_retries = 0;
 
	if (_session_key == 0 && session_key_retries++ == 2) {
 
		DEBUG(net, 0, "Advertising to the master server is failing");
 
		DEBUG(net, 0, "  we are not receiving the session key from the server");
 
		DEBUG(net, 0, "  please allow udp packets from %s to you to be delivered", out_addr.GetAddressAsString(false).c_str());
 
		DEBUG(net, 0, "  please allow udp packets from you to %s to be delivered", out_addr.GetAddressAsString(false).c_str());
 
		Debug(net, 0, "Advertising to the master server is failing");
 
		Debug(net, 0, "  we are not receiving the session key from the server");
 
		Debug(net, 0, "  please allow udp packets from {} to you to be delivered", out_addr.GetAddressAsString(false));
 
		Debug(net, 0, "  please allow udp packets from you to {} to be delivered", out_addr.GetAddressAsString(false));
 
	}
 
	if (_session_key != 0 && _network_advertise_retries == 0) {
 
		DEBUG(net, 0, "Advertising to the master server is failing");
 
		DEBUG(net, 0, "  we are not receiving the acknowledgement from the server");
 
		DEBUG(net, 0, "  this usually means that the master server cannot reach us");
 
		DEBUG(net, 0, "  please allow udp and tcp packets to port %u to be delivered", _settings_client.network.server_port);
 
		DEBUG(net, 0, "  please allow udp and tcp packets from port %u to be delivered", _settings_client.network.server_port);
 
		Debug(net, 0, "Advertising to the master server is failing");
 
		Debug(net, 0, "  we are not receiving the acknowledgement from the server");
 
		Debug(net, 0, "  this usually means that the master server cannot reach us");
 
		Debug(net, 0, "  please allow udp and tcp packets to port {} to be delivered", _settings_client.network.server_port);
 
		Debug(net, 0, "  please allow udp and tcp packets from port {} to be delivered", _settings_client.network.server_port);
 
	}
 

	
 
	/* Send the packet */
 
@@ -588,7 +588,7 @@ void NetworkUDPInitialize()
 
	/* If not closed, then do it. */
 
	if (_udp_server.socket != nullptr) NetworkUDPClose();
 

	
 
	DEBUG(net, 3, "Initializing UDP listeners");
 
	Debug(net, 3, "Initializing UDP listeners");
 
	assert(_udp_client.socket == nullptr && _udp_server.socket == nullptr && _udp_master.socket == nullptr);
 

	
 
	std::scoped_lock lock(_udp_client.mutex, _udp_server.mutex, _udp_master.mutex);
 
@@ -624,7 +624,7 @@ void NetworkUDPClose()
 

	
 
	_network_udp_server = false;
 
	_network_udp_broadcast = 0;
 
	DEBUG(net, 5, "Closed UDP listeners");
 
	Debug(net, 5, "Closed UDP listeners");
 
}
 

	
 
/** Receive the UDP packets. */
src/newgrf.cpp
Show inline comments
 
@@ -380,8 +380,8 @@ typedef std::map<GRFLocation, byte*> GRF
 
static GRFLineToSpriteOverride _grf_line_to_action6_sprite_override;
 

	
 
/**
 
 * DEBUG() function dedicated to newGRF debugging messages
 
 * Function is essentially the same as DEBUG(grf, severity, ...) with the
 
 * Debug() function dedicated to newGRF debugging messages
 
 * Function is essentially the same as Debug(grf, severity, ...) with the
 
 * addition of file:line information when parsing grf files.
 
 * NOTE: for the above reason(s) grfmsg() should ONLY be used for
 
 * loading/parsing grf files, not for runtime debug messages as there
 
@@ -398,7 +398,7 @@ void CDECL grfmsg(int severity, const ch
 
	vseprintf(buf, lastof(buf), str, va);
 
	va_end(va);
 

	
 
	DEBUG(grf, severity, "[%s:%d] %s", _cur.grfconfig->filename, _cur.nfo_line, buf);
 
	Debug(grf, severity, "[{}:{}] {}", _cur.grfconfig->filename, _cur.nfo_line, buf);
 
}
 

	
 
/**
 
@@ -549,7 +549,7 @@ static StringID TTDPStringIDToOTTDString
 

	
 
	if (str == STR_NULL) return STR_EMPTY;
 

	
 
	DEBUG(grf, 0, "Unknown StringID 0x%04X remapped to STR_EMPTY. Please open a Feature Request if you need it", str);
 
	Debug(grf, 0, "Unknown StringID 0x{:04X} remapped to STR_EMPTY. Please open a Feature Request if you need it", str);
 

	
 
	return STR_EMPTY;
 
}
 
@@ -6731,7 +6731,7 @@ static void ScanInfo(ByteReader *buf)
 

	
 
	if (grf_version < 2 || grf_version > 8) {
 
		SetBit(_cur.grfconfig->flags, GCF_INVALID);
 
		DEBUG(grf, 0, "%s: NewGRF \"%s\" (GRFID %08X) uses GRF version %d, which is incompatible with this version of OpenTTD.", _cur.grfconfig->filename, name, BSWAP32(grfid), grf_version);
 
		Debug(grf, 0, "{}: NewGRF \"{}\" (GRFID {:08X}) uses GRF version {}, which is incompatible with this version of OpenTTD.", _cur.grfconfig->filename, name, BSWAP32(grfid), grf_version);
 
	}
 

	
 
	/* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */
 
@@ -6768,7 +6768,7 @@ static void GRFInfo(ByteReader *buf)
 
	}
 

	
 
	if (_cur.grffile->grfid != grfid) {
 
		DEBUG(grf, 0, "GRFInfo: GRFID %08X in FILESCAN stage does not match GRFID %08X in INIT/RESERVE/ACTIVATION stage", BSWAP32(_cur.grffile->grfid), BSWAP32(grfid));
 
		Debug(grf, 0, "GRFInfo: GRFID {:08X} in FILESCAN stage does not match GRFID {:08X} in INIT/RESERVE/ACTIVATION stage", BSWAP32(_cur.grffile->grfid), BSWAP32(grfid));
 
		_cur.grffile->grfid = grfid;
 
	}
 

	
 
@@ -6776,7 +6776,7 @@ static void GRFInfo(ByteReader *buf)
 
	_cur.grfconfig->status = _cur.stage < GLS_RESERVE ? GCS_INITIALISED : GCS_ACTIVATED;
 

	
 
	/* Do swap the GRFID for displaying purposes since people expect that */
 
	DEBUG(grf, 1, "GRFInfo: Loaded GRFv%d set %08X - %s (palette: %s, version: %i)", version, BSWAP32(grfid), name, (_cur.grfconfig->palette & GRFP_USE_MASK) ? "Windows" : "DOS", _cur.grfconfig->version);
 
	Debug(grf, 1, "GRFInfo: Loaded GRFv{} set {:08X} - {} (palette: {}, version: {})", version, BSWAP32(grfid), name, (_cur.grfconfig->palette & GRFP_USE_MASK) ? "Windows" : "DOS", _cur.grfconfig->version);
 
}
 

	
 
/* Action 0x0A */
 
@@ -9019,7 +9019,7 @@ static bool IsHouseSpecValid(HouseSpec *
 
				(next2 == nullptr || !next2->enabled || (next2->building_flags & BUILDING_HAS_1_TILE) != 0 ||
 
				next3 == nullptr || !next3->enabled || (next3->building_flags & BUILDING_HAS_1_TILE) != 0))) {
 
		hs->enabled = false;
 
		if (filename != nullptr) DEBUG(grf, 1, "FinaliseHouseArray: %s defines house %d as multitile, but no suitable tiles follow. Disabling house.", filename, hs->grf_prop.local_id);
 
		if (filename != nullptr) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} as multitile, but no suitable tiles follow. Disabling house.", filename, hs->grf_prop.local_id);
 
		return false;
 
	}
 

	
 
@@ -9029,7 +9029,7 @@ static bool IsHouseSpecValid(HouseSpec *
 
	if (((hs->building_flags & BUILDING_HAS_2_TILES) != 0 && next1->population != 0) ||
 
			((hs->building_flags & BUILDING_HAS_4_TILES) != 0 && (next2->population != 0 || next3->population != 0))) {
 
		hs->enabled = false;
 
		if (filename != nullptr) DEBUG(grf, 1, "FinaliseHouseArray: %s defines multitile house %d with non-zero population on additional tiles. Disabling house.", filename, hs->grf_prop.local_id);
 
		if (filename != nullptr) Debug(grf, 1, "FinaliseHouseArray: {} defines multitile house {} with non-zero population on additional tiles. Disabling house.", filename, hs->grf_prop.local_id);
 
		return false;
 
	}
 

	
 
@@ -9037,14 +9037,14 @@ static bool IsHouseSpecValid(HouseSpec *
 
	 * This check should only be done for NewGRF houses because grf_prop.subst_id is not set for original houses.*/
 
	if (filename != nullptr && (hs->building_flags & BUILDING_HAS_1_TILE) != (HouseSpec::Get(hs->grf_prop.subst_id)->building_flags & BUILDING_HAS_1_TILE)) {
 
		hs->enabled = false;
 
		DEBUG(grf, 1, "FinaliseHouseArray: %s defines house %d with different house size then it's substitute type. Disabling house.", filename, hs->grf_prop.local_id);
 
		Debug(grf, 1, "FinaliseHouseArray: {} defines house {} with different house size then it's substitute type. Disabling house.", filename, hs->grf_prop.local_id);
 
		return false;
 
	}
 

	
 
	/* Make sure that additional parts of multitile houses are not available. */
 
	if ((hs->building_flags & BUILDING_HAS_1_TILE) == 0 && (hs->building_availability & HZ_ZONALL) != 0 && (hs->building_availability & HZ_CLIMALL) != 0) {
 
		hs->enabled = false;
 
		if (filename != nullptr) DEBUG(grf, 1, "FinaliseHouseArray: %s defines house %d without a size but marked it as available. Disabling house.", filename, hs->grf_prop.local_id);
 
		if (filename != nullptr) Debug(grf, 1, "FinaliseHouseArray: {} defines house {} without a size but marked it as available. Disabling house.", filename, hs->grf_prop.local_id);
 
		return false;
 
	}
 

	
 
@@ -9361,11 +9361,11 @@ static void LoadNewGRFFileFromFile(GRFCo
 
	_cur.file = &file;
 
	_cur.grfconfig = config;
 

	
 
	DEBUG(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '%s'", config->filename);
 
	Debug(grf, 2, "LoadNewGRFFile: Reading NewGRF-file '{}'", config->filename);
 

	
 
	byte grf_container_version = file.GetContainerVersion();
 
	if (grf_container_version == 0) {
 
		DEBUG(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
 
		Debug(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
 
		return;
 
	}
 

	
 
@@ -9382,7 +9382,7 @@ static void LoadNewGRFFileFromFile(GRFCo
 
		/* Read compression value. */
 
		byte compression = file.ReadByte();
 
		if (compression != 0) {
 
			DEBUG(grf, 7, "LoadNewGRFFile: Unsupported compression format");
 
			Debug(grf, 7, "LoadNewGRFFile: Unsupported compression format");
 
			return;
 
		}
 
	}
 
@@ -9394,7 +9394,7 @@ static void LoadNewGRFFileFromFile(GRFCo
 
	if (num == 4 && file.ReadByte() == 0xFF) {
 
		file.ReadDword();
 
	} else {
 
		DEBUG(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
 
		Debug(grf, 7, "LoadNewGRFFile: Custom .grf has invalid format");
 
		return;
 
	}
 

	
 
@@ -9569,7 +9569,7 @@ static void FinalisePriceBaseMultipliers
 
		for (Price p = PR_BEGIN; p < PR_END; p++) {
 
			/* No price defined -> nothing to do */
 
			if (!HasBit(features, _price_base_specs[p].grf_feature) || source->price_base_multipliers[p] == INVALID_PRICE_MODIFIER) continue;
 
			DEBUG(grf, 3, "'%s' overrides price base multiplier %d of '%s'", source->filename, p, dest->filename);
 
			Debug(grf, 3, "'{}' overrides price base multiplier {} of '{}'", source->filename, p, dest->filename);
 
			dest->price_base_multipliers[p] = source->price_base_multipliers[p];
 
		}
 
	}
 
@@ -9587,7 +9587,7 @@ static void FinalisePriceBaseMultipliers
 
		for (Price p = PR_BEGIN; p < PR_END; p++) {
 
			/* Already a price defined -> nothing to do */
 
			if (!HasBit(features, _price_base_specs[p].grf_feature) || dest->price_base_multipliers[p] != INVALID_PRICE_MODIFIER) continue;
 
			DEBUG(grf, 3, "Price base multiplier %d from '%s' propagated to '%s'", p, source->filename, dest->filename);
 
			Debug(grf, 3, "Price base multiplier {} from '{}' propagated to '{}'", p, source->filename, dest->filename);
 
			dest->price_base_multipliers[p] = source->price_base_multipliers[p];
 
		}
 
	}
 
@@ -9605,7 +9605,7 @@ static void FinalisePriceBaseMultipliers
 
		for (Price p = PR_BEGIN; p < PR_END; p++) {
 
			if (!HasBit(features, _price_base_specs[p].grf_feature)) continue;
 
			if (source->price_base_multipliers[p] != dest->price_base_multipliers[p]) {
 
				DEBUG(grf, 3, "Price base multiplier %d from '%s' propagated to '%s'", p, dest->filename, source->filename);
 
				Debug(grf, 3, "Price base multiplier {} from '{}' propagated to '{}'", p, dest->filename, source->filename);
 
			}
 
			source->price_base_multipliers[p] = dest->price_base_multipliers[p];
 
		}
 
@@ -9636,11 +9636,11 @@ static void FinalisePriceBaseMultipliers
 
				if (!HasBit(file->grf_features, _price_base_specs[p].grf_feature)) {
 
					/* The grf does not define any objects of the feature,
 
					 * so it must be a difficulty setting. Apply it globally */
 
					DEBUG(grf, 3, "'%s' sets global price base multiplier %d", file->filename, p);
 
					Debug(grf, 3, "'{}' sets global price base multiplier {}", file->filename, p);
 
					SetPriceBaseMultiplier(p, price_base_multipliers[p]);
 
					price_base_multipliers[p] = 0;
 
				} else {
 
					DEBUG(grf, 3, "'%s' sets local price base multiplier %d", file->filename, p);
 
					Debug(grf, 3, "'{}' sets local price base multiplier {}", file->filename, p);
 
				}
 
			}
 
		}
 
@@ -9839,7 +9839,7 @@ void LoadNewGRF(uint load_index, uint nu
 

	
 
			Subdirectory subdir = num_grfs < num_baseset ? BASESET_DIR : NEWGRF_DIR;
 
			if (!FioCheckFileExists(c->filename, subdir)) {
 
				DEBUG(grf, 0, "NewGRF file is missing '%s'; disabling", c->filename);
 
				Debug(grf, 0, "NewGRF file is missing '{}'; disabling", c->filename);
 
				c->status = GCS_NOT_FOUND;
 
				continue;
 
			}
 
@@ -9848,7 +9848,7 @@ void LoadNewGRF(uint load_index, uint nu
 

	
 
			if (!HasBit(c->flags, GCF_STATIC) && !HasBit(c->flags, GCF_SYSTEM)) {
 
				if (num_non_static == NETWORK_MAX_GRF_COUNT) {
 
					DEBUG(grf, 0, "'%s' is not loaded as the maximum number of non-static GRFs has been reached", c->filename);
 
					Debug(grf, 0, "'{}' is not loaded as the maximum number of non-static GRFs has been reached", c->filename);
 
					c->status = GCS_DISABLED;
 
					c->error  = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
 
					continue;
 
@@ -9857,7 +9857,7 @@ void LoadNewGRF(uint load_index, uint nu
 
			}
 

	
 
			if (num_grfs >= MAX_GRF_COUNT) {
 
				DEBUG(grf, 0, "'%s' is not loaded as the maximum number of file slots has been reached", c->filename);
 
				Debug(grf, 0, "'{}' is not loaded as the maximum number of file slots has been reached", c->filename);
 
				c->status = GCS_DISABLED;
 
				c->error  = new GRFError(STR_NEWGRF_ERROR_MSG_FATAL, STR_NEWGRF_ERROR_TOO_MANY_NEWGRFS_LOADED);
 
				continue;
 
@@ -9872,7 +9872,7 @@ void LoadNewGRF(uint load_index, uint nu
 
				assert(GetFileByGRFID(c->ident.grfid) == _cur.grffile);
 
				ClearTemporaryNewGRFData(_cur.grffile);
 
				BuildCargoTranslationMap();
 
				DEBUG(sprite, 2, "LoadNewGRF: Currently %i sprites are loaded", _cur.spriteid);
 
				Debug(sprite, 2, "LoadNewGRF: Currently {} sprites are loaded", _cur.spriteid);
 
			} else if (stage == GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) {
 
				/* We're not going to activate this, so free whatever data we allocated */
 
				ClearTemporaryNewGRFData(_cur.grffile);
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -193,7 +193,7 @@ static uint32 GetAirportTileIDAtOffset(T
 
		case 0x62: return GetAirportTileIDAtOffset(GetNearbyTile(parameter, this->tile), this->st, this->ro.grffile->grfid);
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled airport tile variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled airport tile variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_canal.cpp
Show inline comments
 
@@ -100,7 +100,7 @@ struct CanalResolverObject : public Reso
 
		case 0x83: return IsTileType(this->tile, MP_WATER) ? GetWaterTileRandomBits(this->tile) : 0;
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled canal variable 0x%02X", variable);
 
	Debug(grf, 1, "Unhandled canal variable 0x{:02X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_commons.cpp
Show inline comments
 
@@ -530,12 +530,12 @@ void ErrorUnknownCallbackResult(uint32 g
 

	
 
	SetDParamStr(0, grfconfig->GetName());
 
	GetString(buffer, STR_NEWGRF_BUGGY, lastof(buffer));
 
	DEBUG(grf, 0, "%s", buffer + 3);
 
	Debug(grf, 0, "{}", buffer + 3);
 

	
 
	SetDParam(1, cbid);
 
	SetDParam(2, cb_res);
 
	GetString(buffer, STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT, lastof(buffer));
 
	DEBUG(grf, 0, "%s", buffer + 3);
 
	Debug(grf, 0, "{}", buffer + 3);
 
}
 

	
 
/**
src/newgrf_config.cpp
Show inline comments
 
@@ -307,7 +307,7 @@ size_t GRFGetSizeOfDataSection(FILE *f)
 
			/* Valid container version 2, get data section size. */
 
			size_t offset = ((size_t)data[13] << 24) | ((size_t)data[12] << 16) | ((size_t)data[11] << 8) | (size_t)data[10];
 
			if (offset >= 1 * 1024 * 1024 * 1024) {
 
				DEBUG(grf, 0, "Unexpectedly large offset for NewGRF");
 
				Debug(grf, 0, "Unexpectedly large offset for NewGRF");
 
				/* Having more than 1 GiB of data is very implausible. Mostly because then
 
				 * all pools in OpenTTD are flooded already. Or it's just Action C all over.
 
				 * In any case, the offsets to graphics will likely not work either. */
 
@@ -524,7 +524,7 @@ GRFListCompatibility IsGoodGRFConfigList
 
			f = FindGRFConfig(c->ident.grfid, FGCM_COMPATIBLE, nullptr, c->version);
 
			if (f != nullptr) {
 
				md5sumToString(buf, lastof(buf), c->ident.md5sum);
 
				DEBUG(grf, 1, "NewGRF %08X (%s) not found; checksum %s. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, buf);
 
				Debug(grf, 1, "NewGRF {:08X} ({}) not found; checksum {}. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, buf);
 
				if (!HasBit(c->flags, GCF_COMPATIBLE)) {
 
					/* Preserve original_md5sum after it has been assigned */
 
					SetBit(c->flags, GCF_COMPATIBLE);
 
@@ -538,13 +538,13 @@ GRFListCompatibility IsGoodGRFConfigList
 

	
 
			/* No compatible grf was found, mark it as disabled */
 
			md5sumToString(buf, lastof(buf), c->ident.md5sum);
 
			DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->ident.grfid), c->filename, buf);
 
			Debug(grf, 0, "NewGRF {:08X} ({}) not found; checksum {}", BSWAP32(c->ident.grfid), c->filename, buf);
 

	
 
			c->status = GCS_NOT_FOUND;
 
			res = GLC_NOT_FOUND;
 
		} else {
 
compatible_grf:
 
			DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->ident.grfid), f->filename);
 
			Debug(grf, 1, "Loading GRF {:08X} from {}", BSWAP32(f->ident.grfid), f->filename);
 
			/* The filename could be the filename as in the savegame. As we need
 
			 * to load the GRF here, we need the correct filename, so overwrite that
 
			 * in any case and set the name and info when it is not set already.
 
@@ -673,10 +673,10 @@ void DoScanNewGRFFiles(NewGRFScanCallbac
 
	ClearGRFConfigList(&_all_grfs);
 
	TarScanner::DoScan(TarScanner::NEWGRF);
 

	
 
	DEBUG(grf, 1, "Scanning for NewGRFs");
 
	Debug(grf, 1, "Scanning for NewGRFs");
 
	uint num = GRFFileScanner::DoScan();
 

	
 
	DEBUG(grf, 1, "Scan complete, found %d files", num);
 
	Debug(grf, 1, "Scan complete, found {} files", num);
 
	if (num != 0 && _all_grfs != nullptr) {
 
		/* Sort the linked list using quicksort.
 
		 * For that we first have to make an array, then sort and
src/newgrf_engine.cpp
Show inline comments
 
@@ -946,7 +946,7 @@ static uint32 VehicleGetVariable(Vehicle
 
		default: break;
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled vehicle variable 0x%X, type 0x%X", variable, (uint)v->type);
 
	Debug(grf, 1, "Unhandled vehicle variable 0x{:X}, type 0x{:X}", variable, (uint)v->type);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_generic.cpp
Show inline comments
 
@@ -139,7 +139,7 @@ void AddGenericCallback(uint8 feature, c
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled generic feature variable 0x%02X", variable);
 
	Debug(grf, 1, "Unhandled generic feature variable 0x{:02X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_house.cpp
Show inline comments
 
@@ -404,7 +404,7 @@ static uint32 GetDistanceFromNearbyHouse
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled house variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled house variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_industries.cpp
Show inline comments
 
@@ -168,7 +168,7 @@ static uint32 GetCountAndDistanceOfClose
 
			case 0x82: return this->industry->town->index;
 
			case 0x83:
 
			case 0x84:
 
			case 0x85: DEBUG(grf, 0, "NewGRFs shouldn't be doing pointer magic"); break; // not supported
 
			case 0x85: Debug(grf, 0, "NewGRFs shouldn't be doing pointer magic"); break; // not supported
 

	
 
			/* Number of the layout */
 
			case 0x86: return this->industry->selected_layout;
 
@@ -199,7 +199,7 @@ static uint32 GetCountAndDistanceOfClose
 
	const IndustrySpec *indspec = GetIndustrySpec(this->type);
 

	
 
	if (this->industry == nullptr) {
 
		DEBUG(grf, 1, "Unhandled variable 0x%X (no available industry) in callback 0x%x", variable, this->ro.callback);
 
		Debug(grf, 1, "Unhandled variable 0x{:X} (no available industry) in callback 0x{:x}", variable, this->ro.callback);
 

	
 
		*available = false;
 
		return UINT_MAX;
 
@@ -352,7 +352,7 @@ static uint32 GetCountAndDistanceOfClose
 
		case 0x82: return this->industry->town->index;
 
		case 0x83:
 
		case 0x84:
 
		case 0x85: DEBUG(grf, 0, "NewGRFs shouldn't be doing pointer magic"); break; // not supported
 
		case 0x85: Debug(grf, 0, "NewGRFs shouldn't be doing pointer magic"); break; // not supported
 
		case 0x86: return this->industry->location.w;
 
		case 0x87: return this->industry->location.h;// xy dimensions
 

	
 
@@ -408,7 +408,7 @@ static uint32 GetCountAndDistanceOfClose
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled industry variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled industry variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -93,7 +93,7 @@ uint32 GetRelativePosition(TileIndex til
 
		case 0x62: return GetIndustryIDAtOffset(GetNearbyTile(parameter, this->tile), this->industry, this->ro.grffile->grfid);
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled industry tile variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled industry tile variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_object.cpp
Show inline comments
 
@@ -335,7 +335,7 @@ static uint32 GetCountAndDistanceOfClose
 
	}
 

	
 
unhandled:
 
	DEBUG(grf, 1, "Unhandled object variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled object variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_railtype.cpp
Show inline comments
 
@@ -52,7 +52,7 @@
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled rail type tile variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled rail type tile variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_roadtype.cpp
Show inline comments
 
@@ -52,7 +52,7 @@
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled road type tile variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled road type tile variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_sound.cpp
Show inline comments
 
@@ -86,14 +86,14 @@ bool LoadNewGRFSound(SoundEntry *sound)
 

	
 
	/* Test string termination */
 
	if (name[name_len] != 0) {
 
		DEBUG(grf, 2, "LoadNewGRFSound [%s]: Name not properly terminated", file.GetSimplifiedFilename().c_str());
 
		Debug(grf, 2, "LoadNewGRFSound [{}]: Name not properly terminated", file.GetSimplifiedFilename());
 
		return false;
 
	}
 

	
 
	DEBUG(grf, 2, "LoadNewGRFSound [%s]: Sound name '%s'...", file.GetSimplifiedFilename().c_str(), name);
 
	Debug(grf, 2, "LoadNewGRFSound [{}]: Sound name '{}'...", file.GetSimplifiedFilename(), name);
 

	
 
	if (file.ReadDword() != BSWAP32('RIFF')) {
 
		DEBUG(grf, 1, "LoadNewGRFSound [%s]: Missing RIFF header", file.GetSimplifiedFilename().c_str());
 
		Debug(grf, 1, "LoadNewGRFSound [{}]: Missing RIFF header", file.GetSimplifiedFilename());
 
		return false;
 
	}
 

	
 
@@ -101,12 +101,12 @@ bool LoadNewGRFSound(SoundEntry *sound)
 
	uint header_size = 11;
 
	if (sound->grf_container_ver >= 2) header_size++; // The first FF in the sprite is only counted for container version >= 2.
 
	if (total_size + name_len + header_size > num) {
 
		DEBUG(grf, 1, "LoadNewGRFSound [%s]: RIFF was truncated", file.GetSimplifiedFilename().c_str());
 
		Debug(grf, 1, "LoadNewGRFSound [{}]: RIFF was truncated", file.GetSimplifiedFilename());
 
		return false;
 
	}
 

	
 
	if (file.ReadDword() != BSWAP32('WAVE')) {
 
		DEBUG(grf, 1, "LoadNewGRFSound [%s]: Invalid RIFF type", file.GetSimplifiedFilename().c_str());
 
		Debug(grf, 1, "LoadNewGRFSound [{}]: Invalid RIFF type", file.GetSimplifiedFilename());
 
		return false;
 
	}
 

	
 
@@ -115,7 +115,7 @@ bool LoadNewGRFSound(SoundEntry *sound)
 
		uint32 size = file.ReadDword();
 
		total_size -= 8;
 
		if (total_size < size) {
 
			DEBUG(grf, 1, "LoadNewGRFSound [%s]: Invalid RIFF", file.GetSimplifiedFilename().c_str());
 
			Debug(grf, 1, "LoadNewGRFSound [{}]: Invalid RIFF", file.GetSimplifiedFilename());
 
			return false;
 
		}
 
		total_size -= size;
 
@@ -124,7 +124,7 @@ bool LoadNewGRFSound(SoundEntry *sound)
 
			case ' tmf': // 'fmt '
 
				/* Audio format, must be 1 (PCM) */
 
				if (size < 16 || file.ReadWord() != 1) {
 
					DEBUG(grf, 1, "LoadGRFSound [%s]: Invalid audio format", file.GetSimplifiedFilename().c_str());
 
					Debug(grf, 1, "LoadGRFSound [{}]: Invalid audio format", file.GetSimplifiedFilename());
 
					return false;
 
				}
 
				sound->channels = file.ReadWord();
 
@@ -141,7 +141,7 @@ bool LoadNewGRFSound(SoundEntry *sound)
 
				sound->file_size   = size;
 
				sound->file_offset = file.GetPos();
 

	
 
				DEBUG(grf, 2, "LoadNewGRFSound [%s]: channels %u, sample rate %u, bits per sample %u, length %u", file.GetSimplifiedFilename().c_str(), sound->channels, sound->rate, sound->bits_per_sample, size);
 
				Debug(grf, 2, "LoadNewGRFSound [{}]: channels {}, sample rate {}, bits per sample {}, length {}", file.GetSimplifiedFilename(), sound->channels, sound->rate, sound->bits_per_sample, size);
 
				return true; // the fmt chunk has to appear before data, so we are finished
 

	
 
			default:
 
@@ -153,7 +153,7 @@ bool LoadNewGRFSound(SoundEntry *sound)
 
		if (size > 0) file.SkipBytes(size);
 
	}
 

	
 
	DEBUG(grf, 1, "LoadNewGRFSound [%s]: RIFF does not contain any sound data", file.GetSimplifiedFilename().c_str());
 
	Debug(grf, 1, "LoadNewGRFSound [{}]: RIFF does not contain any sound data", file.GetSimplifiedFilename());
 

	
 
	/* Clear everything that was read */
 
	MemSetT(sound, 0);
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -105,7 +105,7 @@ static inline uint32 GetVariable(const R
 
 */
 
/* virtual */ uint32 ScopeResolver::GetVariable(byte variable, uint32 parameter, bool *available) const
 
{
 
	DEBUG(grf, 1, "Unhandled scope variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled scope variable 0x{:X}", variable);
 
	*available = false;
 
	return UINT_MAX;
 
}
src/newgrf_station.cpp
Show inline comments
 
@@ -454,7 +454,7 @@ uint32 Station::GetNewGRFVariable(const 
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled station variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled station variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
 
@@ -486,7 +486,7 @@ uint32 Waypoint::GetNewGRFVariable(const
 
		}
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled station variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled station variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/newgrf_storage.cpp
Show inline comments
 
@@ -92,7 +92,7 @@ void AddChangedPersistentStorage(BasePer
 

	
 
	/* Discard all temporary changes */
 
	for (std::set<BasePersistentStorageArray*>::iterator it = _changed_storage_arrays->begin(); it != _changed_storage_arrays->end(); it++) {
 
		DEBUG(desync, 1, "Discarding persistent storage changes: Feature %d, GrfID %08X, Tile %d", (*it)->feature, BSWAP32((*it)->grfid), (*it)->tile);
 
		Debug(desync, 1, "Discarding persistent storage changes: Feature {}, GrfID {:08X}, Tile {}", (*it)->feature, BSWAP32((*it)->grfid), (*it)->tile);
 
		(*it)->ClearChanges();
 
	}
 
	_changed_storage_arrays->clear();
src/newgrf_text.cpp
Show inline comments
 
@@ -884,7 +884,7 @@ uint RemapNewGRFStringControlCode(uint s
 
		case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
 
		case SCC_NEWGRF_PRINT_WORD_CARGO_NAME:
 
			if (argv_size < 1) {
 
				DEBUG(misc, 0, "Too many NewGRF string parameters.");
 
				Debug(misc, 0, "Too many NewGRF string parameters.");
 
				return 0;
 
			}
 
			break;
 
@@ -893,7 +893,7 @@ uint RemapNewGRFStringControlCode(uint s
 
		case SCC_NEWGRF_PRINT_WORD_CARGO_SHORT:
 
		case SCC_NEWGRF_PRINT_WORD_CARGO_TINY:
 
			if (argv_size < 2) {
 
				DEBUG(misc, 0, "Too many NewGRF string parameters.");
 
				Debug(misc, 0, "Too many NewGRF string parameters.");
 
				return 0;
 
			}
 
			break;
src/newgrf_town.cpp
Show inline comments
 
@@ -111,7 +111,7 @@
 
		case 0xD5: return this->t->fund_buildings_months;
 
	}
 

	
 
	DEBUG(grf, 1, "Unhandled town variable 0x%X", variable);
 
	Debug(grf, 1, "Unhandled town variable 0x{:X}", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
src/openttd.cpp
Show inline comments
 
@@ -188,7 +188,7 @@ static void ShowHelp()
 
		"  -p password         = Password to join server\n"
 
		"  -P password         = Password to join company\n"
 
		"  -D [ip][:port]      = Start dedicated server\n"
 
		"  -l ip[:port]        = Redirect DEBUG()\n"
 
		"  -l ip[:port]        = Redirect Debug()\n"
 
#if !defined(_WIN32)
 
		"  -f                  = Fork into the background (dedicated only)\n"
 
#endif
 
@@ -666,7 +666,7 @@ int openttd_main(int argc, char *argv[])
 
	DeterminePaths(argv[0], only_local_path);
 
	TarScanner::DoScan(TarScanner::BASESET);
 

	
 
	if (dedicated) DEBUG(net, 3, "Starting dedicated server, version %s", _openttd_revision);
 
	if (dedicated) Debug(net, 3, "Starting dedicated server, version {}", _openttd_revision);
 
	if (_dedicated_forks && !dedicated) _dedicated_forks = false;
 

	
 
#if defined(UNIX)
 
@@ -715,7 +715,7 @@ int openttd_main(int argc, char *argv[])
 
	/* Initialize game palette */
 
	GfxInitPalettes();
 

	
 
	DEBUG(misc, 1, "Loading blitter...");
 
	Debug(misc, 1, "Loading blitter...");
 
	if (blitter.empty() && !_ini_blitter.empty()) blitter = _ini_blitter;
 
	_blitter_autodetected = blitter.empty();
 
	/* Activate the initial blitter.
 
@@ -945,7 +945,7 @@ bool SafeLoad(const std::string &filenam
 
				 * special cases which make clients desync immediately. So we fall
 
				 * back to just generating a new game with the current settings.
 
				 */
 
				DEBUG(net, 0, "Loading game failed, so a new (random) game will be started");
 
				Debug(net, 0, "Loading game failed, so a new (random) game will be started");
 
				MakeNewGame(false, true);
 
				return false;
 
			}
 
@@ -1136,7 +1136,7 @@ static void CheckCaches()
 
	uint i = 0;
 
	for (Town *t : Town::Iterate()) {
 
		if (MemCmpT(old_town_caches.data() + i, &t->cache) != 0) {
 
			DEBUG(desync, 2, "town cache mismatch: town %i", (int)t->index);
 
			Debug(desync, 2, "town cache mismatch: town {}", t->index);
 
		}
 
		i++;
 
	}
 
@@ -1151,7 +1151,7 @@ static void CheckCaches()
 
	i = 0;
 
	for (const Company *c : Company::Iterate()) {
 
		if (MemCmpT(old_infrastructure.data() + i, &c->infrastructure) != 0) {
 
			DEBUG(desync, 2, "infrastructure cache mismatch: company %i", (int)c->index);
 
			Debug(desync, 2, "infrastructure cache mismatch: company {}", c->index);
 
		}
 
		i++;
 
	}
 
@@ -1208,23 +1208,23 @@ static void CheckCaches()
 
		for (const Vehicle *u = v; u != nullptr; u = u->Next()) {
 
			FillNewGRFVehicleCache(u);
 
			if (memcmp(&grf_cache[length], &u->grf_cache, sizeof(NewGRFCache)) != 0) {
 
				DEBUG(desync, 2, "newgrf cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
 
				Debug(desync, 2, "newgrf cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
 
			}
 
			if (memcmp(&veh_cache[length], &u->vcache, sizeof(VehicleCache)) != 0) {
 
				DEBUG(desync, 2, "vehicle cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
 
				Debug(desync, 2, "vehicle cache mismatch: type {}, vehicle {}, company {}, unit number {}, wagon {}", v->type, v->index, v->owner, v->unitnumber, length);
 
			}
 
			switch (u->type) {
 
				case VEH_TRAIN:
 
					if (memcmp(&gro_cache[length], &Train::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
 
						DEBUG(desync, 2, "train ground vehicle cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
 
						Debug(desync, 2, "train ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
 
					}
 
					if (memcmp(&tra_cache[length], &Train::From(u)->tcache, sizeof(TrainCache)) != 0) {
 
						DEBUG(desync, 2, "train cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
 
						Debug(desync, 2, "train cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
 
					}
 
					break;
 
				case VEH_ROAD:
 
					if (memcmp(&gro_cache[length], &RoadVehicle::From(u)->gcache, sizeof(GroundVehicleCache)) != 0) {
 
						DEBUG(desync, 2, "road vehicle ground vehicle cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
 
						Debug(desync, 2, "road vehicle ground vehicle cache mismatch: vehicle {}, company {}, unit number {}, wagon {}", v->index, v->owner, v->unitnumber, length);
 
					}
 
					break;
 
				default:
 
@@ -1271,11 +1271,11 @@ static void CheckCaches()
 
		}
 
		UpdateStationDockingTiles(st);
 
		if (ta.tile != st->docking_station.tile || ta.w != st->docking_station.w || ta.h != st->docking_station.h) {
 
			DEBUG(desync, 2, "station docking mismatch: station %i, company %i", st->index, (int)st->owner);
 
			Debug(desync, 2, "station docking mismatch: station {}, company {}", st->index, st->owner);
 
		}
 
		for (TileIndex tile : ta) {
 
			if (docking_tiles[tile] != IsDockingTile(tile)) {
 
				DEBUG(desync, 2, "docking tile mismatch: tile %i", (int)tile);
 
				Debug(desync, 2, "docking tile mismatch: tile {}", tile);
 
			}
 
		}
 

	
 
@@ -1283,7 +1283,7 @@ static void CheckCaches()
 
		IndustryList industries_near = st->industries_near;
 
		st->RecomputeCatchment();
 
		if (st->industries_near != industries_near) {
 
			DEBUG(desync, 2, "station industries near mismatch: station %i", st->index);
 
			Debug(desync, 2, "station industries near mismatch: station {}", st->index);
 
		}
 
	}
 

	
 
@@ -1291,14 +1291,14 @@ static void CheckCaches()
 
	i = 0;
 
	for (Town *t : Town::Iterate()) {
 
		if (t->stations_near != old_town_stations_near[i]) {
 
			DEBUG(desync, 2, "town stations near mismatch: town %i", t->index);
 
			Debug(desync, 2, "town stations near mismatch: town {}", t->index);
 
		}
 
		i++;
 
	}
 
	i = 0;
 
	for (Industry *ind : Industry::Iterate()) {
 
		if (ind->stations_near != old_industry_stations_near[i]) {
 
			DEBUG(desync, 2, "industry stations near mismatch: industry %i", ind->index);
 
			Debug(desync, 2, "industry stations near mismatch: industry {}", ind->index);
 
		}
 
		i++;
 
	}
 
@@ -1406,7 +1406,7 @@ static void DoAutosave()
 
		if (++_autosave_ctr >= _settings_client.gui.max_num_autosaves) _autosave_ctr = 0;
 
	}
 

	
 
	DEBUG(sl, 2, "Autosaving to '%s'", buf);
 
	Debug(sl, 2, "Autosaving to '{}'", buf);
 
	if (SaveOrLoad(buf, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR) != SL_OK) {
 
		ShowErrorMessage(STR_ERROR_AUTOSAVE_FAILED, INVALID_STRING_ID, WL_ERROR);
 
	}
src/order_cmd.cpp
Show inline comments
 
@@ -620,7 +620,7 @@ void OrderList::DebugCheckSanity() const
 
	Ticks check_timetable_duration = 0;
 
	Ticks check_total_duration = 0;
 

	
 
	DEBUG(misc, 6, "Checking OrderList %hu for sanity...", this->index);
 
	Debug(misc, 6, "Checking OrderList {} for sanity...", this->index);
 

	
 
	for (const Order *o = this->first; o != nullptr; o = o->next) {
 
		++check_num_orders;
 
@@ -638,7 +638,7 @@ void OrderList::DebugCheckSanity() const
 
		assert(v->orders.list == this);
 
	}
 
	assert(this->num_vehicles == check_num_vehicles);
 
	DEBUG(misc, 6, "... detected %u orders (%u manual), %u vehicles, %i timetabled, %i total",
 
	Debug(misc, 6, "... detected {} orders ({} manual), {} vehicles, {} timetabled, {} total",
 
			(uint)this->num_orders, (uint)this->num_manual_orders,
 
			this->num_vehicles, this->timetable_duration, this->total_duration);
 
}
src/os/macosx/font_osx.cpp
Show inline comments
 
@@ -57,7 +57,7 @@ FT_Error GetFontByFaceName(const char *f
 
	}
 

	
 
	if (os_err == noErr) {
 
		DEBUG(freetype, 3, "Font path for %s: %s", font_name, file_path);
 
		Debug(freetype, 3, "Font path for {}: {}", font_name, file_path);
 
		err = FT_New_Face(_library, (const char *)file_path, 0, face);
 
	}
 

	
 
@@ -134,7 +134,7 @@ bool SetFallbackFont(FreeTypeSettings *s
 
			/* Save result. */
 
			callback->SetFontNames(settings, name);
 
			if (!callback->FindMissingGlyphs()) {
 
				DEBUG(freetype, 2, "CT-Font for %s: %s", language_isocode, name);
 
				Debug(freetype, 2, "CT-Font for {}: {}", language_isocode, name);
 
				result = true;
 
				break;
 
			}
 
@@ -221,7 +221,7 @@ void CoreTextFontCache::SetFontSize(int 
 
	CFStringGetCString(font_name.get(), name, lengthof(name), kCFStringEncodingUTF8);
 
	this->font_name = name;
 

	
 
	DEBUG(freetype, 2, "Loaded font '%s' with size %d", this->font_name.c_str(), pixels);
 
	Debug(freetype, 2, "Loaded font '{}' with size {}", this->font_name, pixels);
 
}
 

	
 
GlyphID CoreTextFontCache::MapCharToGlyph(WChar key)
src/os/os2/os2.cpp
Show inline comments
 
@@ -206,7 +206,7 @@ bool GetClipboardContents(char *buffer, 
 
void OSOpenBrowser(const char *url)
 
{
 
	// stub only
 
	DEBUG(misc, 0, "Failed to open url: %s", url);
 
	Debug(misc, 0, "Failed to open url: {}", url);
 
}
 

	
 
void SetCurrentThreadName(const char *)
src/os/unix/font_unix.cpp
Show inline comments
 
@@ -148,7 +148,7 @@ bool SetFallbackFont(FreeTypeSettings *s
 
			callback->SetFontNames(settings, (const char *)file);
 

	
 
			bool missing = callback->FindMissingGlyphs();
 
			DEBUG(freetype, 1, "Font \"%s\" misses%s glyphs", file, missing ? "" : " no");
 
			Debug(freetype, 1, "Font \"{}\" misses{} glyphs", file, missing ? "" : " no");
 

	
 
			if (!missing) {
 
				best_weight = value;
src/os/unix/unix.cpp
Show inline comments
 
@@ -164,7 +164,7 @@ static const char *convert_tofrom_fs(ico
 

	
 
	iconv(convd, nullptr, nullptr, nullptr, nullptr);
 
	if (iconv(convd, &inbuf, &inlen, &outbuf, &outlen) == (size_t)(-1)) {
 
		DEBUG(misc, 0, "[iconv] error converting '%s'. Errno %d", name, errno);
 
		Debug(misc, 0, "[iconv] error converting '{}'. Errno {}", name, errno);
 
	}
 

	
 
	*outbuf = '\0';
 
@@ -186,7 +186,7 @@ std::string OTTD2FS(const std::string &n
 
		const char *env = GetLocalCode();
 
		convd = iconv_open(env, INTERNALCODE);
 
		if (convd == (iconv_t)(-1)) {
 
			DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", INTERNALCODE, env);
 
			Debug(misc, 0, "[iconv] conversion from codeset '{}' to '{}' unsupported", INTERNALCODE, env);
 
			return name;
 
		}
 
	}
 
@@ -208,7 +208,7 @@ std::string FS2OTTD(const std::string &n
 
		const char *env = GetLocalCode();
 
		convd = iconv_open(INTERNALCODE, env);
 
		if (convd == (iconv_t)(-1)) {
 
			DEBUG(misc, 0, "[iconv] conversion from codeset '%s' to '%s' unsupported", env, INTERNALCODE);
 
			Debug(misc, 0, "[iconv] conversion from codeset '{}' to '{}' unsupported", env, INTERNALCODE);
 
			return name;
 
		}
 
	}
 
@@ -306,7 +306,7 @@ void OSOpenBrowser(const char *url)
 
	args[1] = url;
 
	args[2] = nullptr;
 
	execvp(args[0], const_cast<char * const *>(args));
 
	DEBUG(misc, 0, "Failed to open url: %s", url);
 
	Debug(misc, 0, "Failed to open url: {}", url);
 
	exit(0);
 
}
 
#endif /* __APPLE__ */
src/os/windows/font_win32.cpp
Show inline comments
 
@@ -78,7 +78,7 @@ FT_Error GetFontByFaceName(const char *f
 
	ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, FONT_DIR_NT, 0, KEY_READ, &hKey);
 

	
 
	if (ret != ERROR_SUCCESS) {
 
		DEBUG(freetype, 0, "Cannot open registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
 
		Debug(freetype, 0, "Cannot open registry key HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts");
 
		return err;
 
	}
 

	
 
@@ -113,7 +113,7 @@ FT_Error GetFontByFaceName(const char *f
 
	}
 

	
 
	if (!SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_FONTS, nullptr, SHGFP_TYPE_CURRENT, vbuffer))) {
 
		DEBUG(freetype, 0, "SHGetFolderPath cannot return fonts directory");
 
		Debug(freetype, 0, "SHGetFolderPath cannot return fonts directory");
 
		goto folder_error;
 
	}
 

	
 
@@ -334,17 +334,17 @@ static int CALLBACK EnumFontCallback(con
 

	
 
	info->callback->SetFontNames(info->settings, font_name, &logfont->elfLogFont);
 
	if (info->callback->FindMissingGlyphs()) return 1;
 
	DEBUG(freetype, 1, "Fallback font: %s (%s)", font_name, english_name);
 
	Debug(freetype, 1, "Fallback font: {} ({})", font_name, english_name);
 
	return 0; // stop enumerating
 
}
 

	
 
bool SetFallbackFont(FreeTypeSettings *settings, const char *language_isocode, int winlangid, MissingGlyphSearcher *callback)
 
{
 
	DEBUG(freetype, 1, "Trying fallback fonts");
 
	Debug(freetype, 1, "Trying fallback fonts");
 
	EFCParam langInfo;
 
	if (GetLocaleInfo(MAKELCID(winlangid, SORT_DEFAULT), LOCALE_FONTSIGNATURE, (LPTSTR)&langInfo.locale, sizeof(langInfo.locale) / sizeof(wchar_t)) == 0) {
 
		/* Invalid langid or some other mysterious error, can't determine fallback font. */
 
		DEBUG(freetype, 1, "Can't get locale info for fallback font (langid=0x%x)", winlangid);
 
		Debug(freetype, 1, "Can't get locale info for fallback font (langid=0x{:x})", winlangid);
 
		return false;
 
	}
 
	langInfo.settings = settings;
 
@@ -439,7 +439,7 @@ void Win32FontCache::SetFontSize(FontSiz
 
	this->glyph_size.cx = otm->otmTextMetrics.tmMaxCharWidth;
 
	this->glyph_size.cy = otm->otmTextMetrics.tmHeight;
 

	
 
	DEBUG(freetype, 2, "Loaded font '%s' with size %d", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)).c_str(), pixels);
 
	Debug(freetype, 2, "Loaded font '{}' with size {}", FS2OTTD((LPWSTR)((BYTE *)otm + (ptrdiff_t)otm->otmpFullName)), pixels);
 
}
 

	
 
/**
src/os/windows/win32.cpp
Show inline comments
 
@@ -471,7 +471,7 @@ void DetermineBasePaths(const char *exe)
 
		wchar_t config_dir[MAX_PATH];
 
		wcsncpy(path, convert_to_fs(_config_file.c_str(), path, lengthof(path)), lengthof(path));
 
		if (!GetFullPathName(path, lengthof(config_dir), config_dir, nullptr)) {
 
			DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
 
			Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
 
			_searchpaths[SP_WORKING_DIR].clear();
 
		} else {
 
			std::string tmp(FS2OTTD(config_dir));
 
@@ -483,13 +483,13 @@ void DetermineBasePaths(const char *exe)
 
	}
 

	
 
	if (!GetModuleFileName(nullptr, path, lengthof(path))) {
 
		DEBUG(misc, 0, "GetModuleFileName failed (%lu)\n", GetLastError());
 
		Debug(misc, 0, "GetModuleFileName failed ({})", GetLastError());
 
		_searchpaths[SP_BINARY_DIR].clear();
 
	} else {
 
		wchar_t exec_dir[MAX_PATH];
 
		wcsncpy(path, convert_to_fs(exe, path, lengthof(path)), lengthof(path));
 
		if (!GetFullPathName(path, lengthof(exec_dir), exec_dir, nullptr)) {
 
			DEBUG(misc, 0, "GetFullPathName failed (%lu)\n", GetLastError());
 
			Debug(misc, 0, "GetFullPathName failed ({})", GetLastError());
 
			_searchpaths[SP_BINARY_DIR].clear();
 
		} else {
 
			std::string tmp(FS2OTTD(exec_dir));
src/pathfinder/npf/npf.cpp
Show inline comments
 
@@ -178,7 +178,7 @@ static int32 NPFCalcStationOrTileHeurist
 
		dist = NPFDistanceTrack(from, to);
 
	}
 

	
 
	DEBUG(npf, 4, "Calculating H for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), dist);
 
	Debug(npf, 4, "Calculating H for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), dist);
 

	
 
	if (dist < ftd->best_bird_dist) {
 
		ftd->best_bird_dist = dist;
 
@@ -198,7 +198,7 @@ static void NPFFillTrackdirChoice(AyStar
 
		/* This is a first order decision, so we'd better save the
 
		 * direction we chose */
 
		current->user_data[NPF_TRACKDIR_CHOICE] = trackdir;
 
		DEBUG(npf, 6, "Saving trackdir: 0x%X", trackdir);
 
		Debug(npf, 6, "Saving trackdir: 0x{:X}", trackdir);
 
	} else {
 
		/* We've already made the decision, so just save our parent's decision */
 
		current->user_data[NPF_TRACKDIR_CHOICE] = parent->path.node.user_data[NPF_TRACKDIR_CHOICE];
 
@@ -394,7 +394,7 @@ static int32 NPFRoadPathCost(AyStar *as,
 
	}
 

	
 
	NPFMarkTile(tile);
 
	DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
 
	Debug(npf, 4, "Calculating G for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), cost);
 
	return cost;
 
}
 

	
 
@@ -546,7 +546,7 @@ static int32 NPFRailPathCost(AyStar *as,
 
	cost += NPFReservedTrackCost(current);
 

	
 
	NPFMarkTile(tile);
 
	DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
 
	Debug(npf, 4, "Calculating G for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), cost);
 
	return cost;
 
}
 

	
 
@@ -865,7 +865,7 @@ static TrackdirBits GetDriveableTrackdir
 
		}
 
	}
 

	
 
	DEBUG(npf, 4, "Next node: (%d, %d) [%d], possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits);
 
	Debug(npf, 4, "Next node: ({}, {}) [{}], possible trackdirs: 0x{:X}", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits);
 

	
 
	/* Select only trackdirs we can reach from our current trackdir */
 
	trackdirbits &= TrackdirReachesTrackdirs(src_trackdir);
 
@@ -875,7 +875,7 @@ static TrackdirBits GetDriveableTrackdir
 
		trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
 
	}
 

	
 
	DEBUG(npf, 6, "After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits);
 
	Debug(npf, 6, "After filtering: ({}, {}), possible trackdirs: 0x{:X}", TileX(dst_tile), TileY(dst_tile), trackdirbits);
 

	
 
	return trackdirbits;
 
}
 
@@ -901,7 +901,7 @@ static void NPFFollowTrack(AyStar *aysta
 

	
 
	/* Initialize to 0, so we can jump out (return) somewhere an have no neighbours */
 
	aystar->num_neighbours = 0;
 
	DEBUG(npf, 4, "Expanding: (%d, %d, %d) [%d]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
 
	Debug(npf, 4, "Expanding: ({}, {}, {}) [{}]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
 

	
 
	/* We want to determine the tile we arrive, and which choices we have there */
 
	TileIndex dst_tile;
 
@@ -966,7 +966,7 @@ static void NPFFollowTrack(AyStar *aysta
 
	uint i = 0;
 
	while (trackdirbits != TRACKDIR_BIT_NONE) {
 
		Trackdir dst_trackdir = RemoveFirstTrackdir(&trackdirbits);
 
		DEBUG(npf, 5, "Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);
 
		Debug(npf, 5, "Expanded into trackdir: {}, remaining trackdirs: 0x{:X}", dst_trackdir, trackdirbits);
 

	
 
		/* Tile with signals? */
 
		if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) {
 
@@ -1050,10 +1050,10 @@ static NPFFoundTargetData NPFRouteIntern
 

	
 
	if (result.best_bird_dist != 0) {
 
		if (target != nullptr) {
 
			DEBUG(npf, 1, "Could not find route to tile 0x%X from 0x%X.", target->dest_coords, start1->tile);
 
			Debug(npf, 1, "Could not find route to tile 0x{:X} from 0x{:X}.", target->dest_coords, start1->tile);
 
		} else {
 
			/* Assumption: target == nullptr, so we are looking for a depot */
 
			DEBUG(npf, 1, "Could not find route to a depot from tile 0x%X.", start1->tile);
 
			Debug(npf, 1, "Could not find route to a depot from tile 0x{:X}.", start1->tile);
 
		}
 

	
 
	}
src/pathfinder/yapf/yapf_base.hpp
Show inline comments
 
@@ -146,7 +146,7 @@ public:
 
			int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
 
			int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
 

	
 
			DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d rounds - %d open - %d closed - CHR %4.1f%% - C %d D %d",
 
			Debug(yapf, 3, "[YAPF{}]{}{:4d} - {} rounds - {} open - {} closed - CHR {:4.1f}% - C {} D {}",
 
				ttc, bDestFound ? '-' : '!', veh_idx, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist
 
			);
 
		}
src/pathfinder/yapf/yapf_rail.cpp
Show inline comments
 
@@ -241,7 +241,7 @@ public:
 
			pf2.DisableCache(true);
 
			FindDepotData result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty);
 
			if (result1.tile != result2.tile || (result1.reverse != result2.reverse)) {
 
				DEBUG(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]",
 
				Debug(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [{}, {}]",
 
						result1.tile != INVALID_TILE ? "T" : "F",
 
						result2.tile != INVALID_TILE ? "T" : "F");
 
				DumpState(pf1, pf2);
 
@@ -325,7 +325,7 @@ public:
 
			pf2.DisableCache(true);
 
			result1 = pf2.FindNearestSafeTile(v, t1, td, override_railtype, false);
 
			if (result1 != result2) {
 
				DEBUG(desync, 2, "CACHE ERROR: FindSafeTile() = [%s, %s]", result2 ? "T" : "F", result1 ? "T" : "F");
 
				Debug(desync, 2, "CACHE ERROR: FindSafeTile() = [{}, {}]", result2 ? "T" : "F", result1 ? "T" : "F");
 
				DumpState(pf1, pf2);
 
			}
 
		}
 
@@ -409,7 +409,7 @@ public:
 
			pf2.DisableCache(true);
 
			Trackdir result2 = pf2.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target);
 
			if (result1 != result2) {
 
				DEBUG(desync, 2, "CACHE ERROR: ChooseRailTrack() = [%d, %d]", result1, result2);
 
				Debug(desync, 2, "CACHE ERROR: ChooseRailTrack() = [{}, {}]", result1, result2);
 
				DumpState(pf1, pf2);
 
			}
 
		}
 
@@ -467,7 +467,7 @@ public:
 
			pf2.DisableCache(true);
 
			bool result2 = pf2.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty);
 
			if (result1 != result2) {
 
				DEBUG(desync, 2, "CACHE ERROR: CheckReverseTrain() = [%s, %s]", result1 ? "T" : "F", result2 ? "T" : "F");
 
				Debug(desync, 2, "CACHE ERROR: CheckReverseTrain() = [{}, {}]", result1 ? "T" : "F", result2 ? "T" : "F");
 
				DumpState(pf1, pf2);
 
			}
 
		}
src/random_access_file.cpp
Show inline comments
 
@@ -86,7 +86,7 @@ void RandomAccessFile::SeekTo(size_t pos
 

	
 
	this->pos = pos;
 
	if (fseek(this->file_handle, this->pos, SEEK_SET) < 0) {
 
		DEBUG(misc, 0, "Seeking in %s failed", this->filename.c_str());
 
		Debug(misc, 0, "Seeking in {} failed", this->filename);
 
	}
 

	
 
	/* Reset the buffer, so the next ReadByte will read bytes from the file. */
src/saveload/afterload.cpp
Show inline comments
 
@@ -568,8 +568,8 @@ bool AfterLoadGame()
 
	if (IsSavegameVersionBefore(SLV_119)) {
 
		_pause_mode = (_pause_mode == 2) ? PM_PAUSED_NORMAL : PM_UNPAUSED;
 
	} else if (_network_dedicated && (_pause_mode & PM_PAUSED_ERROR) != 0) {
 
		DEBUG(net, 0, "The loading savegame was paused due to an error state");
 
		DEBUG(net, 0, "  This savegame cannot be used for multiplayer");
 
		Debug(net, 0, "The loading savegame was paused due to an error state");
 
		Debug(net, 0, "  This savegame cannot be used for multiplayer");
 
		/* Restore the signals */
 
		ResetSignalHandlers();
 
		return false;
 
@@ -2308,7 +2308,7 @@ bool AfterLoadGame()
 
			/* At some point, invalid depots were saved into the game (possibly those removed in the past?)
 
			 * Remove them here, so they don't cause issues further down the line */
 
			if (!IsDepotTile(d->xy)) {
 
				DEBUG(sl, 0, "Removing invalid depot %d at %d, %d", d->index, TileX(d->xy), TileY(d->xy));
 
				Debug(sl, 0, "Removing invalid depot {} at {}, {}", d->index, TileX(d->xy), TileY(d->xy));
 
				delete d;
 
				d = nullptr;
 
				continue;
src/saveload/ai_sl.cpp
Show inline comments
 
@@ -86,15 +86,15 @@ static void Load_AIPL()
 
				config->Change(_ai_saveload_name.c_str(), -1, false, _ai_saveload_is_random);
 
				if (!config->HasScript()) {
 
					if (_ai_saveload_name.compare("%_dummy") != 0) {
 
						DEBUG(script, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name.c_str(), _ai_saveload_version);
 
						DEBUG(script, 0, "A random other AI will be loaded in its place.");
 
						Debug(script, 0, "The savegame has an AI by the name '{}', version {} which is no longer available.", _ai_saveload_name, _ai_saveload_version);
 
						Debug(script, 0, "A random other AI will be loaded in its place.");
 
					} else {
 
						DEBUG(script, 0, "The savegame had no AIs available at the time of saving.");
 
						DEBUG(script, 0, "A random available AI will be loaded now.");
 
						Debug(script, 0, "The savegame had no AIs available at the time of saving.");
 
						Debug(script, 0, "A random available AI will be loaded now.");
 
					}
 
				} else {
 
					DEBUG(script, 0, "The savegame has an AI by the name '%s', version %d which is no longer available.", _ai_saveload_name.c_str(), _ai_saveload_version);
 
					DEBUG(script, 0, "The latest version of that AI has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
					Debug(script, 0, "The savegame has an AI by the name '{}', version {} which is no longer available.", _ai_saveload_name, _ai_saveload_version);
 
					Debug(script, 0, "The latest version of that AI has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
				}
 
				/* Make sure the AI doesn't get the saveload data, as it was not the
 
				 *  writer of the saveload data in the first place */
src/saveload/game_sl.cpp
Show inline comments
 
@@ -77,15 +77,15 @@ static void Load_GSDT()
 
			config->Change(_game_saveload_name.c_str(), -1, false, _game_saveload_is_random);
 
			if (!config->HasScript()) {
 
				if (_game_saveload_name.compare("%_dummy") != 0) {
 
					DEBUG(script, 0, "The savegame has an GameScript by the name '%s', version %d which is no longer available.", _game_saveload_name.c_str(), _game_saveload_version);
 
					DEBUG(script, 0, "This game will continue to run without GameScript.");
 
					Debug(script, 0, "The savegame has an GameScript by the name '{}', version {} which is no longer available.", _game_saveload_name, _game_saveload_version);
 
					Debug(script, 0, "This game will continue to run without GameScript.");
 
				} else {
 
					DEBUG(script, 0, "The savegame had no GameScript available at the time of saving.");
 
					DEBUG(script, 0, "This game will continue to run without GameScript.");
 
					Debug(script, 0, "The savegame had no GameScript available at the time of saving.");
 
					Debug(script, 0, "This game will continue to run without GameScript.");
 
				}
 
			} else {
 
				DEBUG(script, 0, "The savegame has an GameScript by the name '%s', version %d which is no longer available.", _game_saveload_name.c_str(), _game_saveload_version);
 
				DEBUG(script, 0, "The latest version of that GameScript has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
				Debug(script, 0, "The savegame has an GameScript by the name '{}', version {} which is no longer available.", _game_saveload_name, _game_saveload_version);
 
				Debug(script, 0, "The latest version of that GameScript has been loaded instead, but it'll not get the savegame data as it's incompatible.");
 
			}
 
			/* Make sure the GameScript doesn't get the saveload data, as it was not the
 
			 *  writer of the saveload data in the first place */
src/saveload/oldloader.cpp
Show inline comments
 
@@ -56,7 +56,7 @@ static byte ReadByteFromFile(LoadgameSta
 

	
 
		/* We tried to read, but there is nothing in the file anymore.. */
 
		if (count == 0) {
 
			DEBUG(oldloader, 0, "Read past end of file, loading failed");
 
			Debug(oldloader, 0, "Read past end of file, loading failed");
 
			throw std::exception();
 
		}
 

	
 
@@ -132,7 +132,7 @@ bool LoadChunk(LoadgameState *ls, void *
 
						break;
 

	
 
					case OC_ASSERT:
 
						DEBUG(oldloader, 4, "Assert point: 0x%X / 0x%X", ls->total_read, (uint)(size_t)chunk->ptr + _bump_assert_value);
 
						Debug(oldloader, 4, "Assert point: 0x{:X} / 0x{:X}", ls->total_read, (uint)(size_t)chunk->ptr + _bump_assert_value);
 
						if (ls->total_read != (size_t)chunk->ptr + _bump_assert_value) throw std::exception();
 
					default: break;
 
				}
 
@@ -273,7 +273,7 @@ bool LoadOldSaveGame(const std::string &
 
{
 
	LoadgameState ls;
 

	
 
	DEBUG(oldloader, 3, "Trying to load a TTD(Patch) savegame");
 
	Debug(oldloader, 3, "Trying to load a TTD(Patch) savegame");
 

	
 
	InitLoading(&ls);
 

	
 
@@ -281,7 +281,7 @@ bool LoadOldSaveGame(const std::string &
 
	ls.file = FioFOpenFile(file, "rb", NO_DIRECTORY);
 

	
 
	if (ls.file == nullptr) {
 
		DEBUG(oldloader, 0, "Cannot open file '%s'", file.c_str());
 
		Debug(oldloader, 0, "Cannot open file '{}'", file);
 
		return false;
 
	}
 

	
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -132,7 +132,7 @@ static uint32 RemapOldTownName(uint32 to
 
			return FIXNUM(townnameparts - 86, lengthof(_name_french_real), 0);
 

	
 
		case 2: // German
 
			DEBUG(misc, 0, "German Townnames are buggy (%d)", townnameparts);
 
			Debug(misc, 0, "German Townnames are buggy ({})", townnameparts);
 
			return townnameparts;
 

	
 
		case 4: // Latin-American
 
@@ -532,9 +532,9 @@ static void ReadTTDPatchFlags()
 
	for (uint i = 0;       i < 17;      i++) _old_map3[i] = 0;
 
	for (uint i = 0x1FE00; i < 0x20000; i++) _old_map3[i] = 0;
 

	
 
	if (_savegame_type == SGT_TTDP2) DEBUG(oldloader, 2, "Found TTDPatch game");
 
	if (_savegame_type == SGT_TTDP2) Debug(oldloader, 2, "Found TTDPatch game");
 

	
 
	DEBUG(oldloader, 3, "Vehicle-multiplier is set to %d (%d vehicles)", _old_vehicle_multiplier, _old_vehicle_multiplier * 850);
 
	Debug(oldloader, 3, "Vehicle-multiplier is set to {} ({} vehicles)", _old_vehicle_multiplier, _old_vehicle_multiplier * 850);
 
}
 

	
 
static const OldChunks town_chunk[] = {
 
@@ -1114,7 +1114,7 @@ static bool LoadOldVehicleUnion(Loadgame
 

	
 
	/* This chunk size should always be 10 bytes */
 
	if (ls->total_read - temp != 10) {
 
		DEBUG(oldloader, 0, "Assert failed in VehicleUnion: invalid chunk size");
 
		Debug(oldloader, 0, "Assert failed in VehicleUnion: invalid chunk size");
 
		return false;
 
	}
 

	
 
@@ -1327,7 +1327,7 @@ bool LoadOldVehicle(LoadgameState *ls, i
 

	
 
			/* This should be consistent, else we have a big problem... */
 
			if (v->index != _current_vehicle_id) {
 
				DEBUG(oldloader, 0, "Loading failed - vehicle-array is invalid");
 
				Debug(oldloader, 0, "Loading failed - vehicle-array is invalid");
 
				return false;
 
			}
 
		}
 
@@ -1512,7 +1512,7 @@ static bool LoadTTDPatchExtraChunks(Load
 
{
 
	ReadTTDPatchFlags();
 

	
 
	DEBUG(oldloader, 2, "Found %d extra chunk(s)", _old_extra_chunk_nums);
 
	Debug(oldloader, 2, "Found {} extra chunk(s)", _old_extra_chunk_nums);
 

	
 
	for (int i = 0; i != _old_extra_chunk_nums; i++) {
 
		uint16 id = ReadUint16(ls);
 
@@ -1535,7 +1535,7 @@ static bool LoadTTDPatchExtraChunks(Load
 
						c->ident.grfid = grfid;
 

	
 
						AppendToGRFConfigList(&_grfconfig, c);
 
						DEBUG(oldloader, 3, "TTDPatch game using GRF file with GRFID %0X", BSWAP32(c->ident.grfid));
 
						Debug(oldloader, 3, "TTDPatch game using GRF file with GRFID {:08X}", BSWAP32(c->ident.grfid));
 
					}
 
					len -= 5;
 
				}
 
@@ -1548,14 +1548,14 @@ static bool LoadTTDPatchExtraChunks(Load
 
			/* TTDPatch version and configuration */
 
			case 0x3:
 
				_ttdp_version = ReadUint32(ls);
 
				DEBUG(oldloader, 3, "Game saved with TTDPatch version %d.%d.%d r%d",
 
				Debug(oldloader, 3, "Game saved with TTDPatch version {}.{}.{} r{}",
 
					GB(_ttdp_version, 24, 8), GB(_ttdp_version, 20, 4), GB(_ttdp_version, 16, 4), GB(_ttdp_version, 0, 16));
 
				len -= 4;
 
				while (len-- != 0) ReadByte(ls); // skip the configuration
 
				break;
 

	
 
			default:
 
				DEBUG(oldloader, 4, "Skipping unknown extra chunk %X", id);
 
				Debug(oldloader, 4, "Skipping unknown extra chunk {}", id);
 
				while (len-- != 0) ReadByte(ls);
 
				break;
 
		}
 
@@ -1742,7 +1742,7 @@ static const OldChunks main_chunk[] = {
 

	
 
bool LoadTTDMain(LoadgameState *ls)
 
{
 
	DEBUG(oldloader, 3, "Reading main chunk...");
 
	Debug(oldloader, 3, "Reading main chunk...");
 

	
 
	_read_ttdpatch_flags = false;
 

	
 
@@ -1752,7 +1752,7 @@ bool LoadTTDMain(LoadgameState *ls)
 
	_old_vehicle_names = nullptr;
 
	try {
 
		if (!LoadChunk(ls, nullptr, main_chunk)) {
 
			DEBUG(oldloader, 0, "Loading failed");
 
			Debug(oldloader, 0, "Loading failed");
 
			free(_old_vehicle_names);
 
			return false;
 
		}
 
@@ -1761,7 +1761,7 @@ bool LoadTTDMain(LoadgameState *ls)
 
		throw;
 
	}
 

	
 
	DEBUG(oldloader, 3, "Done, converting game data...");
 
	Debug(oldloader, 3, "Done, converting game data...");
 

	
 
	FixTTDMapArray();
 
	FixTTDDepots();
 
@@ -1776,8 +1776,8 @@ bool LoadTTDMain(LoadgameState *ls)
 
	/* We have a new difficulty setting */
 
	_settings_game.difficulty.town_council_tolerance = Clamp(_old_diff_level, 0, 2);
 

	
 
	DEBUG(oldloader, 3, "Finished converting game data");
 
	DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
 
	Debug(oldloader, 3, "Finished converting game data");
 
	Debug(oldloader, 1, "TTD(Patch) savegame successfully converted");
 

	
 
	free(_old_vehicle_names);
 

	
 
@@ -1786,7 +1786,7 @@ bool LoadTTDMain(LoadgameState *ls)
 

	
 
bool LoadTTOMain(LoadgameState *ls)
 
{
 
	DEBUG(oldloader, 3, "Reading main chunk...");
 
	Debug(oldloader, 3, "Reading main chunk...");
 

	
 
	_read_ttdpatch_flags = false;
 

	
 
@@ -1797,10 +1797,10 @@ bool LoadTTOMain(LoadgameState *ls)
 

	
 
	/* Load the biggest chunk */
 
	if (!LoadChunk(ls, nullptr, main_chunk)) {
 
		DEBUG(oldloader, 0, "Loading failed");
 
		Debug(oldloader, 0, "Loading failed");
 
		return false;
 
	}
 
	DEBUG(oldloader, 3, "Done, converting game data...");
 
	Debug(oldloader, 3, "Done, converting game data...");
 

	
 
	if (_settings_game.game_creation.town_name != 0) _settings_game.game_creation.town_name++;
 

	
 
@@ -1808,7 +1808,7 @@ bool LoadTTOMain(LoadgameState *ls)
 
	_trees_tick_ctr = 0xFF;
 

	
 
	if (!FixTTOMapArray() || !FixTTOEngines()) {
 
		DEBUG(oldloader, 0, "Conversion failed");
 
		Debug(oldloader, 0, "Conversion failed");
 
		return false;
 
	}
 

	
 
@@ -1825,8 +1825,8 @@ bool LoadTTOMain(LoadgameState *ls)
 
	 * the vehicles stay the same" */
 
	_economy.inflation_payment = std::min(_economy.inflation_payment * 124 / 74, MAX_INFLATION);
 

	
 
	DEBUG(oldloader, 3, "Finished converting game data");
 
	DEBUG(oldloader, 1, "TTO savegame successfully converted");
 
	Debug(oldloader, 3, "Finished converting game data");
 
	Debug(oldloader, 1, "TTO savegame successfully converted");
 

	
 
	return true;
 
}
src/saveload/saveload.cpp
Show inline comments
 
@@ -313,7 +313,7 @@ static void SlNullPointers()
 

	
 
	for (auto &ch : ChunkHandlers()) {
 
		if (ch.ptrs_proc != nullptr) {
 
			DEBUG(sl, 3, "Nulling pointers for %c%c%c%c", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			Debug(sl, 3, "Nulling pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			ch.ptrs_proc();
 
		}
 
	}
 
@@ -656,7 +656,7 @@ int SlIterateArray()
 
			case CH_SPARSE_ARRAY: index = (int)SlReadSparseIndex(); break;
 
			case CH_ARRAY:        index = _sl.array_index++; break;
 
			default:
 
				DEBUG(sl, 0, "SlIterateArray error");
 
				Debug(sl, 0, "SlIterateArray error");
 
				return -1; // error
 
		}
 

	
 
@@ -949,7 +949,7 @@ static void SlString(void *ptr, size_t l
 
					return;
 
				case SLE_VAR_STRB:
 
					if (len >= length) {
 
						DEBUG(sl, 1, "String length in savegame is bigger than buffer, truncating");
 
						Debug(sl, 1, "String length in savegame is bigger than buffer, truncating");
 
						SlCopyBytes(ptr, length);
 
						SlSkipBytes(len - length);
 
						len = length - 1;
 
@@ -1718,7 +1718,7 @@ static void SlSaveChunk(const ChunkHandl
 
	if (proc == nullptr) return;
 

	
 
	SlWriteUint32(ch.id);
 
	DEBUG(sl, 2, "Saving chunk %c%c%c%c", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
	Debug(sl, 2, "Saving chunk {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 

	
 
	_sl.block_mode = ch.type;
 
	switch (ch.type) {
 
@@ -1771,7 +1771,7 @@ static void SlLoadChunks()
 
	const ChunkHandler *ch;
 

	
 
	for (id = SlReadUint32(); id != 0; id = SlReadUint32()) {
 
		DEBUG(sl, 2, "Loading chunk %c%c%c%c", id >> 24, id >> 16, id >> 8, id);
 
		Debug(sl, 2, "Loading chunk {:c}{:c}{:c}{:c}", id >> 24, id >> 16, id >> 8, id);
 

	
 
		ch = SlFindChunkHandler(id);
 
		if (ch == nullptr) SlErrorCorrupt("Unknown chunk type");
 
@@ -1786,7 +1786,7 @@ static void SlLoadCheckChunks()
 
	const ChunkHandler *ch;
 

	
 
	for (id = SlReadUint32(); id != 0; id = SlReadUint32()) {
 
		DEBUG(sl, 2, "Loading chunk %c%c%c%c", id >> 24, id >> 16, id >> 8, id);
 
		Debug(sl, 2, "Loading chunk {:c}{:c}{:c}{:c}", id >> 24, id >> 16, id >> 8, id);
 

	
 
		ch = SlFindChunkHandler(id);
 
		if (ch == nullptr) SlErrorCorrupt("Unknown chunk type");
 
@@ -1801,7 +1801,7 @@ static void SlFixPointers()
 

	
 
	for (auto &ch : ChunkHandlers()) {
 
		if (ch.ptrs_proc != nullptr) {
 
			DEBUG(sl, 3, "Fixing pointers for %c%c%c%c", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			Debug(sl, 3, "Fixing pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id);
 
			ch.ptrs_proc();
 
		}
 
	}
 
@@ -1845,7 +1845,7 @@ struct FileReader : LoadFilter {
 
	{
 
		clearerr(this->file);
 
		if (fseek(this->file, this->begin, SEEK_SET)) {
 
			DEBUG(sl, 1, "Could not reset the file reading");
 
			Debug(sl, 1, "Could not reset the file reading");
 
		}
 
	}
 
};
 
@@ -2470,7 +2470,7 @@ static SaveOrLoadResult SaveFileToDisk(b
 
		 * cancelled due to a client disconnecting. */
 
		if (_sl.error_str != STR_NETWORK_ERROR_LOSTCONNECTION) {
 
			/* Skip the "colour" character */
 
			DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 
			Debug(sl, 0, "{}", GetSaveLoadErrorString() + 3);
 
			asfp = SaveFileError;
 
		}
 

	
 
@@ -2516,7 +2516,7 @@ static SaveOrLoadResult DoSave(SaveFilte
 
	SaveFileStart();
 

	
 
	if (!threaded || !StartNewThread(&_save_thread, "ottd:savegame", &SaveFileToDisk, true)) {
 
		if (threaded) DEBUG(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode...");
 
		if (threaded) Debug(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode...");
 

	
 
		SaveOrLoadResult result = SaveFileToDisk(false);
 
		SaveFileDone();
 
@@ -2569,7 +2569,7 @@ static SaveOrLoadResult DoLoad(LoadFilte
 
	for (;;) {
 
		/* No loader found, treat as version 0 and use LZO format */
 
		if (fmt == endof(_saveload_formats)) {
 
			DEBUG(sl, 0, "Unknown savegame type, trying to load it as the buggy format");
 
			Debug(sl, 0, "Unknown savegame type, trying to load it as the buggy format");
 
			_sl.lf->Reset();
 
			_sl_version = SL_MIN_VERSION;
 
			_sl_minor_version = 0;
 
@@ -2595,7 +2595,7 @@ static SaveOrLoadResult DoLoad(LoadFilte
 
			 * Therefore it is loaded, but never saved (or, it saves a 0 in any scenario). */
 
			_sl_minor_version = (TO_BE32(hdr[1]) >> 8) & 0xFF;
 

	
 
			DEBUG(sl, 1, "Loading savegame version %d", _sl_version);
 
			Debug(sl, 1, "Loading savegame version {}", _sl_version);
 

	
 
			/* Is the version higher than the current? */
 
			if (_sl_version > SAVEGAME_VERSION) SlError(STR_GAME_SAVELOAD_ERROR_TOO_NEW_SAVEGAME);
 
@@ -2775,7 +2775,7 @@ SaveOrLoadResult SaveOrLoad(const std::s
 
		}
 

	
 
		if (fop == SLO_SAVE) { // SAVE game
 
			DEBUG(desync, 1, "save: %08x; %02x; %s", _date, _date_fract, filename.c_str());
 
			Debug(desync, 1, "save: {:08x}; {:02x}; {}", _date, _date_fract, filename);
 
			if (_network_server || !_settings_client.gui.threaded_saves) threaded = false;
 

	
 
			return DoSave(new FileWriter(fh), threaded);
 
@@ -2783,14 +2783,14 @@ SaveOrLoadResult SaveOrLoad(const std::s
 

	
 
		/* LOAD game */
 
		assert(fop == SLO_LOAD || fop == SLO_CHECK);
 
		DEBUG(desync, 1, "load: %s", filename.c_str());
 
		Debug(desync, 1, "load: {}", filename);
 
		return DoLoad(new FileReader(fh), fop == SLO_CHECK);
 
	} catch (...) {
 
		/* This code may be executed both for old and new save games. */
 
		ClearSaveLoadState();
 

	
 
		/* Skip the "colour" character */
 
		if (fop != SLO_CHECK) DEBUG(sl, 0, "%s", GetSaveLoadErrorString() + 3);
 
		if (fop != SLO_CHECK) Debug(sl, 0, "{}", GetSaveLoadErrorString());
 

	
 
		/* A saver/loader exception!! reinitialize all variables to prevent crash! */
 
		return (fop == SLO_LOAD) ? SL_REINIT : SL_ERROR;
src/saveload/waypoint_sl.cpp
Show inline comments
 
@@ -103,10 +103,10 @@ void MoveWaypointsToBaseStations()
 
		/* Sometimes waypoint (sign) locations became disconnected from their actual location in
 
		 * the map array. If this is the case, try to locate the actual location in the map array */
 
		if (!IsTileType(t, MP_RAILWAY) || GetRailTileType(t) != 2 /* RAIL_TILE_WAYPOINT */ || _m[t].m2 != wp.index) {
 
			DEBUG(sl, 0, "Found waypoint tile %u with invalid position", t);
 
			Debug(sl, 0, "Found waypoint tile {} with invalid position", t);
 
			for (t = 0; t < MapSize(); t++) {
 
				if (IsTileType(t, MP_RAILWAY) && GetRailTileType(t) == 2 /* RAIL_TILE_WAYPOINT */ && _m[t].m2 == wp.index) {
 
					DEBUG(sl, 0, "Found actual waypoint position at %u", t);
 
					Debug(sl, 0, "Found actual waypoint position at {}", t);
 
					break;
 
				}
 
			}
src/screenshot.cpp
Show inline comments
 
@@ -237,13 +237,13 @@ static bool MakeBMPImage(const char *nam
 

	
 
static void PNGAPI png_my_error(png_structp png_ptr, png_const_charp message)
 
{
 
	DEBUG(misc, 0, "[libpng] error: %s - %s", message, (const char *)png_get_error_ptr(png_ptr));
 
	Debug(misc, 0, "[libpng] error: {} - {}", message, (const char *)png_get_error_ptr(png_ptr));
 
	longjmp(png_jmpbuf(png_ptr), 1);
 
}
 

	
 
static void PNGAPI png_my_warning(png_structp png_ptr, png_const_charp message)
 
{
 
	DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (const char *)png_get_error_ptr(png_ptr));
 
	Debug(misc, 1, "[libpng] warning: {} - {}", message, (const char *)png_get_error_ptr(png_ptr));
 
}
 

	
 
/**
 
@@ -444,7 +444,7 @@ static bool MakePCXImage(const char *nam
 
	bool success;
 

	
 
	if (pixelformat == 32) {
 
		DEBUG(misc, 0, "Can't convert a 32bpp screenshot to PCX format. Please pick another format.");
 
		Debug(misc, 0, "Can't convert a 32bpp screenshot to PCX format. Please pick another format.");
 
		return false;
 
	}
 
	if (pixelformat != 8 || w == 0) return false;
src/script/api/script_list.cpp
Show inline comments
 
@@ -469,7 +469,7 @@ int64 ScriptList::Begin()
 
int64 ScriptList::Next()
 
{
 
	if (this->initialized == false) {
 
		DEBUG(script, 0, "Next() is invalid as Begin() is never called");
 
		Debug(script, 0, "Next() is invalid as Begin() is never called");
 
		return 0;
 
	}
 
	return this->sorter->Next();
 
@@ -483,7 +483,7 @@ bool ScriptList::IsEmpty()
 
bool ScriptList::IsEnd()
 
{
 
	if (this->initialized == false) {
 
		DEBUG(script, 0, "IsEnd() is invalid as Begin() is never called");
 
		Debug(script, 0, "IsEnd() is invalid as Begin() is never called");
 
		return true;
 
	}
 
	return this->sorter->IsEnd();
src/script/api/script_log.cpp
Show inline comments
 
@@ -74,7 +74,7 @@
 
	}
 

	
 
	/* Also still print to debug window */
 
	DEBUG(script, level, "[%d] [%c] %s", (uint)ScriptObject::GetRootCompany(), logc, log->lines[log->pos]);
 
	Debug(script, level, "[{}] [{}] {}", (uint)ScriptObject::GetRootCompany(), logc, log->lines[log->pos]);
 
	InvalidateWindowData(WC_AI_DEBUG, 0, ScriptObject::GetRootCompany());
 
}
 

	
src/script/api/script_log.hpp
Show inline comments
 
@@ -23,7 +23,7 @@ class ScriptLog : public ScriptObject {
 

	
 
public:
 
	/**
 
	 * Log levels; The value is also feed to DEBUG() lvl.
 
	 * Log levels; The value is also feed to Debug() lvl.
 
	 *  This has no use for you, as script writer.
 
	 * @api -all
 
	 */
src/script/api/script_object.cpp
Show inline comments
 
@@ -85,7 +85,7 @@ ScriptObject::ActiveInstance::~ActiveIns
 
/* static */ void ScriptObject::SetLastCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
 
{
 
	ScriptStorage *s = GetStorage();
 
	DEBUG(script, 6, "SetLastCommand company=%02d tile=%06x p1=%08x p2=%08x cmd=%d", s->root_company, tile, p1, p2, cmd);
 
	Debug(script, 6, "SetLastCommand company={:02d} tile={:06x} p1={:08x} p2={:08x} cmd={}", s->root_company, tile, p1, p2, cmd);
 
	s->last_tile = tile;
 
	s->last_p1 = p1;
 
	s->last_p2 = p2;
 
@@ -95,7 +95,7 @@ ScriptObject::ActiveInstance::~ActiveIns
 
/* static */ bool ScriptObject::CheckLastCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd)
 
{
 
	ScriptStorage *s = GetStorage();
 
	DEBUG(script, 6, "CheckLastCommand company=%02d tile=%06x p1=%08x p2=%08x cmd=%d", s->root_company, tile, p1, p2, cmd);
 
	Debug(script, 6, "CheckLastCommand company={:02d} tile={:06x} p1={:08x} p2={:08x} cmd={}", s->root_company, tile, p1, p2, cmd);
 
	if (s->last_tile != tile) return false;
 
	if (s->last_p1 != p1) return false;
 
	if (s->last_p2 != p2) return false;
src/script/api/script_order.cpp
Show inline comments
 
@@ -564,7 +564,7 @@ static void _DoCommandReturnSetOrderFlag
 
	/* Make sure we don't go into an infinite loop */
 
	int retry = ScriptObject::GetCallbackVariable(3) - 1;
 
	if (retry < 0) {
 
		DEBUG(script, 0, "Possible infinite loop in SetOrderFlags() detected");
 
		Debug(script, 0, "Possible infinite loop in SetOrderFlags() detected");
 
		return false;
 
	}
 
	ScriptObject::SetCallbackVariable(3, retry);
src/script/api/script_rail.cpp
Show inline comments
 
@@ -195,7 +195,7 @@
 
		int index = 0;
 
		const StationSpec *spec = StationClass::GetByGrf(file->grfid, res, &index);
 
		if (spec == nullptr) {
 
			DEBUG(grf, 1, "%s returned an invalid station ID for 'AI construction/purchase selection (18)' callback", file->filename);
 
			Debug(grf, 1, "{} returned an invalid station ID for 'AI construction/purchase selection (18)' callback", file->filename);
 
		} else {
 
			/* We might have gotten an usable station spec. Try to build it, but if it fails we'll fall back to the original station. */
 
			if (ScriptObject::DoCommand(tile, p1, p2 | spec->cls_id | index << 8, CMD_BUILD_RAIL_STATION)) return true;
src/script/script_instance.cpp
Show inline comments
 
@@ -124,7 +124,7 @@ bool ScriptInstance::LoadCompatibilitySc
 
		if (this->engine->LoadScript(buf.c_str())) return true;
 

	
 
		ScriptLog::Error("Failed to load API compatibility script");
 
		DEBUG(script, 0, "Error compiling / running API compatibility script: %s", buf.c_str());
 
		Debug(script, 0, "Error compiling / running API compatibility script: {}", buf);
 
		return false;
 
	}
 

	
 
@@ -152,7 +152,7 @@ void ScriptInstance::Continue()
 

	
 
void ScriptInstance::Died()
 
{
 
	DEBUG(script, 0, "The script died unexpectedly.");
 
	Debug(script, 0, "The script died unexpectedly.");
 
	this->is_dead = true;
 
	this->in_shutdown = true;
 

	
 
@@ -692,7 +692,7 @@ bool ScriptInstance::DoCommandCallback(c
 
	ScriptObject::ActiveInstance active(this);
 

	
 
	if (!ScriptObject::CheckLastCommand(tile, p1, p2, cmd)) {
 
		DEBUG(script, 1, "DoCommandCallback terminating a script, last command does not match expected command");
 
		Debug(script, 1, "DoCommandCallback terminating a script, last command does not match expected command");
 
		return false;
 
	}
 

	
src/script/script_scanner.cpp
Show inline comments
 
@@ -38,7 +38,7 @@ bool ScriptScanner::AddFile(const std::s
 
	try {
 
		this->engine->LoadScript(filename.c_str());
 
	} catch (Script_FatalError &e) {
 
		DEBUG(script, 0, "Fatal error '%s' when trying to load the script '%s'.", e.GetErrorMessage().c_str(), filename.c_str());
 
		Debug(script, 0, "Fatal error '{}' when trying to load the script '{}'.", e.GetErrorMessage(), filename);
 
		return false;
 
	}
 
	return true;
 
@@ -106,7 +106,7 @@ void ScriptScanner::RegisterScript(Scrip
 

	
 
	/* Check if GetShortName follows the rules */
 
	if (strlen(info->GetShortName()) != 4) {
 
		DEBUG(script, 0, "The script '%s' returned a string from GetShortName() which is not four characaters. Unable to load the script.", info->GetName());
 
		Debug(script, 0, "The script '{}' returned a string from GetShortName() which is not four characaters. Unable to load the script.", info->GetName());
 
		delete info;
 
		return;
 
	}
 
@@ -123,10 +123,10 @@ void ScriptScanner::RegisterScript(Scrip
 
			return;
 
		}
 

	
 
		DEBUG(script, 1, "Registering two scripts with the same name and version");
 
		DEBUG(script, 1, "  1: %s", this->info_list[script_name]->GetMainScript());
 
		DEBUG(script, 1, "  2: %s", info->GetMainScript());
 
		DEBUG(script, 1, "The first is taking precedence.");
 
		Debug(script, 1, "Registering two scripts with the same name and version");
 
		Debug(script, 1, "  1: {}", this->info_list[script_name]->GetMainScript());
 
		Debug(script, 1, "  2: {}", info->GetMainScript());
 
		Debug(script, 1, "The first is taking precedence.");
 

	
 
		delete info;
 
		return;
src/script/squirrel.cpp
Show inline comments
 
@@ -207,7 +207,7 @@ void Squirrel::CompileError(HSQUIRRELVM 
 
	engine->crashed = true;
 
	SQPrintFunc *func = engine->print_func;
 
	if (func == nullptr) {
 
		DEBUG(misc, 0, "[Squirrel] Compile error: %s", buf);
 
		Debug(misc, 0, "[Squirrel] Compile error: {}", buf);
 
	} else {
 
		(*func)(true, buf);
 
	}
 
@@ -340,8 +340,8 @@ void Squirrel::AddClassBegin(const char 
 
	sq_pushstring(this->vm, class_name, -1);
 
	sq_pushstring(this->vm, parent_class, -1);
 
	if (SQ_FAILED(sq_get(this->vm, -3))) {
 
		DEBUG(misc, 0, "[squirrel] Failed to initialize class '%s' based on parent class '%s'", class_name, parent_class);
 
		DEBUG(misc, 0, "[squirrel] Make sure that '%s' exists before trying to define '%s'", parent_class, class_name);
 
		Debug(misc, 0, "[squirrel] Failed to initialize class '{}' based on parent class '{}'", class_name, parent_class);
 
		Debug(misc, 0, "[squirrel] Make sure that '{}' exists before trying to define '{}'", parent_class, class_name);
 
		return;
 
	}
 
	sq_newclass(this->vm, SQTrue);
 
@@ -425,7 +425,7 @@ bool Squirrel::CallMethod(HSQOBJECT inst
 
	/* Find the function-name inside the script */
 
	sq_pushstring(this->vm, method_name, -1);
 
	if (SQ_FAILED(sq_get(this->vm, -2))) {
 
		DEBUG(misc, 0, "[squirrel] Could not find '%s' in the class", method_name);
 
		Debug(misc, 0, "[squirrel] Could not find '{}' in the class", method_name);
 
		sq_settop(this->vm, top);
 
		return false;
 
	}
 
@@ -490,14 +490,14 @@ bool Squirrel::CallBoolMethod(HSQOBJECT 
 
	}
 

	
 
	if (SQ_FAILED(sq_get(vm, -2))) {
 
		DEBUG(misc, 0, "[squirrel] Failed to find class by the name '%s%s'", prepend_API_name ? engine->GetAPIName() : "", class_name);
 
		Debug(misc, 0, "[squirrel] Failed to find class by the name '{}{}'", prepend_API_name ? engine->GetAPIName() : "", class_name);
 
		sq_settop(vm, oldtop);
 
		return false;
 
	}
 

	
 
	/* Create the instance */
 
	if (SQ_FAILED(sq_createinstance(vm, -1))) {
 
		DEBUG(misc, 0, "[squirrel] Failed to create instance for class '%s%s'", prepend_API_name ? engine->GetAPIName() : "", class_name);
 
		Debug(misc, 0, "[squirrel] Failed to create instance for class '{}{}'", prepend_API_name ? engine->GetAPIName() : "", class_name);
 
		sq_settop(vm, oldtop);
 
		return false;
 
	}
 
@@ -736,7 +736,7 @@ bool Squirrel::LoadScript(HSQUIRRELVM vm
 
	}
 

	
 
	vm->_ops_till_suspend = ops_left;
 
	DEBUG(misc, 0, "[squirrel] Failed to compile '%s'", script);
 
	Debug(misc, 0, "[squirrel] Failed to compile '{}'", script);
 
	return false;
 
}
 

	
src/script/squirrel_std.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ SQInteger SquirrelStd::require(HSQUIRREL
 
	SQStackInfos si;
 
	sq_stackinfos(vm, 1, &si);
 
	if (si.source == nullptr) {
 
		DEBUG(misc, 0, "[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
 
		Debug(misc, 0, "[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
 
		return SQ_ERROR;
 
	}
 

	
src/settings.cpp
Show inline comments
 
@@ -1268,7 +1268,7 @@ static void AILoadConfig(IniFile *ini, c
 
		config->Change(item->name.c_str());
 
		if (!config->HasScript()) {
 
			if (item->name != "none") {
 
				DEBUG(script, 0, "The AI by the name '%s' was no longer found, and removed from the list.", item->name.c_str());
 
				Debug(script, 0, "The AI by the name '{}' was no longer found, and removed from the list.", item->name);
 
				continue;
 
			}
 
		}
 
@@ -1295,7 +1295,7 @@ static void GameLoadConfig(IniFile *ini,
 
	config->Change(item->name.c_str());
 
	if (!config->HasScript()) {
 
		if (item->name != "none") {
 
			DEBUG(script, 0, "The GameScript by the name '%s' was no longer found, and removed from the list.", item->name.c_str());
 
			Debug(script, 0, "The GameScript by the name '{}' was no longer found, and removed from the list.", item->name);
 
			return;
 
		}
 
	}
src/signal.cpp
Show inline comments
 
@@ -153,7 +153,7 @@ public:
 
	{
 
		if (this->IsFull()) {
 
			overflowed = true;
 
			DEBUG(misc, 0, "SignalSegment too complex. Set %s is full (maximum %d)", name, items);
 
			Debug(misc, 0, "SignalSegment too complex. Set {} is full (maximum {})", name, items);
 
			return false; // set is full
 
		}
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -57,7 +57,7 @@ struct SignList {
 
	{
 
		if (!this->signs.NeedRebuild()) return;
 

	
 
		DEBUG(misc, 3, "Building sign list");
 
		Debug(misc, 3, "Building sign list");
 

	
 
		this->signs.clear();
 

	
src/sound.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ static void OpenBankFile(const char *fil
 
		/* Corrupt sample data? Just leave the allocated memory as those tell
 
		 * there is no sound to play (size = 0 due to calloc). Not allocating
 
		 * the memory disables valid NewGRFs that replace sounds. */
 
		DEBUG(misc, 6, "Incorrect number of sounds in '%s', ignoring.", filename);
 
		Debug(misc, 6, "Incorrect number of sounds in '{}', ignoring.", filename);
 
		return;
 
	}
 

	
 
@@ -157,7 +157,7 @@ static bool SetBankSource(MixerChannel *
 

	
 
void InitializeSound()
 
{
 
	DEBUG(misc, 1, "Loading sound effects...");
 
	Debug(misc, 1, "Loading sound effects...");
 
	OpenBankFile(BaseSounds::GetUsedSet()->files->filename);
 
}
 

	
src/sound/allegro_s.cpp
Show inline comments
 
@@ -53,20 +53,20 @@ extern int _allegro_instance_count;
 
const char *SoundDriver_Allegro::Start(const StringList &parm)
 
{
 
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
 
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
 
		Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error);
 
		return "Failed to set up Allegro";
 
	}
 
	_allegro_instance_count++;
 

	
 
	/* Initialise the sound */
 
	if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, nullptr) != 0) {
 
		DEBUG(driver, 0, "allegro: install_sound failed '%s'", allegro_error);
 
		Debug(driver, 0, "allegro: install_sound failed '{}'", allegro_error);
 
		return "Failed to set up Allegro sound";
 
	}
 

	
 
	/* Okay, there's no soundcard */
 
	if (digi_card == DIGI_NONE) {
 
		DEBUG(driver, 0, "allegro: no sound card found");
 
		Debug(driver, 0, "allegro: no sound card found");
 
		return "No sound card found";
 
	}
 

	
src/sound/cocoa_s.cpp
Show inline comments
 
@@ -118,7 +118,7 @@ void SoundDriver_Cocoa::Stop()
 

	
 
	/* stop processing the audio unit */
 
	if (AudioOutputUnitStop(_outputAudioUnit) != noErr) {
 
		DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed");
 
		Debug(driver, 0, "cocoa_s: Core_CloseAudio: AudioOutputUnitStop failed");
 
		return;
 
	}
 

	
 
@@ -126,12 +126,12 @@ void SoundDriver_Cocoa::Stop()
 
	callback.inputProc = 0;
 
	callback.inputProcRefCon = 0;
 
	if (AudioUnitSetProperty(_outputAudioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &callback, sizeof(callback)) != noErr) {
 
		DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback) failed");
 
		Debug(driver, 0, "cocoa_s: Core_CloseAudio: AudioUnitSetProperty (kAudioUnitProperty_SetRenderCallback) failed");
 
		return;
 
	}
 

	
 
	if (AudioComponentInstanceDispose(_outputAudioUnit) != noErr) {
 
		DEBUG(driver, 0, "cocoa_s: Core_CloseAudio: AudioComponentInstanceDispose failed");
 
		Debug(driver, 0, "cocoa_s: Core_CloseAudio: AudioComponentInstanceDispose failed");
 
		return;
 
	}
 
}
src/sound/xaudio2_s.cpp
Show inline comments
 
@@ -130,7 +130,7 @@ const char *SoundDriver_XAudio2::Start(c
 

	
 
	if (FAILED(hr))
 
	{
 
		DEBUG(driver, 0, "xaudio2_s: CoInitializeEx failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: CoInitializeEx failed ({:08x})", (uint)hr);
 
		return "Failed to initialise COM";
 
	}
 

	
 
@@ -140,7 +140,7 @@ const char *SoundDriver_XAudio2::Start(c
 
	{
 
		CoUninitialize();
 

	
 
		DEBUG(driver, 0, "xaudio2_s: Unable to load " XAUDIO2_DLL_A);
 
		Debug(driver, 0, "xaudio2_s: Unable to load " XAUDIO2_DLL_A);
 
		return "Failed to load XAudio2 DLL";
 
	}
 

	
 
@@ -151,7 +151,7 @@ const char *SoundDriver_XAudio2::Start(c
 
		FreeLibrary(_xaudio_dll_handle);
 
		CoUninitialize();
 

	
 
		DEBUG(driver, 0, "xaudio2_s: Unable to find XAudio2Create function in DLL");
 
		Debug(driver, 0, "xaudio2_s: Unable to find XAudio2Create function in DLL");
 
		return "Failed to load XAudio2 DLL";
 
	}
 

	
 
@@ -164,7 +164,7 @@ const char *SoundDriver_XAudio2::Start(c
 
		FreeLibrary(_xaudio_dll_handle);
 
		CoUninitialize();
 

	
 
		DEBUG(driver, 0, "xaudio2_s: XAudio2Create failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: XAudio2Create failed ({:08x})", (uint)hr);
 
		return "Failed to inititialise the XAudio2 engine";
 
	}
 

	
 
@@ -177,7 +177,7 @@ const char *SoundDriver_XAudio2::Start(c
 
		FreeLibrary(_xaudio_dll_handle);
 
		CoUninitialize();
 

	
 
		DEBUG(driver, 0, "xaudio2_s: CreateMasteringVoice failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: CreateMasteringVoice failed ({:08x})", (uint)hr);
 
		return "Failed to create a mastering voice";
 
	}
 

	
 
@@ -216,7 +216,7 @@ const char *SoundDriver_XAudio2::Start(c
 
		FreeLibrary(_xaudio_dll_handle);
 
		CoUninitialize();
 

	
 
		DEBUG(driver, 0, "xaudio2_s: CreateSourceVoice failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: CreateSourceVoice failed ({:08x})", (uint)hr);
 
		return "Failed to create a source voice";
 
	}
 

	
 
@@ -225,7 +225,7 @@ const char *SoundDriver_XAudio2::Start(c
 

	
 
	if (FAILED(hr))
 
	{
 
		DEBUG(driver, 0, "xaudio2_s: _source_voice->Start failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: _source_voice->Start failed ({:08x})", (uint)hr);
 

	
 
		Stop();
 
		return "Failed to start the source voice";
 
@@ -238,7 +238,7 @@ const char *SoundDriver_XAudio2::Start(c
 

	
 
	if (FAILED(hr))
 
	{
 
		DEBUG(driver, 0, "xaudio2_s: _voice_context->SubmitBuffer failed (%08x)", (uint)hr);
 
		Debug(driver, 0, "xaudio2_s: _voice_context->SubmitBuffer failed ({:08x})", (uint)hr);
 

	
 
		Stop();
 
		return "Failed to submit the first audio buffer";
src/spritecache.cpp
Show inline comments
 
@@ -59,7 +59,7 @@ static SpriteCache *AllocateSpriteCache(
 
		/* Add another 1024 items to the 'pool' */
 
		uint items = Align(index + 1, 1024);
 

	
 
		DEBUG(sprite, 4, "Increasing sprite cache to %u items (" PRINTF_SIZE " bytes)", items, items * sizeof(*_spritecache));
 
		Debug(sprite, 4, "Increasing sprite cache to {} items ({} bytes)", items, items * sizeof(*_spritecache));
 

	
 
		_spritecache = ReallocT(_spritecache, items);
 

	
 
@@ -462,7 +462,7 @@ static void *ReadSprite(const SpriteCach
 
	assert(IsMapgenSpriteID(id) == (sprite_type == ST_MAPGEN));
 
	assert(sc->type == sprite_type);
 

	
 
	DEBUG(sprite, 9, "Load sprite %d", id);
 
	Debug(sprite, 9, "Load sprite {}", id);
 

	
 
	SpriteLoader::Sprite sprite[ZOOM_LVL_COUNT];
 
	uint8 sprite_avail = 0;
 
@@ -692,7 +692,7 @@ void IncreaseSpriteLRU()
 
	if (_sprite_lru_counter > 16384) {
 
		SpriteID i;
 

	
 
		DEBUG(sprite, 3, "Fixing lru %u, inuse=" PRINTF_SIZE, _sprite_lru_counter, GetSpriteCacheUsage());
 
		Debug(sprite, 3, "Fixing lru {}, inuse={}", _sprite_lru_counter, GetSpriteCacheUsage());
 

	
 
		for (i = 0; i != _spritecache_items; i++) {
 
			SpriteCache *sc = GetSpriteCache(i);
 
@@ -722,7 +722,7 @@ static void CompactSpriteCache()
 
{
 
	MemBlock *s;
 

	
 
	DEBUG(sprite, 3, "Compacting sprite cache, inuse=" PRINTF_SIZE, GetSpriteCacheUsage());
 
	Debug(sprite, 3, "Compacting sprite cache, inuse={}", GetSpriteCacheUsage());
 

	
 
	for (s = _spritecache_ptr; s->size != 0;) {
 
		if (s->size & S_FREE_MASK) {
 
@@ -785,7 +785,7 @@ static void DeleteEntryFromSpriteCache()
 
	uint best = UINT_MAX;
 
	int cur_lru;
 

	
 
	DEBUG(sprite, 3, "DeleteEntryFromSpriteCache, inuse=" PRINTF_SIZE, GetSpriteCacheUsage());
 
	Debug(sprite, 3, "DeleteEntryFromSpriteCache, inuse={}", GetSpriteCacheUsage());
 

	
 
	cur_lru = 0xffff;
 
	for (SpriteID i = 0; i != _spritecache_items; i++) {
 
@@ -874,7 +874,7 @@ static void *HandleInvalidSpriteRequest(
 

	
 
	byte warning_level = sc->warned ? 6 : 0;
 
	sc->warned = true;
 
	DEBUG(sprite, warning_level, "Tried to load %s sprite #%d as a %s sprite. Probable cause: NewGRF interference", sprite_types[available], sprite, sprite_types[requested]);
 
	Debug(sprite, warning_level, "Tried to load {} sprite #{} as a {} sprite. Probable cause: NewGRF interference", sprite_types[available], sprite, sprite_types[requested]);
 

	
 
	switch (requested) {
 
		case ST_NORMAL:
 
@@ -908,7 +908,7 @@ void *GetRawSprite(SpriteID sprite, Spri
 
	assert(type < ST_INVALID);
 

	
 
	if (!SpriteExists(sprite)) {
 
		DEBUG(sprite, 1, "Tried to load non-existing sprite #%d. Probable cause: Wrong/missing NewGRFs", sprite);
 
		Debug(sprite, 1, "Tried to load non-existing sprite #{}. Probable cause: Wrong/missing NewGRFs", sprite);
 

	
 
		/* SPR_IMG_QUERY is a BIG FAT RED ? */
 
		sprite = SPR_IMG_QUERY;
 
@@ -971,7 +971,7 @@ static void GfxInitSpriteCache()
 
		} while (_spritecache_ptr == nullptr);
 

	
 
		if (_allocated_sprite_cache_size != target_size) {
 
			DEBUG(misc, 0, "Not enough memory to allocate %d MiB of spritecache. Spritecache was reduced to %d MiB.", target_size / 1024 / 1024, _allocated_sprite_cache_size / 1024 / 1024);
 
			Debug(misc, 0, "Not enough memory to allocate {} MiB of spritecache. Spritecache was reduced to {} MiB.", target_size / 1024 / 1024, _allocated_sprite_cache_size / 1024 / 1024);
 

	
 
			ErrorMessageData msg(STR_CONFIG_ERROR_OUT_OF_MEMORY, STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG);
 
			msg.SetDParam(0, target_size);
src/spriteloader/grf.cpp
Show inline comments
 
@@ -38,7 +38,7 @@ static bool WarnCorruptSprite(const Spri
 
		SetDParamStr(0, file.GetSimplifiedFilename());
 
		ShowErrorMessage(STR_NEWGRF_ERROR_CORRUPT_SPRITE, INVALID_STRING_ID, WL_ERROR);
 
	}
 
	DEBUG(sprite, warning_level, "[%i] Loading corrupted sprite from %s at position %i", line, file.GetSimplifiedFilename().c_str(), (int)file_pos);
 
	Debug(sprite, warning_level, "[{}] Loading corrupted sprite from {} at position {}", line, file.GetSimplifiedFilename(), file_pos);
 
	warning_level = 6;
 
	return false;
 
}
 
@@ -173,7 +173,7 @@ bool DecodeSingleSprite(SpriteLoader::Sp
 

	
 
		if (dest_size > sprite->width * sprite->height * bpp) {
 
			static byte warning_level = 0;
 
			DEBUG(sprite, warning_level, "Ignoring " OTTD_PRINTF64 " unused extra bytes from the sprite from %s at position %i", dest_size - sprite->width * sprite->height * bpp, file.GetSimplifiedFilename().c_str(), (int)file_pos);
 
			Debug(sprite, warning_level, "Ignoring {} unused extra bytes from the sprite from {} at position {}", dest_size - sprite->width * sprite->height * bpp, file.GetSimplifiedFilename(), file_pos);
 
			warning_level = 6;
 
		}
 

	
 
@@ -279,7 +279,7 @@ uint8 LoadSpriteV2(SpriteLoader::Sprite 
 

	
 
			if (HasBit(loaded_sprites, zoom_lvl)) {
 
				/* We already have this zoom level, skip sprite. */
 
				DEBUG(sprite, 1, "Ignoring duplicate zoom level sprite %u from %s", id, file.GetSimplifiedFilename().c_str());
 
				Debug(sprite, 1, "Ignoring duplicate zoom level sprite {} from {}", id, file.GetSimplifiedFilename());
 
				file.SkipBytes(num - 2);
 
				continue;
 
			}
src/station_cmd.cpp
Show inline comments
 
@@ -3752,7 +3752,7 @@ void IncreaseStats(Station *st, CargoID 
 
				ge2.link_graph = lg->index;
 
				ge2.node = lg->AddNode(st2);
 
			} else {
 
				DEBUG(misc, 0, "Can't allocate link graph");
 
				Debug(misc, 0, "Can't allocate link graph");
 
			}
 
		} else {
 
			lg = LinkGraph::Get(ge2.link_graph);
 
@@ -3894,7 +3894,7 @@ static uint UpdateStationWaiting(Station
 
			ge.link_graph = lg->index;
 
			ge.node = lg->AddNode(st);
 
		} else {
 
			DEBUG(misc, 0, "Can't allocate link graph");
 
			Debug(misc, 0, "Can't allocate link graph");
 
		}
 
	} else {
 
		lg = LinkGraph::Get(ge.link_graph);
 
@@ -4128,7 +4128,7 @@ void UpdateStationDockingTiles(Station *
 
void BuildOilRig(TileIndex tile)
 
{
 
	if (!Station::CanAllocateItem()) {
 
		DEBUG(misc, 0, "Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
 
		Debug(misc, 0, "Can't allocate station for oilrig at 0x{:X}, reverting to oilrig only", tile);
 
		return;
 
	}
 

	
src/station_gui.cpp
Show inline comments
 
@@ -223,7 +223,7 @@ protected:
 
	{
 
		if (!this->stations.NeedRebuild()) return;
 

	
 
		DEBUG(misc, 3, "Building station list for company %d", owner);
 
		Debug(misc, 3, "Building station list for company {}", owner);
 

	
 
		this->stations.clear();
 

	
 
@@ -662,7 +662,7 @@ public:
 
	void OnGameTick() override
 
	{
 
		if (this->stations.NeedResort()) {
 
			DEBUG(misc, 3, "Periodic rebuild station list company %d", this->window_number);
 
			Debug(misc, 3, "Periodic rebuild station list company {}", this->window_number);
 
			this->SetDirty();
 
		}
 
	}
src/string.cpp
Show inline comments
 
@@ -121,7 +121,7 @@ char *strecpy(char *dst, const char *src
 
#if defined(STRGEN) || defined(SETTINGSGEN)
 
		error("String too long for destination buffer");
 
#else /* STRGEN || SETTINGSGEN */
 
		DEBUG(misc, 0, "String too long for destination buffer");
 
		Debug(misc, 0, "String too long for destination buffer");
 
#endif /* STRGEN || SETTINGSGEN */
 
	}
 
	return dst;
 
@@ -599,7 +599,7 @@ size_t Utf8Decode(WChar *c, const char *
 
		}
 
	}
 

	
 
	/* DEBUG(misc, 1, "[utf8] invalid UTF-8 sequence"); */
 
	/* Debug(misc, 1, "[utf8] invalid UTF-8 sequence"); */
 
	*c = '?';
 
	return 1;
 
}
 
@@ -635,7 +635,7 @@ inline size_t Utf8Encode(T buf, WChar c)
 
		return 4;
 
	}
 

	
 
	/* DEBUG(misc, 1, "[utf8] can't UTF-8 encode value 0x%X", c); */
 
	/* Debug(misc, 1, "[utf8] can't UTF-8 encode value 0x{:X}", c); */
 
	*buf = '?';
 
	return 1;
 
}
src/strings.cpp
Show inline comments
 
@@ -70,12 +70,12 @@ void StringParameters::ClearTypeInformat
 
int64 StringParameters::GetInt64(WChar type)
 
{
 
	if (this->offset >= this->num_param) {
 
		DEBUG(misc, 0, "Trying to read invalid string parameter");
 
		Debug(misc, 0, "Trying to read invalid string parameter");
 
		return 0;
 
	}
 
	if (this->type != nullptr) {
 
		if (this->type[this->offset] != 0 && this->type[this->offset] != type) {
 
			DEBUG(misc, 0, "Trying to read string parameter with wrong type");
 
			Debug(misc, 0, "Trying to read string parameter with wrong type");
 
			return 0;
 
		}
 
		this->type[this->offset] = type;
 
@@ -1955,9 +1955,9 @@ static void GetLanguageList(const char *
 

	
 
			/* Check whether the file is of the correct version */
 
			if (!GetLanguageFileHeader(lmd.file, &lmd)) {
 
				DEBUG(misc, 3, "%s is not a valid language file", lmd.file);
 
				Debug(misc, 3, "{} is not a valid language file", lmd.file);
 
			} else if (GetLanguage(lmd.newgrflangid) != nullptr) {
 
				DEBUG(misc, 3, "%s's language ID is already known", lmd.file);
 
				Debug(misc, 3, "{}'s language ID is already known", lmd.file);
 
			} else {
 
				_languages.push_back(lmd);
 
			}
 
@@ -2055,7 +2055,7 @@ bool MissingGlyphSearcher::FindMissingGl
 
					default: NOT_REACHED();
 
				}
 

	
 
				DEBUG(freetype, 0, "Font is missing glyphs to display char 0x%X in %s font size", c, size_name.c_str());
 
				Debug(freetype, 0, "Font is missing glyphs to display char 0x{:X} in {} font size", (int)c, size_name);
 
				return true;
 
			}
 
		}
src/thread.h
Show inline comments
 
@@ -66,7 +66,7 @@ inline bool StartNewThread(std::thread *
 
		return true;
 
	} catch (const std::system_error& e) {
 
		/* Something went wrong, the system we are running on might not support threads. */
 
		DEBUG(misc, 1, "Can't create thread '%s': %s", name, e.what());
 
		Debug(misc, 1, "Can't create thread '{}': {}", name, e.what());
 
	}
 
#endif
 

	
src/vehicle.cpp
Show inline comments
 
@@ -315,11 +315,11 @@ void ShowNewGrfVehicleError(EngineID eng
 

	
 
	SetDParamStr(0, grfconfig->GetName());
 
	GetString(buffer, part1, lastof(buffer));
 
	DEBUG(grf, 0, "%s", buffer + 3);
 
	Debug(grf, 0, "{}", buffer + 3);
 

	
 
	SetDParam(1, engine);
 
	GetString(buffer, part2, lastof(buffer));
 
	DEBUG(grf, 0, "%s", buffer + 3);
 
	Debug(grf, 0, "{}", buffer + 3);
 
}
 

	
 
/**
 
@@ -2231,7 +2231,7 @@ void Vehicle::CancelReservation(StationI
 
	for (Vehicle *v = this; v != nullptr; v = v->next) {
 
		VehicleCargoList &cargo = v->cargo;
 
		if (cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) {
 
			DEBUG(misc, 1, "cancelling cargo reservation");
 
			Debug(misc, 1, "cancelling cargo reservation");
 
			cargo.Return(UINT_MAX, &st->goods[v->cargo_type].cargo, next);
 
			cargo.SetTransferLoadPlace(st->xy);
 
		}
src/vehicle_gui.cpp
Show inline comments
 
@@ -176,7 +176,7 @@ void BaseVehicleListWindow::BuildVehicle
 
{
 
	if (!this->vehgroups.NeedRebuild()) return;
 

	
 
	DEBUG(misc, 3, "Building vehicle list type %d for company %d given index %d", this->vli.type, this->vli.company, this->vli.index);
 
	Debug(misc, 3, "Building vehicle list type {} for company {} given index {}", this->vli.type, this->vli.company, this->vli.index);
 

	
 
	this->vehgroups.clear();
 

	
 
@@ -1906,7 +1906,7 @@ public:
 
		if (this->vehgroups.NeedResort()) {
 
			StationID station = (this->vli.type == VL_STATION_LIST) ? this->vli.index : INVALID_STATION;
 

	
 
			DEBUG(misc, 3, "Periodic resort %d list company %d at station %d", this->vli.vtype, this->owner, station);
 
			Debug(misc, 3, "Periodic resort {} list company {} at station {}", this->vli.vtype, this->owner, station);
 
			this->SetDirty();
 
		}
 
	}
src/video/allegro_v.cpp
Show inline comments
 
@@ -191,7 +191,7 @@ static bool CreateMainSurface(uint w, ui
 

	
 
	GetAvailableVideoMode(&w, &h);
 
	if (set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, w, h, 0, 0) != 0) {
 
		DEBUG(driver, 0, "Allegro: Couldn't allocate a window to draw on '%s'", allegro_error);
 
		Debug(driver, 0, "Allegro: Couldn't allocate a window to draw on '{}'", allegro_error);
 
		return false;
 
	}
 

	
 
@@ -327,8 +327,8 @@ static uint32 ConvertAllegroKeyIntoMy(WC
 
	if (key_shifts & KB_CTRL_FLAG)  key |= WKC_CTRL;
 
	if (key_shifts & KB_ALT_FLAG)   key |= WKC_ALT;
 
#if 0
 
	DEBUG(driver, 0, "Scancode character pressed %u", scancode);
 
	DEBUG(driver, 0, "Unicode character pressed %u", unicode);
 
	Debug(driver, 0, "Scancode character pressed {}", scancode);
 
	Debug(driver, 0, "Unicode character pressed {}", unicode);
 
#endif
 

	
 
	*character = unicode;
 
@@ -425,7 +425,7 @@ int _allegro_instance_count = 0;
 
const char *VideoDriver_Allegro::Start(const StringList &param)
 
{
 
	if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) {
 
		DEBUG(driver, 0, "allegro: install_allegro failed '%s'", allegro_error);
 
		Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error);
 
		return "Failed to set up Allegro";
 
	}
 
	_allegro_instance_count++;
src/video/cocoa/cocoa_v.mm
Show inline comments
 
@@ -363,7 +363,7 @@ bool VideoDriver_Cocoa::MakeWindow(int w
 
	unsigned int style = NSTitledWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask | NSClosableWindowMask;
 
	this->window = [ [ OTTD_CocoaWindow alloc ] initWithContentRect:contentRect styleMask:style backing:NSBackingStoreBuffered defer:NO driver:this ];
 
	if (this->window == nil) {
 
		DEBUG(driver, 0, "Could not create the Cocoa window.");
 
		Debug(driver, 0, "Could not create the Cocoa window.");
 
		this->setup = false;
 
		return false;
 
	}
 
@@ -391,7 +391,7 @@ bool VideoDriver_Cocoa::MakeWindow(int w
 
	NSRect view_frame = [ this->window contentRectForFrameRect:[ this->window frame ] ];
 
	this->cocoaview = [ [ OTTD_CocoaView alloc ] initWithFrame:view_frame ];
 
	if (this->cocoaview == nil) {
 
		DEBUG(driver, 0, "Could not create the event wrapper view.");
 
		Debug(driver, 0, "Could not create the event wrapper view.");
 
		this->setup = false;
 
		return false;
 
	}
 
@@ -400,7 +400,7 @@ bool VideoDriver_Cocoa::MakeWindow(int w
 
	/* Create content view. */
 
	NSView *draw_view = this->AllocateDrawView();
 
	if (draw_view == nil) {
 
		DEBUG(driver, 0, "Could not create the drawing view.");
 
		Debug(driver, 0, "Could not create the drawing view.");
 
		this->setup = false;
 
		return false;
 
	}
src/video/cocoa/cocoa_wnd.mm
Show inline comments
 
@@ -273,7 +273,7 @@ bool CocoaSetupApplication()
 

	
 
	/* Tell the dock about us */
 
	OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
 
	if (returnCode != 0) DEBUG(driver, 0, "Could not change to foreground application. Error %d", (int)returnCode);
 
	if (returnCode != 0) Debug(driver, 0, "Could not change to foreground application. Error {}", (int)returnCode);
 

	
 
	/* Disable the system-wide tab feature as we only have one window. */
 
	if ([ NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:) ]) {
 
@@ -700,9 +700,9 @@ void CocoaDialog(const char *title, cons
 
		if (!EditBoxInGlobalFocus() || IsInsideMM(pressed_key & ~WKC_SPECIAL_KEYS, WKC_F1, WKC_PAUSE + 1)) {
 
			HandleKeypress(pressed_key, unicode);
 
		}
 
		DEBUG(driver, 3, "cocoa_v: QZ_KeyEvent: %x (%x), down, mapping: %x", keycode, unicode, pressed_key);
 
		Debug(driver, 3, "cocoa_v: QZ_KeyEvent: {:x} ({:x}), down, mapping: {:x}", keycode, (int)unicode, pressed_key);
 
	} else {
 
		DEBUG(driver, 3, "cocoa_v: QZ_KeyEvent: %x (%x), up", keycode, unicode);
 
		Debug(driver, 3, "cocoa_v: QZ_KeyEvent: {:x} ({:x}), up", keycode, (int)unicode);
 
	}
 

	
 
	return interpret_keys;
src/video/dedicated_v.cpp
Show inline comments
 
@@ -108,7 +108,7 @@ static void CreateWindowsConsoleThread()
 
	_hThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, nullptr, 0, &dwThreadId);
 
	if (_hThread == nullptr) usererror("Cannot create console thread!");
 

	
 
	DEBUG(driver, 2, "Windows console thread started");
 
	Debug(driver, 2, "Windows console thread started");
 
}
 

	
 
static void CloseWindowsConsoleThread()
 
@@ -116,7 +116,7 @@ static void CloseWindowsConsoleThread()
 
	CloseHandle(_hThread);
 
	CloseHandle(_hInputReady);
 
	CloseHandle(_hWaitForInputHandling);
 
	DEBUG(driver, 2, "Windows console thread shut down");
 
	Debug(driver, 2, "Windows console thread shut down");
 
}
 

	
 
#endif
 
@@ -164,7 +164,7 @@ const char *VideoDriver_Dedicated::Start
 
	OS2_SwitchToConsoleMode();
 
#endif
 

	
 
	DEBUG(driver, 1, "Loading dedicated server");
 
	Debug(driver, 1, "Loading dedicated server");
 
	return nullptr;
 
}
 

	
 
@@ -256,7 +256,7 @@ void VideoDriver_Dedicated::MainLoop()
 
		 *  intro game... */
 
		if (SaveOrLoad(_file_to_saveload.name, _file_to_saveload.file_op, _file_to_saveload.detail_ftype, BASE_DIR) == SL_ERROR) {
 
			/* Loading failed, pop out.. */
 
			DEBUG(net, 0, "Loading requested map failed; closing server.");
 
			Debug(net, 0, "Loading requested map failed; closing server.");
 
			return;
 
		} else {
 
			/* We can load this game, so go ahead */
src/video/null_v.cpp
Show inline comments
 
@@ -35,7 +35,7 @@ const char *VideoDriver_Null::Start(cons
 
	ScreenSizeChanged();
 

	
 
	/* Do not render, nor blit */
 
	DEBUG(misc, 1, "Forcing blitter 'null'...");
 
	Debug(misc, 1, "Forcing blitter 'null'...");
 
	BlitterFactory::SelectBlitter("null");
 
	return nullptr;
 
}
src/video/opengl.cpp
Show inline comments
 
@@ -428,7 +428,7 @@ void APIENTRY DebugOutputCallback(GLenum
 
		case GL_DEBUG_TYPE_PORTABILITY:         type_str = "Portability"; break;
 
	}
 

	
 
	DEBUG(driver, 6, "OpenGL: %s (%s) - %s", type_str, severity_str, message);
 
	Debug(driver, 6, "OpenGL: {} ({}) - {}", type_str, severity_str, message);
 
}
 

	
 
/** Enable OpenGL debug messages if supported. */
 
@@ -536,7 +536,7 @@ const char *OpenGLBackend::Init(const Di
 

	
 
	if (ver == nullptr || vend == nullptr || renderer == nullptr) return "OpenGL not supported";
 

	
 
	DEBUG(driver, 1, "OpenGL driver: %s - %s (%s)", vend, renderer, ver);
 
	Debug(driver, 1, "OpenGL driver: {} - {} ({})", vend, renderer, ver);
 

	
 
#ifndef GL_ALLOW_SOFTWARE_RENDERER
 
	/* Don't use MESA software rendering backends as they are slower than
 
@@ -584,10 +584,10 @@ const char *OpenGLBackend::Init(const Di
 
#endif
 

	
 
	if (this->persistent_mapping_supported && !BindPersistentBufferExtensions()) {
 
		DEBUG(driver, 1, "OpenGL claims to support persistent buffer mapping but doesn't export all functions, not using persistent mapping.");
 
		Debug(driver, 1, "OpenGL claims to support persistent buffer mapping but doesn't export all functions, not using persistent mapping.");
 
		this->persistent_mapping_supported = false;
 
	}
 
	if (this->persistent_mapping_supported) DEBUG(driver, 3, "OpenGL: Using persistent buffer mapping");
 
	if (this->persistent_mapping_supported) Debug(driver, 3, "OpenGL: Using persistent buffer mapping");
 

	
 
	/* Check maximum texture size against screen resolution. */
 
	GLint max_tex_size = 0;
 
@@ -599,7 +599,7 @@ const char *OpenGLBackend::Init(const Di
 
	_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_tex_units);
 
	if (max_tex_units < 4) return "Not enough simultaneous textures supported";
 

	
 
	DEBUG(driver, 2, "OpenGL shading language version: %s, texture units = %d", (const char *)_glGetString(GL_SHADING_LANGUAGE_VERSION), (int)max_tex_units);
 
	Debug(driver, 2, "OpenGL shading language version: {}, texture units = {}", (const char *)_glGetString(GL_SHADING_LANGUAGE_VERSION), (int)max_tex_units);
 

	
 
	if (!this->InitShaders()) return "Failed to initialize shaders";
 

	
 
@@ -761,7 +761,7 @@ static bool VerifyShader(GLuint shader)
 
	_glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len);
 
	if (log_len > 0) {
 
		_glGetShaderInfoLog(shader, log_len, nullptr, log_buf.Allocate(log_len));
 
		DEBUG(driver, result != GL_TRUE ? 0 : 2, "%s", log_buf.GetBuffer()); // Always print on failure.
 
		Debug(driver, result != GL_TRUE ? 0 : 2, "{}", log_buf.GetBuffer()); // Always print on failure.
 
	}
 

	
 
	return result == GL_TRUE;
 
@@ -784,7 +784,7 @@ static bool VerifyProgram(GLuint program
 
	_glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len);
 
	if (log_len > 0) {
 
		_glGetProgramInfoLog(program, log_len, nullptr, log_buf.Allocate(log_len));
 
		DEBUG(driver, result != GL_TRUE ? 0 : 2, "%s", log_buf.GetBuffer()); // Always print on failure.
 
		Debug(driver, result != GL_TRUE ? 0 : 2, "{}", log_buf.GetBuffer()); // Always print on failure.
 
	}
 

	
 
	return result == GL_TRUE;
src/video/sdl2_v.cpp
Show inline comments
 
@@ -119,7 +119,7 @@ static uint FindStartupDisplay(uint star
 
	for (int display = 0; display < num_displays; ++display) {
 
		SDL_Rect r;
 
		if (SDL_GetDisplayBounds(display, &r) == 0 && IsInsideBS(mx, r.x, r.w) && IsInsideBS(my, r.y, r.h)) {
 
			DEBUG(driver, 1, "SDL2: Mouse is at (%d, %d), use display %d (%d, %d, %d, %d)", mx, my, display, r.x, r.y, r.w, r.h);
 
			Debug(driver, 1, "SDL2: Mouse is at ({}, {}), use display {} ({}, {}, {}, {})", mx, my, display, r.x, r.y, r.w, r.h);
 
			return display;
 
		}
 
	}
 
@@ -168,7 +168,7 @@ bool VideoDriver_SDL_Base::CreateMainWin
 
		flags);
 

	
 
	if (this->sdl_window == nullptr) {
 
		DEBUG(driver, 0, "SDL2: Couldn't allocate a window to draw on: %s", SDL_GetError());
 
		Debug(driver, 0, "SDL2: Couldn't allocate a window to draw on: {}", SDL_GetError());
 
		return false;
 
	}
 

	
 
@@ -192,7 +192,7 @@ bool VideoDriver_SDL_Base::CreateMainWin
 
bool VideoDriver_SDL_Base::CreateMainSurface(uint w, uint h, bool resize)
 
{
 
	GetAvailableVideoMode(&w, &h);
 
	DEBUG(driver, 1, "SDL2: using mode %ux%u", w, h);
 
	Debug(driver, 1, "SDL2: using mode {}x{}", w, h);
 

	
 
	if (!this->CreateMainWindow(w, h)) return false;
 
	if (resize) SDL_SetWindowSize(this->sdl_window, w, h);
 
@@ -547,7 +547,7 @@ const char *VideoDriver_SDL_Base::Initia
 
	if (error != nullptr) return error;
 

	
 
	FindResolutions();
 
	DEBUG(driver, 2, "Resolution for display: %ux%u", _cur_resolution.width, _cur_resolution.height);
 
	Debug(driver, 2, "Resolution for display: {}x{}", _cur_resolution.width, _cur_resolution.height);
 

	
 
	return nullptr;
 
}
 
@@ -566,7 +566,7 @@ const char *VideoDriver_SDL_Base::Start(
 
	}
 

	
 
	const char *dname = SDL_GetCurrentVideoDriver();
 
	DEBUG(driver, 1, "SDL2: using driver '%s'", dname);
 
	Debug(driver, 1, "SDL2: using driver '{}'", dname);
 

	
 
	MarkWholeScreenDirty();
 

	
 
@@ -680,20 +680,20 @@ bool VideoDriver_SDL_Base::ToggleFullscr
 
		/* Find fullscreen window size */
 
		SDL_DisplayMode dm;
 
		if (SDL_GetCurrentDisplayMode(0, &dm) < 0) {
 
			DEBUG(driver, 0, "SDL_GetCurrentDisplayMode() failed: %s", SDL_GetError());
 
			Debug(driver, 0, "SDL_GetCurrentDisplayMode() failed: {}", SDL_GetError());
 
		} else {
 
			SDL_SetWindowSize(this->sdl_window, dm.w, dm.h);
 
		}
 
	}
 

	
 
	DEBUG(driver, 1, "SDL2: Setting %s", fullscreen ? "fullscreen" : "windowed");
 
	Debug(driver, 1, "SDL2: Setting {}", fullscreen ? "fullscreen" : "windowed");
 
	int ret = SDL_SetWindowFullscreen(this->sdl_window, fullscreen ? SDL_WINDOW_FULLSCREEN : 0);
 
	if (ret == 0) {
 
		/* Switching resolution succeeded, set fullscreen value of window. */
 
		_fullscreen = fullscreen;
 
		if (!fullscreen) SDL_SetWindowSize(this->sdl_window, w, h);
 
	} else {
 
		DEBUG(driver, 0, "SDL_SetWindowFullscreen() failed: %s", SDL_GetError());
 
		Debug(driver, 0, "SDL_SetWindowFullscreen() failed: {}", SDL_GetError());
 
	}
 

	
 
	InvalidateWindowClassesData(WC_GAME_OPTIONS, 3);
src/video/sdl_v.cpp
Show inline comments
 
@@ -236,7 +236,7 @@ bool VideoDriver_SDL::CreateMainSurface(
 

	
 
	GetAvailableVideoMode(&w, &h);
 

	
 
	DEBUG(driver, 1, "SDL: using mode %ux%ux%d", w, h, bpp);
 
	Debug(driver, 1, "SDL: using mode {}x{}x{}", w, h, bpp);
 

	
 
	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 

	
 
@@ -282,7 +282,7 @@ bool VideoDriver_SDL::CreateMainSurface(
 
		want_hwpalette = _use_hwpalette;
 
	}
 

	
 
	if (want_hwpalette) DEBUG(driver, 1, "SDL: requesting hardware palette");
 
	if (want_hwpalette) Debug(driver, 1, "SDL: requesting hardware palette");
 

	
 
	/* Free any previously allocated shadow surface */
 
	if (_sdl_surface != nullptr && _sdl_surface != _sdl_realscreen) SDL_FreeSurface(_sdl_surface);
 
@@ -297,7 +297,7 @@ bool VideoDriver_SDL::CreateMainSurface(
 
			 * windowed), we restart the entire video
 
			 * subsystem to force creating a new window.
 
			 */
 
			DEBUG(driver, 0, "SDL: Restarting SDL video subsystem, to force hwpalette change");
 
			Debug(driver, 0, "SDL: Restarting SDL video subsystem, to force hwpalette change");
 
			SDL_QuitSubSystem(SDL_INIT_VIDEO);
 
			SDL_InitSubSystem(SDL_INIT_VIDEO);
 
			ClaimMousePointer();
 
@@ -313,7 +313,7 @@ bool VideoDriver_SDL::CreateMainSurface(
 
	/* DO NOT CHANGE TO HWSURFACE, IT DOES NOT WORK */
 
	newscreen = SDL_SetVideoMode(w, h, bpp, SDL_SWSURFACE | (want_hwpalette ? SDL_HWPALETTE : 0) | (_fullscreen ? SDL_FULLSCREEN : SDL_RESIZABLE));
 
	if (newscreen == nullptr) {
 
		DEBUG(driver, 0, "SDL: Couldn't allocate a window to draw on");
 
		Debug(driver, 0, "SDL: Couldn't allocate a window to draw on");
 
		return false;
 
	}
 
	_sdl_realscreen = newscreen;
 
@@ -337,10 +337,10 @@ bool VideoDriver_SDL::CreateMainSurface(
 
		 * This shadow surface will have SDL_HWPALLETE set, so
 
		 * we won't create a second shadow surface in this case.
 
		 */
 
		DEBUG(driver, 1, "SDL: using shadow surface");
 
		Debug(driver, 1, "SDL: using shadow surface");
 
		newscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, bpp, 0, 0, 0, 0);
 
		if (newscreen == nullptr) {
 
			DEBUG(driver, 0, "SDL: Couldn't allocate a shadow surface to draw on");
 
			Debug(driver, 0, "SDL: Couldn't allocate a shadow surface to draw on");
 
			return false;
 
		}
 
	}
 
@@ -594,7 +594,7 @@ const char *VideoDriver_SDL::Start(const
 
	}
 

	
 
	SDL_VideoDriverName(buf, sizeof buf);
 
	DEBUG(driver, 1, "SDL: using driver '%s'", buf);
 
	Debug(driver, 1, "SDL: using driver '{}'", buf);
 

	
 
	MarkWholeScreenDirty();
 
	SetupKeyboard();
src/video/video_driver.cpp
Show inline comments
 
@@ -87,7 +87,7 @@ void VideoDriver::StartGameThread()
 
		this->is_game_threaded = StartNewThread(&this->game_thread, "ottd:game", &VideoDriver::GameThreadThunk, this);
 
	}
 

	
 
	DEBUG(driver, 1, "using %sthread for game-loop", this->is_game_threaded ? "" : "no ");
 
	Debug(driver, 1, "using {}thread for game-loop", this->is_game_threaded ? "" : "no ");
 
}
 

	
 
void VideoDriver::StopGameThread()
src/video/win32_v.cpp
Show inline comments
 
@@ -234,7 +234,7 @@ static LRESULT HandleCharMsg(uint keycod
 

	
 
	/* Did we get a lead surrogate? If yes, store and exit. */
 
	if (Utf16IsLeadSurrogate(charcode)) {
 
		if (prev_char != 0) DEBUG(driver, 1, "Got two UTF-16 lead surrogates, dropping the first one");
 
		if (prev_char != 0) Debug(driver, 1, "Got two UTF-16 lead surrogates, dropping the first one");
 
		prev_char = charcode;
 
		return 0;
 
	}
 
@@ -244,7 +244,7 @@ static LRESULT HandleCharMsg(uint keycod
 
		if (Utf16IsTrailSurrogate(charcode)) {
 
			charcode = Utf16DecodeSurrogate(prev_char, charcode);
 
		} else {
 
			DEBUG(driver, 1, "Got an UTF-16 lead surrogate without a trail surrogate, dropping the lead surrogate");
 
			Debug(driver, 1, "Got an UTF-16 lead surrogate without a trail surrogate, dropping the lead surrogate");
 
		}
 
	}
 
	prev_char = 0;
 
@@ -794,7 +794,7 @@ void VideoDriver_Win32Base::Initialize()
 
	this->width  = this->width_org  = _cur_resolution.width;
 
	this->height = this->height_org = _cur_resolution.height;
 

	
 
	DEBUG(driver, 2, "Resolution for display: %ux%u", _cur_resolution.width, _cur_resolution.height);
 
	Debug(driver, 2, "Resolution for display: {}x{}", _cur_resolution.width, _cur_resolution.height);
 
}
 

	
 
void VideoDriver_Win32Base::Stop()
 
@@ -1361,7 +1361,7 @@ void VideoDriver_Win32OpenGL::ToggleVsyn
 
	if (_wglSwapIntervalEXT != nullptr) {
 
		_wglSwapIntervalEXT(vsync);
 
	} else if (vsync) {
 
		DEBUG(driver, 0, "OpenGL: Vsync requested, but not supported by driver");
 
		Debug(driver, 0, "OpenGL: Vsync requested, but not supported by driver");
 
	}
 
}
 

	
src/viewport.cpp
Show inline comments
 
@@ -2363,7 +2363,7 @@ bool HandleViewportClicked(const Viewpor
 
	bool result = CheckClickOnLandscape(vp, x, y);
 

	
 
	if (v != nullptr) {
 
		DEBUG(misc, 2, "Vehicle %d (index %d) at %p", v->unitnumber, v->index, v);
 
		Debug(misc, 2, "Vehicle {} (index {}) at {}", v->unitnumber, v->index, fmt::ptr(v));
 
		if (IsCompanyBuildableVehicleType(v)) {
 
			v = v->First();
 
			if (_ctrl_pressed && v->owner == _local_company) {
src/window.cpp
Show inline comments
 
@@ -3382,7 +3382,7 @@ static int PositionWindow(Window *w, Win
 
 */
 
int PositionMainToolbar(Window *w)
 
{
 
	DEBUG(misc, 5, "Repositioning Main Toolbar...");
 
	Debug(misc, 5, "Repositioning Main Toolbar...");
 
	return PositionWindow(w, WC_MAIN_TOOLBAR, _settings_client.gui.toolbar_pos);
 
}
 

	
 
@@ -3393,7 +3393,7 @@ int PositionMainToolbar(Window *w)
 
 */
 
int PositionStatusbar(Window *w)
 
{
 
	DEBUG(misc, 5, "Repositioning statusbar...");
 
	Debug(misc, 5, "Repositioning statusbar...");
 
	return PositionWindow(w, WC_STATUS_BAR, _settings_client.gui.statusbar_pos);
 
}
 

	
 
@@ -3404,7 +3404,7 @@ int PositionStatusbar(Window *w)
 
 */
 
int PositionNewsMessage(Window *w)
 
{
 
	DEBUG(misc, 5, "Repositioning news message...");
 
	Debug(misc, 5, "Repositioning news message...");
 
	return PositionWindow(w, WC_NEWS_WINDOW, _settings_client.gui.statusbar_pos);
 
}
 

	
 
@@ -3415,7 +3415,7 @@ int PositionNewsMessage(Window *w)
 
 */
 
int PositionNetworkChatWindow(Window *w)
 
{
 
	DEBUG(misc, 5, "Repositioning network chat window...");
 
	Debug(misc, 5, "Repositioning network chat window...");
 
	return PositionWindow(w, WC_SEND_NETWORK_MSG, _settings_client.gui.statusbar_pos);
 
}
 

	
0 comments (0 inline, 0 general)