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 support for campaign status #1681

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kubaau
Copy link
Contributor

@kubaau kubaau commented Jul 23, 2024

Adds support for Roman-style (video) campaigns and the world campaign (video).

Fixed world campaign scripts to unlock the same continents as it was in S2.

Related to issues #1639 and #1177

@Spikeone
Copy link
Member

Either I'm blind or the implementation is somewhere else? What is rttr:SetCampaignChapterCompleted good for?

@kubaau
Copy link
Contributor Author

kubaau commented Jul 26, 2024

Either I'm blind or the implementation is somewhere else? What is rttr:SetCampaignChapterCompleted good for?

It doesn't make a difference in Roman-style campaigns, but it marks a continent as conquered in the world campaign. It could also be used for other campaign types as well if we wanted to show what was completed, especially if someone designs a campaign whose progression is not linear.

Edit: For roman-style campaigns it shows the "You have successfully completed chapter X." screen after ending the game.

Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

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

Awesome, the last bit for campaigns! Review inline.

General hint: Try to make best use of the type system. E.g. "unsigned char" is/should be a (text-)character (although only since C++11 introduced uint8_t) And using this narrow width number-type as parameters likely introduces overhead (registers are wider so often need to be masked) so it is even faster to just use unsigned there.
Similar for string which should be text. It can be stored in the config as a string for brevity but converted during load/save to a more appropriate type, especially when (scoped) enums can be used.

In general I like the changes, thanks! :)

libs/libGamedata/gameData/CampaignSaveCodes.h Outdated Show resolved Hide resolved
libs/libGamedata/gameData/CampaignDescription.h Outdated Show resolved Hide resolved
libs/s25main/CampaignSaveData.cpp Outdated Show resolved Hide resolved
libs/s25main/CampaignSaveData.h Outdated Show resolved Hide resolved
libs/s25main/CampaignSaveData.cpp Outdated Show resolved Hide resolved

BOOST_FIXTURE_TEST_CASE(Chapters0and1AreEnabledByDefault, CampaignSaveDataFixture)
{
saveData[uid] = CampaignSaveCodes::defaultChaptersEnabled;
Copy link
Member

Choose a reason for hiding this comment

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

So the default is to enable the first 2 chapters? Why that? Wouldn't (only) the first one be a more sensible default?
I'm also a bit confused as you seem to be using indices and 1-based values for chapters

Maybe stick to indices and use an optional instead of zero

tests/s25Main/campaign/testCampaignSaveData.cpp Outdated Show resolved Hide resolved
tests/s25Main/campaign/testCampaignSaveData.cpp Outdated Show resolved Hide resolved
tests/s25Main/lua/testLua.cpp Outdated Show resolved Hide resolved
libs/libGamedata/gameData/CampaignDescription.cpp Outdated Show resolved Hide resolved
@kubaau kubaau marked this pull request as draft December 25, 2024 21:11
@kubaau
Copy link
Contributor Author

kubaau commented Dec 25, 2024

Rework in progress - converting to draft, will notify when ready for review. Resolving some conversations since they will not be relevant.

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.

3 participants