1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};

This commit is contained in:
rubidium
2007-03-07 12:11:48 +00:00
parent 36bb92ae24
commit 24c4d5b06d
138 changed files with 779 additions and 789 deletions

View File

@@ -16,7 +16,7 @@ bool NetworkCoreInitialize();
void NetworkCoreShutdown();
/** Status of a network client; reasons why a client has quit */
typedef enum {
enum NetworkRecvStatus {
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs
@@ -27,7 +27,7 @@ typedef enum {
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done quering the server
} NetworkRecvStatus;
};
/** Forward declaration due to circular dependencies */
struct Packet;

View File

@@ -19,7 +19,7 @@
* some fields will be empty on the client (like game_password) by default
* and only filled with data a player enters.
*/
typedef struct NetworkGameInfo {
struct NetworkGameInfo {
byte game_info_version; ///< Version of the game info
char server_name[NETWORK_NAME_LENGTH]; ///< Server name
char hostname[NETWORK_HOSTNAME_LENGTH]; ///< Hostname of the server (if any)
@@ -43,8 +43,8 @@ typedef struct NetworkGameInfo {
byte map_set; ///< Graphical set
bool dedicated; ///< Is this a dedicated server?
char rcon_password[NETWORK_PASSWORD_LENGTH]; ///< RCon password for the server. "" if rcon is disabled
struct GRFConfig *grfconfig; ///< List of NewGRF files used
} NetworkGameInfo;
GRFConfig *grfconfig; ///< List of NewGRF files used
};
#endif /* ENABLE_NETWORK */

View File

@@ -58,8 +58,8 @@ enum {
};
/** Packet that wraps a command */
typedef struct CommandPacket {
struct CommandPacket *next; ///< the next command packet (if in queue)
struct CommandPacket {
CommandPacket *next; ///< the next command packet (if in queue)
PlayerByte player; ///< player that is executing the command
uint32 cmd; ///< command being executed
uint32 p1; ///< parameter p1
@@ -68,10 +68,10 @@ typedef struct CommandPacket {
char text[80]; ///< possible text sent for name changes etc
uint32 frame; ///< the frame in which this packet is executed
byte callback; ///< any callback function executed upon successful completion of the command
} CommandPacket;
};
/** Status of a client */
typedef enum {
enum ClientStatus {
STATUS_INACTIVE, ///< The client is not connected nor active
STATUS_AUTHORIZING,///< The client is authorizing
STATUS_AUTH, ///< The client is authorized
@@ -80,7 +80,7 @@ typedef enum {
STATUS_DONE_MAP, ///< The client has downloaded the map
STATUS_PRE_ACTIVE, ///< The client is catching up the delayed frames
STATUS_ACTIVE, ///< The client is an active player in the game
} ClientStatus;
};
/** Base socket handler for all TCP sockets */
class NetworkTCPSocketHandler : public NetworkSocketHandler {

View File

@@ -40,7 +40,7 @@
#define NETWORK_VEHICLE_TYPES 5
#define NETWORK_STATION_TYPES 5
typedef struct NetworkPlayerInfo {
struct NetworkPlayerInfo {
char company_name[NETWORK_NAME_LENGTH]; // Company name
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player
Year inaugurated_year; // What year the company started in
@@ -53,9 +53,9 @@ typedef struct NetworkPlayerInfo {
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type?
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..)
uint16 months_empty; // How many months the company is empty
} NetworkPlayerInfo;
};
typedef struct NetworkClientInfo {
struct NetworkClientInfo {
uint16 client_index; // Index of the client (same as ClientState->index)
char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client
byte client_lang; // The language of the client
@@ -63,9 +63,9 @@ typedef struct NetworkClientInfo {
uint32 client_ip; // IP-address of the client (so he can be banned)
Date join_date; // Gamedate the player has joined
char unique_id[NETWORK_NAME_LENGTH]; // Every play sends an unique id so we can indentify him
} NetworkClientInfo;
};
typedef enum {
enum NetworkJoinStatus {
NETWORK_JOIN_STATUS_CONNECTING,
NETWORK_JOIN_STATUS_AUTHORIZING,
NETWORK_JOIN_STATUS_WAITING,
@@ -74,15 +74,15 @@ typedef enum {
NETWORK_JOIN_STATUS_REGISTERING,
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
} NetworkJoinStatus;
};
// language ids for server_lang and client_lang
typedef enum {
enum NetworkLanguage {
NETLANG_ANY = 0,
NETLANG_ENGLISH = 1,
NETLANG_GERMAN = 2,
NETLANG_FRENCH = 3,
} NetworkLanguage;
};
VARDEF NetworkGameInfo _network_game_info;
VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];

View File

@@ -20,13 +20,13 @@
#define NETWORK_SERVER_INDEX 1
#define NETWORK_EMPTY_INDEX 0
typedef enum {
enum MapPacket {
MAP_PACKET_START,
MAP_PACKET_NORMAL,
MAP_PACKET_END,
} MapPacket;
};
typedef enum {
enum NetworkErrorCode {
NETWORK_ERROR_GENERAL, // Try to use thisone like never
// Signals from clients
@@ -46,10 +46,10 @@ typedef enum {
NETWORK_ERROR_KICKED,
NETWORK_ERROR_CHEATER,
NETWORK_ERROR_FULL,
} NetworkErrorCode;
};
// Actions that can be used for NetworkTextMessage
typedef enum {
enum NetworkAction {
NETWORK_ACTION_JOIN,
NETWORK_ACTION_LEAVE,
NETWORK_ACTION_SERVER_MESSAGE,
@@ -58,18 +58,18 @@ typedef enum {
NETWORK_ACTION_CHAT_CLIENT,
NETWORK_ACTION_GIVE_MONEY,
NETWORK_ACTION_NAME_CHANGE,
} NetworkAction;
};
typedef enum {
enum NetworkPasswordType {
NETWORK_GAME_PASSWORD,
NETWORK_COMPANY_PASSWORD,
} NetworkPasswordType;
};
typedef enum {
enum DestType {
DESTTYPE_BROADCAST, ///< Send message/notice to all players (All)
DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team)
DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private)
} DestType;
};
// following externs are instantiated at network.cpp
extern CommandPacket *_local_command_queue;

View File

@@ -32,20 +32,20 @@
#define BGC 5
#define BTC 15
typedef struct network_d {
struct network_d {
PlayerID company; // select company in network lobby
byte field; // select text-field in start-server and game-listing
NetworkGameList *server; // selected server in lobby and game-listing
FiosItem *map; // selected map in start-server
} network_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
typedef struct network_ql_d {
struct network_ql_d {
network_d n; // see above; general stuff
querystr_d q; // text-input in start-server and game-listing
NetworkGameList **sort_list; // list of games (sorted)
list_d l; // accompanying list-administration
} network_ql_d;
};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
/* Global to remember sorting after window has been closed */