From d8e1ba0c8263e5d818d40dc8bc1bfcbcb07a7c7b Mon Sep 17 00:00:00 2001 From: Xanadu Date: Sat, 17 Jul 2010 03:28:20 +0200 Subject: Correctly redo file moves/renames from revs 8469, 8470, 8471, 8472, 8473. --HG-- branch : trunk rename : sql/realmd.sql => sql/auth_database.sql rename : sql/characters.sql => sql/character_database.sql rename : sql/CMakeLists.txt => sql/tools/CMakeLists.txt rename : sql/create_mysql.sql => sql/tools/create_mysql.sql rename : sql/drop_mysql.sql => sql/tools/drop_mysql.sql rename : sql/world.sql => sql/world_database.sql rename : src/server/game/CollisionDetection/BIH.cpp => src/server/game/CollisionDetection/BoundingIntervalHierarchy.cpp rename : src/server/game/CollisionDetection/BIH.h => src/server/game/CollisionDetection/BoundingIntervalHierarchy.h rename : src/server/game/Entities/Transport/Transports.cpp => src/server/game/Entities/Transport/Transport.cpp rename : src/server/game/Entities/Transport/Transports.h => src/server/game/Entities/Transport/Transport.h rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/boss_anetheron.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/boss_archimonde.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/boss_azgalor.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/boss_kazrogal.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/boss_rage_winterchill.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjal.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjal.h => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjalAI.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjalAI.h => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjal_trash.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/hyjal_trash.h => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h rename : src/server/scripts/Kalimdor/CavernsOfTime/hyjal/instance_hyjal.cpp => src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/boss_epoch.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/boss_infinite.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/boss_mal_ganis.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/boss_meathook.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/boss_salramm.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/culling_of_stratholme.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/culling_of_stratholme.h => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h rename : src/server/scripts/Kalimdor/CavernsOfTime/culling_of_stratholme/instance_culling_of_stratholme.cpp => src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/boss_aeonus.cpp => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/boss_chrono_lord_deja.cpp => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/boss_temporus.cpp => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/dark_portal.cpp => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/dark_portal.h => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.h rename : src/server/scripts/Kalimdor/CavernsOfTime/dark_portal/instance_dark_portal.cpp => src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/boss_captain_skarloc.cpp => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/boss_epoch_hunter.cpp => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/boss_leutenant_drake.cpp => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/instance_old_hillsbrad.cpp => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/old_hillsbrad.cpp => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp rename : src/server/scripts/Kalimdor/CavernsOfTime/old_hillsbrad/old_hillsbrad.h => src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h rename : src/server/scripts/Northrend/AzjolNerub/azjol_nerub/azjol_nerub.h => src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h rename : src/server/scripts/Northrend/AzjolNerub/azjol_nerub/boss_anubarak.cpp => src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp rename : src/server/scripts/Northrend/AzjolNerub/azjol_nerub/boss_hadronox.cpp => src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp rename : src/server/scripts/Northrend/AzjolNerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp => src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp rename : src/server/scripts/Northrend/AzjolNerub/azjol_nerub/instance_azjol_nerub.cpp => src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/boss_argent_challenge.cpp => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/boss_black_knight.cpp => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/boss_grand_champions.cpp => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/instance_trial_of_the_champion.cpp => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/trial_of_the_champion.cpp => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp rename : src/server/scripts/Northrend/CrusadersColiseum/trial_of_the_champion/trial_of_the_champion.h => src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h rename : src/server/scripts/Northrend/FrozenHalls/forge_of_souls/boss_bronjahm.cpp => src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp rename : src/server/scripts/Northrend/FrozenHalls/forge_of_souls/boss_devourer_of_souls.cpp => src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp rename : src/server/scripts/Northrend/FrozenHalls/forge_of_souls/forge_of_souls.cpp => src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp rename : src/server/scripts/Northrend/FrozenHalls/forge_of_souls/forge_of_souls.h => src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h rename : src/server/scripts/Northrend/FrozenHalls/forge_of_souls/instance_forge_of_souls.cpp => src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp rename : src/server/scripts/Northrend/FrozenHalls/halls_of_reflection/boss_falric.cpp => src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp rename : src/server/scripts/Northrend/FrozenHalls/halls_of_reflection/boss_marwyn.cpp => src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp rename : src/server/scripts/Northrend/FrozenHalls/halls_of_reflection/halls_of_reflection.cpp => src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp rename : src/server/scripts/Northrend/FrozenHalls/halls_of_reflection/halls_of_reflection.h => src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h rename : src/server/scripts/Northrend/FrozenHalls/halls_of_reflection/instance_halls_of_reflection.cpp => src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/boss_forgemaster_garfrost.cpp => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/boss_krickandick.cpp => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/boss_scourgelord_tyrannus.cpp => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/instance_pit_of_saron.cpp => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/pit_of_saron.cpp => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp rename : src/server/scripts/Northrend/FrozenHalls/pit_of_saron/pit_of_saron.h => src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h rename : src/server/scripts/Northrend/TheNexus/eye_of_eternity/boss_malygos.cpp => src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp rename : src/server/scripts/Northrend/TheNexus/eye_of_eternity/eye_of_eternity.h => src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h rename : src/server/scripts/Northrend/TheNexus/eye_of_eternity/instance_eye_of_eternity.cpp => src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/boss_anomalus.cpp => src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/boss_keristrasza.cpp => src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/boss_magus_telestra.cpp => src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/boss_ormorok.cpp => src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/commander_kolurg.cpp => src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/commander_stoutbeard.cpp => src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/instance_nexus.cpp => src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp rename : src/server/scripts/Northrend/TheNexus/nexus/nexus.h => src/server/scripts/Northrend/Nexus/Nexus/nexus.h rename : src/server/scripts/Northrend/TheNexus/oculus/boss_drakos.cpp => src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/boss_eregos.cpp => src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/boss_urom.cpp => src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/boss_varos.cpp => src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/instance_oculus.cpp => src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/oculus.cpp => src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp rename : src/server/scripts/Northrend/TheNexus/oculus/oculus.h => src/server/scripts/Northrend/Nexus/Oculus/oculus.h rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/boss_bjarngrim.cpp => src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/boss_ionar.cpp => src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/boss_loken.cpp => src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/boss_volkhan.cpp => src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/halls_of_lightning.h => src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h rename : src/server/scripts/Northrend/Ulduar/halls_of_lightning/instance_halls_of_lightning.cpp => src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/boss_krystallus.cpp => src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/boss_maiden_of_grief.cpp => src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/boss_sjonnir.cpp => src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/halls_of_stone.cpp => src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/halls_of_stone.h => src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h rename : src/server/scripts/Northrend/Ulduar/halls_of_stone/instance_halls_of_stone.cpp => src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/boss_ingvar_the_plunderer.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/boss_keleseth.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/boss_skarvald_dalronn.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/instance_utgarde_keep.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/utgarde_keep.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_keep/utgarde_keep.h => src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/boss_palehoof.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/boss_skadi.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/boss_svala.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/boss_ymiron.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/instance_pinnacle.cpp => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp rename : src/server/scripts/Northrend/UtgardeKeep/utgarde_pinnacle/utgarde_pinnacle.h => src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h rename : src/server/scripts/Outland/Auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp => src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp rename : src/server/scripts/Outland/Auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp => src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp rename : src/server/scripts/Outland/Auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp => src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp rename : src/server/scripts/Outland/Auchindoun/mana_tombs/boss_pandemonius.cpp => src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp rename : src/server/scripts/Outland/Auchindoun/sethekk_halls/boss_darkweaver_syth.cpp => src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp rename : src/server/scripts/Outland/Auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp => src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp rename : src/server/scripts/Outland/Auchindoun/sethekk_halls/instance_sethekk_halls.cpp => src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp rename : src/server/scripts/Outland/Auchindoun/sethekk_halls/sethekk_halls.h => src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/boss_murmur.cpp => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp rename : src/server/scripts/Outland/Auchindoun/shadow_labyrinth/shadow_labyrinth.h => src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/shadow_labyrinth.h rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_fathomlord_karathress.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_hydross_the_unstable.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_lady_vashj.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_leotheras_the_blind.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_lurker_below.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/boss_morogrim_tidewalker.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/instance_serpent_shrine.cpp => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp rename : src/server/scripts/Outland/CoilfangReservoir/serpent_shrine/serpent_shrine.h => src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h rename : src/server/scripts/Outland/CoilfangReservoir/steam_vault/boss_hydromancer_thespia.cpp => src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp rename : src/server/scripts/Outland/CoilfangReservoir/steam_vault/boss_mekgineer_steamrigger.cpp => src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp rename : src/server/scripts/Outland/CoilfangReservoir/steam_vault/boss_warlord_kalithresh.cpp => src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp rename : src/server/scripts/Outland/CoilfangReservoir/steam_vault/instance_steam_vault.cpp => src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp rename : src/server/scripts/Outland/CoilfangReservoir/steam_vault/steam_vault.h => src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h rename : src/server/scripts/Outland/HellfireCitadel/blood_furnace/blood_furnace.h => src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h rename : src/server/scripts/Outland/HellfireCitadel/blood_furnace/boss_broggok.cpp => src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp rename : src/server/scripts/Outland/HellfireCitadel/blood_furnace/boss_kelidan_the_breaker.cpp => src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp rename : src/server/scripts/Outland/HellfireCitadel/blood_furnace/boss_the_maker.cpp => src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp rename : src/server/scripts/Outland/HellfireCitadel/blood_furnace/instance_blood_furnace.cpp => src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp rename : src/server/scripts/Outland/HellfireCitadel/hellfire_ramparts/boss_omor_the_unscarred.cpp => src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp rename : src/server/scripts/Outland/HellfireCitadel/hellfire_ramparts/boss_vazruden_the_herald.cpp => src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp rename : src/server/scripts/Outland/HellfireCitadel/hellfire_ramparts/boss_watchkeeper_gargolmar.cpp => src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp rename : src/server/scripts/Outland/HellfireCitadel/hellfire_ramparts/hellfire_ramparts.h => src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h rename : src/server/scripts/Outland/HellfireCitadel/hellfire_ramparts/instance_hellfire_ramparts.cpp => src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp rename : src/server/scripts/Outland/HellfireCitadel/magtheridons_lair/boss_magtheridon.cpp => src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp rename : src/server/scripts/Outland/HellfireCitadel/magtheridons_lair/instance_magtheridons_lair.cpp => src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp rename : src/server/scripts/Outland/HellfireCitadel/magtheridons_lair/magtheridons_lair.h => src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h rename : src/server/scripts/Outland/HellfireCitadel/shattered_halls/boss_nethekurse.cpp => src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp rename : src/server/scripts/Outland/HellfireCitadel/shattered_halls/boss_warbringer_omrogg.cpp => src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp rename : src/server/scripts/Outland/HellfireCitadel/shattered_halls/boss_warchief_kargath_bladefist.cpp => src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp rename : src/server/scripts/Outland/HellfireCitadel/shattered_halls/instance_shattered_halls.cpp => src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp rename : src/server/scripts/Outland/HellfireCitadel/shattered_halls/shattered_halls.h => src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h rename : src/server/scripts/Outland/TempestKeep/the_eye/boss_alar.cpp => src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/boss_astromancer.cpp => src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/boss_kaelthas.cpp => src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/boss_void_reaver.cpp => src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/instance_the_eye.cpp => src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/the_eye.cpp => src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp rename : src/server/scripts/Outland/TempestKeep/the_eye/the_eye.h => src/server/scripts/Outland/TempestKeep/Eye/the_eye.h rename : src/server/scripts/Outland/TempestKeep/the_mechanar/boss_gatewatcher_gyrokill.cpp => src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp rename : src/server/scripts/Outland/TempestKeep/the_mechanar/boss_gatewatcher_ironhand.cpp => src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp rename : src/server/scripts/Outland/TempestKeep/the_mechanar/boss_nethermancer_sepethrea.cpp => src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp rename : src/server/scripts/Outland/TempestKeep/the_mechanar/boss_pathaleon_the_calculator.cpp => src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp rename : src/server/scripts/Outland/TempestKeep/the_mechanar/instance_mechanar.cpp => src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp rename : src/server/scripts/Outland/TempestKeep/the_mechanar/mechanar.h => src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h rename : src/tools/vmap3_assembler/vmap_assembler.cpp => src/tools/vmap3_assembler/VMapAssembler.cpp --- src/server/game/CollisionDetection/BIH.cpp | 304 ----------- src/server/game/CollisionDetection/BIH.h | 391 -------------- .../BoundingIntervalHierarchy.cpp | 304 +++++++++++ .../CollisionDetection/BoundingIntervalHierarchy.h | 391 ++++++++++++++ src/server/game/Entities/Transport/Transport.cpp | 589 +++++++++++++++++++++ src/server/game/Entities/Transport/Transport.h | 108 ++++ src/server/game/Entities/Transport/Transports.cpp | 589 --------------------- src/server/game/Entities/Transport/Transports.h | 108 ---- 8 files changed, 1392 insertions(+), 1392 deletions(-) delete mode 100644 src/server/game/CollisionDetection/BIH.cpp delete mode 100644 src/server/game/CollisionDetection/BIH.h create mode 100644 src/server/game/CollisionDetection/BoundingIntervalHierarchy.cpp create mode 100644 src/server/game/CollisionDetection/BoundingIntervalHierarchy.h create mode 100644 src/server/game/Entities/Transport/Transport.cpp create mode 100644 src/server/game/Entities/Transport/Transport.h delete mode 100644 src/server/game/Entities/Transport/Transports.cpp delete mode 100644 src/server/game/Entities/Transport/Transports.h (limited to 'src/server/game') diff --git a/src/server/game/CollisionDetection/BIH.cpp b/src/server/game/CollisionDetection/BIH.cpp deleted file mode 100644 index 4bd6b3c701e..00000000000 --- a/src/server/game/CollisionDetection/BIH.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "BIH.h" - -void BIH::buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats) -{ - // create space for the first node - tempTree.push_back(3 << 30); // dummy leaf - tempTree.insert(tempTree.end(), 2, 0); - //tempTree.add(0); - - // seed bbox - AABound gridBox = { bounds.low(), bounds.high() }; - AABound nodeBox = gridBox; - // seed subdivide function - subdivide(0, dat.numPrims - 1, tempTree, dat, gridBox, nodeBox, 0, 1, stats); -} - -void BIH::subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats) -{ - if ((right - left + 1) <= dat.maxPrims || depth >= MAX_STACK_SIZE) - { - // write leaf node - stats.updateLeaf(depth, right - left + 1); - createNode(tempTree, nodeIndex, left, right); - return; - } - // calculate extents - int axis = -1, prevAxis, rightOrig; - float clipL = G3D::fnan(), clipR = G3D::fnan(), prevClip = G3D::fnan(); - float split = G3D::fnan(), prevSplit; - bool wasLeft = true; - while (true) - { - prevAxis = axis; - prevSplit = split; - // perform quick consistency checks - Vector3 d( gridBox.hi - gridBox.lo ); - if (d.x < 0 || d.y < 0 || d.z < 0) - throw std::logic_error("negative node extents"); - for (int i = 0; i < 3; i++) - { - if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i]) - { - //UI.printError(Module.ACCEL, "Reached tree area in error - discarding node with: %d objects", right - left + 1); - throw std::logic_error("invalid node overlap"); - } - } - // find longest axis - axis = d.primaryAxis(); - split = 0.5f * (gridBox.lo[axis] + gridBox.hi[axis]); - // partition L/R subsets - clipL = -G3D::inf(); - clipR = G3D::inf(); - rightOrig = right; // save this for later - float nodeL = G3D::inf(); - float nodeR = -G3D::inf(); - for (int i = left; i <= right;) - { - int obj = dat.indices[i]; - float minb = dat.primBound[obj].low()[axis]; - float maxb = dat.primBound[obj].high()[axis]; - float center = (minb + maxb) * 0.5f; - if (center <= split) - { - // stay left - i++; - if (clipL < maxb) - clipL = maxb; - } - else - { - // move to the right most - int t = dat.indices[i]; - dat.indices[i] = dat.indices[right]; - dat.indices[right] = t; - right--; - if (clipR > minb) - clipR = minb; - } - nodeL = std::min(nodeL, minb); - nodeR = std::max(nodeR, maxb); - } - // check for empty space - if (nodeL > nodeBox.lo[axis] && nodeR < nodeBox.hi[axis]) - { - float nodeBoxW = nodeBox.hi[axis] - nodeBox.lo[axis]; - float nodeNewW = nodeR - nodeL; - // node box is too big compare to space occupied by primitives? - if (1.3f * nodeNewW < nodeBoxW) - { - stats.updateBVH2(); - int nextIndex = tempTree.size(); - // allocate child - tempTree.push_back(0); - tempTree.push_back(0); - tempTree.push_back(0); - // write bvh2 clip node - stats.updateInner(); - tempTree[nodeIndex + 0] = (axis << 30) | (1 << 29) | nextIndex; - tempTree[nodeIndex + 1] = floatToRawIntBits(nodeL); - tempTree[nodeIndex + 2] = floatToRawIntBits(nodeR); - // update nodebox and recurse - nodeBox.lo[axis] = nodeL; - nodeBox.hi[axis] = nodeR; - subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex, depth + 1, stats); - return; - } - } - // ensure we are making progress in the subdivision - if (right == rightOrig) - { - // all left - if (prevAxis == axis && prevSplit == split) { - // we are stuck here - create a leaf - stats.updateLeaf(depth, right - left + 1); - createNode(tempTree, nodeIndex, left, right); - return; - } - if (clipL <= split) { - // keep looping on left half - gridBox.hi[axis] = split; - prevClip = clipL; - wasLeft = true; - continue; - } - gridBox.hi[axis] = split; - prevClip = G3D::fnan(); - } - else if (left > right) - { - // all right - if (prevAxis == axis && prevSplit == split) { - // we are stuck here - create a leaf - stats.updateLeaf(depth, right - left + 1); - createNode(tempTree, nodeIndex, left, right); - return; - } - right = rightOrig; - if (clipR >= split) { - // keep looping on right half - gridBox.lo[axis] = split; - prevClip = clipR; - wasLeft = false; - continue; - } - gridBox.lo[axis] = split; - prevClip = G3D::fnan(); - } - else - { - // we are actually splitting stuff - if (prevAxis != -1 && !isnan(prevClip)) - { - // second time through - lets create the previous split - // since it produced empty space - int nextIndex = tempTree.size(); - // allocate child node - tempTree.push_back(0); - tempTree.push_back(0); - tempTree.push_back(0); - if (wasLeft) { - // create a node with a left child - // write leaf node - stats.updateInner(); - tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex; - tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip); - tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf()); - } else { - // create a node with a right child - // write leaf node - stats.updateInner(); - tempTree[nodeIndex + 0] = (prevAxis << 30) | (nextIndex - 3); - tempTree[nodeIndex + 1] = floatToRawIntBits(-G3D::inf()); - tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip); - } - // count stats for the unused leaf - depth++; - stats.updateLeaf(depth, 0); - // now we keep going as we are, with a new nodeIndex: - nodeIndex = nextIndex; - } - break; - } - } - // compute index of child nodes - int nextIndex = tempTree.size(); - // allocate left node - int nl = right - left + 1; - int nr = rightOrig - (right + 1) + 1; - if (nl > 0) { - tempTree.push_back(0); - tempTree.push_back(0); - tempTree.push_back(0); - } else - nextIndex -= 3; - // allocate right node - if (nr > 0) { - tempTree.push_back(0); - tempTree.push_back(0); - tempTree.push_back(0); - } - // write leaf node - stats.updateInner(); - tempTree[nodeIndex + 0] = (axis << 30) | nextIndex; - tempTree[nodeIndex + 1] = floatToRawIntBits(clipL); - tempTree[nodeIndex + 2] = floatToRawIntBits(clipR); - // prepare L/R child boxes - AABound gridBoxL(gridBox), gridBoxR(gridBox); - AABound nodeBoxL(nodeBox), nodeBoxR(nodeBox); - gridBoxL.hi[axis] = gridBoxR.lo[axis] = split; - nodeBoxL.hi[axis] = clipL; - nodeBoxR.lo[axis] = clipR; - // recurse - if (nl > 0) - subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats); - else - stats.updateLeaf(depth + 1, 0); - if (nr > 0) - subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats); - else - stats.updateLeaf(depth + 1, 0); -} - -bool BIH::writeToFile(FILE *wf) const -{ - uint32 treeSize = tree.size(); - uint32 check=0, count=0; - check += fwrite(&bounds.low(), sizeof(float), 3, wf); - check += fwrite(&bounds.high(), sizeof(float), 3, wf); - check += fwrite(&treeSize, sizeof(uint32), 1, wf); - check += fwrite(&tree[0], sizeof(uint32), treeSize, wf); - count = objects.size(); - check += fwrite(&count, sizeof(uint32), 1, wf); - check += fwrite(&objects[0], sizeof(uint32), count, wf); - return check == (3 + 3 + 2 + treeSize + count); -} - -bool BIH::readFromFile(FILE *rf) -{ - uint32 treeSize; - Vector3 lo, hi; - uint32 check=0, count=0; - check += fread(&lo, sizeof(float), 3, rf); - check += fread(&hi, sizeof(float), 3, rf); - bounds = AABox(lo, hi); - check += fread(&treeSize, sizeof(uint32), 1, rf); - tree.resize(treeSize); - check += fread(&tree[0], sizeof(uint32), treeSize, rf); - check += fread(&count, sizeof(uint32), 1, rf); - objects.resize(count); // = new uint32[nObjects]; - check += fread(&objects[0], sizeof(uint32), count, rf); - return check == (3 + 3 + 2 + treeSize + count); -} - -void BIH::BuildStats::updateLeaf(int depth, int n) -{ - numLeaves++; - minDepth = std::min(depth, minDepth); - maxDepth = std::max(depth, maxDepth); - sumDepth += depth; - minObjects = std::min(n, minObjects); - maxObjects = std::max(n, maxObjects); - sumObjects += n; - int nl = std::min(n, 5); - ++numLeavesN[nl]; -} - -void BIH::BuildStats::printStats() -{ - printf("Tree stats:\n"); - printf(" * Nodes: %d\n", numNodes); - printf(" * Leaves: %d\n", numLeaves); - printf(" * Objects: min %d\n", minObjects); - printf(" avg %.2f\n", (float) sumObjects / numLeaves); - printf(" avg(n>0) %.2f\n", (float) sumObjects / (numLeaves - numLeavesN[0])); - printf(" max %d\n", maxObjects); - printf(" * Depth: min %d\n", minDepth); - printf(" avg %.2f\n", (float) sumDepth / numLeaves); - printf(" max %d\n", maxDepth); - printf(" * Leaves w/: N=0 %3d%%\n", 100 * numLeavesN[0] / numLeaves); - printf(" N=1 %3d%%\n", 100 * numLeavesN[1] / numLeaves); - printf(" N=2 %3d%%\n", 100 * numLeavesN[2] / numLeaves); - printf(" N=3 %3d%%\n", 100 * numLeavesN[3] / numLeaves); - printf(" N=4 %3d%%\n", 100 * numLeavesN[4] / numLeaves); - printf(" N>4 %3d%%\n", 100 * numLeavesN[5] / numLeaves); - printf(" * BVH2 nodes: %d (%3d%%)\n", numBVH2, 100 * numBVH2 / (numNodes + numLeaves - 2 * numBVH2)); -} diff --git a/src/server/game/CollisionDetection/BIH.h b/src/server/game/CollisionDetection/BIH.h deleted file mode 100644 index 15ae90c23eb..00000000000 --- a/src/server/game/CollisionDetection/BIH.h +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (C) 2005-2010 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _BIH_H -#define _BIH_H - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#define MAX_STACK_SIZE 64 - -#ifdef _MSC_VER - #define isnan(x) _isnan(x) -#endif - -using G3D::Vector3; -using G3D::AABox; -using G3D::Ray; - -static inline uint32 floatToRawIntBits(float f) -{ - union - { - uint32 ival; - float fval; - } temp; - temp.fval=f; - return temp.ival; -} - -static inline float intBitsToFloat(uint32 i) -{ - union - { - uint32 ival; - float fval; - } temp; - temp.ival=i; - return temp.fval; -} - -struct AABound -{ - Vector3 lo, hi; -}; - -/** Bounding Interval Hierarchy Class. - Building and Ray-Intersection functions based on BIH from - Sunflow, a Java Raytracer, released under MIT/X11 License - http://sunflow.sourceforge.net/ - Copyright (c) 2003-2007 Christopher Kulla -*/ - -class BIH -{ - public: - BIH() {}; - template< class T, class BoundsFunc > - void build(const std::vector &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) - { - if(primitives.size() == 0) - return; - buildData dat; - dat.maxPrims = leafSize; - dat.numPrims = primitives.size(); - dat.indices = new uint32[dat.numPrims]; - dat.primBound = new AABox[dat.numPrims]; - getBounds(primitives[0], bounds); - for (uint32 i=0; i tempTree; - BuildStats stats; - buildHierarchy(tempTree, dat, stats); - if (printStats) - stats.printStats(); - - objects.resize(dat.numPrims); - for (uint32 i=0; i - void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const - { - float intervalMin = 0.f; - float intervalMax = maxDist; - Vector3 org = r.origin(); - Vector3 dir = r.direction(); - Vector3 invDir; - float t1, t2; - for(int i=0; i<3; ++i) - { - invDir[i] = 1.f / dir[i]; - t1 = (bounds.low()[i] - org[i]) * invDir[i]; - t2 = (bounds.high()[i] - org[i]) * invDir[i]; - if (invDir[i] > 0) { - if (t1 > intervalMin) - intervalMin = t1; - if (t2 < intervalMax) - intervalMax = t2; - } else { - if (t2 > intervalMin) - intervalMin = t2; - if (t1 < intervalMax) - intervalMax = t1; - } - if (intervalMin > intervalMax) - return; - } - - uint32 offsetFront[3]; - uint32 offsetBack[3]; - uint32 offsetFront3[3]; - uint32 offsetBack3[3]; - // compute custom offsets from direction sign bit - - for(int i=0; i<3; ++i) - { - offsetFront[i] = floatToRawIntBits(dir[i]) >> 31; - offsetBack[i] = offsetFront[i] ^ 1; - offsetFront3[i] = offsetFront[i] * 3; - offsetBack3[i] = offsetBack[i] * 3; - - // avoid always adding 1 during the inner loop - ++offsetFront[i]; - ++offsetBack[i]; - } - - StackNode stack[MAX_STACK_SIZE]; - int stackPos = 0; - int node = 0; - - while (true) { - while (true) - { - uint32 tn = tree[node]; - uint32 axis = (tn & (3 << 30)) >> 30; - bool BVH2 = tn & (1 << 29); - int offset = tn & ~(7 << 29); - if (!BVH2) - { - if (axis < 3) - { - // "normal" interior node - float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; - float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; - // ray passes between clip zones - if (tf < intervalMin && tb > intervalMax) - break; - int back = offset + offsetBack3[axis]; - node = back; - // ray passes through far node only - if (tf < intervalMin) { - intervalMin = (tb >= intervalMin) ? tb : intervalMin; - continue; - } - node = offset + offsetFront3[axis]; // front - // ray passes through near node only - if (tb > intervalMax) { - intervalMax = (tf <= intervalMax) ? tf : intervalMax; - continue; - } - // ray passes through both nodes - // push back node - stack[stackPos].node = back; - stack[stackPos].tnear = (tb >= intervalMin) ? tb : intervalMin; - stack[stackPos].tfar = intervalMax; - stackPos++; - // update ray interval for front node - intervalMax = (tf <= intervalMax) ? tf : intervalMax; - continue; - } - else - { - // leaf - test some objects - int n = tree[node + 1]; - while (n > 0) { - bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst); - if(stopAtFirst && hit) return; - --n; - ++offset; - } - break; - } - } - else - { - if (axis>2) - return; // should not happen - float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; - float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; - node = offset; - intervalMin = (tf >= intervalMin) ? tf : intervalMin; - intervalMax = (tb <= intervalMax) ? tb : intervalMax; - if (intervalMin > intervalMax) - break; - continue; - } - } // traversal loop - do - { - // stack is empty? - if (stackPos == 0) - return; - // move back up the stack - stackPos--; - intervalMin = stack[stackPos].tnear; - if (maxDist < intervalMin) - continue; - node = stack[stackPos].node; - intervalMax = stack[stackPos].tfar; - break; - } while (true); - } - } - - template - void intersectPoint(const Vector3 &p, IsectCallback& intersectCallback) const - { - if (!bounds.contains(p)) - return; - - StackNode stack[MAX_STACK_SIZE]; - int stackPos = 0; - int node = 0; - - while (true) { - while (true) - { - uint32 tn = tree[node]; - uint32 axis = (tn & (3 << 30)) >> 30; - bool BVH2 = tn & (1 << 29); - int offset = tn & ~(7 << 29); - if (!BVH2) - { - if (axis < 3) - { - // "normal" interior node - float tl = intBitsToFloat(tree[node + 1]); - float tr = intBitsToFloat(tree[node + 2]); - // point is between clip zones - if (tl < p[axis] && tr > p[axis]) - break; - int right = offset + 3; - node = right; - // point is in right node only - if (tl < p[axis]) { - continue; - } - node = offset; // left - // point is in left node only - if (tr > p[axis]) { - continue; - } - // point is in both nodes - // push back right node - stack[stackPos].node = right; - stackPos++; - continue; - } - else - { - // leaf - test some objects - int n = tree[node + 1]; - while (n > 0) { - intersectCallback(p, objects[offset]); // !!! - --n; - ++offset; - } - break; - } - } - else // BVH2 node (empty space cut off left and right) - { - if (axis>2) - return; // should not happen - float tl = intBitsToFloat(tree[node + 1]); - float tr = intBitsToFloat(tree[node + 2]); - node = offset; - if (tl > p[axis] || tr < p[axis]) - break; - continue; - } - } // traversal loop - - // stack is empty? - if (stackPos == 0) - return; - // move back up the stack - stackPos--; - node = stack[stackPos].node; - } - } - - bool writeToFile(FILE *wf) const; - bool readFromFile(FILE *rf); - - protected: - std::vector tree; - std::vector objects; - AABox bounds; - - struct buildData - { - uint32 *indices; - AABox *primBound; - uint32 numPrims; - int maxPrims; - }; - struct StackNode - { - uint32 node; - float tnear; - float tfar; - }; - - class BuildStats - { - private: - int numNodes; - int numLeaves; - int sumObjects; - int minObjects; - int maxObjects; - int sumDepth; - int minDepth; - int maxDepth; - int numLeavesN[6]; - int numBVH2; - - public: - BuildStats(): - numNodes(0), numLeaves(0), sumObjects(0), minObjects(0x0FFFFFFF), - maxObjects(0xFFFFFFFF), sumDepth(0), minDepth(0x0FFFFFFF), - maxDepth(0xFFFFFFFF), numBVH2(0) - { - for(int i=0; i<6; ++i) numLeavesN[i] = 0; - } - - void updateInner() { numNodes++; } - void updateBVH2() { numBVH2++; } - void updateLeaf(int depth, int n); - void printStats(); - }; - - void buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats); - - void createNode(std::vector &tempTree, int nodeIndex, uint32 left, uint32 right) { - // write leaf node - tempTree[nodeIndex + 0] = (3 << 30) | left; - tempTree[nodeIndex + 1] = right - left + 1; - } - - void subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats); -}; - -#endif // _BIH_H diff --git a/src/server/game/CollisionDetection/BoundingIntervalHierarchy.cpp b/src/server/game/CollisionDetection/BoundingIntervalHierarchy.cpp new file mode 100644 index 00000000000..4bd6b3c701e --- /dev/null +++ b/src/server/game/CollisionDetection/BoundingIntervalHierarchy.cpp @@ -0,0 +1,304 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "BIH.h" + +void BIH::buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats) +{ + // create space for the first node + tempTree.push_back(3 << 30); // dummy leaf + tempTree.insert(tempTree.end(), 2, 0); + //tempTree.add(0); + + // seed bbox + AABound gridBox = { bounds.low(), bounds.high() }; + AABound nodeBox = gridBox; + // seed subdivide function + subdivide(0, dat.numPrims - 1, tempTree, dat, gridBox, nodeBox, 0, 1, stats); +} + +void BIH::subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats) +{ + if ((right - left + 1) <= dat.maxPrims || depth >= MAX_STACK_SIZE) + { + // write leaf node + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + // calculate extents + int axis = -1, prevAxis, rightOrig; + float clipL = G3D::fnan(), clipR = G3D::fnan(), prevClip = G3D::fnan(); + float split = G3D::fnan(), prevSplit; + bool wasLeft = true; + while (true) + { + prevAxis = axis; + prevSplit = split; + // perform quick consistency checks + Vector3 d( gridBox.hi - gridBox.lo ); + if (d.x < 0 || d.y < 0 || d.z < 0) + throw std::logic_error("negative node extents"); + for (int i = 0; i < 3; i++) + { + if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i]) + { + //UI.printError(Module.ACCEL, "Reached tree area in error - discarding node with: %d objects", right - left + 1); + throw std::logic_error("invalid node overlap"); + } + } + // find longest axis + axis = d.primaryAxis(); + split = 0.5f * (gridBox.lo[axis] + gridBox.hi[axis]); + // partition L/R subsets + clipL = -G3D::inf(); + clipR = G3D::inf(); + rightOrig = right; // save this for later + float nodeL = G3D::inf(); + float nodeR = -G3D::inf(); + for (int i = left; i <= right;) + { + int obj = dat.indices[i]; + float minb = dat.primBound[obj].low()[axis]; + float maxb = dat.primBound[obj].high()[axis]; + float center = (minb + maxb) * 0.5f; + if (center <= split) + { + // stay left + i++; + if (clipL < maxb) + clipL = maxb; + } + else + { + // move to the right most + int t = dat.indices[i]; + dat.indices[i] = dat.indices[right]; + dat.indices[right] = t; + right--; + if (clipR > minb) + clipR = minb; + } + nodeL = std::min(nodeL, minb); + nodeR = std::max(nodeR, maxb); + } + // check for empty space + if (nodeL > nodeBox.lo[axis] && nodeR < nodeBox.hi[axis]) + { + float nodeBoxW = nodeBox.hi[axis] - nodeBox.lo[axis]; + float nodeNewW = nodeR - nodeL; + // node box is too big compare to space occupied by primitives? + if (1.3f * nodeNewW < nodeBoxW) + { + stats.updateBVH2(); + int nextIndex = tempTree.size(); + // allocate child + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + // write bvh2 clip node + stats.updateInner(); + tempTree[nodeIndex + 0] = (axis << 30) | (1 << 29) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(nodeL); + tempTree[nodeIndex + 2] = floatToRawIntBits(nodeR); + // update nodebox and recurse + nodeBox.lo[axis] = nodeL; + nodeBox.hi[axis] = nodeR; + subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex, depth + 1, stats); + return; + } + } + // ensure we are making progress in the subdivision + if (right == rightOrig) + { + // all left + if (prevAxis == axis && prevSplit == split) { + // we are stuck here - create a leaf + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + if (clipL <= split) { + // keep looping on left half + gridBox.hi[axis] = split; + prevClip = clipL; + wasLeft = true; + continue; + } + gridBox.hi[axis] = split; + prevClip = G3D::fnan(); + } + else if (left > right) + { + // all right + if (prevAxis == axis && prevSplit == split) { + // we are stuck here - create a leaf + stats.updateLeaf(depth, right - left + 1); + createNode(tempTree, nodeIndex, left, right); + return; + } + right = rightOrig; + if (clipR >= split) { + // keep looping on right half + gridBox.lo[axis] = split; + prevClip = clipR; + wasLeft = false; + continue; + } + gridBox.lo[axis] = split; + prevClip = G3D::fnan(); + } + else + { + // we are actually splitting stuff + if (prevAxis != -1 && !isnan(prevClip)) + { + // second time through - lets create the previous split + // since it produced empty space + int nextIndex = tempTree.size(); + // allocate child node + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + if (wasLeft) { + // create a node with a left child + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip); + tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf()); + } else { + // create a node with a right child + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (prevAxis << 30) | (nextIndex - 3); + tempTree[nodeIndex + 1] = floatToRawIntBits(-G3D::inf()); + tempTree[nodeIndex + 2] = floatToRawIntBits(prevClip); + } + // count stats for the unused leaf + depth++; + stats.updateLeaf(depth, 0); + // now we keep going as we are, with a new nodeIndex: + nodeIndex = nextIndex; + } + break; + } + } + // compute index of child nodes + int nextIndex = tempTree.size(); + // allocate left node + int nl = right - left + 1; + int nr = rightOrig - (right + 1) + 1; + if (nl > 0) { + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + } else + nextIndex -= 3; + // allocate right node + if (nr > 0) { + tempTree.push_back(0); + tempTree.push_back(0); + tempTree.push_back(0); + } + // write leaf node + stats.updateInner(); + tempTree[nodeIndex + 0] = (axis << 30) | nextIndex; + tempTree[nodeIndex + 1] = floatToRawIntBits(clipL); + tempTree[nodeIndex + 2] = floatToRawIntBits(clipR); + // prepare L/R child boxes + AABound gridBoxL(gridBox), gridBoxR(gridBox); + AABound nodeBoxL(nodeBox), nodeBoxR(nodeBox); + gridBoxL.hi[axis] = gridBoxR.lo[axis] = split; + nodeBoxL.hi[axis] = clipL; + nodeBoxR.lo[axis] = clipR; + // recurse + if (nl > 0) + subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats); + else + stats.updateLeaf(depth + 1, 0); + if (nr > 0) + subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats); + else + stats.updateLeaf(depth + 1, 0); +} + +bool BIH::writeToFile(FILE *wf) const +{ + uint32 treeSize = tree.size(); + uint32 check=0, count=0; + check += fwrite(&bounds.low(), sizeof(float), 3, wf); + check += fwrite(&bounds.high(), sizeof(float), 3, wf); + check += fwrite(&treeSize, sizeof(uint32), 1, wf); + check += fwrite(&tree[0], sizeof(uint32), treeSize, wf); + count = objects.size(); + check += fwrite(&count, sizeof(uint32), 1, wf); + check += fwrite(&objects[0], sizeof(uint32), count, wf); + return check == (3 + 3 + 2 + treeSize + count); +} + +bool BIH::readFromFile(FILE *rf) +{ + uint32 treeSize; + Vector3 lo, hi; + uint32 check=0, count=0; + check += fread(&lo, sizeof(float), 3, rf); + check += fread(&hi, sizeof(float), 3, rf); + bounds = AABox(lo, hi); + check += fread(&treeSize, sizeof(uint32), 1, rf); + tree.resize(treeSize); + check += fread(&tree[0], sizeof(uint32), treeSize, rf); + check += fread(&count, sizeof(uint32), 1, rf); + objects.resize(count); // = new uint32[nObjects]; + check += fread(&objects[0], sizeof(uint32), count, rf); + return check == (3 + 3 + 2 + treeSize + count); +} + +void BIH::BuildStats::updateLeaf(int depth, int n) +{ + numLeaves++; + minDepth = std::min(depth, minDepth); + maxDepth = std::max(depth, maxDepth); + sumDepth += depth; + minObjects = std::min(n, minObjects); + maxObjects = std::max(n, maxObjects); + sumObjects += n; + int nl = std::min(n, 5); + ++numLeavesN[nl]; +} + +void BIH::BuildStats::printStats() +{ + printf("Tree stats:\n"); + printf(" * Nodes: %d\n", numNodes); + printf(" * Leaves: %d\n", numLeaves); + printf(" * Objects: min %d\n", minObjects); + printf(" avg %.2f\n", (float) sumObjects / numLeaves); + printf(" avg(n>0) %.2f\n", (float) sumObjects / (numLeaves - numLeavesN[0])); + printf(" max %d\n", maxObjects); + printf(" * Depth: min %d\n", minDepth); + printf(" avg %.2f\n", (float) sumDepth / numLeaves); + printf(" max %d\n", maxDepth); + printf(" * Leaves w/: N=0 %3d%%\n", 100 * numLeavesN[0] / numLeaves); + printf(" N=1 %3d%%\n", 100 * numLeavesN[1] / numLeaves); + printf(" N=2 %3d%%\n", 100 * numLeavesN[2] / numLeaves); + printf(" N=3 %3d%%\n", 100 * numLeavesN[3] / numLeaves); + printf(" N=4 %3d%%\n", 100 * numLeavesN[4] / numLeaves); + printf(" N>4 %3d%%\n", 100 * numLeavesN[5] / numLeaves); + printf(" * BVH2 nodes: %d (%3d%%)\n", numBVH2, 100 * numBVH2 / (numNodes + numLeaves - 2 * numBVH2)); +} diff --git a/src/server/game/CollisionDetection/BoundingIntervalHierarchy.h b/src/server/game/CollisionDetection/BoundingIntervalHierarchy.h new file mode 100644 index 00000000000..15ae90c23eb --- /dev/null +++ b/src/server/game/CollisionDetection/BoundingIntervalHierarchy.h @@ -0,0 +1,391 @@ +/* + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _BIH_H +#define _BIH_H + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#define MAX_STACK_SIZE 64 + +#ifdef _MSC_VER + #define isnan(x) _isnan(x) +#endif + +using G3D::Vector3; +using G3D::AABox; +using G3D::Ray; + +static inline uint32 floatToRawIntBits(float f) +{ + union + { + uint32 ival; + float fval; + } temp; + temp.fval=f; + return temp.ival; +} + +static inline float intBitsToFloat(uint32 i) +{ + union + { + uint32 ival; + float fval; + } temp; + temp.ival=i; + return temp.fval; +} + +struct AABound +{ + Vector3 lo, hi; +}; + +/** Bounding Interval Hierarchy Class. + Building and Ray-Intersection functions based on BIH from + Sunflow, a Java Raytracer, released under MIT/X11 License + http://sunflow.sourceforge.net/ + Copyright (c) 2003-2007 Christopher Kulla +*/ + +class BIH +{ + public: + BIH() {}; + template< class T, class BoundsFunc > + void build(const std::vector &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) + { + if(primitives.size() == 0) + return; + buildData dat; + dat.maxPrims = leafSize; + dat.numPrims = primitives.size(); + dat.indices = new uint32[dat.numPrims]; + dat.primBound = new AABox[dat.numPrims]; + getBounds(primitives[0], bounds); + for (uint32 i=0; i tempTree; + BuildStats stats; + buildHierarchy(tempTree, dat, stats); + if (printStats) + stats.printStats(); + + objects.resize(dat.numPrims); + for (uint32 i=0; i + void intersectRay(const Ray &r, RayCallback& intersectCallback, float &maxDist, bool stopAtFirst=false) const + { + float intervalMin = 0.f; + float intervalMax = maxDist; + Vector3 org = r.origin(); + Vector3 dir = r.direction(); + Vector3 invDir; + float t1, t2; + for(int i=0; i<3; ++i) + { + invDir[i] = 1.f / dir[i]; + t1 = (bounds.low()[i] - org[i]) * invDir[i]; + t2 = (bounds.high()[i] - org[i]) * invDir[i]; + if (invDir[i] > 0) { + if (t1 > intervalMin) + intervalMin = t1; + if (t2 < intervalMax) + intervalMax = t2; + } else { + if (t2 > intervalMin) + intervalMin = t2; + if (t1 < intervalMax) + intervalMax = t1; + } + if (intervalMin > intervalMax) + return; + } + + uint32 offsetFront[3]; + uint32 offsetBack[3]; + uint32 offsetFront3[3]; + uint32 offsetBack3[3]; + // compute custom offsets from direction sign bit + + for(int i=0; i<3; ++i) + { + offsetFront[i] = floatToRawIntBits(dir[i]) >> 31; + offsetBack[i] = offsetFront[i] ^ 1; + offsetFront3[i] = offsetFront[i] * 3; + offsetBack3[i] = offsetBack[i] * 3; + + // avoid always adding 1 during the inner loop + ++offsetFront[i]; + ++offsetBack[i]; + } + + StackNode stack[MAX_STACK_SIZE]; + int stackPos = 0; + int node = 0; + + while (true) { + while (true) + { + uint32 tn = tree[node]; + uint32 axis = (tn & (3 << 30)) >> 30; + bool BVH2 = tn & (1 << 29); + int offset = tn & ~(7 << 29); + if (!BVH2) + { + if (axis < 3) + { + // "normal" interior node + float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; + float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; + // ray passes between clip zones + if (tf < intervalMin && tb > intervalMax) + break; + int back = offset + offsetBack3[axis]; + node = back; + // ray passes through far node only + if (tf < intervalMin) { + intervalMin = (tb >= intervalMin) ? tb : intervalMin; + continue; + } + node = offset + offsetFront3[axis]; // front + // ray passes through near node only + if (tb > intervalMax) { + intervalMax = (tf <= intervalMax) ? tf : intervalMax; + continue; + } + // ray passes through both nodes + // push back node + stack[stackPos].node = back; + stack[stackPos].tnear = (tb >= intervalMin) ? tb : intervalMin; + stack[stackPos].tfar = intervalMax; + stackPos++; + // update ray interval for front node + intervalMax = (tf <= intervalMax) ? tf : intervalMax; + continue; + } + else + { + // leaf - test some objects + int n = tree[node + 1]; + while (n > 0) { + bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst); + if(stopAtFirst && hit) return; + --n; + ++offset; + } + break; + } + } + else + { + if (axis>2) + return; // should not happen + float tf = (intBitsToFloat(tree[node + offsetFront[axis]]) - org[axis]) * invDir[axis]; + float tb = (intBitsToFloat(tree[node + offsetBack[axis]]) - org[axis]) * invDir[axis]; + node = offset; + intervalMin = (tf >= intervalMin) ? tf : intervalMin; + intervalMax = (tb <= intervalMax) ? tb : intervalMax; + if (intervalMin > intervalMax) + break; + continue; + } + } // traversal loop + do + { + // stack is empty? + if (stackPos == 0) + return; + // move back up the stack + stackPos--; + intervalMin = stack[stackPos].tnear; + if (maxDist < intervalMin) + continue; + node = stack[stackPos].node; + intervalMax = stack[stackPos].tfar; + break; + } while (true); + } + } + + template + void intersectPoint(const Vector3 &p, IsectCallback& intersectCallback) const + { + if (!bounds.contains(p)) + return; + + StackNode stack[MAX_STACK_SIZE]; + int stackPos = 0; + int node = 0; + + while (true) { + while (true) + { + uint32 tn = tree[node]; + uint32 axis = (tn & (3 << 30)) >> 30; + bool BVH2 = tn & (1 << 29); + int offset = tn & ~(7 << 29); + if (!BVH2) + { + if (axis < 3) + { + // "normal" interior node + float tl = intBitsToFloat(tree[node + 1]); + float tr = intBitsToFloat(tree[node + 2]); + // point is between clip zones + if (tl < p[axis] && tr > p[axis]) + break; + int right = offset + 3; + node = right; + // point is in right node only + if (tl < p[axis]) { + continue; + } + node = offset; // left + // point is in left node only + if (tr > p[axis]) { + continue; + } + // point is in both nodes + // push back right node + stack[stackPos].node = right; + stackPos++; + continue; + } + else + { + // leaf - test some objects + int n = tree[node + 1]; + while (n > 0) { + intersectCallback(p, objects[offset]); // !!! + --n; + ++offset; + } + break; + } + } + else // BVH2 node (empty space cut off left and right) + { + if (axis>2) + return; // should not happen + float tl = intBitsToFloat(tree[node + 1]); + float tr = intBitsToFloat(tree[node + 2]); + node = offset; + if (tl > p[axis] || tr < p[axis]) + break; + continue; + } + } // traversal loop + + // stack is empty? + if (stackPos == 0) + return; + // move back up the stack + stackPos--; + node = stack[stackPos].node; + } + } + + bool writeToFile(FILE *wf) const; + bool readFromFile(FILE *rf); + + protected: + std::vector tree; + std::vector objects; + AABox bounds; + + struct buildData + { + uint32 *indices; + AABox *primBound; + uint32 numPrims; + int maxPrims; + }; + struct StackNode + { + uint32 node; + float tnear; + float tfar; + }; + + class BuildStats + { + private: + int numNodes; + int numLeaves; + int sumObjects; + int minObjects; + int maxObjects; + int sumDepth; + int minDepth; + int maxDepth; + int numLeavesN[6]; + int numBVH2; + + public: + BuildStats(): + numNodes(0), numLeaves(0), sumObjects(0), minObjects(0x0FFFFFFF), + maxObjects(0xFFFFFFFF), sumDepth(0), minDepth(0x0FFFFFFF), + maxDepth(0xFFFFFFFF), numBVH2(0) + { + for(int i=0; i<6; ++i) numLeavesN[i] = 0; + } + + void updateInner() { numNodes++; } + void updateBVH2() { numBVH2++; } + void updateLeaf(int depth, int n); + void printStats(); + }; + + void buildHierarchy(std::vector &tempTree, buildData &dat, BuildStats &stats); + + void createNode(std::vector &tempTree, int nodeIndex, uint32 left, uint32 right) { + // write leaf node + tempTree[nodeIndex + 0] = (3 << 30) | left; + tempTree[nodeIndex + 1] = right - left + 1; + } + + void subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats); +}; + +#endif // _BIH_H diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp new file mode 100644 index 00000000000..444e115f8b9 --- /dev/null +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -0,0 +1,589 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "Common.h" + +#include "Transports.h" +#include "MapManager.h" +#include "ObjectMgr.h" +#include "Path.h" + +#include "WorldPacket.h" +#include "DBCStores.h" +#include "ProgressBar.h" + +#include "World.h" + +void MapManager::LoadTransports() +{ + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports"); + + uint32 count = 0; + + if (!result) + { + barGoLink bar(1); + bar.step(); + + sLog.outString(); + sLog.outString(">> Loaded %u transports", count); + return; + } + + barGoLink bar(result->GetRowCount()); + + do + { + bar.step(); + + Transport *t = new Transport; + + Field *fields = result->Fetch(); + + uint32 entry = fields[0].GetUInt32(); + std::string name = fields[1].GetCppString(); + t->m_period = fields[2].GetUInt32(); + + const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry); + + if (!goinfo) + { + sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str()); + delete t; + continue; + } + + if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT) + { + sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str()); + delete t; + continue; + } + + // sLog.outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); + + std::set mapsUsed; + + if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) + // skip transports with empty waypoints list + { + sLog.outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.",goinfo->moTransport.taxiPathId); + delete t; + continue; + } + + float x, y, z, o; + uint32 mapid; + x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1; + + // creates the Gameobject + if (!t->Create(entry, mapid, x, y, z, o, 100, 0)) + { + delete t; + continue; + } + + m_Transports.insert(t); + + for (std::set::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i) + m_TransportsByMap[*i].insert(t); + + //If we someday decide to use the grid to track transports, here: + t->SetMap(MapManager::Instance().CreateMap(mapid, t, 0)); + + //t->GetMap()->Add((GameObject *)t); + ++count; + } while (result->NextRow()); + + sLog.outString(); + sLog.outString(">> Loaded %u transports", count); + + // check transport data DB integrity + result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry"); + if (result) // wrong data found + { + do + { + Field *fields = result->Fetch(); + + uint32 guid = fields[0].GetUInt32(); + uint32 entry = fields[1].GetUInt32(); + std::string name = fields[2].GetCppString(); + sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid); + } + while (result->NextRow()); + } +} + +Transport::Transport() : GameObject() +{ + m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION); +} + +bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) +{ + Relocate(x,y,z,ang); + // instance id and phaseMask isn't set to values different from std. + + if (!IsPositionValid()) + { + sLog.outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + guidlow,x,y); + return false; + } + + Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); + + GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); + + if (!goinfo) + { + sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang); + return false; + } + + m_goInfo = goinfo; + + SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); + + SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); + //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); + SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); + SetUInt32Value(GAMEOBJECT_LEVEL, m_period); + SetEntry(goinfo->id); + + SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); + + SetGoState(GO_STATE_READY); + SetGoType(GameobjectTypes(goinfo->type)); + + SetGoAnimProgress(animprogress); + if (dynflags) + SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags)); + + SetName(goinfo->name); + + return true; +} + +struct keyFrame +{ + keyFrame(float _x, float _y, float _z, uint32 _mapid, int _actionflag, int _delay) + { + x = _x; y = _y; z = _z; mapid = _mapid; actionflag = _actionflag; delay = _delay; distFromPrev = -1; distSinceStop = -1; distUntilStop = -1; + tFrom = 0; tTo = 0; + } + + float x; + float y; + float z; + uint32 mapid; + int actionflag; + int delay; + float distSinceStop; + float distUntilStop; + float distFromPrev; + float tFrom, tTo; +}; + +bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) +{ + TransportPath path; + objmgr.GetTransportPathNodes(pathid, path); + + if (path.Empty()) + return false; + + std::vector keyFrames; + int mapChange = 0; + mapids.clear(); + for (size_t i = 1; i < path.Size() - 1; ++i) + { + if (mapChange == 0) + { + if ((path[i].mapid == path[i+1].mapid)) + { + keyFrame k(path[i].x, path[i].y, path[i].z, path[i].mapid, path[i].actionFlag, path[i].delay); + keyFrames.push_back(k); + mapids.insert(k.mapid); + } + else + { + mapChange = 1; + } + } + else + { + --mapChange; + } + } + + int lastStop = -1; + int firstStop = -1; + + // first cell is arrived at by teleportation :S + keyFrames[0].distFromPrev = 0; + if (keyFrames[0].actionflag == 2) + { + lastStop = 0; + } + + // find the rest of the distances between key points + for (size_t i = 1; i < keyFrames.size(); ++i) + { + if ((keyFrames[i].actionflag == 1) || (keyFrames[i].mapid != keyFrames[i-1].mapid)) + { + keyFrames[i].distFromPrev = 0; + } + else + { + keyFrames[i].distFromPrev = + sqrt(pow(keyFrames[i].x - keyFrames[i - 1].x, 2) + + pow(keyFrames[i].y - keyFrames[i - 1].y, 2) + + pow(keyFrames[i].z - keyFrames[i - 1].z, 2)); + } + if (keyFrames[i].actionflag == 2) + { + // remember first stop frame + if (firstStop == -1) + firstStop = i; + lastStop = i; + } + } + + float tmpDist = 0; + for (size_t i = 0; i < keyFrames.size(); ++i) + { + int j = (i + lastStop) % keyFrames.size(); + if (keyFrames[j].actionflag == 2) + tmpDist = 0; + else + tmpDist += keyFrames[j].distFromPrev; + keyFrames[j].distSinceStop = tmpDist; + } + + for (int i = int(keyFrames.size()) - 1; i >= 0; i--) + { + int j = (i + (firstStop+1)) % keyFrames.size(); + tmpDist += keyFrames[(j + 1) % keyFrames.size()].distFromPrev; + keyFrames[j].distUntilStop = tmpDist; + if (keyFrames[j].actionflag == 2) + tmpDist = 0; + } + + for (size_t i = 0; i < keyFrames.size(); ++i) + { + if (keyFrames[i].distSinceStop < (30 * 30 * 0.5f)) + keyFrames[i].tFrom = sqrt(2 * keyFrames[i].distSinceStop); + else + keyFrames[i].tFrom = ((keyFrames[i].distSinceStop - (30 * 30 * 0.5f)) / 30) + 30; + + if (keyFrames[i].distUntilStop < (30 * 30 * 0.5f)) + keyFrames[i].tTo = sqrt(2 * keyFrames[i].distUntilStop); + else + keyFrames[i].tTo = ((keyFrames[i].distUntilStop - (30 * 30 * 0.5f)) / 30) + 30; + + keyFrames[i].tFrom *= 1000; + keyFrames[i].tTo *= 1000; + } + + // for (int i = 0; i < keyFrames.size(); ++i) { + // sLog.outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo); + // } + + // Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals + // speed = max(30, t) (remember x = 0.5s^2, and when accelerating, a = 1 unit/s^2 + int t = 0; + bool teleport = false; + if (keyFrames[keyFrames.size() - 1].mapid != keyFrames[0].mapid) + teleport = true; + + WayPoint pos(keyFrames[0].mapid, keyFrames[0].x, keyFrames[0].y, keyFrames[0].z, teleport, 0); + m_WayPoints[0] = pos; + t += keyFrames[0].delay * 1000; + + uint32 cM = keyFrames[0].mapid; + for (size_t i = 0; i < keyFrames.size() - 1; ++i) + { + float d = 0; + float tFrom = keyFrames[i].tFrom; + float tTo = keyFrames[i].tTo; + + // keep the generation of all these points; we use only a few now, but may need the others later + if (((d < keyFrames[i + 1].distFromPrev) && (tTo > 0))) + { + while ((d < keyFrames[i + 1].distFromPrev) && (tTo > 0)) + { + tFrom += 100; + tTo -= 100; + + if (d > 0) + { + float newX, newY, newZ; + newX = keyFrames[i].x + (keyFrames[i + 1].x - keyFrames[i].x) * d / keyFrames[i + 1].distFromPrev; + newY = keyFrames[i].y + (keyFrames[i + 1].y - keyFrames[i].y) * d / keyFrames[i + 1].distFromPrev; + newZ = keyFrames[i].z + (keyFrames[i + 1].z - keyFrames[i].z) * d / keyFrames[i + 1].distFromPrev; + + bool teleport = false; + if (keyFrames[i].mapid != cM) + { + teleport = true; + cM = keyFrames[i].mapid; + } + + // sLog.outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ); + WayPoint pos(keyFrames[i].mapid, newX, newY, newZ, teleport, i); + if (teleport) + m_WayPoints[t] = pos; + } + + if (tFrom < tTo) // caught in tFrom dock's "gravitational pull" + { + if (tFrom <= 30000) + { + d = 0.5f * (tFrom / 1000) * (tFrom / 1000); + } + else + { + d = 0.5f * 30 * 30 + 30 * ((tFrom - 30000) / 1000); + } + d = d - keyFrames[i].distSinceStop; + } + else + { + if (tTo <= 30000) + { + d = 0.5f * (tTo / 1000) * (tTo / 1000); + } + else + { + d = 0.5f * 30 * 30 + 30 * ((tTo - 30000) / 1000); + } + d = keyFrames[i].distUntilStop - d; + } + t += 100; + } + t -= 100; + } + + if (keyFrames[i + 1].tFrom > keyFrames[i + 1].tTo) + t += 100 - ((long)keyFrames[i + 1].tTo % 100); + else + t += (long)keyFrames[i + 1].tTo % 100; + + bool teleport = false; + if ((keyFrames[i + 1].actionflag == 1) || (keyFrames[i + 1].mapid != keyFrames[i].mapid)) + { + teleport = true; + cM = keyFrames[i + 1].mapid; + } + + WayPoint pos(keyFrames[i + 1].mapid, keyFrames[i + 1].x, keyFrames[i + 1].y, keyFrames[i + 1].z, teleport, i); + + // sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); +/* + if (keyFrames[i+1].delay > 5) + pos.delayed = true; +*/ + //if (teleport) + m_WayPoints[t] = pos; + + t += keyFrames[i + 1].delay * 1000; + // sLog.outString("------"); + } + + uint32 timer = t; + + // sLog.outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer); + + m_curr = m_WayPoints.begin(); + m_curr = GetNextWayPoint(); + m_next = GetNextWayPoint(); + m_pathTime = timer; + + m_nextNodeTime = m_curr->first; + + return true; +} + +Transport::WayPointMap::const_iterator Transport::GetNextWayPoint() +{ + WayPointMap::const_iterator iter = m_curr; + ++iter; + if (iter == m_WayPoints.end()) + iter = m_WayPoints.begin(); + return iter; +} + +void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) +{ + Map const* oldMap = GetMap(); + Relocate(x, y, z); + + for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) + { + Player *plr = *itr; + ++itr; + + if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + { + plr->ResurrectPlayer(1.0); + } + plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); + + //WorldPacket data(SMSG_811, 4); + //data << uint32(0); + //plr->GetSession()->SendPacket(&data); + } + + //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... + //player far teleport would try to create same instance, but we need it NOW for transport... + //correct me if I'm wrong O.o + //yes, you're right + + ResetMap(); + Map * newMap = MapManager::Instance().CreateMap(newMapid, this, 0); + SetMap(newMap); + assert (GetMap()); + + if (oldMap != newMap) + { + UpdateForMap(oldMap); + UpdateForMap(newMap); + } +} + +bool Transport::AddPassenger(Player* passenger) +{ + if (m_passengers.insert(passenger).second) + sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName()); + return true; +} + +bool Transport::RemovePassenger(Player* passenger) +{ + if (m_passengers.erase(passenger)) + sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName()); + return true; +} + +void Transport::CheckForEvent(uint32 entry, uint32 wp_id) +{ + uint32 key = entry*100+wp_id; + if (objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end()) + GetMap()->ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL); +} + +void Transport::Update(uint32 /*p_time*/) +{ + if (m_WayPoints.size() <= 1) + return; + + m_timer = getMSTime() % m_period; + while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime)) + { + m_curr = GetNextWayPoint(); + m_next = GetNextWayPoint(); + + // first check help in case client-server transport coordinates de-synchronization + if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport) + { + TeleportTransport(m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); + } + else + { + Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); + } +/* + if (m_curr->second.delayed) + { + switch (GetEntry()) + { + case 176495: + case 164871: + case 175080: + SendPlaySound(11804, false); break; // ZeppelinDocked + case 20808: + case 181646: + case 176231: + case 176244: + case 176310: + case 177233: + SendPlaySound(5495, false);break; // BoatDockingWarning + default: + SendPlaySound(5154, false); break; // ShipDocked + } + } +*/ + /* + for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) + { + PlayerSet::const_iterator it2 = itr; + ++itr; + //(*it2)->SetPosition(m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO()); + } + */ + + m_nextNodeTime = m_curr->first; + + if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0) + sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str()); + + if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0) + sLog.outDetail("%s moved to %d %f %f %f %d", this->m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); + + //Transport Event System + CheckForEvent(this->GetEntry(), m_curr->second.id); + } +} + +void Transport::UpdateForMap(Map const* targetMap) +{ + Map::PlayerList const& pl = targetMap->GetPlayers(); + if (pl.isEmpty()) + return; + + if (GetMapId() == targetMap->GetId()) + { + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + { + if (this != itr->getSource()->GetTransport()) + { + UpdateData transData; + BuildCreateUpdateBlockForPlayer(&transData, itr->getSource()); + WorldPacket packet; + transData.BuildPacket(&packet); + itr->getSource()->SendDirectMessage(&packet); + } + } + } + else + { + UpdateData transData; + BuildOutOfRangeUpdateBlock(&transData); + WorldPacket out_packet; + transData.BuildPacket(&out_packet); + + for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + if (this != itr->getSource()->GetTransport()) + itr->getSource()->SendDirectMessage(&out_packet); + } +} + diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h new file mode 100644 index 00000000000..25b9ade1461 --- /dev/null +++ b/src/server/game/Entities/Transport/Transport.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef TRANSPORTS_H +#define TRANSPORTS_H + +#include "GameObject.h" + +#include +#include +#include + +class TransportPath +{ + public: + struct PathNode + { + uint32 mapid; + float x,y,z; + uint32 actionFlag; + uint32 delay; + }; + + void SetLength(const unsigned int sz) + { + i_nodes.resize(sz); + } + + unsigned int Size(void) const { return i_nodes.size(); } + bool Empty(void) const { return i_nodes.empty(); } + void Resize(unsigned int sz) { i_nodes.resize(sz); } + void Clear(void) { i_nodes.clear(); } + PathNode* GetNodes(void) { return static_cast(&i_nodes[0]); } + + PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; } + const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; } + + protected: + std::vector i_nodes; +}; + +class Transport : public GameObject +{ + public: + explicit Transport(); + + bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); + bool GenerateWaypoints(uint32 pathid, std::set &mapids); + void Update(uint32 p_time); + bool AddPassenger(Player* passenger); + bool RemovePassenger(Player* passenger); + void CheckForEvent(uint32 entry, uint32 wp_id); + + typedef std::set PlayerSet; + PlayerSet const& GetPassengers() const { return m_passengers; } + + private: + struct WayPoint + { + WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false), id(0) {} + WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _id) : + mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport), id(_id) {} + uint32 mapid; + float x; + float y; + float z; + bool teleport; + uint32 id; + }; + + typedef std::map WayPointMap; + + WayPointMap::const_iterator m_curr; + WayPointMap::const_iterator m_next; + uint32 m_pathTime; + uint32 m_timer; + + PlayerSet m_passengers; + + public: + WayPointMap m_WayPoints; + uint32 m_nextNodeTime; + uint32 m_period; + + private: + void TeleportTransport(uint32 newMapid, float x, float y, float z); + void UpdateForMap(Map const* map); + WayPointMap::const_iterator GetNextWayPoint(); +}; +#endif + diff --git a/src/server/game/Entities/Transport/Transports.cpp b/src/server/game/Entities/Transport/Transports.cpp deleted file mode 100644 index 444e115f8b9..00000000000 --- a/src/server/game/Entities/Transport/Transports.cpp +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * Copyright (C) 2008-2010 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "Common.h" - -#include "Transports.h" -#include "MapManager.h" -#include "ObjectMgr.h" -#include "Path.h" - -#include "WorldPacket.h" -#include "DBCStores.h" -#include "ProgressBar.h" - -#include "World.h" - -void MapManager::LoadTransports() -{ - QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports"); - - uint32 count = 0; - - if (!result) - { - barGoLink bar(1); - bar.step(); - - sLog.outString(); - sLog.outString(">> Loaded %u transports", count); - return; - } - - barGoLink bar(result->GetRowCount()); - - do - { - bar.step(); - - Transport *t = new Transport; - - Field *fields = result->Fetch(); - - uint32 entry = fields[0].GetUInt32(); - std::string name = fields[1].GetCppString(); - t->m_period = fields[2].GetUInt32(); - - const GameObjectInfo *goinfo = objmgr.GetGameObjectInfo(entry); - - if (!goinfo) - { - sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str()); - delete t; - continue; - } - - if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT) - { - sLog.outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str()); - delete t; - continue; - } - - // sLog.outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name); - - std::set mapsUsed; - - if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) - // skip transports with empty waypoints list - { - sLog.outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.",goinfo->moTransport.taxiPathId); - delete t; - continue; - } - - float x, y, z, o; - uint32 mapid; - x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1; - - // creates the Gameobject - if (!t->Create(entry, mapid, x, y, z, o, 100, 0)) - { - delete t; - continue; - } - - m_Transports.insert(t); - - for (std::set::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i) - m_TransportsByMap[*i].insert(t); - - //If we someday decide to use the grid to track transports, here: - t->SetMap(MapManager::Instance().CreateMap(mapid, t, 0)); - - //t->GetMap()->Add((GameObject *)t); - ++count; - } while (result->NextRow()); - - sLog.outString(); - sLog.outString(">> Loaded %u transports", count); - - // check transport data DB integrity - result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry"); - if (result) // wrong data found - { - do - { - Field *fields = result->Fetch(); - - uint32 guid = fields[0].GetUInt32(); - uint32 entry = fields[1].GetUInt32(); - std::string name = fields[2].GetCppString(); - sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid); - } - while (result->NextRow()); - } -} - -Transport::Transport() : GameObject() -{ - m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION); -} - -bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) -{ - Relocate(x,y,z,ang); - // instance id and phaseMask isn't set to values different from std. - - if (!IsPositionValid()) - { - sLog.outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", - guidlow,x,y); - return false; - } - - Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT); - - GameObjectInfo const* goinfo = objmgr.GetGameObjectInfo(guidlow); - - if (!goinfo) - { - sLog.outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f",guidlow, mapid, x, y, z, ang); - return false; - } - - m_goInfo = goinfo; - - SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); - - SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); - //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); - SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); - SetUInt32Value(GAMEOBJECT_LEVEL, m_period); - SetEntry(goinfo->id); - - SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); - - SetGoState(GO_STATE_READY); - SetGoType(GameobjectTypes(goinfo->type)); - - SetGoAnimProgress(animprogress); - if (dynflags) - SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags)); - - SetName(goinfo->name); - - return true; -} - -struct keyFrame -{ - keyFrame(float _x, float _y, float _z, uint32 _mapid, int _actionflag, int _delay) - { - x = _x; y = _y; z = _z; mapid = _mapid; actionflag = _actionflag; delay = _delay; distFromPrev = -1; distSinceStop = -1; distUntilStop = -1; - tFrom = 0; tTo = 0; - } - - float x; - float y; - float z; - uint32 mapid; - int actionflag; - int delay; - float distSinceStop; - float distUntilStop; - float distFromPrev; - float tFrom, tTo; -}; - -bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) -{ - TransportPath path; - objmgr.GetTransportPathNodes(pathid, path); - - if (path.Empty()) - return false; - - std::vector keyFrames; - int mapChange = 0; - mapids.clear(); - for (size_t i = 1; i < path.Size() - 1; ++i) - { - if (mapChange == 0) - { - if ((path[i].mapid == path[i+1].mapid)) - { - keyFrame k(path[i].x, path[i].y, path[i].z, path[i].mapid, path[i].actionFlag, path[i].delay); - keyFrames.push_back(k); - mapids.insert(k.mapid); - } - else - { - mapChange = 1; - } - } - else - { - --mapChange; - } - } - - int lastStop = -1; - int firstStop = -1; - - // first cell is arrived at by teleportation :S - keyFrames[0].distFromPrev = 0; - if (keyFrames[0].actionflag == 2) - { - lastStop = 0; - } - - // find the rest of the distances between key points - for (size_t i = 1; i < keyFrames.size(); ++i) - { - if ((keyFrames[i].actionflag == 1) || (keyFrames[i].mapid != keyFrames[i-1].mapid)) - { - keyFrames[i].distFromPrev = 0; - } - else - { - keyFrames[i].distFromPrev = - sqrt(pow(keyFrames[i].x - keyFrames[i - 1].x, 2) + - pow(keyFrames[i].y - keyFrames[i - 1].y, 2) + - pow(keyFrames[i].z - keyFrames[i - 1].z, 2)); - } - if (keyFrames[i].actionflag == 2) - { - // remember first stop frame - if (firstStop == -1) - firstStop = i; - lastStop = i; - } - } - - float tmpDist = 0; - for (size_t i = 0; i < keyFrames.size(); ++i) - { - int j = (i + lastStop) % keyFrames.size(); - if (keyFrames[j].actionflag == 2) - tmpDist = 0; - else - tmpDist += keyFrames[j].distFromPrev; - keyFrames[j].distSinceStop = tmpDist; - } - - for (int i = int(keyFrames.size()) - 1; i >= 0; i--) - { - int j = (i + (firstStop+1)) % keyFrames.size(); - tmpDist += keyFrames[(j + 1) % keyFrames.size()].distFromPrev; - keyFrames[j].distUntilStop = tmpDist; - if (keyFrames[j].actionflag == 2) - tmpDist = 0; - } - - for (size_t i = 0; i < keyFrames.size(); ++i) - { - if (keyFrames[i].distSinceStop < (30 * 30 * 0.5f)) - keyFrames[i].tFrom = sqrt(2 * keyFrames[i].distSinceStop); - else - keyFrames[i].tFrom = ((keyFrames[i].distSinceStop - (30 * 30 * 0.5f)) / 30) + 30; - - if (keyFrames[i].distUntilStop < (30 * 30 * 0.5f)) - keyFrames[i].tTo = sqrt(2 * keyFrames[i].distUntilStop); - else - keyFrames[i].tTo = ((keyFrames[i].distUntilStop - (30 * 30 * 0.5f)) / 30) + 30; - - keyFrames[i].tFrom *= 1000; - keyFrames[i].tTo *= 1000; - } - - // for (int i = 0; i < keyFrames.size(); ++i) { - // sLog.outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo); - // } - - // Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals - // speed = max(30, t) (remember x = 0.5s^2, and when accelerating, a = 1 unit/s^2 - int t = 0; - bool teleport = false; - if (keyFrames[keyFrames.size() - 1].mapid != keyFrames[0].mapid) - teleport = true; - - WayPoint pos(keyFrames[0].mapid, keyFrames[0].x, keyFrames[0].y, keyFrames[0].z, teleport, 0); - m_WayPoints[0] = pos; - t += keyFrames[0].delay * 1000; - - uint32 cM = keyFrames[0].mapid; - for (size_t i = 0; i < keyFrames.size() - 1; ++i) - { - float d = 0; - float tFrom = keyFrames[i].tFrom; - float tTo = keyFrames[i].tTo; - - // keep the generation of all these points; we use only a few now, but may need the others later - if (((d < keyFrames[i + 1].distFromPrev) && (tTo > 0))) - { - while ((d < keyFrames[i + 1].distFromPrev) && (tTo > 0)) - { - tFrom += 100; - tTo -= 100; - - if (d > 0) - { - float newX, newY, newZ; - newX = keyFrames[i].x + (keyFrames[i + 1].x - keyFrames[i].x) * d / keyFrames[i + 1].distFromPrev; - newY = keyFrames[i].y + (keyFrames[i + 1].y - keyFrames[i].y) * d / keyFrames[i + 1].distFromPrev; - newZ = keyFrames[i].z + (keyFrames[i + 1].z - keyFrames[i].z) * d / keyFrames[i + 1].distFromPrev; - - bool teleport = false; - if (keyFrames[i].mapid != cM) - { - teleport = true; - cM = keyFrames[i].mapid; - } - - // sLog.outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ); - WayPoint pos(keyFrames[i].mapid, newX, newY, newZ, teleport, i); - if (teleport) - m_WayPoints[t] = pos; - } - - if (tFrom < tTo) // caught in tFrom dock's "gravitational pull" - { - if (tFrom <= 30000) - { - d = 0.5f * (tFrom / 1000) * (tFrom / 1000); - } - else - { - d = 0.5f * 30 * 30 + 30 * ((tFrom - 30000) / 1000); - } - d = d - keyFrames[i].distSinceStop; - } - else - { - if (tTo <= 30000) - { - d = 0.5f * (tTo / 1000) * (tTo / 1000); - } - else - { - d = 0.5f * 30 * 30 + 30 * ((tTo - 30000) / 1000); - } - d = keyFrames[i].distUntilStop - d; - } - t += 100; - } - t -= 100; - } - - if (keyFrames[i + 1].tFrom > keyFrames[i + 1].tTo) - t += 100 - ((long)keyFrames[i + 1].tTo % 100); - else - t += (long)keyFrames[i + 1].tTo % 100; - - bool teleport = false; - if ((keyFrames[i + 1].actionflag == 1) || (keyFrames[i + 1].mapid != keyFrames[i].mapid)) - { - teleport = true; - cM = keyFrames[i + 1].mapid; - } - - WayPoint pos(keyFrames[i + 1].mapid, keyFrames[i + 1].x, keyFrames[i + 1].y, keyFrames[i + 1].z, teleport, i); - - // sLog.outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport); -/* - if (keyFrames[i+1].delay > 5) - pos.delayed = true; -*/ - //if (teleport) - m_WayPoints[t] = pos; - - t += keyFrames[i + 1].delay * 1000; - // sLog.outString("------"); - } - - uint32 timer = t; - - // sLog.outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer); - - m_curr = m_WayPoints.begin(); - m_curr = GetNextWayPoint(); - m_next = GetNextWayPoint(); - m_pathTime = timer; - - m_nextNodeTime = m_curr->first; - - return true; -} - -Transport::WayPointMap::const_iterator Transport::GetNextWayPoint() -{ - WayPointMap::const_iterator iter = m_curr; - ++iter; - if (iter == m_WayPoints.end()) - iter = m_WayPoints.begin(); - return iter; -} - -void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) -{ - Map const* oldMap = GetMap(); - Relocate(x, y, z); - - for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) - { - Player *plr = *itr; - ++itr; - - if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - { - plr->ResurrectPlayer(1.0); - } - plr->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); - - //WorldPacket data(SMSG_811, 4); - //data << uint32(0); - //plr->GetSession()->SendPacket(&data); - } - - //we need to create and save new Map object with 'newMapid' because if not done -> lead to invalid Map object reference... - //player far teleport would try to create same instance, but we need it NOW for transport... - //correct me if I'm wrong O.o - //yes, you're right - - ResetMap(); - Map * newMap = MapManager::Instance().CreateMap(newMapid, this, 0); - SetMap(newMap); - assert (GetMap()); - - if (oldMap != newMap) - { - UpdateForMap(oldMap); - UpdateForMap(newMap); - } -} - -bool Transport::AddPassenger(Player* passenger) -{ - if (m_passengers.insert(passenger).second) - sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName()); - return true; -} - -bool Transport::RemovePassenger(Player* passenger) -{ - if (m_passengers.erase(passenger)) - sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName()); - return true; -} - -void Transport::CheckForEvent(uint32 entry, uint32 wp_id) -{ - uint32 key = entry*100+wp_id; - if (objmgr.TransportEventMap.find(key) != objmgr.TransportEventMap.end()) - GetMap()->ScriptsStart(sEventScripts, objmgr.TransportEventMap[key], this, NULL); -} - -void Transport::Update(uint32 /*p_time*/) -{ - if (m_WayPoints.size() <= 1) - return; - - m_timer = getMSTime() % m_period; - while (((m_timer - m_curr->first) % m_pathTime) > ((m_next->first - m_curr->first) % m_pathTime)) - { - m_curr = GetNextWayPoint(); - m_next = GetNextWayPoint(); - - // first check help in case client-server transport coordinates de-synchronization - if (m_curr->second.mapid != GetMapId() || m_curr->second.teleport) - { - TeleportTransport(m_curr->second.mapid, m_curr->second.x, m_curr->second.y, m_curr->second.z); - } - else - { - Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); - } -/* - if (m_curr->second.delayed) - { - switch (GetEntry()) - { - case 176495: - case 164871: - case 175080: - SendPlaySound(11804, false); break; // ZeppelinDocked - case 20808: - case 181646: - case 176231: - case 176244: - case 176310: - case 177233: - SendPlaySound(5495, false);break; // BoatDockingWarning - default: - SendPlaySound(5154, false); break; // ShipDocked - } - } -*/ - /* - for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) - { - PlayerSet::const_iterator it2 = itr; - ++itr; - //(*it2)->SetPosition(m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO()); - } - */ - - m_nextNodeTime = m_curr->first; - - if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0) - sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str()); - - if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES) == 0) - sLog.outDetail("%s moved to %d %f %f %f %d", this->m_name.c_str(), m_curr->second.id, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); - - //Transport Event System - CheckForEvent(this->GetEntry(), m_curr->second.id); - } -} - -void Transport::UpdateForMap(Map const* targetMap) -{ - Map::PlayerList const& pl = targetMap->GetPlayers(); - if (pl.isEmpty()) - return; - - if (GetMapId() == targetMap->GetId()) - { - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - { - if (this != itr->getSource()->GetTransport()) - { - UpdateData transData; - BuildCreateUpdateBlockForPlayer(&transData, itr->getSource()); - WorldPacket packet; - transData.BuildPacket(&packet); - itr->getSource()->SendDirectMessage(&packet); - } - } - } - else - { - UpdateData transData; - BuildOutOfRangeUpdateBlock(&transData); - WorldPacket out_packet; - transData.BuildPacket(&out_packet); - - for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) - if (this != itr->getSource()->GetTransport()) - itr->getSource()->SendDirectMessage(&out_packet); - } -} - diff --git a/src/server/game/Entities/Transport/Transports.h b/src/server/game/Entities/Transport/Transports.h deleted file mode 100644 index 25b9ade1461..00000000000 --- a/src/server/game/Entities/Transport/Transports.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * Copyright (C) 2008-2010 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef TRANSPORTS_H -#define TRANSPORTS_H - -#include "GameObject.h" - -#include -#include -#include - -class TransportPath -{ - public: - struct PathNode - { - uint32 mapid; - float x,y,z; - uint32 actionFlag; - uint32 delay; - }; - - void SetLength(const unsigned int sz) - { - i_nodes.resize(sz); - } - - unsigned int Size(void) const { return i_nodes.size(); } - bool Empty(void) const { return i_nodes.empty(); } - void Resize(unsigned int sz) { i_nodes.resize(sz); } - void Clear(void) { i_nodes.clear(); } - PathNode* GetNodes(void) { return static_cast(&i_nodes[0]); } - - PathNode& operator[](const unsigned int idx) { return i_nodes[idx]; } - const PathNode& operator()(const unsigned int idx) const { return i_nodes[idx]; } - - protected: - std::vector i_nodes; -}; - -class Transport : public GameObject -{ - public: - explicit Transport(); - - bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); - bool GenerateWaypoints(uint32 pathid, std::set &mapids); - void Update(uint32 p_time); - bool AddPassenger(Player* passenger); - bool RemovePassenger(Player* passenger); - void CheckForEvent(uint32 entry, uint32 wp_id); - - typedef std::set PlayerSet; - PlayerSet const& GetPassengers() const { return m_passengers; } - - private: - struct WayPoint - { - WayPoint() : mapid(0), x(0), y(0), z(0), teleport(false), id(0) {} - WayPoint(uint32 _mapid, float _x, float _y, float _z, bool _teleport, uint32 _id) : - mapid(_mapid), x(_x), y(_y), z(_z), teleport(_teleport), id(_id) {} - uint32 mapid; - float x; - float y; - float z; - bool teleport; - uint32 id; - }; - - typedef std::map WayPointMap; - - WayPointMap::const_iterator m_curr; - WayPointMap::const_iterator m_next; - uint32 m_pathTime; - uint32 m_timer; - - PlayerSet m_passengers; - - public: - WayPointMap m_WayPoints; - uint32 m_nextNodeTime; - uint32 m_period; - - private: - void TeleportTransport(uint32 newMapid, float x, float y, float z); - void UpdateForMap(Map const* map); - WayPointMap::const_iterator GetNextWayPoint(); -}; -#endif - -- cgit v1.2.3