Exemplo n.º 1
0
public func RejectCollect(id idObj, object pObj)
{
  // Objekt ist Gold oder ein Sack voll Geld
  if(idObj != GOLD && idObj != MBAG) return();
  // Objekt wird von einem Clonk getragen
  if(Contained(pObj))
   if(GetOCF(Contained(pObj)) & OCF_CrewMember())
    {
    // Nicht für Banditen
    if(Contained(pObj)->~IsBandit()) return(Sound("Error", 1, 0, 0, GetOwner(pObj)+1));
    DoWealth(GetOwner(Contained(pObj)), GetValue(pObj));
    DoPoints(GetValue(pObj), GetOwner(Contained(pObj)));
    Sound("Cash", 1, 0,0, GetOwner(pObj));
    RemoveObject(pObj);
    return(1);
    }
}
Exemplo n.º 2
0
static unsigned MechDo( unsigned select, unsigned parm )
{
    unsigned long       size;
    unsigned            result = 0;
    DIPHDL( type, th );
    dip_type_info       info;
    mad_type_info       mti;

    switch( select ) {
    case 0:
        DoAssign();
        break;
    case 1:
        DoMul();
        break;
    case 2:
        DoDiv();
        break;
    case 3:
        DoMod();
        break;
    case 4:
        DoMinus();
        break;
    case 5:
        DoShift();
        break;
    case 6:
        DoAnd();
        break;
    case 7:
        DoXor();
        break;
    case 8:
        DoOr();
        break;
    case 9:
        DoAddr();
        break;
    case 10:
        ClassToTypeInfo( parm, &info );
        DoPoints( info.kind );
        break;
    case 11:
        DoField();
        break;
    case 12:
        DoCall( Num, parm );
        break;
    case 13:
        DoConvert();
        break;
    case 14:
        DoPlus();
        break;
    case 15:
        MakeAddr();
        break;
    case 16:
        result = TstEQ( parm );
        break;
    case 17:
        result = TstLT( parm );
        break;
    case 18:
        result = TstTrue( parm );
        break;
    case 19:
        result = TstExist( parm );
        break;
    case 20:
        size = ExprSP->info.size;
        PopEntry();
        PushNum( size );
        break;
    case 21:
        TypeBase( ExprSP->th, th, NULL, NULL );
        PopEntry();
        PushType( th );
        break;
    case 22:
        GetMADTypeDefault( MTK_ADDRESS, &mti );
        size = (mti.b.bits - mti.a.seg.bits) / BITS_PER_BYTE;
        if( parm ) {
            size += sizeof( addr_seg );
            TypePointer( ExprSP->th, TM_FAR, size, th );
        } else {
            TypePointer( ExprSP->th, TM_NEAR, size, th );
        }
        PopEntry();
        PushType( th );
        break;
    case 23:
        result = UserType( th );
        if( result ) {
            PopEntry();
            PushType( th );
        }
        break;
    case 24:
        DoMakeComplex();
        break;
    case 25:
        DoStringConcat();
        break;
    case 26:
        DoLConvert();
        break;
    case 27:
        DoPlusScaled();
        break;
    case 28:
        DoMinusScaled();
        break;
    case 29:
        DoPoints( TI_KIND_EXTRACT( parm ) );
        break;
    case 30:
        info.kind = TK_POINTER;
        info.size = TI_SIZE_EXTRACT( parm );
        info.modifier = TI_MOD_EXTRACT( parm );
        FillInDefaults( &info );
        TypePointer( ExprSP->th, info.modifier, info.size, th );
        PopEntry();
        PushType( th );
        break;
    case 31:
        if( parm ) {
            /* file scope */
            if( ExprSP->flags & SF_NAME ) {
                ExprSP->v.li.file_scope = TRUE;
            } else {
                Error( ERR_LOC, LIT( ERR_WANT_NAME ) );
            }
        } else {
            /* in a namespace */
            DoScope();
        }
        break;
    }
    return( result );
}
Exemplo n.º 3
0
/* HandleAvailable()
 * ===================================================================
 */
