コード例 #1
0
bool CUIMpTradeWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
{
#ifdef DEBUG
	//for debug only
	if(keyboard_action==WINDOW_KEY_PRESSED && dik==DIK_NUMPAD7)
	{
		if(GetRank()>0)
			SetRank( clampr(u32(GetRank()-1),u32(0),u32(4) ) );
	}
	if(keyboard_action==WINDOW_KEY_PRESSED && dik==DIK_NUMPAD8)
	{
		SetRank( clampr(u32(GetRank()+1),u32(0),u32(4) ) );
	}
#endif

	if(!m_store_hierarchy->CurrentIsRoot())
	{
		if (m_shop_wnd->OnKeyboard(dik, keyboard_action) )
			return true;

		m_root_tab_control->SetAcceleratorsMode		(false);
	}

	bool res =  inherited::OnKeyboard(dik, keyboard_action);

	m_root_tab_control->SetAcceleratorsMode		(true);

	return			res;
}
コード例 #2
0
ファイル: HandRank.cpp プロジェクト: robertjmartin/poker
bool HandRank::CheckThreeOfAKind(list<Card> cards, unsigned int& HandRank )
{
	list<Card>::iterator it = cards.begin();
	list<Card>::iterator next = cards.begin();
	list<Card>::iterator next2 = cards.begin();
	next++;
	next2++;next2++;
	
	while( next2 != cards.end() )
	{
		if( it->GetValue() == next->GetValue() && it->GetValue() == next2->GetValue() )
		{
			SetRank(THREEOFAKIND, HandRank);
			SetHighV(it->GetValue(), HandRank);
			cards.erase(it);
			cards.erase(next);
			cards.erase(next2);
			SetKickers(cards, HandRank);
			return true;
		}

		it++;
		next++;
		next2++;
	}

	return false;

}
コード例 #3
0
ファイル: UIMpTradeWnd_misc.cpp プロジェクト: 2asoft/xray
void CUIMpTradeWnd::IgnoreMoneyAndRank(bool ignore)
{
	m_bIgnoreMoneyAndRank	= ignore;
	
	if(m_bIgnoreMoneyAndRank)
	{
		SetMoneyAmount		(1);
		SetRank				(0);
	}
}
コード例 #4
0
ファイル: HandRank.cpp プロジェクト: robertjmartin/poker
bool HandRank::CheckStraight(list<Card> cards, unsigned int& HandRank )
{
	list<Card>::iterator it = cards.begin();

	int lastvalue = it->GetValue();
	int highcard = it->GetValue();
	int count = 1;
	bool Ace = false;

	if( it->GetValue() == 0x0E )
		Ace = true;
	
	it++;

	while( it != cards.end())
	{
		if( it->GetValue() == --lastvalue )
		{
			if( ++count == 5)
			{
				SetRank(STRAIGHT, HandRank);
				SetHighV(highcard, HandRank);
				return true;
			}			
		}
		else
		{
			lastvalue = it->GetValue();
			highcard = it->GetValue();
			count = 1;
		}
		it++;
	}

	if( count == 4 && lastvalue == 2 && Ace )
	{
		SetRank(STRAIGHT, HandRank);
		SetHighV(highcard, HandRank);
		return true;
	}

	return false;
}
コード例 #5
0
ファイル: assignment.cpp プロジェクト: mbelaoucha/fadalib
void
Assignment::Initialize(void)
{
SetRank( -1 );
SetLHS( "", NULL );
SetRHS( NULL );
vector<string> empty;
SetLoopCounters( empty );
//References.clear();
GetReferences()->clear();
normalized_domain.clear();
}
コード例 #6
0
ファイル: ArenaTeam.cpp プロジェクト: Archives/try
void ArenaTeam::UpdateTeamRank(bool update_packet, bool save_to_db)
{
    uint32 rank = 1;
    for (ObjectMgr::ArenaTeamMap::const_iterator i = sObjectMgr.GetArenaTeamMapBegin(); i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
    {
        if (GetType() == i->second->GetType() && GetStats().rating < i->second->GetRating())
                ++rank;
    }
    SetRank(rank);
    if (update_packet)
        NotifyStatsChanged();
    if (save_to_db)
        CharacterDatabase.PExecute("UPDATE arena_team_stats SET rank = '%u' WHERE arenateamid = '%u'", m_stats.rank, m_TeamId);
}
コード例 #7
0
ファイル: HandRank.cpp プロジェクト: robertjmartin/poker
bool HandRank::CheckFlush(list<Card> cards, unsigned int& HandRank )
{
	list<Card>::iterator it = cards.begin();
	int count[4] = {0,0,0,0};
	int flushsuit = -1;	

	while( it != cards.end())
	{
		suit s = it->GetSuit();
		count[(int)s]++;
		it++;
	}

	for( int i = 0; i < 4; i++ )
	{
		if( count[i] >= 5)
		{
			flushsuit = i;
			break;
		}
	}

	if( flushsuit == -1 )
		return false;
	else
	{
		SetRank(FLUSH, HandRank);

		list<Card> FlushCards;
		it = cards.begin();
		while( it != cards.end())
		{
			if( (int)it->GetSuit() == flushsuit )
			{
				FlushCards.push_back(Card(it->GetValue(), it->GetSuit()));
			}
			it++;
		}

		Card F = FlushCards.front();
		FlushCards.pop_front();
		SetHighV(F.GetValue(), HandRank);
		
		F = FlushCards.front();
		SetLowV(F.GetValue(), HandRank);

		SetKickers(FlushCards, HandRank);
		return true;
	}
}
コード例 #8
0
ファイル: character_info.cpp プロジェクト: OLR-xray/OLR-3.0
void CCharacterInfo::InitSpecificCharacter (shared_str new_id)
{
    R_ASSERT(new_id.size());
    m_SpecificCharacterId = new_id;

    m_SpecificCharacter.Load(m_SpecificCharacterId);
    if(Rank().value() == NO_RANK)
        SetRank(m_SpecificCharacter.Rank());
    if(Reputation().value() == NO_REPUTATION)
        SetReputation(m_SpecificCharacter.Reputation());
    if(Community().index() == NO_COMMUNITY_INDEX)
        SetCommunity(m_SpecificCharacter.Community());
    if(!m_StartDialog || !m_StartDialog.size() )
        m_StartDialog = m_SpecificCharacter.data()->m_StartDialog;
}
コード例 #9
0
ファイル: Card.cpp プロジェクト: dmaddalone/GameAI
bool Card::SetRankAndSuit(const std::string &sRankAndSuit)
{
    if (sRankAndSuit.empty())
        return false;

    std::string sSuit(1, sRankAndSuit.back());
    if (!SetSuit(sSuit))
        return false;

    std::string sRank(sRankAndSuit.substr(0, sRankAndSuit.length() - 1));
    if (!SetRank(sRank))
        return false;

    return true;
}
コード例 #10
0
ファイル: HandRank.cpp プロジェクト: robertjmartin/poker
bool HandRank::CheckTwoPair(list<Card> cards, unsigned int& HandRank )
{
	list<Card>::iterator it = cards.begin();
	list<Card>::iterator next = cards.begin();
	int pairsfound = 0;
	int values[2];

	next++;
	
	while( next != cards.end() )
	{
		if( it->GetValue() == next->GetValue() )
		{
			values[pairsfound] = it->GetValue();

			if(++pairsfound == 2)
			{
				SetRank(TWOPAIR, HandRank);
				SetHighV(max(values[0], values[1]), HandRank);
				SetLowV(min(values[0], values[1]), HandRank);
				cards.erase(it);
				cards.erase(next);
				SetKickers(cards, HandRank);
				return true;
			}
			it++;
			next++;

			if( next == cards.end() )
				return false;
		}

		it++;
		next++;
	}

	return false;
}
コード例 #11
0
ファイル: HandRank.cpp プロジェクト: robertjmartin/poker
bool HandRank::CheckPair(list<Card> cards, unsigned int& HandRank )
{
	list<Card>::iterator it = cards.begin();
	list<Card>::iterator next = cards.begin();
	next++;
	
	while( next != cards.end() )
	{
		if( it->GetValue() == next->GetValue() )
		{
			SetRank(PAIR, HandRank);
			SetHighV(it->GetValue(), HandRank);
			cards.erase(it);
			cards.erase(next);
			SetKickers(cards, HandRank);
			return true;
		}

		it++;
		next++;
	}

	return false;
}
コード例 #12
0
void CInventoryOwner::ChangeRank			(CHARACTER_RANK_VALUE delta)
{
	SetRank(Rank()+delta);
}
コード例 #13
0
Card::Card(int faceValue, std::string suit)
{
    SetRank(faceValue);
    SetSuit(suit);
}
コード例 #14
0
ファイル: GameStats.cpp プロジェクト: amrhead/eaascode
void CGameStats::OnGameplayEvent(IEntity *pEntity, const GameplayEvent &event)
{
/*	for(int i=0;i<gEventNamesNum;++i)
	{
		if(gEventNames[i].key == event.event)
		{
			CryLog("GameStats : Event %s",gEventNames[i].name);
		}
	}*/

	int e_id = pEntity ? (int) pEntity->GetId() : 0;
	switch(event.event)
	{
	case eGE_GameStarted:
		StartGame(event.value!=0);
		break;
	case eGE_GameEnd:
		EndGame(event.value!=0);
		break;
	case eGE_SuddenDeath:
		SuddenDeath(event.value!=0);
		break;
	case eGE_RoundEnd:
		EndRound(event.value!=0, atoi(event.description));
		break;
	case eGE_Renamed:
		SetName(e_id, event.description);
		break;
	case eGE_Scored:
		SetScore(e_id, event.description, (int)event.value);
		break;
	case eGE_Kill:
		OnKill(e_id, (EntityId*)event.extra);
		if(pEntity)
			ProcessPlayerStat(pEntity,event);
		break;
	case eGE_Death:
		OnDeath(e_id, (int)(TRUNCATE_PTR)event.extra);
		if(pEntity)
			ProcessPlayerStat(pEntity,event);
		break;
  case eGE_WeaponShot:
	case eGE_WeaponHit:
	case eGE_SuitModeChanged:
	case eGE_WeaponMelee:
	case eGE_LeftVehicle:
	case eGE_EnteredVehicle:
	case eGE_ItemSelected:
	case eGE_WeaponReload:
	case eGE_Damage:
	case eGE_Revive:
	case eGE_WeaponFireModeChanged:
	case eGE_ZoomedIn:
	case eGE_ZoomedOut:
		if(pEntity)
			ProcessPlayerStat(pEntity,event);
		break;
	case eGE_Connected:
		{
			bool restored = event.value!=0.0f;

			struct SExtraData
			{
					int status[2];
			};

			SExtraData* pExtra = static_cast<SExtraData*>(event.extra);
			NewPlayer(e_id, pExtra->status[0], pExtra->status[1]!=0, restored);
		}
		break;
  case eGE_ChangedTeam:
    SetTeam(e_id,(int)event.value);
    break;
  case eGE_Spectator:
    SetSpectator(e_id,(int)event.value);
		if(pEntity)
			ProcessPlayerStat(pEntity,event);
    break;
	case eGE_Disconnected:
		RemovePlayer(e_id, event.value!=0);
		break;
	case eGE_ScoreReset:
		ResetScore(e_id);
		break;
  case eGE_Rank:
    SetRank(e_id,(int)event.value);
    break;
	case eGE_GameReset:
		GameReset();
		break;
	default:
		break;
	}
}