diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-15 09:24:02 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-04-05 21:20:35 +0200 |
commit | 5c99148b945ed4fe6c01af05bcf390de8df13505 (patch) | |
tree | a2abd3330895fd0d3f996c40500d8375cefcf32b | |
parent | ea824742822a2e17b2b83c77d6b28bf0a12aacf4 (diff) | |
download | hercules-5c99148b945ed4fe6c01af05bcf390de8df13505.tar.gz hercules-5c99148b945ed4fe6c01af05bcf390de8df13505.tar.bz2 hercules-5c99148b945ed4fe6c01af05bcf390de8df13505.tar.xz hercules-5c99148b945ed4fe6c01af05bcf390de8df13505.zip |
Apply code style to inter_pet_fromsql() function
-rw-r--r-- | src/char/int_pet.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/char/int_pet.c b/src/char/int_pet.c index 2ba31b43b..9b81869d2 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -128,8 +128,21 @@ static int inter_pet_tosql(const struct s_pet *p) return pet_id; } +/** + * Loads a pet's data from the SQL database. + * + * Table structure: + * `pet` (`pet_id`, `class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incubate`, `autofeed`) + * + * @param pet_id The pet's ID. + * @param p The pet data to save the SQL data in. + * @return Always 0. + * + **/ static int inter_pet_fromsql(int pet_id, struct s_pet *p) { + nullpo_ret(p); + struct SqlStmt *stmt = SQL->StmtMalloc(inter->sql_handle); if (stmt == NULL) { @@ -140,13 +153,12 @@ static int inter_pet_fromsql(int pet_id, struct s_pet *p) #ifdef NOISY ShowInfo("Loading pet (%d)...\n",pet_id); #endif - nullpo_ret(p); - memset(p, 0, sizeof(struct s_pet)); - //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`, `autofeed`) + memset(p, 0, sizeof(struct s_pet)); const char *query = "SELECT " - "`class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, `intimate`, `hungry`, `rename_flag`, `incubate`, `autofeed` " + "`class`, `name`, `account_id`, `char_id`, `level`, `egg_id`, `equip`, " + "`intimate`, `hungry`, `rename_flag`, `incubate`, `autofeed` " "FROM `%s` WHERE `pet_id`=?"; if (SQL_ERROR == SQL->StmtPrepare(stmt, query, pet_db) || |