Esempio n. 1
0
	long GetFather(long a,long b){
		if(deep[a]>deep[b]){long c=a;a=b;b=c;}
		GoUp(b,deep[b]-deep[a]);

		if(a==b)return a;
		for(long i=18;i>=0;i--)
			if(f[i][a]!=f[i][b])
				a=f[i][a],b=f[i][b];
		return f[0][a];
	}
Esempio n. 2
0
bool Cx710::run(void) {

    if (pKEYB->LastKey == K_PFEED) { PaperFeed();}

    // Si strobe change de status et passe bas vers haut, alors prelever les data
    // mettre le busy
    //
    if (GoUp(1)) {
        UINT8 car = (pCONNECTOR->Get_values() >> 1) & 0xFF;
        AddLog(LOG_PRINTER,tr("RECIEVED CHAR : %1").arg(car,2,16,QChar('0')));
        if (car != 0xff && car !=0x0a) Command( car );
    }
Esempio n. 3
0
//======================================================//
void UpDownLineEdit::keyPressEvent(QKeyEvent * ke) 
{
    puts("UpDownLineEdit::keyPressEvent(QKeyEvent * ke)");
    
    switch(ke->key())    {
    case Qt::Key_Up :
	GoUp();
	break;	
    case Qt::Key_Down :
	GoDown();
	break;		}
    
    QLineEdit::keyPressEvent(ke);
}
Esempio n. 4
0
void CFuncPlat::Blocked( CBaseEntity *pOther )
{
	ALERT( at_aiconsole, "%s Blocked by %s\n", STRING( pev->classname ), STRING( pOther->pev->classname ) );
	// Hurt the blocker a little
	pOther->TakeDamage( this, this, 1, DMG_CRUSH );

	if( pev->noiseMovement )
		STOP_SOUND( ENT( pev ), CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) );

	// Send the platform back where it came from
	ASSERT( m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN );
	if( m_toggle_state == TS_GOING_UP )
		GoDown();
	else if( m_toggle_state == TS_GOING_DOWN )
		GoUp();
}
Esempio n. 5
0
void Entity::SearchWay(double& next_x, double& next_y ){
		    
  for(int j=0; j<=3; ++j){
      roll_die();
  }		    
	int tmp=roll_die();
	
	if(tmp==1){
	   GoRight();
	}
	else if(tmp==2){
	   GoUp();
	}
	else if(tmp==3){
	  GoLeft();
	}
	else if(tmp==4){
	  GoDown();
	}  
}
Esempio n. 6
0
void Grapple::Refresh()
{
  if (!attached)
    return ;

  if (move_left_pressed && !move_right_pressed) {
    GoLeft();
  } else if (move_right_pressed && !move_left_pressed) {
    GoRight();
  }

  if (move_up_pressed && !move_down_pressed) {
    GoUp();
  } else if (move_down_pressed && !move_up_pressed) {
    GoDown();
  }

  ActiveCharacter().SetMovement("ninja-rope");
  ActiveCharacter().UpdatePosition();
}
Esempio n. 7
0
void 
BNavigator::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case kNavigatorCommandBackward:
			GoBackward((modifiers() & B_OPTION_KEY) == B_OPTION_KEY);
			break;

		case kNavigatorCommandForward:
			GoForward((modifiers() & B_OPTION_KEY) == B_OPTION_KEY);
			break;

		case kNavigatorCommandUp:
			GoUp((modifiers() & B_OPTION_KEY) == B_OPTION_KEY);
			break;

		case kNavigatorCommandLocation:
			GoTo();
			break;
				
		default:
			{
				// Catch any dropped refs and try 
				// to switch to this new directory
				entry_ref ref;
				if (message->FindRef("refs", &ref) == B_OK) {
					BMessage message(kSwitchDirectory);
					BEntry entry(&ref, true);
					if (!entry.IsDirectory()) {
						entry.GetRef(&ref);
						BPath path(&ref);
							path.GetParent(&path);
							get_ref_for_path(path.Path(), &ref);
					}
					message.AddRef("refs", &ref);
					message.AddInt32("action", kActionSet);
					Window()->PostMessage(&message);
				}
			}
	}
}
Esempio n. 8
0
//======================================================//
UpDownLineEdit::UpDownLineEdit(QWidget *parent, const char *name, QString possible_value)
    : QLineEdit(parent, name),	possible_val(possible_value)
{    
    buttonUp = new QPushButton(parent, "buttonUp");
    //QPixmap pm ("./image/arrow_up.png");
    QPixmap pm = QPixmap::fromMimeSource("arrow_up.png");
    buttonUp->setPixmap( pm);
    
    buttonDown = new QPushButton(parent, "buttonDown");
    //pm = QPixmap("./image/arrow_down.png");
    pm = QPixmap::fromMimeSource("arrow_down.png");
    buttonDown->setPixmap( pm);
    
    setPosition(0, 0);
    setMaxLength(1);
    setReadOnly(true);
    setAlignment(Qt::AlignHCenter);
    
    QFont f = font();
    f.setPointSize(12);
    f.setBold(false);
    setFont(f);
    
    buttonUp->setFocusPolicy(QWidget::NoFocus);
    buttonDown->setFocusPolicy(QWidget::NoFocus);
    
    QSizePolicy sp (QSizePolicy::Fixed, QSizePolicy::Fixed);
    setSizePolicy(sp);
    buttonUp->setSizePolicy(sp);
    buttonDown->setSizePolicy(sp);
    
    buttonUp->setFlat(true);
    buttonDown->setFlat(true);
    
    connect ( buttonUp, SIGNAL(clicked()), SLOT(GoUp()) );
    connect ( buttonDown, SIGNAL(clicked()), SLOT(GoDown()) );
    
    index = 0;
    //puts("UpDownCreate");
}
Esempio n. 9
0
//
// Used by SUB_UseTargets, when a platform is the target of a button.
// Start bringing platform down.
//
void CFuncPlat::PlatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if( IsTogglePlat() )
	{
		// Top is off, bottom is on
		const bool on = m_toggle_state == TS_AT_BOTTOM;

		if( !ShouldToggle( useType, on ) )
			return;

		if( m_toggle_state == TS_AT_TOP )
			GoDown();
		else if( m_toggle_state == TS_AT_BOTTOM )
			GoUp();
	}
	else
	{
		SetUse( NULL );

		if( m_toggle_state == TS_AT_TOP )
			GoDown();
	}
}
Esempio n. 10
0
void
on_goup_button_clicked                 (GtkToolButton   *toolbutton,
                                        gpointer         user_data)
{
	GoUp();
}