Beispiel #1
0
 public void AddExitStub(Room room, AutomapDirection direction)
 {
     try { m_control.Invoke((MethodInvoker) delegate { m_canvas.AddExitStub(room, direction); }); }
     catch (Exception)
     {
     }
 }
Beispiel #2
0
 public void AddExitStub(Room room, MappableDirection direction)
 {
     try { mControl.Invoke((MethodInvoker) delegate { mCanvas.AddExitStub(room, direction); }); }
     catch (Exception) {
         // ignored
     }
 }
Beispiel #3
0
        private void DeduceExitsFromDescription(Room room, string description)
        {
            if (!m_settings.GuessExits)
            {
                // we're disabled; do nothing
                return;
            }

            if (string.IsNullOrEmpty(description))
            {
                // we don't have a description to work from
                return;
            }

            // lowercase the description
            description = description.ToLowerInvariant();

            // search it for the names of compass directions
            foreach (var pair in s_namesForExitsInRoomDescriptions)
            {
                var directions   = pair.Key;
                var namesOfExits = pair.Value;
                foreach (var directionName in namesOfExits)
                {
                    var index = description.IndexOf(directionName);
                    if (index != -1)
                    {
                        // we found one
                        if (index == 0 || !char.IsLetterOrDigit(description[index - 1]))
                        {
                            // it's not the middle/end of a longer word
                            if (index + directionName.Length == description.Length || !char.IsLetterOrDigit(description[index + directionName.Length]))
                            {
                                // it's not the middle/start of a longer word

                                // add all relevant exits
                                foreach (var direction in directions)
                                {
                                    m_canvas.AddExitStub(room, direction);
                                }
                            }
                        }
                    }
                }
            }
        }