Tracerestrict: Fix non-deterministic use of _sorted_cargo_specs
This commit is contained in:
@@ -53,6 +53,13 @@ uint8 FindFirstBit(uint32 x)
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8 FindFirstBit64(uint64 x)
|
||||||
|
{
|
||||||
|
if (x == 0) return 0;
|
||||||
|
if ((x & 0x00000000ffffffffULL) != 0) return FindFirstBit(x);
|
||||||
|
return FindFirstBit(x >> 32) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search the last set bit in a 64 bit variable.
|
* Search the last set bit in a 64 bit variable.
|
||||||
*
|
*
|
||||||
|
@@ -630,8 +630,8 @@ void SetTraceRestrictValueDefault(TraceRestrictItem &item, TraceRestrictValueTyp
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TRVT_CARGO_ID:
|
case TRVT_CARGO_ID:
|
||||||
assert(_sorted_standard_cargo_specs_size > 0);
|
assert(_standard_cargo_mask != 0);
|
||||||
SetTraceRestrictValue(item, _sorted_cargo_specs[0]->Index());
|
SetTraceRestrictValue(item, FindFirstBit64(_standard_cargo_mask));
|
||||||
SetTraceRestrictAuxField(item, 0);
|
SetTraceRestrictAuxField(item, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user