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

Cache map option ShortGame at game load #14928

Merged
merged 1 commit into from Mar 21, 2018

Conversation

Projects
None yet
3 participants
@reaperrr
Copy link
Contributor

reaperrr commented Mar 16, 2018

To reduce MapOptions calls.

Likely negligible in the grand scheme of things, but this is also a fairly small and risk-free change (as map options don't change mid-game).

Cache map option ShortGame at game load
To reduce MapOptions calls.
{
var mapOptions = player.World.WorldActor.Trait<MapOptions>();
if (mapOptions.ShortGame)
if (shortGame)
return !player.World.ActorsHavingTrait<MustBeDestroyed>(t => t.Info.RequiredForShortGame).Any(a => a.Owner == player);
return !player.World.ActorsHavingTrait<MustBeDestroyed>().Any(a => a.Owner == player && a.IsInWorld);

This comment has been minimized.

@RoosterDragon

RoosterDragon Mar 17, 2018

Member

For my own curiosity even though it's not actually in the PR: why is a => a.Owner == player sufficient for short game, but a => a.Owner == player && a.IsInWorld required for a long game?

This comment has been minimized.

@reaperrr

reaperrr Mar 17, 2018

Author Contributor

I noticed that myself after pushing the PR. Probably short game should have && a.IsInWorld as well, but pinging @pchote in case this rings a bell somehow.

This comment has been minimized.

@pchote

pchote Mar 17, 2018

Member

Probably something to do with MCVs in transports...

This comment has been minimized.

@reaperrr

reaperrr Mar 19, 2018

Author Contributor

Ok. Since there aren't any tickets on this, I assume it's intentional and will leave it as-is.

@pchote

pchote approved these changes Mar 21, 2018

@pchote pchote merged commit f351f03 into OpenRA:bleed Mar 21, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@reaperrr reaperrr deleted the reaperrr:cache-ShortGame branch May 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.