Skip to content

Commit

Permalink
<strong>Related to issues #203, #1523, fixed issue #1588</strong>:
Browse files Browse the repository at this point in the history
More Template magic: Added Nullable<T>::SetDefault to fix that tags always return the unit variables, no matter what were set at the country/global defaults. This also restores the branch's status from broken to untested fully, but working. No, status haven't changed, <strong>this still won't hit 0.2.</strong>

Reminder, the tags again:

 [TechnoType/Country]->Bounty.Modifier (float, defaults to 0)
 Multiplier of the enemy victim's Cost/Damage which should be granted as bounty.
 [TechnoType/Country]->Bounty.Message (bool, default's to no)
 If set to yes, the granted money will be written out above the unit.
 [TechnoType/Country]->Bounty.FriendlyModifier (float, defaults to 0)
 Multiplier of the friendly victim's Cost/Damage which should be taken as bounty.
 [TechnoType/Country]->Bounty.FriendlyMessage (bool, defaults to no)
 If set to yes, the taken money will be written out above the unit.
 [TechnoType/Country]->Bounty.Pillager (bool, defaults to no)
 If set to yes, the unit will grant money for the Damage it delivered and not when it destroys a unit.
 [TechnoType/Country]->Bounty.CostMultiplier (float, defaults to 1)
 Specifies the multiplier of the money from the victim's side when this unit was destroyed by a Bounty unit.
 [TechnoType/Country]->Bounty.PillageMultiplier (float, defaults to 1)
 Specifies the multiplier of the money from the victim's side when this unit gets attacked by a Pillager unit.

Country values are serves as defaults to all units of the country's, current global defaults are *Messages=yes, *Modifiers=0, *Multipliers=1, Pillager=no.

git-svn-id: svn://svn.renegadeprojects.com/ares/branches/ft-bounty@1147 859b54a9-7a54-0410-aeb3-f8d2f1fa40fd
  • Loading branch information
GraionDilach committed Aug 6, 2011
1 parent 84f5f4e commit b75770c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Ares.version.h
Expand Up @@ -3,7 +3,7 @@


#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 1 #define VERSION_MINOR 1
#define VERSION_REVISION 1085 #define VERSION_REVISION 1147


#define SAVEGAME_MAGIC ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION)) #define SAVEGAME_MAGIC ((VERSION_MAJOR << 24) | (VERSION_MINOR << 16) | (VERSION_REVISION))


Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Building/Hooks.Prism.cpp
Expand Up @@ -220,7 +220,7 @@ DEFINE_HOOK(44ABD0, BuildingClass_FireLaser, 5)
EBolt* supportEBolt; EBolt* supportEBolt;
GAME_ALLOC(EBolt, supportEBolt); GAME_ALLOC(EBolt, supportEBolt);
if (supportEBolt) { if (supportEBolt) {
supportEBolt->Owner = B; //supportEBolt->Owner = B;
supportEBolt->WeaponSlot = idxSupport; supportEBolt->WeaponSlot = idxSupport;
supportEBolt->AlternateColor = supportWeapon->IsAlternateColor; supportEBolt->AlternateColor = supportWeapon->IsAlternateColor;
WeaponTypeExt::BoltExt[supportEBolt] = WeaponTypeExt::ExtMap.Find(supportWeapon); WeaponTypeExt::BoltExt[supportEBolt] = WeaponTypeExt::ExtMap.Find(supportWeapon);
Expand Down
4 changes: 2 additions & 2 deletions src/Ext/Techno/Body.cpp
Expand Up @@ -358,10 +358,10 @@ bool TechnoExt::CreateWithDroppod(FootClass *Object, CoordStruct *XYZ) {
template<typename T> template<typename T>
T TechnoExt::ExtData::GetBountyValue(Nullable<T> BountyClass::*pMember) const { T TechnoExt::ExtData::GetBountyValue(Nullable<T> BountyClass::*pMember) const {
auto &myBountyVal = this->GetTypeExt()->Bounty.*pMember; auto &myBountyVal = this->GetTypeExt()->Bounty.*pMember;
if(myBountyVal.isset()) { if(!!myBountyVal.isset()) {
return myBountyVal.Get(); return myBountyVal.Get();
} }
auto pCountryData = HouseTypeExt::ExtMap.Find(this->AttachedToObject->GetOwningHouse()->Type); auto pCountryData = HouseTypeExt::ExtMap.Find(this->AttachedToObject->Owner->Type);
auto &countryBountyVal = pCountryData->Bounty.*pMember; auto &countryBountyVal = pCountryData->Bounty.*pMember;
return countryBountyVal.Get(); return countryBountyVal.Get();
}; };
Expand Down
17 changes: 9 additions & 8 deletions src/Misc/BountyClass.h
Expand Up @@ -17,15 +17,16 @@ class BountyClass {


BountyClass(bool Msg = false, bool FriendlyMsg = false, BountyClass(bool Msg = false, bool FriendlyMsg = false,
double Mod = 0, double FriendlyMod = 0, bool IsPillager = false, double Mod = 0, double FriendlyMod = 0, bool IsPillager = false,
double CostMult = 0, double PillageMult = 0): double CostMult = 0, double PillageMult = 0)
Message (Msg),
FriendlyMessage (FriendlyMsg),
Modifier (Mod),
FriendlyModifier (FriendlyMod),
Pillager (IsPillager),
CostMultiplier (CostMult),
PillageMultiplier (PillageMult)
{ {
Message.SetDefault(Msg);
FriendlyMessage.SetDefault(FriendlyMsg);
Modifier.SetDefault (Mod);
FriendlyModifier.SetDefault (FriendlyMod);
Pillager.SetDefault (IsPillager);
CostMultiplier.SetDefault (CostMult);
PillageMultiplier.SetDefault (PillageMult);
}; };


void Read(INI_EX *exINI, const char * section) { void Read(INI_EX *exINI, const char * section) {
Expand Down
5 changes: 5 additions & 0 deletions src/Utilities/Template.h
Expand Up @@ -151,6 +151,11 @@ class Nullable : public Valueable<T> {
this->HasValue = true; this->HasValue = true;
} }


virtual void SetDefault(T val) {
Valueable<T>::Set(val);
this->HasValue = false;
}

void Reset() { void Reset() {
Valueable<T>::Set(T()); Valueable<T>::Set(T());
this->HasValue = false; this->HasValue = false;
Expand Down

0 comments on commit b75770c

Please sign in to comment.