Prechádzať zdrojové kódy

* Added some of Shinomori's fixes

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@751 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest 20 rokov pred
rodič
commit
bea3ec88e9
9 zmenil súbory, kde vykonal 70 pridanie a 31 odobranie
  1. 3 1
      Changelog.txt
  2. 15 5
      src/common/grfio.c
  3. 0 4
      src/common/mmo.h
  4. 5 0
      src/common/socket.c
  5. 3 3
      src/login/login.h
  6. 15 3
      src/map/intif.c
  7. 20 5
      src/map/npc.c
  8. 5 7
      src/map/pc.c
  9. 4 3
      src/map/pc.h

+ 3 - 1
Changelog.txt

@@ -1,9 +1,11 @@
 Date	Added
 12/23
 	* Updated mapflags (added missing payon_in03,ayo_in01,ayo_in02, que_god01, que_god02) [Lupus]
-        * Updated Sacrifice [celest]
+        * Updated Sacrifice : it's now self-activating, and lasts for 5 attacks [celest]
         * Fixed compile errors in party.c [celest]
         * Moved SC_EDP back to 114 [celest]
+        * Added some of Shinomori's fixes [celest]
+        * Added optimisation in intif_parse_WisMessage from Freya [celest]
 
 12/22
 	* Eliminated skill tree mapping since we have entries

+ 15 - 5
src/common/grfio.c

@@ -140,7 +140,11 @@ static unsigned char NibbleData[4][64]={
  */
 static unsigned int getlong(unsigned char *p)
 {
-  return *p+p[1]*256+(p[2]+p[3]*256)*65536;
+//	return *p+p[1]*256+(p[2]+p[3]*256)*65536;
+	return   p[0]
+		| p[1] << 0x08
+		| p[2] << 0x10
+		| p[3] << 0x18; // Shinomori
 }
 
 /*==========================================
@@ -158,15 +162,17 @@ static void BitConvert(BYTE *Src,char *BitSwapTable)
 {
 	int lop,prm;
 	BYTE tmp[8];
-	*(DWORD*)tmp=*(DWORD*)(tmp+4)=0;
+//	*(DWORD*)tmp=*(DWORD*)(tmp+4)=0;
+	memset(tmp,0,8);
 	for(lop=0;lop!=64;lop++) {
 		prm = BitSwapTable[lop]-1;
 		if (Src[(prm >> 3) & 7] & BitMaskTable[prm & 7]) {
 			tmp[(lop >> 3) & 7] |= BitMaskTable[lop & 7];
 		}
 	}
-	*(DWORD*)Src     = *(DWORD*)tmp;
-	*(DWORD*)(Src+4) = *(DWORD*)(tmp+4);
+//	*(DWORD*)Src     = *(DWORD*)tmp;
+//	*(DWORD*)(Src+4) = *(DWORD*)(tmp+4);
+	memcpy(Src,tmp,8);
 }
 
 static void BitConvert4(BYTE *Src)
@@ -194,7 +200,11 @@ static void BitConvert4(BYTE *Src)
 			tmp[(lop >> 3) + 4] |= BitMaskTable[lop & 7];
 		}
 	}
-	*(DWORD*)Src ^= *(DWORD*)(tmp+4);
+//	*(DWORD*)Src ^= *(DWORD*)(tmp+4);
+	Src[0] ^= tmp[4];
+	Src[1] ^= tmp[5];
+	Src[2] ^= tmp[6];
+	Src[3] ^= tmp[7];
 }
 
 static void decode_des_etc(BYTE *buf,int len,int type,int cycle)

+ 0 - 4
src/common/mmo.h

@@ -325,10 +325,6 @@ enum {
 #ifndef strnicmp
 #define strnicmp strncasecmp
 #endif
-#ifndef strrchr
-#define strrchr rindex
-#endif
-
 #endif
 
 #endif	// _MMO_H_

+ 5 - 0
src/common/socket.c

@@ -17,6 +17,11 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <errno.h>
+
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h> // SIOCGIFCONF on Solaris, maybe others? [Shinomori]
+#endif
+
 #endif
 
 #include <fcntl.h>

+ 3 - 3
src/login/login.h

@@ -13,7 +13,7 @@
 #define START_ACCOUNT_NUM 2000000
 #define END_ACCOUNT_NUM 100000000
 
-int login_port;
+extern int login_port;
 struct mmo_account {
 	char* userid;
 	char passwd[33];
@@ -36,6 +36,6 @@ struct mmo_char_server {
 	int new;
 };
 
-struct mmo_char_server server[MAX_SERVERS];
-int server_fd[MAX_SERVERS];
+extern struct mmo_char_server server[MAX_SERVERS];
+extern int server_fd[MAX_SERVERS];
 #endif

+ 15 - 3
src/map/intif.c

@@ -627,6 +627,7 @@ int intif_guild_castle_datasave(int castle_id,int index, int value)
 // Wisp/Page reception
 int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
 	struct map_session_data* sd;
+	char *wisp_source;
 	int id=RFIFOL(fd,4);
 	int i=0; //,j=0;
 
@@ -651,9 +652,20 @@ int intif_parse_WisMessage(int fd) { // rewritten by [Yor]
 
 		else{
 */
-		if(i == MAX_IGNORE_LIST) {
-			clif_wis_message(sd->fd,RFIFOP(fd,8),RFIFOP(fd,56),RFIFOW(fd,2)-56);
-			intif_wis_replay(RFIFOL(fd,4),0);	// 送信成功
+		else {
+			wisp_source = RFIFOP(fd,8); // speed up [Yor]
+			for(i=0;i<MAX_IGNORE_LIST;i++){   //拒否リストに名前があるかどうか判定してあれば拒否
+				if(strcmp(sd->ignore[i].name, wisp_source)==0){
+					break;
+				}
+			}
+			if(i==MAX_IGNORE_LIST) // run out of list, so we are not ignored
+			{
+				clif_wis_message(sd->fd, wisp_source, (char*)RFIFOP(fd,56),RFIFOW(fd,2)-56);
+				intif_wis_replay(id,0);   // 送信成功
+			}
+			else
+				intif_wis_replay(id, 2);   // 受信拒否
 		}
 	}else
 		intif_wis_replay(id,1);	// そんな人いません

+ 20 - 5
src/map/npc.c

@@ -32,13 +32,17 @@
 
 struct npc_src_list {
 	struct npc_src_list * next;
-	struct npc_src_list * prev;
+//	struct npc_src_list * prev; //[Shinomori]
 	char name[4];
 } ;
 
-static struct npc_src_list *npc_src_first,*npc_src_last;
+static struct npc_src_list *npc_src_first=NULL;
+static struct npc_src_list *npc_src_last=NULL;
 static int npc_id=START_NPC_NUM;
-static int npc_warp,npc_shop,npc_script,npc_mob;
+static int npc_warp=0;
+static int npc_shop=0;
+static int npc_script=0;
+static int npc_mob=0;
 
 int npc_get_new_npc_id(void){ return npc_id++; }
 
@@ -1366,6 +1370,17 @@ void npc_addsrcfile(char *name)
 		return;
 	}
 
