예제 #1
0
void SinglePlayerTab::OnMapSelect(wxCommandEvent& /*unused*/)
{
	unsigned int index = (unsigned int)m_map_pick->GetCurrentSelection();
	SetMap(index);
}
예제 #2
0
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
{
    Map const* oldMap = GetMap();

    if (oldMap->GetId() != newMapid)
    {
        Map* newMap = sMapMgr->CreateBaseMap(newMapid);
        Map::PlayerList const& oldPlayers = GetMap()->GetPlayers();
        if (!oldPlayers.isEmpty())
        {
            UpdateData data;
            BuildOutOfRangeUpdateBlock(&data);
            WorldPacket packet;
            data.BuildPacket(&packet);
            for (Map::PlayerList::const_iterator itr = oldPlayers.begin(); itr != oldPlayers.end(); ++itr)
                if (itr->GetSource()->GetTransport() != this)
                    itr->GetSource()->SendDirectMessage(&packet);
        }

        UnloadStaticPassengers();
        GetMap()->RemoveFromMap<Transport>(this, false);
        SetMap(newMap);

        Map::PlayerList const& newPlayers = GetMap()->GetPlayers();
        if (!newPlayers.isEmpty())
        {
            for (Map::PlayerList::const_iterator itr = newPlayers.begin(); itr != newPlayers.end(); ++itr)
            {
                if (itr->GetSource()->GetTransport() != this)
                {
                    UpdateData data;
                    BuildCreateUpdateBlockForPlayer(&data, itr->GetSource());
                    WorldPacket packet;
                    data.BuildPacket(&packet);
                    itr->GetSource()->SendDirectMessage(&packet);
                }
            }
        }

        for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end();)
        {
            WorldObject* obj = (*itr++);

            switch (obj->GetTypeId())
            {
                case TYPEID_UNIT:
                    if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID()))  // pets should be teleported with player
                        obj->ToCreature()->FarTeleportTo(newMap, x, y, z, obj->GetOrientation());
                    break;
                case TYPEID_GAMEOBJECT:
                {
                    GameObject* go = obj->ToGameObject();
                    go->GetMap()->RemoveFromMap(go, false);
                    Relocate(x, y, z, go->GetOrientation());
                    SetMap(newMap);
                    newMap->AddToMap(go);
                    break;
                }
                case TYPEID_PLAYER:
                    if (!obj->ToPlayer()->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT))
                        _passengers.erase(obj);
                    break;
                default:
                    break;
            }
        }

        GetMap()->AddToMap<Transport>(this);
    }
    else
    {
        // Teleport players, they need to know it
        for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
            if ((*itr)->GetTypeId() == TYPEID_PLAYER)
                (*itr)->ToUnit()->NearTeleportTo(x, y, z, GetOrientation());
    }

    UpdatePosition(x, y, z, GetOrientation());
}
예제 #3
0
BOOL CStockContainer::RetrieveFromStatic( int nType, LPCTSTR lpszDomain, CStrategy * pStrategy, DWORD dwDate )
{
	CSPMutex::Scoped	l(m_mutex);

	Clear( );

	if( nType == typeNone )
	{
		m_nType	=	typeNone;
		return TRUE;
	}

	if( nType < typeMin || nType > typeMax )
		return FALSE;
	m_nType		=	nType;

	m_dwDate	=	dwDate;
	
	CSPStringArray	astrSpecify;

	switch( nType )
	{
	case typeAll:
		CopyData( AfxGetStockContainer() );
		break;
	case typeIndex:
	case typeA:
	case typeBond:
	case typeFund:
	case typeClassShaa:
	case typeClassShab:
	case typeClassSzna:
	case typeClassSznb:
	case typeClassShabond:
	case typeClassSznbond:
		{
			int	nCount	=	0;
			SetSize( 0, AfxGetStockContainer().GetSize() );
			for( int i=0; i<AfxGetStockContainer().GetSize(); i++ )
			{
				CStockInfo	& info = AfxGetStockContainer().ElementAt(i);
				LONG	stocktype	=	info.GetType();
				if( ( typeIndex == nType && CStock::typeshIndex == stocktype )
					|| ( typeIndex == nType && CStock::typeszIndex == stocktype )
					|| ( typeA == nType && (CStock::typeshA == stocktype || CStock::typeszA == stocktype) && !info.IsFund() )
					|| ( typeBond == nType && (CStock::typeshBond == stocktype || CStock::typeszBond == stocktype) )
					|| ( typeFund == nType && info.IsFund() )
					|| ( typeClassShaa == nType && CStock::typeshA == stocktype )
					|| ( typeClassShab == nType && CStock::typeshB == stocktype )
					|| ( typeClassSzna == nType && CStock::typeszA == stocktype )
					|| ( typeClassSznb == nType && CStock::typeszB == stocktype )
					|| ( typeClassShabond == nType && CStock::typeshBond == stocktype )
					|| ( typeClassSznbond == nType && CStock::typeszBond == stocktype ) )
				{
					Add( info );
					nCount	++;
				}
			}
			SetSize( nCount );
		}
		break;
	case typeStrategy:
		{
			if( pStrategy )
				RetrieveSpecify( pStrategy->GetStocks() );
		}
		break;
	case typeGroup:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetGroupContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetGroupContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	case typeDomain:
		{
			if( lpszDomain && strlen(lpszDomain) > 0 )
			{
				AfxGetDomainContainer().GetDomainStocks( lpszDomain, astrSpecify );
				RetrieveSpecify( astrSpecify );
				m_strDomain	=	lpszDomain;
			}
			else
				return AfxGetDomainContainer().GetAllDomainInfo( this, m_dwDate );
		}
		break;
	default:
		SP_ASSERT( FALSE );
		SetMap( );
		SetAverage( );
		return FALSE;
	}

	SetMap( );

	DWORD	dwMainDate = -1;
	AfxGetStockContainer().GetCurrentType( NULL, NULL, &dwMainDate );
	if( m_dwDate != dwMainDate )
		OnDataChanged();
	else
		SetAverage( );
	return TRUE;
}
예제 #4
0
/**
 *
 *  @author OLiver
 */
