Merge branch 'infrastructure_sharing' into jgrpp
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
#include "order_type.h"
|
#include "order_type.h"
|
||||||
#include "company_func.h"
|
#include "company_func.h"
|
||||||
#include "core/backup_type.hpp"
|
#include "core/backup_type.hpp"
|
||||||
|
#include "string_func.h"
|
||||||
|
#include "strings_func.h"
|
||||||
#include "3rdparty/cpp-btree/btree_map.h"
|
#include "3rdparty/cpp-btree/btree_map.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -73,6 +75,29 @@ inline void IterateCargoPacketDeferredPayments(CargoPacketID index, bool erase_r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DumpCargoPacketDeferredPaymentStats(char *buffer, const char *last)
|
||||||
|
{
|
||||||
|
Money payments[256][4] = {};
|
||||||
|
for (auto &it : _cargo_packet_deferred_payments) {
|
||||||
|
payments[GB(it.first, 24, 8)][GB(it.first, 22, 2)] += it.second;
|
||||||
|
}
|
||||||
|
for (uint i = 0; i < 256; i++) {
|
||||||
|
for (uint j = 0; j < 4; j++) {
|
||||||
|
if (payments[i][j] != 0) {
|
||||||
|
SetDParam(0, i);
|
||||||
|
buffer = GetString(buffer, STR_COMPANY_NAME, last);
|
||||||
|
buffer += seprintf(buffer, last, " (");
|
||||||
|
buffer = GetString(buffer, STR_REPLACE_VEHICLE_TRAIN + j, last);
|
||||||
|
buffer += seprintf(buffer, last, "): ");
|
||||||
|
SetDParam(0, payments[i][j]);
|
||||||
|
buffer = GetString(buffer, STR_JUST_CURRENCY_LONG, last);
|
||||||
|
buffer += seprintf(buffer, last, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buffer += seprintf(buffer, last, "Deferred payment count: %u\n", (uint) _cargo_packet_deferred_payments.size());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new packet for savegame loading.
|
* Create a new packet for savegame loading.
|
||||||
*/
|
*/
|
||||||
|
@@ -60,7 +60,7 @@ private:
|
|||||||
};
|
};
|
||||||
uint flags = 0; ///< NOSAVE: temporary flags
|
uint flags = 0; ///< NOSAVE: temporary flags
|
||||||
|
|
||||||
/** Vehicle status bits in #Vehicle::vehstatus. */
|
/** Cargo packet flag bits in CargoPacket::flags. */
|
||||||
enum CargoPacketFlags {
|
enum CargoPacketFlags {
|
||||||
CPF_HAS_DEFERRED_PAYMENT = 0x01, ///< Cargo packet has 1 or more deferred payment(s)
|
CPF_HAS_DEFERRED_PAYMENT = 0x01, ///< Cargo packet has 1 or more deferred payment(s)
|
||||||
};
|
};
|
||||||
|
@@ -1976,6 +1976,20 @@ DEF_CONSOLE_CMD(ConDumpInflation)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_CONSOLE_CMD(ConDumpCpdpStats)
|
||||||
|
{
|
||||||
|
if (argc == 0) {
|
||||||
|
IConsoleHelp("Dump cargo packet deferred payment stats.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void DumpCargoPacketDeferredPaymentStats(char *buffer, const char *last);
|
||||||
|
char buffer[32768];
|
||||||
|
DumpCargoPacketDeferredPaymentStats(buffer, lastof(buffer));
|
||||||
|
PrintLineByLine(buffer);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
DEF_CONSOLE_CMD(ConCheckCaches)
|
DEF_CONSOLE_CMD(ConCheckCaches)
|
||||||
{
|
{
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
@@ -2142,6 +2156,7 @@ void IConsoleStdLibRegister()
|
|||||||
#endif
|
#endif
|
||||||
IConsoleCmdRegister("dump_command_log", ConDumpCommandLog, nullptr, true);
|
IConsoleCmdRegister("dump_command_log", ConDumpCommandLog, nullptr, true);
|
||||||
IConsoleCmdRegister("dump_inflation", ConDumpInflation, nullptr, true);
|
IConsoleCmdRegister("dump_inflation", ConDumpInflation, nullptr, true);
|
||||||
|
IConsoleCmdRegister("dump_cpdp_stats", ConDumpCpdpStats, nullptr, true);
|
||||||
IConsoleCmdRegister("check_caches", ConCheckCaches, nullptr, true);
|
IConsoleCmdRegister("check_caches", ConCheckCaches, nullptr, true);
|
||||||
|
|
||||||
/* NewGRF development stuff */
|
/* NewGRF development stuff */
|
||||||
|
Reference in New Issue
Block a user