소스 검색

Add TeleportChannel / TeleportChannelID / ETeleportChannelType

TeleportChannel is structure that contain two vectors of entrances and exits for certain teleport channel. It's also store passability state independently which almost only useful for Player and AI as they can't know if channel passible or not until enough entrances / exits are visible or server passed them information that certain channel is impassible when they visited entrance.

ETeleportChannelType is determined by checking intersection between entrances and exit vectors or checking their size:
 - IMPASSABLE: one of vectors empty or only one entrance id is same as only one exit id.
 - BIDIRECTIONAL: contents of both vectors is exactly the same.
 - UNIDIRECTIONAL: contents of both vectors do not intersect.
 - MIXED: contents of vectors only partially intersect. Not currently used; added for future modding.
ArseniyShestakov 10 년 전
부모
커밋
04a1df29ad
2개의 변경된 파일35개의 추가작업 그리고 0개의 파일을 삭제
  1. 19 0
      lib/GameConstants.h
  2. 16 0
      lib/mapObjects/MiscObjects.h

+ 19 - 0
lib/GameConstants.h

@@ -252,6 +252,14 @@ class TeamID : public BaseForID<TeamID, ui8>
 	friend class CNonConstInfoCallback;
 };
 
+class TeleportChannelID : public BaseForID<TeleportChannelID, si32>
+{
+	INSTID_LIKE_CLASS_COMMON(TeleportChannelID, si32)
+
+	friend class CGameInfoCallback;
+	friend class CNonConstInfoCallback;
+};
+
 // #ifndef INSTANTIATE_BASE_FOR_ID_HERE
 // extern template std::ostream & operator << <ArtifactInstanceID>(std::ostream & os, BaseForID<ArtifactInstanceID> id);
 // extern template std::ostream & operator << <ObjectInstanceID>(std::ostream & os, BaseForID<ObjectInstanceID> id);
@@ -466,6 +474,17 @@ namespace ETileType
 	};
 }
 
+namespace ETeleportChannelType
+{
+	enum ETeleportChannelType
+	{
+		IMPASSABLE,
+		BIDIRECTIONAL,
+		UNIDIRECTIONAL,
+		MIXED
+	};
+}
+
 class Obj
 {
 public:

+ 16 - 0
lib/mapObjects/MiscObjects.h

@@ -247,6 +247,22 @@ public:
 	ui32 defaultResProduction();
 };
 
+struct DLL_LINKAGE TeleportChannel
+{
+	enum EPassability {UNKNOWN, IMPASSABLE, PASSABLE};
+
+	TeleportChannel() : passability(UNKNOWN) {}
+
+	std::vector<ObjectInstanceID> entrances;
+	std::vector<ObjectInstanceID> exits;
+	EPassability passability;
+
+	template <typename Handler> void serialize(Handler &h, const int version)
+	{
+		h & entrances & exits & passability;
+	}
+};
+
 class DLL_LINKAGE CGTeleport : public CGObjectInstance //teleports and subterranean gates
 {
 public: