pathfinder_interface.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #pragma once
  2. #include "map.h"
  3. #include <list>
  4. class Client;
  5. class Seperator;
  6. enum PathingPolyFlags
  7. {
  8. PathingNormal = 1,
  9. PathingWater = 2,
  10. PathingLava = 4,
  11. PathingZoneLine = 8,
  12. PathingPvP = 16,
  13. PathingSlime = 32,
  14. PathingIce = 64,
  15. PathingVWater = 128,
  16. PathingGeneralArea = 256,
  17. PathingPortal = 512,
  18. PathingPrefer = 1024,
  19. PathingDisabled = 2048,
  20. PathingAll = 65535,
  21. PathingNotDisabled = PathingAll ^ PathingDisabled
  22. };
  23. struct PathfinderOptions
  24. {
  25. PathfinderOptions() {
  26. flags = PathingNotDisabled;
  27. smooth_path = true;
  28. step_size = 10.0f;
  29. flag_cost[0] = 1.0f;
  30. flag_cost[1] = 3.0f;
  31. flag_cost[2] = 5.0f;
  32. flag_cost[3] = 1.0f;
  33. flag_cost[4] = 2.0f;
  34. flag_cost[5] = 2.0f;
  35. flag_cost[6] = 4.0f;
  36. flag_cost[7] = 1.0f;
  37. flag_cost[8] = 0.1f;
  38. flag_cost[9] = 0.1f;
  39. offset = 3.25f;
  40. }
  41. int flags;
  42. bool smooth_path;
  43. float step_size;
  44. float flag_cost[10];
  45. float offset;
  46. };
  47. class IPathfinder
  48. {
  49. public:
  50. struct IPathNode
  51. {
  52. IPathNode(const glm::vec3 &p) {
  53. pos = p;
  54. teleport = false;
  55. }
  56. IPathNode(bool tp) {
  57. teleport = tp;
  58. }
  59. glm::vec3 pos;
  60. bool teleport;
  61. };
  62. typedef std::list<IPathNode> IPath;
  63. IPathfinder() { }
  64. virtual ~IPathfinder() { }
  65. virtual IPath FindRoute(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck, int flags = PathingNotDisabled) = 0;
  66. virtual IPath FindPath(const glm::vec3 &start, const glm::vec3 &end, bool &partial, bool &stuck, const PathfinderOptions& opts) = 0;
  67. virtual glm::vec3 GetRandomLocation(const glm::vec3 &start) = 0;
  68. static IPathfinder *Load(const std::string &zone);
  69. };