Skip to content
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

Fixes vanilla bug/inconsistency in harvester replacement logic #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions REDALERT/HOUSE.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -6417,9 +6417,14 @@ int HouseClass::AI_Unit(void)

/*
** A computer controlled house will try to build a replacement
** harvester if possible.
** harvester if possible. Never replace harvesters if the game
** is in easy mode.
** CFE Note: Vanilla bugfix - Difficulty was accidentally set check if != DIFF_HARD, when it was supposed to be != DIFF_EASY.
** Was correct in one place but not the other two spots (including this one) with the same harvester build logic.
** Jump to the others by searching the below phrase:
** CFE Harvester Build Fix
*/
if (IQ >= Rule.IQHarvester && !IsTiberiumShort && !IsHuman && BQuantity[STRUCT_REFINERY] > UQuantity[UNIT_HARVESTER] && Difficulty != DIFF_HARD) {
if (IQ >= Rule.IQHarvester && !IsTiberiumShort && !IsHuman && BQuantity[STRUCT_REFINERY] > UQuantity[UNIT_HARVESTER] && Difficulty != DIFF_EASY) {
if (UnitTypeClass::As_Reference(UNIT_HARVESTER).Level <= (unsigned)Control.TechLevel) {
BuildUnit = UNIT_HARVESTER;
return(TICKS_PER_SECOND);
Expand Down
16 changes: 12 additions & 4 deletions TIBERIANDAWN/HOUSE.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -3804,8 +3804,11 @@ TechnoTypeClass const * HouseClass::Suggest_New_Object(RTTIType objecttype) cons

/*
** A computer controlled house will try to build a replacement
** harvester if possible. Never replace harvesters if the game
** is in easy mode.
** harvester if possible. Never replace harvesters if the AI
** is set to easy mode.
** CFE Note: Vanilla bugfix - Difficulty is CORRECTLY set to check !DIFF_EASY here, but not in two other spots that also control the same harvester replacement logic.
** Jump to the others by searching the below phrase:
** CFE Harvester Build Fix
*/
if (!(GameToPlay == GAME_NORMAL && PlayerPtr->Difficulty == DIFF_EASY) && !IsHuman && (ActiveBScan & STRUCTF_REFINERY) && !(UScan & UNITF_HARVESTER)) {
techno = &UnitTypeClass::As_Reference(UNIT_HARVESTER);
Expand Down Expand Up @@ -6902,9 +6905,14 @@ int HouseClass::AI_Unit(void)

/*
** A computer controlled house will try to build a replacement
** harvester if possible.
** harvester if possible. Never replace harvesters if the AI
** is set to easy mode.
** CFE Note: Vanilla bugfix - Difficulty was accidentally set check if != DIFF_HARD, when it was supposed to be != DIFF_EASY.
** Was correct in one place but not the other two spots (including this one) with the same harvester build logic.
** Jump to the others by searching the below phrase:
** CFE Harvester Build Fix
*/
if (IQ >= Rule.IQHarvester && !IsTiberiumShort && !IsHuman && BQuantity[STRUCT_REFINERY] > UQuantity[UNIT_HARVESTER] && Difficulty != DIFF_HARD) {
if (IQ >= Rule.IQHarvester && !IsTiberiumShort && !IsHuman && BQuantity[STRUCT_REFINERY] > UQuantity[UNIT_HARVESTER] && Difficulty != DIFF_EASY) {
//if (UnitTypeClass::As_Reference(UNIT_HARVESTER).Level <= (unsigned)Control.TechLevel) {
if (UnitTypeClass::As_Reference(UNIT_HARVESTER).Level <= (unsigned)BuildLevel) {
BuildUnit = UNIT_HARVESTER;
Expand Down