Commit graph

73 commits

Author SHA1 Message Date
Stephen Lyons
7720f0ae98 Enhance: 2D Map Room Selection, better big map performance + other mods
In situations when we check whether a room in an area both for internal
purposes and when rooms on a mapper is selected, using QSet instead of a
QList is faster in performance for large numbers of entries in set.

As it reworks the mapper code it also fixes issue where the multi-room
selection widget overwrites map info display - the latter is re-sized and
re-positioned (and regains a semi-transparent background which helped to
show this working during debugging!)  The former is now: dynamically
resized to only take up enough vertical space to show the selected rooms;
also displays the associate room names if there are any, expanding the
widget as required; sorts the display either by room name or number and in
either direction.

The mouse wheel handler is modified so that using the scroll wheel ONLY
scrolls the list within the widget - previously (by default) once the end
in either direction was hit the related events would be passed up the
widget chain where it would otherwise invoke the 2D mapper's zoom in/out
code.

In modifying the zoom in/out code I have replaced the (obsoleted in Qt5.x)
QWheelEvent::delta() method to use the QWheelEvent::angleDelta() method,
using only the Y-component the latter provides.  If the Control modifier is
active the zoom value is modified by an extra x10 factor which is useful
when working with large maps as otherwise the zooming rate is "slow" at
high values - ideally the control should be logarithmic or exponential or
some other "non-linear" algorithm to work more uniformly over the range of
practical use cases.

The code to paint the map info text has been revised also to use the
mMapInfoRect which was being defined but NOT used.

The info text now reports whether the room name is for the player room
{set via the Lua command centerview(roomId)} or is one that is selected
by mouse dragging - and if more than one room is selected by that indicates
the count of rooms in the selection.  In the case of multiple rooms being
selected the room that single room context menu operations will act upon
is highlighted by the same style of yellow target used to show the custom
exit line destination but is drawn in a different point in the code so that
it is drawn over the rooms.

Because of the change to the way that multiple rooms are selected routines
that use that information had to be revised - in doing so it was possible
to improve the usability/operation of:
T2DMap::slot_movePosition()
T2DMap::slot_setCharacter()
T2DMap::slot_spread()
T2DMap::slot_shrink()
T2DMap::slot_lockRoom():
T2DMap::slot_unlockRoom():
This method, also resurrected here to the 2D mapper context menu, as it is
also affected by the changes:
T2DMap::slot_setPlayerLocation()

There was a slot_setPlayerLocation code that set a global lua variable
mRoomSet and moved the player to that room Id (introduced in
commit-c25faf4e 2012-05-04 07:44:36 by Heiko) but the corresponding 2D
Mapper context menu item that called it was commented out and thus removed
from the menu in commit-93f65962 2012-12-29 01:16:28 also by Heiko without
any explaination. Since that has not been used since then I have replaced
it with a new Event: sysManualLocationSetEvent with a single numeric value
which is the new (valid) room Id number - user scripts can capture this
event if they want to know that the user has manually re-positioned the
current player room in the 2D mapper.

In passing:
* Fixed Text font changing between docked and un-docked forms of the
built-in map widget (when not incorporated into a console) - as it was
not previously explicitly set it assumed the Application one whilst
docked but the Qt System one when a free floating widget - and the two
do not have to be the same. This fixes:
https://bugs.launchpad.net/mudlet/+bug/1432841 .

* Starts to fix https://bugs.launchpad.net/mudlet/+bug/1376511 by changing
from use of obsolete QWheelEvent::delta() to QWheelEvent::angleDelta() in
T2DMap::wheelEvent(...); will need duplicating in
TTextEdit::wheelEvent(...)  and GLWidget::wheelEvent(...) .

* Adds the profile name to the Mapper dockable widget so that it's
parentage can be determined when multiple profiles are active.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2016-04-17 03:11:53 +01:00
Stephen Lyons
86736b2f43 Enhance: Add ability to specify starting room number to createRoomID()
About to start a real session of MUD playing I noted that there is no quick
way to assign ranges of room numbers when mapping out areas - it is useful
to some map-makers to group ranges of numbers to areas.  Since we do not
provide an implicit ways to renumber rooms (have to create new instance and
copy data across in a script) I think some would find it useful to be able
to supply a starting room number to the Lua command createRoomID and for
that to return the next available number past that.

