-
Notifications
You must be signed in to change notification settings - Fork 72
[GEN][ZH] Initialize supplyTruck variable #820
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1041,13 +1041,8 @@ Bool AIPlayer::isLocationSafe(const Coord3D *pos, const ThingTemplate *tthing ) | |
void AIPlayer::onUnitProduced( Object *factory, Object *unit ) | ||
{ | ||
Bool found = false; | ||
// TheSuperHackers @fix Mauller 26/04/2025 Fixes uninitialized variable. | ||
// To keep retail compatibility this needs to remain uninitialized in VS6 builds. | ||
#if defined(_MSC_VER) && _MSC_VER < 1300 | ||
Bool supplyTruck; | ||
#else | ||
Bool supplyTruck = false; | ||
#endif | ||
// TheSuperHackers @fix helmutbuhler 05/05/2025 Fixes uninitialized variable. | ||
Bool supplyTruck = true; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the subsequent code that the uninitialised variable was hitting, the correct initialisation value should be false. If we think it is better to initialise this to true then set the VC6 specific variable to initialise to true, this way we maintain the correct behaviour when removing VC6 support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we figure out what user facing behaviour is changing when it is set to false? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's code specific to construction vehicles that aren't also supplytrucks. if (!supplyTruck && unit->isKindOf(KINDOF_DOZER)) {
if (m_dozerQueuedForRepair) {
m_repairDozer = unit->getID();
m_dozerQueuedForRepair =false;
} else {
m_buildDelay = 0;
m_structureTimer = 1;
}
} Essentially dozers will always be treated as though they are also supply trucks and not have variables relevant to them being set properly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I just changed it as requested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can you please figure out what changes user facing? Does it fix a bug? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we verify this observation with AI match? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to spot it if we play against a large map with all other slots filled with AI. In theory the playback should show:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Based on my earlier logging, the delay would be between 0 and 60. I presume those are frames, so up to roughly two second delay for building anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 seconds is not much :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can create an AI to test this but I'm not exactly sure what conditions should be generated.
xezon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// factory could be NULL at the start of the game. | ||
if (factory == NULL) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.