summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-05 04:25:56 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-05 04:25:56 +0000
commitf204cc7915dac6116bce5f402c8882ea0aff49a4 (patch)
tree35639b6c012b987f5fca8309641d68c76eaa53cb
parentc4f027e10aaeeb4ab72b68cae0b3e66d8bb5a4b2 (diff)
downloadhercules-f204cc7915dac6116bce5f402c8882ea0aff49a4.tar.gz
hercules-f204cc7915dac6116bce5f402c8882ea0aff49a4.tar.bz2
hercules-f204cc7915dac6116bce5f402c8882ea0aff49a4.tar.xz
hercules-f204cc7915dac6116bce5f402c8882ea0aff49a4.zip
Fix some compile errors
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1037 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog.txt1
-rw-r--r--src/char/char.c1
-rw-r--r--src/common/buffer.h2
-rw-r--r--src/login/login.c1
-rw-r--r--src/map/map.c62
-rw-r--r--src/map/npc.c14
6 files changed, 43 insertions, 38 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 5dbab7aa2..4cb2220f1 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,6 +1,7 @@
Date Added
02/04
+ * Fixed some compile errors [SVN 1037: MouseJstr]
* Added common/buffer.(c/h) [SVN 1033: Ajarn]
* Login server can now set it's ip address in the config [SVN 1033: Ajarn]
* Servers now bind to a single ip address, thus allowing multiple servers to
diff --git a/src/char/char.c b/src/char/char.c
index caae3c143..70bf4aeb7 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -25,6 +25,7 @@
#include "lock.h"
#include "char.h"
#include "showmsg.h"
+#include "buffer.h"
#include "inter.h"
#include "int_pet.h"
diff --git a/src/common/buffer.h b/src/common/buffer.h
index 294233595..4d7f46d38 100644
--- a/src/common/buffer.h
+++ b/src/common/buffer.h
@@ -15,4 +15,4 @@
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/src/login/login.c b/src/login/login.c
index a61210921..5c3888bd4 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -42,6 +42,7 @@ void Gettimeofday(struct timeval *timenow)
#include "../common/db.h"
#include "../common/lock.h"
#include "../common/malloc.h"
+#include "../common/buffer.h"
#ifdef PASSWORDENC
#include "md5calc.h"
diff --git a/src/map/map.c b/src/map/map.c
index c214f16a2..c0f3aa046 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -117,7 +117,7 @@ static struct dbt * nick_db=NULL;
static struct dbt * charid_db=NULL;
static int users=0;
-static struct block_list *object[MAX_FLOORITEM];
+static struct block_list *objects[MAX_FLOORITEM];
static int first_free_object_id=0,last_object_id=0;
#define block_free_max 1048576
@@ -668,7 +668,7 @@ int map_addobject(struct block_list *bl) {
if(first_free_object_id<2 || first_free_object_id>=MAX_FLOORITEM)
first_free_object_id=2;
for(i=first_free_object_id;i<MAX_FLOORITEM;i++)
- if(object[i]==NULL)
+ if(objects[i]==NULL)
break;
if(i>=MAX_FLOORITEM){
if(battle_config.error_log)
@@ -678,7 +678,7 @@ int map_addobject(struct block_list *bl) {
first_free_object_id=i;
if(last_object_id<i)
last_object_id=i;
- object[i]=bl;
+ objects[i]=bl;
numdb_insert(id_db,i,bl);
return i;
}
@@ -689,18 +689,18 @@ int map_addobject(struct block_list *bl) {
*------------------------------------------
*/
int map_delobjectnofree(int id) {
- if(object[id]==NULL)
+ if(objects[id]==NULL)
return 0;
- map_delblock(object[id]);
+ map_delblock(objects[id]);
numdb_erase(id_db,id);
-// map_freeblock(object[id]);
- object[id]=NULL;
+// map_freeblock(objects[id]);
+ objects[id]=NULL;
if(first_free_object_id>id)
first_free_object_id=id;
- while(last_object_id>2 && object[last_object_id]==NULL)
+ while(last_object_id>2 && objects[last_object_id]==NULL)
last_object_id--;
return 0;
@@ -715,7 +715,7 @@ int map_delobjectnofree(int id) {
*------------------------------------------
*/
int map_delobject(int id) {
- struct block_list *obj = object[id];
+ struct block_list *obj = objects[id];
if(obj==NULL)
return 0;
@@ -739,15 +739,15 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) {
va_start(ap,type);
for(i=2;i<=last_object_id;i++){
- if(object[i]){
- if(type && object[i]->type!=type)
+ if(objects[i]){
+ if(type && objects[i]->type!=type)
continue;
if(bl_list_count>=BL_LIST_MAX) {
if(battle_config.error_log)
printf("map_foreachobject: too many block !\n");
}
else
- bl_list[bl_list_count++]=object[i];
+ bl_list[bl_list_count++]=objects[i];
}
}
@@ -776,7 +776,7 @@ void map_foreachobject(int (*func)(struct block_list*,va_list),int type,...) {
int map_clearflooritem_timer(int tid,unsigned int tick,int id,int data) {
struct flooritem_data *fitem=NULL;
- fitem = (struct flooritem_data *)object[id];
+ fitem = (struct flooritem_data *)objects[id];
if(fitem==NULL || fitem->bl.type!=BL_ITEM || (!data && fitem->cleartimer != tid)){
if(battle_config.error_log)
printf("map_clearflooritem_timer : error\n");
@@ -1189,8 +1189,8 @@ struct map_session_data * map_nick2sd(char *nick) {
struct block_list * map_id2bl(int id)
{
struct block_list *bl=NULL;
- if(id<sizeof(object)/sizeof(object[0]))
- bl = object[id];
+ if(id<sizeof(objects)/sizeof(objects[0]))
+ bl = objects[id];
else
bl = (struct block_list*)numdb_search(id_db,id);
@@ -1539,14 +1539,16 @@ struct map_cache_info {
int compressed_len; // zilb通せるようにする為の予約
}; // 56 byte
+struct map_cache_head {
+ int sizeof_header;
+ int sizeof_map;
+ // 上の2つ改変不可
+ int nmaps; // マップの個数
+ int filesize;
+};
+
struct {
- struct map_cache_head {
- int sizeof_header;
- int sizeof_map;
- // 上の2つ改変不可
- int nmaps; // マップの個数
- int filesize;
- } head;
+ struct map_cache_head head;
struct map_cache_info *map;
FILE *fp;
int dirty;
@@ -1574,7 +1576,7 @@ static int map_cache_open(char *fn)
map_cache.head.filesize == ftell(map_cache.fp)
) {
// キャッシュ読み込み成功
- map_cache.map = aMalloc(sizeof(struct map_cache_info) * map_cache.head.nmaps);
+ map_cache.map = (struct map_cache_info *) aMalloc(sizeof(struct map_cache_info) * map_cache.head.nmaps);
fseek(map_cache.fp,sizeof(struct map_cache_head),SEEK_SET);
fread(map_cache.map,sizeof(struct map_cache_info),map_cache.head.nmaps,map_cache.fp);
return 1;
@@ -1585,7 +1587,7 @@ static int map_cache_open(char *fn)
map_cache.fp = fopen(fn,"wb");
if(map_cache.fp) {
memset(&map_cache.head,0,sizeof(struct map_cache_head));
- map_cache.map = aCalloc(sizeof(struct map_cache_info),MAX_MAP_CACHE);
+ map_cache.map = (struct map_cache_info *) aCalloc(sizeof(struct map_cache_info),MAX_MAP_CACHE);
map_cache.head.nmaps = MAX_MAP_CACHE;
map_cache.head.sizeof_header = sizeof(struct map_cache_head);
map_cache.head.sizeof_map = sizeof(struct map_cache_info);
@@ -1690,14 +1692,14 @@ static int map_cache_write(struct map_data *m)
if(map_read_flag == 2) {
// 圧縮保存
// さすがに2倍に膨れる事はないという事で
- write_buf = aMalloc(m->xs * m->ys * 2);
+ write_buf = (char *) aMalloc(m->xs * m->ys * 2);
len_new = m->xs * m->ys * 2;
- encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys);
+ encode_zip((unsigned char *) write_buf,&len_new,m->gat,m->xs * m->ys);
map_cache.map[i].compressed = 1;
map_cache.map[i].compressed_len = len_new;
} else {
len_new = m->xs * m->ys;
- write_buf = m->gat;
+ write_buf = (char *) m->gat;
map_cache.map[i].compressed = 0;
map_cache.map[i].compressed_len = 0;
}
@@ -1727,14 +1729,14 @@ static int map_cache_write(struct map_data *m)
if(map_cache.map[i].fn[0] == 0) {
// 新しい場所に登録
if(map_read_flag == 2) {
- write_buf = aMalloc(m->xs * m->ys * 2);
+ write_buf = (char *) aMalloc(m->xs * m->ys * 2);
len_new = m->xs * m->ys * 2;
- encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys);
+ encode_zip((unsigned char *) write_buf,&len_new,m->gat,m->xs * m->ys);
map_cache.map[i].compressed = 1;
map_cache.map[i].compressed_len = len_new;
} else {
len_new = m->xs * m->ys;
- write_buf = m->gat;
+ write_buf = (char *) m->gat;
map_cache.map[i].compressed = 0;
map_cache.map[i].compressed_len = 0;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index cbb6c5495..0519b9925 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1636,26 +1636,26 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line
// スクリプトの解析
srcbuf=(unsigned char *)aCallocA(srcsize,sizeof(char));
if (strchr(first_line,'{')) {
- strcpy(srcbuf,strchr(first_line,'{'));
+ strcpy((char *) srcbuf,strchr(first_line,'{'));
startline=*lines;
} else
srcbuf[0]=0;
while(1) {
- for(i=strlen(srcbuf)-1;i>=0 && isspace(srcbuf[i]);i--);
+ for(i=strlen((const char *) srcbuf)-1;i>=0 && isspace(srcbuf[i]);i--);
if (i>=0 && srcbuf[i]=='}')
break;
- fgets(line,1020,fp);
+ fgets((char *) line,1020,fp);
(*lines)++;
if (feof(fp))
break;
- if (strlen(srcbuf)+strlen(line)+1>=srcsize) {
+ if (strlen((char *) srcbuf)+strlen((char *) line)+1>=srcsize) {
srcsize += 65536;
- srcbuf = (char *)aRealloc(srcbuf, srcsize);
+ srcbuf = (unsigned char *)aRealloc(srcbuf, srcsize);
memset(srcbuf + srcsize - 65536, '\0', 65536);
}
if (srcbuf[0]!='{') {
- if (strchr(line,'{')) {
- strcpy(srcbuf,strchr(line,'{'));
+ if (strchr((char *) line,'{')) {
+ strcpy(srcbuf,strchr((const char *) line,'{'));
startline=*lines;
}
} else