summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-18 00:30:28 -0300
committershennetsind <ind@henn.et>2013-02-18 00:30:28 -0300
commit7e72f0cee8867837be53cb2119b610b00e9bd587 (patch)
tree22ab404109fb2def22cf0085fcec2bf174210970 /src/char
parent237d76e7c409251b5fdb9f3eee40ef3fe5dc2b25 (diff)
downloadhercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.gz
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.bz2
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.tar.xz
hercules-7e72f0cee8867837be53cb2119b610b00e9bd587.zip
Improvements all over the place
Committing on the behalf of mkbu95 who is unable to do it himself, he coded it all and sent me the diff. Thanks mkbu95! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c14
-rw-r--r--src/char/int_guild.c11
2 files changed, 13 insertions, 12 deletions
diff --git a/src/char/char.c b/src/char/char.c
index e7220aa36..cd1b1da66 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2833,8 +2833,6 @@ int parse_frommap(int fd)
if( RFIFOREST(fd) < 18 )
return 0;
{
- struct auth_node* node;
-
int account_id = RFIFOL(fd,2);
uint32 login_id1 = RFIFOL(fd,6);
uint32 login_id2 = RFIFOL(fd,10);
@@ -2851,6 +2849,8 @@ int parse_frommap(int fd)
}
else
{
+ struct auth_node* node;
+
// create temporary auth entry
CREATE(node, struct auth_node, 1);
node->account_id = account_id;
@@ -2880,7 +2880,6 @@ int parse_frommap(int fd)
return 0;
{
int map_id, map_fd = -1;
- struct online_char_data* data;
struct mmo_charstatus* char_data;
struct mmo_charstatus char_dat;
@@ -2898,6 +2897,7 @@ int parse_frommap(int fd)
session_isActive(map_fd) &&
char_data )
{ //Send the map server the auth of this player.
+ struct online_char_data* data;
struct auth_node* node;
//Update the "last map" as this is where the player must be spawned on the new map server.
@@ -4571,25 +4571,25 @@ int char_config_read(const char* cfgName)
safestrncpy(wisp_server_name, w2, sizeof(wisp_server_name));
}
} else if (strcmpi(w1, "login_ip") == 0) {
- char ip_str[16];
login_ip = host2ip(w2);
if (login_ip) {
+ char ip_str[16];
safestrncpy(login_ip_str, w2, sizeof(login_ip_str));
ShowStatus("Login server IP address : %s -> %s\n", w2, ip2str(login_ip, ip_str));
}
} else if (strcmpi(w1, "login_port") == 0) {
login_port = atoi(w2);
} else if (strcmpi(w1, "char_ip") == 0) {
- char ip_str[16];
char_ip = host2ip(w2);
- if (char_ip){
+ if (char_ip) {
+ char ip_str[16];
safestrncpy(char_ip_str, w2, sizeof(char_ip_str));
ShowStatus("Character server IP address : %s -> %s\n", w2, ip2str(char_ip, ip_str));
}
} else if (strcmpi(w1, "bind_ip") == 0) {
- char ip_str[16];
bind_ip = host2ip(w2);
if (bind_ip) {
+ char ip_str[16];
safestrncpy(bind_ip_str, w2, sizeof(bind_ip_str));
ShowStatus("Character server binding IP address : %s -> %s\n", w2, ip2str(bind_ip, ip_str));
}
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 7c2086722..46bba63db 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -217,8 +217,8 @@ int inter_guild_tosql(struct guild *g,int flag)
strcat(t_info, " level");
if( add_comma )
StringBuf_AppendStr(&buf, ", ");
- else
- add_comma = true;
+ //else //last condition using add_coma setting
+ // add_comma = true;
StringBuf_Printf(&buf, "`guild_lv`=%d, `skill_point`=%d, `exp`=%"PRIu64", `next_exp`=%u, `max_member`=%d", g->guild_lv, g->skill_point, g->exp, g->next_exp, g->max_member);
}
StringBuf_Printf(&buf, " WHERE `guild_id`=%d", g->guild_id);
@@ -509,7 +509,7 @@ struct guild * inter_guild_fromsql(int guild_id)
{
int id;
Sql_GetData(sql_handle, 0, &data, NULL); id = atoi(data) - GD_SKILLBASE;
- if( id < 0 && id >= MAX_GUILDSKILL )
+ if( id < 0 || id >= MAX_GUILDSKILL )
continue;// invalid guild skill
Sql_GetData(sql_handle, 1, &data, NULL); g->skill[id].lv = atoi(data);
}
@@ -604,7 +604,7 @@ static bool exp_guild_parse_row(char* split[], int column, int current)
{
unsigned int exp = (unsigned int)atol(split[0]);
- if (exp < 0 || exp >= UINT_MAX) {
+ if (exp >= UINT_MAX) {
ShowError("exp_guild: Invalid exp %d at line %d\n", exp, current);
return false;
}
@@ -1262,7 +1262,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
// Delete member from guild
int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes)
{
- int i, j;
+ int i;
struct guild* g = inter_guild_fromsql(guild_id);
if( g == NULL )
@@ -1285,6 +1285,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in
if( flag )
{ // Write expulsion reason
// Find an empty slot
+ int j;
ARR_FIND( 0, MAX_GUILDEXPULSION, j, g->expulsion[j].account_id == 0 );
if( j == MAX_GUILDEXPULSION )
{