int
HandleAvailable( int button, WORD *msg )
{
   int     quit;
   int     dclick;
   FON_PTR curptr;

   
   dclick = FALSE;  
   quit   = FALSE;
      
   /* Handle Double-clicking of the objects */   
   if( ( button != -1 ) && ( button & 0x8000 ) )
   {
      button &= 0x7FFF;
      dclick = TRUE;
   }   
   
   switch( button )
   {
     case IEXIT:    Deselect( IEXIT );

		    ClearFnodes( installed_list );
		    ClearFnodes( available_list );

		    Reset_Tree( ad_front );     

		    CheckInstallAll( FALSE );
		    		    
                    mover_setup( installed_list, installed_count,
		                 FBASE, FSLIDER, FUP, FDOWN,
		  		 LINE0, LINE13, LINEBASE, 0, FRONT_HEIGHT );
		    HideObj( LINEBASE );	  		 
		    Objc_draw( tree, ROOT, MAX_DEPTH, NULL ); 
		    ShowObj( LINEBASE );
		    RedrawBase( tree, LINEBASE );
     		    break;

     case ILINE0:
     case ILINE1:
     case ILINE2:
     case ILINE3:
     case ILINE4:
     case ILINE5:
     case ILINE6:
     case ILINE7:
     case ILINE8:
     case ILINE9:
     case ILINE10:
     case ILINE11:
     case ILINE12:
     case ILINE13:  if( dclick )
     		    {
	              curptr = Active_Slit[ button - First_Obj ];
	              if( !curptr )
	      	          return( quit );	      
		      DoPoints( tree, button );
     		    }
     		    else
     		      mover_button( button, dclick );
     		    break;


     case IUP:
     case IDOWN:
     case IBASE:
     case ISLIDER:  mover_button( button, dclick );
		    break;


     case IINSTALL: if( IsChanged( available_list ) )
     		    {  
 		       /* ASK if we want it install these fonts first.*/
		       if( form_alert( 1, alert58 ) == 2 )
		       {
		           XDeselect( tree, IINSTALL );
		           return( quit );
		       }       
		       MoveToInstalled( FALSE );
     		    }   
    		    XDeselect( tree, IINSTALL );
     		    break;

     case ICONFIG:  Deselect( ICONFIG );
		    if( DoPoints( ad_inactive, 0 ))
		       XDeselect( tree, ICONFIG );
		    break;

     case ISELECT:  DoSelectAll();
		    XDeselect( tree, ISELECT );
     		    break;
     		    
     default:	 if( button == -1 )
     		 {
     		   switch( msg[0] )
     		   {
     		     case WM_REDRAW: 
     		     		     break;
     			     		     
     		     case AC_CLOSE:  quit = TRUE;
     		     		     break;
     				     		     
     		     case WM_CLOSED: quit = TRUE;
     		     		     CloseWindow();
				     break;

		     case CT_KEY:    if( msg[3] == UNDO )
				        Undo_Fnodes( available_list, ( FON_PTR )NULL );
		     		     break;
     		     default:
     		     		break;
     		   }
     		 }
     		 else
	           Undo_Fnodes( available_list, ( FON_PTR )NULL );
     		 break;
   }
   return( quit );

}
Exemplo n.º 4
0
//平滑由多个点组成的折线, 并把这些平滑的线画在DC上
void CSmooth::SmoothPolyLine( const CPoint* Pts, const int Count )
{
    double x, y, s( 0 );
    int i;
    int PointsCount( Count );
    CPoint* Points = new CPoint[Count];
    ptArray.RemoveAll();

    for( i = 0; i < Count; i++ )
        Points[i] = Pts[i];
    DoPoints( Points, PointsCount ); //规范化处理,剔除重复的点

    ssum = 0;
    ptArray.Add( Points[0] );	//往数组中添加一个元素

    // 点的个数不够,退出平滑处理
    if( PointsCount < 2 )
    {
        delete []Points;
        return;
    }

    // 两个点。
    if( PointsCount == 2 )
    {
        ptArray.Add( Points[1] );
        delete []Points;
        return;
    }

    // 只有三个点
    if( PointsCount == 3 )
    {
        CalcPara( 0, true, Points );
        ax0 = ax;
        bx0 = bx;
        cx0 = cx;
        ay0 = ay;
        by0 = by;
        cy0 = cy;
        si00 = si0;
        si10 = si1;
        si20 = si2;
        si30 = si3;
        do
        {
            s += dts;
            if ( s >= si20 ) s = si20;
            x = x1( s );
            y = y1( s );
            ptArray.Add( CPoint( ( int )x, ( int )y ) );
        }
        while( s < si20 );
        delete []Points;
        return;
    }

    //有四个或更多的点
    //绘制第一个和第二个点之间的曲线
    CalcPara( 0, true, Points );
    ax0 = ax;
    bx0 = bx;
    cx0 = cx;
    ay0 = ay;
    by0 = by;
    cy0 = cy;
    si00 = si0;
    si10 = si1;
    si20 = si2;
    do
    {
        s += dts;
        if ( s >= si10 ) s = si10;
        x = x1( s );
        y = y1( s );
        ptArray.Add( CPoint( ( int )x, ( int )y ) );
    }
    while( s < si10 );
    //绘制中间点的曲线
    for ( i = 0; i < PointsCount - 3; i++ )
    {
        CalcPara( i, true, Points );
        ax0 = ax;
        bx0 = bx;
        cx0 = cx;
        ay0 = ay;
        by0 = by;
        cy0 = cy;
        si00 = si0;
        si10 = si1;
        si20 = si2;
        si30 = si3;
        ssum = si10;
        CalcPara( i + 1, false, Points );

        s = si10;
        do
        {
            s += dts;
            if ( s >= si20 ) s = si20;
            x = a( s ) * x1( s ) + ( 1 - a( s ) ) * x2( s );
            y = a( s ) * y1( s ) + ( 1 - a( s ) ) * y2( s );
            ptArray.Add( CPoint( ( int )x, ( int )y ) );
        }
        while( s < si20 );
    }
    //绘制最后的点与倒数第二个点之间的曲线
    s = si20;
    do
    {
        s += dts;
        if ( s >= si2 ) s = si2;
        x = x2( s );
        y = y2( s );
        ptArray.Add( CPoint( ( int )x, ( int )y ) );
    }
    while( s < si2 );
    delete []Points;
}
Exemplo n.º 5
0
static ssl_value MechDo( unsigned select, ssl_value parm )
{
    unsigned long       size;
    ssl_value           result;
    DIPHDL( type, th );
    dig_type_info       ti;
    mad_type_info       mti;

    result = 0;
    switch( select ) {
    case 0:
        DoAssign();
        break;
    case 1:
        DoMul();
        break;
    case 2:
        DoDiv();
        break;
    case 3:
        DoMod();
        break;
    case 4:
        DoMinus();
        break;
    case 5:
        DoShift();
        break;
    case 6:
        DoAnd();
        break;
    case 7:
        DoXor();
        break;
    case 8:
        DoOr();
        break;
    case 9:
        DoAddr();
        break;
    case 10:
        ClassToTypeInfo( parm, &ti );
        DoPoints( ti.kind );
        break;
    case 11:
        DoField();
        break;
    case 12:
        DoCall( Num, SSL2BOOL( parm ) );
        break;
    case 13:
        DoConvert();
        break;
    case 14:
        DoPlus();
        break;
    case 15:
        MakeAddr();
        break;
    case 16:
        result = ( TstEQ( SSL2INT( parm ) ) != 0 );
        break;
    case 17:
        result = ( TstLT( SSL2INT( parm ) ) != 0 );
        break;
    case 18:
        result = ( TstTrue( SSL2INT( parm ) ) != 0 );
        break;
    case 19:
        result = ( TstExist( SSL2INT( parm ) ) != 0 );
        break;
    case 20:
        size = ExprSP->ti.size;
        PopEntry();
        PushNum( size );
        break;
    case 21:
        DIPTypeBase( ExprSP->th, th, NULL, NULL );
        PopEntry();
        PushType( th );
        break;
    case 22:
        GetMADTypeDefault( MTK_ADDRESS, &mti );
        size = BITS2BYTES( mti.b.bits - mti.a.seg.bits );
        if( parm ) {
            size += sizeof( addr_seg );
            DIPTypePointer( ExprSP->th, TM_FAR, size, th );
        } else {
            DIPTypePointer( ExprSP->th, TM_NEAR, size, th );
        }
        PopEntry();
        PushType( th );
        break;
    case 23:
        result = UserType( th );
        if( result ) {
            PopEntry();
            PushType( th );
        }
        break;
    case 24:
        DoMakeComplex();
        break;
    case 25:
        DoStringConcat();
        break;
    case 26:
        DoLConvert();
        break;
    case 27:
        DoPlusScaled();
        break;
    case 28:
        DoMinusScaled();
        break;
    case 29:
        DoPoints( TI_KIND_EXTRACT( parm ) );
        break;
    case 30:
        ti.kind = TK_POINTER;
        ti.size = TI_SIZE_EXTRACT( parm );
        ti.modifier = TI_MOD_EXTRACT( parm );
        ti.deref = false;
        FillInDefaults( &ti );
        DIPTypePointer( ExprSP->th, ti.modifier, ti.size, th );
        PopEntry();
        PushType( th );
        break;
    case 31:
        if( SSL2BOOL( parm ) ) {
            /* file scope */
            if( ExprSP->flags & SF_NAME ) {
                ExprSP->v.li.file_scope = true;
            } else {
                Error( ERR_LOC, LIT_ENG( ERR_WANT_NAME ) );
            }
        } else {
            /* in a namespace */
            DoScope();
        }
        break;
    }
    return( result );
}