Fix compilation errors
This commit is contained in:
@@ -69,7 +69,7 @@ void ExecuteFakeCommands(TimerGameTick::TickCounter counter) {
|
||||
|
||||
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
|
||||
if (cs->status >= NetworkClientSocket::STATUS_MAP) {
|
||||
cs->outgoing_queue.Append(&x.cp);
|
||||
cs->outgoing_queue.push_back(x.cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,16 +103,16 @@ void ExecuteCurrentCallback(const CommandCost &cost) {
|
||||
}
|
||||
}
|
||||
|
||||
void BeforeNetworkCommandExecution(const CommandPacket* cp) {
|
||||
if (!cp->my_cmd) return;
|
||||
size_t hash = GetCommandHash(cp->cmd, cp->company, cp->err_msg, cp->callback, cp->data);
|
||||
Debug(misc, 5, "CM BeforeNetworkCommandExecution: cmd={} hash={}", cp->cmd, hash);
|
||||
void BeforeNetworkCommandExecution(const CommandPacket &cp) {
|
||||
if (!cp.my_cmd) return;
|
||||
size_t hash = GetCommandHash(cp.cmd, cp.company, cp.err_msg, cp.callback, cp.data);
|
||||
Debug(misc, 5, "CM BeforeNetworkCommandExecution: cmd={} hash={}", cp.cmd, hash);
|
||||
while (!_callback_queue.empty() && _callback_queue.front().hash != hash) {
|
||||
Debug(misc, 0, "CM Dismissing command from callback queue: hash={}", _callback_queue.front().hash);
|
||||
_callback_queue.pop();
|
||||
}
|
||||
if (_callback_queue.empty()) {
|
||||
Debug(misc, 0, "CM Received unexpected network command: cmd={}", cp->cmd);
|
||||
Debug(misc, 0, "CM Received unexpected network command: cmd={}", cp.cmd);
|
||||
return;
|
||||
}
|
||||
auto &cbdata = _callback_queue.front();
|
||||
@@ -122,8 +122,8 @@ void BeforeNetworkCommandExecution(const CommandPacket* cp) {
|
||||
return;
|
||||
}
|
||||
|
||||
void AfterNetworkCommandExecution(const CommandPacket* cp) {
|
||||
Debug(misc, 5, "AfterNetworkCommandExecution {}", cp->cmd);
|
||||
void AfterNetworkCommandExecution(const CommandPacket &cp) {
|
||||
Debug(misc, 5, "AfterNetworkCommandExecution {}", cp.cmd);
|
||||
_current_callback = nullptr;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ uint GetCurrentQueueDelay() {
|
||||
|
||||
void FlushCommandQueue() {
|
||||
while (!_outgoing_queue.empty() && CanSendCommand()) {
|
||||
MyClient::SendCommand(&_outgoing_queue.front());
|
||||
MyClient::SendCommand(_outgoing_queue.front());
|
||||
_outgoing_queue.pop();
|
||||
_commands_this_frame++;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void HandleNextClientFrame() {
|
||||
void SendClientCommand(const CommandPacket *cp) {
|
||||
AddCommandCallback(cp);
|
||||
if (_outgoing_queue.empty() && CanSendCommand()) {
|
||||
MyClient::SendCommand(cp);
|
||||
MyClient::SendCommand(*cp);
|
||||
_commands_this_frame++;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace citymania {
|
||||
// void HandleCommandExecution(bool res, TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, const std::string &text);
|
||||
void AddCommandCallback(const CommandPacket *cp);
|
||||
// void ExecuteCurrentCallback(const CommandCost &cost);
|
||||
void BeforeNetworkCommandExecution(const CommandPacket* cp);
|
||||
void AfterNetworkCommandExecution(const CommandPacket* cp);
|
||||
void BeforeNetworkCommandExecution(const CommandPacket &cp);
|
||||
void AfterNetworkCommandExecution(const CommandPacket &cp);
|
||||
|
||||
void InitCommandQueue();
|
||||
void HandleNextClientFrame();
|
||||
|
||||
@@ -569,8 +569,18 @@ static void AddProducedCargo_Town(TileIndex tile, CargoArray &produced)
|
||||
produced[cargo] += GetMonthlyFrom256Tick((uint)GB(callback, 0, 8)) ;
|
||||
}
|
||||
} else {
|
||||
produced[CT_PASSENGERS] += GetAverageHouseProduction(hs->population);
|
||||
produced[CT_MAIL] += GetAverageHouseProduction(hs->mail_generation);
|
||||
if (hs->population > 0) {
|
||||
auto avg = GetAverageHouseProduction(hs->population);
|
||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[TPE_PASSENGERS]) {
|
||||
produced[cs->Index()] += avg;
|
||||
}
|
||||
}
|
||||
if (hs->mail_generation > 0) {
|
||||
auto avg = GetAverageHouseProduction(hs->mail_generation);
|
||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[TPE_MAIL]) {
|
||||
produced[cs->Index()] += avg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,8 +612,12 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
|
||||
break;
|
||||
case MP_OBJECT:
|
||||
if (IsObjectType(tile, OBJECT_HQ)) {
|
||||
produced[CT_PASSENGERS] += GetMonthlyFrom256Tick(HQ_AVG_POP[EconomyIsInRecession() ? 1 : 0][GetAnimationFrame(tile)]);
|
||||
produced[CT_MAIL] += GetMonthlyFrom256Tick(HQ_AVG_MAIL[EconomyIsInRecession() ? 1 : 0][GetAnimationFrame(tile)]);
|
||||
auto pax_avg = GetMonthlyFrom256Tick(HQ_AVG_POP[EconomyIsInRecession() ? 1 : 0][GetAnimationFrame(tile)]);
|
||||
auto mail_avg = GetMonthlyFrom256Tick(HQ_AVG_MAIL[EconomyIsInRecession() ? 1 : 0][GetAnimationFrame(tile)]);
|
||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[TPE_PASSENGERS])
|
||||
produced[cs->Index()] += pax_avg;
|
||||
for (const CargoSpec *cs : CargoSpec::town_production_cargoes[TPE_MAIL])
|
||||
produced[cs->Index()] += mail_avg;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace citymania {
|
||||
size_t cb_index = FindCallbackIndex(cp->callback);
|
||||
assert(cb_index < _callback_tuple_size);
|
||||
assert(_cmd_dispatch[cp->cmd].Unpack[cb_index] != nullptr);
|
||||
_cmd_dispatch[cp->cmd].Unpack[cb_index](cp);
|
||||
_cmd_dispatch[cp->cmd].Unpack[cb_index](*cp);
|
||||
return _command_execute_cost;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user