summaryrefslogtreecommitdiff
path: root/src/player_type.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-12 14:10:35 +0000
committerrubidium <rubidium@openttd.org>2008-01-12 14:10:35 +0000
commitac528411df2e42e066ab301517bd85743162f356 (patch)
treedd717901825d2b9701f42a6a4bedb895deb3017a /src/player_type.h
parentcbbc53e8f84067cae60c6f2e8e00682c968430a7 (diff)
downloadopenttd-ac528411df2e42e066ab301517bd85743162f356.tar.xz
(svn r11818) -Codechange: split player.h into smaller pieces.
Diffstat (limited to 'src/player_type.h')
-rw-r--r--src/player_type.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/player_type.h b/src/player_type.h
new file mode 100644
index 000000000..0e183fabe
--- /dev/null
+++ b/src/player_type.h
@@ -0,0 +1,41 @@
+/* $Id$ */
+
+/** @file player_type.h Types related to players. */
+
+#ifndef PLAYER_TYPE_H
+#define PLAYER_TYPE_H
+
+/**
+ * Enum for all players/owners.
+ */
+enum Owner {
+ /* Player identifiers All players below MAX_PLAYERS are playable
+ * players, above, they are special, computer controlled players */
+ OWNER_BEGIN = 0x00, ///< First Owner
+ PLAYER_FIRST = 0x00, ///< First Player, same as owner
+ MAX_PLAYERS = 0x08, ///< Maximum numbe rof players
+ OWNER_TOWN = 0x0F, ///< A town owns the tile, or a town is expanding
+ OWNER_NONE = 0x10, ///< The tile has no ownership
+ OWNER_WATER = 0x11, ///< The tile/execution is done by "water"
+ OWNER_END, ///< Last + 1 owner
+ INVALID_OWNER = 0xFF, ///< An invalid owner
+ INVALID_PLAYER = 0xFF, ///< And a valid owner
+
+ /* 'Fake' Players used for networks */
+ PLAYER_INACTIVE_CLIENT = 253, ///< The client is joining
+ PLAYER_NEW_COMPANY = 254, ///< The client wants a new company
+ PLAYER_SPECTATOR = 255, ///< The client is spectating
+};
+DECLARE_POSTFIX_INCREMENT(Owner);
+
+/** Define basic enum properties */
+template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
+typedef TinyEnumT<Owner> OwnerByte;
+
+typedef Owner PlayerID;
+typedef OwnerByte PlayerByte;
+
+struct Player;
+typedef uint32 PlayerFace; ///< player face bits, info see in player_face.h
+
+#endif /* PLAYER_TYPE_H */