|
|
|
@ -525,6 +525,7 @@ enum CommandLogEntryFlag : uint16 {
|
|
|
|
|
CLEF_BINARY = 0x40, ///< binary_length is > 0
|
|
|
|
|
CLEF_SCRIPT = 0x80, ///< command run by AI/game script
|
|
|
|
|
CLEF_TWICE = 0x100, ///< command logged twice (only sending and execution)
|
|
|
|
|
CLEF_RANDOM = 0x200, ///< command changed random seed
|
|
|
|
|
};
|
|
|
|
|
DECLARE_ENUM_AS_BIT_SET(CommandLogEntryFlag)
|
|
|
|
|
|
|
|
|
@ -587,8 +588,8 @@ static void DumpSubCommandLog(char *&buffer, const char *last, const CommandLog
|
|
|
|
|
YearMonthDay ymd;
|
|
|
|
|
ConvertDateToYMD(entry.date, &ymd);
|
|
|
|
|
buffer += seprintf(buffer, last, " %3u | %4i-%02i-%02i, %2i, %3i | ", i, ymd.year, ymd.month + 1, ymd.day, entry.date_fract, entry.tick_skip_counter);
|
|
|
|
|
buffer += seprintf(buffer, last, "%c%c%c%c%c%c%c%c%c | ",
|
|
|
|
|
fc(CLEF_TWICE, '2'), fc(CLEF_SCRIPT, 'a'), fc(CLEF_BINARY, 'b'), fc(CLEF_MY_CMD, 'm'), fc(CLEF_ONLY_SENDING, 's'),
|
|
|
|
|
buffer += seprintf(buffer, last, "%c%c%c%c%c%c%c%c%c%c | ",
|
|
|
|
|
fc(CLEF_RANDOM, 'r'), fc(CLEF_TWICE, '2'), fc(CLEF_SCRIPT, 'a'), fc(CLEF_BINARY, 'b'), fc(CLEF_MY_CMD, 'm'), fc(CLEF_ONLY_SENDING, 's'),
|
|
|
|
|
fc(CLEF_ESTIMATE_ONLY, 'e'), fc(CLEF_TEXT, 't'), fc(CLEF_GENERATING_WORLD, 'g'), fc(CLEF_CMD_FAILED, 'f'));
|
|
|
|
|
buffer += seprintf(buffer, last, " %7d x %7d, p1: 0x%08X, p2: 0x%08X, ",
|
|
|
|
|
TileX(entry.tile), TileY(entry.tile), entry.p1, entry.p2);
|
|
|
|
@ -858,6 +859,8 @@ bool DoCommandPEx(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, C
|
|
|
|
|
/* Only set p2 when the command does not come from the network. */
|
|
|
|
|
if (!(cmd & CMD_NETWORK_COMMAND) && GetCommandFlags(cmd) & CMD_CLIENT_ID && p2 == 0) p2 = CLIENT_ID_SERVER;
|
|
|
|
|
|
|
|
|
|
GameRandomSeedChecker random_state;
|
|
|
|
|
|
|
|
|
|
CommandCost res = DoCommandPInternal(tile, p1, p2, p3, cmd, callback, text, my_cmd, estimate_only, binary_length);
|
|
|
|
|
|
|
|
|
|
CommandLogEntryFlag log_flags;
|
|
|
|
@ -867,6 +870,7 @@ bool DoCommandPEx(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, C
|
|
|
|
|
if (only_sending) log_flags |= CLEF_ONLY_SENDING;
|
|
|
|
|
if (my_cmd) log_flags |= CLEF_MY_CMD;
|
|
|
|
|
if (binary_length > 0) log_flags |= CLEF_BINARY;
|
|
|
|
|
if (!random_state.Check()) log_flags |= CLEF_RANDOM;
|
|
|
|
|
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags);
|
|
|
|
|
|
|
|
|
|
if (res.Failed()) {
|
|
|
|
@ -895,6 +899,8 @@ bool DoCommandPEx(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, C
|
|
|
|
|
|
|
|
|
|
CommandCost DoCommandPScript(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, bool estimate_only, uint32 binary_length)
|
|
|
|
|
{
|
|
|
|
|
GameRandomSeedChecker random_state;
|
|
|
|
|
|
|
|
|
|
CommandCost res = DoCommandPInternal(tile, p1, p2, p3, cmd, callback, text, my_cmd, estimate_only, binary_length);
|
|
|
|
|
|
|
|
|
|
CommandLogEntryFlag log_flags;
|
|
|
|
@ -904,6 +910,7 @@ CommandCost DoCommandPScript(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, ui
|
|
|
|
|
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) log_flags |= CLEF_ONLY_SENDING;
|
|
|
|
|
if (my_cmd) log_flags |= CLEF_MY_CMD;
|
|
|
|
|
if (binary_length > 0) log_flags |= CLEF_BINARY;
|
|
|
|
|
if (!random_state.Check()) log_flags |= CLEF_RANDOM;
|
|
|
|
|
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags);
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|