Skip to content

Enhance: allow modification of the player room indication on 2D map#2621

Merged
SlySven merged 16 commits intoMudlet:developmentfrom
SlySven:Enhance_allowModificationOfPlayerRoomIndicatorOn2DMap
Dec 1, 2019
Merged

Enhance: allow modification of the player room indication on 2D map#2621
SlySven merged 16 commits intoMudlet:developmentfrom
SlySven:Enhance_allowModificationOfPlayerRoomIndicatorOn2DMap

Conversation

@SlySven
Copy link
Copy Markdown
Member

@SlySven SlySven commented Jun 15, 2019

This commit reorganises the 2D Painter code to draw the player room indicator AFTER all the rooms have been drawn so that it does not get overdrawn by rooms painted after the player's room - which it could be if the rooms are at maximum size or the area is in "gridMode".

It also offers some alternative marker options in the form of an oversized ring around the room which reduces the obstruction of the details of the room when the marker is drawn on it. The alternatives are:

  • a fixed red colour ring
  • a fixed blue/yellow colour ring - two contrasting colours mean that it can not be lost if drawn over a room that already has one of them as its colour (environment) setting.
  • a customizable two colour ring where the user can set the outer and inner colours as they like - even to the same colour.

This commit does not contain code to save the setting between sessions. It is intended to get peer/public evaluation of the proposal. A follow up commit will be has been appended if as this proposal is acceptable and does work.

The ancient (bool) Host::mMapStrongHighlight option is still respected, I note that it was introduced in 3cb1719 from 2011/01/20 (after Mudlet 1.0.5) and the code to control it was lost in 8b0e8bb from 2012/12/31 "NEW Vadim Peretokin: mapper remembers settings" just before the release of Mudlet 2.0...!

This may fix #2057 raised by @Eraene .

Signed-off-by: Stephen Lyons slysven@virginmedia.com

This commit reorganises the 2D Painter code to draw the player room
indicator AFTER all the rooms have been drawn so that it does not get
overdrawn by rooms painted after the player's room - which it could be
if the rooms are at maximum size or the area is in "gridMode".

It also offers some alternative marker options in the form of an oversized
ring around the room which reduces the obstruction of the details of the
room when the marker is drawn on it. The alternatives are:
* a fixed red colour ring
* a fixed blue/yellow colour ring - two contrasting colours mean that it
can not be lost if drawn over a room that already has one of them as its
colour (environment) setting.
* a customizable two colour ring where the user can set the outer and inner
colours as they like - even to the same colour.

This commit does not contain code to save the setting between sessions. It
is intended to get peer/public evaluation of the proposal. A follow up
commit will be appended if this proposal is acceptable and does work.

The ancient `(bool) Host::mMapStrongHighlight` option is still respected,
I note that it was introduced in 3cb1719
from 2011/01/20 (after Mudlet 1.0.5) and the code to control it was lost
in 8b0e8bb from 2012/12/31 "NEW Vadim
Peretokin: mapper remembers settings" just before the release of Mudlet
2.0...!

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven requested review from a team June 15, 2019 18:08
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Jun 15, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 15, 2019

Original, current code:
Screenshot_20190615_165322

Emulation of original - however drawing the indication later in the code means the exit markings within the room have been covered - to get it back we would have to have a copy of the code for them as part of the processing of the player room (making a function to do that and calling that for every room normally will slow things unless it is made an inline one):
Screenshot_20190615_160546

Red ring:
Screenshot_20190615_160630

Blue/Yellow Ring:
Screenshot_20190615_160710

Custom ring with green and magenta colours:
Screenshot_20190615_160821

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jun 15, 2019

I have a different take on doing this - what if we allow people to set a custom image in place of the marker? That would be way more flexible than the current and proposed ring system, yet still relatively easy to code and for people to use.

@Eraene
Copy link
Copy Markdown
Contributor

Eraene commented Jun 15, 2019

This seems like a good change. I'm a little concerned the ring is too large, as it covers up adjacent rooms just slightly (and their exits), but it's a large step in the right direction.

As for a custom image @vadi2 - I'm not so sure. The idea of sailing the internet just to find an image to replace the marker that I don't like doesn't seem enticing to me.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 16, 2019