PreviewMinimap::PreviewMinimap(glArchivItem_Map *s2map)
{
	SetMap(s2map);
}
예제 #5
0
MenuOptions::MenuOptions(Settings *settings, Map *currentMap) {
    SetSettings(settings);
    SetMap(currentMap);
    InitMenu();
}
예제 #6
0
void CTextures::ChangeMap(unsigned int ID)
{
	ClearMap();
	SetMap(ID);
}
예제 #7
0
CMapCreator::CMapCreator(void)
{
	initMap(false);
	SetMap();
}
예제 #8
0
bool Corpse::Create(ObjectGuid::LowType guidlow, Map* map)
{
    SetMap(map);
    Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(map->GetId(), 0, guidlow));
    return true;
}
예제 #9
0
void ClearPasswordVaultContents()
{
   SetMap("PasswordVaultContents", QMap<QString,QString>());
}
예제 #10
0
void PasswordVaultContents(QMap<QString,QString> const& contents)
{
   SetMap("PasswordVaultContents", contents);
}
예제 #11
0
bool AreaTrigger::Create(uint32 spellMiscId, Unit* caster, Unit* target, SpellInfo const* spell, Position const& pos, int32 duration, uint32 spellXSpellVisualId, ObjectGuid const& castId, AuraEffect const* aurEff)
{
    _targetGuid = target ? target->GetGUID() : ObjectGuid::Empty;
    _aurEff = aurEff;

    SetMap(caster->GetMap());
    Relocate(pos);
    if (!IsPositionValid())
    {
        TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (spellMiscId %u) not created. Invalid coordinates (X: %f Y: %f)", spellMiscId, GetPositionX(), GetPositionY());
        return false;
    }

    _areaTriggerMiscTemplate = sAreaTriggerDataStore->GetAreaTriggerMiscTemplate(spellMiscId);
    if (!_areaTriggerMiscTemplate)
    {
        TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (spellMiscId %u) not created. Invalid areatrigger miscid (%u)", spellMiscId, spellMiscId);
        return false;
    }

    Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), GetTemplate()->Id, caster->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>()));

    SetEntry(GetTemplate()->Id);
    SetDuration(duration);

    SetObjectScale(1.0f);

    SetGuidValue(AREATRIGGER_CASTER, caster->GetGUID());
    SetGuidValue(AREATRIGGER_CREATING_EFFECT_GUID, castId);

    SetUInt32Value(AREATRIGGER_SPELLID, spell->Id);
    SetUInt32Value(AREATRIGGER_SPELL_FOR_VISUALS, spell->Id);
    SetUInt32Value(AREATRIGGER_SPELL_X_SPELL_VISUAL_ID, spellXSpellVisualId);
    SetUInt32Value(AREATRIGGER_TIME_TO_TARGET_SCALE, GetMiscTemplate()->TimeToTargetScale != 0 ? GetMiscTemplate()->TimeToTargetScale : GetUInt32Value(AREATRIGGER_DURATION));
    SetFloatValue(AREATRIGGER_BOUNDS_RADIUS_2D, GetTemplate()->MaxSearchRadius);
    SetUInt32Value(AREATRIGGER_DECAL_PROPERTIES_ID, GetMiscTemplate()->DecalPropertiesId);

    for (uint8 scaleCurveIndex = 0; scaleCurveIndex < MAX_AREATRIGGER_SCALE; ++scaleCurveIndex)
        if (GetMiscTemplate()->ScaleInfo.ExtraScale[scaleCurveIndex].AsInt32)
            SetUInt32Value(AREATRIGGER_EXTRA_SCALE_CURVE + scaleCurveIndex, GetMiscTemplate()->ScaleInfo.ExtraScale[scaleCurveIndex].AsInt32);

    PhasingHandler::InheritPhaseShift(this, caster);

    if (target && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
    {
        m_movementInfo.transport.guid = target->GetGUID();
    }

    UpdateShape();

    uint32 timeToTarget = GetMiscTemplate()->TimeToTarget != 0 ? GetMiscTemplate()->TimeToTarget : GetUInt32Value(AREATRIGGER_DURATION);

    if (GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_CIRCULAR_MOVEMENT))
    {
        AreaTriggerCircularMovementInfo cmi = GetMiscTemplate()->CircularMovementInfo;
        if (target && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
            cmi.PathTarget = target->GetGUID();
        else
            cmi.Center = pos;

        InitCircularMovement(cmi, timeToTarget);
    }
    else if (GetMiscTemplate()->HasSplines())
    {
        InitSplineOffsets(GetMiscTemplate()->SplinePoints, timeToTarget);
    }

    // movement on transport of areatriggers on unit is handled by themself
    Transport* transport = m_movementInfo.transport.guid.IsEmpty() ? caster->GetTransport() : nullptr;
    if (transport)
    {
        float x, y, z, o;
        pos.GetPosition(x, y, z, o);
        transport->CalculatePassengerOffset(x, y, z, &o);
        m_movementInfo.transport.pos.Relocate(x, y, z, o);

        // This object must be added to transport before adding to map for the client to properly display it
        transport->AddPassenger(this);
    }

    AI_Initialize();

    // Relocate areatriggers with circular movement again
    if (HasCircularMovement())
        Relocate(CalculateCircularMovementPosition());

    if (!GetMap()->AddToMap(this))
    {
        // Returning false will cause the object to be deleted - remove from transport
        if (transport)
            transport->RemovePassenger(this);
        return false;
    }

    caster->_RegisterAreaTrigger(this);

    _ai->OnCreate();

    return true;
}
예제 #12
0
파일: game.c 프로젝트: maimaris/arduino-2
void Task_Game (void)
{
    static      char    s_cKeys;        // Keyboard command
    static      char    s_cLastKeys = 0;// Previous command
    static      bit     bButton;        // Fire button state

    static near char    x, y, yy, xx;

                char    A,          // Object at porition X
                        B;          // Object style for A. These styles are calculated
                                    // once per cycle, to increase speed of GameStep
                char    A_top,      // Object above A
                        A_bottom,   // Object under A
                        A_move,     // Object at position where A wants move to.
        
                        B_top,      
                        B_bottom, 
                        B_move;

    static near char    s_cAction;  // Action performing on moving object

    static      bit     bDirChanged;// Addition flag for fireflies and butterflies
                                    // to change direction of moving
    static      bit     bBangJewel; // This bit tells that jewel should appear after bang
    static near char    s_cSound;   // Sound type on current stage

    static near char    n,m;        // addition temp variables
    static near char    temp;
    


    //for (;;)
    {
        OS_Bsem_Set(BS_MAP_FREE);       // Free "Map" resource

        OS_Flag_Wait_11(i_cStep, 0x08); // Run every eight VGA-cadr
        OS_Flag_Set_0(i_cStep, 0x08);

        OS_Bsem_Wait(BS_MAP_FREE);      // Wait for resource "Map" became free
        
        s_cKeys = 0;
        bButton = 0;


        //------------------------------------------------------------------------------
        // All button pressed: Restart level
        //------------------------------------------------------------------------------
    
        if (BUTTON_UP && BUTTON_LEFT && BUTTON_RIGHT && BUTTON_DOWN) 
        {    
            if (m_bAlive)
            {
                m_bAlive = false;
                m_bEnd = true;
                m_Map[m_cManY][m_cManX] = OBJECT_BANG;
                str_cpy(m_strStatusBar, STR_GAME_OVER);
            }    
        }
        
        //------------------------------------------------------------------------------
        //  Fire button after dead - reborn
        //------------------------------------------------------------------------------

        if (BUTTON_FIRE && m_bEnd) 
        {
            if (BUTTON_UP && BUTTON_LEFT && BUTTON_RIGHT && BUTTON_DOWN) 
            {    
                m_cCurMap++;
                if (m_cCurMap >= NUMBER_OF_MAPS) m_cCurMap = 0;
                InitMap(m_cCurMap);
            }
            if (!BUTTON_UP && !BUTTON_LEFT && !BUTTON_RIGHT && !BUTTON_DOWN) InitMap(m_cCurMap);
            
        }



        //------------------------------------------------------------------------------
        //  When man alive, check keyoard and make the man run
        //------------------------------------------------------------------------------
        
        if (m_bAlive)
        {
            OS_Bsem_Set(BS_MUSIC_START);            // First time music can start only
                                                    // after born
            
            if (BUTTON_UP)     s_cKeys = 1;
            if (BUTTON_DOWN)   s_cKeys = 2;
            if (BUTTON_LEFT)   s_cKeys = 3;
            if (BUTTON_RIGHT)  s_cKeys = 4;
            if (BUTTON_FIRE)   bButton = 1;
            

            // Select man picture: standing, running left, running right
            temp = 0;
            switch (s_cKeys & 0xF)
            {
                case 0:     
                    temp = OBJECT_MAN | (((i_wRandom & 7) == 7)?1:0);    
                    break;
                case 1:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_LEFT_MAN  | MOVING | DIR_UP;
                    break; 

                case 2:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_RIGHT_MAN | MOVING | DIR_DOWN; 
                    break;

                case 3:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_LEFT_MAN  | MOVING | DIR_LEFT; 
                    break;

                case 4:     
                    if (s_cLastKeys != s_cKeys) temp = OBJECT_RIGHT_MAN | MOVING | DIR_RIGHT;
                    break;
            }

            if (temp) SetMap(m_cManY, m_cManX, temp);

        } else {            // Man is not born yet
            m_cBornTimer--;
        }

        s_cLastKeys = s_cKeys;   


        //------------------------------------------------------------------------------
        //  Make window position correction
        //------------------------------------------------------------------------------
        
        if (m_bScrMovedX)
        {
            m_bScrMovedX = false;
            if (!s_cKeys) CorrectWindowPositionX(5);
        }

        if (m_bScrMovedY)
        {
            m_bScrMovedY = false;
            if (!s_cKeys) CorrectWindowPositionY(4);
        }

        OS_Yield();

        s_cSound = 0;

        //------------------------------------------------------------------------------
        //  Check all elements in map
        //------------------------------------------------------------------------------

        for (y = 18; y > 0; y--)
        {    
            OS_Yield();

            for (x = 38; x > 0; x--)
            {
                
                CLRWDT();
                bDirChanged = false;
                bBangJewel = false;
                
            RETRY:
                A        = GetMap(y, x);

                if (A == (OBJECT_SPACE | 0x80)) // When object SPACE have bit 7 set, 
                {                               // nither boulder nor jewel can fall here
                    SetMap(y,x, OBJECT_SPACE);  // This state of SPACE can be active 
                    continue;                   // per one game step only.
                }
                if (A == OBJECT_SPACE) continue;
                if (A == OBJECT_WALL) continue;
                if (A == OBJECT_DIRT) continue;

                B        = Object(A);

                //******************************************************************************
                if (A & MOVING)         // Check moving object
                //******************************************************************************
                {
                    xx = x;             // Calculate position to move to
                    yy = y;
                    switch (A & DIR_MASK)
                    {
                        //------------------------------------------------------------------------------
                        case DIR_UP: 
                        //------------------------------------------------------------------------------
                            yy--;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_DOWN: 
                        //------------------------------------------------------------------------------
                            yy++;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_LEFT: 
                        //------------------------------------------------------------------------------
                            xx--;
                            break;

                        //------------------------------------------------------------------------------
                        case DIR_RIGHT: 
                        //------------------------------------------------------------------------------
                            xx++;
                            break;
                    }

                    // Point where object moves to
                    A_move = GetMap(yy, xx);    
                    B_move = Object(A_move);
                        
                    //**************************************************************************
                    //  Check what the action should we do
                    //**************************************************************************
                    
                    s_cAction = ACTION_NO_ACTION;

                    switch (B)
                    {
                    //------------------------------------------------------------------------------
                    case OBJECT_MAN:        // man
                    case OBJECT_MAN_EYES:   // man
                    case OBJECT_LEFT_MAN:   // man
                    case OBJECT_RIGHT_MAN:  // man

                        //------------------------------------------------------------------------------
                        //  Check for push boulder
                        //------------------------------------------------------------------------------
                        if (B_move == OBJECT_BOULDER)
                        {
                            if (y != yy) break;
                            if (x > xx && GetMap(y,xx-1)==OBJECT_SPACE) s_cAction = ACTION_PUSH;
                            if (x < xx && GetMap(y,xx+1)==OBJECT_SPACE) s_cAction = ACTION_PUSH;
                        }


                        if (B_move == OBJECT_TIT_WALL)
                        {      
                            // Check for HOME and there is enough jewels
                            if ((A_move & 0x80) && (m_cJewels >= m_cNeededJewels)) 
                            {    
                                s_cAction = ACTION_GO_HOME; 
                            }
                            break;
                        }

                        if (B_move == OBJECT_WALL)      s_cAction = ACTION_NO_ACTION;
                        if (B_move == OBJECT_SPACE)     s_cAction = ACTION_CAN_MOVE;
                        if (B_move == OBJECT_DIRT)      s_cAction = ACTION_EAT_DIRT;
                        if (B_move == OBJECT_BANG)      s_cAction = ACTION_NO_ACTION;
                        if (B_move == OBJECT_JEWEL)     s_cAction = ACTION_EAT_JEWEL;


                        break;

                    //------------------------------------------------------------------------------
                    case OBJECT_BUTTERFLY:
                    case OBJECT_FIREFLY:

                        //------------------------------------------------------------------------------
                        // Check for man touching
                        //------------------------------------------------------------------------------
                        
                        if (m_bAlive)
                        {
                            if ((m_cManY == y && (m_cManX == (x+1) || m_cManX == (x-1))) ||
                                (m_cManX == x && (m_cManY == (y+1) || m_cManY == (y-1))))
                            {
                                // Set bang position
                                m_cBangX = m_cManX;
                                m_cBangY = m_cManY;
                                s_cAction = ACTION_BANG;
                                if (B == OBJECT_BUTTERFLY) s_cAction = ACTION_BANG_JEWEL;
                                break;
                            }
                        }

                        if (B_move == OBJECT_SPACE) 
                        {    
                            s_cAction = ACTION_CAN_MOVE;
                            break;
                        }

                        //------------------------------------------------------------------------------
                        //  When firefly and butterfly meat face to face, they just 
                        //  replaced one by one (they should be moved in opposit directions
                        //------------------------------------------------------------------------------
                        
                        if (B_move == OBJECT_FIREFLY || B_move == OBJECT_BUTTERFLY)
                        {
                            if (B != B_move) if (((A^A_move) & DIR_MASK)==0x80) 
                            {
                                s_cAction = ACTION_EXCHANGE;
                                break;
                            }
                        }

                        //------------------------------------------------------------------------------
                        // Check for falling boulder or jewel above
                        //------------------------------------------------------------------------------
                        
                        A_top = GetMap(y-1, x);
                        B_top = A_top & 0x1F;

                        if (B_top == OBJECT_BOULDER || (B_top & 0x1C)== OBJECT_JEWEL )
                        {
                            if ((A_top & MOVING)) 
                            {    
                                s_cAction = ACTION_STOP_FLY;
                                break;
                            }
                        }
                        
                        s_cAction = ACTION_DEC_DIRECTION;
                        if (B == OBJECT_BUTTERFLY) s_cAction = ACTION_INC_DIRECTION;
                        break;

                    //------------------------------------------------------------------------------
                    case OBJECT_BOULDER:
                    case OBJECT_JEWEL:

                        m_cBangX = x;
                        m_cBangY = y + 1;
                        s_cAction = ACTION_STOP_MOVE;
                        B_bottom = Object(GetMap(y+1, x));
                        if (B_bottom == OBJECT_SPACE)     s_cAction = ACTION_CAN_MOVE;
                        if (B_bottom == OBJECT_MAN)       s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_LEFT_MAN)  s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_RIGHT_MAN) s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_FIREFLY)   s_cAction = ACTION_BANG;
                        if (B_bottom == OBJECT_BUTTERFLY) s_cAction = ACTION_BANG_JEWEL;
                        break;

                    }   // switch (B)
                    

                    //******************************************************************************
                    //  Now we have a variable s_cAction which contains what should we do
                    //******************************************************************************


                    switch (s_cAction)
                    {
                        //------------------------------------------------------------------------------
                        case ACTION_NO_ACTION:  
                        //------------------------------------------------------------------------------
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_PUSH:
                        //------------------------------------------------------------------------------

                            if (i_wRandom & 3) break;
                            if (x > xx) SetMap(y, xx-1, OBJECT_BOULDER);
                            if (x < xx) SetMap(y, xx+1, OBJECT_BOULDER);
    
                            if (s_cSound < GAME_SOUND_PUSH) s_cSound = GAME_SOUND_PUSH;
    
                            goto MOVE;
                
                
                        //------------------------------------------------------------------------------
                        case ACTION_EAT_JEWEL:
                        //------------------------------------------------------------------------------

                            m_cJewels++;
                            if (m_cJewels == m_cNeededJewels) 
                            {    
                                m_bBlink = 1;
                                if (s_cSound < GAME_SOUND_COMPLETE) s_cSound = GAME_SOUND_COMPLETE;
                            }
                            if (s_cSound < GAME_SOUND_EAT_JEWEL) s_cSound = GAME_SOUND_EAT_JEWEL;
                            goto MOVE;
                
                        //------------------------------------------------------------------------------
                        case ACTION_GO_HOME:
                        //------------------------------------------------------------------------------

                            m_bAlive = 0;
                            m_bEnd = 1;
                            str_cpy(m_strStatusBar, STR_YOU_WIN);
                            A &= ~MOVING;
                            SetMap(y, x, A);

                            m_cCurMap++;
                            if (m_cCurMap >= NUMBER_OF_MAPS) m_cCurMap = 0;

                            if (s_cSound < GAME_SOUND_HOME) s_cSound = GAME_SOUND_HOME;
                            goto MOVE;
                    
                        
                        //------------------------------------------------------------------------------
                        case ACTION_EAT_DIRT:
                        //------------------------------------------------------------------------------
                            if (s_cSound < GAME_SOUND_EAT_DIRT) s_cSound = GAME_SOUND_EAT_DIRT;
                            goto MOVE;

                        //------------------------------------------------------------------------------
                        case ACTION_CAN_MOVE:
                        //------------------------------------------------------------------------------
                MOVE:
                            SetMap(y, x, OBJECT_SPACE);
                            
                            if (x == m_cManX && y == m_cManY) 
                            {
                                if (bButton && m_cManX==x && m_cManY==y)
                                {
                                    SetMap(yy, xx, OBJECT_SPACE);
                                    xx = x;
                                    yy = y;
                                }

                                m_cManX = xx;
                                m_cManY = yy;
                                
                                CorrectWindowPositionX(2);
                                CorrectWindowPositionY(2);
                                
                                if (s_cSound < GAME_SOUND_STEP) s_cSound = GAME_SOUND_STEP;
                            }

                            if (yy < y || xx < x) A &= ~MOVING; // To prevent multiply moving
                                                                // of same object


                            if (B == OBJECT_BUTTERFLY)  A -= 0x40;
                            if (B == OBJECT_FIREFLY)    A += 0x40;
                            SetMap(yy, xx, A);
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_EXCHANGE:
                        //------------------------------------------------------------------------------
                            SetMap(y, x, A_move);
                            SetMap(yy, xx, A);
                            break;
                
                        //------------------------------------------------------------------------------
                        case ACTION_INC_DIRECTION:
                        //------------------------------------------------------------------------------
                            if (!bDirChanged)
                            {
                                A += 0x40;
                                SetMap(y, x, A);
                                bDirChanged = true;
                                goto RETRY;
                            }
                            break;
                        //------------------------------------------------------------------------------
                        case ACTION_DEC_DIRECTION:
                        //------------------------------------------------------------------------------
                            if (!bDirChanged)
                            {
                                A -= 0x40;
                                SetMap(y, x, A);
                                bDirChanged = true;
                                goto RETRY;
                            }
                            break;
                    
                        //------------------------------------------------------------------------------
                        case ACTION_STOP_MOVE:
                        //------------------------------------------------------------------------------
                            A &= ~MOVING;
                            SetMap(y, x, A);
                            if (B == OBJECT_JEWEL)
                            {
                                if (s_cSound < GAME_SOUND_JEWEL_FELD) s_cSound = GAME_SOUND_JEWEL_FELD;
                            } else {
                                if (s_cSound < GAME_SOUND_BOULDER_FELD)s_cSound = GAME_SOUND_BOULDER_FELD; 
                            }
                            goto RETRY;
                    
                        //------------------------------------------------------------------------------
                        case ACTION_STOP_FLY:
                        //------------------------------------------------------------------------------
                            A &= ~MOVING;
                            SetMap(y, x, A);
                            break;
                    
                    
                        //------------------------------------------------------------------------------
                        case ACTION_BANG_JEWEL:
                        //------------------------------------------------------------------------------
                            if (s_cSound < GAME_SOUND_BANG_JEWEL) s_cSound = GAME_SOUND_BANG_JEWEL;
                            bBangJewel = true;
                            
                        //------------------------------------------------------------------------------
                        case ACTION_BANG:
                        //------------------------------------------------------------------------------
                            if (!bBangJewel) 
                                if (s_cSound < GAME_SOUND_BANG) s_cSound = GAME_SOUND_BANG;

                            for (n = m_cBangX - 1; n <= m_cBangX + 1; n++) 
                            {        
                                for (m = m_cBangY-1; m <= m_cBangY+1; m++)
                                {
                                    if (GetMap(m, n) != OBJECT_TIT_WALL)
                                    {
                                        if (n == m_cManX && m == m_cManY) 
                                        { 
                                            if (!m_bAlive) continue;   
                                            m_bAlive = 0;
                                            m_bEnd = true;
                                            str_cpy(m_strStatusBar, STR_GAME_OVER);
                                        }
                                        temp =  OBJECT_BANG;
                                        if (bBangJewel) temp |= 0x80;
                                        SetMap(m, n, temp);
                                        
                                    };
                                }
                            }    
                            break;
                    };  // switch s_cAction

                //******************************************************************************
                } else {            // not MOVING object
                //******************************************************************************

                    switch (B)
                    {
                        //------------------------------------------------------------------------------
                        case OBJECT_LEFT_MAN:   // Restore moving state to objects that should move
                        case OBJECT_RIGHT_MAN:  
                             if (!m_bAlive) break;
                        case OBJECT_BUTTERFLY:  
                        case OBJECT_FIREFLY:;   

                             m_Map[y][x] |= MOVING;
                             break;

                        //------------------------------------------------------------------------------
                        case OBJECT_BOULDER:
                        case OBJECT_JEWEL:

                            B_bottom = Object(A_bottom = GetMap(y+1, x));

                            if (B_bottom == OBJECT_SPACE)   // Check for start falling down
                             {
                                 A |= MOVING;
                                 A |= DIR_DOWN;
                                 SetMap(y, x, A);
                             } else {

                                 // Check for falling from a boulder, a jewel or a wall
                                 
                                 if ((B_bottom == OBJECT_BOULDER || 
                                      B_bottom == OBJECT_WALL || 
                                      B_bottom == OBJECT_JEWEL) && !(A_bottom & MOVING))
                                 {

                                     if (GetMap(y  ,x-1) == OBJECT_SPACE && 
                                         GetMap(y+1,x-1) == OBJECT_SPACE)
                                     {
                                         temp = Object(GetMap(y-1, x-1));
                                         // Не даем камню уйти влево, если что-то
                                         // должно падать сверху
                                         if (temp == OBJECT_BOULDER) break;
                                         if (temp == OBJECT_JEWEL)   break;
                    
                                         SetMap(y, x-1, A); // Здесь не нужно ставить флаг 
                                                            // движения, т.к. эта клетка будет
                                                            // преверена следюущим же шагом (т.к.
                                                            // просматриваем справа налево)
                                                                   
                                         SetMap(y,x, OBJECT_SPACE | 0x80);  // Признак того, что 
                                                                            // пока еще нельзя 
                                                                            // ронять сюда камень 
                                         break;
                                     }

                                     if (GetMap(y  ,x+1) == OBJECT_SPACE && 
                                         GetMap(y+1,x+1) == OBJECT_SPACE) 
                                     {
                                         temp = Object(GetMap(y-1,x+1));
                                         // Не даем камню уйти влево, если что-то
                                         // должно падать сверху
                                         if (temp == OBJECT_BOULDER) break;
                                         if (temp == OBJECT_JEWEL)   break;
                    
                                         SetMap(y,x+1, A | MOVING | DIR_DOWN);
                                         SetMap(y,x, OBJECT_SPACE | 0x80);
                                         break;
                                     }
                                 }
                             }
                             break;
                            
                        //------------------------------------------------------------------------------
                        case OBJECT_HOME:
                        case OBJECT_TIT_WALL:

                            if ((A & 0x80) && (m_cNeededJewels <= m_cJewels))
                            {
                    
                            }
                            if ((A & 0x40) && !m_cBornTimer)
                            {
                                SetMap(y,x, OBJECT_BANG | 0x40);
                                if (s_cSound < GAME_SOUND_BORN) s_cSound = GAME_SOUND_BORN;
                            }
                            break;
                    }   // switch (B)

                
                    if ((A & 0x1F) == (OBJECT_BANG | 3))    // last stage of bang
                    {
                        if (A & 0x40)           // Borning
                        {
                            A = OBJECT_MAN;
                            m_cManX = x;
                            m_cManY = y;
                            m_bAlive = 1;
                        } else {
                            if (A & 0x80)   A = OBJECT_JEWEL;   // Bang with jewels
                            else            A = OBJECT_SPACE;   // Bang without jewels
                        }
                        SetMap(y, x, A);
                    }

                //******************************************************************************
                }   // MOVING
                //******************************************************************************
            }   // for x
        }   // for y

        if (s_cSound) OS_SMsg_Send_Now(smsg_GameSound, s_cSound);
        if (m_bAlive) MakeStatusBar();
    }
}
예제 #13
0
int ParseTextEnd(ClientData, Tcl_Interp *interp,
              int, char**)
{
    Token tokens__[MAX_TOKNS] = { TOKEN_END, 0 };
    Token* tokens_ = tokens__;
    int num = 0;
    int max_num = MAX_TOKNS;
    
    Tcl_Eval(interp, "$CVEnv::curframe get 1.0 end");

    int len = strlen(interp->result);
    if(!len) return 0;
    char* text = new char[len + 1];
    assert(text);
    char* map  = new char[len + 1];
    assert(map);

    strcpy(text, interp->result);

    if(old_text && !strcmp(text, old_text)) goto end;

    {
    if(!old_text) {old_text = new char[1]; *old_text = 0;}
    if(!old_map) {old_map = new char[1]; *old_map = TOKEN_END;}

    assert(*old_map <= TOKEN_END);

    Lexer lexer;
    Token* tokens = tokens_;
    Token token;
    Token prev_token = { TOKEN_END, 0 };

    InitLexer( &lexer, text );
    lexer.pos = 0;

    for(num = 0;;)
    {
        GetToken( &lexer, &token );
        if( token.type != prev_token.type )
        {
            tokens_[num] = token;
            prev_token = token;
            num++;
            if(num >= max_num)
            {
                max_num *= 2;
                Token* tokens_tmp = new Token[max_num];
                assert(tokens_tmp);
                for(int i = 0; i < num; i++) tokens_tmp[i] = tokens_[i];
                if(tokens_ != tokens__) delete tokens_;
                tokens_ = tokens_tmp;
            }
        }
        if( token.type == TOKEN_END ) break;
    }

    assert(*old_map <= TOKEN_END);

    int len = strlen(text);
    int old_len = strlen(old_text);

    SetMap(map, tokens_, num);
    // finding first & last changed tokens
    int first;
    int last;
    for(first = 0; map[first] == old_map[first]; first++);
    for(last = len - 1; map[last] == old_map[max(0, last + (old_len - len))]; last--);

    if(first > last) swap(first, last);

    int first_t = GetTokenFromPos(first, tokens_, num);
    int last_t = GetTokenFromPos(last, tokens_, num);

    if(first == len)
        goto end2;

    char command[1000];

    char* normal  = new char[len * strlen("\"0.0 + 0000000 chars\" \"0.0 + 0000000 chars\" ")];
    char* comment = new char[len * strlen("\"0.0 + 0000000 chars\" \"0.0 + 0000000 chars\" ")];
    char* strng  = new char[len * strlen("\"0.0 + 0000000 chars\" \"0.0 + 0000000 chars\" ")];
    char* keyword = new char[len * strlen("\"0.0 + 0000000 chars\" \"0.0 + 0000000 chars\" ")];
    char* number  = new char[len * strlen("\"0.0 + 0000000 chars\" \"0.0 + 0000000 chars\" ")];

    assert( normal && comment && strng && keyword && number );
    strcpy( normal, "$CVEnv::curframe tag add normal " );
    strcpy( comment, "$CVEnv::curframe tag add comment " );
    strcpy( strng, "$CVEnv::curframe tag add string " );
    strcpy( keyword, "$CVEnv::curframe tag add keyword " );
    strcpy( number, "$CVEnv::curframe tag add number " );

    sprintf(command, "ClearColors %d %d $CVEnv::curframe", first, last);
    Tcl_Eval(interp, command);
    assert(*interp->result == 0);

    tokens = tokens_;
    for( int t = first_t; t <=last_t; t++ )
    {
        char pos[60];
        sprintf(pos, "\"0.0 + %d chars\" \"0.0 + %d chars\" ", tokens[t].start, tokens[t + 1].start);
        switch(tokens[t].type)
        {
        case TOKEN_COMMENT:
            strcat(comment, pos);
            break;
        case TOKEN_STRING:
            strcat(strng, pos);
            break;
        case TOKEN_KEYWORD:
            strcat(keyword, pos);
            break;
        case TOKEN_NUMBER:
            strcat(number, pos);
            break;
        case TOKEN_END:
            goto end2;
            break;
        default:
            strcat(normal, pos);
            break;
        }
    }
    if(strlen(normal) > 34)
    {
        Tcl_Eval(interp, normal);
        assert(*interp->result == 0);
    }
    if(strlen(comment) > 34)
    {
        Tcl_Eval(interp, comment);
        assert(*interp->result == 0);
    }
    if(strlen(strng) > 34)
    {
        Tcl_Eval(interp, strng);
        assert(*interp->result == 0);
    }
    if(strlen(number) > 34)
    {
        Tcl_Eval(interp, number);
        assert(*interp->result == 0);
    }
    if(strlen(keyword) > 34)
    {
        Tcl_Eval(interp, keyword);
        assert(*interp->result == 0);
    }

    delete normal;
    delete comment;
    delete strng;
    delete keyword;
    delete number;
    }
end2:
    if(old_map) delete old_map;
    old_map = map;
end:
    if(old_text) delete old_text;
    old_text = text;
    if(tokens_ != tokens__) delete tokens_;
    return 0;
}
예제 #14
0
bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z, float o)
{
    Map const* oldMap = GetMap();

    if (oldMap->GetId() != newMapid)
    {
        Map* newMap = sMapMgr->CreateBaseMap(newMapid);
        UnloadStaticPassengers();
        GetMap()->RemoveFromMap<Transport>(this, false);
        SetMap(newMap);

        for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end();)
        {
            WorldObject* obj = (*itr++);

            float destX, destY, destZ, destO;
            obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
            TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);

            switch (obj->GetTypeId())
            {
                case TYPEID_UNIT:
                    if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID()))  // pets should be teleported with player
                        obj->ToCreature()->FarTeleportTo(newMap, destX, destY, destZ, destO);
                    break;
                case TYPEID_GAMEOBJECT:
                {
                    GameObject* go = obj->ToGameObject();
                    go->GetMap()->RemoveFromMap(go, false);
                    go->Relocate(destX, destY, destZ, destO);
                    go->SetMap(newMap);
                    newMap->AddToMap(go);
                    break;
                }
                case TYPEID_PLAYER:
                    if (!obj->ToPlayer()->TeleportTo(newMapid, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
                        _passengers.erase(obj);
                    break;
                case TYPEID_DYNAMICOBJECT:
                    obj->AddObjectToRemoveList();
                    break;
                default:
                    break;
            }
        }

        Relocate(x, y, z, o);
        UpdateModelPosition();
        GetMap()->AddToMap<Transport>(this);
        return true;
    }
    else
    {
        // Teleport players, they need to know it
        for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
        {
            if ((*itr)->GetTypeId() == TYPEID_PLAYER)
            {
                float destX, destY, destZ, destO;
                (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
                TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);

                (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
            }
        }

        UpdatePosition(x, y, z, o);
        return false;
    }
}
예제 #15
0
MenuMapOptions::MenuMapOptions(std::shared_ptr<Settings> &settings, std::shared_ptr<AcedSharedDLL::Map> &currentMap) : Menu((std::shared_ptr<AcedSharedDLL::BaseSettings>)settings) {
	SetMap(currentMap);

	SetMenuHeader(std::string("Map Options"));
	SetId(AcedSharedDLL::STATES::EDITORMAPOPTIONS);
	int widestItem = settings->GetFontWidth(GetMenuHeader());

	auto itemStoreCurrentWidth = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreCurrentWidth->SetMenuItemText(std::string("Current Width:"));

	//might need to delete this tempval char array? mmm looks to be in stack so should die when method finishs....
	std::string tempVal;
	tempVal = std::to_string(GetMap()->GetMapWidth());

	itemStoreCurrentWidth->InitMenuItemProperty(tempVal);
	itemStoreCurrentWidth->SetMenuItemTargetable(false);
	if (widestItem < settings->GetFontWidth(itemStoreCurrentWidth->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreCurrentWidth->GetMenuItemText());
	}
	AddMenuItem(itemStoreCurrentWidth);





	auto itemStoreNewWidth = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreNewWidth->InitMenuItemProperty("");
	itemStoreNewWidth->SetOptionId(AcedSharedDLL::OPTIONTYPES::WIDTHOPTION);
	itemStoreNewWidth->SetMenuItemText(std::string("New Width:"));
	if (widestItem < settings->GetFontWidth(itemStoreNewWidth->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreNewWidth->GetMenuItemText());
	}
	AddMenuItem(itemStoreNewWidth);




	auto itemStoreCurrentHeight = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreCurrentHeight->SetMenuItemText(std::string("Current Height:"));

	tempVal = std::to_string(GetMap()->GetMapHeight());

	itemStoreCurrentHeight->InitMenuItemProperty(tempVal);
	itemStoreCurrentHeight->SetMenuItemTargetable(false);
	if (widestItem < settings->GetFontWidth(itemStoreCurrentHeight->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreCurrentHeight->GetMenuItemText());
	}
	AddMenuItem(itemStoreCurrentHeight);






	auto itemStoreNewHeight = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreNewHeight->InitMenuItemProperty("");
	itemStoreNewHeight->SetOptionId(AcedSharedDLL::OPTIONTYPES::HEIGHTOPTION);
	itemStoreNewHeight->SetMenuItemText(std::string("New Height:"));
	if (widestItem < settings->GetFontWidth(itemStoreNewHeight->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreNewHeight->GetMenuItemText());
	}
	AddMenuItem(itemStoreNewHeight);




	auto itemStoreSave = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreSave->SetId(AcedSharedDLL::STATES::SAVE);
	itemStoreSave->SetMenuItemText(std::string("Save"));
	if (widestItem < settings->GetFontWidth(itemStoreSave->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreSave->GetMenuItemText());
	}
	AddMenuItem(itemStoreSave);

	auto itemStoreReturn = std::shared_ptr<AcedSharedDLL::MenuItem>(new AcedSharedDLL::MenuItem());
	itemStoreReturn->SetId(AcedSharedDLL::STATES::RETURN);
	itemStoreReturn->SetMenuItemText(std::string("Return"));
	if (widestItem < settings->GetFontWidth(itemStoreReturn->GetMenuItemText())) {
		widestItem = settings->GetFontWidth(itemStoreReturn->GetMenuItemText());
	}
	AddMenuItem(itemStoreReturn);

	widestItem += (AcedSharedDLL::Constants::TileSize() * 4);

	SetMenuX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4));
	SetMenuY(100);

	SetMenuHeaderX((settings->GetScreenWidth() / 2) - (widestItem / 2) - (AcedSharedDLL::Constants::TileSize() * 4));
	SetMenuHeaderY(50 + AcedSharedDLL::Constants::TileSize());
	SetMenuHeaderHeight(50 - AcedSharedDLL::Constants::TileSize());

	int i = 0;
	int xloc = settings->GetScreenWidth() / 2;
	int yloc = 100 + AcedSharedDLL::Constants::TileSize();
	int yspacing = AcedSharedDLL::Constants::TileSize() * 2;

	auto menuSize = GetMenuItems().size();
	for (i = 0; i < menuSize; i++)
	{
		GetMenuItems()[i]->SetMenuItemX(xloc);
		GetMenuItems()[i]->SetMenuItemPropertyX(xloc + (settings->GetFontWidth(GetMenuItems()[i]->GetMenuItemText()) / 2) + (AcedSharedDLL::Constants::TileSize() * 1));
		GetMenuItems()[i]->SetMenuItemY(yloc);
		yloc = yloc + yspacing;
	}

	SetMenuWidth(settings->GetScreenWidth() - (2 * GetMenuX()));
	SetMenuHeaderWidth(settings->GetScreenWidth() - (2 * GetMenuX()));
	SetMenuHeight(yloc - GetMenuY());

	SetCurrentSelection();
}
예제 #16
0
bool Corpse::Create(uint32 guidlow, Map *map)
{
    SetMap(map);
    Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
    return true;
}
예제 #17
0
Pathfinding::Pathfinding(Mat map, bool _diagonal) {

	InitValues();
	SetMap(map);
	diagonal = _diagonal;
}
예제 #18
0
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, const CreatureData *data)
{
    SetMap(map);
    SetPhaseMask(phaseMask,false);

    CreatureInfo const *cinfo = sObjectMgr.GetCreatureTemplate(Entry);
    if(!cinfo)
    {
        sLog.outErrorDb("Creature entry %u does not exist.", Entry);
        return false;
    }

    Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);

    if(!UpdateEntry(Entry, team, data))
        return false;

    if(!vehicleId)
    {
        CreatureDataAddon const *cainfo = GetCreatureAddon();
        if(!cainfo)
            return false;
        vehicleId = cainfo->vehicle_id;
    }
    if(!SetVehicleId(vehicleId))
        return false;

    LoadCreaturesAddon();

    m_regenHealth = false;
    m_creation_time = getMSTime();

    SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
    //RemoveMonsterMoveFlag(MONSTER_MOVE_WALK);

    //Notify the map's instance data.
    //Only works if you create the object in it, not if it is moves to that map.
    //Normally non-players do not teleport to other maps.
    if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
    {
        ((InstanceMap*)map)->GetInstanceData()->OnCreatureCreate(this);
    SetHealth(GetMaxHealth());
    }
    
    if(m_vehicleInfo->m_powerType == POWER_TYPE_STEAM)
    {
        setPowerType(POWER_ENERGY);
        SetMaxPower(POWER_ENERGY, 100);
        SetPower(POWER_ENERGY, 100);
    }
    else if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE)
    {
        setPowerType(POWER_ENERGY);
        SetMaxPower(POWER_ENERGY, 50);
        SetPower(POWER_ENERGY, 50);
    }
    else
    {
        for (uint32 i = 0; i < MAX_VEHICLE_SPELLS; ++i)
        {
            if(!GetVehicleData()->v_spells[i])
                continue;
            SpellEntry const *spellInfo = sSpellStore.LookupEntry(GetVehicleData()->v_spells[i]);
            if(!spellInfo)
                continue;

            if(spellInfo->powerType == POWER_MANA)
                break;

            if(spellInfo->powerType == POWER_ENERGY)
            {
                setPowerType(POWER_ENERGY);
                SetMaxPower(POWER_ENERGY, 100);
                SetPower(POWER_ENERGY, 100);
                break;
            }
        }
    }
    SetHealth(GetMaxHealth());
    InstallAllAccessories();

    return true;
}
예제 #19
0
PreviewMinimap::PreviewMinimap(const glArchivItem_Map* const s2map)
{
    if(s2map)
        SetMap(*s2map);
}