Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gameengine): send only the computer's units for salvage
Olcay Seyganbe1270f5aec2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e26d00ca2..540a16d4b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -527,7 +527,8 @@ A third pass went through the generals' powers, promotions and unit abilities.## One crate, one collector-- Salvage gets collected. A wreck leaves money and a free upgrade lying on the ground, and the game asked you to spot it in the middle of the fight that made it, work out which of your units was allowed to take it, and drive that one over it by hand. Nobody does that, so most salvage on most maps timed out where it fell. Whoever is standing nearest with nothing to do goes and gets it now: a unit that can still be upgraded off it goes first, however far back it is standing, and failing that the nearest idle unit takes the cash. Dozers and harvesters are left to the job they are already earning at.+- Salvage gets collected. A wreck leaves money and a free upgrade lying on the ground, and the game asked you to spot it in the middle of the fight that made it, work out which of your units was allowed to take it, and drive that one over it by hand. Nobody does that, so most salvage on most maps timed out where it fell. The computer's units go and get it now: a unit that can still be upgraded off it goes first, however far back it is standing, and failing that the nearest one takes the cash. Dozers and harvesters are left to the job they are already earning at.+- Your units stay where you put them. The first version of salvage collection sent yours too, and a squad you had parked walked off to a wreck you never told it about. Only the computer's units go for salvage by themselves now; yours take a crate when you drive them over it.- And the collector comes back. A line dug in across a road is idle, every man of it, so the first version of this walked the line out to the wrecks in front and left it standing there - the position lost to the crates it had just earned. A unit sent for a crate now walks back to the spot it left. Nobody with an enemy in sight goes at all, and nothing is called further than a few seconds away. Anything that dies when it fires stays where it is: a Terrorist is worth more than every crate on the map.- The computer collects salvage too. That pass only ever looked at idle units, and a computer opponent never has one: it keeps every team on an order from the moment the team exists. So a crate could lie there for half a minute with three of its own rebels beside it and then time out, and every wreck on the field was money that only you could pick up. A unit that is busy is told about the crate now rather than ordered to it, and it takes the detour between one thing and the next before going back to what it was doing - the same way a unit walks over the wreck of something it just killed.- Salvage waits. A crate used to disappear thirty seconds after it fell, which on most maps was before anyone could get to it: four crates from one fight, all four still lying untouched when the clock took them. They stay on the ground now until something drives over one.diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cppindex deb2d7ffd..5aff49d01 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp@@ -4215,6 +4215,9 @@ static Bool hasEnemyInSight( Object *obj )off it wins over one that cannot, however far back it is standing, because the upgrade is worthmore than the walk; failing that the nearest unit takes the cash.+ Only a computer player's units are sent. A human's units stay where the human put them and+ pick salvage up when the human drives them over it.+How it is sent depends on what it was doing. An idle unit is ordered to the crate and then walksback to the spot it left - idle is not the same as free, which is what the first version of thisgot wrong. A line of infantry dug in across a road is idle, every one of them, and a fight in@@ -4276,6 +4279,9 @@ static void salvageCrateTick( void )const Player *owner = them->getControllingPlayer();if( owner == NULL || crate->getShroudedStatus( owner->getPlayerIndex() ) >= OBJECTSHROUD_FOGGED )continue;+ // a human's units go where the human sends them; only the computer's are sent for salvage+ if( owner->getPlayerType() != PLAYER_COMPUTER )+ continue;const Bool upgrades = wantsSalvageUpgrade( them );if( collector == NULL || ( upgrades && !collectorUpgrades ) )