/* Don't go over (12, 0) or (12, 1) without changing struct client in s_struct.h */

/* SYMBOL, NARGS, STRINGARG */

#define OPCODE_VERSION 6 /* integer, increment whenever a change is made */

/* generic server codes */
DEFOPCODE(SF_CLOCKTICK,		0,	0)
	/* update */

DEFOPCODE(SF_DELIVERMESSAGE,	3,	1)
	/* deliver a message: message type,
	   message id (0 for string), string */

DEFOPCODE(SF_PLAYERINFO,	4,	1)
	/* inform the client about an other player
	   type (0 exit, 1 join), player_id, ship_id, race,
	   string */

DEFOPCODE(SF_CREATECBODY,	8,	1)
	/* create celestial body: id, parent, distance(2),
	   radius, angle, update_angle, move_hash, name */

DEFOPCODE(SF_DELETECBODY,       1,      0)
	/* delete celestial body: id */

DEFOPCODE(SF_CREATEMISSILE,	12,	0)
	/* create missile: id, firing_ship, (tracking_type, warhead_type),
	   (0, heading) x-low, x-high, y-low, y-high, dx-low, dx-high,
	   dy-low, dy-high */

DEFOPCODE(SF_UPDATEMISSILE,	10,	0)
	/* update missile: id, heading,
	   x-low, x-high, y-low, y-high, dx-low, dx-high,
	   dy-low, dy-high */

DEFOPCODE(SF_DELETEMISSILE,	2,	0)
	/* delete weapon: id, method */

DEFOPCODE(SF_CREATEPHASER,	5,	0)
	/* create phaser: ship_id, phaser_id, to, length, (heading,arcs) */

DEFOPCODE(SF_UPDATEPHASER,      4,      0)
        /* update phaser: phaser_id, to, length, (0, heading) */

DEFOPCODE(SF_DELETEPHASER,	1,	0)
	/* delete weapon: phaser_id */

DEFOPCODE(SF_CREATETRACTOR,     5,      0)
        /* create tractor: ship_id, tractor_id, target, range, (heading,arcs) */

DEFOPCODE(SF_UPDATETRACTOR,     4,      0)
        /* update tractor: tractor_id, target, range, (0, heading) */

DEFOPCODE(SF_DELETETRACTOR,     1,      0)
        /* delete tractor: tractor_id */

DEFOPCODE(SF_DRONE_UPDATE_COURSE,   2,      0)
        /* Request a drone course change from the server: id, speed, heading */

DEFOPCODE(SF_DRONE_UPDATE_TARGET,   2,      0)
        /* Set a new server target for the drone: id, ship id */

DEFOPCODE(SF_DRONE_DETONATE,   1,   0)
        /* Request the server detonate the given drone: id */

DEFOPCODE(SF_DRONE_NOTIFY,     3,     0)
        /* Notify a client that it controls a drone: ship id, drone id */

/* Unknown functions */
DEFOPCODE(SF_DELETEUNKNOWN,     2,      0)
	/* Delete an unknown object: id, reason */

DEFOPCODE(SF_CREATEUNKNOWN,	11,	0)
        /* create unknown: id, x, y, dx, dy, (speed, heading) ,race */

DEFOPCODE(SF_RACEUNKNOWN,        2,       0)
        /* Set an unknown object's race: id, race */

DEFOPCODE(SF_CONVERTUNKNOWN,     3,       1)
        /* convert unknown: unknown_id, ship_id, (class, iff), name */

/* Ship functions */
DEFOPCODE(SF_CREATESHIP,        11,      1)
        /* create ship: id, x, y, dx, dy, (speed, heading), (class, iff), name */

DEFOPCODE(SF_UPDATESHIP,	10,	0)
	/* update ship: id, (speed, heading), x, y, dx, dy */

DEFOPCODE(SF_DELETESHIP,	2,	0)
	/* delete ship: id, cloak/explode/warp/range */

