summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 76dad5203..566cd1e21 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -287,7 +287,7 @@ int search_character_online(int aid, int cid)
{
//Look for online character.
struct online_char_data* character;
- character = idb_get(online_char_db, aid);
+ character = (struct online_char_data*)idb_get(online_char_db, aid);
if(character &&
character->char_id == cid &&
character->server > -1)
@@ -297,7 +297,7 @@ int search_character_online(int aid, int cid)
static void * create_online_char_data(DBKey key, va_list args)
{
struct online_char_data* character;
- character = aCalloc(1, sizeof(struct online_char_data));
+ character = (struct online_char_data*)aCalloc(1, sizeof(struct online_char_data));
character->account_id = key.i;
character->char_id = -1;
character->server = -1;
@@ -327,7 +327,7 @@ void set_char_online(int map_id, int char_id, int account_id)
}
}
- character = idb_ensure(online_char_db, account_id, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
if (online_check && character->char_id != -1 && character->server > -1 && character->server != map_id)
{
//char == 99 <- Character logging in, so someone has logged in while one
@@ -362,7 +362,7 @@ void set_char_offline(int char_id, int account_id)
{
struct online_char_data* character;
- if ((character = idb_get(online_char_db, account_id)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL)
{ //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex]
if( character->server > -1 )
server[character->server].users--;
@@ -1911,7 +1911,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
return;
}
- if( online_check && (character = idb_get(online_char_db, sd->account_id)) != NULL )
+ if( online_check && (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) != NULL )
{ // check if character is not online already. [Skotlex]
if (character->server > -1)
{ //Character already online. KICK KICK KICK
@@ -2301,7 +2301,7 @@ int parse_fromlogin(int fd)
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
return 0;
{
- unsigned char buf[32000];
+ unsigned char buf[32000]; //FIXME: this will crash
if (gm_account != NULL)
aFree(gm_account);
CREATE(gm_account, struct gm_account, (RFIFOW(fd,2) - 4)/5);
@@ -2330,7 +2330,7 @@ int parse_fromlogin(int fd)
{
struct online_char_data* character;
int aid = RFIFOL(fd,2);
- if ((character = idb_get(online_char_db, aid)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL)
{ //Kick out this player.
if (character->server > -1)
{ //Kick it from the map server it is on.
@@ -2434,10 +2434,10 @@ int char_parse_Registry(int account_id, int char_id, unsigned char *buf, int buf
if(i >= char_num) //Character not found?
return 1;
for(j=0,p=0;j<GLOBAL_REG_NUM && p<buf_len;j++){
- sscanf(WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len);
+ sscanf((char*)WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len);
char_dat[i].global[j].str[len]='\0';
p +=len+1; //+1 to skip the '\0' between strings.
- sscanf(WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len);
+ sscanf((char*)WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len);
char_dat[i].global[j].value[len]='\0';
p +=len+1;
}
@@ -2463,8 +2463,8 @@ int char_account_reg_reply(int fd,int account_id,int char_id)
}else{
for (p=13,j = 0; j < char_dat[i].global_num; j++) {
if (char_dat[i].global[j].str[0]) {
- p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place.
- p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1;
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place.
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1;
}
}
WFIFOW(fd,2)=p;
@@ -2581,7 +2581,7 @@ int char_send_fame_list(int fd)
void char_update_fame_list(int type, int index, int fame)
{
- char buf[9];
+ unsigned char buf[9];
WBUFW(buf,0) = 0x2b22;
WBUFB(buf,2) = type;
WBUFB(buf,3) = index;
@@ -2767,7 +2767,7 @@ int parse_frommap(int fd)
struct online_char_data* character;
aid = RFIFOL(fd,6+i*8);
cid = RFIFOL(fd,6+i*8+4);
- character = idb_ensure(online_char_db, aid, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, aid, create_online_char_data);
if (online_check && character->server > -1 && character->server != id)
{
ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n",
@@ -2863,7 +2863,7 @@ int parse_frommap(int fd)
memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus));
WFIFOSET(map_fd, WFIFOW(map_fd,2));
- data = idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
+ data = (struct online_char_data*)idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
data->char_id = char_data->char_id;
data->server = map_id; //Update server where char is.
@@ -3134,7 +3134,7 @@ int parse_frommap(int fd)
if (data->count != count)
{
data->count = count;
- data->data = aRealloc(data->data, count*sizeof(struct status_change_data));
+ data->data = (struct status_change_data*)aRealloc(data->data, count*sizeof(struct status_change_data));
}
for (i = 0; i < count; i++)
memcpy (&data->data[i], RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
@@ -3237,7 +3237,7 @@ int parse_char(int fd)
{
if (sd != NULL)
{
- struct online_char_data* data = idb_get(online_char_db, sd->account_id);
+ struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
if (!data || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
set_char_offline(99,sd->account_id);
if (data && data->fd == fd)
@@ -3631,8 +3631,8 @@ int parse_char(int fd)
if (RFIFOREST(fd) < 60)
return 0;
{
- char* l_user = RFIFOP(fd,2);
- char* l_pass = RFIFOP(fd,26);
+ char* l_user = (char*)RFIFOP(fd,2);
+ char* l_pass = (char*)RFIFOP(fd,26);
l_user[23] = '\0';
l_pass[23] = '\0';
ARR_FIND( 0, MAX_MAP_SERVERS, i, server[i].fd <= 0 );
@@ -3899,7 +3899,7 @@ int ping_login_server(int tid, unsigned int tick, int id, int data)
static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, int data)
{
struct online_char_data* character;
- if ((character = idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
{ //Mark it offline due to timeout.
character->waiting_disconnect = -1;
set_char_offline(character->char_id, character->account_id);