Commit fb79c62
committed
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 some
where 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"}.
Added to TLuaInterpreter class to provide following user script commands:
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...
==========================================================================
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.
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Conflicts:
src/src.pro1 parent c3b9ec0 commit fb79c62
9 files changed
Lines changed: 1238 additions & 232 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
0 commit comments