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:
@@ -2087,15 +2087,13 @@ int char_loadName(uint32 char_id, char* name){
|
||||
// Searches for the mapserver that has a given map (and optionally ip/port, if not -1).
|
||||
// If found, returns the server's index in the 'server' array (otherwise returns -1).
|
||||
int char_search_mapserver(unsigned short map, uint32 ip, uint16 port){
|
||||
int i, j;
|
||||
|
||||
for(i = 0; i < ARRAYLENGTH(map_server); i++)
|
||||
for(int i = 0; i < ARRAYLENGTH(map_server); i++)
|
||||
{
|
||||
if (map_server[i].fd > 0
|
||||
&& (ip == (uint32)-1 || map_server[i].ip == ip)
|
||||
&& (port == (uint16)-1 || map_server[i].port == port))
|
||||
{
|
||||
for (j = 0; map_server[i].map[j]; j++)
|
||||
for (int j = 0; map_server[i].map[j]; j++)
|
||||
if (map_server[i].map[j] == map)
|
||||
return i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user