Difference for socket/request.c from version 1.51 to 1.52


version 1.51 version 1.52
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_init_c =   * static char *rcsid_init_c =
  *    "$Id: request.c,v 1.51 2003/08/08 17:49:31 tchize Exp $";   *    "$Id: request.c,v 1.52 2003/09/13 05:02:14 mwedel Exp $";
  */   */
   
 /*  /*
Line 95
 
Line 95
     -1 /* Chaos */, -1 /* Counterspell */,      -1 /* Chaos */, -1 /* Counterspell */,
     -1 /* Godpower */, CS_STAT_RES_HOLYWORD,      -1 /* Godpower */, CS_STAT_RES_HOLYWORD,
     CS_STAT_RES_BLIND,       CS_STAT_RES_BLIND,
     -1 /* Internal */, -1 /* life stealing */      -1, /* Internal */
       -1, /* life stealing */
       -1 /* Disease - not fully done yet */
 };  };
   
 /* This is the Setup cmd - easy first implementation */  /* This is the Setup cmd - easy first implementation */
Line 144
 
Line 146
      ns->ext2 = atoi(param);       ns->ext2 = atoi(param);
      strcat(cmdback, param);       strcat(cmdback, param);
  }   }
  else if (!strcmp(cmd,"sexp")) {   else if (!strcmp(cmd,"exp64")) {
      ns->skillexp = atoi(param);       ns->exp64 = atoi(param);
      strcat(cmdback, param);       strcat(cmdback, param);
  } else if (!strcmp(cmd,"darkness")) {   } else if (!strcmp(cmd,"darkness")) {
      ns->darkness = atoi(param);       ns->darkness = atoi(param);
Line 184
 
Line 186
      char tmpbuf[20];       char tmpbuf[20];
      int q = atoi(param);       int q = atoi(param);
      if (q<1 || q>2) {       if (q<1 || q>2) {
  sprintf(tmpbuf,"%d", ns->itemcmd);   strcpy(tmpbuf,"FALSE");
      } else  {       } else  {
  ns->itemcmd = q;   ns->itemcmd = q;
    sprintf(tmpbuf,"%d", ns->itemcmd);
      }       }
        strcat(cmdback, tmpbuf);
         } else if (!strcmp(cmd,"mapsize")) {          } else if (!strcmp(cmd,"mapsize")) {
      int x, y=0;       int x, y=0;
      char tmpbuf[MAX_BUF], *cp;       char tmpbuf[MAX_BUF], *cp;
Line 631
 
Line 635
   
 /* Sends the stats to the client - only sends them if they have changed */  /* Sends the stats to the client - only sends them if they have changed */
   
   #define AddIfInt64(Old,New,Type) if (Old != New) {\
    Old = New; \
    SockList_AddChar(&sl, Type); \
    SockList_AddInt64(&sl, New); \
           }
   
 #define AddIfInt(Old,New,Type) if (Old != New) {\  #define AddIfInt(Old,New,Type) if (Old != New) {\
  Old = New; \   Old = New; \
  SockList_AddChar(&sl, Type); \   SockList_AddChar(&sl, Type); \
Line 690
 
Line 700
         AddIfShort(pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON);          AddIfShort(pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON);
         AddIfShort(pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA);          AddIfShort(pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA);
     }      }
     if(pl->last_stats.exp != pl->ob->stats.exp && pl->socket.skillexp)       if(pl->socket.exp64) {
     {  
  int s;   int s;
  for(s=0;s<pl->last_skill_index;s++) {   for(s=0;s<NUM_SKILLS;s++) {
      AddIfInt(pl->last_skill_exp[s],pl->last_skill_ob[s]->stats.exp , pl->last_skill_id[s]);       if (pl->last_skill_ob[s] &&
      AddIfShort(pl->last_skill_level[s],pl->last_skill_ob[s]->level , pl->last_skill_id[s]+1);   pl->last_skill_exp[s] != pl->last_skill_ob[s]->stats.exp) {
   
    /* Always send along the level if exp changes.  This is only
    * 1 extra byte, but keeps processing simpler.
    */
    SockList_AddChar(&sl, s + CS_STAT_SKILLINFO);
    SockList_AddChar(&sl, pl->last_skill_ob[s]->level);
    SockList_AddInt64(&sl, pl->last_skill_ob[s]->stats.exp);
    pl->last_skill_exp[s] =  pl->last_skill_ob[s]->stats.exp;
        }
  }   }
     }      }
       if (pl->socket.exp64) {
    AddIfInt64(pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64);
       } else {
     AddIfInt(pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP);      AddIfInt(pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP);
       }
     AddIfShort(pl->last_level, pl->ob->level, CS_STAT_LEVEL);      AddIfShort(pl->last_level, pl->ob->level, CS_STAT_LEVEL);
     AddIfShort(pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC);      AddIfShort(pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC);
     AddIfShort(pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC);      AddIfShort(pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC);
Line 1731
 
Line 1753
     cs_write_string(&pl->contr->socket,buf,strlen(buf));      cs_write_string(&pl->contr->socket,buf,strlen(buf));
 }  }
   
   /* This sends the skill number to name mapping.  We ignore
    * the params - we always send the same info no matter what.
     */
   void send_skill_info(NewSocket *ns, char *params)
   {
       SockList sl;
       int i;
   
       sl.buf = malloc(MAXSOCKBUF);
       strcpy(sl.buf,"replyinfo skill_info\n");
       for (i=1; i< NUM_SKILLS; i++) {
    sprintf(sl.buf + strlen(sl.buf), "%d:%s\n", i + CS_STAT_SKILLINFO,
    skill_names[i]);
       }
       sl.len = strlen(sl.buf);
       if (sl.len > MAXSOCKBUF) {
    LOG(llevError,"Buffer overflow in send_skill_info!\n");
    fatal(0);
       }
       Send_With_Handling(ns, &sl);
       free(sl.buf);
   }


Legend:
line(s) removed in v.1.51 
line(s) changed
 line(s) added in v.1.52

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:37