Skip to content

Commit

Permalink
Give experience when squishing a scavenger
Browse files Browse the repository at this point in the history
Adds experience for the critical micro needed to run one over.
  • Loading branch information
KJeff01 committed Aug 23, 2024
1 parent 22fa943 commit 736fae8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ int getTopExperience(int player)
}
return recycled_experience[player].top();
}

void cancelBuild(DROID *psDroid)
{
if (psDroid->order.type == DORDER_NONE || psDroid->order.type == DORDER_PATROL || psDroid->order.type == DORDER_HOLD || psDroid->order.type == DORDER_SCOUT || psDroid->order.type == DORDER_GUARD)
Expand Down Expand Up @@ -2413,6 +2414,17 @@ void droidIncreaseExperience(DROID *psDroid, uint32_t experienceInc)
}
}

// Possibly increase experience when squishing a scavenger.
void giveExperienceForSquish(DROID *psDroid)
{
if (psDroid->droidType == DROID_WEAPON || psDroid->droidType == DROID_SENSOR || psDroid->droidType == DROID_COMMAND)
{
const uint32_t expGain = std::max(65536 / 2, 65536 * getExpGain(psDroid->player) / 100);
droidIncreaseExperience(psDroid, expGain);
cmdDroidUpdateExperience(psDroid, expGain);
}
}

// Get the name of a droid from it's DROID structure.
//
const char *droidGetName(const DROID *psDroid)
Expand Down
1 change: 1 addition & 0 deletions src/droid.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ UDWORD getDroidEffectiveLevel(const DROID *psDroid);
const char *getDroidLevelName(const DROID *psDroid);
// Increase the experience of a droid (and handle events, if needed).
void droidIncreaseExperience(DROID *psDroid, uint32_t experienceInc);
void giveExperienceForSquish(DROID *psDroid);

// Get a droid's name.
const char *droidGetName(const DROID *psDroid);
Expand Down
1 change: 1 addition & 0 deletions src/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ static void moveCheckSquished(DROID *psDroid, int32_t emx, int32_t emy)
// run over a bloke - kill him
destroyDroid((DROID *)psObj, gameTime);
scoreUpdateVar(WD_BARBARIANS_MOWED_DOWN);
giveExperienceForSquish(psDroid);
}
}
}
Expand Down

0 comments on commit 736fae8

Please sign in to comment.