summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/grfio.c20
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/common/socket.c5
-rw-r--r--src/login/login.h6
-rw-r--r--src/map/intif.c18
-rw-r--r--src/map/npc.c25
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/pc.h7
8 files changed, 67 insertions, 30 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index d27636d33..c8c021b8d 100644
--- a/src/common/grfio.c
+++ b/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)
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 5ee6bf602..44069b85f 100644
--- a/src/common/mmo.h
+++ b/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_
diff --git a/src/common/socket.c b/src/common/socket.c
index dfeebf03a..0f5b53550 100644
--- a/src/common/socket.c
+++ b/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>
diff --git a/src/login/login.h b/src/login/login.h
index 9ae4734fe..7370f5238 100644
--- a/src/login/login.h
+++ b/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
diff --git a/src/map/intif.c b/src/map/intif.c
index fd79acc0c..28f1b65a2 100644
--- a/src/map/intif.c
+++ b/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); // そんな人いません
diff --git a/src/map/npc.c b/src/map/npc.c
index 7b616282f..728e76a9c 100644
--- a/src/map/npc.c
+++ b/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);
diff --git a/src/map/pc.c b/src/map/pc.c
index 3cd14fcef..09ff43733 100644
--- a/src/map/pc.c
+++ b/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)
diff --git a/src/map/pc.h b/src/map/pc.h
index 1f294ce92..a32926886 100644
--- a/src/map/pc.h
+++ b/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]