Games-Axmud

 view release on metacpan or  search on metacpan

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

            #   model objects are created, the first description added is marked as belonging to the
            #   light status defined by this IV
            lightStatus                 => 'day',
            # List of standard light statuses (never altered)
            constLightStatusList        => [
                'day', 'night', 'dark',
            ],
            # Customised list of light statuses (can be modified)
            lightStatusList             => [],          # Set below

            # Room tags
            # Rooms can be given a short name, usually displayed next to the room on the map. These
            #   are called room tags. The maximum size is 16 characters
            # Room tags are unique - a room tag called 'tower' can either belong to no room at all,
            #   or a single room. However, room tags are case-insensitive - you can refer to a
            #   room's tag as 'tower', 'TOWER' or 'tOwEr', if you like. (Room tags are stored in
            #   lower-case letters, i.e. 'tower')
            # Each room object also has its own ->roomTag IV, set to 'undef' if the room doesn't
            #   have a room tag
            # This hash stores all room tags currently in use, in the form
            #   $roomTagHash{room_tag} = model_number_of_room
            # NB GA::Obj::Route objects also use room tags. It's up to the user to ensure that world
            #   model room tags are equivalent to the tags used in their route objects; by the same
            #   token, adding or deleting a route does not change the contents of $self->roomTagHash
            #   (in fact, the world model isn't informed at all)
            roomTagHash                 => {},

            # Teleport hash
            # Using this hash, the client command ';teleport <destination>' is converted into a
            #   world command in order to teleport to a certain destination (assuming that the
            #   teleport ability might be available at many departure locations)
            # In this hash, the keys are <destination>, and the corresponding values are the
            #   command to get there
            #   e.g. $teleportHash{tower} = 'goto /domains/town/room/start'
            #   e.g. $teleportHash{2} = 'goto /domains/town/room/start'
            #
            # If the destination ('tower' in the example above) exists as a room tag in the world
            #   model, or if it is the number of a world model room ('2' in the example above), the
            #   automapper/Locator task assume that this is the target destination. Otherwise, the
            #   target destination is unknown, and the automapper will get lost
            # If the user types ';teleport tower', and the key 'tower' is not found in this hash,
            #   the highest-priority command cage's standard command 'teleport' is used instead.
            #   Assuming that the standard command is in the form 'teleport room', the word 'room'
            #   is replaced with the destination specified by the user. If it's a recognised room
            #   tag, the automapper/Locator task assume that this room is the target destination
            #   (world model room numbers can't be used in this case). Otherwise, the target
            #   destination is unknown, and the automapper will get lost
            teleportHash                => {},

            # IVs used to draw maps
            # ---------------------

            # Should the Automapper window open automatically when Axmud starts? (TRUE for yes,
            #   FALSE for no)
            autoOpenWinFlag             => FALSE,
            # Should the Automapper window open inside the session's 'main' window, if possible, and
            #   open as a normal 'grid' window, if not possible? (TRUE for yes, FALSE for no)
            pseudoWinFlag               => TRUE,
            # When the Automapper window opens, which parts of it should be visible? (TRUE for
            #   visible, FALSE for not visible)
            showMenuBarFlag             => TRUE,
            showToolbarFlag             => TRUE,
            showTreeViewFlag            => TRUE,
            showCanvasFlag              => TRUE,
            # The automapper window can show one or more toolbars, each with a set of buttons
            # A list specifying how many toolbars should be shown, besides the (compulsory) first
            #   one. The list comprises the names of the button sets to use in each additional
            #   toolbar. (This list is updated whenever the user adds/removes button sets, so it's
            #   remembered between sessions)
            # The list can contain 0, 1 or more of the button set names specified by
            #   GA::Win::Map->constButtonSetList, except for 'default'
            # When the list is empty, only one toolbar is shown. If the list contains one item, two
            #   are shown (and so on)
            buttonSetList               => [],
            # The automapper window's 'painting' toolbar can show buttons, each corresponding to a
            #   room flag, that are applied to the window's painter when turned on
            # A list of room flags that should be shown (can be an empty list, but should not
            #   contain duplicates)
            preferRoomFlagList          => [],
            # The automapper window's 'background' toolbar can show buttons, each corresponding to
            #   an RGB colour, that is used to colour in the map's background
            # A list of RGB colours that should be shown, in addition to a button for the default
            #   colour, which is always shown (can be an empty list, but should not contain
            #   duplicates)
            preferBGColourList          => [],

            # Default and maximum sizes/colours.

            # Default sizes. Each gridblock contain max 1 room. All these sizes should be odd
            #   numbers
            defaultGridWidthBlocks      => 201,         # Room's x co-ordinates
            defaultGridHeightBlocks     => 201,         # Room's y co-ordinates
            defaultBlockWidthPixels     => 51,          # At magnification 1
            defaultBlockHeightPixels    => 51,
            defaultRoomWidthPixels      => 31,          # Room in centre of block
            defaultRoomHeightPixels     => 31,

            # Maximum sizes. We use a maximum size to stop the user creating a map bigger than the
            #   known universe in the world model's 'pref' window; we use the default size IVs above
            #   to enable smaller maps by default for testing purposes
            # $self->defaultGridWidthBlocks (etc) is not checked against these maximum sizes. It's
            #   up to you, as the person editing these literal values, to make the maximum sizes the
            #   same as, or bigger, than the default sizes
            maxGridWidthBlocks          => 1001,
            maxGridHeightBlocks         => 1001,
            maxBlockWidthPixels         => 101,
            maxBlockHeightPixels        => 101,
            maxRoomWidthPixels          => 51,
            maxRoomHeightPixels         => 51,

            # Default map sizes
            defaultMapWidthPixels       => undef,       # Set below
            defaultMapHeightPixels      => undef,

            # Hash of region scheme objects, specifying a set of colours to use in the automapper.
            #   The object named 'default' always exists and cannot be deleted. Other objects can
            #   have any name (i.e. they don't need to match a region name)
            # Hash in the form
            #   $regionSchemeHash{style_name} = blessed_reference_to_scheme_object
            regionSchemeHash            => {},
            # Shortcut to the default region scheme object

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

        }

        # Update each Automapper window in turn
        foreach my $mapWin ($self->collectMapWins()) {

            if (! $regionmapObj) {

                # Redraw all drawn regions
                $mapWin->redrawRegions();

            } elsif ($mapWin->ivExists('parchmentHash', $regionmapObj->name)) {

                # Redraw the specified region (if it's drawn in this automapper window). The TRUE
                #   argument means 'don't redraw other regions'
                $mapWin->redrawRegions($regionmapObj, TRUE);
            }
        }

        return 1;
    }

    sub updateMaps {

        # Can be called by anything in the automapper object (GA::Obj::Map) and the Automapper
        #   window (GA::Win::Map) to update every Automapper window using this world model
        # Usually called after other calls to this world model object, in which the $updateFlag
        #   argument was set to FALSE - the calling function is now ready for the Automapper windows
        #   to be updated
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Optional arguments
        #   @list       - A list to send to each Automapper window's ->markObjs, in the form
        #                   (type, object, type, object...)
        #               - If it's an empty list, nothing is marked to be drawn; GA::Win::Map->doDraw
        #                   is still called in each automapper window, in the expectation that
        #                   something has already been marked to be drawn
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, @list) = @_;

        # (No improper arguments to check)

        foreach my $mapWin ($self->collectMapWins()) {

            if (@list) {

                $mapWin->markObjs(@list);
            }

            $mapWin->doDraw();
        }

        return 1;
    }

    sub updateMapMenuToolbars {

        # Can be called by anything in the automapper object (GA::Obj::Map) and the Automapper
        #   window (GA::Win::Map) to update every Automapper window using this world model
        # Also called by the painter's edit window, when ->saveChanges is applied
        # Redraws the menu bars and/or toolbars in all automapper windows using this world model
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->updateMapMenuToolbars', @_);
        }

        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->redrawWidgets('menu_bar', 'toolbar');
        }

        return 1;
    }

    sub updateMapExit {

        # Called by several of this object's functions to update a single exit (and its twin) in
        #   every Automapper window using this world model
        #
        # Expected arguments
        #   $exitObj        - The exit object to update
        #
        # Optional arguments
        #   $twinExitObj    - The exit's twin object, if known (if 'undef', this function looks up
        #                       for twin exit object)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $exitObj, $twinExitObj, $check) = @_;

        # Local variables
        my @list;

        # Check for improper arguments
        if (! defined $exitObj || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->updateMapExit', @_);
        }

        # If the exit has a twin, that must be redrawn, too
        @list = ('exit', $exitObj);

        if (! $twinExitObj && $exitObj->twinExit) {

            $twinExitObj = $self->ivShow('exitModelHash', $exitObj->twinExit);
        }

        if ($twinExitObj) {

            push (@list, 'exit', $twinExitObj);
        }

        foreach my $mapWin ($self->collectMapWins()) {

            # Redraw the objects
            $mapWin->markObjs(@list);
            $mapWin->doDraw();
        }

        return 1;
    }

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

        #   'markers' room tag
        # (In the default list, all 'markers' room flags come first, followed by all 'custom' room
        #   flags)
        foreach my $roomFlagObj ($self->ivValues('roomFlagHash')) {

            if (
                $roomFlagObj->filter eq 'markers'
                && (! defined $lastMarker || $lastMarker < $roomFlagObj->priority)
            ) {
                $lastMarker = $roomFlagObj->priority;

            } elsif (
                $roomFlagObj->filter eq 'custom'
                && (! defined $lastCustom || $lastCustom < $roomFlagObj->priority)
            ) {
                $lastCustom = $roomFlagObj->priority;
            }
        }

        if (defined $lastCustom) {
            $priority = $lastCustom + 1;
        } elsif (defined $lastMarker) {
            $priority = $lastMarker + 1;
        } else {
            $priority = 1;                  # Failsafe - should never be used
        }

        # Create a new room flag object
        $newObj = Games::Axmud::Obj::RoomFlag->new(
            $session,
            $name,
            TRUE,           # Custom room flag
        );

        if ($newObj) {

            $self->ivAdd('roomFlagHash', $name, $newObj);

            # Set the object's IVs
            $newObj->ivPoke('shortName', $shortName);
            $newObj->ivPoke('descrip', $descrip);
            $newObj->ivPoke('priority', $priority);
            $newObj->ivPoke('filter', 'custom');
            $newObj->ivPoke('colour', $colour);

            # Insert it at the right position in the room flag priority list
            $self->ivSplice('roomFlagOrderedList', ($priority - 1), 0, $name);

            # Update every room flag object's ->priority IV
            $count = 0;
            foreach my $name ($self->roomFlagOrderedList) {

                my $thisObj = $self->ivShow('roomFlagHash', $name);

                $count++;
                $thisObj->ivPoke('priority', $count);
            }

            # Must redraw the menu in any automapper windows, so that the new room flag appears in
            #   them
            $self->updateMapMenuToolbars();
        }

        # Operation complete
        return 1;
    }

    sub deleteRoomFlag {

        # Called by GA::EditWin::WorldModel->roomFlags1Tab
        # Deletes custom room flag and updates the priority list for all room flags
        # (Room flags belonging to other filters can't be deleted)
        #
        # Expected arguments
        #   $name       - The room flag name to delete
        #
        # Return values
        #   'undef' on improper arguments, if the room flag doesn't exist or if it isn't a custom
        #       room flag
        #   1 otherwise

        my ($self, $name, $check) = @_;

        # Local variables
        my ($roomFlagObj, $count);

        # Check for improper arguments
        if (! defined $name) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->deleteRoomFlag', @_);
        }

        # Check the flag exists and is a custom room flag
        $roomFlagObj = $self->ivShow('roomFlagHash', $name);
        if (! $roomFlagObj || $roomFlagObj->filter ne 'custom') {

            return undef;

        } else {

            $self->ivDelete('roomFlagHash', $name);

            # Remove it from the room flag priority list
            $self->ivSplice('roomFlagOrderedList', ($roomFlagObj->priority - 1), 1);

            # Update every room flag object's ->priority IV
            $count = 0;
            foreach my $name ($self->roomFlagOrderedList) {

                my $thisObj = $self->ivShow('roomFlagHash', $name);

                $count++;
                $thisObj->ivPoke('priority', $count);
            }

            # Must redraw the menu in any automapper windows, so that the old room flag no longer
            #   appears in them
            $self->updateMapMenuToolbars();
        }

        # Operation complete
        return 1;
    }

    sub toggleRoomFlags {

        # Called by GA::Win::Map->enableRoomsColumn_filterSubMenu
        # Toggles a room flag in one or more rooms. Redraws the rooms (if permitted) and
        #   recalculates the regionmap's paths (if necessary)
        #
        # Expected arguments
        #   $session    - The calling function's GA::Session
        #   $updateFlag - Flag set to TRUE if all Automapper windows using this world model should
        #                   be updated now, FALSE if not (in which case, they can be updated later
        #                   by the calling function, when it is ready)
        #   $roomFlag   - The room flag to toggle (matches one of the keys in
        #                   $self->roomFlagHash)
        #
        # Optional arguments
        #   @roomList   - A list of room objects to update. If the list is empty, no flags are
        #                   toggled
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $session, $updateFlag, $roomFlag, @roomList) = @_;

        # Local variables
        my (
            $hazardFlag,
            @redrawList,
            %regionHash,
        );

        # Check for improper arguments
        if (! defined $session || ! defined $updateFlag || ! defined $roomFlag) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->toggleRoomFlags', @_);
        }

        # For speed, work out now whether $roomFlag is one of the hazardous room flags, or not
        if ($axmud::CLIENT->ivExists('constRoomHazardHash', $roomFlag)) {

            $hazardFlag = TRUE;
        }

        # Update each room in turn
        foreach my $roomObj (@roomList) {

            my $listRef;

            # (All affected rooms may be redrawn shortly)
            push (@redrawList, 'room', $roomObj);

            if ($roomObj->ivExists('roomFlagHash', $roomFlag)) {

                # Unset the flag by deleting the key
                $roomObj->ivDelete('roomFlagHash', $roomFlag);

            } else {

                # Set the flag by adding the key
                $roomObj->ivAdd('roomFlagHash', $roomFlag);
            }

            if ($updateFlag) {

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

            defined $regionmapObj->regionScheme
            && $self->ivExists('regionSchemeHash', $regionmapObj->regionScheme)
        ) {
            return $self->ivShow('regionSchemeHash', $regionmapObj->regionScheme);

        } else{

            # If the regionmap doesn't name a region scheme, then use the default one
            return $self->defaultSchemeObj;
        }
    }

    # (Called from GA::Win::Map menu, 'View' column)

    sub toggleFlag {

        # Called by anonymous function in GA::Win::Map->enableXXXColumn
        # Toggles a flag IV and updates each Automapper window
        #
        # Expected arguments
        #   $iv         - The flag IV to toggle
        #   $ivFlag     - New value of the IV (TRUE or FALSE)
        #   $drawFlag   - If set to TRUE, this function calls ->drawRegion in every affected
        #                   Automapper window. If FALSE, ->drawRegion is not called
        #
        # Optional arguments
        #   $menuName   - The name of the menu item which must be set to active, or inactive (a key
        #                   in GA::Map::Win->menuToolItemHash
        #   $iconName   - The name of the toolbar icon which must be set to active, or inactive (a
        #                   key in GA::Map::Win->menuToolItemHash. If set to 'undef', there is no
        #                   icon to modify)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $iv, $ivFlag, $drawFlag, $menuName, $iconName, $check) = @_;

        # Check for improper arguments
        if (! defined $iv || ! defined $ivFlag || ! defined $drawFlag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->toggleFlag', @_);
        }

        # Update the IV
        if ($ivFlag) {
            $self->ivPoke($iv, TRUE);
        } else {
            $self->ivPoke($iv, FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            if ($drawFlag) {

                # Redraw all drawn regions
                $mapWin->redrawRegions();
            }

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($menuName) {

                $mapWin->setActiveItem($menuName, $self->$iv);
            }

            # Set the equivalent toolbar button, if there is one
            if ($iconName) {

                $mapWin->setActiveItem($iconName, $self->$iv);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub switchMode {

        # Called by anonymous function in GA::Win::Map->enableXXXColumn
        # Sets the new value of an IV and updates each Automapper window
        #
        # Expected arguments
        #   $iv         - The IV to set
        #   $value      - New value of the IV (can be 'undef')
        #   $drawFlag   - If set to TRUE, this function calls ->drawRegion in every affected
        #                   Automapper window. If FALSE, ->drawRegion is not called
        #
        # Optional arguments
        #   $menuName   - The name of the menu item which must be set to active, or inactive (a key
        #                   in GA::Map::Win->menuToolItemHash
        #   $iconName   - The name of the toolbar icon which must be set to active, or inactive (a
        #                   key in GA::Map::Win->menuToolItemHash. If set to 'undef', there is no
        #                   icon to modify)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $iv, $value, $drawFlag, $menuName, $iconName, $check) = @_;

        # Check for improper arguments
        if (! defined $iv || ! defined $drawFlag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->switchMode', @_);
        }

        # Update the IV
        $self->ivPoke($iv, $value);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            if ($drawFlag && $mapWin->currentRegionmap) {

                # Redraw all drawn regions
                $mapWin->redrawRegions();

            } elsif ($iv eq 'currentRoomMode') {

                # When setting $self->currentRoomMode, redraw the current/last known/ghost rooms
                if ($mapWin->mapObj->currentRoom) {

                    $mapWin->markObjs('room', $mapWin->mapObj->currentRoom);
                }

                if ($mapWin->mapObj->lastKnownRoom) {

                   $mapWin->markObjs('room', $mapWin->mapObj->lastKnownRoom);
                }

                if ($mapWin->mapObj->ghostRoom) {

                    $mapWin->markObjs('room', $mapWin->mapObj->ghostRoom);
                }

                $mapWin->doDraw();
            }

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($menuName) {

                $mapWin->setActiveItem($menuName, TRUE);
            }

            # Set the equivalent toolbar button, if there is one
            if ($iconName) {

                $mapWin->setActiveItem($iconName, TRUE);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
            $mapWin->restrictWidgets();
        }

        return 1;
    }

    sub toggleWinComponents {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Shows (or hides) each Automapper window's major components (the menu, toolbar, treeview
        #   and canvas)
        #
        # Expected arguments
        #   $iv     - The IV matching the component to show (or hide) - one of 'showMenuBarFlag',
        #               'showToolbarFlag', 'showTreeViewFlag', 'showCanvasFlag'
        #   $flag   - The new value of the IV - TRUE or FALSE
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $iv, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $iv || ! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->toggleWinComponents', @_);
        }

        # Update the IV
        if ($flag) {
            $self->ivPoke($iv, TRUE);
        } else {
            $self->ivPoke($iv, FALSE);
        }

        # Show (or hide) the component in every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my $menuItem;

            if ($iv eq 'showMenuBarFlag') {

                $mapWin->redrawWidgets('menu_bar');
                $mapWin->setActiveItem('show_menu_bar', $self->$iv);

            } elsif ($iv eq 'showToolbarFlag') {

                $mapWin->redrawWidgets('toolbar');
                $mapWin->setActiveItem('show_toolbar', $self->$iv);

            } elsif ($iv eq 'showTreeViewFlag') {

                $mapWin->redrawWidgets('treeview');
                $mapWin->setActiveItem('show_treeview', $self->$iv);

            } elsif ($iv eq 'showCanvasFlag') {

                # If there's a current region, we don't need it any more
                if (! $flag && $mapWin->currentRegionmap) {

                    $mapWin->setCurrentRegion();
                }

                $mapWin->redrawWidgets('canvas');
                $mapWin->setActiveItem('show_canvas', $self->$iv);
            }
        }

        return 1;
    }

    sub resetRegionList {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Resets the order of the list of regions displayed in each Automapper window's treeview
        #
        # Expected arguments
        #   (none besides $self)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $check) = @_;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->resetRegionList', @_);
        }

        # If there's a region moved to the top of the list, put back in its normal position
        $self->ivUndef('firstRegion');
        # Don't show a reversed list
        $self->ivPoke('reverseRegionListFlag', FALSE);

        # Redraw the list of regions in the treeview of every Automapper window using this world
        #   model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->resetTreeView();

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


        my ($self, $regionmapObj, $check) = @_;

        # Check for improper arguments
        if (defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->moveRegionToTop', @_);
        }

        # Mark the current region as being at the top of the list (or remove an existing region from
        #   the top of the list, if any)
        if ($regionmapObj) {
            $self->ivPoke('firstRegion', $regionmapObj->name);
        } else {
            $self->ivUndef('firstRegion');
        }

        # Redraw the list of regions in the treeview of every Automapper window using this world
        #   model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->resetTreeView();
        }

        return 1;
    }

    sub toggleFilter {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Releases/applies the specified room filter and updates each Automapper window
        #
        # Expected arguments
        #   $filter     - The filter to apply/release
        #   $flag       - Set to TRUE to release the room filter, FALSE to apply it
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $filter, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $filter || ! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->toggleAllFilters', @_);
        }

        if ($flag) {
            $self->ivAdd('roomFilterApplyHash', $filter, TRUE);
        } else {
            $self->ivAdd('roomFilterApplyHash', $filter, FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            # Redraw all drawn regions
            $mapWin->redrawRegions();

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            $mapWin->setActiveItem($filter . '_filter', $flag);

            # Set the equivalent toolbar button
            $mapWin->setActiveItem('icon_' . $filter . '_filter', $flag);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub switchRoomInteriorMode {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of $self->roomInteriorMode and updates each Automapper window
        #
        # Expected arguments
        #   $mode       - The new value of ->roomInteriorMode
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->switchRoomInteriorMode', @_);
        }

        $self->ivPoke('roomInteriorMode', $mode);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            # Redraw all drawn regions
            $mapWin->redrawRegions();

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            $mapWin->setActiveItem('interior_mode_' . $mode, TRUE);

            # Set the equivalent toolbar button
            $mapWin->setActiveItem('icon_interior_mode_' . $mode, TRUE);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub switchRegionDrawExitMode {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of GA::Obj::Regionmap->drawExitMode and updates each Automapper window
        #
        # Expected arguments
        #   $regionmapObj   - The regionmap to modify
        #   $mode           - The new value of $regionmapObj->drawExitMode
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $regionmapObj, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $regionmapObj || ! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->switchRegionDrawExitMode',
                @_,
            );
        }

        $regionmapObj->ivPoke('drawExitMode', $mode);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my ($menuName, $menuItem);

            # Redraw the specified regionmap (the TRUE argument means don't redraw other regionmaps)
            $mapWin->redrawRegions($regionmapObj, TRUE);

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($mode eq 'no_exit') {
                $menuName = 'region_draw_no_exits';
            } elsif ($mode eq 'simple_exit') {
                $menuName = 'region_draw_simple_exits';
            } elsif ($mode eq 'complex_exit') {
                $menuName = 'region_draw_complex_exits';
            }

            $mapWin->setActiveItem($menuName, FALSE);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
            $mapWin->restrictWidgets();
        }

        return 1;
    }

    sub toggleObscuredExitFlag {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of GA::Obj::Regionmap->obscuredExitFlag and updates each Automapper window
        #
        # Expected arguments
        #   $regionmapObj   - The regionmap to modify
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $regionmapObj, $check) = @_;

        # Check for improper arguments
        if (! defined $regionmapObj || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->toggleObscuredExitFlag',
                @_,
            );
        }

        if (! $regionmapObj->obscuredExitFlag) {
            $regionmapObj->ivPoke('obscuredExitFlag', TRUE);
        } else {
            $regionmapObj->ivPoke('obscuredExitFlag', FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my ($menuName, $menuItem);

            # Redraw the specified regionmap (the TRUE argument means don't redraw other regionmaps)
            $mapWin->redrawRegions($regionmapObj, TRUE);

            # Update the menu item
            $mapWin->set_ignoreMenuUpdateFlag(TRUE);
            $mapWin->setActiveItem('obscured_exits_region', $regionmapObj->obscuredExitFlag);
            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
            $mapWin->restrictWidgets();
        }

        return 1;
    }

    sub toggleObscuredExitRedrawFlag {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of GA::Obj::Regionmap->obscuredExitRedrawFlag and updates each Automapper
        #   window
        #
        # Expected arguments
        #   $regionmapObj   - The regionmap to modify
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $regionmapObj, $check) = @_;

        # Check for improper arguments
        if (! defined $regionmapObj || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->toggleObscuredExitRedrawFlag',
                @_,
            );
        }

        if (! $regionmapObj->obscuredExitRedrawFlag) {
            $regionmapObj->ivPoke('obscuredExitRedrawFlag', TRUE);
        } else {
            $regionmapObj->ivPoke('obscuredExitRedrawFlag', FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my ($menuName, $menuItem);

            # Redraw the specified regionmap (the TRUE argument means don't redraw other regionmaps)
            $mapWin->redrawRegions($regionmapObj, TRUE);

            # Update the menu item
            $mapWin->set_ignoreMenuUpdateFlag(TRUE);
            $mapWin->setActiveItem(
                'auto_redraw_obscured_region',
                $regionmapObj->obscuredExitRedrawFlag,
            );
            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
            $mapWin->restrictWidgets();
        }

        return 1;
    }

    sub toggleDrawOrnamentsFlag {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of GA::Obj::Regionmap->drawOrnamentsFlag and updates each Automapper window
        #
        # Expected arguments
        #   $regionmapObj   - The regionmap to modify
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $regionmapObj, $check) = @_;

        # Check for improper arguments
        if (! defined $regionmapObj || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->toggleDrawOrnamentsFlag',
                @_,
            );
        }

        if (! $regionmapObj->drawOrnamentsFlag) {
            $regionmapObj->ivPoke('drawOrnamentsFlag', TRUE);
        } else {
            $regionmapObj->ivPoke('drawOrnamentsFlag', FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my ($menuName, $menuItem);

            # Redraw the specified regionmap (the TRUE argument means don't redraw other regionmaps)
            $mapWin->redrawRegions($regionmapObj, TRUE);

            # Update the menu item
            $mapWin->set_ignoreMenuUpdateFlag(TRUE);
            $mapWin->setActiveItem('draw_ornaments_region', $regionmapObj->drawOrnamentsFlag);
            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # Sensitise/desensitise menu bar/toolbar items, depending on current conditions
            $mapWin->restrictWidgets();
        }

        return 1;
    }

    sub setMagnification {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of GA::Obj::Regionmap->magnification and updates each Automapper window
        #
        # Expected arguments
        #   $mapWin         - The GA::Win::Map that initiated the zoom
        #   $magnification  - The new value of $regionmapObj->magnification
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $mapWin, $magnification, $check) = @_;

        # Local variables
        my (
            $regionmapObj, $oldOffsetXPos, $oldOffsetYPos, $oldStartXPos, $oldStartYPos,
            $oldWidth, $oldHeight, $offsetXPos, $offsetYPos, $startXPos, $startYPos, $width,
            $height, $adjustXFlag, $adjustYFlag,
        );

        # Check for improper arguments
        if (! defined $mapWin || ! defined $magnification || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->setMagnification', @_);
        }

        $regionmapObj = $mapWin->currentRegionmap;
        $regionmapObj->ivPoke('magnification', $magnification);

        # When we fully zoom out, so that there are no scroll bars visible, GooCanvas2::Canvas
        #   helpfully forgets the scrollbar's position. This means that the current room, if we were
        #   centred on it, is no longer centred. Therefore we have to get the scrollbar's position,
        #   change the map's visible size, and then - if the map is fully zoomed out, and the
        #   scrollbars have disappeared - record their position, for the next time the user zooms in

        # Get the visible map's size and position. The six return values are all numbers in the
        #   range 0-1
        ($oldOffsetXPos, $oldOffsetYPos, $oldStartXPos, $oldStartYPos, $oldWidth, $oldHeight)
            = $mapWin->getMapPosn();

        # Update every Automapper window using this world model
        foreach my $otherMapWin ($self->collectMapWins()) {

            if ($otherMapWin->currentRegionmap && $otherMapWin->currentRegionmap eq $regionmapObj) {

                # Zoom in or out on this region
                $otherMapWin->doZoom();
            }
        }

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


                # Reset zoom factor (magnification) to 1
                $mapWin->zoomCallback(1);
                # Reset the scrollbars
                $mapWin->setMapPosn(0.5, 0.5);
                # Redraw the map to make sure the default level is visible
                $mapWin->setCurrentLevel(0);
            }
        }

        return 1;
    }

    sub setTrackingSensitivity {

        # Called by anonymous function in GA::Win::Map->enableViewColumn
        # Sets the value of $self->trackingSensitivity and updates each Automapper window
        #
        # Expected arguments
        #   $sensitivity    - The new tracking sensitivity (one of the value 0, 0.33, 0.66 or 1)
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $sensitivity, $check) = @_;

        # Check for improper arguments
        if (! defined $sensitivity || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->setTrackingSensitivity', @_);
        }

        if (
            $sensitivity != 0
            && $sensitivity != 0.33
            && $sensitivity != 0.66
            && $sensitivity != 1
        ) {
            # Use a default value for $sensitivity
            $sensitivity = 0;
        }

        $self->ivPoke('trackingSensitivity', $sensitivity);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my $menuName;

            if ($sensitivity == 0) {
                $menuName = 'track_always';
            } elsif ($sensitivity == 0.33) {
                $menuName = 'track_near_centre';
            } elsif ($sensitivity == 0.66) {
                $menuName = 'track_near_edge';
            } else {
                $menuName = 'track_not_visible';
            }

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            $mapWin->setActiveItem($menuName, TRUE);

            # Set the equivalent toolbar button
            $mapWin->setActiveItem('icon_' . $menuName, TRUE);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    # (Called from GA::Win::Map menu, 'Mode' column)

    sub setAutoCompareMode {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Updates the world model's ->autoCompareMode and updates each Automapper window using this
        #   world model
        #
        # Expected arguments
        #   $mode   - The new value of the IV - 'default', 'new' or 'current'
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->setAutoCompareMode', @_);
        }

        # Update the IV
        $self->ivPoke('autoCompareMode', $mode);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($mode eq 'default') {
                $mapWin->setActiveItem('auto_compare_default', TRUE);
            } elsif ($mode eq 'default') {
                $mapWin->setActiveItem('auto_compare_new', TRUE);
            } elsif ($mode eq 'default') {
                $mapWin->setActiveItem('auto_compare_current', TRUE);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # If interior counts are currently showing the number of rooms that match the current
            #   room, redraw the current room to show the counts
            if ($self->roomInteriorMode eq 'compare_count' && $mapWin->mapObj->currentRoom) {

                $mapWin->markObjs('room', $mapWin->mapObj->currentRoom);
                $mapWin->doDraw();
            }
        }

        return 1;
    }

    sub toggleAutoCompareAllFlag {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Toggles the world model's ->autoCompareAllFlag and updates each Automapper window using
        #   this world model
        #
        # Expected arguments
        #   $flag   - The new value of the IV - TRUE or FALSE
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->toggleAutoCompareAllFlag',
                @_,
            );
        }

        # Update the IV
        if (! $flag) {
            $self->ivPoke('autoCompareAllFlag', FALSE);
        } else {
            $self->ivPoke('autoCompareAllFlag', TRUE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if (! $flag) {
                $mapWin->setActiveItem('auto_compare_region', TRUE);
            } else {
                $mapWin->setActiveItem('auto_compare_model', TRUE);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub setAutoSlideMode {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Updates the world model's ->autoSlideMode and updates each Automapper window using this
        #   world model
        #
        # Expected arguments
        #   $mode   - The new value of the IV - 'default', 'orig_pull', 'orig_push', 'other_pull',
        #               'other_push', 'dest_pull' or 'dest_push'
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->setAutoSlideMode', @_);
        }

        # Update the IV
        $self->ivPoke('autoSlideMode', $mode);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            my $menuItem;

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($mode eq 'default') {
                $mapWin->setActiveItem('slide_default', TRUE);
            } elsif ($mode eq 'orig_pull') {
                $mapWin->setActiveItem('slide_orig_pull', TRUE);
            } elsif ($mode eq 'orig_push') {
                $mapWin->setActiveItem('slide_orig_push', TRUE);
            } elsif ($mode eq 'other_pull') {
                $mapWin->setActiveItem('slide_other_pull', TRUE);
            } elsif ($mode eq 'other_push') {
                $mapWin->setActiveItem('slide_other_push', TRUE);
            } elsif ($mode eq 'dest_pull') {
                $mapWin->setActiveItem('slide_dest_pull', TRUE);
            } elsif ($mode eq 'dest_push') {
                $mapWin->setActiveItem('slide_dest_push', TRUE);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub toggleDisableUpdateModeFlag {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Toggles the world model's ->disableUpdateModeFlag and updates each Automapper window using
        #   this world model
        #
        # Expected arguments
        #   $flag   - The new value of the IV - TRUE or FALSE
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->toggleDisableUpdateModeFlag',
                @_,
            );
        }

        # Update the IV
        if ($flag) {
            $self->ivPoke('disableUpdateModeFlag', TRUE);
        } else {
            $self->ivPoke('disableUpdateModeFlag', FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            $mapWin->setActiveItem('disable_update_mode', $self->disableUpdateModeFlag);

            # The call to ->setMode makes sure the Automapper window's mode is switched from
            #   'update' to 'follow' if 'update' mode has just been disabled, and also makes sure
            #   the menu/toolbar buttons are sensitised or not, as appropriate
            $mapWin->setMode($mapWin->mode);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);
        }

        return 1;
    }

    sub toggleShowTooltipsFlag {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Toggles the world model's ->showTooltipsFlag and updates each Automapper window using this
        #   world model
        #
        # Expected arguments
        #   $flag   - The new value of the IV - TRUE or FALSE
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->toggleShowTooltipsFlag', @_);
        }

        # Update the IV
        if ($flag) {
            $self->ivPoke('showTooltipsFlag', TRUE);
        } else {
            $self->ivPoke('showTooltipsFlag', FALSE);
        }

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            $mapWin->setActiveItem('show_tooltips', $self->showTooltipsFlag);

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            if (! $flag) {

                # If the tooltip window is currently visible, hide it
                $mapWin->hideTooltips();
            }
        }

        return 1;
    }

    # (Called from GA::Win::Map menu, 'Exits' column)

    sub setCheckableDirMode {

        # Called by anonymous function in GA::Win::Map->enableModeColumn
        # Updates the world model's ->checkableDirMode and updates each Automapper window using
        #   this world model
        #
        # Expected arguments
        #   $mode   - The new value of the IV - 'simple', 'diku', 'lp' or 'complex'
        #
        # Return values
        #   'undef' on improper arguments
        #   1 otherwise

        my ($self, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->setCheckableDirMode', @_);
        }

        # Update the IV
        $self->ivPoke('checkableDirMode', $mode);

        # Update every Automapper window using this world model
        foreach my $mapWin ($self->collectMapWins()) {

            $mapWin->set_ignoreMenuUpdateFlag(TRUE);

            # Update the menu item
            if ($mode eq 'simple') {
                $mapWin->setActiveItem('checkable_dir_simple', TRUE);
            } elsif ($mode eq 'diku') {
                $mapWin->setActiveItem('checkable_dir_diku', TRUE);
            } elsif ($mode eq 'lp') {
                $mapWin->setActiveItem('checkable_dir_lp', TRUE);
            } elsif ($mode eq 'complex') {
                $mapWin->setActiveItem('checkable_dir_complex', TRUE);
            }

            $mapWin->set_ignoreMenuUpdateFlag(FALSE);

            # If interior counts are currently showing checked/checkable directions, redraw all
            #   drawn regions to update those counts
            if ($self->roomInteriorMode eq 'checked_count') {

                $mapWin->redrawRegions();
            }
        }

        return 1;
    }

    sub getCheckableDirs {

        # Called by GA::Win::Map->prepareCheckedCounts, once per drawing cycle. Also called by
        #   GA::Cmd::ModelReport->do
        # $self->roomInteriorMode specifies which primary directions should be checked, when
        #   using checkable directions. This function compiles the list of primary directions, and
        #   converts them from their standard to custom forms, which is how they are stored in
        #   GA::ModelObj::Room->checkedDirHash
        #
        # Expected arguments
        #   $session    - The calling GA::Session
        #
        # Return values
        #   An empty hash on improper arguments
        #   Otherwise returns a hash (never empty), in the form
        #       $hash{custom_primary_direction} = undef

        my ($self, $session, $check) = @_;

        # Local variables
        my (
            $dictObj,
            @standardList,
            %emptyHash, %returnHash,
        );

        # Check for improper arguments
        if (! defined $session || defined $check) {

            $axmud::CLIENT->writeImproper($self->_objClass . '->getCheckableDirs', @_);
            return %emptyHash;
        }

        # Import the current dictionary (for convenience)
        $dictObj = $session->currentDict;

        if ($self->checkableDirMode eq 'complex') {
            @standardList = $axmud::CLIENT->constPrimaryDirList;
        } elsif ($self->checkableDirMode eq 'lp') {
            @standardList = $axmud::CLIENT->constShortPrimaryDirList;
        } elsif ($self->checkableDirMode eq 'diku') {
            @standardList = qw(north south east west up down);
        } else {
            @standardList = qw(north south east west);      # ->roomInteriorMode is 'simple'
        }

        foreach my $standard (@standardList) {

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

                $self->_objClass . '->set_quickPaintMultiFlag',
                @_,
            );
        }

        if ($flag) {
            $self->ivPoke('quickPaintMultiFlag', TRUE);
        } else {
            $self->ivPoke('quickPaintMultiFlag', FALSE);
        }

        return 1;
    }

    sub set_preDrawAllocation {

        my ($self, $number, $check) = @_;

        # Check for improper arguments
        if (! defined $number || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_preDrawAllocation', @_);
        }

        # Update IVs
        $self->ivPoke('preDrawAllocation', $number);

        return 1;
    }

    sub set_preDrawRetainRooms {

        my ($self, $number, $check) = @_;

        # Check for improper arguments
        if (! defined $number || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_preDrawRetainRooms', @_);
        }

        # Update IVs
        $self->ivPoke('preDrawRetainRooms', $number);

        return 1;
    }

    sub set_roomFlagShowMode {

        my ($self, $mode, $check) = @_;

        # Check for improper arguments
        if (! defined $mode || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_roomFlagShowMode', @_);
        }

        # Update IVs
        $self->ivPoke('roomFlagShowMode', $mode);

        # Must redraw the menu in any automapper windows, so that the new room flag appears in them
        $self->updateMapMenuToolbars();

        return 1;
    }

    sub set_searchSelectRoomsFlag {

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper(
                $self->_objClass . '->set_searchSelectRoomsFlag',
                @_,
            );
        }

        if ($flag) {
            $self->ivPoke('searchSelectRoomsFlag', TRUE);
        } else {
            $self->ivPoke('searchSelectRoomsFlag', FALSE);
        }

        return 1;
    }

    sub set_showCanvasFlag {

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_showCanvasFlag', @_);
        }

        if ($flag) {
            $self->ivPoke('showCanvasFlag', TRUE);
        } else {
            $self->ivPoke('showCanvasFlag', FALSE);
        }

        return 1;
    }

    sub set_showMenuBarFlag {

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_showMenuBarFlag', @_);
        }

        if ($flag) {
            $self->ivPoke('showMenuBarFlag', TRUE);
        } else {
            $self->ivPoke('showMenuBarFlag', FALSE);
        }

        return 1;
    }

    sub set_showToolbarFlag {

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_showToolbarFlag', @_);
        }

        if ($flag) {
            $self->ivPoke('showToolbarFlag', TRUE);
        } else {
            $self->ivPoke('showToolbarFlag', FALSE);
        }

        return 1;
    }

    sub set_showTreeViewFlag {

        my ($self, $flag, $check) = @_;

        # Check for improper arguments
        if (! defined $flag || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->set_showTreeViewFlag', @_);
        }

        if ($flag) {
            $self->ivPoke('showTreeViewFlag', TRUE);
        } else {
            $self->ivPoke('showTreeViewFlag', FALSE);
        }

        return 1;
    }

    sub add_teleport {

        # Called by GA::Cmd::AddTeleport

        my ($self, $room, $cmd, $check) = @_;

        # Check for improper arguments
        if (! defined $room || ! defined $cmd || defined $check) {

            return $axmud::CLIENT->writeImproper($self->_objClass . '->add_teleport', @_);
        }

        $self->ivAdd('teleportHash', $room, $cmd);

        return 1;
    }

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

    sub modelActualCount
        { $_[0]->{modelActualCount} }
    sub modelDeletedList
        { my $self = shift; return @{$self->{modelDeletedList}}; }
    sub modelBufferList
        { my $self = shift; return @{$self->{modelBufferList}}; }
    sub mostRecentNum
        { $_[0]->{mostRecentNum} }

    sub exitModelHash
        { my $self = shift; return %{$self->{exitModelHash}}; }
    sub exitObjCount
        { $_[0]->{exitObjCount} }
    sub exitActualCount
        { $_[0]->{exitActualCount} }
    sub exitDeletedList
        { my $self = shift; return @{$self->{exitDeletedList}}; }
    sub exitBufferList
        { my $self = shift; return @{$self->{exitBufferList}}; }
    sub mostRecentExitNum
        { $_[0]->{mostRecentExitNum} }

    sub regionmapHash
        { my $self = shift; return %{$self->{regionmapHash}}; }
    sub reverseRegionListFlag
        { $_[0]->{reverseRegionListFlag} }
    sub firstRegion
        { $_[0]->{firstRegion} }

    sub preDrawAllowFlag
        { $_[0]->{preDrawAllowFlag} }
    sub preDrawMinRooms
        { $_[0]->{preDrawMinRooms} }
    sub preDrawRetainRooms
        { $_[0]->{preDrawRetainRooms} }
    sub preDrawAllocation
        { $_[0]->{preDrawAllocation} }

    sub knownCharHash
        { my $self = shift; return %{$self->{knownCharHash}}; }
    sub minionStringHash
        { my $self = shift; return %{$self->{minionStringHash}}; }

    sub lightStatus
        { $_[0]->{lightStatus} }
    sub constLightStatusList
        { my $self = shift; return @{$self->{constLightStatusList}}; }
    sub lightStatusList
        { my $self = shift; return @{$self->{lightStatusList}}; }

    sub roomTagHash
        { my $self = shift; return %{$self->{roomTagHash}}; }

    sub teleportHash
        { my $self = shift; return %{$self->{teleportHash}}; }

    sub autoOpenWinFlag
        { $_[0]->{autoOpenWinFlag} }
    sub pseudoWinFlag
        { $_[0]->{pseudoWinFlag} }
    sub showMenuBarFlag
        { $_[0]->{showMenuBarFlag} }
    sub showToolbarFlag
        { $_[0]->{showToolbarFlag} }
    sub showTreeViewFlag
        { $_[0]->{showTreeViewFlag} }
    sub showCanvasFlag
        { $_[0]->{showCanvasFlag} }
    sub buttonSetList
        { my $self = shift; return @{$self->{buttonSetList}}; }
    sub preferRoomFlagList
        { my $self = shift; return @{$self->{preferRoomFlagList}}; }
    sub preferBGColourList
        { my $self = shift; return @{$self->{preferBGColourList}}; }

    sub defaultGridWidthBlocks
        { $_[0]->{defaultGridWidthBlocks} }
    sub defaultGridHeightBlocks
        { $_[0]->{defaultGridHeightBlocks} }
    sub defaultBlockWidthPixels
        { $_[0]->{defaultBlockWidthPixels} }
    sub defaultBlockHeightPixels
        { $_[0]->{defaultBlockHeightPixels} }
    sub defaultRoomWidthPixels
        { $_[0]->{defaultRoomWidthPixels} }
    sub defaultRoomHeightPixels
        { $_[0]->{defaultRoomHeightPixels} }

    sub maxGridWidthBlocks
        { $_[0]->{maxGridWidthBlocks} }
    sub maxGridHeightBlocks
        { $_[0]->{maxGridHeightBlocks} }
    sub maxBlockWidthPixels
        { $_[0]->{maxBlockWidthPixels} }
    sub maxBlockHeightPixels
        { $_[0]->{maxBlockHeightPixels} }
    sub maxRoomWidthPixels
        { $_[0]->{maxRoomWidthPixels} }
    sub maxRoomHeightPixels
        { $_[0]->{maxRoomHeightPixels} }

    sub defaultMapWidthPixels
        { $_[0]->{defaultMapWidthPixels} }
    sub defaultMapHeightPixels
        { $_[0]->{defaultMapHeightPixels} }

    sub regionSchemeHash
        { my $self = shift; return %{$self->{regionSchemeHash}}; }
    sub defaultSchemeObj
        { $_[0]->{defaultSchemeObj} }

    sub defaultBackgroundColour
        { $_[0]->{defaultBackgroundColour} }
    sub defaultNoBackgroundColour
        { $_[0]->{defaultNoBackgroundColour} }
    sub defaultRoomColour
        { $_[0]->{defaultRoomColour} }
    sub defaultRoomTextColour
        { $_[0]->{defaultRoomTextColour} }
    sub defaultSelectBoxColour
        { $_[0]->{defaultSelectBoxColour} }
    sub defaultBorderColour



( run in 1.048 second using v1.01-cache-2.11-cpan-39bf76dae61 )