00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __ACTION__
00024 #define __ACTION__
00025
00026
00027
00028
00029
00030 typedef enum{
00031 growVertical=0,
00032 growHorizontal=1
00033 }GrowType;
00034
00035
00036
00037
00038
00039
00040 typedef enum{
00041 moveVerticalCW=0,
00042 moveHorizontalCW=1,
00043 moveVerticalCCW=2,
00044 moveHorizontalCCW=3,
00045 moveUnknown=0xFF
00046 }MoveType;
00047
00048
00049
00050
00051
00052 typedef enum{
00053 none=0,
00054 newCylinder=1,
00055 growTo=2,
00056 belittle=3,
00057 moveCylinder=4,
00058 dropCylinder=5,
00059 sendEnergy=6,
00060 sendMessageAction=7
00061 }ActionList;
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 struct Action{
00072 ActionList action;
00073 short int energy;
00074 union {
00075 char type;
00076 GrowType growType;
00077 MoveType moveType;
00078 };
00079 unsigned char cylinder;
00080 unsigned long int agentId;
00081 union{
00082 double angle;
00083 char *message;
00084 };
00085 union{
00086 double height;
00087 unsigned long int messageSize;
00088 };
00089
00090
00091 Action(){ action=none; }
00092 ~Action();
00093
00094
00095 Action(ActionList _action, unsigned short int _energy,
00096 char _type, unsigned char _cylinder);
00097
00098
00099 Action(double angle, double height, unsigned short int _energy);
00100
00101 Action(unsigned short int _energy, GrowType type);
00102
00103 Action(unsigned short int _energy, MoveType type);
00104
00105 Action(unsigned char son, unsigned short int _energy);
00106
00107 Action(unsigned char son, const char *creationMessage, unsigned long int messageSize);
00108
00109 Action(unsigned long int agentId, unsigned long int messageSize, const char *message);
00110 };
00111
00112
00113
00114 #endif