Also you would also need an image with a degree of transparency - and I do not imaging that there is a large proportion of stock images with that characteristic - remember .jpg just doesn't handle transparently and .gif can only set pixels of particular pixel colour to wholly transparent so you are pretty much talking only of .png ...

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 16, 2019

... I'm a little concerned the ring is too large,..

A (couple of) spin-box(es) to set the outer (and inner) diameters might help there but you, Vadim, have previously reminded us to be really careful about adding more knobs and switches... 😟

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jun 16, 2019

Yeah, perhaps not on the general settings screen but hide the very rarely-used options behind pop-up menu. I don't foresee too many customising this given how few have asked to change it over the years.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 16, 2019

Well I've added controls to set the size and also added alpha (transparency) controls to the custom colours which means that it can be adjusted to NOT obscure details - though what those might be can vary I guess between users' preferences for maps.

For instance grid mode maps perhaps will have different requirements than those with exits and where there is at least one (or two) room spaces between adjacent rooms - that is why I doubt there is one setting that everyone will think is the best...

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jun 16, 2019

👍

Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like 👍 thanks for adding this!

@vadi2 vadi2 assigned SlySven and unassigned vadi2 Jun 24, 2019
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 24, 2019

It is still a Work-honestly-In-my-Plans-even-yesterday (WhImPey)... 😁 - it needs the settings to be save/loaded between session...

... also I would like to try and find a way to draw the player room last so then I can put it back to where it was before but avoid other rooms being painted from overwriting the new stuff. The quick and dirty fix would be to convert the (QSet<int>) TArea::rooms into a QList<int> for each T2DMap::paintEvent(...) call and then, if the player room is found in that during the iteration through it to skip painting it then and to append it to the end of the list - this would probably be simpler but be less efficient code compared to refactoring out the whole of the per room paint code to an inline method and then calling it with the player room after the iteration through all the other rooms ...

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jun 25, 2019

Hm... yes, let's just paint the room on top after instead of keeping changing the datastructures we use a lot.

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 25, 2019

Actually the refactoring isn't too bad and it does allow the paintEvent code to appear to be smaller (by shunting it off to an inlined {I hope} method - and the benefit of not overwriting the player room markings does seem worth it...

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 25, 2019

Oh, b****r - I had two parallel repositories (so I can run side by side comparisons of my work in progress code against the main line one) both open in Qt Creator - and I did the refactoring on the wrong repository's code! 🤦‍♂️

This is done by extracting the relevant room drawing code to a separate
inline function that is used whilst iterating through the area rooms to
paint them, skipping but noting if the player room is found and then that
function is used to paint the player's room afterwards.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 26, 2019

It turns out that using auto in a function prototype is a GCC extension to C++14 and the Clang compiler objects to it. (It was being used where a QPen reference/value was being passed to the new inline T2DMap::drawRoom(...)) It was inserted automagically by the latest Qt Creator extract function refactor operation so might need to be watched out for in the future...

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Jun 26, 2019

Good to know!

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 26, 2019

I'll see if I can fix it this morning - whilst on a 2 hour train to pick up a replacement 🚗 from a parent - I've reserved a Window seat with a table so should have power and WiFi on the way... 😀

The clang compiler does not like `auto` being used as a type in function
prototypes as it is not formally part of the C++14 standard but a GCC
extension - it got put in by the Qt Creator function extraction code
option on the refactor menu.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Eraene mind testing the final version?

// player's room and then, AFTER all those have been drawn, once for the
// player's room if it is visible. This is so it is drawn LAST (and any effects,
// or extra markings for it do not get overwritten by the drawing of the other
// rooms)...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this comment is needed. We don't need the history of the code as a comment (we can look at git history for that) and we can tell the function is used in two places by looking at usages. Long comments don't really help in readability, plus it's only you who'd be interested in keeping it up to date...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, not every usage of the source code is going to be from a git repository, but I take your point - how about if I reduced it to a one-liner along the lines of:

