src/Network/Message.hh
author Tero Marttila <terom@fixme.fi>
Tue, 27 Jan 2009 03:02:02 +0200
changeset 441 f769fab21a6c
parent 434 a8ba81432ddd
permissions -rw-r--r--
fix bug with NetworkBufferOutput where push_write doesn't update offset
#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 */