Beispiel #1
0
//---------------------------------------------------------------------------
void __fastcall TTVPMenuContainerForm::TimerTimer(TObject *Sender)
{
	// check mouse cursor position
	POINT pos = {0, OwnerForm->Height};
	GetCursorPos(&pos);
	bool outofwindow = pos.y > Height;

	// check popup opportunity
	if(pos.y == 0 && WaitingShowing)
	{
		Drop();
		return;
	}

	// check hiding oppertunity
	if(ShowingMenu)
	{
		LastOutOfWindow = false;
		return;
	}

	if(Visible && outofwindow && LastOutOfWindow) Conceal();

	LastOutOfWindow = outofwindow;
}
Beispiel #2
0
int CNetConsole::Update()
{
    NETSOCKET Socket;
    NETADDR Addr;

    if(net_tcp_accept(m_Socket, &Socket, &Addr) > 0)
    {
        // check if we just should drop the packet
        char aBuf[128];
        if(NetBan() && NetBan()->IsBanned(&Addr, aBuf, sizeof(aBuf)))
        {
            // banned, reply with a message and drop
            net_tcp_send(Socket, aBuf, str_length(aBuf));
            net_tcp_close(Socket);
        }
        else
            AcceptClient(Socket, &Addr);
    }

    for(int i = 0; i < NET_MAX_CONSOLE_CLIENTS; i++)
    {
        if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ONLINE)
            m_aSlots[i].m_Connection.Update();
        if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR)
            Drop(i, m_aSlots[i].m_Connection.ErrorString());
    }

    return 0;
}
	/// @brief Performs upkeep logic
	/// @param bPressed If true, there is a press
	void Widget::Upkeep (bool bPressed)
	{
		IssueEvent(ePreUpkeep);

		// Perform leave logic.
		Leave();

		// If the widget is signaled, perform enter logic; on a press, perform grab logic.
		if (IsSignaled())
		{
			Enter();

			if (bPressed) Grab();
		}

		// If there is no press, perform drop logic.
		if (!bPressed) Drop();

		// If the widget remains chosen, post-process it; otherwise, abandon it.
		if (!IsSignaled() && !IsChosen())
		{
			mState->ClearChoice();

			IssueEvent(eAbandon);
		}

		else IssueEvent(ePostUpkeep);
	}
