-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vehicle Functions: Update daily #2182
base: master
Are you sure you want to change the base?
Conversation
184202f
to
a7859fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments with respect to code style aside, have you run any replay tests for this yet?
What's still needed for this PR? |
void removeEntityFromThought(AiThought& thought, EntityId id) | ||
{ | ||
auto iter = std::find(std::begin(thought.var_66), std::end(thought.var_66), id); | ||
if (iter == std::end(thought.var_66)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we name var_66
?
// Original would copy the value from var_66 + 2 which | ||
// would mean it would copy currency var_76 if var_44 was 7 | ||
// I don't think that is possible but lets just add an assert. | ||
assert(thought.var_44 < 7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly can we name var_44
?
crashedTimeout = Math::Bound::add(crashedTimeout, 1U); | ||
if (!CompanyManager::isPlayerCompany(owner)) | ||
{ | ||
if (crashedTimeout > 14 && var_60 != 0xFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a constant for the 14
, and can we rename var_60
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple minor code changes requested. Branch also has merge conflicts
a7859fc
to
f8b6f7f
Compare
There is some sort of divergence in this. I've narrowed it down to the loop at L312 or the minReliabilityCount but i can't tell what ive done wrong. I didn't implement it exactly as per the assembly as it looked like there were some easy simplifications. |
13896fe
to
d0fd9e6
Compare
@@ -312,7 +312,7 @@ namespace OpenLoco::Vehicles | |||
reliabilityFactor /= 16; | |||
|
|||
auto& prng = gPrng1(); | |||
int32_t randVal = (prng.randNext(65535) * reliabilityFactor / 2) / 65536; | |||
int32_t randVal = (prng.randNext(65535) * (reliabilityFactor / 2)) / 65536; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fix causes replays to diverge as its used by create vehicle as well but i checked and it is how it is meant to work so will record new masters.
There is some horrible branches in this code. I can't see an easy way to rework it to not be as horrible whilst still matching vanilla logic.