Raised This Month: $32 Target: $400
 8% 

Module: HashMap


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-hi-
Member
Join Date: Jul 2006
Old 09-06-2006 , 04:23   Module: HashMap
Reply With Quote #1

Code:
/* This is a simple hashmap. It can only store integers (cells). */ #if defined hashmap_included     #endinput #endif #define hashmap_included #if AMXX_VERSION_NUM >= 175  #pragma reqlib hashmap  #if !defined AMXMODX_NOAUTOLOAD   #pragma loadlib hashmap  #endif #else  #pragma library hashmap #endif #define REMOVED = ((1 << 31) + 1) #define EMPTY_SLOT (~(1 << 31)) // clears the hashmap maintaining the same capacity native hashmap_clear(); // returns non-zero value if the map contains this key native hashmap_contains_key(key); // places a key/value mapping in the map; returns 1 on success // returns 0 if you use a bad key, i.e. REMOVED or EMPTY_SLOT native hashmap_put(key, value); // returns the value mapped by the given key // returns EMPTY_SLOT if the key is not in the map native hashmap_get(key); // removes the mapping with the given key // if the key isn't in the map, it has no effect native hashmap_remove(key); // returns the number of key/value mappings in the map native hashmap_size(); // returns the available slots in the map (it grows if necessary) native hashmap_capacity();

Thanks BAIL for the tip about auto module loading
Attached Files
File Type: zip hashmap_amxx.zip (91.5 KB, 212 views)

Last edited by -hi-; 09-15-2006 at 17:51.
-hi- is offline
Old 09-06-2006, 23:19
Twilight Suzuka
This message has been deleted by BAILOPAN. Reason: what the hell...
Old 09-06-2006, 23:55
-hi-
This message has been deleted by -hi-.
BAILOPAN
Join Date: Jan 2004
Old 09-15-2006 , 16:22   Re: Module: HashMap
Reply With Quote #2

You may want to look at the other module include files, they have special tokens at the top which lets them autoload.
__________________
egg
BAILOPAN is offline
OneEyed
AMX Mod X Beta Tester
Join Date: Jun 2005
Old 09-15-2006 , 19:30   Re: Module: HashMap
Reply With Quote #3

You might want to describe a little bit about how this works if you want people to utilize it.

Also, you should consider making it work with strings and floats, AMXX has easy functions you can use for modules to convert the pawn floats/strings to c++.

Anyways great job! We don't get very many modules compared to plugins.
__________________
OneEyed is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode