equal
deleted
inserted
replaced
843 |
843 |
844 if ((_m[tile].m5 & 0xFC) == 0x00) { |
844 if ((_m[tile].m5 & 0xFC) == 0x00) { |
845 // railway tunnel |
845 // railway tunnel |
846 if (!CheckTileOwnership(tile)) return CMD_ERROR; |
846 if (!CheckTileOwnership(tile)) return CMD_ERROR; |
847 |
847 |
848 if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR; |
848 if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR; |
849 |
849 |
850 endtile = CheckTunnelBusy(tile, &length); |
850 endtile = CheckTunnelBusy(tile, &length); |
851 if (endtile == INVALID_TILE) return CMD_ERROR; |
851 if (endtile == INVALID_TILE) return CMD_ERROR; |
852 |
852 |
853 if (exec) { |
853 if (exec) { |
862 // only check for train under bridge |
862 // only check for train under bridge |
863 if (!CheckTileOwnership(tile) || !EnsureNoVehicleZ(tile, TilePixelHeight(tile))) |
863 if (!CheckTileOwnership(tile) || !EnsureNoVehicleZ(tile, TilePixelHeight(tile))) |
864 return CMD_ERROR; |
864 return CMD_ERROR; |
865 |
865 |
866 // tile is already of requested type? |
866 // tile is already of requested type? |
867 if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR; |
867 if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR; |
868 // change type. |
868 // change type. |
869 if (exec) { |
869 if (exec) { |
870 _m[tile].m3 = (_m[tile].m3 & 0xF0) + totype; |
870 _m[tile].m3 = (_m[tile].m3 & 0xF0) + totype; |
871 MarkTileDirtyByTile(tile); |
871 MarkTileDirtyByTile(tile); |
872 } |
872 } |
891 if (!EnsureNoVehicle(starttile) || !EnsureNoVehicle(endtile)) { |
891 if (!EnsureNoVehicle(starttile) || !EnsureNoVehicle(endtile)) { |
892 _error_message = STR_8803_TRAIN_IN_THE_WAY; |
892 _error_message = STR_8803_TRAIN_IN_THE_WAY; |
893 return CMD_ERROR; |
893 return CMD_ERROR; |
894 } |
894 } |
895 |
895 |
896 if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR; |
896 if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR; |
897 cost = 0; |
897 cost = 0; |
898 do { |
898 do { |
899 if (exec) { |
899 if (exec) { |
900 if (tile == starttile || tile == endtile) { |
900 if (tile == starttile || tile == endtile) { |
901 _m[tile].m3 = (_m[tile].m3 & 0xF0) + totype; |
901 _m[tile].m3 = (_m[tile].m3 & 0xF0) + totype; |