1 #include "Effect.h"
2
3 #include "UniverseObject.h"
4 #include "ObjectMap.h"
5 #include "Enums.h"
6
EffectCause()7 Effect::EffectCause::EffectCause() :
8 cause_type(INVALID_EFFECTS_GROUP_CAUSE_TYPE),
9 specific_cause(),
10 custom_label()
11 {}
12
EffectCause(EffectsCauseType cause_type_,const std::string & specific_cause_,const std::string & custom_label_)13 Effect::EffectCause::EffectCause(EffectsCauseType cause_type_, const std::string& specific_cause_,
14 const std::string& custom_label_) :
15 cause_type(cause_type_),
16 specific_cause(specific_cause_),
17 custom_label(custom_label_)
18 {
19 //DebugLogger() << "EffectCause(" << cause_type << ", " << specific_cause << ", " << custom_label << ")";
20 }
21
AccountingInfo()22 Effect::AccountingInfo::AccountingInfo() :
23 EffectCause(),
24 source_id(INVALID_OBJECT_ID),
25 meter_change(0.0f),
26 running_meter_total(0.0f)
27 {}
28
AccountingInfo(int source_id_,EffectsCauseType cause_type_,float meter_change_,float running_meter_total_,const std::string & specific_cause_,const std::string & custom_label_)29 Effect::AccountingInfo::AccountingInfo(
30 int source_id_, EffectsCauseType cause_type_, float meter_change_,
31 float running_meter_total_, const std::string& specific_cause_,
32 const std::string& custom_label_) :
33 EffectCause(cause_type_, specific_cause_, custom_label_),
34 source_id(source_id_),
35 meter_change(meter_change_),
36 running_meter_total(running_meter_total_)
37 {}
38
operator ==(const AccountingInfo & rhs) const39 bool Effect::AccountingInfo::operator==(const AccountingInfo& rhs) const {
40 return
41 cause_type == rhs.cause_type &&
42 specific_cause == rhs.specific_cause &&
43 custom_label == rhs.custom_label &&
44 source_id == rhs.source_id &&
45 meter_change == rhs.meter_change &&
46 running_meter_total == rhs.running_meter_total;
47 }
48
TargetsAndCause()49 Effect::TargetsAndCause::TargetsAndCause() :
50 target_set(),
51 effect_cause()
52 {}
53
TargetsAndCause(const TargetSet & target_set_,const EffectCause & effect_cause_)54 Effect::TargetsAndCause::TargetsAndCause(const TargetSet& target_set_, const EffectCause& effect_cause_) :
55 target_set(target_set_),
56 effect_cause(effect_cause_)
57 {}
58
SourcedEffectsGroup()59 Effect::SourcedEffectsGroup::SourcedEffectsGroup() :
60 source_object_id(INVALID_OBJECT_ID)
61 {}
62
SourcedEffectsGroup(int source_object_id_,const EffectsGroup * effects_group_)63 Effect::SourcedEffectsGroup::SourcedEffectsGroup(int source_object_id_, const EffectsGroup* effects_group_) :
64 source_object_id(source_object_id_),
65 effects_group(effects_group_)
66 {}
67
operator <(const SourcedEffectsGroup & right) const68 bool Effect::SourcedEffectsGroup::operator<(const SourcedEffectsGroup& right) const {
69 return (this->source_object_id < right.source_object_id ||
70 ((this->source_object_id == right.source_object_id) && this->effects_group < right.effects_group));
71 }
72
73