Module: Lich::Common::MapBase

Included in:
Map
Defined in:
documented/common/map/map_base.rb

Overview

Base module containing shared map functionality Include this in game-specific Map classes

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Configures the including class with MapBase methods and tag caching.

Extends the class with ClassMethods, includes InstanceMethods, and marks it as the owner of the shared tag index so subclasses resolve to a single cache.

Parameters:

  • base (Class)

    the class including this module



177
178
179
180
181
182
183
184
185
186
# File 'documented/common/map/map_base.rb', line 177

def self.included(base)
  base.extend(ClassMethods)
  base.include(InstanceMethods)
  # The tag cache lives on class-instance variables, which subclasses do
  # not share. Room subclasses Map and inherits these class methods, so
  # without a single owner a query through Room would memoize a second
  # cache that Map's invalidations never reach. Mark the includer as owner
  # and resolve to it from any subclass, see #tag_cache_host.
  base.instance_variable_set(:@tag_cache_owner, true)
end