DEFOPCODE(SF_ORBITSHIP,         5,      0)
        /* orbit ship: id, cbody_id, angle, dist, inc */

DEFOPCODE(SF_PRIMESHIP,         1,      0)
        /* prime ship: id */

/* Ship system functions */
DEFOPCODE(SF_SYSTEMDAMAGE,	5,	0)
	/* update damage: id, system, cur_damage, max_damage, num */

DEFOPCODE(SF_SYSTEMPOWER,	4,	0)
	/* update power: id, system, power , num */

DEFOPCODE(SF_SYSTEMSTATUS,	4,	0)
	/* update power: id, system, status, num */ 

DEFOPCODE(SF_SETSYSTEMON,	3,	0)
	/* set a system on (either power-on or active-on) system-id system-idnum type(power,active) */

DEFOPCODE(SF_SETSYSTEMOFF,	3,	0)
	/* set a system off (either power-on or active-on) system-id system-idnum type(power,active) */

DEFOPCODE(SF_SYSTEMVALUE,	5,	0)
	/* update value: id, system, value_type, num, value */

DEFOPCODE(SF_CARGOVALUE,        4,      0)
        /* update cargo: id, type, value */

DEFOPCODE(SF_POWERPRIORITY,     6,      0)
        /* set power priority */

DEFOPCODE(SF_REPAIRPRIORITY,    10,      0)
        /* set repair priorities */

DEFOPCODE(SF_SETPOWERPRIORITY,   5,      0)
		/* send a power priority client -> server */

DEFOPCODE(SF_SETREPAIRPRIORITY,   9,      0)
		/* send a repair priority client -> server */

DEFOPCODE(SF_RSETPOWERPRIORITY,   6,      0)
		/* send a power priority robot -> server */

DEFOPCODE(SF_RSETREPAIRPRIORITY,   10,      0)
		/* send a repair priority robot -> server */

DEFOPCODE(SF_PLANETRATING,      5,      0)
     /* Send a planet's ratings: id, industry, agri, mineral, ship_yard */

DEFOPCODE(SF_PLANETVALUES,     11,      0)
     /* Send a planet's values:  id, population, marines, food, minerals, resources */

DEFOPCODE(SF_PLANETVALUE,       4,      0)
     /* Send a single planet value:  id, type, value */

DEFOPCODE(SF_PLANETOWNER,       2,      0)
     /* Send a planet's ownership:  id, original, current */

/* to client only */
DEFOPCODE(SF_CHOICEFAILURE,	0,	0)
	/* ship selection failure */

DEFOPCODE(SF_AUTHFAILURE,	0,	0)
	/* authentication failure */

DEFOPCODE(SF_AUTHSUCCESS,	0,	0)
	/* authentication success */

DEFOPCODE(SF_AUTHNEWPLAYER,	0,	0)
	/* authentication new user */

DEFOPCODE(SF_SHIPCHOICE,	6,	0)
	/* send a ship choice: class, id, x-low, x-high, y-low, y-high */

DEFOPCODE(SF_SHIPRELEASED,      0,      0)
        /* Server notifies client that its ship has been released */

/* to robo-client only */
DEFOPCODE(SF_GIVEUPSHIP,	1,	0)
	/* give up ship: id */

DEFOPCODE(SF_RECLAIMSHIP,	2,	0)
	/* reclaim ship: id */

DEFOPCODE(SF_DETECTIONUPDATE,	3,	0)
	/* update ship detection: target, sensor_mask */

/* to server codes */

/* client only */
DEFOPCODE(SF_DETONATETORPS,	0,	0)
	/* detonate all torpedos in flight */

DEFOPCODE(SF_SELFDESTRUCT,	0,	0)
	/* destroy the ship */
      
DEFOPCODE(SF_RELEASESHIP,	0,	0)
	/* let the ship go back to the robo-client */

DEFOPCODE(SF_MESSAGE,		2,	1)
	/* 1 messages type, 2 id , 3 message */

