src/Network/Message.hh
author Tero Marttila <terom@fixme.fi>
Tue, 27 Jan 2009 00:02:34 +0200
changeset 434 a8ba81432ddd
parent 432 82b0f4e55a13
permissions -rw-r--r--
move write_object to NetworkMessage, fix player sync, and implement projectile sync
#ifndef NETWORK_MESSAGE_HH
#define NETWORK_MESSAGE_HH

/**
 * @file
 *
 * NetworkPacket for use with NetworkObjects
 */

#include "Channel.hh"
#include "Object.hh"

/**
 * NetworkMessages are NetworkPackets that are related to some specfic NetworkObject and its NetworkObjectController.
 */
class NetworkMessage : public NetworkChannelPacket {
    public:
        /**
         * Create a message of the given type to be sent on the given object
         */
        NetworkMessage (NetworkObject &obj, NetworkMessageID msg_id);

        /**
         * Write the given Object's NetworkObjectID (or 0, if the obj is NULL) to this p acket
         *
         * @param obj the NetworkObject* whose NetworkObjectID to write to the packet, or NULL to write zero
         */
        void write_object (const NetworkObject *obj);
};

#endif /* NETWORK_MESSAGE_HH */