(release 30)enhance add area and map user data structures#279
Merged
SlySven merged 6 commits intoMudlet:release_30from Jan 1, 2016
Merged
Conversation
Member
Author
|
🚧 I think I may have to revert that last commit so it can be replaced by #283 instead. 🚧 |
…ands
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>
This helps with the Travis C.I. which is currently using Qt 5.0.2 for linux testing and thus fails with the QComboBox::currentData() used in the previous commits. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…ject The linux build does a qmake build before it does a cmake one - this sames to be unnecessary. A warning message from the MacOs C.I. builds advises that the Qt5 installation on the Travis host is a "keg" build and that the command "brew linkapps qt" is advisable and/or including in the environment: LDFLAGS += -L/usr/local/opt/qt5/lib CPPFLAGS += -I/usr/local/opt/qt5/include The CI control file .travis was missing from the Qt project file src.pro. Also there was a couple of tweaks needed there for the QMAKE_CXX_FLAGS: the release one needed to have any preset optimisatin flags removed before we set our own (-03) for the RELEASE one and we do not need to put in -g for the DEBUG one (QT puts THAT in automatically). Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…er) PR Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
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>
I accidentally included this in previous commit. Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
cda81c5 to
ab05692
Compare
Member
Author
Member
|
+1 |
SlySven
added a commit
that referenced
this pull request
Jan 1, 2016
…pUserDataStructures (release 30)enhance add area and map user data structures
mehulmathur16
pushed a commit
to mehulmathur16/Mudlet
that referenced
this pull request
Feb 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first commit is actually #277.Evaporated from here as it has already been merged.The
secondfirst is the purpose of this PR. See it's comments for the details but its primary purpose is to provide data storage on a per area and a whole map basis in the same manner as the per room TRoom::userData member. I have a use for this to hold extra attributes found during importation of Xml Map files but I realised that there is a more general usefulness to being able to store these types of data within the map; just a couple of random examples of the top of my head would be, for areas: the name of a piece of background music to play whilst in that area and for the map: a history of edits or - for a profile that is used for more than one character from within the same profile, saving of pertinent details for each of the characters {like, where they were when last saved}. This is not to say there are not other ways to do the same things but it seems a logical extension to an existing (per room) system.