diff options
| author | Kudlaty <none@none> | 2009-06-15 04:09:41 +0200 |
|---|---|---|
| committer | Kudlaty <none@none> | 2009-06-15 04:09:41 +0200 |
| commit | d1d8e2d171b1b7fc3c1fc0b83238ac5b0f8af64d (patch) | |
| tree | 752c90f5f7c192cd277c1107df3f40d9005af7d1 /src/game/Vehicle.cpp | |
| parent | b1a8df0cde6311a6116417785c658786267636ba (diff) | |
| parent | d86194147741840cbf4642d7a23003dc0f5bbb2b (diff) | |
*merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/Vehicle.cpp')
| -rw-r--r-- | src/game/Vehicle.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp index 2271bcc3c4a..3fbbd9f922c 100644 --- a/src/game/Vehicle.cpp +++ b/src/game/Vehicle.cpp @@ -44,8 +44,7 @@ void Vehicle::AddToWorld() if(m_zoneScript) m_zoneScript->OnCreatureCreate(this, true); ObjectAccessor::Instance().AddObject(this); - Unit::AddToWorld(); - AIM_Initialize(); + switch(GetEntry()) { //case 27850:InstallAccessory(27905,1);break; @@ -66,11 +65,28 @@ void Vehicle::AddToWorld() InstallAccessory(33142,2); break; } - if(!GetMaxPower(POWER_MANA)) // m_vehicleInfo->36 + for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i) { - setPowerType(POWER_ENERGY); - SetMaxPower(POWER_ENERGY, 100); + if(!m_spells[i]) + continue; + + SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); + if(!spellInfo) + continue; + + if(spellInfo->powerType == POWER_MANA) + break; + + if(spellInfo->powerType == POWER_ENERGY) + { + setPowerType(POWER_ENERGY); + SetMaxPower(POWER_ENERGY, 100); + break; + } } + + Unit::AddToWorld(); + AIM_Initialize(); } } @@ -114,7 +130,7 @@ void Vehicle::Update(uint32 diff) { Creature::Update(diff); //310 - if(getPowerType() == POWER_ENERGY) + if(getPowerType() == POWER_ENERGY) // m_vehicleInfo->36 ModifyPower(POWER_ENERGY, 100); } @@ -224,6 +240,8 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId) accessory->m_Vehicle = this; AddPassenger(accessory, seatId); + // This is not good, we have to send update twice + accessory->SendMovementFlagUpdate(); } bool Vehicle::AddPassenger(Unit *unit, int8 seatId) @@ -278,16 +296,12 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId) if(unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.seatInfo->IsUsable()) // not right SetCharmedBy(unit, CHARM_TYPE_VEHICLE); - if(false) - { - unit->SendMonsterMoveTransport(this, true); - } - else - { - if(unit->GetTypeId() == TYPEID_PLAYER) - ((Player*)unit)->SendTeleportAckMsg(); - unit->SendMovementFlagUpdate(); - } + if(IsInWorld()) + unit->SendMonsterMoveTransport(this); + + //if(unit->GetTypeId() == TYPEID_PLAYER) + // ((Player*)unit)->SendTeleportAckMsg(); + //unit->SendMovementFlagUpdate(); return true; } |
