Beispiel #1
0
	/*!
	\author Luxor
	*/
	void addToStableMap(P_CHAR pet)
	{
		VALIDATEPC(pet);
		SERIAL stablemaster=pet->getStablemaster();
		if( stablemaster !=INVALID ) {

			delFromStableMap( pet );

			pStableMap[stablemaster].push_back(pet);
		}
	}
Beispiel #2
0
	/*!
	\brief initializes pointer maps
	\author Luxor
	*/
	void init()
	{


		pStableMap.clear();
		pContMap.clear();
		pMounted.clear();
		pOwnCharMap.clear();
		pOwnItemMap.clear();
		//Chars and Stablers
		P_CHAR pc = 0;

		cAllObjectsIter objs;

		for( objs.rewind(); !objs.IsEmpty(); objs++ )
		{
			if( isCharSerial( objs.getSerial() ) ) {
				pc=(P_CHAR)objs.getObject();
				{
					if( pc->isStabled() ) {
						pStableMap[pc->getStablemaster()].push_back(pc);
					}
					if( pc->mounted )
						pMounted[pc->getOwnerSerial32()]=pc;

					P_CHAR own=pointers::findCharBySerial(pc->getOwnerSerial32());
					pc->setOwnerSerial32( DEREF_P_CHAR(own), true );
				}
			}
			else {

				P_ITEM pi = (P_ITEM)objs.getObject();

				updContMap(pi);

				P_CHAR own=pointers::findCharBySerial(pi->getOwnerSerial32());
				pi->setOwnerSerial32( DEREF_P_CHAR(own), true );
			}
		}

		std::map< SERIAL, P_CHAR >::iterator iter( pMounted.begin() ), end( pMounted.end() );
		for( ; iter!=end; iter++)
		{
			pc = pointers::findCharBySerial(iter->first);
			if(ISVALIDPC(pc))
				pc->setOnHorse();
		}
	}
Beispiel #3
0
	/*!
	\author Luxor
	*/
	void delFromStableMap(P_CHAR pet)
	{
		VALIDATEPC(pet);
		SERIAL stablemaster=pet->getStablemaster();
		if( stablemaster != INVALID ) {

			std::map<SERIAL, vector <P_CHAR> >::iterator vect( pStableMap.find( stablemaster ) );
			if( ( vect!=pStableMap.end() ) && !vect->second.empty() ) {

				vector<P_CHAR>::iterator stableIter;
				stableIter = find( vect->second.begin(), vect->second.end(), pet);
				if( stableIter != vect->second.end())
					vect->second.erase(stableIter);
			}
		}
	}