From: <geo...@us...> - 2011-09-12 04:39:23
|
Revision: 4250 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=4250&view=rev Author: geoffthemedio Date: 2011-09-12 04:39:17 +0000 (Mon, 12 Sep 2011) Log Message: ----------- Added variant of CreateShip, with parsing, that takes a predefined design name and empire ID but not species. The species is left empty when this variant is used, similar to specifying speces = "". Modified Paths: -------------- trunk/FreeOrion/universe/Effect.cpp trunk/FreeOrion/universe/Effect.h trunk/FreeOrion/universe/EffectParser.cpp Modified: trunk/FreeOrion/universe/Effect.cpp =================================================================== --- trunk/FreeOrion/universe/Effect.cpp 2011-09-12 04:04:58 UTC (rev 4249) +++ trunk/FreeOrion/universe/Effect.cpp 2011-09-12 04:39:17 UTC (rev 4250) @@ -1163,6 +1163,14 @@ m_species_name(species_name) {} +CreateShip::CreateShip(const std::string& predefined_ship_design_name, + const ValueRef::ValueRefBase<int>* empire_id) : + m_design_name(predefined_ship_design_name), + m_design_id(0), // this specifies a null pointer to a ValueRef, not the constant 0 + m_empire_id(empire_id), + m_species_name(0) // ... +{} + CreateShip::CreateShip(const std::string& predefined_ship_design_name) : m_design_name(predefined_ship_design_name), m_design_id(0), // this specifies a null pointer to a ValueRef, not the constant 0 Modified: trunk/FreeOrion/universe/Effect.h =================================================================== --- trunk/FreeOrion/universe/Effect.h 2011-09-12 04:04:58 UTC (rev 4249) +++ trunk/FreeOrion/universe/Effect.h 2011-09-12 04:39:17 UTC (rev 4250) @@ -404,6 +404,8 @@ CreateShip(const ValueRef::ValueRefBase<int>* ship_design_id, const ValueRef::ValueRefBase<int>* empire_id, const ValueRef::ValueRefBase<std::string>* species_name); + CreateShip(const std::string& predefined_ship_design_name, + const ValueRef::ValueRefBase<int>* empire_id); CreateShip(const std::string& predefined_ship_design_name); virtual ~CreateShip(); Modified: trunk/FreeOrion/universe/EffectParser.cpp =================================================================== --- trunk/FreeOrion/universe/EffectParser.cpp 2011-09-12 04:04:58 UTC (rev 4249) +++ trunk/FreeOrion/universe/EffectParser.cpp 2011-09-12 04:39:17 UTC (rev 4250) @@ -425,6 +425,11 @@ create_ship.empire, create_ship.species)]) | ((str_p("createship") + >> design_name_label >> name_p[create_ship.predefined_design_name = arg1] + >> empire_label >> int_expr_p[create_ship.empire = arg1]) + [create_ship.this_ = new_<Effect::CreateShip>(create_ship.predefined_design_name, + create_ship.empire)]) + | ((str_p("createship") >> design_name_label >> name_p[create_ship.predefined_design_name = arg1]) [create_ship.this_ = new_<Effect::CreateShip>(create_ship.predefined_design_name)]) ); |