Skip to content

Commit

Permalink
Always use latest armour upgrade value for already built droids.
Browse files Browse the repository at this point in the history
This makes armour behave the same way for droids as for structures
and features, and in line with every other upgrade.
  • Loading branch information
perim committed Dec 29, 2015
1 parent d1f9747 commit 01510e4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion src/combat.cpp
Expand Up @@ -345,7 +345,7 @@ int objArmour(BASE_OBJECT *psObj, WEAPON_CLASS weaponClass)
int armour = 0;
if (psObj->type == OBJ_DROID)
{
armour = ((DROID *)psObj)->armour[weaponClass];
armour = bodyArmour(asBodyStats + ((DROID *)psObj)->asBits[COMP_BODY], psObj->player, weaponClass);
}
else if (psObj->type == OBJ_STRUCTURE && weaponClass == WC_KINETIC && ((STRUCTURE *)psObj)->status != SS_BEING_BUILT)
{
Expand Down
6 changes: 0 additions & 6 deletions src/droid.cpp
Expand Up @@ -1796,7 +1796,6 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, Position pos, UDWORD player,
{
DROID *psDroid;
DROID_GROUP *psGrp;
UDWORD inc;
SDWORD i, experienceLoc;

// Don't use this assertion in single player, since droids can finish building while on an away mission
Expand Down Expand Up @@ -1868,11 +1867,6 @@ DROID *reallyBuildDroid(DROID_TEMPLATE *pTemplate, Position pos, UDWORD player,
ASSERT(psDroid->body > 0, "Invalid number of hitpoints");
psDroid->originalBody = psDroid->body;

for (inc = 0; inc < WC_NUM_WEAPON_CLASSES; inc++)
{
psDroid->armour[inc] = bodyArmour(asBodyStats + pTemplate->asParts[COMP_BODY], player, (WEAPON_CLASS)inc);
}

/* Set droid's initial illumination */
psDroid->sDisplay.imd = BODY_IMD(psDroid, psDroid->player);

Expand Down
1 change: 0 additions & 1 deletion src/droiddef.h
Expand Up @@ -104,7 +104,6 @@ struct DROID : public BASE_OBJECT
uint32_t experience;
UDWORD lastFrustratedTime; ///< Set when eg being stuck; used for eg firing indiscriminately at map features to clear the way
SWORD resistance; ///< used in Electronic Warfare
UDWORD armour[WC_NUM_WEAPON_CLASSES];
UDWORD numWeaps; ///< Watermelon:Re-enabled this,I need this one in droid.c
WEAPON asWeaps[DROID_MAXWEAPS];
// The group the droid belongs to
Expand Down

0 comments on commit 01510e4

Please sign in to comment.