Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#13051) Packet generator extension
Home

[Freeciv-Dev] (PR#13051) Packet generator extension

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13051) Packet generator extension
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Thu, 12 May 2005 14:33:19 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13051 >

We need a way to define "virtual packets" in packets.def: They create
structs in packets_gen.h, but no send/receive code, and can be included in
packets definitions.

Eg:

STRUCT_PLAYER_DIPLSTATE(struct player_diplstate)
  DIPLSTATE type;
  UINT8 turns_left;
  UINT8 has_reason_to_cancel;
  UINT contact_turns_left;
end
...
PACKET_PLAYER_INFO=39; is-info,sc
  ...
  STRUCT_PLAYER_DIPLSTATE diplstates[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
  ...
end

which generates the structs (in packets_gen.h):

struct player_diplstate {
  enum diplstate_type type;
  int turns_left;
  int has_reason_to_cancel;
  int contact_turns_left;
};

and

struct packet_player_info {
  ...
  struct player_diplstate diplstates[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
  ...
};

And in the packets_gen.c code, folds in the "virtual packet" as a part of
the parent packet.

It should not be too hard to add, but I am unable to do this myself, not
having any idea about Python. Anyone?

  - Per





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13051) Packet generator extension, Per I. Mathisen <=