amessier Posted January 10, 2006 Report Share Posted January 10, 2006 (edited) im trying to add a setStartConstructionTime() to humanfacility so I can compute days left to completion. Im getting this error c:\xenocide\xenocide\src\core\gamestate\humanbase.cpp(112): error C2039: 'setStartConstructionTime' : is not a member of 'boost::shared_ptr<T>' with [ T=Xenocide::Core::HumanFacility ] ----Humanfacility.h------- typedef TSharedPtr<HumanFacility> SharedPtr; HumanFacility(const ::String & typeName, int xpos, int ypos, HumanBase *ownerBase, bool addOnly, boost::gregorian::date startTime);----Humanfacility.cpp-------void HumanFacility::setStartConstructionTime(boost::gregorian::date startDate){ this->startConstructionTime = startDate;}--- The error line points at humanbase.cpp I marked the spot by ~~ ---- void HumanBase::addFacility(const ::String &typeName, int xpos, int ypos){ boost::gregorian::date startDateGreg(GameTime::instance().getYear(), GameTime::instance().getMonth(), GameTime::instance().getDay()); HumanFacility::SharedPtr newFacility(new HumanFacility(typeName, xpos, ypos, this, true, startDateGreg)); ~~newFacility.setStartConstructionTime(startDateGreg); facilities.push_back(newFacility);} I have more lines of code but I do not think they are relavent to the problem at hand.If someone could give me a hint along with point me toward some documentation that would be great. Edited January 10, 2006 by amessier Link to comment Share on other sites More sharing options...
UnFleshed One Posted January 10, 2006 Report Share Posted January 10, 2006 (edited) Try the -> . Since 'setStartConstructionTime' is really not a member of shared_ptr . -> is overloaded so it returns &T. newFacility->setStartConstructionTime(startDateGreg); Edit:You can look for boost docs here http://www.boost.org/libs/libraries.htm, although they are kinda hard to make sence. Edit2:To use dot you can do it like that:(*newFacility.get()).setStartConstructionTimeor maybe even like that (I'm not sure):(*newFacility).setStartConstructionTime Just kidding, don't do that unless it is really nessesary. Edited January 10, 2006 by UnFleshed One Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now