summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_auction.c16
-rw-r--r--src/char/int_guild.c5
2 files changed, 8 insertions, 13 deletions
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index 04e321062..4fc9215a0 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -27,16 +27,14 @@ static int auction_count(int char_id, bool buy)
{
int i = 0;
struct auction_data *auction;
- DBIterator* iter;
- DBKey key;
+ DBIterator *iter = db_iterator(auction_db_);
- iter = auction_db_->iterator(auction_db_);
- for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
+ for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
{
if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) )
i++;
}
- iter->destroy(iter);
+ dbi_destroy(iter);
return i;
}
@@ -258,15 +256,13 @@ static void mapif_parse_Auction_requestlist(int fd)
int price = RFIFOL(fd,10);
short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
unsigned char buf[5 * sizeof(struct auction_data)];
- DBIterator* iter;
- DBKey key;
+ DBIterator *iter = db_iterator(auction_db_);
struct auction_data *auction;
short i = 0, j = 0, pages = 1;
memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);
- iter = auction_db_->iterator(auction_db_);
- for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
+ for( auction = dbi_first(iter); dbi_exists(iter); auction = dbi_next(iter) )
{
if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) ||
(type == 1 && auction->type != IT_WEAPON) ||
@@ -291,7 +287,7 @@ static void mapif_parse_Auction_requestlist(int fd)
memcpy(WBUFP(buf, j * len), auction, len);
j++; // Found Results
}
- iter->destroy(iter);
+ dbi_destroy(iter);
mapif_Auction_sendlist(fd, char_id, j, pages, buf);
}
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index d0f41b541..d2e74ee1d 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -49,14 +49,13 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
{
static int last_id = 0; //To know in which guild we were.
int state = 0; //0: Have not reached last guild. 1: Reached last guild, ready for save. 2: Some guild saved, don't do further saving.
- DBIterator* iter;
+ DBIterator *iter = db_iterator(guild_db_);
DBKey key;
struct guild* g;
if( last_id == 0 ) //Save the first guild in the list.
state = 1;
- iter = guild_db_->iterator(guild_db_);
for( g = (struct guild*)iter->first(iter,&key); iter->exists(iter); g = (struct guild*)iter->next(iter,&key) )
{
if( state == 0 && g->guild_id == last_id )
@@ -79,7 +78,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
db_remove(guild_db_, key);
}
}
- iter->destroy(iter);
+ dbi_destroy(iter);
if( state != 2 ) //Reached the end of the guild db without saving.
last_id = 0; //Reset guild saved, return to beginning.