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

Martial faction points #79

Merged

Conversation

valdisz
Copy link
Contributor

@valdisz valdisz commented Nov 21, 2021

This PR merges War and Trade points into Martial points. Activity tracking is made more flexible in the code.
Faction points are defined during runtime and are using vector.

#71

@valdisz valdisz changed the base branch from master to neworigins November 21, 2021 09:29
@valdisz valdisz marked this pull request as ready for review November 21, 2021 16:40
@valdisz valdisz force-pushed the flexible-faction-points branch from e80411e to 7ee907c Compare November 21, 2021 16:45
Copy link
Member

@artyomtrityak artyomtrityak 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, did you run tests in a local game?

"Trade",
"Magic"
};
const std::string F_WAR = "War";
Copy link
Member

Choose a reason for hiding this comment

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

why do we changing this to std string?

Copy link
Contributor Author

@valdisz valdisz Nov 22, 2021

Choose a reason for hiding this comment

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

So that there is no unexpected behavior in using strings with STD containers as I don't trust AString. std::string is better in all aspects and there are no problems to convert it into AString.

std::string is available since 1998. It existed already when Atlantis code was written. AString should not exist then, and it is wrong to use it now.

}

bool Faction::IsActivityRecorded(ARegion *region, FactionActivity type) {
auto regionActivity = this->activity[region];
Copy link
Member

Choose a reason for hiding this comment

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

was it pushed "as it is" or changes to auto?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IsActivityRecorded is a new function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

auto does not mean that variable will have a dynamic type or something. It just tells that compiler should infer type during compilation. It is the same as var in C# or Java.

No need to write long type names if the compiler knows them.

F_MAGIC,
NFACTYPES
};
extern const std::string F_WAR;
Copy link
Member

Choose a reason for hiding this comment

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

if we change FWAR to enum, can we keep the same AString?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would be more afraid of using AString instead of std::string.

The enum will make code more complicated because it will need those constants anyway (to be used in parsing) and it will need mapping.

@@ -58,6 +58,11 @@ static int ag[] = { 0, 1, 2, 4, 6, 10 };
int *allowedTacticians = ag;
int allowedTacticiansSize = sizeof(ag) / sizeof(ag[0]);

// allowed Martial activity
static int ma[] = { 0, 10, 25, 40, 60, 90 };
Copy link
Member

Choose a reason for hiding this comment

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

why do we need this here if it is off?

Copy link
Contributor Author

@valdisz valdisz Nov 22, 2021

Choose a reason for hiding this comment

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

Otherwise, code won't compile and all other rulesets will be broken.

@arriveby
Copy link

arriveby commented Nov 22, 2021 via email

@valdisz
Copy link
Contributor Author

valdisz commented Nov 22, 2021

looks good, did you run tests in a local game?

Yes, was working fine. Need to admit that this was not quite big test game.

@artyomtrityak artyomtrityak merged commit 18b51a6 into Atlantis-PBEM:neworigins Nov 29, 2021
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