mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-20 04:59:11 +00:00
Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -195,7 +195,7 @@ bool Order::Equals(const Order &other) const
|
||||
* @return the packed representation.
|
||||
* @note unpacking is done in the constructor.
|
||||
*/
|
||||
uint32 Order::Pack() const
|
||||
uint32_t Order::Pack() const
|
||||
{
|
||||
return this->dest << 16 | this->flags << 8 | this->type;
|
||||
}
|
||||
@@ -205,9 +205,9 @@ uint32 Order::Pack() const
|
||||
* representation as possible.
|
||||
* @return the TTD-like packed representation.
|
||||
*/
|
||||
uint16 Order::MapOldOrder() const
|
||||
uint16_t Order::MapOldOrder() const
|
||||
{
|
||||
uint16 order = this->GetType();
|
||||
uint16_t order = this->GetType();
|
||||
switch (this->type) {
|
||||
case OT_GOTO_STATION:
|
||||
if (this->GetUnloadType() & OUFB_UNLOAD) SetBit(order, 5);
|
||||
@@ -231,7 +231,7 @@ uint16 Order::MapOldOrder() const
|
||||
* Create an order based on a packed representation of that order.
|
||||
* @param packed the packed representation.
|
||||
*/
|
||||
Order::Order(uint32 packed)
|
||||
Order::Order(uint32_t packed)
|
||||
{
|
||||
this->type = (OrderType)GB(packed, 0, 8);
|
||||
this->flags = GB(packed, 8, 8);
|
||||
@@ -952,7 +952,7 @@ void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
|
||||
/* We are inserting an order just before the current implicit order.
|
||||
* We do not know whether we will reach current implicit or the newly inserted order first.
|
||||
* So, disable creation of implicit orders until we are on track again. */
|
||||
uint16 &gv_flags = u->GetGroundVehicleFlags();
|
||||
uint16_t &gv_flags = u->GetGroundVehicleFlags();
|
||||
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
|
||||
}
|
||||
if (sel_ord <= u->cur_implicit_order_index) {
|
||||
@@ -1237,7 +1237,7 @@ CommandCost CmdMoveOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID movi
|
||||
* @param data the data to modify
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdModifyOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID sel_ord, ModifyOrderFlags mof, uint16 data)
|
||||
CommandCost CmdModifyOrder(DoCommandFlag flags, VehicleID veh, VehicleOrderID sel_ord, ModifyOrderFlags mof, uint16_t data)
|
||||
{
|
||||
if (mof >= MOF_END) return CMD_ERROR;
|
||||
|
||||
@@ -1874,7 +1874,7 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic
|
||||
* @param interval proposed service interval
|
||||
* @return Clamped service interval
|
||||
*/
|
||||
uint16 GetServiceIntervalClamped(uint interval, bool ispercent)
|
||||
uint16_t GetServiceIntervalClamped(uint interval, bool ispercent)
|
||||
{
|
||||
return ispercent ? Clamp(interval, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(interval, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
||||
}
|
||||
@@ -1934,7 +1934,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
|
||||
|
||||
bool skip_order = false;
|
||||
OrderConditionComparator occ = order->GetConditionComparator();
|
||||
uint16 value = order->GetConditionValue();
|
||||
uint16_t value = order->GetConditionValue();
|
||||
|
||||
switch (order->GetConditionVariable()) {
|
||||
case OCV_LOAD_PERCENTAGE: skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, nullptr), value); break;
|
||||
@@ -2041,7 +2041,7 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth, bool
|
||||
/* Disable creation of implicit orders.
|
||||
* When inserting them we do not know that we would have to make the conditional orders point to them. */
|
||||
if (v->IsGroundVehicle()) {
|
||||
uint16 &gv_flags = v->GetGroundVehicleFlags();
|
||||
uint16_t &gv_flags = v->GetGroundVehicleFlags();
|
||||
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user