/// <summary>
        /// Add a location to the reference map. Auto increments file offset, so be sure to add small maps in correct order
        /// </summary>
        /// <param name="location">the location of reference</param>
        /// <param name="hasBasement">Does it have a basement? if so, start at position -1 </param>
        /// <param name="nFloors">How many floors?</param>
        private void AddLocation(SingleMapReference.Location location, bool hasBasement, short nFloors)
        {
            // get the master map file from the location info
            SingleMapReference.SmallMapMasterFiles masterMap = SingleMapReference.GetMapMasterFromLocation(location);
            // we are going to track the order that the maps were added
            // if the master map hasn't been seen yet, then we need to create a new index array of locations
            if (!masterFileLocationDictionary.ContainsKey(masterMap))
            {
                masterFileLocationDictionary.Add(masterMap, new List <SingleMapReference.Location>());
            }
            masterFileLocationDictionary[masterMap].Add(location);

            // get the filename of the location - we use it as key into a map
            string dataFilename = SingleMapReference.GetFilenameFromLocation(location);

            // create an offset counter if it doesn't already exist
            if (!roomOffsetCountDictionary.ContainsKey(dataFilename))
            {
                roomOffsetCountDictionary[dataFilename] = 0;
            }

            // get the current file offset value (auto-counting...)
            short roomOffset = roomOffsetCountDictionary[dataFilename];

            // add one or more map references
            mapReferences.AddRange(GenerateSingleMapReferences(location, hasBasement?-1:0, nFloors, roomOffset, locationNames[(int)location]));

            // add the number of floors you have just added so that it can increment the file offset for subequent calls
            roomOffsetCountDictionary[dataFilename] += nFloors;

            smallMapBasementDictionary.Add(location, hasBasement);
            nFloorsDictionary.Add(location, nFloors);
        }
 /// <summary>
 /// Get a map reference based on a location
 /// </summary>
 /// <param name="location">The location you are looking for</param>
 /// <returns>a single map reference providing details on the map itself</returns>
 public SingleMapReference GetSingleMapByLocation(SingleMapReference.Location location, int floor)
 {
     SingleMapReference.SmallMapMasterFiles masterMap = SingleMapReference.GetMapMasterFromLocation(location);
     foreach (SingleMapReference mapRef in mapReferences)
     {
         if (mapRef.MapLocation == location && mapRef.Floor == floor)
         {
             return(mapRef);
         }
     }
     throw new Exception("Location was not found!");
 }
        /// <summary>
        /// Cheater function to automatically create floors in a building
        /// </summary>
        /// <param name="location"></param>
        /// <param name="startFloor"></param>
        /// <param name="nFloors"></param>
        /// <returns></returns>
        private List <SingleMapReference> GenerateSingleMapReferences(SingleMapReference.Location location, int startFloor, short nFloors, short roomOffset, string name)
        {
            List <SingleMapReference> mapRefs = new List <SingleMapReference>();

            int fileOffset = roomOffset * SmallMap.XTILES * SmallMap.YTILES; // the number of rooms offset, converted to number of bytes to skip

            for (int i = 0; i < nFloors; i++)
            {
                mapRefs.Add(new SingleMapReference(location, startFloor + i, fileOffset + (i * SmallMap.XTILES * SmallMap.YTILES), dataRef));
            }

            return(mapRefs);
        }
 /// <summary>
 /// Get the location based on the index within the small map file
 /// </summary>
 /// <param name="smallMap">the small map file reference</param>
 /// <param name="index">the 0-7 index within the small map file</param>
 /// <returns>the location reference</returns>
 public SingleMapReference.Location GetLocationByIndex(SingleMapReference.SmallMapMasterFiles smallMap, int index)
 {
     SingleMapReference.Location location = masterFileLocationDictionary[smallMap][index];
     return(location);
 }
 public bool HasBasement(SingleMapReference.Location location)
 {
     return(smallMapBasementDictionary[location]);
 }
 public int GetNumberOfFloors(SingleMapReference.Location location)
 {
     return(nFloorsDictionary[location]);
 }