summaryrefslogtreecommitdiff
path: root/src/char/int_auction.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-09 21:09:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-15 11:47:30 +0300
commitc60c9292886f436eb12d4042a05af1e462705e3d (patch)
treed6a5cd0f78d9c845e966e18ecfb386e0b31515b2 /src/char/int_auction.c
parent63075b84ecf52e329ee524e1e90878469c388f9d (diff)
downloadhercules-c60c9292886f436eb12d4042a05af1e462705e3d.tar.gz
hercules-c60c9292886f436eb12d4042a05af1e462705e3d.tar.bz2
hercules-c60c9292886f436eb12d4042a05af1e462705e3d.tar.xz
hercules-c60c9292886f436eb12d4042a05af1e462705e3d.zip
Move global variable into interface in inter.c
Diffstat (limited to 'src/char/int_auction.c')
-rw-r--r--src/char/int_auction.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index d85c10522..684faa46b 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -57,7 +57,7 @@ void inter_auction_save(struct auction_data *auction)
StrBuf->Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
StrBuf->Printf(&buf, " WHERE `auction_id` = '%d'", auction->auction_id);
- stmt = SQL->StmtMalloc(sql_handle);
+ stmt = SQL->StmtMalloc(inter->sql_handle);
if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
@@ -92,7 +92,7 @@ unsigned int inter_auction_create(struct auction_data *auction)
StrBuf->Printf(&buf, ",'%d'", auction->item.card[j]);
StrBuf->AppendStr(&buf, ")");
- stmt = SQL->StmtMalloc(sql_handle);
+ stmt = SQL->StmtMalloc(inter->sql_handle);
if( SQL_SUCCESS != SQL->StmtPrepareStr(stmt, StrBuf->Value(&buf))
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, auction->seller_name, strnlen(auction->seller_name, NAME_LENGTH))
|| SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, auction->buyer_name, strnlen(auction->buyer_name, NAME_LENGTH))
@@ -162,8 +162,8 @@ void inter_auction_delete(struct auction_data *auction)
{
unsigned int auction_id = auction->auction_id;
- if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) )
- Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `auction_id` = '%d'", auction_db, auction_id) )
+ Sql_ShowDebug(inter->sql_handle);
if( auction->auction_end_timer != INVALID_TIMER )
timer->delete(auction->auction_end_timer, inter_auction->end_timer);
@@ -188,32 +188,32 @@ void inter_auctions_fromsql(void)
StrBuf->Printf(&buf, ",`card%d`", i);
StrBuf->Printf(&buf, " FROM `%s` ORDER BY `auction_id` DESC", auction_db);
- if( SQL_ERROR == SQL->Query(sql_handle, StrBuf->Value(&buf)) )
- Sql_ShowDebug(sql_handle);
+ if( SQL_ERROR == SQL->Query(inter->sql_handle, StrBuf->Value(&buf)) )
+ Sql_ShowDebug(inter->sql_handle);
StrBuf->Destroy(&buf);
- while( SQL_SUCCESS == SQL->NextRow(sql_handle) )
+ while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) )
{
CREATE(auction, struct auction_data, 1);
- SQL->GetData(sql_handle, 0, &data, NULL); auction->auction_id = atoi(data);
- SQL->GetData(sql_handle, 1, &data, NULL); auction->seller_id = atoi(data);
- SQL->GetData(sql_handle, 2, &data, NULL); safestrncpy(auction->seller_name, data, NAME_LENGTH);
- SQL->GetData(sql_handle, 3, &data, NULL); auction->buyer_id = atoi(data);
- SQL->GetData(sql_handle, 4, &data, NULL); safestrncpy(auction->buyer_name, data, NAME_LENGTH);
- SQL->GetData(sql_handle, 5, &data, NULL); auction->price = atoi(data);
- SQL->GetData(sql_handle, 6, &data, NULL); auction->buynow = atoi(data);
- SQL->GetData(sql_handle, 7, &data, NULL); auction->hours = atoi(data);
- SQL->GetData(sql_handle, 8, &data, NULL); auction->timestamp = atoi(data);
+ SQL->GetData(inter->sql_handle, 0, &data, NULL); auction->auction_id = atoi(data);
+ SQL->GetData(inter->sql_handle, 1, &data, NULL); auction->seller_id = atoi(data);
+ SQL->GetData(inter->sql_handle, 2, &data, NULL); safestrncpy(auction->seller_name, data, NAME_LENGTH);
+ SQL->GetData(inter->sql_handle, 3, &data, NULL); auction->buyer_id = atoi(data);
+ SQL->GetData(inter->sql_handle, 4, &data, NULL); safestrncpy(auction->buyer_name, data, NAME_LENGTH);
+ SQL->GetData(inter->sql_handle, 5, &data, NULL); auction->price = atoi(data);
+ SQL->GetData(inter->sql_handle, 6, &data, NULL); auction->buynow = atoi(data);
+ SQL->GetData(inter->sql_handle, 7, &data, NULL); auction->hours = atoi(data);
+ SQL->GetData(inter->sql_handle, 8, &data, NULL); auction->timestamp = atoi(data);
item = &auction->item;
- SQL->GetData(sql_handle, 9, &data, NULL); item->nameid = atoi(data);
- SQL->GetData(sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH);
- SQL->GetData(sql_handle,11, &data, NULL); auction->type = atoi(data);
+ SQL->GetData(inter->sql_handle, 9, &data, NULL); item->nameid = atoi(data);
+ SQL->GetData(inter->sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH);
+ SQL->GetData(inter->sql_handle,11, &data, NULL); auction->type = atoi(data);
- SQL->GetData(sql_handle,12, &data, NULL); item->refine = atoi(data);
- SQL->GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data);
- SQL->GetData(sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10);
+ SQL->GetData(inter->sql_handle,12, &data, NULL); item->refine = atoi(data);
+ SQL->GetData(inter->sql_handle,13, &data, NULL); item->attribute = atoi(data);
+ SQL->GetData(inter->sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10);
item->identify = 1;
item->amount = 1;
@@ -221,7 +221,7 @@ void inter_auctions_fromsql(void)
for( i = 0; i < MAX_SLOTS; i++ )
{
- SQL->GetData(sql_handle, 15 + i, &data, NULL);
+ SQL->GetData(inter->sql_handle, 15 + i, &data, NULL);
item->card[i] = atoi(data);
}
@@ -234,7 +234,7 @@ void inter_auctions_fromsql(void)
idb_put(inter_auction->db, auction->auction_id, auction);
}
- SQL->FreeResult(sql_handle);
+ SQL->FreeResult(inter->sql_handle);
}
void mapif_auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf)