Games-Axmud

 view release on metacpan or  search on metacpan

lib/Games/Axmud/Obj/WorldModel.pm  view on Meta::CPAN

            #   through them). Details about the painter are stored here, but each Automapper window
            #   has its own ->painterFlag which can be set to TRUE or FALSE
            # The non-model GA::ModelObj::Room object which is the painter object
            painterObj                  => undef,           # Set below
            # A list of IVs in the painter object that are actually used to paint rooms (the others
            #   are ignored).
            # Scalar and list IVs in the current room are replaced by their equivalents in the
            #   painter - but hash IVs are merged. (If the same key exists in both objects, the
            #   painter's key-value pair is used)
            constPainterIVList          => [
                'wildMode',
                'titleList',
                'descripHash',
                'exclusiveFlag',
                'exclusiveHash',
                'roomFlagHash',
                'roomGuild',
                'searchHash',
            ],
            # Flag set to TRUE, when only new rooms should be painted. Otherwise, set to FALSE, so
            #   that in 'update' mode, every time the current room changes, it is painted
            paintAllRoomsFlag           => FALSE,
            # Flag relating to the automapper window's quick painting toolbar. Set to FALSE if
            #   quick painting should apply to one room (before resetting itself), TRUE if it should
            #   apply to multiple rooms (the user must manually reset it)
            quickPaintMultiFlag         => FALSE,

            # Limits to world model searches (used by GA::PrefWin::Search). If either value is 0,
            #   then searches use $self->modelObjCount as a limit
            # Maximum number of matches during a search
            searchMaxMatches            => 1000,
            # Maximum number of objects searched
            searchMaxObjects            => 10000,
            # A flag which, when set to TRUE, causes any matching rooms to be selected in the map
            #   window (set to FALSE otherwise)
            searchSelectRoomsFlag       => TRUE,
            # Limits to locate room operations. If the value is 0, then the whole model is searched
            #   when trying to locate a room
            locateMaxObjects            => 5000,
            # What to do, when the character uses an exit whose ->randomType is 'same_region'
            #   (locate room in the current region). Set to TRUE if Axmud should try to locate the
            #   new location (but only if there are less than ->locateMaxObjects to search), or
            #   FALSE if the character should just be marked as 'lost'
            locateRandomInRegionFlag    => FALSE,
            # What to do, when the character uses an exit whose ->randomType is 'any_region' (locate
            #   room anywhere in the map). Set to TRUE if Axmud should try to locate the new
            #   location (but only if there are less than ->locateMaxObjects to search), or FALSE if
            #   the character should just be marked as 'lost'
            locateRandomAnywhereFlag    => FALSE,

            # When the user double-clicks on a room to go there (using the shortest path), give them
            #   an opportunity to change their minds for very long paths. IV set to the number of
            #   steps (separate world commands) used to move from the current room to the specified
            #   one; if the actual number of steps exceeds this value,
            #   GA::Win::Map->processPathCallback shows a yes-no 'dialogue' window, first. If the
            #   IV is set to 0, there is no limit
            pathFindStepLimit           => 200,

            # When GA::Win::Map->doDraw is called, the drawing process can take a long time, if
            #   there are thousands of objects to draw. The value of this IV is the number of
            #   objects (not including exits) above which ->doDraw will create a popup window, so
            #   that the user knows why Axmud has frozen (minimum value 100)
            drawPauseNum                => 500,
            # When GA::Win::Map->recalculatePathsCallback is called, the recalculation process
            #   can tak a long time, if there are hundreds of region paths to recalculate. The
            #   value of this IV is the number of paths above which ->recalculatePathsCallback
            #   will create a popup window, so that the user knows why Axmud has frozen (minimum
            #   value 10)
            recalculatePauseNum         => 50,

            # The font and font size to use for text drawn in the Automapper window (expressed as a
            #   ratio, with 1 being the font size used for room tags at the map's current
            #   magnification)
            mapFont                     => 'Sans',
            roomTagRatio                => 1,
            roomGuildRatio              => 0.7,
            exitTagRatio                => 0.7,
            labelRatio                  => 0.8,
            roomTextRatio               => 0.7,

            # $self->deleteRegions, ->deleteRooms, ->deleteExits and ->deleteLabels all make a call
            #   to GA::Win::Map->setSelectedObj to make sure there are no selected objects in the
            #   automapper window(s)
            # A single call to ->deleteRegions could cause thousands of calls to ->deleteExits,
            #   each of them calling GA::Win::Map->setSelectedObj in turn
            # In that case, we only need a single call to GA::Win::Map->setSelectedObj. This flag is
            #   set to TRUE when ->deleteRegions is called, and reset back to FALSE when that
            #   function is finished. When the flag is TRUE, no time-wasting calls to
            #   GA::Win::Map->setSelectedObj are made
            blockUnselectFlag           => FALSE,
        };

        # Bless the object into existence
        bless $self, $class;

        # Set the light status list
        $self->{lightStatusList}        = $self->{constLightStatusList};

        # Set map size (based on the values immediately above)
        $self->{defaultMapWidthPixels}
            = $self->{defaultGridWidthBlocks} * $self->{defaultBlockWidthPixels};
        $self->{defaultMapHeightPixels}
            = $self->{defaultGridHeightBlocks} * $self->{defaultBlockHeightPixels};

        # Create a default region scheme object
        $self->ivPoke(
            'defaultSchemeObj',
            Games::Axmud::Obj::RegionScheme->new($session, $self, 'default'),
        );
        $self->ivAdd('regionSchemeHash', 'default', $self->defaultSchemeObj);

        # Create some map label styles
        $self->addLabelStyle($session, 'Style 1', $self->{defaultMapLabelColour});
        $self->addLabelStyle($session, 'Style 2', '#FF40E0');
        $self->addLabelStyle($session, 'Style 3', '#000000', undef, 2);
        $self->addLabelStyle($session, 'Style 4', '#000000', undef, 4);
        $self->{mapLabelStyle}          = 'Style 1';

        # Set room filters and room flags
        $self->setupRoomFlags($session);

        # Create a painter object - a non-model GA::ModelObj::Room used to 'paint' other rooms
        #   by copying its IVs into theirs
        $self->resetPainter($session);

        return $self;
    }



( run in 1.488 second using v1.01-cache-2.11-cpan-364913b4093 )