summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-02 15:33:00 -0300
committershennetsind <ind@henn.et>2013-04-02 15:33:00 -0300
commit2a8ab737f60439d2c9faf0b374fcb0daa8365a4d (patch)
tree90cbca4511325ca88c93c7fc559cfa661949f4f0
parent716c400ab53268b432045b8f2883285d22ce650c (diff)
downloadhercules-2a8ab737f60439d2c9faf0b374fcb0daa8365a4d.tar.gz
hercules-2a8ab737f60439d2c9faf0b374fcb0daa8365a4d.tar.bz2
hercules-2a8ab737f60439d2c9faf0b374fcb0daa8365a4d.tar.xz
hercules-2a8ab737f60439d2c9faf0b374fcb0daa8365a4d.zip
Follow up a4e273d9bed24286002bed8f2909f0ff1b5c4f91
Fixed a issue that was making it unable to create new characters Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/char/char.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/char/char.c b/src/char/char.c
index ec16883b7..0b8a3831d 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -984,13 +984,15 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
char last_map[MAP_NAME_LENGTH_EXT];
stmt = SqlStmt_Malloc(sql_handle);
- if( stmt == NULL )
- {
+ if( stmt == NULL ) {
SqlStmt_ShowDebug(stmt);
return 0;
}
memset(&p, 0, sizeof(p));
+ for(i = 0 ; i < MAX_CHARS; i++ )
+ sd->found_char[i] = -1;
+
// read char data
if( SQL_ERROR == SqlStmt_Prepare(stmt, "SELECT "
"`char_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`,"
@@ -1043,14 +1045,12 @@ int mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
SqlStmt_Free(stmt);
return 0;
}
- for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); i++ )
- {
+
+ for( i = 0; i < MAX_CHARS && SQL_SUCCESS == SqlStmt_NextRow(stmt); i++ ) {
p.last_point.map = mapindex_name2id(last_map);
sd->found_char[p.slot] = p.char_id;
j += mmo_char_tobuf(WBUFP(buf, j), &p);
}
- for( ; i < MAX_CHARS; i++ )
- sd->found_char[i] = -1;
memset(sd->new_name,0,sizeof(sd->new_name));
@@ -1533,7 +1533,7 @@ int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int ag
#endif
// check char slot
- if( sd->found_char[slot] )
+ if( sd->found_char[slot] != -1 )
return -2; /* character account limit exceeded */
// validation success, log result