Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to toggle monthly artifact change in black market #341

Merged
merged 3 commits into from Jul 14, 2017

Conversation

dydzio0614
Copy link
Member

@dydzio0614 dydzio0614 commented Jul 13, 2017

EDIT: Implemented as "hardcoded feature".
Fixes mantis #2714.

Copy link
Member

@alexvins alexvins left a comment

Choose a reason for hiding this comment

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

If you want to keep comment about this bug, leave method empty and put comment there.

@DjWarmonger
Copy link
Member

Well, this is a feature borrowed from H5 (similiar to dwellings accumulate creatures).

@ArseniyShestakov
Copy link
Member

As Warmonger noted this kind of feature of VCMI.
You might want to instead make it option in "hardcodedFeatures".

@ArseniyShestakov
Copy link
Member

And then it's need to be added on Wiki too:
https://wiki.vcmi.eu/index.php?title=Game_mechanics


template <typename Handler> void serialize(Handler &h, const int version)
{
h & data & CREEP_SIZE & WEEKLY_GROWTH & NEUTRAL_STACK_EXP & MAX_BUILDING_PER_TURN;
h & DWELLINGS_ACCUMULATE_CREATURES & ALL_CREATURES_GET_DOUBLE_MONTHS &
MAX_HEROES_AVAILABLE_PER_PLAYER & MAX_HEROES_ON_MAP_PER_PLAYER;
if(version >= 756)
{
Copy link
Member

Choose a reason for hiding this comment

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

If you didn't do that yourself please disable this automatic curly brackets removal. In many cases it's makes sense to avoid or remove them, but serialization compatibility code is not one of those places.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I removed these on purpose as they stick to my code where I used "no bracket style" and changing that does not ruin PR readability

Copy link
Member

Choose a reason for hiding this comment

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

I think we should always use brackets in serialization code, but it's all about it.

Copy link
Member Author

Choose a reason for hiding this comment

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

So should I change to brackets?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I'll probably have to write something about that on wiki.
I not sure if we have any article about compatibility code yet.

saa.id = id.getNum();
cb->pickAllowedArtsSet(saa.arts, rand);
cb->sendAndApply(&saa);
if(VLC->modh->settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE && cb->getDate(Date::DAY_OF_MONTH) == 1) //new month and feature enabled
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to use dedicated if instead:

if(!VLC->modh->settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)
	return;

So it's easier to understand is some very special hardcoded option and not just one of parameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, though apart from this pull request - isn't it better practice to use "if" for main code logic and leave the rest for automatic return instead of explicitly quitting from function at beginning?

Copy link
Member

Choose a reason for hiding this comment

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

I personally don't have any strong opinion on that topic, but I think it's depend on what is your code doing. If it's some kind of rules checking or input validation there nothing wrong with multiple checks instead of large one.

@ArseniyShestakov ArseniyShestakov added the advmap Issues involving adventure map label Jul 13, 2017
@ArseniyShestakov
Copy link
Member

Should be merged after #323.

@dydzio0614 dydzio0614 changed the title Fix mantis #2714 Give option to enable/disable monthly artifact change in black market Jul 14, 2017
@dydzio0614 dydzio0614 changed the title Give option to enable/disable monthly artifact change in black market Add option to turn on/off monthly artifact change in black market Jul 14, 2017
@dydzio0614 dydzio0614 changed the title Add option to turn on/off monthly artifact change in black market Add option to toggle monthly artifact change in black market Jul 14, 2017
@ArseniyShestakov ArseniyShestakov merged commit 98140aa into vcmi:develop Jul 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advmap Issues involving adventure map lib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants