Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions C7/C7.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=chokepoints/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=civilopedia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=civs/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
28 changes: 14 additions & 14 deletions C7/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public override void _Ready() {

// Set initial camera location. If the UI controller has any cities, focus on their capital. Otherwise, focus on their
// starting settler.
if (controller.cities.Count > 0) {
City capital = controller.cities.Find(c => c.IsCapital());
if (controller.Cities.Count > 0) {
City capital = controller.Cities.Find(c => c.IsCapital());
if (capital != null)
mapView.centerCameraOnTile(capital.location);
} else {
MapUnit startingSettler = controller.units.Find(u => u.unitType.actions.Contains(C7Action.UnitBuildCity));
MapUnit startingSettler = controller.Units.Find(u => u.unitType.actions.Contains(C7Action.UnitBuildCity));
if (startingSettler != null)
mapView.centerCameraOnTile(startingSettler.location);
}
Expand Down Expand Up @@ -155,7 +155,7 @@ public void processEngineMessages(GameData gameData) {
switch (msg) {
case MsgStartUnitAnimation mSUA:
MapUnit unit = gameData.GetUnit(mSUA.unitID);
if (unit != null && (controller.tileKnowledge.isTileKnown(unit.location) || controller.tileKnowledge.isTileKnown(unit.previousLocation))) {
if (unit != null && (controller.TileKnowledge.isTileKnown(unit.location) || controller.TileKnowledge.isTileKnown(unit.previousLocation))) {
// TODO: This needs to be extended so that the player is shown when AIs found cities, when they move units
// (optionally, depending on preferences) and generalized so that modders can specify whether custom
// animations should be shown to the player.
Expand All @@ -173,7 +173,7 @@ public void processEngineMessages(GameData gameData) {
int x, y;
gameData.map.tileIndexToCoords(mSEA.tileIndex, out x, out y);
Tile tile = gameData.map.tileAt(x, y);
if (tile != Tile.NONE && controller.tileKnowledge.isTileKnown(tile))
if (tile != Tile.NONE && controller.TileKnowledge.isTileKnown(tile))
animTracker.startAnimation(tile, mSEA.effect, mSEA.completionEvent, mSEA.ending);
else {
if (mSEA.completionEvent != null)
Expand All @@ -193,9 +193,9 @@ public void processEngineMessages(GameData gameData) {
// handling cases like 1 city elimination, regicide, settlers that
// are still alive, etc.
if (mCD.city.owner.RemainingCities() == 0) {
popupOverlay.ShowPopup(new CivilizationDestroyed(mCD.city.owner.civilization), PopupOverlay.PopupCategory.Advisor);
for (int i = 0; i < mCD.city.owner.units.Count; ++i) {
MapUnitExtensions.disband(mCD.city.owner.units[i]);
popupOverlay.ShowPopup(new CivilizationDestroyed(mCD.city.owner.Civilization), PopupOverlay.PopupCategory.Advisor);
for (int i = 0; i < mCD.city.owner.Units.Count; ++i) {
MapUnitExtensions.disband(mCD.city.owner.Units[i]);
}
}
break;
Expand All @@ -213,7 +213,7 @@ public void processEngineMessages(GameData gameData) {
// F6 is the science advisor.
// TODO: Move the F* key strings to a set of constants/enum.
EmitSignal(SignalName.ShowSpecificAdvisor, "F6");
Tech tech = gameData.techs.Find(x => x.id == gameData.GetHumanPlayers()[0].currentlyResearchedTech);
Tech tech = gameData.techs.Find(x => x.id == gameData.GetHumanPlayers()[0].CurrentlyResearchedTech);

// TODO: calculate research speed.
EmitSignal(SignalName.UpdateTechProgress, tech.Name, -1);
Expand Down Expand Up @@ -287,7 +287,7 @@ public override void _Process(double delta) {

// If "location" is not already near the center of the screen, moves the camera to bring it into view.
public void ensureLocationIsInView(Tile location) {
if (controller.tileKnowledge.isTileKnown(location) && location != Tile.NONE) {
if (controller.TileKnowledge.isTileKnown(location) && location != Tile.NONE) {
Vector2 relativeScreenLocation = mapView.screenLocationOfTile(location, true) / mapView.getVisibleAreaSize();
if (relativeScreenLocation.DistanceTo(new Vector2((float)0.5, (float)0.5)) > 0.30)
mapView.centerCameraOnTile(location);
Expand Down Expand Up @@ -342,7 +342,7 @@ private void OnPlayerStartTurn() {
int turnNumber = TurnHandling.GetTurnNumber();
Player player = gameDataAccess.gameData.GetHumanPlayers()[0];

EmitSignal(SignalName.TurnStarted, turnNumber, player.gold, /*goldPerTurn=*/0);
EmitSignal(SignalName.TurnStarted, turnNumber, player.Gold, /*goldPerTurn=*/0);
CurrentState = GameState.PlayerTurn;

GetNextAutoselectedUnit(gameDataAccess.gameData);
Expand Down Expand Up @@ -510,12 +510,12 @@ public override void _UnhandledInput(InputEvent @event) {
gameDataAccess.gameData.observerMode = !gameDataAccess.gameData.observerMode;
if (gameDataAccess.gameData.observerMode) {
foreach (Player player in gameDataAccess.gameData.players) {
player.isHuman = false;
player.IsHuman = false;
}
} else {
foreach (Player player in gameDataAccess.gameData.players) {
if (player.id == EngineStorage.uiControllerID) {
player.isHuman = true;
if (player.Id == EngineStorage.uiControllerID) {
player.IsHuman = true;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion C7/Map/BorderLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override void drawObject(LooseView looseView, GameData gameData, Tile til
{ TileDirection.SOUTHEAST, 6 }
};

Color borderColor = Util.LoadColor(tile.owner.colorIndex);
Color borderColor = Util.LoadColor(tile.owner.ColorIndex);

foreach (var entry in directionToTextureIdx) {
if (tile.neighbors[entry.Key].owner != tile.owner) {
Expand Down
2 changes: 1 addition & 1 deletion C7/Map/CityLabelScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private Image CreateLabelBackground(int cityLabelWidth, City city, int textAreaW
Image labelImage = Image.Create(cityLabelWidth, CITY_LABEL_HEIGHT, false, Image.Format.Rgba8);
labelImage.Fill(Color.Color8(0, 0, 0, 0));
byte transparencyLevel = 192; //25%
Color civColor = Util.LoadColor(city.owner.colorIndex);
Color civColor = Util.LoadColor(city.owner.ColorIndex);
civColor = new Color(civColor, transparencyLevel);
Color civColorDarker = Color.Color8(0, 0, 138, transparencyLevel); //todo: automate the darker() function. maybe less transparency?
Color topRowGrey = Color.Color8(32, 32, 32, transparencyLevel);
Expand Down
2 changes: 1 addition & 1 deletion C7/Map/FogOfWarLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public FogOfWarLayer() {

public override void drawObject(LooseView looseView, GameData gameData, Tile tile, Vector2 tileCenter) {
Rect2 screenTarget = new Rect2(tileCenter - tileSize / 2, tileSize);
TileKnowledge tileKnowledge = gameData.GetHumanPlayers()[0].tileKnowledge;
TileKnowledge tileKnowledge = gameData.GetHumanPlayers()[0].TileKnowledge;
//N.B. FogOfWar.pcx handles both totally unknown and fogged tiles, indexed in the same file.
//Hence the trinary math rather than the more commonplace binary.
if (!tileKnowledge.isTileKnown(tile)) {
Expand Down
2 changes: 1 addition & 1 deletion C7/Map/UnitLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void drawUnitAnimFrame(LooseView looseView, MapUnit unit, MapUnit.Appeara
Vector2 position = tileCenter + animOffset - new Vector2(0, inst.FrameSize(animName).Y / 4);
inst.SetPosition(position);

Color civColor = Util.LoadColor(unit.owner.colorIndex);
Color civColor = Util.LoadColor(unit.owner.ColorIndex);
int nextFrame = inst.GetNextFrameByProgress(animName, appearance.progress);
inst.material.SetShaderParameter("tintColor", new Vector3(civColor.R, civColor.G, civColor.B));

Expand Down
2 changes: 1 addition & 1 deletion C7/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ private static bool IsTileKnown(Tile tile, UIGameDataAccess gameDataAccess) {
if (gameDataAccess.gameData.observerMode) {
return true;
}
return tile != Tile.NONE && gameDataAccess.gameData.GetHumanPlayers()[0].tileKnowledge.isTileKnown(tile);
return tile != Tile.NONE && gameDataAccess.gameData.GetHumanPlayers()[0].TileKnowledge.isTileKnown(tile);
}
}

Expand Down
14 changes: 7 additions & 7 deletions C7/UIElements/Advisors/ScienceAdvisor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,28 @@ void DrawTechTree() {
using (UIGameDataAccess gameDataAccess = new()) {
List<Tech> techs = gameDataAccess.gameData.techs;
Player player = gameDataAccess.gameData.GetHumanPlayers()[0];
HashSet<ID> knownTechs = player.knownTechs;
HashSet<ID> knownTechs = player.KnownTechs;

// Set the tech background based on the player's era.
if (player.eraCivilopediaName == "ERAS_Ancient_Times") {
if (player.EraCivilopediaName == "ERAS_Ancient_Times") {
this.Texture = AncientBackground;
} else if (player.eraCivilopediaName == "ERAS_Middle_Ages") {
} else if (player.EraCivilopediaName == "ERAS_Middle_Ages") {
this.Texture = MiddleBackground;
} else if (player.eraCivilopediaName == "ERAS_Industrial_Age") {
} else if (player.EraCivilopediaName == "ERAS_Industrial_Age") {
this.Texture = IndustrialBackground;
} else if (player.eraCivilopediaName == "ERAS_Modern_Era") {
} else if (player.EraCivilopediaName == "ERAS_Modern_Era") {
this.Texture = ModernBackground;
}

foreach (Tech tech in techs) {
if (tech.EraCivilopediaName != player.eraCivilopediaName) {
if (tech.EraCivilopediaName != player.EraCivilopediaName) {
continue;
}

TechBox.TechState techState = TechBox.TechState.kBlocked;
if (knownTechs.Contains(tech.id)) {
techState = TechBox.TechState.kKnown;
} else if (player.currentlyResearchedTech == tech.id) {
} else if (player.CurrentlyResearchedTech == tech.id) {
techState = TechBox.TechState.kInProgress;
} else {
bool prereqsKnown = true;
Expand Down
2 changes: 1 addition & 1 deletion C7/UIElements/Popups/CivilizationDestroyed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class CivilizationDestroyed : Popup {
public CivilizationDestroyed(Civilization civ) {
alignment = BoxContainer.AlignmentMode.End;
margins = new Margins(right: 10);
civNoun = civ.noun;
civNoun = civ.Noun;
}

public override void _Ready() {
Expand Down
12 changes: 6 additions & 6 deletions C7/UIElements/RightClickMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public void ResetItems(Tile tile, Dictionary<ID, bool> uiUpdatedUnitStates = nul
RemoveAll();

int fortifiedCount = 0;
List<MapUnit> playerUnits = tile.unitsOnTile.FindAll(unit => unit.owner.id == game.controller.id);
List<MapUnit> nonPlayerUnits = tile.unitsOnTile.FindAll(unit => unit.owner.id != game.controller.id);
List<MapUnit> playerUnits = tile.unitsOnTile.FindAll(unit => unit.owner.Id == game.controller.Id);
List<MapUnit> nonPlayerUnits = tile.unitsOnTile.FindAll(unit => unit.owner.Id != game.controller.Id);

foreach (MapUnit unit in playerUnits) {
bool isFortified = isUnitFortified(unit, uiUpdatedUnitStates);
Expand Down Expand Up @@ -159,15 +159,15 @@ public void ResetItems(Tile tile, Dictionary<ID, bool> uiUpdatedUnitStates = nul
if (nonPlayerUnits.Count > 0) {
if (tile.cityAtTile == null) {
foreach (MapUnit unit in nonPlayerUnits) {
AddItem($"{unit.owner.civilization.noun} {unit.Describe()}", null);
AddItem($"{unit.owner.Civilization.Noun} {unit.Describe()}", null);
}
AddItem($"Contact {nonPlayerUnits[0].owner.civilization.name}", null);
AddItem($"Contact {nonPlayerUnits[0].owner.Civilization.Name}", null);
} else {
// TODO: This isn't necessarily the top unit, get that code to an accessible
// location and then use it here.
MapUnit unit = nonPlayerUnits[0];
AddItem($"{unit.owner.civilization.noun} {unit.Describe()}", null);
AddItem($"Contact {unit.owner.civilization.name}", null);
AddItem($"{unit.owner.Civilization.Noun} {unit.Describe()}", null);
AddItem($"Contact {unit.owner.Civilization.Name}", null);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions C7Engine/AI/BarbarianAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class BarbarianAI {
private ILogger log = Log.ForContext<BarbarianAI>();

public void PlayTurn(Player player, GameData gameData) {
if (!player.isBarbarians) {
if (!player.IsBarbarians) {
throw new System.Exception("Barbarian AI can only play barbarian players");
}

// Copy unit list into temporary array so we can remove units while iterating.
// TODO: We also need to handle units spawned during the loop, e.g. leaders, armies, enslaved units. This is not so much an
// issue for the barbs but will be for similar loops elsewhere in the AI logic.
foreach (MapUnit unit in player.units.ToArray()) {
foreach (MapUnit unit in player.Units.ToArray()) {
if (UnitIsFreeToMove(unit)) {
while (unit.movementPoints.canMove) {
//Move randomly
Expand Down
2 changes: 1 addition & 1 deletion C7Engine/AI/CityProductionAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class CityProductionAI {
* get hung up on knowing exactly how it should be done the road.
*/
public static IProducible GetNextItemToBeProduced(City city, IProducible lastProduced) {
List<StrategicPriority> priorities = city.owner.strategicPriorityData;
List<StrategicPriority> priorities = city.owner.StrategicPriorityData;
IEnumerable<IProducible> unitPrototypes = city.ListProductionOptions();

log.Information($"Choosing what to produce next in {city.name}");
Expand Down
Loading