Skip to content

Commit

Permalink
fix experience
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnTW committed Nov 9, 2024
1 parent 5a9316c commit 9cd8807
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 12 additions & 3 deletions M2TWEOP Code/M2TWEOP library/types/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ void unit::setArmour(const uint8_t armour)
GAME_FUNC(void(__thiscall*)(unit*, uint8_t), setUnitArmorFunc)(this, arm);
}

void unit::setExperience(const uint8_t exp)
{
expScreen = exp;
for (int i = 0; i < SoldierCountStrat; i++)
{
soldiersArr[i].experience = exp;
}
}

void unit::setWeapon(uint8_t wpn)
{
const auto weapon = wpn;
Expand Down Expand Up @@ -492,7 +501,7 @@ namespace unitActions
mov eax, funcAddr
call eax
}
unit->unitPositionData->hasTargets = 1;
unit->unitPositionData->hasTargets = true;
}

/////////////////////////////////////// GROUP COMMANDS ////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -838,7 +847,7 @@ namespace unitHelpers
{
un->setArmour(arm);
un->setWeapon(weapon);
un->expScreen = exp;
un->setExperience(exp);
}
return un;
}
Expand Down Expand Up @@ -917,7 +926,7 @@ namespace unitHelpers

void setSoldiersCountAndExp(unit* un, int count, int exp)
{
un->expScreen = exp;
un->setExperience(exp);
setSoldiersCount(un, count);
}

Expand Down
5 changes: 3 additions & 2 deletions M2TWEOP Code/M2TWEOP library/types/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1803,9 +1803,9 @@ struct unit
{
return expScreen;
}
void setExp(int exp)
void setExp(const int exp)
{
expScreen = exp;
setExperience(exp);
}
int getArmourLevel()
{
Expand All @@ -1816,6 +1816,7 @@ struct unit
return avgWeaponUpg;
}
void setArmour(uint8_t armour);
void setExperience(uint8_t exp);
void setWeapon(uint8_t wpn);
void setarmourLVL(int lvl)
{
Expand Down

0 comments on commit 9cd8807

Please sign in to comment.