Beispiel #1
0
bool CPITradeMessage::Handle( void )
{
	CItem *tradeWindowOne = calcItemObjFromSer( tSock->GetDWord( 4 ) );
	CItem *tradeWindowTwo = NULL;
	if( ValidateObject( tradeWindowOne ) )
	{
		switch( tSock->GetByte( 3 ) )
		{
			case 0://Start trade - Never happens, sent out by the server only.
				break;
			case 2://Change check marks.  Possibly conclude trade
				tradeWindowTwo = calcItemObjFromSer( tradeWindowOne->GetTempVar( CITV_MOREX ) );
				if( ValidateObject( tradeWindowTwo ) )
				{
					tradeWindowOne->SetTempVar( CITV_MOREZ, tSock->GetByte( 11 ) );
					sendTradeStatus( tradeWindowOne, tradeWindowTwo );
					if( tradeWindowOne->GetTempVar( CITV_MOREZ ) && tradeWindowTwo->GetTempVar( CITV_MOREZ ) )
						completeTrade( tradeWindowOne, tradeWindowTwo, true );
				}
				break;
			case 1://Cancel trade.  Send each person cancel messages, move items.
				cancelTrade( tradeWindowOne );
				break;
			default:
				Console.Error( " Fallout of switch statement without default. trade.cpp, trademsg()" );
				break;
		}
	}
	return true;
}
Beispiel #2
0
void flagOptions::runThru(bool x){
    int zero = 0;
    int bop = true;
    for(auto it = eqMap.begin(); it != eqMap.end(); it++){
        while(bop){
            if(completeTrade(*it, x) != zero) {
                last = it->first;
                if(median)
                    medianSet.insert(it->first);
            }
            bop = false;
        }
        while(!bop){
            if(insider.count(it->first)) {
                bool temp = false;
                for(int i = 0; i < 2; ++i){
                    if(i == 0)
                        temp = true;
                    else
                        temp = false;
                    inside(*it, temp);
                }
                
            }
            bop = true;
        }
    }
}
Beispiel #3
0
//o---------------------------------------------------------------------------o
//|   Function    :  void cancelTrade( CItem *tradeWindowOne )
//|   Date        :  February 2, 2006
//|   Programmer  :  giwo
//o---------------------------------------------------------------------------o
//|   Purpose     :  Cancels a secure trade
//o---------------------------------------------------------------------------o
void cancelTrade( CItem *tradeWindowOne )
{
	CItem *tradeWindowTwo = calcItemObjFromSer( tradeWindowOne->GetTempVar( CITV_MOREX ) );
	if( !ValidateObject( tradeWindowTwo ) )
		return;

	tradeWindowOne->SetTempVar( CITV_MOREZ, 0 );
	tradeWindowTwo->SetTempVar( CITV_MOREZ, 0 );
	sendTradeStatus( tradeWindowOne, tradeWindowTwo );

	completeTrade( tradeWindowOne, tradeWindowTwo, false );
}