{This will be familiar to a TinTin++ MUD Client user which behaves in the
same manner as I propose here - IIRC!}

The Lua createRoomID() has been updated (to current code/message
guidelines) - it will return a nil AND an error message instead of a
number if the optionally supplied first argument is less than 1.  Otherwise
it behaves as before - new scripts written to take advantage of this
functionality may wish to check the returned number IS greater than the
specified value if they need to guarantee the result and provide fall-back
functionality with prior versions of the application {start iterating
through room Ids with getRoom( roomId ) to find first non-existent room} -
as in that case the supplied argument will be ignored and just the lowest
free positive number will be returned as for previous versions.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2016-04-14 20:42:28 +01:00
Stephen Lyons
a102d6b7b5 Fixup: correct some issues raised in testing
* In dlgTrigger C'tor tweak Qt Version check for inclusion of placeholder
  text - should be 5.3 not 5.2
* In source_editor_area.ui restore full-widget background limiting the
  painting of the background colour to the extent of the content not the
  widget is NOT wanted
* In dlgTriggerEditor::slot_cursorPositionChanged() rearrange "current
  position" details to a more acceptable order
* Initialise Host::mTimerDebugOutputSuppressionInterval member so that the
  adjustment control in "Profile Preferences" comes up with a consistent
  value on first use.  When testing it became clear that the behaviour when
  moving away from the zero "Show all" value would start acting on the most
  significant section ("Hours") rather than the more useful "Seconds".
  Added void dlgProfilePreferences::slot_timeValueChanged(QTime)
  private slot connect to the timeChanged(QTime) signal to handle things.

Whilst fixing the above things also became aware of and addressed:
* When the Profile Preferences dialog is open the map format save control
  was not being initialised to the current setting but to the default 16
  instead - this is confusing for someone who HAS changed the value and
  goes back to see it reset - even though it has not been until they
  close (and thus save) whatever the value.
* Absence of tool-tips for Profile Preference Special Option mentioned
  above to cut down spam from short interval Timers and the map save
  version override control.
* There are already warning in place the first time that the Lua
  set{Map|Area}UserData(...) commands are used and the map format is not 17
  but this is is now detected on map save.  However as this can happen when
  the user closes Mudlet the other warnings are also useful.
* Spotted a potential bug in that when saving rooms there is not a null
  room pointer check to skip the (hopefully) unlikely case of a
  QHash<int, TRoom*>TRoomDB:rooms value being null - this would cause a
  null pointer bug and thus a probable crash.
* The Editor toolbar button to show/hide the search area also shows and
  hides the area where "Errors" {"popupArea"} are displayed within the
  Editor widget. Probably a long standing issue from the past evolution of
  the editor.
* Spotted that the statusBar tip for the "copy HTML" context menu command
  for the TTextEdit class was being applied to the "copy" entry - so that
  the "copy" command got the wrong text and the "copy HTML" did not have
  any statusBer Tip.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2016-03-05 06:48:08 +00:00
Stephen Lyons
ab0569211d BugFix: repair a map loading error caused by a stray space
I accidentally included this in previous commit.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-12-30 17:17:34 +00:00
Stephen Lyons
669b5e7df5 Fix: correct initialisation error revealed by C.I. testing
The clang compiler spotted an invalid initialisation sequence in the recent
commit-f8ffe911 that I made.  This fixes that issue (in TMap constructor).

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-12-30 17:17:34 +00:00
Stephen Lyons
b380e49d13 Enhance: add Area & Map user data structures & Lua script access commands
Whilst working on the XML importer for Map files I found that I wanted
somewhere to store the data from attributes for tags that we don't use in
Mudlet directly.  For room related details I could use the TRoom::userData
member but then I realised that there is nothing corresponding to Areas or
for the Map overall.  This separate commit provides these and the lua
commands to interact with them - with functionality the same as the Room
based one.  Of course, as there is only ONE map there is no argument needed
to select an instance for those commands.  Of all the "room" user data
commands replicated for "area" and "map" the only one NOT so done are
get????UserDataKeys() as this is a bit pointless with a
getAll????UserData() one from which the keys could be extracted from the
returned table {???? being "Area" or "Map"}.

