void BuildBridge(uint8 i) { switch ((TransportType)(this->type >> 15)) { case TRANSPORT_RAIL: _last_railbridge_type = this->bridges->Get(i)->index; break; case TRANSPORT_ROAD: _last_roadbridge_type = this->bridges->Get(i)->index; break; default: break; } // Alberth: It's hacky, but it ensures your bits are preserved (shifting 17 times in a value with width 8 is undefined behavior) uint32 w = _bridge_cur_road_subtype; w <<= 17; DoCommandP(this->end_tile, this->start_tile, this->type | this->bridges->Get(i)->index | w, CMD_BUILD_BRIDGE | CMD_MSG(STR_ERROR_CAN_T_BUILD_BRIDGE_HERE), CcBuildBridge); }