From 28cee2caa9b546e92e799f9b4d64f427f180d6f6 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Mon, 14 Nov 2016 20:05:19 +0100 Subject: [PATCH] Cleaned storage saving output --- src/char/char.c | 4 ++-- src/char/int_storage.c | 16 ++++++++++++++++ src/char/int_storage.h | 1 + src/map/clif.c | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/char/char.c b/src/char/char.c index ebe98ac937..a9e96eebe4 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -537,7 +537,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto selectoption = "char_id"; break; case TABLE_STORAGE: - printname = "Storage"; + printname = inter_premiumStorage_getPrintableName(stor_id); tablename = inter_premiumStorage_getTableName(stor_id); selectoption = "account_id"; break; @@ -826,7 +826,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag memcpy(&storage[i], &item, sizeof(item)); p->amount = i; - ShowInfo("Loaded %s (%d) data from table %s for %s: %d (total: %d)\n", printname, p->stor_id, tablename, selectoption, id, p->amount); + ShowInfo("Loaded %s data from table %s for %s: %d (total: %d)\n", printname, tablename, selectoption, id, p->amount); SqlStmt_FreeResult(stmt); SqlStmt_Free(stmt); diff --git a/src/char/int_storage.c b/src/char/int_storage.c index df6e825736..f2bb2a3c44 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -63,6 +63,22 @@ const char *inter_premiumStorage_getTableName(uint8 id) { return schema_config.storage_db; } +/** +* Get printable name of storage +* @param id Storage ID +* @return printable name +**/ +const char *inter_premiumStorage_getPrintableName(uint8 id) { + if (interserv_config.storages && interserv_config.storage_count) { + int i; + for (i = 0; i < interserv_config.storage_count; i++) { + if (&interserv_config.storages[i] && interserv_config.storages[i].id == id) + return interserv_config.storages[i].name; + } + } + return "Storage"; +} + /** * Save inventory entries to SQL * @param char_id: Character ID to save diff --git a/src/char/int_storage.h b/src/char/int_storage.h index 9418a13038..4ba947a002 100644 --- a/src/char/int_storage.h +++ b/src/char/int_storage.h @@ -12,6 +12,7 @@ void inter_storage_sql_final(void); bool inter_premiumStorage_exists(uint8 id); int inter_premiumStorage_getMax(uint8 id); const char *inter_premiumStorage_getTableName(uint8 id); +const char *inter_premiumStorage_getPrintableName(uint8 id); bool inter_storage_parse_frommap(int fd); diff --git a/src/map/clif.c b/src/map/clif.c index a9bfd8c299..d6305bc1b7 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10303,7 +10303,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) status_change_clear_onChangeMap(&sd->bl, &sd->sc); map_iwall_get(sd); // Updates Walls Info on this Map to Client - status_calc_pc(sd, SCO_NONE); // Some conditions are map-dependent so we must recalculate + status_calc_pc(sd, sd->state.autotrade ? SCO_FIRST : SCO_NONE); // Some conditions are map-dependent so we must recalculate #ifdef VIP_ENABLE if (!sd->state.connect_new &&