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

Give experience when squishing a scavenger #4046

Merged
merged 1 commit into from
Aug 23, 2024
Merged
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
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
Loading