30 #include "table/strings.h"
201 #define DEF_CMD(proc, flags, type) {proc, #proc, (CommandFlags)flags, type}
369 return cmd <
lengthof(_command_proc_table) && _command_proc_table[cmd].
proc != NULL;
408 static const int command_type_lookup[] = {
426 static int _docommand_recursive = 0;
464 _docommand_recursive++;
467 if (_docommand_recursive == 1 || !(flags &
DC_EXEC) ) {
468 if (_docommand_recursive == 1) _cleared_object_areas.Clear();
470 res = proc(tile, flags & ~DC_EXEC, p1, p2, text);
476 if (_docommand_recursive == 1 &&
483 if (!(flags & DC_EXEC)) {
484 _docommand_recursive--;
491 if (_docommand_recursive == 1) _cleared_object_areas.Clear();
492 res = proc(tile, flags, p1, p2, text);
495 _docommand_recursive--;
500 if (--_docommand_recursive == 0 && !(flags &
DC_BANKRUPT)) {
572 #ifdef ENABLE_NETWORK
581 if (estimate_only || (
IsLocalCompany() && error_part1 != 0 && my_cmd)) {
584 }
else if (estimate_only) {
586 }
else if (!only_sending && res.
GetCost() != 0 && tile != 0 &&
IsLocalCompany() && _game_mode != GM_EDITOR) {
595 if (!estimate_only && !only_sending && callback != NULL) {
596 callback(res, tile, p1, p2);
608 #define return_dcpi(cmd) { _docommand_recursive = 0; return cmd; }
626 assert(_docommand_recursive == 0);
627 _docommand_recursive = 1;
630 _additional_cash_required = 0;
634 assert(cmd_id <
lengthof(_command_proc_table));
639 assert(proc != NULL);
646 #ifdef ENABLE_NETWORK
667 bool test_and_exec_can_differ = (cmd_flags &
CMD_NO_TEST) != 0;
670 _cleared_object_areas.Clear();
685 if (res.
Failed() || estimate_only ||
690 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,
GetCommandName(cmd));
696 #ifdef ENABLE_NETWORK
712 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,
GetCommandName(cmd));
716 _cleared_object_areas.Clear();
737 if (!test_and_exec_can_differ) {
739 }
else if (res2.
Failed()) {
745 if (_additional_cash_required != 0 && res2.
GetCost() == 0) {
802 for (uint i = 0; i < num_registers; i++) {