summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-29 17:54:32 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-29 17:54:32 +0000
commit20990141f99acddc43e09c4090eff120a435719b (patch)
treec5a5106617f3fdb246445d893390b7f5a42005eb /src/map/map.c
parent856c6ccb9d5d893783e27d7b0d58387276e9f4e8 (diff)
downloadhercules-20990141f99acddc43e09c4090eff120a435719b.tar.gz
hercules-20990141f99acddc43e09c4090eff120a435719b.tar.bz2
hercules-20990141f99acddc43e09c4090eff120a435719b.tar.xz
hercules-20990141f99acddc43e09c4090eff120a435719b.zip
A minor memory improvement, and some curly brace love.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16008 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/map/map.c b/src/map/map.c
index deb8548b0..938f46582 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1302,19 +1302,17 @@ int map_get_new_object_id(void)
// find a free id
i = last_object_id + 1;
- while( i != last_object_id )
- {
+ while( i != last_object_id ) {
if( i == MAX_FLOORITEM )
i = MIN_FLOORITEM;
- if( idb_get(id_db, i) == NULL )
+ if( !idb_exists(id_db, i) )
break;
++i;
}
- if( i == last_object_id )
- {
+ if( i == last_object_id ) {
ShowError("map_addobject: no free object id!\n");
return 0;
}
@@ -1892,14 +1890,19 @@ struct map_session_data * map_nick2sd(const char *nick)
}
/*==========================================
- * id番?の物を探す
- * 一三bjectの場合は配列を引くのみ
+ * Looksup id_db DBMap and returns BL pointer of 'id' or NULL if not found
*------------------------------------------*/
-struct block_list * map_id2bl(int id)
-{
+struct block_list * map_id2bl(int id) {
return (struct block_list*)idb_get(id_db,id);
}
+/**
+ * Same as map_id2bl except it only checks for its existence
+ **/
+bool map_blid_exists( int id ) {
+ return (idb_exists(id_db,id));
+}
+
/*==========================================
* Convext Mirror
*------------------------------------------*/