On Sat, Mar 29, 2008 at 3:21 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
The dispatcher needs to know what the ID of a packet is to
Robert Dailey wrote:
> Is there any reason why the ID needs to be available at runtime?
> Instead of your specialization, I do:
>
> class WalkPacket : Packet
> {
> static const PacketId ID = PID_WALKPACKET;
> };
>
> Is there any reason why this isn't sufficient?
do its job. The idea is that instead of passing the ID and the packet
separately,
the packet knows its own ID. It is possible, though to replace the ID
type with
std::string in the dispatcher and use std::string(typeid(packet).name())
avoiding the ID's entirely inside the dispatcher.