Allow CmdCompanyCtrl while replaying the command log
This commit is contained in:
@@ -283,6 +283,11 @@ void LoadCommands(const std::string &filename) {
|
|||||||
_replay_started = false;
|
_replay_started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsReplayingCommands() {
|
||||||
|
return !_fake_commands.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ConLoadCommands(byte argc, char *argv[]) {
|
bool ConLoadCommands(byte argc, char *argv[]) {
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
IConsoleHelp("Loads a file with command queue to execute");
|
IConsoleHelp("Loads a file with command queue to execute");
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ void SkipFakeCommands(Date date, DateFract date_fract);
|
|||||||
void SetReplaySaveInterval(uint32 interval);
|
void SetReplaySaveInterval(uint32 interval);
|
||||||
void LoadCommands(const std::string &filename);
|
void LoadCommands(const std::string &filename);
|
||||||
void CheckIntervalSave();
|
void CheckIntervalSave();
|
||||||
|
bool IsReplayingCommands();
|
||||||
|
|
||||||
bool ConGameSpeed(byte argc, char *argv[]);
|
bool ConGameSpeed(byte argc, char *argv[]);
|
||||||
bool ConStep(byte argc, char *argv[]);
|
bool ConStep(byte argc, char *argv[]);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "cargo_type.h"
|
#include "cargo_type.h"
|
||||||
|
|
||||||
#include "citymania/cm_hotkeys.hpp"
|
#include "citymania/cm_hotkeys.hpp"
|
||||||
|
#include "citymania/cm_console_cmds.hpp"
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
@@ -824,7 +825,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
|||||||
switch ((CompanyCtrlAction)GB(p1, 0, 16)) {
|
switch ((CompanyCtrlAction)GB(p1, 0, 16)) {
|
||||||
case CCA_NEW: { // Create a new company
|
case CCA_NEW: { // Create a new company
|
||||||
/* This command is only executed in a multiplayer game */
|
/* This command is only executed in a multiplayer game */
|
||||||
if (!_networking) return CMD_ERROR;
|
if (!_networking && !citymania::IsReplayingCommands()) return CMD_ERROR;
|
||||||
|
|
||||||
/* Has the network client a correct ClientIndex? */
|
/* Has the network client a correct ClientIndex? */
|
||||||
if (!(flags & DC_EXEC)) return CommandCost();
|
if (!(flags & DC_EXEC)) return CommandCost();
|
||||||
|
|||||||
Reference in New Issue
Block a user