From: <geo...@us...> - 2013-08-17 04:16:05
|
Revision: 6343 http://sourceforge.net/p/freeorion/code/6343 Author: geoffthemedio Date: 2013-08-17 04:16:00 +0000 (Sat, 17 Aug 2013) Log Message: ----------- Removed slot type parameter from SetShipPartMeter effect. Modified Paths: -------------- trunk/FreeOrion/parse/EffectParser2.cpp trunk/FreeOrion/universe/Effect.cpp trunk/FreeOrion/universe/Effect.h Modified: trunk/FreeOrion/parse/EffectParser2.cpp =================================================================== --- trunk/FreeOrion/parse/EffectParser2.cpp 2013-08-16 15:53:22 UTC (rev 6342) +++ trunk/FreeOrion/parse/EffectParser2.cpp 2013-08-17 04:16:00 UTC (rev 6343) @@ -49,20 +49,17 @@ set_ship_part_meter_suffix_1 = parse::label(PartClass_token) >> parse::enum_parser<ShipPartClass>() [ _a = _1 ] // TODO: PartClass should match "Class" from ShipPartsParser.cpp. - > parse::label(Value_token) > double_value_ref [ _d = _1 ] - > parse::label(SlotType_token) > parse::enum_parser<ShipSlotType>() [ _val = new_<Effect::SetShipPartMeter>(_r1, _a, _d, _1) ] + > parse::label(Value_token) > double_value_ref [ _val = new_<Effect::SetShipPartMeter>(_r1, _a, _1) ] ; set_ship_part_meter_suffix_2 = parse::label(FighterType_token) >> parse::enum_parser<CombatFighterType>() [ _b = _1 ] - > parse::label(Value_token) > double_value_ref [ _d = _1 ] - > parse::label(SlotType_token) > parse::enum_parser<ShipSlotType>() [ _val = new_<Effect::SetShipPartMeter>(_r1, _b, _d, _1) ] + > parse::label(Value_token) > double_value_ref [ _val = new_<Effect::SetShipPartMeter>(_r1, _b, _1) ] ; set_ship_part_meter_suffix_3 = parse::label(PartName_token) > tok.string [ _c = _1 ] - > parse::label(Value_token) > double_value_ref [ _d = _1 ] - > parse::label(SlotType_token) > parse::enum_parser<ShipSlotType>() [ _val = new_<Effect::SetShipPartMeter>(_r1, _c, _d, _1) ] + > parse::label(Value_token) > double_value_ref [ _val = new_<Effect::SetShipPartMeter>(_r1, _c, _1) ] ; set_empire_stockpile @@ -156,8 +153,7 @@ qi::locals< ShipPartClass, CombatFighterType, - std::string, - ValueRef::ValueRefBase<double>* + std::string >, parse::skipper_type > set_ship_part_meter_suffix_rule; Modified: trunk/FreeOrion/universe/Effect.cpp =================================================================== --- trunk/FreeOrion/universe/Effect.cpp 2013-08-16 15:53:22 UTC (rev 6342) +++ trunk/FreeOrion/universe/Effect.cpp 2013-08-17 04:16:00 UTC (rev 6343) @@ -156,12 +156,8 @@ bool PartMatchesEffect(const PartType& part, ShipPartClass part_class, CombatFighterType fighter_type, - const std::string& part_name, - ShipSlotType slot_type) + const std::string& part_name) { - if (slot_type != INVALID_SHIP_SLOT_TYPE && !part.CanMountInSlotType(slot_type)) - return false; - if (!part_name.empty()) return part_name == part.Name(); @@ -725,12 +721,10 @@ /////////////////////////////////////////////////////////// SetShipPartMeter::SetShipPartMeter(MeterType meter, ShipPartClass part_class, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type/* = INVALID_SHIP_SLOT_TYPE*/) : + const ValueRef::ValueRefBase<double>* value) : m_part_class(part_class), m_fighter_type(INVALID_COMBAT_FIGHTER_TYPE), m_part_name(), - m_slot_type(slot_type), m_meter(meter), m_value(value) { @@ -740,24 +734,20 @@ SetShipPartMeter::SetShipPartMeter(MeterType meter, CombatFighterType fighter_type, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type/* = INVALID_SHIP_SLOT_TYPE*/) : + const ValueRef::ValueRefBase<double>* value) : m_part_class(INVALID_SHIP_PART_CLASS), m_fighter_type(fighter_type), m_part_name(), - m_slot_type(slot_type), m_meter(meter), m_value(value) {} SetShipPartMeter::SetShipPartMeter(MeterType meter, const std::string& part_name, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type/* = INVALID_SHIP_SLOT_TYPE*/) : + const ValueRef::ValueRefBase<double>* value) : m_part_class(INVALID_SHIP_PART_CLASS), m_fighter_type(INVALID_COMBAT_FIGHTER_TYPE), m_part_name(part_name), - m_slot_type(slot_type), m_meter(meter), m_value(value) {} @@ -807,7 +797,7 @@ // verify that found part matches the target part type information for // this effect: same name, same class and slot type, or same fighter type - if (PartMatchesEffect(*target_part, m_part_class, m_fighter_type, m_part_name, m_slot_type)) { + if (PartMatchesEffect(*target_part, m_part_class, m_fighter_type, m_part_name)) { double val = m_value->Eval(ScriptingContext(context, meter->Current())); meter->SetCurrent(val); } @@ -875,9 +865,6 @@ retval += " value = " + m_value->Dump(); - if (m_slot_type != INVALID_SHIP_SLOT_TYPE) - retval += " slottype = " + lexical_cast<std::string>(m_slot_type); - return retval; } Modified: trunk/FreeOrion/universe/Effect.h =================================================================== --- trunk/FreeOrion/universe/Effect.h 2013-08-16 15:53:22 UTC (rev 6342) +++ trunk/FreeOrion/universe/Effect.h 2013-08-17 04:16:00 UTC (rev 6343) @@ -197,22 +197,19 @@ there is a ship meter (i.e. specifying PC_FUEL would be illegal). */ SetShipPartMeter(MeterType meter_type, ShipPartClass part_class, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type = INVALID_SHIP_SLOT_TYPE); + const ValueRef::ValueRefBase<double>* value); /** Affects the \a meter_type meters that belong to all PC_FIGHTERS parts of type \a fighter_type. */ SetShipPartMeter(MeterType meter_type, CombatFighterType fighter_type, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type = INVALID_SHIP_SLOT_TYPE); + const ValueRef::ValueRefBase<double>* value); /** Affects the \a meter_type meters that belong to all parts named \a part_name. */ SetShipPartMeter(MeterType meter_type, const std::string& part_name, - const ValueRef::ValueRefBase<double>* value, - ShipSlotType slot_type = INVALID_SHIP_SLOT_TYPE); + const ValueRef::ValueRefBase<double>* value); virtual ~SetShipPartMeter(); @@ -220,14 +217,12 @@ virtual std::string Description() const; virtual std::string Dump() const; const std::string& GetPartName() const {return m_part_name;} - ShipSlotType GetShipSlotType() const {return m_slot_type;} MeterType GetMeterType() const {return m_meter;}; private: ShipPartClass m_part_class; CombatFighterType m_fighter_type; std::string m_part_name; - ShipSlotType m_slot_type; MeterType m_meter; const ValueRef::ValueRefBase<double>* m_value; @@ -892,7 +887,6 @@ & BOOST_SERIALIZATION_NVP(m_part_class) & BOOST_SERIALIZATION_NVP(m_fighter_type) & BOOST_SERIALIZATION_NVP(m_part_name) - & BOOST_SERIALIZATION_NVP(m_slot_type) & BOOST_SERIALIZATION_NVP(m_meter) & BOOST_SERIALIZATION_NVP(m_value); } |