Skip to content

Conversation

stavrosfa
Copy link
Contributor

Besides the tile ownership, I implemented the Engineering effect of bridging rivers with roads. It seemed logical to include it in there since it affects tile movement cost.

Copy link
Contributor

@TomWerner TomWerner left a comment

Choose a reason for hiding this comment

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

Very nice, thank you!

}

public static float getMovementCost(Tile from, TileDirection dir, Tile newLocation) {
public static float GetMovementCost(MapUnit unit, Tile from, TileDirection dir, Tile newLocation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the only thing needed from the mapunit here is the owner - could we follow the law of Demeter and just pass the player in?

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 get your point, but I will have to disagree on that one. How would we implement something like the Privateer as a land unit (like a spy or something)? Or even the Privateer if we decide to make enemy ocean tiles cost more (and this wouldn't apply to the Privateer)?
And as I am writing this, I am thinking of the Marine unit, maybe it has some implications there as well (or similar unit in the future)?

Copy link
Contributor

Choose a reason for hiding this comment

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

We would pass some bit of information about the unit if/when we implement something like marines.

I don't feel super strongly about this, just pointing out that it tends to result in less coupled code.

Player targetTileOwner = targetTile.OwningPlayer();
Player sourceTileOwner = sourceTile.OwningPlayer();

// any to any && any to own && own to any && own to own
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd personally find a comment like this a bit easier to understand:

// We are free to move if:
// - the tile we are on is unowned, or we own the tile
// - and the tile we are moving to is unowned, or we own the tile

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's better, I just wrote it like this cause it made sense to me in the heat of the moment, I will change it

@esbudylin esbudylin linked an issue Oct 9, 2025 that may be closed by this pull request
@esbudylin esbudylin merged commit 84aa539 into C7-Game:Development Oct 13, 2025
3 checks passed
stavrosfa added a commit to stavrosfa/C7-Prototype that referenced this pull request Oct 13, 2025
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.

Make movement aware of tile owners

3 participants