Difference for main/reconfig.c from version 1.2 to 1.3


version 1.2 version 1.3
Line 3
 
Line 3
 #ifdef NETWORK  #ifdef NETWORK
 //end addition -MM  //end addition -MM
   
   #include <string.h>
   
 #include "types.h"  #include "types.h"
 #include "byteswap.h"  #include "byteswap.h"
 #include "network.h"  #include "network.h"
Line 15
 
Line 17
   
 #include "reconfig.h"  #include "reconfig.h"
   
   #include "error.h"
   
 void reconfig_send_gameinfo()  void reconfig_send_gameinfo()
 {  {
 //added 06/09/99 Matt Mueller - "fix" shareware compile  //added 06/09/99 Matt Mueller - "fix" shareware compile
 #ifndef SHAREWARE  #ifndef SHAREWARE
 //end addition -MM  //end addition -MM
  int i=0;   int i=0;
  int tmpi=0;   int32_t tmpi=0;
  ubyte r_packet[30];   ubyte r_packet[3+64];
   
   r_packet[i] = (ubyte)MULTI_INGAME_CONFIG;          i++;    r_packet[i] = (ubyte)MULTI_INGAME_CONFIG;          i++;
   r_packet[i] = (ubyte)Player_num;                   i++;    r_packet[i] = (ubyte)Player_num;                   i++;
   
   r_packet[i] = (ubyte)RECONFIG_GAMEMODE;            i++;   r_packet[i] = (ubyte)RECONFIG_VERSION;             i++;
   r_packet[i] = (ubyte)Netgame.gamemode;             i++;    r_packet[i] = (ubyte)Netgame.gamemode;             i++;
   
   r_packet[i] = (ubyte)RECONFIG_GAME_FLAGS;          i++;  
   r_packet[i] = (ubyte)Netgame.game_flags;           i++;    r_packet[i] = (ubyte)Netgame.game_flags;           i++;
   
   r_packet[i] = (ubyte)RECONFIG_DIFFICULTY;          i++;  
   r_packet[i] = (ubyte)Netgame.difficulty;           i++;    r_packet[i] = (ubyte)Netgame.difficulty;           i++;
   
   r_packet[i] = (ubyte)RECONFIG_RESTRICT_MODE;       i++;  
   r_packet[i] = (ubyte)restrict_mode;                i++;    r_packet[i] = (ubyte)restrict_mode;                i++;
   
   r_packet[i] = (ubyte)RECONFIG_PPS;                 i++;  
   r_packet[i] = (ubyte)Netgame.packets_per_sec;      i++;    r_packet[i] = (ubyte)Netgame.packets_per_sec;      i++;
   
   r_packet[i] = (ubyte)RECONFIG_PROTOCOL_VERSION;    i++;  
   r_packet[i] = (ubyte)Netgame.protocol_version;     i++;    r_packet[i] = (ubyte)Netgame.protocol_version;     i++;
   
   r_packet[i] = (ubyte)RECONFIG_MAX_NUMPLAYERS;      i++;  
   r_packet[i] = (ubyte)Netgame.max_numplayers;       i++;    r_packet[i] = (ubyte)Netgame.max_numplayers;       i++;
   
   r_packet[i] = (ubyte)RECONFIG_CONTROL_INVUL_TIME;  i++;  
   tmpi=swapint(Netgame.control_invul_time);    tmpi=swapint(Netgame.control_invul_time);
   memcpy(&(r_packet[i]),&tmpi,4);                    i+=4;    memcpy(&(r_packet[i]),&tmpi,4);                    i+=4;
   
   r_packet[i] = (ubyte)RECONFIG_FLAGS;               i++;  
   tmpi=swapint(Netgame.flags);    tmpi=swapint(Netgame.flags);
   memcpy(&(r_packet[i]),&tmpi,4);                    i+=4;    memcpy(&(r_packet[i]),&tmpi,4);                    i+=4;
   
   mekh_send_direct_broadcast(r_packet,i);   mprintf((0,"sending reconfig (l%i,v%i) ",i,RECONFIG_VERSION));
    mprintf((0,"GAMEMODE:%i",Netgame.gamemode));
    mprintf((0,"GAME_FLAGS:%i",Netgame.game_flags));
    mprintf((0,"DIFFICULTY:%i",Netgame.difficulty));
    mprintf((0,"RESTRICT_MODE:%i",restrict_mode));
    mprintf((0,"PPS:%i",Netgame.packets_per_sec));
    mprintf((0,"PROTOCOL_VERSION:%i",Netgame.protocol_version));
    mprintf((0,"MAX_NUMPLAYERS:%i",Netgame.max_numplayers));
    mprintf((0,"CONTROL_INVUL_TIME:%i",Netgame.control_invul_time));
    mprintf((0,"FLAGS:%i",Netgame.flags));
    if (i>message_length[MULTI_INGAME_CONFIG])
    Error("reconfig_send_gameinfo: packet too long\n");
   
    memset(r_packet+i,0,message_length[MULTI_INGAME_CONFIG]-i);//set the rest to zero, so it'll compress easily
    mekh_send_direct_broadcast(r_packet,message_length[MULTI_INGAME_CONFIG]);
 //added 06/09/99 Matt Mueller - "fix" shareware compile  //added 06/09/99 Matt Mueller - "fix" shareware compile
 #endif  #endif
 //end addition -MM  //end addition -MM
Line 67
 
Line 77
 //added 06/09/99 Matt Mueller - "fix" shareware compile  //added 06/09/99 Matt Mueller - "fix" shareware compile
 #ifndef SHAREWARE  #ifndef SHAREWARE
 //end addition -MM  //end addition -MM
  int i=-1;   int i=2,version;
    int32_t t;
   
   hud_message(MSGC_GAME_FEEDBACK,"Received reconfig");   version=values[i++];
    hud_message(MSGC_GAME_FEEDBACK,"Received reconfig from %i (v%i)",values[1],version);
   
    while(i <= len)   if (version < 128){//thinking ahead a bit, just in case we want to make some new additions we can still have them work on older versions of d1x, but we can also make new reconfig types that don't have any of the old stuff.
     {   Netgame.gamemode = values[i++];
        switch(values[++i])   Netgame.game_flags = values[i++];
         {   Netgame.difficulty = values[i++];
           case RECONFIG_GAMEMODE:   restrict_mode = values[i++];
                            Netgame.gamemode = values[++i];           break;   Netgame.packets_per_sec = values[i++];
           case RECONFIG_GAME_FLAGS:   Netgame.protocol_version = values[i++];
                            Netgame.game_flags = values[++i];         break;   Netgame.max_numplayers = values[i++];
           case RECONFIG_DIFFICULTY:                              memcpy(&t,&(values[i]),sizeof(t)); i+= sizeof(t);
                            Netgame.difficulty = values[++i];         break;   Netgame.control_invul_time = swapint(t);
           case RECONFIG_RESTRICT_MODE:   memcpy(&t,&(values[i]),sizeof(t)); i+= sizeof(t);
                            restrict_mode = values[++i];              break;   Netgame.flags = swapint(t);
           case RECONFIG_PPS:  
                            Netgame.packets_per_sec = values[++i];    break;  
           case RECONFIG_PROTOCOL_VERSION:  
                            Netgame.protocol_version = values[++i];   break;  
           case RECONFIG_MAX_NUMPLAYERS:  
                            Netgame.max_numplayers = values[++i];     break;  
           case RECONFIG_CONTROL_INVUL_TIME:  
                           {  
                            int t;  
                             memcpy(&t,&(values[i+1]),sizeof(t)); i+= sizeof(t);  
                             Netgame.control_invul_time = t;  
                             break;  
                           }  
           case RECONFIG_FLAGS:  
                           {  
                            int t;  
                             memcpy(&t,&(values[i+1]),sizeof(t)); i+= sizeof(t);  
                             Netgame.flags = t;  
                             break;  
                           }  
           default: mprintf((0,"unknown reconfig value %i at %i",values[i],i));  
                         break;  
         }  
     }      }
   
   // if (version==?) then process_additional_info
   
    mprintf((0,"GAMEMODE:%i",Netgame.gamemode));
    mprintf((0,"GAME_FLAGS:%i",Netgame.game_flags));
    mprintf((0,"DIFFICULTY:%i",Netgame.difficulty));
    mprintf((0,"RESTRICT_MODE:%i",restrict_mode));
    mprintf((0,"PPS:%i",Netgame.packets_per_sec));
    mprintf((0,"PROTOCOL_VERSION:%i",Netgame.protocol_version));
    mprintf((0,"MAX_NUMPLAYERS:%i",Netgame.max_numplayers));
    mprintf((0,"CONTROL_INVUL_TIME:%i",Netgame.control_invul_time));
    mprintf((0,"FLAGS:%i",Netgame.flags));
 //added 06/09/99 Matt Mueller - "fix" shareware compile  //added 06/09/99 Matt Mueller - "fix" shareware compile
 #endif  #endif
 //end addition -MM  //end addition -MM

Legend:
line(s) removed in v.1.2 
line(s) changed
 line(s) added in v.1.3