Skip to content
Permalink
Browse files
Follow up to 7cd82d0.
- Adjusted a few SQL variable types and specifiers for cards in the char-server.
  • Loading branch information
aleos89 committed Jun 12, 2014
1 parent 42b29ee commit 82467e14ed57d5c8c7ad7a26599d08431633bc50
Showing with 12 additions and 12 deletions.
  1. +8 −8 src/char/char.c
  2. +2 −2 src/char/int_auction.c
  3. +1 −1 src/char/int_mail.c
  4. +1 −1 src/char/int_storage.c
@@ -613,7 +613,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &item.bound, 0, NULL, NULL);
for( j = 0; j < MAX_SLOTS; ++j )
SqlStmt_BindColumn(stmt, 9+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 9+j, SQLDT_USHORT, &item.card[j], 0, NULL, NULL);

// bit array indicating which inventory items have already been matched
flag = (bool*) aCalloc(max, sizeof(bool));
@@ -650,7 +650,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d'",
tablename, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound);
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ", `card%d`=%d", j, items[i].card[j]);
StringBuf_Printf(&buf, ", `card%d`=%hu", j, items[i].card[j]);
StringBuf_Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id);

if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) )
@@ -697,7 +697,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id);
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ", '%d'", items[i].card[j]);
StringBuf_Printf(&buf, ", '%hu'", items[i].card[j]);
StringBuf_AppendStr(&buf, ")");

updateLastUid(items[i].unique_id); // Unique Non Stackable Item ID
@@ -760,7 +760,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 9, SQLDT_CHAR, &item.bound, 0, NULL, NULL);
for( j = 0; j < MAX_SLOTS; ++j )
SqlStmt_BindColumn(stmt, 10+j, SQLDT_SHORT, &item.card[j], 0, NULL, NULL);
SqlStmt_BindColumn(stmt, 10+j, SQLDT_USHORT, &item.card[j], 0, NULL, NULL);

// bit array indicating which inventory items have already been matched
flag = (bool*) aCalloc(max, sizeof(bool));
@@ -795,7 +795,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%d', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `favorite`='%d', `bound`='%d'",
schema_config.inventory_db, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite, items[i].bound);
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ", `card%d`=%d", j, items[i].card[j]);
StringBuf_Printf(&buf, ", `card%d`=%hu", j, items[i].card[j]);
StringBuf_Printf(&buf, " WHERE `id`='%d' LIMIT 1", item.id);

if( SQL_ERROR == Sql_QueryStr(sql_handle, StringBuf_Value(&buf)) ) {
@@ -838,7 +838,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%d', '%"PRIu64"'",
id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite, items[i].bound, items[i].unique_id);
for( j = 0; j < MAX_SLOTS; ++j )
StringBuf_Printf(&buf, ", '%d'", items[i].card[j]);
StringBuf_Printf(&buf, ", '%hu'", items[i].card[j]);
StringBuf_AppendStr(&buf, ")");

updateLastUid(items[i].unique_id);// Unique Non Stackable Item ID
@@ -1124,7 +1124,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
|| SQL_ERROR == SqlStmt_BindColumn(stmt,10, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
if( SQL_ERROR == SqlStmt_BindColumn(stmt, 11+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
if( SQL_ERROR == SqlStmt_BindColumn(stmt, 11+i, SQLDT_USHORT, &tmp_item.card[i], 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);

for( i = 0; i < MAX_INVENTORY && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
@@ -1155,7 +1155,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
|| SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);
for( i = 0; i < MAX_SLOTS; ++i )
if( SQL_ERROR == SqlStmt_BindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) )
if( SQL_ERROR == SqlStmt_BindColumn(stmt, 10+i, SQLDT_USHORT, &tmp_item.card[i], 0, NULL, NULL) )
SqlStmt_ShowDebug(stmt);

for( i = 0; i < MAX_CART && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
@@ -53,7 +53,7 @@ void auction_save(struct auction_data *auction)
StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%hu', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
schema_config.auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
StringBuf_Printf(&buf, ", `card%d` = '%hu'", j, auction->item.card[j]);
StringBuf_Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);

stmt = SqlStmt_Malloc(sql_handle);
@@ -88,7 +88,7 @@ unsigned int auction_create(struct auction_data *auction)
StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%hu',?,'%d','%d','%d','%"PRIu64"'",
auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute, auction->item.unique_id);
for( j = 0; j < MAX_SLOTS; j++ )
StringBuf_Printf(&buf, ",'%d'", auction->item.card[j]);
StringBuf_Printf(&buf, ",'%hu'", auction->item.card[j]);
StringBuf_AppendStr(&buf, ")");

//Unique Non Stackable Item ID
@@ -115,7 +115,7 @@ int mail_savemessage(struct mail_message* msg)
StringBuf_Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%hu', '%d', '%d', '%d', '%"PRIu64"'",
msg->send_id, msg->dest_id, (unsigned long)msg->timestamp, msg->status, msg->zeny, msg->item.amount, msg->item.nameid, msg->item.refine, msg->item.attribute, msg->item.identify, msg->item.unique_id);
for (j = 0; j < MAX_SLOTS; j++)
StringBuf_Printf(&buf, ", '%d'", msg->item.card[j]);
StringBuf_Printf(&buf, ", '%hu'", msg->item.card[j]);
StringBuf_AppendStr(&buf, ")");

//Unique Non Stackable Item ID
@@ -402,7 +402,7 @@ int mapif_parse_itembound_retrieve(int fd)
guild_id, items[j].nameid, items[j].amount, items[j].equip, items[j].identify, items[j].refine,
items[j].attribute, items[j].expire_time, items[j].bound);
for( s = 0; s < MAX_SLOTS; ++s )
StringBuf_Printf(&buf, ", '%d'", items[j].card[s]);
StringBuf_Printf(&buf, ", '%hu'", items[j].card[s]);
StringBuf_AppendStr(&buf, ")");
}

0 comments on commit 82467e1

Please sign in to comment.