int CNetServer::Send(CNetChunk *pChunk)
{
	if(pChunk->m_DataSize >= NET_MAX_PAYLOAD)
	{
		dbg_msg("netserver", "packet payload too big. %d. dropping packet", pChunk->m_DataSize);
		return -1;
	}

	if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
	{
		// send connectionless packet
		CNetBase::SendPacketConnless(m_Socket, &pChunk->m_Address, pChunk->m_pData, pChunk->m_DataSize);
	}
	else
	{
		int Flags = 0;
		dbg_assert(pChunk->m_ClientID >= 0, "errornous client id");
		dbg_assert(pChunk->m_ClientID < MaxClients(), "errornous client id");

		if(pChunk->m_Flags&NETSENDFLAG_VITAL)
			Flags = NET_CHUNKFLAG_VITAL;

		if(m_aSlots[pChunk->m_ClientID].m_Connection.QueueChunk(Flags, pChunk->m_DataSize, pChunk->m_pData) == 0)
		{
			if(pChunk->m_Flags&NETSENDFLAG_FLUSH)
				m_aSlots[pChunk->m_ClientID].m_Connection.Flush();
		}
		else
		{
			Drop(pChunk->m_ClientID, "Error sending data");
		}
	}
	return 0;
}
void LocalPrefServer::processDrop(CardsSet drop, BidType bid, int playerNum)
{
	// Checking validness of move
	if(mapModelToRealPlayer(model->PlayerCardsOwner(model->CurrentPlayer())) != playerNum) {
		players[playerNum].Player->OnMessage(ErrorMessage("Not your turn"));
		return;
	}

	if( !model->IsValidDrop(Drop(drop, bid)) ) {
		players[playerNum].Player->OnMessage(ErrorMessage("Invalid move"));
		players[playerNum].Player->OnMessage(MoveRequestMessage());
		return;
	}

	// Updating state
	PrefAssert( model->ProcessDrop(Drop(drop, bid)) );
}
Beispiel #6
0
static Action_SkBuff
steering_vlan_id(arguments_t args, SkBuff b)
{
        if (b.skb->vlan_tci & VLAN_VID_MASK)
 	        return Steering(b, b.skb->vlan_tci & VLAN_VID_MASK);
        else
                return Drop(b);
}
Association::~Association()
{
        // drop an existing association on shutdown
        if (assoc != NULL)
                Drop();
        assoc = NULL;
        m_pNotificadorProgreso = NULL;
}
Beispiel #8
0
void    SendWSLStr( char *str ) {
//===============================

    while( *str != NULLCHAR ) {
        Drop( *str );
        ++str;
    }
}
Beispiel #9
0
bool ColorPusher::Key(dword key, int)
{
	if(key == K_SPACE) {
		Drop();
		return true;
	}
	return false;
}
Beispiel #10
0
static ActionSkBuff
filter_dst_addr(arguments_t args, SkBuff b)
{
	__be32 addr = GET_ARG_0(__be32, args);
	__be32 mask = GET_ARG_1(__be32, args);

	return has_dst_addr(b, addr, mask) ? Pass(b) : Drop(b);
}
Beispiel #11
0
void DropGrid::LeftDown(Point p, dword keyflags)
{
	WhenLeftDown();
	if(nodrop)
		SetFocus();
	else
		Drop();	
}
Beispiel #12
0
void    SendChar( char ch, int rep ) {
//====================================

    while( rep > 0 ) {
        Drop( ch );
        rep--;
    }
}
Beispiel #13
0
void    SendStr( char PGM *str, uint len ) {
//==========================================

    while( len > 0 ) {
        Drop( *str );
        str++;
        len--;
    }
}
void InventoryContainer::OnButtonEvent(std::string selection){
	if(selection == "Equip")
		Equip();
	else if(selection == "Drop")
		Drop();
	else if(selection == "Deposit")
		Deposit();
	else if(selection == "Barter")
		Barter();
};
Beispiel #15
0
static ActionSkBuff
filter_generic(arguments_t args, SkBuff b)
{
	predicate_t pred_ = GET_ARG(predicate_t, args);

	if (EVAL_PREDICATE(pred_, b))
		return Pass(b);

	return Drop(b);
}
Beispiel #16
0
void cRingBufferFrame::Clear(void)
{
  Lock();
  cFrame *p;
  while ((p = Get()) != NULL)
        Drop(p);
  Unlock();
  EnablePut();
  EnableGet();
}
Beispiel #17
0
 /* --------------------------------------------------------------------------------------------
  * Copy assignment operator.
 */
 ManagerHnd & operator = (const ManagerHnd & o)
 {
     if (m_Hnd != o.m_Hnd)
     {
         Drop();
         m_Hnd = o.m_Hnd;
         Grab();
     }
     return *this;
 }
Beispiel #18
0
 /* --------------------------------------------------------------------------------------------
  * Copy assignment operator.
 */
 DocumentRef & operator = (const DocumentRef & o)
 {
     if (m_Ptr != o.m_Ptr)
     {
         Drop();
         m_Ptr = o.m_Ptr;
         m_Ref = o.m_Ref;
         Grab();
     }
     return *this;
 }
