resonance 1.0.1
Loading...
Searching...
No Matches
bumppacket.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5#include "game/idableptr.h"
7
8class IBStream;
9class OBStream;
10class Player;
11
26public:
34 }
35
46 BumpPacket(Player *pPlayer, int nBar, int nTrack)
47 : mPlayer(pPlayer), mBar(nBar), mTrack(nTrack) {
48 }
49
60 static Message *New();
61
69 virtual Message *Clone();
70
78 virtual int Type();
79
87 virtual const char *GetName() const;
88
99 virtual void PrintExtra(std::ostream &stream) const;
100
108 virtual void saveGuts(OBStream &stream) const;
109
117 virtual void restoreGuts(IBStream &stream);
118
121
123 int mBar;
124
127
134 int mResult = 0;
135};
136
145extern int g_nBumpPacketType;
int g_nBumpPacketType
Identity that BumpPacket::Type() reports.
virtual void restoreGuts(IBStream &stream)
Read the Packet words, the player's identifier, the bar, and the track back in place.
virtual void PrintExtra(std::ostream &stream) const
Write the player's address, bar , the bar, track , and the track to a diagnostic stream.
virtual int Type()
Report this packet's registered identity.
BumpPacket(Player *pPlayer, int nBar, int nTrack)
Report a bumper deployed by a player.
Definition bumppacket.h:46
virtual Message * Clone()
Produce a heap copy of this packet.
virtual void saveGuts(OBStream &stream) const
Write the Packet words, the player's identifier, the bar, and the track to a stream.
int mResult
Non-zero once a receiver has acted on the packet.
Definition bumppacket.h:134
int mTrack
The track the bump strikes.
Definition bumppacket.h:126
IDablePtr< Player > mPlayer
The bumping player.
Definition bumppacket.h:120
int mBar
The bar of the bump.
Definition bumppacket.h:123
virtual const char * GetName() const
Report this packet's class name.
BumpPacket()
Construct a packet with only the player reference, the Packet words, and mResult set.
Definition bumppacket.h:33
static Message * New()
Produce a default-constructed packet on the heap.
Input half of the byte stream interface.
Definition ibstream.h:36
Reference to a registered object by its identifier, resolved on first use.
Definition idableptr.h:30
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Output half of the byte stream interface.
Definition obstream.h:25
One participant in a session, local or remote.
Definition player.h:39
ToAllOtherGameSystemsPacket()
Route the packet with the pair 2 and 3.
Definition toallothergamesystemspacket.h:21