DEFOPCODE(SF_IDENTIFYPLAYER,	0,	1)
	/* identify player: name */

DEFOPCODE(SF_CHANGEPASSWORD,	0,	1)
	/* change player's password: old password */

DEFOPCODE(SF_PASSWORD,		0,	1)
	/* send a password: password */

DEFOPCODE(SF_ORBIT,		1,	0)
	/* orbit a celestial body: c_id */

DEFOPCODE(SF_CHANGECOURSE,	1,	0)
	/* change course: arg1.bits: 1-8: heading (0-255), 9-15: speed,
	   16: engine (warp/impulse) */

DEFOPCODE(SF_FIRESYSTEM,	4,	0)
	/* fire a system: (system) (system_id) (heading,special) (target) */

DEFOPCODE(SF_SELECTRACE,	1,	0)
	/* select race: arg1.bits: 1-8: race, 9: best ship */

DEFOPCODE(SF_LOCKONSHIP,	1,	0)
	/* lock on to a ship: id */

DEFOPCODE(SF_SELECTSHIP,	1,	0)
	/* ship id */

DEFOPCODE(SF_SERVEROPTION,      0,      1)
	/* Server option: string */

DEFOPCODE(SF_WAITQUEUE,         1,      0)
	/* Wait queue: Length of wait queue */

DEFOPCODE(SF_SETSYSTEMVALUE,	4,	0)
	/* system, value_type, num, value */

DEFOPCODE(SF_REQSPECSENSOR,	3,	0)
	/* request special sensor data: system, type, num */

/* robo-client only */
DEFOPCODE(SF_IAMROBOCLIENT,	0,	0)
	/* identify as robo_client */

DEFOPCODE(SF_RMESSAGE,		3,	1)
        /* 1 robot id, 2 messages type, 3 id, 4 message */

DEFOPCODE(SF_REQUESTSHIP,	6,	0)
	/* request ship creation: class, x-low, x-high, y-low, y-high
	 stamp */

DEFOPCODE(SF_RDETECTIONUPDATE,	4,	0)
	/* update ship detection: id, target, sensor_mask */

DEFOPCODE(SF_UPDATECBODY,	3,	0)
	/* update celestial body: id, race, marines */

DEFOPCODE(SF_RDETONATETORPS,	1,	0)
	/* detonate all torpedos in flight: id */

DEFOPCODE(SF_RORBIT,		2,	0)
	/* orbit celestial body: id, c_id */

DEFOPCODE(SF_RSELFDESTRUCT,	1,	0)
	/* destroy the ship: id */

DEFOPCODE(SF_RSYSTEMON, 4, 0)
	/* system on: id, system, num, type */

DEFOPCODE(SF_RSYSTEMOFF, 4, 0)
	/* system off: id, system, num, type */

DEFOPCODE(SF_RREQSPECSENSOR,	2,	0)
	/* request special sensor data: id, system */

DEFOPCODE(SF_RCHANGECOURSE,	2,	0)
	/* change course: id, arg2.bits: 1-8: heading (0-255), 9-15: speed,
	   16: engine (warp/impulse) */

DEFOPCODE(SF_RFIRESYSTEM,	5,	0)
	/* fire a system: (ship_id) (system) (system_id) (heading,special) (target) */

DEFOPCODE(SF_RLOCKONSHIP,	2,	0)
	/* lock on to a ship: from, to */

DEFOPCODE(SF_RSETSYSTEMVALUE,	5,	0)
	/* id, system, value_type, num, value */

DEFOPCODE(SF_RSETPLANETOWNER,	2,	0)
	/* set planet owner, id, owner original_owner */

DEFOPCODE(SF_RSETPLANETRATING,  3,      0)
        /* set planet ratings, id, type value */

DEFOPCODE(SF_RSETPLANETRESOURCE,4,      0)
        /* set planet resource, id, type value */

DEFOPCODE(SF_RUSEPLANETRESOURCE,4,      0)
        /* subtract from planet resource, id, type value */