So, the commands added to TLuaInterpreter class to provide user script
commands are:
searchAreaUserData((string)<key>[, (string)<value>])
setAreaUserData((number)<area Id>, (string)<key>, (string)<value>)
clearAreaUserData((number)<area Id>)
clearAreaUserDataItem((number)<area Id>, (string)<key>)
getAreaUserData((number)<area Id>, (string)<key>)
getAllAreaUserData((number)<area Id>)
setMapUserData((string)<key>, (string)<value>)
clearMapUserData((string)<key>)
clearMapUserDataItem()
getMapUserData((string)<key>)
getAllMapUserData()

Refactored TMap::serialize() to allow saving in different map file formats
as defined by the constants TMap::mDefaultVersion, mMinVersion and
mMaxVersion - if either of the last pair are less than or more than the
first value respectively then a control on the "Special Options" tab of the
profile preferences dialog will be enabled - the state of each value that
is allowed is clearly indicated and it is defaulted appropriately.  At
present:
TMap::mDefaultVersion is 16 (replaces #define CURRENT_MAP_VERSION)
TMap::mMinVersion is also 16
TMap::mMaxVersion is 17

This means that the new user data areas will only persist (be saved) if
that control is manually adjusted to 17 FOR EACH SESSION in this
development version.  When we get to a release version mDefaultVersion
should be upped to 17 so that the release version uses the new format but
can be manually downgraded to current (16) for those who want to share a
map with users who have not upgraded - with the less of those new user data
items - such users can do this by opening the profile preferences, downing
this setting THEN using the SAVE MAP button and then restoring to the
default value and SAVING AGAIN to a different name in the recommend format.

Also renamed TMap::version to TMap::mVersion...

Both TMap::serialise(...) and TMap::restore(...) have been revised to work
with these and messages to the main console added as seemed prudent.

==========================================================================
As this code requires the revision to the map file format that is coded
for but only enabled manually the setter commands setAreaUserData(...) and
setMapUserData(...) will both emit a warning message that the data written
will not CURRENTLY be saved with the map the FIRST (and only the first)
time they are used when the preference control has not been manually
adjusted.
==========================================================================

Also: Tweaked a recent, previous merged commit that set an optional minimum
time for a Timer NOT to display it's contents every time it fires in
debug output screen in value: Host::mTimerDebugOutputSuppressionInterval
so that the QTimeEdit that controls it defaults to adjusting the "Seconds"
time field rather than the default "Hours" one as that is the one that
is most likely the one the user might wist to use.

Also: The control this commit adds to the Profile Preferences dialog
makes use of the QComboBox::currentData() method that was introduced in
Qt5.2 - the minimum Qt library requirement in the qmake project file was
revised to accomodate this - if builders wish to use a Qt5.x before this
they will need to manually provide extra code to allocate an integer
value from the range of values wanted/offered.

Also: whilst cross-checking for the cmake project file I found the top
level one was missing from the qmake project file - so have added it to
that.

HOWEVER I HAVE NOT FOUND A WAY TO REQUIRE THE CMAKE SYSTEM TO REQUIRE QT5.2
AS A MINIMUM WHICH THIS COMMIT REQUIRES.

Also: in the Top level CMake project file CMakeLists.txt the APP_BUILD
variable was incorrectly set to "-beta" and NOT the correct value that is
"-delta" - this means that any recent CMake'd Mudlet builds will identify
themselves incorrectly!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-12-30 17:12:31 +00:00
Stephen Lyons
9c306b80f1 BugFix: faulty message alignment, cTelnet::postMessage() in non-ERROR cases
A version of this commit never got into the release_30 branch with the
effect that all the postMessage() type calls with messages OTHER than the
ones beginning with "[ ERROR ]" were not being aligned correctly.

Original commit-e17d023b read:
===========================================================================
Code that was put in to fix messages with tag "[ ERROR ] - " was not copied
to the other tag types, so those messages were not lined up correctly as
per:

"[<tag>] - <message line 1 ...>
           <message line 2 ...>
           ...
           <message line n ...>"

===========================================================================

Whilst fixing this I decided to give the Host class a wrapper around
mTelnet.postMessage() so that other classes could access this without
having to include the cTelnet header or access it via a Host pointer.
As a result other existing uses have been modified where it is advantagous
to do so.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-11-04 22:45:59 +00:00
Stephen Lyons
403469594e enhanceAndFix: fix handling of parallel edges in BGL route-finding graph
This commit cleans up some problems in route finding - specifically when
working out the exits to use to move from the ordered list of rooms that
make up the route that the A* code determined - no longer is the first
exit in a fixed order in a particular room used that happens to go to the
next room - instead the correct (lowest weighted, non-locked) exit is
selected.  If a route is not found the reason why is output via qDebug()
which should make debugging problems a bit easier for developers!  The BGL
graph that TMap::initgraph() produces now tracks which exit from one room
to another is the best one to use (choosing just one from equally weighted
ones and ignores higher weighted ones) if it is a "normal" exit the
subsequent use of TMap:findPath() will now insert a "translated" direction
to the TMap::mDirList - but in future it should be straightforward to
arrange for a user specified "direction" name to be used - perhaps with
locale specific defaults which will make using Mudlet's route-finding
code possible with non-ASCII using MUDs (i.e. those not based on American
English!)

This commit also avoids creating spurious entries in the BGL graph that
the previous code did by using the "[]" operator (which inserted *wrong*
entries into (QMap<int, int>) TMap::roomidToIndex for TRooms that should
NOT have been present!)  That was found to be causing crashes in corner
cases where ALL rooms in the map or at least some rooms or their exits
in what would otherwise have been a valid route were locked against use
for route-finding.

Also:
* Culls some dead code in TAstar.h that was copied verbatim from a usage
  example elsewhere (possibly the boost library documentation).

* Removes following unused members of TMap:
  * (QList<int>) mTestedNodes
  * (QList<int>) conList
  * (int) mPlausaOptOut;
  * typedef of: mygraph_t::vertex_iterator to: vertex_iterator
  * typedef of: std::pair<int, int> to: edge
  * (WeightMap) weightmap
  * The, already, commented out:
     * (mapVar) mVars[20]
     * (mapVar) <int> mvRoomId
     * (QMap<QString, mVarTypes> mVars
     * (QMap<QString, *QVariant> mVars
     * mVars.insert("RoomId", &mRoomId)

* Comments out the now unused members of TMap:
  * (QMap<int, int>) indexToRoomid

* Corrects spelling of TAstar.h in qmake project file - was spelt TAStar.h!

* Generates a "speedWalkWeight" table alongside the "speedWalkPath" and
  "speedWalkDir" ones that indicates the weight of each step in a route,
  it can be accessed in the same manner as those others.

* Host::assemblePath() now returns the total "weight" of the route
  calculated - which the lua command getPath(startRoomId, targetRoomId)
  now returns as a second value - this will make it easier for users'
  scripts to choose between routes to multiple destinations.

* Some Lua helper methods:
  * TLuaInterpreter::get_lua_string(...)
  * TLuaInterpreter::set_lua_string(...)
  * TLuaInterpreter::set_lua_table(...)
  now process strings as Utf-8 - this change was needed to allow non-ASCII
  characters to appear in exit directions but will also be needed by other
  commands. Whilst the first is currently unused, the second is used once
  in three class and the third by Host::assemblePath() and twice in
  TLuaInterpreter::initLuaGlobals() to set up something for "atcp" and
  "channel102" processing...

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-08-15 22:04:56 +01:00
Stephen Lyons
e164b80407 BugFix: allow setRoomArea() to set room to area that has name but no TArea
After restoring the ability to register a (new) area ID with a specific
name in TRoomDB::areaNameMap without actually creating a TArea instance to
hold the area's data by using TLuaIntrepreter::setAreaName(areaId, name),
it is necessary to modify TLuaIntrepreter::setRoomArea( roomId, areaId) to
work again when "areaId" only represents an area Name without the TArea
to contain most of the area data.  This commit implements the changes to
do so - and permits an area Name to be used to specify the area instead of
an areaId provided such an area exists already.

Also arranges for the 2/3D mappers to be updated on successfully setting or
resetting a room's area - so the user can see the result on screen
immediately without having to cause the mapper to be redrawn.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-06-28 05:06:40 +01:00
Stephen Lyons
521fdc2125 BugFix: Treat and prevent further duplicate or empty map area names
Some steps had previously been taken to enforce no duplicate area names
when importing an XML map or when adding a new name but other mechanisms
were left unchecked, specifically this was when renaming an existing area.

This commit adds a number of validation steps to many of the lua functions
that manipulate areas and their names.  This includes taking steps when
creating a new TArea instance to ensure a suitable area name is created and
added to the areaNamesMap which may be overwritten if a valid (non-empty,
non-duplicate) name is provided at the time or later.  This avoids problems
with the Area selection widget on the 2 or 3D Map Display and the lua
getAreaTable() function, neither of which will handle duplicate area names
and for the former, does not handle nameless areas well either.  The
deleteArea() function could take either an area Id or a name as the target
of its action so the area that is to be deleted is now not subject to any
ambiguity if supplied as a name!

Should a map file be loaded where empty or duplicated area names are found
these will be "fixed" and warning messages inserted onto the main profile
to explain what has happened.  The user will only get this once per map
file as there should now be no way to modified the map file to have either
of these issues.

The code that builds the area selection widget is revised to handle the
corner cases of two areas that have the same letters in their name but the
cases vary (the widget is sorted by name in a case insensitive manner)
which previously was not handled (same as duplicate names were not).

As a side effect of revising the TLuaInterpreter Class, area names
containing non-ASCII characters can now be handled - they will be passed
through the lua subsystem using the UTF-8 encoding.

*** This commit is a reworking of one that produced a QMessageBox to alert
and advised the user what was happening - that was deemed to be too
intrusive so this version instead displays the information in the console
- as such the detail of the renaming has to be shown now whereas the dialog
solution had the option of providing it as "Show Details..." to display it
only if requested at the time. ***

Additionally, the lua setAreaName(areaId, newAreaName) has been extended to
allow the existing area to be specified as a name (string) as well as an Id
as we can now uniquely identify it by that means.  This now matches the
behaviour of deleteArea which already acts in that manner.  It also means
a user script can use "setAreaNAme(oldName, newName)" to rename an area
without concern about determining the area Id.

This commit is based upon modifications made to the "development" branch
but corrects a bug that prevented setAreaName() from accepting a new
non-Ascii area name and includes the changes from a separate commit that
clears the area name table on loading a new map that was missed from the
original series of commits on the development branch.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-06-23 22:45:56 +01:00
Stephen Lyons
c7e3f2ca6c FixEnhance: fix entranceMap maintenance, bulk room deletion and map loading
Previously we were not removing entries from the entranceMap involving
the value (a room that the room Id that was a key had an entrance FROM)
when a route was changed.  There is a performance cost in ensuring the
data is kept correctly - there may be a modest gain by storing the
entrance data within each TRoom class instance rather than a central
database in TRoomDB...

Deletion of multiple rooms and map loading can be done more efficiently
if we skip some redundant steps.

Also added/revised some timing code to measure things.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-02-08 12:19:59 +00:00
Chris Mitchell
610ca6b6ec fix for keeping reverse area exit map in sync with exit creation, adding, and deletion 2015-02-02 14:00:11 -05:00
Stephen Lyons
8a8fac09a0 Revise: massage Area Exit data to required format and ensure it is correct
Rename:
(void)TArea::fast_ausgaengeBestimmen(int)
                                     ==> TArea::determineAreaExitsOfRoom
(void)TArea::ausgaengeBestimmen(int) ==> TArea::determineAreaExits
(const)(QList<int>)TArea::getAreaExits() const
                                     ==> TArea::getAreaExitRoomIds()

Add new method to return area exit data in new, wanted format:
(const)(QMultiMap<int, QPair<QString, int> >) getAreaExitRoomData() const

In preparation to revising internal storage representation of area exit
data moved the: (QMultiMap<int, QPair<int, int> >)(TArea *)->exits member
from public to private area of class.  To permit save and load the
following have had to be made friends of the TArea class:
(bool)TMap::serialize( QDataStream & ) and  (bool)TMap::restore( QString )

Revise (void)TMap::init(Host *) to run (TArea *)->determineAreaExits() on
current and all previous map file format versions, will not be needed on
future version as the code to manage the areaExits data is now functional.
Previous code would have done this only for versions prior to 14 files
(current is 16) or if the lua function auditAreas() was manually run.  In
passing also modified code that "fixed-up" "old style" map labels so that
it is no longer run on current version files and pushes any messages that
that creates into the main profile console instead of using standard C++
cout calls which we deprecate now.

All code blocks that have been touched by this series of commits have been
re-formatted to current styles.

Update copyrights on all files touched that have not already been marked as
having been edited by myself.

Revised TLuaInterpreter::getAreaExits(...) to take a second optional
Boolean that if present and true cause it to return data about the area
exit directions and the destination rooms, if false or omitted, returns
only the rooms in the area that have exits out of it, reproducing the
previous implementation.  In either case the result is a table if there
are area exits (or a nil for an isolate area without exits); two additional
values are returned an informative, translatable, text message and an
integer status code that reflects the same information.

When moving a series of rooms to a different area via the 2D mapper's GUI
the recalculations for the area extremes {by TArea::calcSpan()} and the
out of area exits {by TArea::determineAreaExits()} can now be deferred
until the last room has been moved by passing a third true (boolean)
argument to TMap::setRoomArea(...) which defaults to false for other single
room at a time usages.  Though that method keeps a local copy of the areas
that have been modified and thus need updating, should the last room NOT
be processed (null TRooo pointer for room Id) a publicly accessible
"mIsDirty" flag is also used so that recovery code can identify and clean
up those affected areas otherwise.  It is possible that this flag may be
useful in other situations, such as when moving or adding multiple rooms
WITHIN an area.

*** This commit has been rebased so it's history might not be the same as
someone else's copy of it ***

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2015-01-07 02:14:14 +00:00
Ahmed Charles
441bda28f1 Remove three dead functions from TMap.h/cpp. 2014-08-19 04:25:01 -07:00
Ahmed Charles
3989340fcd Rearrange includes to improve compile times.
This also allows for memory leak checking on MSVC by having include
surrounding Qt headers, which break if you have a macro define new
to be something which tracks line information.
2014-08-17 14:46:54 -07:00
Stephen Lyons
127d095ad9 Permissions Fix: Remove Executable bit(s) from non-executable files.
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2014-08-15 00:55:39 -07:00
Stephen Lyons
5c55a065db Mute warnings: Comment out unused vars, delete unneeded comment, fix var
Tidying up some compiler warnings.  Fix a signed/unsigned comparision clash
Also changed "build" project variable to reflect git branch name.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2014-05-23 18:36:57 +01:00
Stephen Lyons
83db9f94ed Enhancement: Improved/extended exits GUI for 2D mapper
The GUI formed by dlgRoomExits.{cpp|h} and room_exits.ui combined now
provide full control and aim to enforce relational consistency between the
data items that provide all the exits from a particular room.  All controls
should have tool-tips - some context sensitive and provide support for some
aspects that are not yet implemented in other parts of the code e.g. door
markers for the mapper on exits not in the XY-Plane.  As the controls for
each normal exit are duplicated, labels are not given for the individual
components to save space, instead an expanded disabled dummy with labels
is provided as a Key.  Unfortunately even after this the dialogue is still
a little large and it has been suggested to replace the four radio buttons
that provide control over the door item with a combo-box with the four
fixed values...

Following support methods have been changed/added:
bool TRoom::hasExitStub(int) - modified, to provide a Boolean type result
consistent with functionality.

void TRoom::setExitStub(int, bool) - modified, remove ALL existing stub
entries for the given direction code if the second argument is false, only
adds a new entry if a corresponding one was not present - this is required
for the data storage type (QList) for stubs which could otherwise take
multiple entries for the same key (exit).  Changed second argument to
Boolean type to reflect its functionality.

bool TRoom::hasExitWeight(QString) - new, needed for the GUI to determine
source of weight data for exit.  Normally that detail is hidden from
consumers of this data.

void TRoom::setExitWeight(QString, int) - modified, to permit it to remove
data item for an exit.  Uses zero or negative weight value which
additionally aides route-finding code that consumes this data but requires
only positive weight data.  Removal of specific exit weight data permits
reversion to use of overall weight value set in ROOM's weight.

void TRoom::setDoor(QString, int) - new, implemented previously declared
but not defined code.  First argument as lower case initials for normal
exits in XY-plane and "up", "down", "in", "out" for other normal exits.
Supports special exits though no support at this point in 2D mapper for
these or non-XY-plane exits. Second argument is door type (0=none, 1=open,
2=closed, 3=locked) and value of 0 will remove instance data of any of the
other type.

int TRoom::getDoor(QString) - new, companion to setDoor, uses same first
argument to determine exit to return door code of.  Returns zero for any
exit specified which does not have a door explicitly set.

Note: Parts of code-base still access door data directly at this point,
further work required before that data could be made private to TRoom
class.

void TRoom::setArea(int) - modified, warning for room not having valid
previous area enabled.

bool TRoom::hasExit(int) - modified, method not being in use, re-purposed
to use to test for an actual exit in given normal exit direction.  Test
used is simple, fast and may produce false positives (checks only for exit
to room Id NOT being -1).  A more thorough check would be to check that
mpRoomDB->getRoom( exitId ) != 0 where exitId is value already determined
not to be -1.

bool TRoom::setExit(int, int) - new, uses a direction code as a first
argument to set the exit to the exitId given as second.  Intended to
replace individual setNorth()...setOut() series of methods in cases
requiring iteration through all normal exits.

int TRoom::getExit(int) - new, companion to the new setExit().

bool TRoom::setSpecialExitLock(QString, bool) - new, substitute for
other version which does not need to have the destination room supplied.
Unlike the void method it supplants, it provides a bool return, true on
success.

void TRoom::setSpecialExit(int, QString) - replacement for addSpecialExit()
renamed because now capable of removing a special exit if the first
argument, the exit to room Id is less than one.  Lua command
removeSpecialExit( fromRoomId, cmd ) with no normal return value added for
users' use, eliminating the need to remove all exits and re-adding all
others in order to remove or change just one.  Corresponding
addSpecialExit( fromRoomId, toRoomId, cmd ) now able to change the
toRoomId for an existing exit "cmd" from given fromRoomId room.

void TRoom::removeAllSpecialExitsToRoom(int) - modified, now ensures the
corresponding TArea::exits is updated upon removal of all the special exits
from a room.

void TRoom::auditExits() - modified, missing checks added for up and down
normal exits, and reporting for all normal exits. Code restructured to
avoid use of two "goto" commands and consequent restarts in checking of
special exits if they were to be executed.

int TRoomDB::getArea(TArea *) - commented out prior to removal, it is
mis-named as it returned an integer area Id not a TArea value, pointer or
reference.  Also it's given functionality is already provided by
int TRoomDB::getAreaID(TArea *) and the implied action by
TArea * TRoomDB::getArea(int).


Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2014-03-15 05:16:30 +00:00
Vadim Peretokin
83b0c2afcf Removed some debug information related to mapping
The amount of information being generated was enourmous and was making it really difficult to work - real warnings were being missed. I removed the main offenders as they didn't seem to be in use by anyone currently - and if need be, it can easily be re-added.
2014-01-11 09:16:43 +10:00
Vadim Peretokin
f0ffaea0c9 Removed unnused stdout on map restore - we haven't had issues selecting the latest map file to restore in years. 2014-01-06 20:38:53 +10:00
Chris Mitchell
b8e7fb61c8 variable rooms changed in TRoomDB to be QHash instead of QMap for faster lookups. 2013-12-25 11:04:23 -05:00
Chris Mitchell
134c3739cf calcSpan added to room removal, pathfinding check for starting room with exits added (Stephen Lyons). 2013-12-23 11:13:58 -05:00
Chris Mitchell
6d8878be8d Rooms defaulted to -1 as initial area, rooms removed from areas on deletion/area changes 2013-12-22 21:02:25 -05:00
Chris Mitchell
dc0ded5f31 Fixed AStar implementation to use distance heuristic and build correct graph 2013-09-26 14:19:14 -04:00
Heiko Koehn
ed1e26952d Stephen Lyons: compiler warning reduction patch 2013-07-10 11:49:48 +02:00
Heiko Koehn
bfaed1b67e misc 2013-06-12 21:44:38 +02:00
Heiko Koehn
36aba7246a FIX: force room and exit weights >= 1 2013-05-26 11:47:15 +02:00
Heiko Koehn
b076e4dbdf NEW: tab stop support, NEW: Lua func getAreaExits() FIX: line wrap bug in trigger context 2013-05-22 10:18:11 +02:00
Heiko Koehn
4e651d55fd safe mapper 2013-03-22 12:47:58 +01:00
Chris Mitchell
f4c4bb170b Bug Fix: rooms/labels/etc cleared on importing new map 2013-03-11 16:05:18 -04:00
Chris Mitchell
0be2a040c0 Bug Fix: Labels could be made with infinite size. Corrected this and created a new label attribute, clickSize 2013-03-03 12:22:58 -05:00
Heiko Koehn
053530da00 FIX: update graph on changing exit weights & strip special exit lock info 2013-01-04 01:16:34 +01:00
Heiko Koehn
88ef6491e0 NEW: mapper: exit Weights and door support: setExitWeight(roomID, dirCmd, weight), getExitWeights(), setDoor(roomID, dirCmd, doorStatus [0=no_door,1=open,2=closed,3=locked]), getDoors(roomID) 2013-01-02 19:14:09 +01:00
Heiko Koehn
c23f7a1718 misc 2012-12-30 10:11:02 +01:00
Heiko Koehn
93f659628e misc 2012-12-29 02:16:28 +01:00
Heiko Koehn
3f4315af03 NEW: mapper: createMapImageLabel() SYNTAX: int labelID = createMapImageLabel( int area, string filePath, float posx, float posy, float posz, float width, float height, float zoom, bool showOnTop=true ) 2012-12-28 18:05:12 +01:00
Heiko Koehn
4ba50e2830 NEW: major mapper upgrade part 2 new label features complete 2012-12-28 16:09:59 +01:00
Heiko Koehn
cff9923a97 NEW: sysConnectionEvent &+sysDisconnectionEvent | FIX: mapdownload from server is more resilient 2012-12-13 12:00:07 +01:00
Heiko Koehn
dcc3fbfbb1 UPDATE: Mudlet Lua API reference updated to current online version 2012-12-12 18:21:01 +01:00
Heiko Koehn
e0be122351 FIX: on broken maps not all special exit ids correspond to room ids. until the source of the problem has been found this is a workaround 2012-12-11 16:49:22 +01:00
Heiko Koehn
312a7495c6 mapper: fast map loading and map initialization 2012-05-15 23:16:58 +02:00
Heiko Koehn
1bb56676f5 mapper: map editor: room moves only after right click move again 2012-05-14 09:56:04 +02:00
Heiko Koehn
ad4a3b976b mapper: new fully featured map labels 2012-05-10 22:23:51 +02:00
Heiko Koehn
83a4e8a834 mapper: new features of the visual map editor: select custom lines and edit the points visually or delete the line with delete key|ensure custom lines are visible even if the originating room isn't 2012-05-06 03:34:07 +02:00
Heiko Koehn
c25faf4e26 Features: mapper clickable labels, move, delete|center area map on area switch|Fix:getSpecialExitSwap()|Fix:mapper GUI edit existing special exit 2012-05-04 08:44:36 +02:00
Heiko Koehn
1ff87af65d misc fixes: alias and timer package install issues | offset timer problem | misc changes 2012-04-21 22:29:17 +02:00
Heiko Koehn
55b6642edf FIX:timer packages|FIX:Alias sometimes didn't enable in packages|FIX: misc 2012-04-19 15:40:40 +02:00
Heiko Koehn
3207ccc97c FIX: special exit locking|FIX: special exit add different exit cmd to same
roomID|FIX:buttons: always run checkbox button scripts on startup, but no
other buttons
2012-04-18 12:08:31 +02:00
Heiko Koehn
9bac80c08d fix: old maps couldn't be loaded properly 2011-10-30 02:57:50 +02:00
Heiko Koehn
fec8f58627 Chris Mitchell: shared modules history and fixes for his mapper patch 2011-10-25 11:42:41 +02:00