+	{
+		// prevent multiple insert of source files
+		struct npc_src_list *p=npc_src_first;
+		while( p )
+		{   // found the file, no need to insert it again
+			if( 0==strcmp(name,p->name) )
+				return;
+			p=p->next;
+		}
+	}
+
 	len = sizeof(*new) + strlen(name);
 	new=(struct npc_src_list *)aCalloc(1,len);
 	new->next = NULL;
@@ -2273,10 +2288,10 @@ int do_init_npc(void)
 	memset(&ev_tm_b,-1,sizeof(ev_tm_b));
 
 	for(nsl=npc_src_first;nsl;nsl=nsl->next) {
-		if(nsl->prev){
+		/*if(nsl->prev){ // [Shinomori]
 			free(nsl->prev);
 			nsl->prev = NULL;
-		}
+		}*/
 		fp=fopen(nsl->name,"r");
 		if (fp==NULL) {
 			printf("file not found : %s\n",nsl->name);

+ 5 - 7
src/map/pc.c

@@ -55,13 +55,11 @@ static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL];
 static int exp_table[14][MAX_LEVEL];
 static char statp[255][7];
 
-/*static struct {
-	int id;
-	int max;
-	struct {
-		short id,lv;
-	} need[6];
-} skill_tree[3][MAX_PC_CLASS][100];*/ // moved to pc.h - celest
+// h-files are for declarations, not for implementations... [Shinomori]
+struct skill_tree_entry skill_tree[3][MAX_PC_CLASS][100];
+// timer for night.day implementation
+int day_timer_tid;
+int night_timer_tid;
 
 static int atkmods[3][20];	// 武器ATKサイズ修正(size_fix.txt)
 static int refinebonus[5][3];	// 精?ボ?ナステ?ブル(refine_db.txt)

+ 4 - 3
src/map/pc.h

@@ -181,7 +181,8 @@ struct skill_tree_entry {
 	struct {
 		short id,lv;
 	} need[6];
-} skill_tree[3][MAX_PC_CLASS][100];	// Celest
+}; // Celest
+extern struct skill_tree_entry skill_tree[3][MAX_PC_CLASS][100];
 
 int pc_read_gm_account(int fd);
 int pc_setinvincibletimer(struct map_session_data *sd,int);
@@ -194,8 +195,8 @@ int do_init_pc(void);
 enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT};
 
 // timer for night.day
-int day_timer_tid;
-int night_timer_tid;
+extern int day_timer_tid;
+extern int night_timer_tid;
 int map_day_timer(int,unsigned int,int,int); // by [yor]
 int map_night_timer(int,unsigned int,int,int); // by [yor]