2003-03-26 14:06:51 +00:00
|
|
|
// mpmessages.hxx -- Message definitions for multiplayer communications
|
|
|
|
// within a multiplayer Flightgear
|
|
|
|
//
|
|
|
|
// Written by Duncan McCreanor, started February 2003.
|
|
|
|
// duncan.mccreanor@airservicesaustralia.com
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003 Airservices Australia
|
|
|
|
//
|
|
|
|
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//
|
|
|
|
|
2003-03-19 20:45:09 +00:00
|
|
|
#ifndef MPMESSAGES_H
|
|
|
|
#define MPMESSAGES_H
|
|
|
|
|
|
|
|
#define MPMESSAGES_HID "$Id$"
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
* @version $Id$
|
|
|
|
*
|
|
|
|
* Description: Each message used for multiplayer communications
|
|
|
|
* consists of a header and optionally a block of data. The combined
|
|
|
|
* header and data is sent as one IP packet.
|
|
|
|
*
|
|
|
|
******************************************************************/
|
|
|
|
|
2005-07-28 08:40:03 +00:00
|
|
|
#include <stdint.h>
|
2003-03-19 20:45:09 +00:00
|
|
|
#include <plib/sg.h>
|
|
|
|
|
|
|
|
// Message identifiers
|
|
|
|
#define CHAT_MSG_ID 1
|
2005-07-28 08:40:03 +00:00
|
|
|
#define UNUSABLE_POS_DATA_ID 2
|
|
|
|
#define POS_DATA_ID 3
|
|
|
|
/* should be a multiple of 8! */
|
|
|
|
#define MAX_CALLSIGN_LEN 8
|
2003-03-19 20:45:09 +00:00
|
|
|
/** Header for use with all messages sent */
|
|
|
|
typedef struct {
|
|
|
|
|
2005-07-28 08:40:03 +00:00
|
|
|
/** Message identifier, multiple of 8! */
|
|
|
|
uint32_t MsgId;
|
2003-03-19 20:45:09 +00:00
|
|
|
|
|
|
|
/** Length of the message inclusive of this header */
|
2005-07-28 08:40:03 +00:00
|
|
|
uint32_t iMsgLen;
|
2003-03-19 20:45:09 +00:00
|
|
|
|
|
|
|
/** IP address for reply to message (player's receiver address) */
|
2005-07-28 08:40:03 +00:00
|
|
|
uint32_t lReplyAddress;
|
2003-03-19 20:45:09 +00:00
|
|
|
|
|
|
|
/** Port for replies (player's receiver port) */
|
2005-07-28 08:40:03 +00:00
|
|
|
uint32_t iReplyPort;
|
2003-03-19 20:45:09 +00:00
|
|
|
|
|
|
|
/** Callsign used by the player */
|
|
|
|
char sCallsign[MAX_CALLSIGN_LEN];
|
|
|
|
|
|
|
|
} T_MsgHdr;
|
|
|
|
|
2005-07-28 08:40:03 +00:00
|
|
|
#define MAX_CHAT_MSG_LEN 48
|
2003-03-19 20:45:09 +00:00
|
|
|
/** Chat message */
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
/** Text of chat message */
|
|
|
|
char sText[MAX_CHAT_MSG_LEN];
|
|
|
|
|
|
|
|
} T_ChatMsg;
|
|
|
|
|
2005-07-28 08:40:03 +00:00
|
|
|
/* should be a multiple of 8! */
|
|
|
|
#define MAX_MODEL_NAME_LEN 48
|
2003-03-19 20:45:09 +00:00
|
|
|
/** Aircraft position message */
|
|
|
|
typedef struct {
|
|
|
|
|
|
|
|
/** Name of the aircraft model */
|
|
|
|
char sModel[MAX_MODEL_NAME_LEN];
|
|
|
|
|
|
|
|
/** Position data for the aircraft */
|
2005-07-28 08:40:03 +00:00
|
|
|
sgdVec3 PlayerPosition;
|
|
|
|
sgQuat PlayerOrientation;
|
2003-03-19 20:45:09 +00:00
|
|
|
|
|
|
|
} T_PositionMsg;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|