Beispiel #19
0
int CNetServer::Update()
{
    for(int i = 0; i < MaxClients(); i++)
    {
        m_aSlots[i].m_Connection.Update();
        if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR)
            Drop(i, m_aSlots[i].m_Connection.ErrorString());
    }

    return 0;
}
Beispiel #20
0
static Action_SkBuff
steering_ip(arguments_t args, SkBuff b)
{
	if (eth_hdr(b.skb)->h_proto == __constant_htons(ETH_P_IP))
	{
		struct iphdr _iph;
    		const struct iphdr *ip;
		__be32 hash;

		ip = skb_header_pointer(b.skb, b.skb->mac_len, sizeof(_iph), &_iph);
 		if (ip == NULL)
                        return Drop(b);

		hash = ip->saddr ^ ip->daddr;

        	return Steering(b, *(uint32_t *)&hash);
	}

        return Drop(b);
}
Beispiel #21
0
int CNetServer::Update()
{
	int64 Now = time_get();
	for(int i = 0; i < MaxClients(); i++)
	{
		m_aSlots[i].m_Connection.Update();
		if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR)
		{
			if(Now - m_aSlots[i].m_Connection.ConnectTime() < time_freq() && NetBan())
			{
				if(NetBan()->BanAddr(ClientAddr(i), 60, "Stressing network") == -1)
					Drop(i, m_aSlots[i].m_Connection.ErrorString());
			}
			else
				Drop(i, m_aSlots[i].m_Connection.ErrorString());
		}
	}

	return 0;
}
Beispiel #22
0
static Action_SkBuff
inv(arguments_t args, SkBuff b)
{
	function_t expr = GET_ARG(function_t, args);
	SkBuff nb = EVAL_FUNCTION(expr, b).value;

	if (!nb.skb || is_drop(PFQ_CB(nb.skb)->monad->fanout))
		return Copy(nb);

	return Drop(nb);
}
Beispiel #23
0
void Y_data_align(int nArgs)
{
  IOStream *file;
  int alignment;
  if (nArgs!=2) YError("data_align takes exactly two arguments");

  file= yarg_file(1);
  alignment= (int)YGetInteger(sp);

  file->dataAlign= alignment>0? alignment : 0;
  Drop(2);
}
Beispiel #24
0
void Y_struct_align(int nArgs)
{
  IOStream *file;
  int alignment;
  if (nArgs!=2) YError("struct_align takes exactly two arguments");

  file= yarg_file(1);
  alignment= (int)YGetInteger(sp);

  file->structAlign= (alignment!=0)? alignment : yStructAlign;
  Drop(2);
}
Beispiel #25
0
void Y_dump_clog(int nArgs)
{
  IOStream *file;
  char *name;
  if (nArgs!=2) YError("dump_clog takes exactly two arguments");

  file= yarg_file(1);
  name= YGetString(sp);

  if (DumpClogFile(file, name))
    YError("dump_clog failed -- unable to open output file");
  Drop(2);
}
Beispiel #26
0
void Y__init_pdb(int nArgs)
{
  IOStream *file;
  int close102;
  if (nArgs!=2) YError("_init_pdb takes exactly two arguments");

  file= yarg_file(1);
  close102= ((int)YGetInteger(sp)) & 017;

  if (YinitPDB(file, close102))
    YError("unable to initialize PDB file (no write permission?)");
  Drop(1);
}
Beispiel #27
0
void Y_read_clog(int nArgs)
{
  IOStream *file;
  char *name;
  if (nArgs!=2) YError("read_clog takes exactly two arguments");

  file= yarg_file(1);
  name= yarg_sq(0);

  if (ReadClogFile(file, name))
    YError("read_clog failed -- unable to read input file");
  Drop(1);
}
Beispiel #28
0
void AMagazineItem::Reload(APlayerCharacter* player) {
    TArray<AAmmoItem*> toReadd;
    toReadd.Init(NULL, 0);
    
    for (unsigned int i = 0; i < Ammunition.Num(); i++) {
        if (!Ammunition[i]) {
            // Stop if the magazine is filled
            if (GetStoredAmmo() >= Ammunition.Num()) break;
            
            ItemSlot slot = player->Inventory->FindItemByType(AAmmoItem::StaticClass());
            if (slot.IsValid()) {
                AAmmoItem* item = Cast<AAmmoItem>(slot.Get());
                if(item) {
                    if (item->Calibre == Calibre) {
                        slot.Delete();
                        Ammunition.Add(item);
                        Ammunition.Swap(i, Ammunition.Num() - 1);
                        Ammunition.RemoveAt(Ammunition.Num() - 1);
                        
                        item->SetState(None);
                        item->AttachRootComponentTo(StaticMesh);
                        item->SetActorRelativeLocation(FVector::ZeroVector);
                        item->SetActorRelativeRotation(FRotator::ZeroRotator);
                    } else {
                        toReadd.Add(item);
                        
                        slot.Delete();
                    }
                } else break;
            } else break;
        }
    }
    
    for (auto& item: toReadd) {
        if (item) {
            if (player->Inventory->EquipItem(item)) {
                // Nothing changed! (possibly state, but that is dealt for us)
                
                // Stop pickup text
                player->Inventory->RecentlyEquiped = NULL;
            } else {
                item->SetState(ItemState::World);
                item->Unwear(player);
                
                item->DetachRootComponentFromParent();
                Drop(player);
            }
        }
    }
}
void Buffer::Push(const Flit & flit)
{
  SaveOccupancyAndTime();

  if (IsFull())
    Drop(flit);
  else
    buffer.push(flit);
  
  UpdateMeanOccupancy();

  if (max_occupancy < buffer.size())
    max_occupancy = buffer.size();
}
Beispiel #30
0
//-----------------------------------------------------------------------------
// Purpose:
// Input  : *pOwner -
//-----------------------------------------------------------------------------
void CWeaponFrag::DecrementAmmo( CBaseCombatCharacter *pOwner )
{
    pOwner->RemoveAmmo( 1, m_iPrimaryAmmoType );

    //DHL - Skillet - Once we throw our last grenade remove weapon_grenade from our inventory
#ifndef CLIENT_DLL
    if ( !HasPrimaryAmmo() /*pOwner->GetAmmoCount( m_iPrimaryAmmoType ) <= 0*/ )
    {
        if ( GetLastWeapon() )
            pOwner->SwitchToNextBestWeapon( this );
        Drop( vec3_origin );
        SUB_Remove();
    }
#endif
}