// We need to ensure the player's room is drawn last so that any oversized parts of it don't get overwritten by other rooms....

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, and that should be at the point where this function is called for that reason - not at the function definition (doesn't make sense there)

bool __Pick = mPick;
// As it happens this local is never changed in this method so it can be
// made const:
const bool __Pick = mPick;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bool __Pick = mPick;
const bool pick = mPick;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Whoever thought to using a double leading underscore is heading for trouble as far as I can see, e.g. https://stackoverflow.com/questions/224397/why-do-people-use-double-underscore-so-much-in-c - mind you, I think I have used them in the qmake project file but then that is not text that is parsed by the compiler/linker...

@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 28, 2019

@Eraene mind testing the final version?

Not the final version yet I am afraid - got to get "saving-to" and "loading-from" the game saves working and it is a bit awkward as the TMap (and the mapper classes) do not necessarily get instantiated when the the profile is being read.

<ASIDE>This means the settings have to be stored in the Host class whereas currently they are in the TMap one - furthermore, since we seem to be trying to protect the Host class from conflicting access from more than one thread with a (QMutex) Host::mLock it is desirable to not access that class's member variables more than is necessary {which is why I've just raised #2673 which suggests a way to reduce the risk of deadlock there} so ideally I should continue to use the copy of the settings in the TMap class for map painting but keep them synced with the master ones held in the Host class...</ASIDE>

They are saved with the profile's data rather than the map.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven assigned vadi2 and unassigned SlySven Jun 28, 2019
@SlySven
Copy link
Copy Markdown
Member Author

SlySven commented Jun 28, 2019

Okay - finally got the save and load working.

Can you okay this now @vadi2 ?

Helpful hint no. 42: using pugixml::append_attribute(<attribute name>) more than once on the same node with the same attribute name produces invalid XML - but as pugixml is a lightweight ("speedy"?) library it does not check for such unnatural acts {see https://github.com/zeux/pugixml/issues/269} and the Qt QXmlStreamReader class will only report that such an element with a duplicate attribute is an element of a tokenType() that is QXmlStreamReader::Invalid instead of QXmlStreamReader::StartElement.

The moral of this is - if adding a new attribute to one of the elements that are exported in an Mudlet XMLexport method ensure you do not forget to edit the attribute name if you copy and paste an existing append_attribute(...) line of code. 😱

Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well but I think there are improvements we can make to the code it make it less confusing, see below.

src/Host.h Outdated
// An invalid/null value is treated as the "show all"/inactive case:
QTime mTimerDebugOutputSuppressionInterval;

// This hold copies of variables from the TMap class which are saved with
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a confusing comment and we shouldn't have it - it's the Host class that stores the application settings in Mudlet. Other classes should reference Host for the settings they need, not the other way around.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't evolve like that! When I started this PR I hadn't contemplated the load/save of the settings - though in hindsight that comment does need revision..

src/Host.h Outdated
QColor mPlayerRoomColorPrimary;
QColor mPlayerRoomColorSecondary;
// Mode selected - 0 is closest to original style:
quint8 mPlayerRoomStyle;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deliberate limit on something with less than a handful of choices (four), and it is much safer to convert between integer representations of numbers of different bitnesses for unsigned integers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to go exactly against the best practice mentioned above?

// player's room and then, AFTER all those have been drawn, once for the
// player's room if it is visible. This is so it is drawn LAST (and any effects,
// or extra markings for it do not get overwritten by the drawing of the other
// rooms)...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, and that should be at the point where this function is called for that reason - not at the function definition (doesn't make sense there)

src/T2DMap.cpp Outdated
// player's room if it is visible. This is so it is drawn LAST (and any effects,
// or extra markings for it do not get overwritten by the drawing of the other
// rooms)...
inline void T2DMap::drawRoom(QPainter& painter, QFont& roomVNumFont, QPen& pen, TRoom* pRoom, TArea* pArea, const int currentRoomId, const bool isFontBigEnoughToShowRoomVnum, const int playerRoomId, const float rx, const float ry, const bool picked)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function signature is a monster with many tentacles: I think if we gave anyone drawRoom(painter, roomVNumFont, pen, room, pArea, currentAreaRoom, isFontBigEnoughToShowRoomVnum, playerRoomId, rx, ry, __Pick); to look at, they'd have no clue what they were looking at. Let's improve it!

Can't currentRoomId be derived from pRoom inside the function? Or something like that - we have 3 arguments that all talk about the room, at least one should go.

pArea is only checked for gridMode - that should be passed in as a boolean to make the function interface more intuitive.

isFontBigEnoughToShowRoomVnum - no to yoda speak and 30 character variables! roomTextfits would work fine, observe:

if (mShowRoomID && roomTextfits) {

And it wouldn't even need the comment it has right now, because it would be self-explanatory.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The many tentacles come from me using the refactor code to extract a large chunk of code from the paintEvent code but not spending enough time to refine out all the extraneous bits - the use of pArea to get the gridmode setting does sound sensible, getting currentAreaRoom from pRoom also; roomTextFits though - what text - there is a symbol is that the text it means - fair enough I will have a think on that and find something we both can agree on...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😟 Oh, I haven't done much with this. Lemme have another look at it...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... okay take a look at the latest commit: 010f8b4 !

src/T2DMap.cpp Outdated
if (mpMap->mpRoomDB->getRoom(mTarget)) {
mpMap->mTargetID = mTarget;
if (mpMap->findPath(playerRoomId, mpMap->mTargetID)) {
mpHost->startSpeedWalk();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the function to draw a single room on a map calling startSpeedWalk()? That doesn't seem to make sense. Need to fix this in a follow-up PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Nope, that is actually starting the speed walk route calculation - because the current room being painted has been determined to be close enough to where the mouse was double-clicked on the map to be the destination for the speed walk. Incidentally the use of the playerRoomId is because that is the starting point for the speed walk route. Also, the destination room for the speedwalk gets drawn with a red-circle on it for just that one paint event.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As part of the previous point #2621 I happened to refactor this code out to a separate initiateSpeedWalk(...) helper! 👼

src/TMap.cpp Outdated

void TMap::initialiseMembersFromHost()
{
mPlayerRoomColorPrimary = mpHost->mPlayerRoomColorPrimary;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we copying that into this class?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally wrote the code on the basis of having the settings in the TMap class - because they are associated with the map strangely enough 😉 - but then I worked out that they would need to be stored as part of the profile and thus as part of the Host class. I am aware that some of the members of that class are protected by a QMutex but it is not entirely clear why those particular ones are so protected; and rather than having to read the settings from that class for every T2DMap::paintEvent() I felt it was safer to work from copies held in the TMap class and only access the master ones in Host when they needed to be changed or used to initialise the copies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're the one who put a QMutex on them... if we don't need it anymore, lets take it off?

Seems to make sense not to complicate things with forgotten mutexes and then copying things around...

void dlgProfilePreferences::slot_setPlayerRoomSecondaryColor()
{
Host* pHost = mpHost;
if (!pHost || !mpHost->mpMap || !mpHost->mpMap->mpMapper || !mpHost->mpMap->mpMapper->mp2dMap) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting should be adjustable even when the map isn't open, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debatable, I think. After all why show the controls if you are Mudding without a map - I know I wouldn't but not everyone thinks like that...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well - because you haven't yet opened the map?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, looking at how the code is structured that slot directly alters the 2D mapper by calling a method in the T2DMap class - which can't happen if there is no map loaded. Going to have to rethink this...

@vadi2 vadi2 assigned SlySven and unassigned vadi2 Jun 29, 2019
@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Sep 5, 2019

@SlySven ping

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Oct 13, 2019

👋 :)

As the `TMap` members being initialised are (now) public they can assigned
values from the Host members they are caching directly in the
`mudlet::createMapper(...)` method. In that method - since there are many
uses of `(TMap*) pHost->mpMap` it is sensible to create a shorter named
variable `pMap` to hold that pointer value.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
…IndicatorOn2DMap

Conflicts resolved in:
* src/Host.cpp
* src/Host.h
* src/T2DMap.cpp
* src/T2DMap.h
* src/dlgProfilePreferences.cpp
* src/dlgProfilePreferences.h
* src/mudlet.cpp

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
They were only being written to the cached values in the TMap instance so
were not being stored when the profile was saved.

Also the default output from `QColor::name()` does NOT contain any alpha
component so that was not being stored either when the profile was being
saved.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
It is not possible to just colour the background of the `QPushButton`s that
set the custom colours to use for the *custom* player room marker as the
transparency effects do not show. Instead this commit arranges for an icon
with a black-and-white checker board pattern is over-painted with a brush
in the relevant colour so that when the opacity is less than 100% the
pattern is shown to an extent which is proportional to the degree of
transparency of the colour chosen.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Copy link
Copy Markdown
Member

@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well! I love the realtime feedback so you can do the settings adjustment quicker.

… code

Suggested in peer review comment:
Mudlet#2621

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven merged commit 56c363d into Mudlet:development Dec 1, 2019
@SlySven SlySven deleted the Enhance_allowModificationOfPlayerRoomIndicatorOn2DMap branch December 1, 2019 14:36
SlySven added a commit to SlySven/Mudlet that referenced this pull request Dec 2, 2019
…alised

Forgot this when I was producting Mudlet#2621 as I tend to use the other form of
the map in a floating/dockable window.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
SlySven added a commit that referenced this pull request Dec 4, 2019
…alised

Forgot this when I was producting #2621 as I tend to use the other form of
the map in a floating/dockable window.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
dicene pushed a commit to dicene/Mudlet that referenced this pull request Feb 19, 2020
…udlet#2621)

This is a squash-and-merge of a number of commits with the following
edited summary:

This PR reorganises the 2D Painter code to draw the player room
indicator AFTER all the rooms have been drawn so that it does not get
overdrawn by rooms painted after the player's room - which it could be
if the rooms are at maximum size or the area is in "gridMode".

It also offers some alternative marker options in the form of an oversized
ring around the room which reduces the obstruction of the details of the
room when the marker is drawn on it. The alternatives are:
* a fixed red colour ring
* a fixed blue/yellow colour ring - two contrasting colours mean that it
can not be lost if drawn over a room that already has one of them as its
colour (environment) setting.
* a customizable two colour ring where the user can set the outer and inner
colours as they like - even to the same colour.

The ancient `(bool) Host::mMapStrongHighlight` option is still respected,
I note that it was introduced in 3cb1719
from 2011/01/20 (after Mudlet 1.0.5) and the code to control it was lost
in 8b0e8bb from 2012/12/31 "NEW Vadim
Peretokin: mapper remembers settings" just before the release of Mudlet
2.0...!

Refactor: ensure player room is drawn last

This is done by extracting the relevant room drawing code to a separate
inline function that is used whilst iterating through the area rooms to
paint them, skipping but noting if the player room is found and then that
function is used to paint the player's room afterwards.

Revise: made code acceptable to all compilers

The clang compiler does not like `auto` being used as a type in function
prototypes as it is not formally part of the C++14 standard but a GCC
extension - it got put in by the Qt Creator function extraction code
option on the refactor menu.

Revise: allow player room marking customisation to be saved and restored

They are saved with the profile's data rather than the map.

Revise: show transparency effects in custom player room marker colours

It is not possible to just colour the background of the `QPushButton`s that
set the custom colours to use for the *custom* player room marker as the
transparency effects do not show. Instead this commit arranges for an icon
with a black-and-white checker board pattern is over-painted with a brush
in the relevant colour so that when the opacity is less than 100% the
pattern is shown to an extent which is proportional to the degree of
transparency of the colour chosen.

Refactor: extract code to start 2D map speed-walk & simplify drawRoom code

Suggested in peer review comment:
Mudlet#2621

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
dicene pushed a commit to dicene/Mudlet that referenced this pull request Feb 19, 2020
…alised

Forgot this when I was producting Mudlet#2621 as I tend to use the other form of
the map in a floating/dockable window.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
@SlySven SlySven restored the Enhance_allowModificationOfPlayerRoomIndicatorOn2DMap branch June 22, 2020 18:06
@SlySven SlySven deleted the Enhance_allowModificationOfPlayerRoomIndicatorOn2DMap branch June 22, 2020 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request: Customizable "You are here" dot on mapper

3 participants