Cleaned up map storage type (#3384)

* Fixes #3369, fixes #3370, and fixes #3382.
* Converted maps storage container back to static array.
* Converted mapflag storage containers to unordered_map.
* Removed a lot of redundancy and recursive lookups.
* Fixed a couple short-circuit checks to help with performance.
* Fixed multiple instance creation/destruction issues.
* Fixed PK Mode attempting to set PvP on flags that are already active.
* Getting MF_RESTRICTED will return the map's zone value instead of the state.
* Converted mapflag macros to inline functions.
Thanks to @teededung, @lelouch22, @mazvi, @Lemongrass3110, and @cydh!
This commit is contained in:
Aleos
2018-08-10 13:52:07 -04:00
committed by GitHub
parent 11b255e0e9
commit 48ae1a1e05
20 changed files with 548 additions and 300 deletions

View File

@@ -28,6 +28,8 @@
struct instance_data instance_data[MAX_INSTANCE_DATA];
struct eri *instance_maps_ers = NULL; ///< Array of maps per instance
int16 instance_start = 0;
static DBMap *InstanceDB; /// Instance DB: struct instance_db, key: id
static DBMap *InstanceNameDB; /// instance id, key: name
@@ -1137,6 +1139,7 @@ void do_init_instance(void) {
InstanceDB = uidb_alloc(DB_OPT_BASE);
InstanceNameDB = strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA),0);
instance_start = map_num;
instance_readdb();
memset(instance_data, 0, sizeof(instance_data));
memset(&instance_wait, 0, sizeof(instance_wait));