servemsg.h

Go to the documentation of this file.
00001 
00008 #ifndef INCL_SERVEMSG
00009 #define INCL_SERVEMSG 1
00010 /*
00011 Copyright (C) 2000-2002 The Exult Team
00012 
00013 This program is free software; you can redistribute it and/or
00014 modify it under the terms of the GNU General Public License
00015 as published by the Free Software Foundation; either version 2
00016 of the License, or (at your option) any later version.
00017 
00018 This program is distributed in the hope that it will be useful,
00019 but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 GNU General Public License for more details.
00022 
00023 You should have received a copy of the GNU General Public License
00024 along with this program; if not, write to the Free Software
00025 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00026 */
00027 
00028 
00029 /*
00030  *  An entry sent between client and server will have the following format:
00031  *
00032 Bytes Description
00033 0-1 Magic.
00034 2-3 Length of the data, low-byte first.
00035 4 Message type.  Defined below.
00036 5-  Data.
00037  */
00038 
00039 namespace Exult_server
00040 {
00041 const unsigned short magic = 0xf381;
00042 const int maxlength = 600;    // Big enough to hold a 'terrain'.
00043 const int hdrlength = 5;
00044 const int version = 0;      // Sent with 'info' message.
00045 
00046 enum Msg_type
00047   {
00048   say = 0,      // For testing.  Data is text.
00049   obj = 1,      // Generic object.
00050   egg = 2,      // Egg_object.
00051   npc = 3,      // Editing an NPC.
00052   user_responded = 4,   // User performed requested action.
00053   cancel = 5,     // Cancel operation.
00054   info = 6,     // Game info. request/response.  See
00055           //   Game_info_xxx in objserial.h.
00056   write_map = 7,      // Save map.
00057   read_map = 8,     // Read map.
00058   map_editing_mode = 9,   // 1 to turn it on, 0 for off.
00059   tile_grid = 10,     // 1 to show grid, 0 for off.
00060   edit_lift = 11,     // Lift passed: 0-13.
00061   reload_usecode = 12,    // Reload patched usecode.
00062   locate_terrain = 13,    // Locate desired chunk terrain.
00063   swap_terrain = 14,    // Swap two terrains.
00064   insert_terrain = 15,    // Insert new chunk terrain.
00065   delete_terrain = 16,    // Delete (unused) terrain.
00066   send_terrain = 17,    // Send 512-byte terrain to client.
00067   terrain_editing_mode = 18,  // 1 to turn on, 0 for off, -1 to undo.
00068   set_edit_shape = 19,    // Set shape/frame to 'paint' with.
00069   view_pos = 20,      // Tile loc., size, scale of what's
00070           //   shown in gamewin.  Sent both ways.
00071   set_edit_mode = 21,   // Move(0), paint(1), select(2).
00072   combo_pick = 22,    // Sending shape to add to combo.
00073   hide_lift = 23,     // Lift passed: 1-16.
00074   reload_shapes = 24,   // Reload a .vga file.
00075   unused_shapes = 25,   // Find unused shapes in game.
00076   locate_shape = 26,    // Find shape in world.
00077   cut = 27,     // Cut/copy.
00078   paste = 28,     // ... from clipboard.
00079   select_status = 29,   // Flags:  selection, clipboard avail.
00080   npc_info = 30,      // Get #NPC's, first unused.
00081   edit_selected = 31,   // Edit selected object.
00082   set_edit_chunknum = 32,   // Set chunk# to paint with.
00083   game_pos = 33,      // Returns tx, ty, tz of main char.
00084   usecode_debugging = 128
00085   };
00086 
00087 // I/O routines:
00088 int Send_data
00089   (
00090   int socket,
00091   Msg_type id,
00092   unsigned char *data = 0,  // For just sending id.
00093   int datalen = 0
00094   );
00095 int Receive_data
00096   (
00097   int& socket,      // Closed, set to -1 if disconnected.
00098   Msg_type& id,     // ID returned.
00099   unsigned char *data,
00100   int datalen
00101   );
00102 
00103 // Wait for given ms for a response. return false if no response
00104 bool wait_for_response(int socket, int ms);
00105 
00106 }// Exult_server namespace.
00107 
00108 #endif  /* INCL_SERVEMSG */

Generated on Mon Jul 9 14:42:50 2007 for ExultEngine by  doxygen 1.5.1