1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 // static members of CStable
23 CStable
* CStable::_Instance
= NULL
;
26 using namespace NLMISC
;
27 using namespace NLNET
;
29 NL_INSTANCE_COUNTER_IMPL(CStable
);
31 //----------------------------------------------------------------------------
33 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
41 //----------------------------------------------------------------------------
49 //----------------------------------------------------------------------------
51 //----------------------------------------------------------------------------
52 void CStable::addStable( const std::string
& stableName
, uint16 placeId
, const std::string
& continent
, float x
, float y
, float z
, float theta
)
56 sd
.StableName
= stableName
;
57 sd
.Continent
= CONTINENT::toContinent( continent
);
58 sd
.StableExitX
= sint32(x
* 1000);
59 sd
.StableExitY
= sint32(y
* 1000);
60 sd
.StableExitZ
= sint32(z
* 1000);
63 if( ! isStable( placeId
) )
65 _Stables
.insert( make_pair(placeId
, sd
) );
69 nlwarning("<CStable::addStable> Stable name %s (PlaceId %u) already exist !!!", stableName
.c_str(), placeId
);
73 //----------------------------------------------------------------------------
74 // return stable entry point coordinate
75 //----------------------------------------------------------------------------
76 bool CStable::getStableData( uint16 placeId
, TStableData
& stableData
) const
78 TStableContainer::const_iterator it
= _Stables
.find( placeId
);
79 if( it
!= _Stables
.end() )
81 stableData
= (*it
).second
;