From 55036cd58ce4ead49eb9d0caf0e21de395593a79 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 25 Sep 2011 14:37:12 +1300 Subject: [PATCH] fix trailing whitespace everywhere --- OpenRA.Editor/ActorTemplate.cs | 2 +- OpenRA.Editor/ActorTool.cs | 4 +- OpenRA.Editor/BrushTool.cs | 2 +- OpenRA.Editor/ErrorListDialog.Designer.cs | 18 +- OpenRA.Editor/ErrorListDialog.cs | 2 +- OpenRA.Editor/Form1.Designer.cs | 186 +++++++++--------- OpenRA.Editor/Form1.cs | 20 +- OpenRA.Editor/ITool.cs | 2 +- OpenRA.Editor/LegacyMapImporter.cs | 66 +++---- OpenRA.Editor/MapSelect.Designer.cs | 110 +++++------ OpenRA.Editor/MapSelect.cs | 10 +- OpenRA.Editor/NewMapDialog.Designer.cs | 58 +++--- OpenRA.Editor/NewMapDialog.cs | 2 +- OpenRA.Editor/Program.cs | 10 +- OpenRA.Editor/Properties/AssemblyInfo.cs | 12 +- OpenRA.Editor/PropertiesDialog.Designer.cs | 46 ++--- OpenRA.Editor/PropertiesDialog.cs | 2 +- OpenRA.Editor/RenderUtils.cs | 4 +- OpenRA.Editor/ResizeDialog.Designer.cs | 50 ++--- OpenRA.Editor/ResizeDialog.cs | 2 +- OpenRA.Editor/ResourceTool.cs | 4 +- OpenRA.Editor/Surface.cs | 10 +- OpenRA.FileFormats/ColorRamp.cs | 2 +- OpenRA.FileFormats/Evaluator.cs | 8 +- OpenRA.FileFormats/Exts.cs | 10 +- OpenRA.FileFormats/FieldLoader.cs | 8 +- OpenRA.FileFormats/FileFormats/AudLoader.cs | 10 +- OpenRA.FileFormats/FileFormats/Blast.cs | 58 +++--- OpenRA.FileFormats/FileFormats/Blowfish.cs | 2 +- .../FileFormats/BlowfishKeyProvider.cs | 6 +- OpenRA.FileFormats/FileFormats/Format2.cs | 2 +- OpenRA.FileFormats/FileFormats/Format40.cs | 2 +- OpenRA.FileFormats/FileFormats/Format80.cs | 4 +- OpenRA.FileFormats/FileFormats/IniFile.cs | 2 +- OpenRA.FileFormats/Filesystem/FileSystem.cs | 10 +- OpenRA.FileFormats/Filesystem/Folder.cs | 10 +- .../Filesystem/InstallShieldPackage.cs | 22 +-- OpenRA.FileFormats/Filesystem/MixFile.cs | 16 +- OpenRA.FileFormats/Filesystem/ZipFile.cs | 10 +- OpenRA.FileFormats/Graphics/Dune2ShpReader.cs | 8 +- .../Graphics/IGraphicsDevice.cs | 10 +- OpenRA.FileFormats/Graphics/IInputHandler.cs | 2 +- OpenRA.FileFormats/Graphics/PngLoader.cs | 2 +- OpenRA.FileFormats/Graphics/ShpReader.cs | 2 +- OpenRA.FileFormats/Graphics/ShpWriter.cs | 2 +- OpenRA.FileFormats/Graphics/Vertex.cs | 2 +- OpenRA.FileFormats/Graphics/VqaReader.cs | 68 +++---- OpenRA.FileFormats/HttpUtil.cs | 2 +- OpenRA.FileFormats/InstallUtils.cs | 22 +-- OpenRA.FileFormats/Manifest.cs | 4 +- OpenRA.FileFormats/Map/PlayerReference.cs | 4 +- OpenRA.FileFormats/Map/SmudgeReference.cs | 4 +- OpenRA.FileFormats/Map/Terrain.cs | 20 +- OpenRA.FileFormats/Map/TileReference.cs | 4 +- OpenRA.FileFormats/Map/TileSet.cs | 28 +-- OpenRA.FileFormats/MiniYaml.cs | 14 +- OpenRA.FileFormats/Mod.cs | 2 +- OpenRA.FileFormats/PackageEntry.cs | 12 +- OpenRA.FileFormats/Palette.cs | 22 +-- OpenRA.FileFormats/Platform.cs | 4 +- OpenRA.FileFormats/PlayerColorRemap.cs | 6 +- OpenRA.FileFormats/Primitives/ActionQueue.cs | 2 +- OpenRA.FileFormats/Primitives/Bits.cs | 2 +- OpenRA.FileFormats/Primitives/Cache.cs | 2 +- OpenRA.FileFormats/Primitives/Cached.cs | 4 +- .../Primitives/DisposableAction.cs | 2 +- OpenRA.FileFormats/Primitives/Lazy.cs | 2 +- OpenRA.FileFormats/Primitives/Pair.cs | 4 +- .../Primitives/PriorityQueue.cs | 2 +- OpenRA.FileFormats/Primitives/Set.cs | 2 +- OpenRA.FileFormats/Primitives/float2.cs | 2 +- OpenRA.FileFormats/Primitives/int2.cs | 8 +- OpenRA.FileFormats/Properties/AssemblyInfo.cs | 2 +- OpenRA.FileFormats/Support/Log.cs | 6 +- OpenRA.FileFormats/Support/Stopwatch.cs | 2 +- OpenRA.FileFormats/Support/Timer.cs | 2 +- OpenRA.FileFormats/Thirdparty/Random.cs | 6 +- OpenRA.FileFormats/TypeDictionary.cs | 2 +- OpenRA.Game/Actor.cs | 18 +- OpenRA.Game/ActorInitializer.cs | 4 +- OpenRA.Game/ActorMap.cs | 16 +- OpenRA.Game/ActorReference.cs | 2 +- OpenRA.Game/Download.cs | 18 +- OpenRA.Game/Effects/DelayedAction.cs | 2 +- OpenRA.Game/Effects/FlashTarget.cs | 4 +- OpenRA.Game/Effects/IEffect.cs | 2 +- OpenRA.Game/Game.cs | 52 ++--- OpenRA.Game/GameRules/ActorInfo.cs | 2 +- OpenRA.Game/GameRules/MusicInfo.cs | 8 +- OpenRA.Game/GameRules/Rules.cs | 6 +- OpenRA.Game/GameRules/Settings.cs | 30 +-- OpenRA.Game/GameRules/VoiceInfo.cs | 8 +- OpenRA.Game/GameRules/WeaponInfo.cs | 10 +- OpenRA.Game/Graphics/Animation.cs | 4 +- OpenRA.Game/Graphics/AnimationWithOffset.cs | 2 +- OpenRA.Game/Graphics/ChromeProvider.cs | 20 +- OpenRA.Game/Graphics/CursorProvider.cs | 10 +- OpenRA.Game/Graphics/CursorSequence.cs | 6 +- OpenRA.Game/Graphics/HardwarePalette.cs | 18 +- OpenRA.Game/Graphics/LineRenderer.cs | 4 +- OpenRA.Game/Graphics/MappedImage.cs | 6 +- OpenRA.Game/Graphics/Minimap.cs | 46 ++--- OpenRA.Game/Graphics/Renderer.cs | 14 +- OpenRA.Game/Graphics/Sequence.cs | 20 +- OpenRA.Game/Graphics/SequenceProvider.cs | 2 +- OpenRA.Game/Graphics/Sheet.cs | 2 +- OpenRA.Game/Graphics/SheetBuilder.cs | 4 +- OpenRA.Game/Graphics/ShroudRenderer.cs | 14 +- OpenRA.Game/Graphics/Sprite.cs | 2 +- OpenRA.Game/Graphics/SpriteFont.cs | 8 +- OpenRA.Game/Graphics/SpriteLoader.cs | 4 +- OpenRA.Game/Graphics/SpriteRenderer.cs | 14 +- OpenRA.Game/Graphics/TerrainRenderer.cs | 8 +- OpenRA.Game/Graphics/Util.cs | 12 +- OpenRA.Game/Graphics/Viewport.cs | 26 +-- OpenRA.Game/Graphics/WorldRenderer.cs | 16 +- OpenRA.Game/Group.cs | 4 +- OpenRA.Game/InputHandler.cs | 2 +- OpenRA.Game/Map.cs | 62 +++--- OpenRA.Game/ModData.cs | 22 +-- OpenRA.Game/Network/Connection.cs | 4 +- OpenRA.Game/Network/FrameData.cs | 2 +- OpenRA.Game/Network/GameServer.cs | 2 +- OpenRA.Game/Network/Handshake.cs | 12 +- OpenRA.Game/Network/Order.cs | 30 +-- OpenRA.Game/Network/OrderIO.cs | 2 +- OpenRA.Game/Network/OrderManager.cs | 14 +- OpenRA.Game/Network/ReplayConnection.cs | 2 +- OpenRA.Game/Network/ServerList.cs | 2 +- OpenRA.Game/Network/Session.cs | 2 +- OpenRA.Game/Network/SyncReport.cs | 10 +- OpenRA.Game/Network/UnitOrders.cs | 16 +- OpenRA.Game/ObjectCreator.cs | 4 +- OpenRA.Game/Orders/GenericSelectTarget.cs | 6 +- OpenRA.Game/Orders/IOrderGenerator.cs | 2 +- OpenRA.Game/Orders/UnitOrderGenerator.cs | 6 +- OpenRA.Game/Player.cs | 4 +- OpenRA.Game/Properties/AssemblyInfo.cs | 2 +- OpenRA.Game/Selection.cs | 4 +- OpenRA.Game/Server/Connection.cs | 8 +- OpenRA.Game/Server/Exts.cs | 2 +- OpenRA.Game/Server/ProtocolVersion.cs | 2 +- OpenRA.Game/Server/Server.cs | 82 ++++---- OpenRA.Game/Server/ServerOrder.cs | 2 +- OpenRA.Game/Server/TraitInterfaces.cs | 20 +- OpenRA.Game/Sound.cs | 12 +- OpenRA.Game/Support/Arguments.cs | 2 +- OpenRA.Game/Support/PerfHistory.cs | 12 +- OpenRA.Game/Support/Program.cs | 2 +- OpenRA.Game/Sync.cs | 2 +- OpenRA.Game/TraitDictionary.cs | 8 +- OpenRA.Game/Traits/Activities/Activity.cs | 4 +- OpenRA.Game/Traits/Armor.cs | 2 +- OpenRA.Game/Traits/DrawLineToTarget.cs | 10 +- OpenRA.Game/Traits/EditorAppearance.cs | 2 +- OpenRA.Game/Traits/EditorTilesetFilter.cs | 2 +- OpenRA.Game/Traits/Health.cs | 50 ++--- OpenRA.Game/Traits/LintAttributes.cs | 2 +- OpenRA.Game/Traits/Player/DeveloperMode.cs | 12 +- OpenRA.Game/Traits/Player/EvaAlerts.cs | 10 +- OpenRA.Game/Traits/Player/PlayerResources.cs | 48 ++--- OpenRA.Game/Traits/Render/RenderSimple.cs | 2 +- OpenRA.Game/Traits/RevealsShroud.cs | 12 +- OpenRA.Game/Traits/Selectable.cs | 32 +-- OpenRA.Game/Traits/SubcellInit.cs | 2 +- OpenRA.Game/Traits/Target.cs | 4 +- OpenRA.Game/Traits/TraitsInterfaces.cs | 2 +- OpenRA.Game/Traits/Util.cs | 14 +- OpenRA.Game/Traits/ValidateOrder.cs | 4 +- OpenRA.Game/Traits/Waypoint.cs | 4 +- OpenRA.Game/Traits/World/Country.cs | 2 +- .../Traits/World/PlayerColorPalette.cs | 4 +- OpenRA.Game/Traits/World/ResourceLayer.cs | 10 +- OpenRA.Game/Traits/World/ResourceType.cs | 4 +- OpenRA.Game/Traits/World/ScreenShaker.cs | 20 +- OpenRA.Game/Traits/World/Shroud.cs | 34 ++-- OpenRA.Game/Traits/World/SpatialBins.cs | 4 +- OpenRA.Game/Widgets/BackgroundWidget.cs | 6 +- OpenRA.Game/Widgets/ButtonWidget.cs | 28 +-- OpenRA.Game/Widgets/ChatDisplayWidget.cs | 12 +- OpenRA.Game/Widgets/ChatEntryWidget.cs | 4 +- OpenRA.Game/Widgets/CheckboxWidget.cs | 12 +- OpenRA.Game/Widgets/ChromeMetrics.cs | 4 +- OpenRA.Game/Widgets/ColorBlockWidget.cs | 2 +- OpenRA.Game/Widgets/DropDownButtonWidget.cs | 26 +-- OpenRA.Game/Widgets/ImageWidget.cs | 4 +- OpenRA.Game/Widgets/LabelWidget.cs | 10 +- OpenRA.Game/Widgets/MapPreviewWidget.cs | 12 +- OpenRA.Game/Widgets/PasswordFieldWidget.cs | 2 +- OpenRA.Game/Widgets/PerfGraphWidget.cs | 2 +- OpenRA.Game/Widgets/ProgressBarWidget.cs | 20 +- OpenRA.Game/Widgets/ScrollItem.cs | 18 +- OpenRA.Game/Widgets/ScrollPanelWidget.cs | 56 +++--- OpenRA.Game/Widgets/ShpImageWidget.cs | 10 +- OpenRA.Game/Widgets/SliderWidget.cs | 2 +- OpenRA.Game/Widgets/TextFieldWidget.cs | 26 +-- OpenRA.Game/Widgets/TimerWidget.cs | 2 +- .../Widgets/ViewportScrollControllerWidget.cs | 22 +-- OpenRA.Game/Widgets/VqaPlayerWidget.cs | 52 ++--- OpenRA.Game/Widgets/Widget.cs | 8 +- OpenRA.Game/Widgets/WidgetLoader.cs | 6 +- OpenRA.Game/Widgets/WidgetUtils.cs | 20 +- .../WorldInteractionControllerWidget.cs | 20 +- OpenRA.Game/World.cs | 34 ++-- OpenRA.Game/WorldUtils.cs | 14 +- .../Activities/HarvesterDockSequence.cs | 8 +- .../CncColorPickerPaletteModifier.cs | 10 +- OpenRA.Mods.Cnc/CncLoadScreen.cs | 2 +- OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs | 20 +- OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs | 2 +- OpenRA.Mods.Cnc/DeadBuildingState.cs | 2 +- OpenRA.Mods.Cnc/Effects/IonCannon.cs | 2 +- OpenRA.Mods.Cnc/IonCannonPower.cs | 2 +- OpenRA.Mods.Cnc/Missions/CncShellmapScript.cs | 12 +- OpenRA.Mods.Cnc/Missions/Gdi01Script.cs | 58 +++--- OpenRA.Mods.Cnc/PoisonedByTiberium.cs | 4 +- OpenRA.Mods.Cnc/ProductionAirdrop.cs | 18 +- .../ProductionQueueFromSelection.cs | 2 +- OpenRA.Mods.Cnc/Properties/AssemblyInfo.cs | 12 +- OpenRA.Mods.Cnc/RenderBuildingRefinery.cs | 2 +- OpenRA.Mods.Cnc/RenderCargo.cs | 8 +- OpenRA.Mods.Cnc/RenderGunboat.cs | 4 +- OpenRA.Mods.Cnc/SpawnViceroid.cs | 12 +- OpenRA.Mods.Cnc/TiberiumRefinery.cs | 4 +- OpenRA.Mods.Cnc/Widgets/CncWidgetUtils.cs | 2 +- .../CncWorldInteractionControllerWidget.cs | 4 +- .../Widgets/Logic/ButtonTooltipLogic.cs | 2 +- .../Widgets/Logic/CncCheatsLogic.cs | 30 +-- .../Widgets/Logic/CncColorPickerLogic.cs | 16 +- .../Widgets/Logic/CncConnectionLogic.cs | 20 +- .../Logic/CncConquestObjectivesLogic.cs | 2 +- .../Widgets/Logic/CncDownloadPackagesLogic.cs | 30 +-- .../Widgets/Logic/CncIngameChromeLogic.cs | 2 +- .../Widgets/Logic/CncIngameMenuLogic.cs | 22 +-- .../Widgets/Logic/CncInstallFromCDLogic.cs | 32 +-- .../Widgets/Logic/CncInstallLogic.cs | 2 +- .../Widgets/Logic/CncLobbyLogic.cs | 60 +++--- .../Widgets/Logic/CncMapChooserLogic.cs | 10 +- OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs | 8 +- .../Widgets/Logic/CncModBrowserLogic.cs | 14 +- .../Widgets/Logic/CncMusicPlayerLogic.cs | 92 ++++----- .../Widgets/Logic/CncPerfDebugLogic.cs | 4 +- .../Widgets/Logic/CncReplayBrowserLogic.cs | 2 +- .../Widgets/Logic/CncServerBrowserLogic.cs | 44 ++--- .../Widgets/Logic/CncServerCreationLogic.cs | 2 +- .../Widgets/Logic/CncSettingsLogic.cs | 6 +- .../Widgets/Logic/ProductionTooltipLogic.cs | 4 +- .../Widgets/Logic/SimpleTooltipLogic.cs | 2 +- .../Widgets/Logic/SupportPowerTooltipLogic.cs | 2 +- .../Widgets/Logic/WorldTooltipLogic.cs | 4 +- OpenRA.Mods.Cnc/Widgets/LogicTickerWidget.cs | 2 +- OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs | 12 +- .../Widgets/ProductionPaletteWidget.cs | 16 +- .../Widgets/ProductionTabsWidget.cs | 4 +- OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs | 12 +- .../Widgets/SupportPowersWidget.cs | 2 +- OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs | 2 +- .../Widgets/TooltipContainerWidget.cs | 2 +- OpenRA.Mods.Cnc/WithFire.cs | 2 +- OpenRA.Mods.Cnc/WithRoof.cs | 2 +- OpenRA.Mods.RA/AcceptsSupplies.cs | 2 +- OpenRA.Mods.RA/Activities/Attack.cs | 4 +- OpenRA.Mods.RA/Activities/CallFunc.cs | 4 +- OpenRA.Mods.RA/Activities/CaptureActor.cs | 6 +- OpenRA.Mods.RA/Activities/DeliverResources.cs | 8 +- OpenRA.Mods.RA/Activities/Demolish.cs | 6 +- OpenRA.Mods.RA/Activities/DonateSupplies.cs | 8 +- OpenRA.Mods.RA/Activities/Enter.cs | 2 +- OpenRA.Mods.RA/Activities/EnterTransport.cs | 8 +- OpenRA.Mods.RA/Activities/FindResources.cs | 2 +- OpenRA.Mods.RA/Activities/Follow.cs | 2 +- OpenRA.Mods.RA/Activities/Heal.cs | 4 +- OpenRA.Mods.RA/Activities/Infiltrate.cs | 2 +- OpenRA.Mods.RA/Activities/LayMines.cs | 2 +- OpenRA.Mods.RA/Activities/Leap.cs | 2 +- OpenRA.Mods.RA/Activities/MakeAnimation.cs | 8 +- OpenRA.Mods.RA/Activities/MoveAdjacentTo.cs | 2 +- .../Activities/RAHarvesterDockSequence.cs | 6 +- OpenRA.Mods.RA/Activities/Rearm.cs | 2 +- OpenRA.Mods.RA/Activities/RemoveSelf.cs | 2 +- OpenRA.Mods.RA/Activities/Repair.cs | 2 +- OpenRA.Mods.RA/Activities/RepairBuilding.cs | 2 +- OpenRA.Mods.RA/Activities/Sell.cs | 18 +- OpenRA.Mods.RA/Activities/Teleport.cs | 2 +- OpenRA.Mods.RA/Activities/Transform.cs | 10 +- OpenRA.Mods.RA/Activities/Turn.cs | 2 +- OpenRA.Mods.RA/Activities/UnloadCargo.cs | 8 +- OpenRA.Mods.RA/Activities/Wait.cs | 4 +- OpenRA.Mods.RA/ActorExts.cs | 16 +- OpenRA.Mods.RA/ActorLostNotification.cs | 4 +- OpenRA.Mods.RA/Air/Aircraft.cs | 24 +-- OpenRA.Mods.RA/Air/AttackHeli.cs | 2 +- OpenRA.Mods.RA/Air/AttackPlane.cs | 4 +- OpenRA.Mods.RA/Air/EjectOnDeath.cs | 4 +- OpenRA.Mods.RA/Air/FallsToEarth.cs | 2 +- OpenRA.Mods.RA/Air/Fly.cs | 4 +- OpenRA.Mods.RA/Air/FlyAttack.cs | 2 +- OpenRA.Mods.RA/Air/FlyCircle.cs | 2 +- OpenRA.Mods.RA/Air/FlyTimed.cs | 2 +- OpenRA.Mods.RA/Air/HeliAttack.cs | 4 +- OpenRA.Mods.RA/Air/HeliFly.cs | 4 +- OpenRA.Mods.RA/Air/HeliLand.cs | 4 +- OpenRA.Mods.RA/Air/HeliReturn.cs | 4 +- OpenRA.Mods.RA/Air/Helicopter.cs | 20 +- OpenRA.Mods.RA/Air/Land.cs | 6 +- OpenRA.Mods.RA/Air/Plane.cs | 6 +- OpenRA.Mods.RA/Air/ReturnOnIdle.cs | 4 +- OpenRA.Mods.RA/Air/ReturnToBase.cs | 6 +- OpenRA.Mods.RA/Air/TargetableAircraft.cs | 4 +- OpenRA.Mods.RA/AnnounceOnBuild.cs | 6 +- OpenRA.Mods.RA/AnnounceOnKill.cs | 4 +- OpenRA.Mods.RA/AppearsOnRadar.cs | 6 +- OpenRA.Mods.RA/Attack/AttackBase.cs | 14 +- OpenRA.Mods.RA/Attack/AttackFrontal.cs | 2 +- OpenRA.Mods.RA/Attack/AttackLeap.cs | 2 +- OpenRA.Mods.RA/Attack/AttackMedic.cs | 2 +- OpenRA.Mods.RA/Attack/AttackOmni.cs | 2 +- OpenRA.Mods.RA/Attack/AttackPopupTurreted.cs | 2 +- OpenRA.Mods.RA/Attack/AttackTesla.cs | 2 +- OpenRA.Mods.RA/Attack/AttackTurreted.cs | 2 +- OpenRA.Mods.RA/Attack/AttackWander.cs | 6 +- OpenRA.Mods.RA/AttackMove.cs | 28 +-- OpenRA.Mods.RA/AutoHeal.cs | 4 +- OpenRA.Mods.RA/AutoTarget.cs | 16 +- OpenRA.Mods.RA/BaseBuilding.cs | 2 +- OpenRA.Mods.RA/BelowUnits.cs | 2 +- OpenRA.Mods.RA/Bridge.cs | 30 +-- OpenRA.Mods.RA/BridgeLayer.cs | 34 ++-- OpenRA.Mods.RA/Buildable.cs | 6 +- OpenRA.Mods.RA/BuildingCaptureNotification.cs | 8 +- OpenRA.Mods.RA/Buildings/BibLayer.cs | 20 +- OpenRA.Mods.RA/Buildings/Building.cs | 16 +- OpenRA.Mods.RA/Buildings/BuildingInfluence.cs | 2 +- OpenRA.Mods.RA/Buildings/CanPowerDown.cs | 10 +- OpenRA.Mods.RA/Buildings/CustomSellValue.cs | 6 +- OpenRA.Mods.RA/Buildings/FootprintUtils.cs | 4 +- OpenRA.Mods.RA/Buildings/LineBuild.cs | 2 +- OpenRA.Mods.RA/Buildings/PowerManager.cs | 24 +-- .../Buildings/RepairableBuilding.cs | 2 +- OpenRA.Mods.RA/Buildings/RequiresPower.cs | 4 +- OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs | 4 +- .../Buildings/SoundOnDamageTransition.cs | 4 +- OpenRA.Mods.RA/Buildings/TechTree.cs | 26 +-- OpenRA.Mods.RA/Buildings/Util.cs | 6 +- OpenRA.Mods.RA/Buildings/Wall.cs | 4 +- OpenRA.Mods.RA/Burns.cs | 4 +- OpenRA.Mods.RA/C4Demolition.cs | 10 +- OpenRA.Mods.RA/Capturable.cs | 2 +- OpenRA.Mods.RA/Captures.cs | 18 +- OpenRA.Mods.RA/Cargo.cs | 16 +- OpenRA.Mods.RA/CarpetBomb.cs | 2 +- OpenRA.Mods.RA/CashTrickler.cs | 6 +- OpenRA.Mods.RA/ChronoshiftDeploy.cs | 6 +- OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs | 6 +- OpenRA.Mods.RA/Chronoshiftable.cs | 8 +- OpenRA.Mods.RA/Cloak.cs | 10 +- OpenRA.Mods.RA/ColorPickerPaletteModifier.cs | 10 +- OpenRA.Mods.RA/Combat.cs | 14 +- OpenRA.Mods.RA/ConquestVictoryConditions.cs | 22 +-- OpenRA.Mods.RA/Crate.cs | 2 +- OpenRA.Mods.RA/CrateAction.cs | 6 +- OpenRA.Mods.RA/CrateDrop.cs | 18 +- OpenRA.Mods.RA/CrateSpawner.cs | 10 +- OpenRA.Mods.RA/Crates/CloakCrateAction.cs | 6 +- OpenRA.Mods.RA/Crates/ExplodeCrateAction.cs | 2 +- OpenRA.Mods.RA/Crates/GiveCashCrateAction.cs | 2 +- OpenRA.Mods.RA/Crates/GiveMcvCrateAction.cs | 4 +- OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs | 2 +- OpenRA.Mods.RA/Crates/HideMapCrateAction.cs | 2 +- OpenRA.Mods.RA/Crates/LevelUpCrateAction.cs | 6 +- OpenRA.Mods.RA/Crates/RevealMapCrateAction.cs | 2 +- .../Crates/SupportPowerCrateAction.cs | 2 +- OpenRA.Mods.RA/CreateMPPlayers.cs | 4 +- OpenRA.Mods.RA/CrushableInfantry.cs | 2 +- OpenRA.Mods.RA/DemoTruck.cs | 4 +- OpenRA.Mods.RA/DetectCloaked.cs | 2 +- OpenRA.Mods.RA/Effects/Bullet.cs | 8 +- OpenRA.Mods.RA/Effects/CashTick.cs | 2 +- OpenRA.Mods.RA/Effects/Contrail.cs | 2 +- OpenRA.Mods.RA/Effects/Corpse.cs | 2 +- OpenRA.Mods.RA/Effects/CrateEffect.cs | 4 +- OpenRA.Mods.RA/Effects/Explosion.cs | 6 +- OpenRA.Mods.RA/Effects/GpsDot.cs | 4 +- OpenRA.Mods.RA/Effects/GpsSatellite.cs | 6 +- OpenRA.Mods.RA/Effects/GravityBomb.cs | 4 +- OpenRA.Mods.RA/Effects/InvulnEffect.cs | 2 +- OpenRA.Mods.RA/Effects/LaserZap.cs | 6 +- OpenRA.Mods.RA/Effects/Missile.cs | 24 +-- OpenRA.Mods.RA/Effects/NukeLaunch.cs | 8 +- OpenRA.Mods.RA/Effects/Parachute.cs | 12 +- OpenRA.Mods.RA/Effects/PowerdownIndicator.cs | 2 +- OpenRA.Mods.RA/Effects/RallyPoint.cs | 20 +- OpenRA.Mods.RA/Effects/RepairIndicator.cs | 2 +- OpenRA.Mods.RA/Effects/SatelliteLaunch.cs | 8 +- OpenRA.Mods.RA/Effects/Smoke.cs | 2 +- OpenRA.Mods.RA/Effects/TeslaZap.cs | 6 +- OpenRA.Mods.RA/EmitInfantryOnSell.cs | 8 +- OpenRA.Mods.RA/EngineerRepair.cs | 6 +- OpenRA.Mods.RA/Explodes.cs | 2 +- OpenRA.Mods.RA/Fake.cs | 2 +- OpenRA.Mods.RA/FreeActor.cs | 6 +- OpenRA.Mods.RA/GainsExperience.cs | 2 +- OpenRA.Mods.RA/GivesBounty.cs | 2 +- OpenRA.Mods.RA/GivesExperience.cs | 2 +- OpenRA.Mods.RA/HackyAI.cs | 12 +- OpenRA.Mods.RA/Harvester.cs | 40 ++-- OpenRA.Mods.RA/HarvesterHuskModifier.cs | 2 +- OpenRA.Mods.RA/Husk.cs | 2 +- OpenRA.Mods.RA/InfiltrateForSupportPower.cs | 4 +- OpenRA.Mods.RA/InvisibleToEnemy.cs | 4 +- OpenRA.Mods.RA/Invulnerable.cs | 2 +- OpenRA.Mods.RA/IronCurtainable.cs | 2 +- OpenRA.Mods.RA/LeavesHusk.cs | 2 +- OpenRA.Mods.RA/LightPaletteRotator.cs | 8 +- OpenRA.Mods.RA/LimitedAmmo.cs | 6 +- OpenRA.Mods.RA/Lint/CheckActorReferences.cs | 6 +- OpenRA.Mods.RA/Lint/CheckAutotargetWiring.cs | 2 +- OpenRA.Mods.RA/Lint/CheckSyncAnnotations.cs | 4 +- .../Lint/CheckTraitPrerequisites.cs | 2 +- .../Lint/LintBuildablePrerequisites.cs | 6 +- OpenRA.Mods.RA/MPStartLocations.cs | 10 +- OpenRA.Mods.RA/Mine.cs | 2 +- OpenRA.Mods.RA/Minelayer.cs | 12 +- .../Missions/DefaultShellmapScript.cs | 20 +- OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs | 6 +- OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs | 2 +- OpenRA.Mods.RA/Move/Drag.cs | 6 +- OpenRA.Mods.RA/Move/Mobile.cs | 28 +-- OpenRA.Mods.RA/Move/Move.cs | 18 +- OpenRA.Mods.RA/Move/PathFinder.cs | 6 +- OpenRA.Mods.RA/Move/PathSearch.cs | 28 +-- OpenRA.Mods.RA/NukePaletteEffect.cs | 8 +- OpenRA.Mods.RA/NullLoadScreen.cs | 6 +- OpenRA.Mods.RA/OpenWidgetAtGameStart.cs | 8 +- OpenRA.Mods.RA/Orders/DeployOrderTargeter.cs | 2 +- .../Orders/EnterBuildingOrderTargeter.cs | 2 +- .../Orders/PlaceBuildingOrderGenerator.cs | 12 +- .../Orders/PowerDownOrderGenerator.cs | 2 +- OpenRA.Mods.RA/Orders/RepairOrderGenerator.cs | 2 +- OpenRA.Mods.RA/Orders/SellOrderGenerator.cs | 4 +- .../Orders/SetChronoTankDestination.cs | 2 +- OpenRA.Mods.RA/Orders/UnitOrderTargeter.cs | 2 +- OpenRA.Mods.RA/OreRefinery.cs | 28 +-- OpenRA.Mods.RA/PaletteFromCurrentTileset.cs | 2 +- OpenRA.Mods.RA/PaletteFromFile.cs | 2 +- OpenRA.Mods.RA/PaletteFromRGBA.cs | 2 +- OpenRA.Mods.RA/ParaDrop.cs | 2 +- OpenRA.Mods.RA/ParachuteAttachment.cs | 6 +- OpenRA.Mods.RA/Passenger.cs | 8 +- OpenRA.Mods.RA/Player/ActorGroupProxy.cs | 2 +- OpenRA.Mods.RA/Player/AllyRepair.cs | 2 +- .../Player/ClassicProductionQueue.cs | 18 +- OpenRA.Mods.RA/Player/PlaceBuilding.cs | 18 +- OpenRA.Mods.RA/Player/ProductionQueue.cs | 58 +++--- .../Player/SurrenderOnDisconnect.cs | 2 +- OpenRA.Mods.RA/PrimaryBuilding.cs | 4 +- OpenRA.Mods.RA/Production.cs | 16 +- OpenRA.Mods.RA/ProductionBar.cs | 2 +- OpenRA.Mods.RA/Properties/AssemblyInfo.cs | 12 +- OpenRA.Mods.RA/ProvidesRadar.cs | 2 +- OpenRA.Mods.RA/ProximityCaptor.cs | 2 +- OpenRA.Mods.RA/ProximityCapturable.cs | 2 +- OpenRA.Mods.RA/RALoadScreen.cs | 18 +- OpenRA.Mods.RA/RadarColorFromTerrain.cs | 4 +- OpenRA.Mods.RA/RallyPoint.cs | 2 +- OpenRA.Mods.RA/Reloads.cs | 6 +- OpenRA.Mods.RA/Render/RenderBuilding.cs | 20 +- OpenRA.Mods.RA/Render/RenderBuildingCharge.cs | 6 +- OpenRA.Mods.RA/Render/RenderBuildingSilo.cs | 6 +- .../Render/RenderBuildingTurreted.cs | 2 +- OpenRA.Mods.RA/Render/RenderBuildingWall.cs | 8 +- .../Render/RenderBuildingWarFactory.cs | 6 +- OpenRA.Mods.RA/Render/RenderEditorOnly.cs | 2 +- OpenRA.Mods.RA/Render/RenderFlare.cs | 2 +- OpenRA.Mods.RA/Render/RenderHarvester.cs | 8 +- OpenRA.Mods.RA/Render/RenderInfantry.cs | 20 +- OpenRA.Mods.RA/Render/RenderSpy.cs | 8 +- OpenRA.Mods.RA/Render/RenderUnit.cs | 4 +- OpenRA.Mods.RA/Render/RenderUnitReload.cs | 2 +- OpenRA.Mods.RA/Render/RenderUnitSpinner.cs | 2 +- OpenRA.Mods.RA/Render/RenderUnitTurreted.cs | 4 +- .../Render/WithBuildingExplosion.cs | 2 +- OpenRA.Mods.RA/Render/WithMuzzleFlash.cs | 2 +- OpenRA.Mods.RA/Render/WithRotor.cs | 4 +- OpenRA.Mods.RA/Render/WithShadow.cs | 4 +- OpenRA.Mods.RA/Render/WithSmoke.cs | 2 +- OpenRA.Mods.RA/RenderDetectionCircle.cs | 4 +- OpenRA.Mods.RA/RenderRangeCircle.cs | 4 +- OpenRA.Mods.RA/Repairable.cs | 8 +- OpenRA.Mods.RA/RepairableNear.cs | 2 +- OpenRA.Mods.RA/RepairsUnits.cs | 2 +- OpenRA.Mods.RA/ReplaceWithActor.cs | 4 +- OpenRA.Mods.RA/Reservable.cs | 10 +- OpenRA.Mods.RA/ScaredyCat.cs | 26 +-- OpenRA.Mods.RA/Scripting/Media.cs | 14 +- OpenRA.Mods.RA/Scripting/RASpecialPowers.cs | 14 +- OpenRA.Mods.RA/SeedsResource.cs | 6 +- OpenRA.Mods.RA/SelfHealing.cs | 8 +- OpenRA.Mods.RA/Sellable.cs | 12 +- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 32 +-- .../ServerTraits/MasterServerPinger.cs | 10 +- OpenRA.Mods.RA/ShroudPalette.cs | 26 +-- OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs | 2 +- OpenRA.Mods.RA/SpawnMPUnits.cs | 6 +- OpenRA.Mods.RA/SpawnMapActors.cs | 2 +- OpenRA.Mods.RA/Spy.cs | 50 ++--- OpenRA.Mods.RA/StoresOre.cs | 20 +- OpenRA.Mods.RA/StrategicVictoryConditions.cs | 6 +- OpenRA.Mods.RA/SupplyTruck.cs | 4 +- .../SupportPowers/AirstrikePower.cs | 6 +- .../SupportPowers/ChronoshiftPower.cs | 40 ++-- OpenRA.Mods.RA/SupportPowers/GpsPower.cs | 8 +- .../SupportPowers/IronCurtainPower.cs | 14 +- OpenRA.Mods.RA/SupportPowers/NukePower.cs | 10 +- .../SupportPowers/ParatroopersPower.cs | 10 +- .../SupportPowers/SonarPulsePower.cs | 2 +- OpenRA.Mods.RA/SupportPowers/SpyPlanePower.cs | 6 +- OpenRA.Mods.RA/SupportPowers/SupportPower.cs | 10 +- .../SupportPowers/SupportPowerChargeBar.cs | 2 +- .../SupportPowers/SupportPowerManager.cs | 50 ++--- OpenRA.Mods.RA/TakeCover.cs | 16 +- OpenRA.Mods.RA/TargetableBuilding.cs | 2 +- OpenRA.Mods.RA/TargetableSubmarine.cs | 4 +- OpenRA.Mods.RA/TargetableUnit.cs | 10 +- OpenRA.Mods.RA/TeslaInstantKills.cs | 2 +- OpenRA.Mods.RA/ThrowsParticle.cs | 2 +- OpenRA.Mods.RA/TraitsInterfaces.cs | 4 +- OpenRA.Mods.RA/TransformOnCapture.cs | 8 +- OpenRA.Mods.RA/Transforms.cs | 16 +- OpenRA.Mods.RA/Turreted.cs | 4 +- OpenRA.Mods.RA/Valued.cs | 18 +- OpenRA.Mods.RA/WaterPaletteRotation.cs | 2 +- OpenRA.Mods.RA/Weapon.cs | 12 +- OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs | 132 ++++++------- .../Widgets/Logic/ConnectionDialogsLogic.cs | 4 +- .../Widgets/Logic/CreateServerMenuLogic.cs | 8 +- .../Widgets/Logic/DeveloperModeLogic.cs | 26 +-- .../Widgets/Logic/DiplomacyLogic.cs | 12 +- .../Widgets/Logic/IngameChromeLogic.cs | 4 +- .../Logic/IngameObserverChromeLogic.cs | 16 +- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 66 +++---- .../Widgets/Logic/MainMenuButtonsLogic.cs | 16 +- .../Widgets/Logic/MapChooserLogic.cs | 10 +- .../Widgets/Logic/MusicPlayerLogic.cs | 26 +-- .../Widgets/Logic/OrderButtonsChromeLogic.cs | 10 +- .../Widgets/Logic/PerfDebugLogic.cs | 2 +- .../Widgets/Logic/RADownloadPackagesLogic.cs | 2 +- .../Widgets/Logic/RAInstallFromCDLogic.cs | 34 ++-- .../Widgets/Logic/RAInstallLogic.cs | 2 +- .../Widgets/Logic/ReplayBrowserLogic.cs | 6 +- .../Widgets/Logic/ServerBrowserLogic.cs | 14 +- .../Widgets/Logic/SettingsMenuLogic.cs | 22 +-- OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs | 2 +- OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs | 14 +- OpenRA.Mods.RA/Widgets/PowerBinWidget.cs | 4 +- OpenRA.Mods.RA/Widgets/RadarBinWidget.cs | 36 ++-- OpenRA.Mods.RA/Widgets/RadarWidget.cs | 34 ++-- .../Widgets/StrategicProgressWidget.cs | 8 +- .../Widgets/SupportPowerBinWidget.cs | 20 +- OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs | 16 +- OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs | 14 +- .../World/ChooseBuildTabOnSelect.cs | 8 +- OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs | 2 +- OpenRA.Mods.RA/World/SmudgeLayer.cs | 16 +- OpenRA.Renderer.Cg/GraphicsDevice.cs | 8 +- OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs | 12 +- OpenRA.Renderer.Cg/Shader.cs | 2 +- OpenRA.Renderer.Gl/GraphicsDevice.cs | 10 +- OpenRA.Renderer.Gl/Properties/AssemblyInfo.cs | 4 +- OpenRA.Renderer.Gl/Shader.cs | 30 +-- OpenRA.Renderer.Null/NullGraphicsDevice.cs | 8 +- .../Properties/AssemblyInfo.cs | 12 +- OpenRA.Renderer.SdlCommon/ErrorHandler.cs | 4 +- OpenRA.Renderer.SdlCommon/SdlGraphics.cs | 4 +- OpenRA.Renderer.SdlCommon/SdlInput.cs | 6 +- OpenRA.Renderer.SdlCommon/Texture.cs | 18 +- OpenRA.Renderer.SdlCommon/VertexBuffer.cs | 2 +- OpenRA.TilesetBuilder/Form1.Designer.cs | 90 ++++----- OpenRA.TilesetBuilder/Form1.cs | 30 +-- OpenRA.TilesetBuilder/Program.cs | 2 +- .../Properties/AssemblyInfo.cs | 12 +- OpenRA.TilesetBuilder/Surface.cs | 2 +- OpenRA.TilesetBuilder/Template.cs | 2 +- OpenRA.Utility/Command.cs | 12 +- OpenRA.Utility/Program.cs | 4 +- OpenRA.Utility/Properties/AssemblyInfo.cs | 12 +- RALint/Properties/AssemblyInfo.cs | 12 +- RALint/RALint.cs | 6 +- SequenceEditor/Form1.Designer.cs | 38 ++-- SequenceEditor/Form1.cs | 2 +- SequenceEditor/GetTextForm.Designer.cs | 18 +- SequenceEditor/GetTextForm.cs | 2 +- SequenceEditor/Program.cs | 6 +- SequenceEditor/Properties/AssemblyInfo.cs | 12 +- SequenceEditor/Surface.cs | 14 +- packaging/fixheader.cs | 6 +- 596 files changed, 3194 insertions(+), 3194 deletions(-) diff --git a/OpenRA.Editor/ActorTemplate.cs b/OpenRA.Editor/ActorTemplate.cs index d988a23cfd..aee71661d2 100644 --- a/OpenRA.Editor/ActorTemplate.cs +++ b/OpenRA.Editor/ActorTemplate.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/ActorTool.cs b/OpenRA.Editor/ActorTool.cs index 854dfcf7a7..aca2c9d862 100644 --- a/OpenRA.Editor/ActorTool.cs +++ b/OpenRA.Editor/ActorTool.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Editor public void Preview(Surface surface, SGraphics g) { - /* todo: include the player + /* todo: include the player * in the brush so we can color new buildings too */ surface.DrawActor(g, surface.GetBrushLocation(), Actor, null); diff --git a/OpenRA.Editor/BrushTool.cs b/OpenRA.Editor/BrushTool.cs index a9702b0cd3..39eb79b4de 100644 --- a/OpenRA.Editor/BrushTool.cs +++ b/OpenRA.Editor/BrushTool.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/ErrorListDialog.Designer.cs b/OpenRA.Editor/ErrorListDialog.Designer.cs index 3ff75fe297..21489f0ce5 100644 --- a/OpenRA.Editor/ErrorListDialog.Designer.cs +++ b/OpenRA.Editor/ErrorListDialog.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -42,9 +42,9 @@ namespace OpenRA.Editor this.listBox1 = new System.Windows.Forms.ListBox(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); - // + // // label1 - // + // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(10, 9); @@ -52,9 +52,9 @@ namespace OpenRA.Editor this.label1.Size = new System.Drawing.Size(610, 23); this.label1.TabIndex = 0; this.label1.Text = "Your map import completed, but with errors:"; - // + // // listBox1 - // + // this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); @@ -63,9 +63,9 @@ namespace OpenRA.Editor this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(607, 316); this.listBox1.TabIndex = 1; - // + // // button1 - // + // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button1.Location = new System.Drawing.Point(545, 359); @@ -74,9 +74,9 @@ namespace OpenRA.Editor this.button1.TabIndex = 2; this.button1.Text = "Close"; this.button1.UseVisualStyleBackColor = true; - // + // // ErrorListDialog - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(632, 394); diff --git a/OpenRA.Editor/ErrorListDialog.cs b/OpenRA.Editor/ErrorListDialog.cs index 9929feb3ec..05ae0d2771 100644 --- a/OpenRA.Editor/ErrorListDialog.cs +++ b/OpenRA.Editor/ErrorListDialog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/Form1.Designer.cs b/OpenRA.Editor/Form1.Designer.cs index 667fd6a0b8..05fad73878 100755 --- a/OpenRA.Editor/Form1.Designer.cs +++ b/OpenRA.Editor/Form1.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -96,44 +96,44 @@ namespace OpenRA.Editor this.menuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); - // + // // splitContainer1 - // + // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; - // + // // splitContainer1.Panel1 - // + // this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); - // + // // splitContainer1.Panel2 - // + // this.splitContainer1.Panel2.Controls.Add(this.surface1); this.splitContainer1.Size = new System.Drawing.Size(985, 744); this.splitContainer1.SplitterDistance = 198; this.splitContainer1.TabIndex = 0; - // + // // splitContainer2 - // + // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Location = new System.Drawing.Point(0, 0); this.splitContainer2.Name = "splitContainer2"; this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; - // + // // splitContainer2.Panel1 - // + // this.splitContainer2.Panel1.Controls.Add(this.pmMiniMap); - // + // // splitContainer2.Panel2 - // + // this.splitContainer2.Panel2.Controls.Add(this.tabControl1); this.splitContainer2.Size = new System.Drawing.Size(198, 744); this.splitContainer2.SplitterDistance = 164; this.splitContainer2.TabIndex = 1; - // + // // pmMiniMap - // + // this.pmMiniMap.BackColor = System.Drawing.Color.Black; this.pmMiniMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.pmMiniMap.Dock = System.Windows.Forms.DockStyle.Fill; @@ -143,9 +143,9 @@ namespace OpenRA.Editor this.pmMiniMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pmMiniMap.TabIndex = 1; this.pmMiniMap.TabStop = false; - // + // // tabControl1 - // + // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage3); @@ -158,9 +158,9 @@ namespace OpenRA.Editor this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(198, 576); this.tabControl1.TabIndex = 0; - // + // // tabPage1 - // + // this.tabPage1.Controls.Add(this.tilePalette); this.tabPage1.Location = new System.Drawing.Point(4, 20); this.tabPage1.Name = "tabPage1"; @@ -169,9 +169,9 @@ namespace OpenRA.Editor this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Templates"; this.tabPage1.UseVisualStyleBackColor = true; - // + // // tilePalette - // + // this.tilePalette.AutoScroll = true; this.tilePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tilePalette.Dock = System.Windows.Forms.DockStyle.Fill; @@ -179,9 +179,9 @@ namespace OpenRA.Editor this.tilePalette.Name = "tilePalette"; this.tilePalette.Size = new System.Drawing.Size(184, 546); this.tilePalette.TabIndex = 1; - // + // // tabPage2 - // + // this.tabPage2.Controls.Add(this.actorPalette); this.tabPage2.Location = new System.Drawing.Point(4, 20); this.tabPage2.Name = "tabPage2"; @@ -190,9 +190,9 @@ namespace OpenRA.Editor this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Actors"; this.tabPage2.UseVisualStyleBackColor = true; - // + // // actorPalette - // + // this.actorPalette.AutoScroll = true; this.actorPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.actorPalette.Dock = System.Windows.Forms.DockStyle.Fill; @@ -200,9 +200,9 @@ namespace OpenRA.Editor this.actorPalette.Name = "actorPalette"; this.actorPalette.Size = new System.Drawing.Size(184, 546); this.actorPalette.TabIndex = 2; - // + // // tabPage3 - // + // this.tabPage3.Controls.Add(this.resourcePalette); this.tabPage3.Location = new System.Drawing.Point(4, 20); this.tabPage3.Name = "tabPage3"; @@ -210,9 +210,9 @@ namespace OpenRA.Editor this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Resources"; this.tabPage3.UseVisualStyleBackColor = true; - // + // // resourcePalette - // + // this.resourcePalette.AutoScroll = true; this.resourcePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.resourcePalette.Dock = System.Windows.Forms.DockStyle.Fill; @@ -220,9 +220,9 @@ namespace OpenRA.Editor this.resourcePalette.Name = "resourcePalette"; this.resourcePalette.Size = new System.Drawing.Size(190, 552); this.resourcePalette.TabIndex = 3; - // + // // surface1 - // + // this.surface1.BackColor = System.Drawing.Color.Black; this.surface1.Dock = System.Windows.Forms.DockStyle.Fill; this.surface1.Location = new System.Drawing.Point(0, 0); @@ -230,39 +230,39 @@ namespace OpenRA.Editor this.surface1.Size = new System.Drawing.Size(783, 744); this.surface1.TabIndex = 5; this.surface1.Text = "surface1"; - // + // // tt - // + // this.tt.ShowAlways = true; - // + // // saveFileDialog - // + // this.saveFileDialog.DefaultExt = "*.png"; this.saveFileDialog.Filter = "PNG Image (*.png)|"; this.saveFileDialog.Title = "Export minimap to PNG"; - // + // // splitContainer3 - // + // this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer3.IsSplitterFixed = true; this.splitContainer3.Location = new System.Drawing.Point(0, 0); this.splitContainer3.Name = "splitContainer3"; this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; - // + // // splitContainer3.Panel1 - // + // this.splitContainer3.Panel1.Controls.Add(this.menuStrip1); - // + // // splitContainer3.Panel2 - // + // this.splitContainer3.Panel2.Controls.Add(this.splitContainer1); this.splitContainer3.Size = new System.Drawing.Size(985, 773); this.splitContainer3.SplitterDistance = 25; this.splitContainer3.TabIndex = 6; - // + // // menuStrip1 - // + // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.mapToolStripMenuItem, @@ -273,9 +273,9 @@ namespace OpenRA.Editor this.menuStrip1.Size = new System.Drawing.Size(985, 27); this.menuStrip1.TabIndex = 1; this.menuStrip1.Text = "menuStrip1"; - // + // // fileToolStripMenuItem - // + // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, this.toolStripSeparator1, @@ -290,107 +290,107 @@ namespace OpenRA.Editor this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 23); this.fileToolStripMenuItem.Text = "&File"; - // + // // newToolStripMenuItem - // + // this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.newToolStripMenuItem.Text = "&New..."; this.newToolStripMenuItem.Click += new System.EventHandler(this.NewClicked); - // + // // toolStripSeparator1 - // + // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6); - // + // // openToolStripMenuItem - // + // this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.openToolStripMenuItem.Text = "&Open..."; this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenClicked); - // + // // saveToolStripMenuItem - // + // this.saveToolStripMenuItem.Enabled = false; this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.saveToolStripMenuItem.Text = "&Save"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveClicked); - // + // // saveAsToolStripMenuItem - // + // this.saveAsToolStripMenuItem.Enabled = false; this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.saveAsToolStripMenuItem.Text = "Save &As..."; this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsClicked); - // + // // toolStripSeparator2 - // + // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6); - // + // // toolStripMenuItem1 - // + // this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cCRedAlertMapToolStripMenuItem, this.bitmapToolStripMenuItem}); this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItem1.Text = "&Import"; - // + // // cCRedAlertMapToolStripMenuItem - // + // this.cCRedAlertMapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cCRedAlertMapToolStripMenuItem.Image"))); this.cCRedAlertMapToolStripMenuItem.Name = "cCRedAlertMapToolStripMenuItem"; this.cCRedAlertMapToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.cCRedAlertMapToolStripMenuItem.Text = "&C&&C / Red Alert Map..."; this.cCRedAlertMapToolStripMenuItem.Click += new System.EventHandler(this.ImportLegacyMapClicked); - // + // // bitmapToolStripMenuItem - // + // this.bitmapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bitmapToolStripMenuItem.Image"))); this.bitmapToolStripMenuItem.Name = "bitmapToolStripMenuItem"; this.bitmapToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.bitmapToolStripMenuItem.Text = "&Bitmap..."; this.bitmapToolStripMenuItem.Visible = false; - // + // // mnuExport - // + // this.mnuExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuMinimapToPNG}); this.mnuExport.Name = "mnuExport"; this.mnuExport.Size = new System.Drawing.Size(123, 22); this.mnuExport.Text = "&Export"; - // + // // mnuMinimapToPNG - // + // this.mnuMinimapToPNG.Enabled = false; this.mnuMinimapToPNG.Image = ((System.Drawing.Image)(resources.GetObject("mnuMinimapToPNG.Image"))); this.mnuMinimapToPNG.Name = "mnuMinimapToPNG"; this.mnuMinimapToPNG.Size = new System.Drawing.Size(163, 22); this.mnuMinimapToPNG.Text = "Minimap to PNG"; this.mnuMinimapToPNG.Click += new System.EventHandler(this.ExportMinimap); - // + // // toolStripSeparator3 - // + // this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6); - // + // // exitToolStripMenuItem - // + // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.CloseClicked); - // + // // mapToolStripMenuItem - // + // this.mapToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.propertiesToolStripMenuItem, this.resizeToolStripMenuItem, @@ -399,48 +399,48 @@ namespace OpenRA.Editor this.mapToolStripMenuItem.Name = "mapToolStripMenuItem"; this.mapToolStripMenuItem.Size = new System.Drawing.Size(43, 23); this.mapToolStripMenuItem.Text = "&Map"; - // + // // propertiesToolStripMenuItem - // + // this.propertiesToolStripMenuItem.Enabled = false; this.propertiesToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("propertiesToolStripMenuItem.Image"))); this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.propertiesToolStripMenuItem.Text = "&Properties..."; this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.PropertiesClicked); - // + // // resizeToolStripMenuItem - // + // this.resizeToolStripMenuItem.Enabled = false; this.resizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("resizeToolStripMenuItem.Image"))); this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem"; this.resizeToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.resizeToolStripMenuItem.Text = "&Resize..."; this.resizeToolStripMenuItem.Click += new System.EventHandler(this.ResizeClicked); - // + // // showActorNamesToolStripMenuItem - // + // this.showActorNamesToolStripMenuItem.Name = "showActorNamesToolStripMenuItem"; this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.showActorNamesToolStripMenuItem.Text = "Show Actor &Names"; this.showActorNamesToolStripMenuItem.Click += new System.EventHandler(this.ShowActorNamesClicked); - // + // // toolStripComboBox1 - // + // this.toolStripComboBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.toolStripComboBox1.Name = "toolStripComboBox1"; this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); - // + // // toolStripLabel1 - // + // this.toolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Size = new System.Drawing.Size(71, 20); this.toolStripLabel1.Text = "Active Mod:"; - // + // // statusStrip1 - // + // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabelFiller, this.toolStripStatusLabelMousePosition}); @@ -449,29 +449,29 @@ namespace OpenRA.Editor this.statusStrip1.Size = new System.Drawing.Size(985, 22); this.statusStrip1.TabIndex = 7; this.statusStrip1.Text = "statusStrip1"; - // + // // toolStripStatusLabelFiller - // + // this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller"; this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17); this.toolStripStatusLabelFiller.Spring = true; - // + // // toolStripStatusLabelMousePosition - // + // this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition"; this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17); this.toolStripStatusLabelMousePosition.Text = "0,0"; - // + // // fixOpenAreasToolStripMenuItem - // + // this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem"; this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas"; this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas); - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(985, 773); diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index b5e58ad577..2f991c6799 100755 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,8 +29,8 @@ namespace OpenRA.Editor currentMod = args.FirstOrDefault() ?? "ra"; toolStripComboBox1.Items.AddRange(Mod.AllMods.Keys.ToArray()); - - toolStripComboBox1.SelectedIndexChanged += (_, e) => + + toolStripComboBox1.SelectedIndexChanged += (_, e) => { tilePalette.SuspendLayout(); actorPalette.SuspendLayout(); @@ -44,19 +44,19 @@ namespace OpenRA.Editor surface1.Bind(null, null, null); pmMiniMap.Image = null; currentMod = toolStripComboBox1.SelectedItem as string; - + Text = "OpenRA Editor (mod:{0})".F(currentMod); Game.modData = new ModData(currentMod); FileSystem.LoadFromManifest(Game.modData.Manifest); Rules.LoadRules(Game.modData.Manifest, new Map()); loadedMapName = null; }; - + toolStripComboBox1.SelectedItem = currentMod; - + surface1.AfterChange += OnMapChanged; surface1.MousePositionChanged += s => toolStripStatusLabelMousePosition.Text = s; - + if (args.Length >= 2) LoadMap(args[1]); } @@ -366,7 +366,7 @@ namespace OpenRA.Editor void ImportLegacyMapClicked(object sender, EventArgs e) { - using (var ofd = new OpenFileDialog { RestoreDirectory = true, + using (var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = "Legacy maps (*.ini;*.mpr)|*.ini;*.mpr" }) if (DialogResult.OK == ofd.ShowDialog()) { @@ -385,7 +385,7 @@ namespace OpenRA.Editor eld.ShowDialog(); map.MakeDefaultPlayers(); - + map.Save(savePath); LoadMap(savePath); loadedMapName = null; /* editor needs to think this hasnt been saved */ @@ -433,7 +433,7 @@ namespace OpenRA.Editor { var tr = surface1.Map.MapTiles.Value[i, j]; if (tr.type == 0xff || tr.type == 0xffff || tr.type == 1 || tr.type == 2) - tr.index = (byte)r.Next(0, + tr.index = (byte)r.Next(0, Rules.TileSets[surface1.Map.Tileset].Tiles[tr.type].TileBitmapBytes.Count); surface1.Map.MapTiles.Value[i, j] = tr; diff --git a/OpenRA.Editor/ITool.cs b/OpenRA.Editor/ITool.cs index e03083098f..62a8e56060 100644 --- a/OpenRA.Editor/ITool.cs +++ b/OpenRA.Editor/ITool.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/LegacyMapImporter.cs b/OpenRA.Editor/LegacyMapImporter.cs index 3f8bd17a32..698c9b126c 100644 --- a/OpenRA.Editor/LegacyMapImporter.cs +++ b/OpenRA.Editor/LegacyMapImporter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,12 +39,12 @@ namespace OpenRA.Editor { "gold02", new Pair(1,1) }, { "gold03", new Pair(1,2) }, { "gold04", new Pair(1,3) }, - + { "gem01", new Pair(2,0) }, { "gem02", new Pair(2,1) }, { "gem03", new Pair(2,2) }, { "gem04", new Pair(2,3) }, - + // cnc tiberium { "ti1", new Pair(1,0) }, { "ti2", new Pair(1,1) }, @@ -67,7 +67,7 @@ namespace OpenRA.Editor {"brik","brik"}, {"fenc","fenc"}, {"wood","wood"}, - + // Fields {"v12","v12"}, {"v13","v13"}, @@ -76,12 +76,12 @@ namespace OpenRA.Editor {"v16","v16"}, {"v17","v17"}, {"v18","v18"}, - + // Crates // {"wcrate","crate"}, // {"scrate","crate"}, }; - + // todo: fix this -- will have bitrotted pretty badly. static Dictionary> namedColorMapping = new Dictionary>() { @@ -96,13 +96,13 @@ namespace OpenRA.Editor {"white",Pair.New(Color.FromArgb(255,255,255),Color.FromArgb(75,75,75))}, {"black",Pair.New(Color.FromArgb(80,80,80),Color.FromArgb(5,5,5))}, }; - + int MapSize; int ActorCount = 0; Map Map = new Map(); List Players = new List(); Action errorHandler; - + LegacyMapImporter(string filename, Action errorHandler) { this.errorHandler = errorHandler; @@ -116,10 +116,10 @@ namespace OpenRA.Editor } enum IniMapFormat { RedAlert = 3, /* otherwise, cnc (2 variants exist, we don't care to differentiate) */ }; - + public void ConvertIniMap(string iniFile) { - + var file = new IniFile(FileSystem.Open(iniFile)); var basic = file.GetSection("Basic"); var map = file.GetSection("Map"); @@ -137,12 +137,12 @@ namespace OpenRA.Editor Map.MapSize.Y = MapSize; Map.Bounds = Rectangle.FromLTRB(XOffset, YOffset, XOffset + Width, YOffset + Height); Map.Selectable = true; - + Map.Smudges = Lazy.New(() => new List()); Map.Actors = Lazy.New(() => new Dictionary()); Map.MapResources = Lazy.New(() => new TileReference[MapSize, MapSize]); Map.MapTiles = Lazy.New(() => new TileReference[MapSize, MapSize]); - + if (legacyMapFormat == IniMapFormat.RedAlert) { UnpackRATileData(ReadPackedSection(file.GetSection("MapPack"))); @@ -155,22 +155,22 @@ namespace OpenRA.Editor ReadCncOverlay(file); ReadCncTrees(file); } - + LoadActors(file, "STRUCTURES"); LoadActors(file, "UNITS"); LoadActors(file, "INFANTRY"); LoadSmudges(file, "SMUDGE"); - + foreach (var p in Players) LoadPlayer(file, p, (legacyMapFormat == IniMapFormat.RedAlert)); - + var wps = file.GetSection("Waypoints") .Where(kv => int.Parse(kv.Value) > 0) .Select(kv => Pair.New(int.Parse(kv.Key), LocationFromMapOffset(int.Parse(kv.Value), MapSize))) .ToArray(); - - + + // Add waypoint actors foreach( var kv in wps ) { @@ -179,7 +179,7 @@ namespace OpenRA.Editor a.Add(new OwnerInit("Neutral")); Map.Actors.Value.Add("spawn" + kv.First, a); } - + } static int2 LocationFromMapOffset(int offset, int mapSize) @@ -243,7 +243,7 @@ namespace OpenRA.Editor return ret; } - + void UnpackRATileData(MemoryStream ms) { for (int i = 0; i < MapSize; i++) @@ -274,10 +274,10 @@ namespace OpenRA.Editor if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o])) Map.Actors.Value.Add("Actor" + ActorCount++, - new ActorReference(overlayActorMapping[raOverlayNames[o]]) - { + new ActorReference(overlayActorMapping[raOverlayNames[o]]) + { new LocationInit( new int2(i, j) ), - new OwnerInit( "Neutral" ) + new OwnerInit( "Neutral" ) }); } } @@ -291,7 +291,7 @@ namespace OpenRA.Editor foreach (KeyValuePair kv in terrain) { var loc = int.Parse(kv.Key); - Map.Actors.Value.Add("Actor" + ActorCount++, + Map.Actors.Value.Add("Actor" + ActorCount++, new ActorReference(kv.Value.ToLowerInvariant()) { new LocationInit(new int2(loc % MapSize, loc / MapSize)), @@ -313,7 +313,7 @@ namespace OpenRA.Editor Map.MapTiles.Value[i, j].index = ReadByte(ms); } } - + void ReadCncOverlay(IniFile file) { IniSection overlay = file.GetSection("OVERLAY", true); @@ -332,7 +332,7 @@ namespace OpenRA.Editor Map.MapResources.Value[cell.X, cell.Y] = new TileReference(res.First, res.Second); if (overlayActorMapping.ContainsKey(kv.Value.ToLower())) - Map.Actors.Value.Add("Actor" + ActorCount++, + Map.Actors.Value.Add("Actor" + ActorCount++, new ActorReference(overlayActorMapping[kv.Value.ToLower()]) { new LocationInit(cell), @@ -340,7 +340,7 @@ namespace OpenRA.Editor }); } } - + void ReadCncTrees(IniFile file) { IniSection terrain = file.GetSection("TERRAIN", true); @@ -401,7 +401,7 @@ namespace OpenRA.Editor } } } - + void LoadSmudges(IniFile file, string section) { foreach (var s in file.GetSection(section, true)) @@ -412,14 +412,14 @@ namespace OpenRA.Editor Map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), int.Parse(parts[2]))); } } - + void LoadPlayer(IniFile file, string section, bool isRA) - { + { var c = section == "BadGuy" ? "red" : isRA ? "blue" : "gold"; - + var color = namedColorMapping[c]; - + var pr = new PlayerReference { Name = section, @@ -432,7 +432,7 @@ namespace OpenRA.Editor (byte)(color.First.GetBrightness() * 255), (byte)(color.Second.GetBrightness() * 255)) }; - + var Neutral = new [] {"Neutral"}; foreach (var s in file.GetSection(section, true)) { @@ -448,7 +448,7 @@ namespace OpenRA.Editor break; } } - + Map.Players.Add(section, pr); } diff --git a/OpenRA.Editor/MapSelect.Designer.cs b/OpenRA.Editor/MapSelect.Designer.cs index 9184aadb3e..32d930df6b 100644 --- a/OpenRA.Editor/MapSelect.Designer.cs +++ b/OpenRA.Editor/MapSelect.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -70,9 +70,9 @@ namespace OpenRA.Editor this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); - // + // // MapList - // + // this.MapList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.MapList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.colMapName}); @@ -89,20 +89,20 @@ namespace OpenRA.Editor this.MapList.UseCompatibleStateImageBehavior = false; this.MapList.View = System.Windows.Forms.View.Details; this.MapList.SelectedIndexChanged += new System.EventHandler(this.MapList_SelectedIndexChanged); - // + // // colMapName - // + // this.colMapName.Text = "Map name"; this.colMapName.Width = 240; - // + // // MapIconsList - // + // this.MapIconsList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; this.MapIconsList.ImageSize = new System.Drawing.Size(24, 24); this.MapIconsList.TransparentColor = System.Drawing.Color.Transparent; - // + // // btnCancel - // + // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(407, 35); this.btnCancel.Name = "btnCancel"; @@ -110,9 +110,9 @@ namespace OpenRA.Editor this.btnCancel.TabIndex = 3; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; - // + // // btnOk - // + // this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOk.Location = new System.Drawing.Point(326, 35); this.btnOk.Name = "btnOk"; @@ -120,9 +120,9 @@ namespace OpenRA.Editor this.btnOk.TabIndex = 2; this.btnOk.Text = "Open"; this.btnOk.UseVisualStyleBackColor = true; - // + // // lblNew - // + // this.lblNew.AutoSize = true; this.lblNew.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.lblNew.Location = new System.Drawing.Point(12, 40); @@ -130,18 +130,18 @@ namespace OpenRA.Editor this.lblNew.Size = new System.Drawing.Size(69, 13); this.lblNew.TabIndex = 3; this.lblNew.Text = "Map name:"; - // + // // txtNew - // + // this.txtNew.BackColor = System.Drawing.SystemColors.Window; this.txtNew.Location = new System.Drawing.Point(88, 37); this.txtNew.Name = "txtNew"; this.txtNew.ReadOnly = true; this.txtNew.Size = new System.Drawing.Size(232, 20); this.txtNew.TabIndex = 1; - // + // // pbMinimap - // + // this.pbMinimap.BackColor = System.Drawing.Color.Black; this.pbMinimap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.pbMinimap.Location = new System.Drawing.Point(32, 25); @@ -150,9 +150,9 @@ namespace OpenRA.Editor this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbMinimap.TabIndex = 5; this.pbMinimap.TabStop = false; - // + // // pnlBottom - // + // this.pnlBottom.Controls.Add(this.pictureBox1); this.pnlBottom.Controls.Add(this.txtPathOut); this.pnlBottom.Controls.Add(this.lblPathOut); @@ -167,9 +167,9 @@ namespace OpenRA.Editor this.pnlBottom.Name = "pnlBottom"; this.pnlBottom.Size = new System.Drawing.Size(494, 70); this.pnlBottom.TabIndex = 6; - // + // // txtPathOut - // + // this.txtPathOut.BackColor = System.Drawing.SystemColors.Window; this.txtPathOut.Location = new System.Drawing.Point(55, 10); this.txtPathOut.Name = "txtPathOut"; @@ -177,17 +177,17 @@ namespace OpenRA.Editor this.txtPathOut.Size = new System.Drawing.Size(265, 20); this.txtPathOut.TabIndex = 0; this.txtPathOut.TextChanged += new System.EventHandler(this.txtPathOut_TextChanged); - // + // // lblPathOut - // + // this.lblPathOut.AutoSize = true; this.lblPathOut.Location = new System.Drawing.Point(55, 13); this.lblPathOut.Name = "lblPathOut"; this.lblPathOut.Size = new System.Drawing.Size(0, 13); this.lblPathOut.TabIndex = 6; - // + // // lblPath - // + // this.lblPath.AutoSize = true; this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.lblPath.Location = new System.Drawing.Point(12, 13); @@ -195,20 +195,20 @@ namespace OpenRA.Editor this.lblPath.Size = new System.Drawing.Size(37, 13); this.lblPath.TabIndex = 5; this.lblPath.Text = "Path:"; - // + // // splitContainer1 - // + // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; - // + // // splitContainer1.Panel1 - // + // this.splitContainer1.Panel1.Controls.Add(this.lblMapList); this.splitContainer1.Panel1.Controls.Add(this.MapList); - // + // // splitContainer1.Panel2 - // + // this.splitContainer1.Panel2.Controls.Add(this.txtDesc); this.splitContainer1.Panel2.Controls.Add(this.lblDesc); this.splitContainer1.Panel2.Controls.Add(this.txtTheater); @@ -222,90 +222,90 @@ namespace OpenRA.Editor this.splitContainer1.Size = new System.Drawing.Size(494, 332); this.splitContainer1.SplitterDistance = 300; this.splitContainer1.TabIndex = 7; - // + // // lblMapList - // + // this.lblMapList.AutoSize = true; this.lblMapList.Location = new System.Drawing.Point(12, 9); this.lblMapList.Name = "lblMapList"; this.lblMapList.Size = new System.Drawing.Size(81, 13); this.lblMapList.TabIndex = 1; this.lblMapList.Text = "Available maps:"; - // + // // txtDesc - // + // this.txtDesc.BackColor = System.Drawing.SystemColors.ButtonFace; this.txtDesc.Location = new System.Drawing.Point(16, 289); this.txtDesc.Name = "txtDesc"; this.txtDesc.ReadOnly = true; this.txtDesc.Size = new System.Drawing.Size(162, 20); this.txtDesc.TabIndex = 14; - // + // // lblDesc - // + // this.lblDesc.AutoSize = true; this.lblDesc.Location = new System.Drawing.Point(13, 273); this.lblDesc.Name = "lblDesc"; this.lblDesc.Size = new System.Drawing.Size(63, 13); this.lblDesc.TabIndex = 13; this.lblDesc.Text = "Description:"; - // + // // txtTheater - // + // this.txtTheater.BackColor = System.Drawing.SystemColors.ButtonFace; this.txtTheater.Location = new System.Drawing.Point(16, 252); this.txtTheater.Name = "txtTheater"; this.txtTheater.ReadOnly = true; this.txtTheater.Size = new System.Drawing.Size(162, 20); this.txtTheater.TabIndex = 12; - // + // // lblTheater - // + // this.lblTheater.AutoSize = true; this.lblTheater.Location = new System.Drawing.Point(13, 236); this.lblTheater.Name = "lblTheater"; this.lblTheater.Size = new System.Drawing.Size(47, 13); this.lblTheater.TabIndex = 11; this.lblTheater.Text = "Tileset:"; - // + // // txtAuthor - // + // this.txtAuthor.BackColor = System.Drawing.SystemColors.ButtonFace; this.txtAuthor.Location = new System.Drawing.Point(16, 214); this.txtAuthor.Name = "txtAuthor"; this.txtAuthor.ReadOnly = true; this.txtAuthor.Size = new System.Drawing.Size(162, 20); this.txtAuthor.TabIndex = 10; - // + // // lblAuthor - // + // this.lblAuthor.AutoSize = true; this.lblAuthor.Location = new System.Drawing.Point(13, 198); this.lblAuthor.Name = "lblAuthor"; this.lblAuthor.Size = new System.Drawing.Size(41, 13); this.lblAuthor.TabIndex = 9; this.lblAuthor.Text = "Author:"; - // + // // txtTitle - // + // this.txtTitle.BackColor = System.Drawing.SystemColors.ButtonFace; this.txtTitle.Location = new System.Drawing.Point(16, 177); this.txtTitle.Name = "txtTitle"; this.txtTitle.ReadOnly = true; this.txtTitle.Size = new System.Drawing.Size(162, 20); this.txtTitle.TabIndex = 8; - // + // // lblMapName - // + // this.lblMapName.AutoSize = true; this.lblMapName.Location = new System.Drawing.Point(13, 161); this.lblMapName.Name = "lblMapName"; this.lblMapName.Size = new System.Drawing.Size(30, 13); this.lblMapName.TabIndex = 7; this.lblMapName.Text = "Title:"; - // + // // lblMinimap - // + // this.lblMinimap.AutoSize = true; this.lblMinimap.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.lblMinimap.Location = new System.Drawing.Point(29, 9); @@ -313,9 +313,9 @@ namespace OpenRA.Editor this.lblMinimap.Size = new System.Drawing.Size(71, 13); this.lblMinimap.TabIndex = 6; this.lblMinimap.Text = "Map preview:"; - // + // // pictureBox1 - // + // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(336, -9); this.pictureBox1.Name = "pictureBox1"; @@ -323,9 +323,9 @@ namespace OpenRA.Editor this.pictureBox1.TabIndex = 7; this.pictureBox1.TabStop = false; this.pictureBox1.Visible = false; - // + // // MapSelect - // + // this.AcceptButton = this.btnOk; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; diff --git a/OpenRA.Editor/MapSelect.cs b/OpenRA.Editor/MapSelect.cs index 76715cd2c2..1c09892264 100644 --- a/OpenRA.Editor/MapSelect.cs +++ b/OpenRA.Editor/MapSelect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Editor { MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" } .Aggregate(Path.Combine); - + InitializeComponent(); MapIconsList.Images.Add(pictureBox1.Image); } @@ -34,7 +34,7 @@ namespace OpenRA.Editor { MapList.Items.Clear(); txtPathOut.Text = MapFolderPath; - + foreach (var map in ModData.FindMapsIn(MapFolderPath)) { ListViewItem map1 = new ListViewItem(); @@ -43,7 +43,7 @@ namespace OpenRA.Editor map1.ImageIndex = 0; MapList.Items.Add(map1); } - + // hack if (txtNew.Text != "unnamed") MapList.Items[0].Selected = true; @@ -62,7 +62,7 @@ namespace OpenRA.Editor txtTheater.Text = map.Tileset; txtDesc.Text = map.Description; pbMinimap.Image = null; - + try { pbMinimap.Image = Minimap.AddStaticResources(map, Minimap.TerrainBitmap(map, true)); diff --git a/OpenRA.Editor/NewMapDialog.Designer.cs b/OpenRA.Editor/NewMapDialog.Designer.cs index 48df76d0cd..00407886fa 100755 --- a/OpenRA.Editor/NewMapDialog.Designer.cs +++ b/OpenRA.Editor/NewMapDialog.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -58,9 +58,9 @@ namespace OpenRA.Editor ((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit(); this.SuspendLayout(); - // + // // button2 - // + // this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; this.button2.Location = new System.Drawing.Point(229, 160); this.button2.Name = "button2"; @@ -68,9 +68,9 @@ namespace OpenRA.Editor this.button2.TabIndex = 7; this.button2.Text = "OK"; this.button2.UseVisualStyleBackColor = true; - // + // // button1 - // + // this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button1.Location = new System.Drawing.Point(310, 160); this.button1.Name = "button1"; @@ -78,36 +78,36 @@ namespace OpenRA.Editor this.button1.TabIndex = 8; this.button1.Text = "Cancel"; this.button1.UseVisualStyleBackColor = true; - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(31, 77); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(107, 13); this.label3.TabIndex = 9; this.label3.Text = "Cordon Right/Bottom"; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(31, 51); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(86, 13); this.label2.TabIndex = 11; this.label2.Text = "Cordon Left/Top"; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(31, 25); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(27, 13); this.label1.TabIndex = 10; this.label1.Text = "Size"; - // + // // cordonBottom - // + // this.cordonBottom.Location = new System.Drawing.Point(280, 75); this.cordonBottom.Maximum = new decimal(new int[] { 2048, @@ -123,9 +123,9 @@ namespace OpenRA.Editor 0, 0}); this.cordonBottom.Enter += new System.EventHandler(this.SelectText); - // + // // cordonTop - // + // this.cordonTop.Location = new System.Drawing.Point(280, 49); this.cordonTop.Maximum = new decimal(new int[] { 2048, @@ -141,9 +141,9 @@ namespace OpenRA.Editor 0, 0}); this.cordonTop.Enter += new System.EventHandler(this.SelectText); - // + // // cordonRight - // + // this.cordonRight.Location = new System.Drawing.Point(169, 75); this.cordonRight.Maximum = new decimal(new int[] { 2048, @@ -159,9 +159,9 @@ namespace OpenRA.Editor 0, 0}); this.cordonRight.Enter += new System.EventHandler(this.SelectText); - // + // // cordonLeft - // + // this.cordonLeft.Location = new System.Drawing.Point(169, 49); this.cordonLeft.Maximum = new decimal(new int[] { 2048, @@ -177,9 +177,9 @@ namespace OpenRA.Editor 0, 0}); this.cordonLeft.Enter += new System.EventHandler(this.SelectText); - // + // // height - // + // this.height.Increment = new decimal(new int[] { 8, 0, @@ -200,9 +200,9 @@ namespace OpenRA.Editor 0, 0}); this.height.Enter += new System.EventHandler(this.SelectText); - // + // // width - // + // this.width.Increment = new decimal(new int[] { 8, 0, @@ -223,27 +223,27 @@ namespace OpenRA.Editor 0, 0}); this.width.Enter += new System.EventHandler(this.SelectText); - // + // // label4 - // + // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(31, 124); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(44, 13); this.label4.TabIndex = 14; this.label4.Text = "Tileset"; - // + // // theater - // + // this.theater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.theater.FormattingEnabled = true; this.theater.Location = new System.Drawing.Point(169, 121); this.theater.Name = "theater"; this.theater.Size = new System.Drawing.Size(216, 21); this.theater.TabIndex = 6; - // + // // NewMapDialog - // + // this.AcceptButton = this.button2; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; diff --git a/OpenRA.Editor/NewMapDialog.cs b/OpenRA.Editor/NewMapDialog.cs index 1845e86ebf..3db52d4144 100755 --- a/OpenRA.Editor/NewMapDialog.cs +++ b/OpenRA.Editor/NewMapDialog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/Program.cs b/OpenRA.Editor/Program.cs index b063b563aa..2e44ff1f13 100644 --- a/OpenRA.Editor/Program.cs +++ b/OpenRA.Editor/Program.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,19 +30,19 @@ namespace OpenRA.Editor UpgradeMaps(args[1]); return; } - + Application.CurrentCulture = CultureInfo.InvariantCulture; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(args)); } - + static void UpgradeMaps(string mod) { var MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", mod, "maps" } .Aggregate(Path.Combine); - + foreach (var path in ModData.FindMapsIn(MapFolderPath)) { var map = new Map(path); @@ -54,6 +54,6 @@ namespace OpenRA.Editor map.Save(path); } } - + } } diff --git a/OpenRA.Editor/Properties/AssemblyInfo.cs b/OpenRA.Editor/Properties/AssemblyInfo.cs index 1fedfc5aa9..89becad42b 100644 --- a/OpenRA.Editor/Properties/AssemblyInfo.cs +++ b/OpenRA.Editor/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Editor")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.Editor/PropertiesDialog.Designer.cs b/OpenRA.Editor/PropertiesDialog.Designer.cs index a23a8c98e2..57c72ff325 100644 --- a/OpenRA.Editor/PropertiesDialog.Designer.cs +++ b/OpenRA.Editor/PropertiesDialog.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -49,9 +49,9 @@ namespace OpenRA.Editor this.author = new System.Windows.Forms.TextBox(); this.useAsShellmap = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); - // + // // button2 - // + // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; this.button2.Location = new System.Drawing.Point(196, 193); @@ -60,9 +60,9 @@ namespace OpenRA.Editor this.button2.TabIndex = 14; this.button2.Text = "OK"; this.button2.UseVisualStyleBackColor = true; - // + // // button1 - // + // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button1.Location = new System.Drawing.Point(277, 193); @@ -71,41 +71,41 @@ namespace OpenRA.Editor this.button1.TabIndex = 15; this.button1.Text = "Cancel"; this.button1.UseVisualStyleBackColor = true; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 50); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(27, 13); this.label1.TabIndex = 16; this.label1.Text = "Title"; - // + // // title - // + // this.title.Location = new System.Drawing.Point(66, 47); this.title.Name = "title"; this.title.Size = new System.Drawing.Size(286, 20); this.title.TabIndex = 17; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 76); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(32, 13); this.label2.TabIndex = 16; this.label2.Text = "Desc"; - // + // // desc - // + // this.desc.Location = new System.Drawing.Point(66, 73); this.desc.Name = "desc"; this.desc.Size = new System.Drawing.Size(286, 20); this.desc.TabIndex = 17; - // + // // selectable - // + // this.selectable.AutoSize = true; this.selectable.Location = new System.Drawing.Point(118, 138); this.selectable.Name = "selectable"; @@ -113,25 +113,25 @@ namespace OpenRA.Editor this.selectable.TabIndex = 18; this.selectable.Text = "Show in Map Chooser"; this.selectable.UseVisualStyleBackColor = true; - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(12, 102); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(38, 13); this.label3.TabIndex = 16; this.label3.Text = "Author"; - // + // // author - // + // this.author.Location = new System.Drawing.Point(66, 99); this.author.Name = "author"; this.author.Size = new System.Drawing.Size(286, 20); this.author.TabIndex = 17; - // + // // checkBox1 - // + // this.useAsShellmap.AutoSize = true; this.useAsShellmap.Location = new System.Drawing.Point(118, 161); this.useAsShellmap.Name = "checkBox1"; @@ -139,9 +139,9 @@ namespace OpenRA.Editor this.useAsShellmap.TabIndex = 18; this.useAsShellmap.Text = "Use as Shellmap"; this.useAsShellmap.UseVisualStyleBackColor = true; - // + // // PropertiesDialog - // + // this.AcceptButton = this.button2; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; diff --git a/OpenRA.Editor/PropertiesDialog.cs b/OpenRA.Editor/PropertiesDialog.cs index 875c92c54b..86aa67ad73 100644 --- a/OpenRA.Editor/PropertiesDialog.cs +++ b/OpenRA.Editor/PropertiesDialog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/RenderUtils.cs b/OpenRA.Editor/RenderUtils.cs index ad4d765659..a9e03f2802 100644 --- a/OpenRA.Editor/RenderUtils.cs +++ b/OpenRA.Editor/RenderUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -85,7 +85,7 @@ namespace OpenRA.Editor public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, Palette p) { var image = RenderSimple.GetImage(info); - + using (var s = FileSystem.OpenWithExts(image, tileset.Extensions)) { var shp = new ShpReader(s); diff --git a/OpenRA.Editor/ResizeDialog.Designer.cs b/OpenRA.Editor/ResizeDialog.Designer.cs index c084db8210..8be0f50a06 100644 --- a/OpenRA.Editor/ResizeDialog.Designer.cs +++ b/OpenRA.Editor/ResizeDialog.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -56,9 +56,9 @@ namespace OpenRA.Editor ((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit(); this.SuspendLayout(); - // + // // width - // + // this.width.Increment = new decimal(new int[] { 8, 0, @@ -73,27 +73,27 @@ namespace OpenRA.Editor this.width.Name = "width"; this.width.Size = new System.Drawing.Size(105, 20); this.width.TabIndex = 0; - // + // // label1 - // + // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(23, 20); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(27, 13); this.label1.TabIndex = 1; this.label1.Text = "Size"; - // + // // label2 - // + // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(23, 46); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(86, 13); this.label2.TabIndex = 1; this.label2.Text = "Cordon Left/Top"; - // + // // cordonLeft - // + // this.cordonLeft.Location = new System.Drawing.Point(161, 44); this.cordonLeft.Maximum = new decimal(new int[] { 2048, @@ -103,9 +103,9 @@ namespace OpenRA.Editor this.cordonLeft.Name = "cordonLeft"; this.cordonLeft.Size = new System.Drawing.Size(105, 20); this.cordonLeft.TabIndex = 0; - // + // // cordonTop - // + // this.cordonTop.Location = new System.Drawing.Point(272, 44); this.cordonTop.Maximum = new decimal(new int[] { 2048, @@ -115,9 +115,9 @@ namespace OpenRA.Editor this.cordonTop.Name = "cordonTop"; this.cordonTop.Size = new System.Drawing.Size(105, 20); this.cordonTop.TabIndex = 0; - // + // // cordonRight - // + // this.cordonRight.Location = new System.Drawing.Point(161, 70); this.cordonRight.Maximum = new decimal(new int[] { 2048, @@ -127,9 +127,9 @@ namespace OpenRA.Editor this.cordonRight.Name = "cordonRight"; this.cordonRight.Size = new System.Drawing.Size(105, 20); this.cordonRight.TabIndex = 0; - // + // // cordonBottom - // + // this.cordonBottom.Location = new System.Drawing.Point(272, 70); this.cordonBottom.Maximum = new decimal(new int[] { 2048, @@ -139,18 +139,18 @@ namespace OpenRA.Editor this.cordonBottom.Name = "cordonBottom"; this.cordonBottom.Size = new System.Drawing.Size(105, 20); this.cordonBottom.TabIndex = 0; - // + // // label3 - // + // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(23, 72); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(107, 13); this.label3.TabIndex = 1; this.label3.Text = "Cordon Right/Bottom"; - // + // // button1 - // + // this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button1.Location = new System.Drawing.Point(302, 111); this.button1.Name = "button1"; @@ -158,9 +158,9 @@ namespace OpenRA.Editor this.button1.TabIndex = 2; this.button1.Text = "Cancel"; this.button1.UseVisualStyleBackColor = true; - // + // // button2 - // + // this.button2.DialogResult = System.Windows.Forms.DialogResult.OK; this.button2.Location = new System.Drawing.Point(221, 111); this.button2.Name = "button2"; @@ -168,9 +168,9 @@ namespace OpenRA.Editor this.button2.TabIndex = 2; this.button2.Text = "OK"; this.button2.UseVisualStyleBackColor = true; - // + // // height - // + // this.height.Increment = new decimal(new int[] { 8, 0, @@ -185,9 +185,9 @@ namespace OpenRA.Editor this.height.Name = "height"; this.height.Size = new System.Drawing.Size(105, 20); this.height.TabIndex = 0; - // + // // ResizeDialog - // + // this.AcceptButton = this.button2; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; diff --git a/OpenRA.Editor/ResizeDialog.cs b/OpenRA.Editor/ResizeDialog.cs index 081ec6105f..629a1502a7 100644 --- a/OpenRA.Editor/ResizeDialog.cs +++ b/OpenRA.Editor/ResizeDialog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Editor/ResourceTool.cs b/OpenRA.Editor/ResourceTool.cs index 1c60edbfa1..ae3a9d10b2 100644 --- a/OpenRA.Editor/ResourceTool.cs +++ b/OpenRA.Editor/ResourceTool.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,7 +30,7 @@ namespace OpenRA.Editor index = (byte)random.Next(Resource.Info.SpriteNames.Length) }; - var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize, + var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize, (surface.GetBrushLocation().Y) / Surface.ChunkSize); if (surface.Chunks.ContainsKey(ch)) diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs index 8a8968e268..1240a478cb 100755 --- a/OpenRA.Editor/Surface.cs +++ b/OpenRA.Editor/Surface.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA.Editor public float Zoom = 1.0f; ITool Tool; - + public bool IsPanning; public bool ShowActorNames; @@ -153,7 +153,7 @@ namespace OpenRA.Editor return; Tool = null; - + var key = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == BrushLocation); if (key.Key != null) Map.Actors.Value.Remove(key.Key); @@ -286,7 +286,7 @@ namespace OpenRA.Editor { var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft; var drawPos = GetDrawPosition(p, t.Bitmap, centered); - + g.DrawRectangle(CordonPen, drawPos.X, drawPos.Y, t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); @@ -360,7 +360,7 @@ namespace OpenRA.Editor if (Tool != null) Tool.Preview(this, e.Graphics); - + if (Tool == null) { var x = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == GetBrushLocation()); diff --git a/OpenRA.FileFormats/ColorRamp.cs b/OpenRA.FileFormats/ColorRamp.cs index ed04f6bed2..67e94b3754 100644 --- a/OpenRA.FileFormats/ColorRamp.cs +++ b/OpenRA.FileFormats/ColorRamp.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Evaluator.cs b/OpenRA.FileFormats/Evaluator.cs index 43aa1f32ac..40addb059b 100644 --- a/OpenRA.FileFormats/Evaluator.cs +++ b/OpenRA.FileFormats/Evaluator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -61,11 +61,11 @@ namespace OpenRA.FileFormats while ((temp = s.Pop()) != "(") yield return temp; } else if (char.IsNumber(t[0])) yield return t; - else if (char.IsLetter(t[0])) + else if (char.IsLetter(t[0])) { if (!syms.ContainsKey(t)) throw new InvalidOperationException("Substitution `{0}` undefined".F(t)); - + yield return syms[t].ToString(); } else @@ -74,7 +74,7 @@ namespace OpenRA.FileFormats s.Push(t); } } - + while (s.Count > 0) yield return s.Pop(); } diff --git a/OpenRA.FileFormats/Exts.cs b/OpenRA.FileFormats/Exts.cs index a18d923f16..df7b60fb64 100755 --- a/OpenRA.FileFormats/Exts.cs +++ b/OpenRA.FileFormats/Exts.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -111,11 +111,11 @@ namespace OpenRA { return (k & mod) == mod; } - + public static bool IsValidInput(this KeyInput key) { - return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) || - char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) || + return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) || + char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) || char.IsPunctuation(key.UnicodeChar); } @@ -149,7 +149,7 @@ namespace OpenRA // this is probably a shockingly-slow way to do this, but it's concise. return xs.Except(ys).Concat(ys.Except(xs)); } - + public static IEnumerable Iterate( this T t, Func f ) { for(;;) { yield return t; t = f(t); } diff --git a/OpenRA.FileFormats/FieldLoader.cs b/OpenRA.FileFormats/FieldLoader.cs index 1cde8801da..482300f101 100755 --- a/OpenRA.FileFormats/FieldLoader.cs +++ b/OpenRA.FileFormats/FieldLoader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -77,7 +77,7 @@ namespace OpenRA.FileFormats field.SetValue( self, GetValue( field.Name, field.FieldType, value ) ); return; } - + var prop = self.GetType().GetProperty( key.Trim() ); if (prop != null) @@ -207,7 +207,7 @@ namespace OpenRA.FileFormats var argValues = new object[] { parts }; return fieldType.GetConstructor(argTypes).Invoke(argValues); } - + UnknownFieldAction("[Type] {0}".F(x),fieldType); return null; } @@ -304,7 +304,7 @@ namespace OpenRA.FileFormats { return new MiniYamlNode(field, FieldSaver.FormatValue( o, o.GetType().GetField(field) )); } - + public static string FormatValue(object o, FieldInfo f) { var v = f.GetValue(o); diff --git a/OpenRA.FileFormats/FileFormats/AudLoader.cs b/OpenRA.FileFormats/FileFormats/AudLoader.cs index c283067ce0..4152276db8 100644 --- a/OpenRA.FileFormats/FileFormats/AudLoader.cs +++ b/OpenRA.FileFormats/FileFormats/AudLoader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -109,13 +109,13 @@ namespace OpenRA.FileFormats /*var dataSize = */ br.ReadInt32(); var outputSize = br.ReadInt32(); var flags = (SoundFlags) br.ReadByte(); - + var samples = outputSize; if (0 != (flags & SoundFlags.Stereo)) samples /= 2; if (0 != (flags & SoundFlags._16Bit)) samples /= 2; return samples / sampleRate; } - + public static byte[] LoadSound(Stream s) { var br = new BinaryReader(s); @@ -140,9 +140,9 @@ namespace OpenRA.FileFormats var t = DecodeSample(b, ref index, ref currentSample); output[offset++] = (byte)t; output[offset++] = (byte)(t >> 8); - + if (offset < outputSize) - { + { /* possible that only half of the final byte is used! */ t = DecodeSample((byte)(b >> 4), ref index, ref currentSample); output[offset++] = (byte)t; diff --git a/OpenRA.FileFormats/FileFormats/Blast.cs b/OpenRA.FileFormats/FileFormats/Blast.cs index c83e5ddc31..a3049b0225 100644 --- a/OpenRA.FileFormats/FileFormats/Blast.cs +++ b/OpenRA.FileFormats/FileFormats/Blast.cs @@ -1,12 +1,12 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. * - * This file is based on the blast routines (version 1.1 by Mark Adler) + * This file is based on the blast routines (version 1.1 by Mark Adler) * included in zlib/contrib */ #endregion @@ -20,7 +20,7 @@ namespace OpenRA.FileFormats { public static readonly int MAXBITS = 13; // maximum code length public static readonly int MAXWIN = 4096; // maximum window size - + static byte[] litlen = new byte[] { 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8, 9, @@ -51,28 +51,28 @@ namespace OpenRA.FileFormats 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - + static Huffman litcode = new Huffman(litlen, litlen.Length, 256); static Huffman lencode = new Huffman(lenlen, lenlen.Length, 16); static Huffman distcode = new Huffman(distlen, distlen.Length, 64); - + // Decode PKWare Compression Library stream. public static byte[] Decompress(byte[] src) { BitReader br = new BitReader(src); - + // Are literals coded? int coded = br.ReadBits(8); - + if (coded < 0 || coded > 1) throw new NotImplementedException("Invalid datastream"); bool EncodedLiterals = (coded == 1); - + // log2(dictionary size) - 6 int dict = br.ReadBits(8); if (dict < 4 || dict > 6) - throw new InvalidDataException("Invalid dictionary size"); - + throw new InvalidDataException("Invalid dictionary size"); + // output state ushort next = 0; // index of next write location in out[] bool first = true; // true to check distances (for first 4K) @@ -94,33 +94,33 @@ namespace OpenRA.FileFormats ms.WriteByte(outBuffer[i]); break; } - + // Distance symbol = len == 2 ? 2 : dict; int dist = Decode(distcode, br) << symbol; dist += br.ReadBits(symbol); dist++; - + if (first && dist > next) throw new InvalidDataException("Attempt to jump before data"); - + // copy length bytes from distance bytes back do { int dest = next; int source = dest - dist; - + int copy = MAXWIN; if (next < dist) { source += copy; copy = dist; } - + copy -= next; if (copy > len) copy = len; - + len -= copy; next += (ushort)copy; @@ -129,7 +129,7 @@ namespace OpenRA.FileFormats // the same as Array.Copy() while( copy-- > 0 ) outBuffer[dest++] = outBuffer[source++]; - + // Flush window to outstream if (next == MAXWIN) { @@ -153,11 +153,11 @@ namespace OpenRA.FileFormats } } } while (true); - + return ms.ToArray(); } - - // Decode a code using huffman table h. + + // Decode a code using huffman table h. static int Decode(Huffman h, BitReader br) { int code = 0; // len bits being decoded @@ -178,7 +178,7 @@ namespace OpenRA.FileFormats } } } - + class BitReader { readonly byte[] src; @@ -190,7 +190,7 @@ namespace OpenRA.FileFormats { this.src = src; } - + public int ReadBits(int count) { int ret = 0; @@ -202,7 +202,7 @@ namespace OpenRA.FileFormats bitBuffer = src[offset++]; bitCount = 8; } - + ret |= (bitBuffer & 1) << filled; bitBuffer >>= 1; bitCount--; @@ -230,7 +230,7 @@ namespace OpenRA.FileFormats { short[] length = new short[256]; // code lengths int s = 0; // current symbol - + // convert compact repeat counts into symbol bit length list foreach (byte code in rep) { @@ -242,16 +242,16 @@ namespace OpenRA.FileFormats } while (--num > 0); } n = s; - + // count number of codes of each length Count = new short[Blast.MAXBITS + 1]; for (int i = 0; i < n; i++) Count[length[i]]++; - + // no codes! if (Count[0] == n) return; - + // check for an over-subscribed or incomplete set of lengths int left = 1; // one possible code of zero length for (int len = 1; len <= Blast.MAXBITS; len++) @@ -263,12 +263,12 @@ namespace OpenRA.FileFormats if (left < 0) throw new InvalidDataException ("over subscribed code set"); } - + // generate offsets into symbol table for each length for sorting short[] offs = new short[Blast.MAXBITS + 1]; for (int len = 1; len < Blast.MAXBITS; len++) offs[len + 1] = (short)(offs[len] + Count[len]); - + // put symbols in table sorted by length, by symbol order within each length Symbol = new short[SymbolCount]; for (short i = 0; i < n; i++) diff --git a/OpenRA.FileFormats/FileFormats/Blowfish.cs b/OpenRA.FileFormats/FileFormats/Blowfish.cs index 2b4d415664..a54e3d66e2 100644 --- a/OpenRA.FileFormats/FileFormats/Blowfish.cs +++ b/OpenRA.FileFormats/FileFormats/Blowfish.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs b/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs index 6ce863856a..ad3d7e355f 100644 --- a/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs +++ b/OpenRA.FileFormats/FileFormats/BlowfishKeyProvider.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -385,7 +385,7 @@ namespace OpenRA.FileFormats void dec_bignum(uint[] n, uint len) { int i = 0; - while ((--n[i] == 0xffffffff) && (--len > 0)) + while ((--n[i] == 0xffffffff) && (--len > 0)) i++; } @@ -495,7 +495,7 @@ namespace OpenRA.FileFormats uint[] n3 = new uint[64]; uint a = (pubkey.len - 1) / 8; - while (a + 1 <= pre_len) + while (a + 1 <= pre_len) { init_bignum(n2, 0, 64); fixed( uint * pn2 = &n2[0] ) diff --git a/OpenRA.FileFormats/FileFormats/Format2.cs b/OpenRA.FileFormats/FileFormats/Format2.cs index 5989e4fc92..a043755c18 100644 --- a/OpenRA.FileFormats/FileFormats/Format2.cs +++ b/OpenRA.FileFormats/FileFormats/Format2.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/FileFormats/Format40.cs b/OpenRA.FileFormats/FileFormats/Format40.cs index 78dacf4c45..5d78918ec5 100644 --- a/OpenRA.FileFormats/FileFormats/Format40.cs +++ b/OpenRA.FileFormats/FileFormats/Format40.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/FileFormats/Format80.cs b/OpenRA.FileFormats/FileFormats/Format80.cs index a61f0abbd4..344de87ca2 100644 --- a/OpenRA.FileFormats/FileFormats/Format80.cs +++ b/OpenRA.FileFormats/FileFormats/Format80.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -129,7 +129,7 @@ namespace OpenRA.FileFormats { /* quick & dirty format80 encoder -- only uses raw copy operator, terminated with a zero-run. */ /* this does not produce good compression, but it's valid format80 */ - + var ctx = new FastByteReader(src); var ms = new MemoryStream(); diff --git a/OpenRA.FileFormats/FileFormats/IniFile.cs b/OpenRA.FileFormats/FileFormats/IniFile.cs index 8cb96974f4..cebeb44be5 100644 --- a/OpenRA.FileFormats/FileFormats/IniFile.cs +++ b/OpenRA.FileFormats/FileFormats/IniFile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Filesystem/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs index 28f61a4321..878be96b56 100644 --- a/OpenRA.FileFormats/Filesystem/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -54,7 +54,7 @@ namespace OpenRA.FileFormats else return new Folder(filename, order, content); } - + public static IFolder OpenPackage(string filename, int order) { if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase)) @@ -73,11 +73,11 @@ namespace OpenRA.FileFormats { var optional = name.StartsWith("~"); if (optional) name = name.Substring(1); - + // paths starting with ^ are relative to the support dir if (name.StartsWith("^")) name = Platform.SupportDir+name.Substring(1); - + var a = (Action)(() => FileSystem.MountInner(OpenPackage(name))); if (optional) @@ -198,7 +198,7 @@ namespace OpenRA.FileFormats assemblyCache.Add(filename, a); return a; } - + return null; } } diff --git a/OpenRA.FileFormats/Filesystem/Folder.cs b/OpenRA.FileFormats/Filesystem/Folder.cs index 4965e88091..210bcf2235 100644 --- a/OpenRA.FileFormats/Filesystem/Folder.cs +++ b/OpenRA.FileFormats/Filesystem/Folder.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,10 +27,10 @@ namespace OpenRA.FileFormats this.priority = priority; if (Directory.Exists(path)) Directory.Delete(path, true); - + Write(contents); } - + public Folder(string path, int priority) { this.path = path; @@ -50,7 +50,7 @@ namespace OpenRA.FileFormats foreach( var filename in Directory.GetFiles( path, "*", SearchOption.TopDirectoryOnly ) ) yield return PackageEntry.HashFilename( Path.GetFileName(filename) ); } - + public bool Exists(string filename) { return File.Exists(Path.Combine(path,filename)); @@ -61,7 +61,7 @@ namespace OpenRA.FileFormats { get { return priority; } } - + public void Write(Dictionary contents) { if (!Directory.Exists(path)) diff --git a/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs b/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs index 1ddbba8ba7..cf59751aa9 100644 --- a/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs +++ b/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.FileFormats uint signature = reader.ReadUInt32(); if (signature != 0x8C655D13) throw new InvalidDataException("Not an Installshield package"); - + reader.ReadBytes(8); /*var FileCount = */reader.ReadUInt16(); reader.ReadBytes(4); @@ -41,7 +41,7 @@ namespace OpenRA.FileFormats var TOCAddress = reader.ReadInt32(); reader.ReadBytes(4); var DirCount = reader.ReadUInt16(); - + // Parse the directory list s.Seek(TOCAddress, SeekOrigin.Begin); BinaryReader TOCreader = new BinaryReader(s); @@ -56,15 +56,15 @@ namespace OpenRA.FileFormats var ChunkSize = reader.ReadUInt16(); var NameLength = reader.ReadUInt16(); reader.ReadChars(NameLength); //var DirName = new String(reader.ReadChars(NameLength)); - + // Skip to the end of the chunk reader.ReadBytes(ChunkSize - NameLength - 6); - + // Parse files for (var i = 0; i < FileCount; i++) ParseFile(reader); } - + uint AccumulatedData = 0; void ParseFile(BinaryReader reader) { @@ -79,11 +79,11 @@ namespace OpenRA.FileFormats var hash = PackageEntry.HashFilename(FileName); index.Add(hash, new PackageEntry(hash,AccumulatedData, CompressedSize)); AccumulatedData += CompressedSize; - + // Skip to the end of the chunk reader.ReadBytes(ChunkSize - NameLength - 30); } - + public Stream GetContent(uint hash) { PackageEntry e; @@ -93,7 +93,7 @@ namespace OpenRA.FileFormats s.Seek( dataStart + e.Offset, SeekOrigin.Begin ); byte[] data = new byte[ e.Length ]; s.Read( data, 0, (int)e.Length ); - + return new MemoryStream(Blast.Decompress(data)); } @@ -106,7 +106,7 @@ namespace OpenRA.FileFormats { return index.Keys; } - + public bool Exists(string filename) { return index.ContainsKey(PackageEntry.HashFilename(filename)); @@ -117,7 +117,7 @@ namespace OpenRA.FileFormats { get { return 2000 + priority; } } - + public void Write(Dictionary contents) { throw new NotImplementedException("Cannot save InstallShieldPackages."); diff --git a/OpenRA.FileFormats/Filesystem/MixFile.cs b/OpenRA.FileFormats/Filesystem/MixFile.cs index 7fac6d9d97..647490640f 100644 --- a/OpenRA.FileFormats/Filesystem/MixFile.cs +++ b/OpenRA.FileFormats/Filesystem/MixFile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,14 +31,14 @@ namespace OpenRA.FileFormats readonly long dataStart; readonly Stream s; int priority; - + // Create a new MixFile public MixFile(string filename, int priority, Dictionary contents) { this.priority = priority; if (File.Exists(filename)) File.Delete(filename); - + s = File.Create(filename); Write(contents); } @@ -137,7 +137,7 @@ namespace OpenRA.FileFormats dataStart = s.Position; return items; } - + public Stream GetContent(uint hash) { PackageEntry e; @@ -159,7 +159,7 @@ namespace OpenRA.FileFormats { return index.Keys; } - + public bool Exists(string filename) { return index.ContainsKey(PackageEntry.HashFilename(filename)); @@ -170,17 +170,17 @@ namespace OpenRA.FileFormats { get { return 1000 + priority; } } - + public void Write(Dictionary contents) { // Cannot modify existing mixfile - rename existing file and // create a new one with original content plus modifications FileSystem.Unmount(this); - + // TODO: Add existing data to the contents list if (index.Count > 0) throw new NotImplementedException("Updating mix files unfinished"); - + // Construct a list of entries for the file header uint dataSize = 0; var items = new List(); diff --git a/OpenRA.FileFormats/Filesystem/ZipFile.cs b/OpenRA.FileFormats/Filesystem/ZipFile.cs index 1fd2a43bd0..caa0158e5e 100644 --- a/OpenRA.FileFormats/Filesystem/ZipFile.cs +++ b/OpenRA.FileFormats/Filesystem/ZipFile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -44,7 +44,7 @@ namespace OpenRA.FileFormats if (File.Exists(filename)) File.Delete(filename); - + pkg = SZipFile.Create(filename); Write(contents); } @@ -70,7 +70,7 @@ namespace OpenRA.FileFormats foreach(ZipEntry entry in pkg) yield return PackageEntry.HashFilename(entry.Name); } - + public bool Exists(string filename) { return pkg.GetEntry(filename) != null; @@ -80,7 +80,7 @@ namespace OpenRA.FileFormats { get { return 500 + priority; } } - + public void Write(Dictionary contents) { pkg.Close(); @@ -108,7 +108,7 @@ namespace OpenRA.FileFormats { this.data = data; } - + public Stream GetSource() { return new MemoryStream(data); diff --git a/OpenRA.FileFormats/Graphics/Dune2ShpReader.cs b/OpenRA.FileFormats/Graphics/Dune2ShpReader.cs index 2e769bf2b0..12d1c7e5c8 100644 --- a/OpenRA.FileFormats/Graphics/Dune2ShpReader.cs +++ b/OpenRA.FileFormats/Graphics/Dune2ShpReader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -83,14 +83,14 @@ namespace OpenRA.FileFormats BinaryReader reader = new BinaryReader(stream); ImageCount = reader.ReadUInt16(); - + //Last offset is pointer to end of file. uint[] offsets = new uint[ImageCount + 1]; uint temp = reader.ReadUInt32(); //If fourth byte in file is non-zero, the offsets are two bytes each. - bool twoByteOffsets = (temp & 0xFF0000) > 0; + bool twoByteOffsets = (temp & 0xFF0000) > 0; if (twoByteOffsets) { offsets[0] = ((temp & 0xFFFF0000) >> 16) + 2; //Offset does not account for image count bytes @@ -132,7 +132,7 @@ namespace OpenRA.FileFormats { get { return headers[index]; } } - + public IEnumerator GetEnumerator() { return headers.GetEnumerator(); diff --git a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs index a4f42568a5..78a5b78247 100755 --- a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.FileFormats.Graphics public interface IDeviceFactory { - IGraphicsDevice Create( Size size, WindowMode windowMode ); + IGraphicsDevice Create( Size size, WindowMode windowMode ); } public interface IGraphicsDevice @@ -75,8 +75,8 @@ namespace OpenRA.FileFormats.Graphics public enum PrimitiveType { - PointList, - LineList, + PointList, + LineList, TriangleList, QuadList, } @@ -86,7 +86,7 @@ namespace OpenRA.FileFormats.Graphics public readonly T Start, End; public Range( T start, T end ) { Start = start; End = end; } } - + public enum WindowMode { Windowed, diff --git a/OpenRA.FileFormats/Graphics/IInputHandler.cs b/OpenRA.FileFormats/Graphics/IInputHandler.cs index e816fd5937..61a8d37304 100755 --- a/OpenRA.FileFormats/Graphics/IInputHandler.cs +++ b/OpenRA.FileFormats/Graphics/IInputHandler.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Graphics/PngLoader.cs b/OpenRA.FileFormats/Graphics/PngLoader.cs index c51fc2cbc8..cb77264513 100644 --- a/OpenRA.FileFormats/Graphics/PngLoader.cs +++ b/OpenRA.FileFormats/Graphics/PngLoader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Graphics/ShpReader.cs b/OpenRA.FileFormats/Graphics/ShpReader.cs index 330a2183ce..7ad21a4fe1 100644 --- a/OpenRA.FileFormats/Graphics/ShpReader.cs +++ b/OpenRA.FileFormats/Graphics/ShpReader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Graphics/ShpWriter.cs b/OpenRA.FileFormats/Graphics/ShpWriter.cs index 8e3cf1521c..9475f02c68 100644 --- a/OpenRA.FileFormats/Graphics/ShpWriter.cs +++ b/OpenRA.FileFormats/Graphics/ShpWriter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Graphics/Vertex.cs b/OpenRA.FileFormats/Graphics/Vertex.cs index e52231f3bc..70fe13f4df 100644 --- a/OpenRA.FileFormats/Graphics/Vertex.cs +++ b/OpenRA.FileFormats/Graphics/Vertex.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Graphics/VqaReader.cs b/OpenRA.FileFormats/Graphics/VqaReader.cs index 2e88134f53..66db6c788f 100644 --- a/OpenRA.FileFormats/Graphics/VqaReader.cs +++ b/OpenRA.FileFormats/Graphics/VqaReader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.FileFormats public readonly byte Framerate; public readonly ushort Width; public readonly ushort Height; - + Stream stream; int currentFrame; ushort numColors; @@ -32,75 +32,75 @@ namespace OpenRA.FileFormats // Stores a list of subpixels, referenced by the VPTZ chunk byte[] cbf; - byte[] cbp; + byte[] cbp; int cbChunk = 0; int cbOffset = 0; - + // Top half contains block info, bottom half contains references to cbf array byte[] origData; - + // Final frame output uint[,] frameData; byte[] audioData; // audio for this frame: 22050Hz 16bit mono pcm, uncompressed. public byte[] AudioData { get { return audioData; } } public int CurrentFrame { get { return currentFrame; } } - + public VqaReader( Stream stream ) { this.stream = stream; BinaryReader reader = new BinaryReader( stream ); - + // Decode FORM chunk if (new String(reader.ReadChars(4)) != "FORM") throw new InvalidDataException("Invalid vqa (invalid FORM section)"); /*var length = */ reader.ReadUInt32(); - + if (new String(reader.ReadChars(8)) != "WVQAVQHD") throw new InvalidDataException("Invalid vqa (not WVQAVQHD)"); /* var length = */reader.ReadUInt32(); - + /*var version = */reader.ReadUInt16(); /*var flags = */reader.ReadUInt16(); Frames = reader.ReadUInt16(); Width = reader.ReadUInt16(); Height = reader.ReadUInt16(); - + blockWidth = reader.ReadByte(); blockHeight = reader.ReadByte(); Framerate = reader.ReadByte(); cbParts = reader.ReadByte(); blocks = new int2(Width / blockWidth, Height / blockHeight); - + numColors = reader.ReadUInt16(); /*var maxBlocks = */reader.ReadUInt16(); /*var unknown1 = */reader.ReadUInt16(); /*var unknown2 = */reader.ReadUInt32(); - + // Audio /*var freq = */reader.ReadUInt16(); /*var channels = */reader.ReadByte(); /*var bits = */reader.ReadByte(); /*var unknown3 = */reader.ReadChars(14); - - + + var frameSize = Exts.NextPowerOf2(Math.Max(Width,Height)); cbf = new byte[Width*Height]; cbp = new byte[Width*Height]; palette = new uint[numColors]; origData = new byte[2*blocks.X*blocks.Y]; frameData = new uint[frameSize,frameSize]; - + var type = new String(reader.ReadChars(4)); if (type != "FINF") { reader.ReadBytes(27); type = new String(reader.ReadChars(4)); } - + /*var length = */reader.ReadUInt16(); /*var unknown4 = */reader.ReadUInt16(); - + // Frame offsets offsets = new UInt32[Frames]; for (int i = 0; i < Frames; i++) @@ -111,7 +111,7 @@ namespace OpenRA.FileFormats } CollectAudioData(); - + Reset(); } @@ -120,7 +120,7 @@ namespace OpenRA.FileFormats currentFrame = cbOffset = cbChunk = 0; LoadFrame(); } - + void CollectAudioData() { var ms = new MemoryStream(); @@ -163,17 +163,17 @@ namespace OpenRA.FileFormats currentFrame++; LoadFrame(); } - + void LoadFrame() - { + { if (currentFrame >= Frames) return; - + // Seek to the start of the frame stream.Seek(offsets[currentFrame], SeekOrigin.Begin); BinaryReader reader = new BinaryReader(stream); var end = (currentFrame < Frames - 1) ? offsets[currentFrame+1] : stream.Length; - + while(reader.BaseStream.Position < end) { var type = new String(reader.ReadChars(4)); @@ -189,17 +189,17 @@ namespace OpenRA.FileFormats reader.ReadBytes((int)length); break; } - + // Chunks are aligned on even bytes; advance by a byte if the next one is null if (reader.PeekChar() == 0) reader.ReadByte(); } } - + // VQA Frame public void DecodeVQFR(BinaryReader reader) - { + { while(true) - { + { // Chunks are aligned on even bytes; may be padded with a single null if (reader.PeekChar() == 0) reader.ReadByte(); var type = new String(reader.ReadChars(4)); @@ -214,9 +214,9 @@ namespace OpenRA.FileFormats case "CBF0": cbf = reader.ReadBytes(subchunkLength); break; - + // frame-modifier chunk - case "CBP0": + case "CBP0": case "CBPZ": // Partial buffer is full; dump and recreate if (cbChunk == cbParts) @@ -225,16 +225,16 @@ namespace OpenRA.FileFormats cbf = (byte[])cbp.Clone(); else Format80.DecodeInto( cbp, cbf ); - + cbOffset = cbChunk = 0; } - + var bytes = reader.ReadBytes(subchunkLength); bytes.CopyTo(cbp,cbOffset); cbOffset += subchunkLength; cbChunk++; break; - + // Palette case "CPL0": for (int i = 0; i < numColors; i++) @@ -245,7 +245,7 @@ namespace OpenRA.FileFormats palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b); } break; - + // Frame data case "VPTZ": Format80.DecodeInto( reader.ReadBytes(subchunkLength), origData ); @@ -256,7 +256,7 @@ namespace OpenRA.FileFormats } } } - + int cachedFrame = -1; void DecodeFrameData( int frame ) diff --git a/OpenRA.FileFormats/HttpUtil.cs b/OpenRA.FileFormats/HttpUtil.cs index 1f3c1b22ab..d819922868 100644 --- a/OpenRA.FileFormats/HttpUtil.cs +++ b/OpenRA.FileFormats/HttpUtil.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/InstallUtils.cs b/OpenRA.FileFormats/InstallUtils.cs index 439e4ce737..9260fbcfd0 100644 --- a/OpenRA.FileFormats/InstallUtils.cs +++ b/OpenRA.FileFormats/InstallUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -42,7 +42,7 @@ namespace OpenRA.FileFormats { if (!Directory.Exists(destPath)) Directory.CreateDirectory(destPath); - + if (!Directory.Exists(srcPath)) { onError("Cannot find "+package); return false; } FileSystem.Mount(srcPath); if (!FileSystem.Exists(package)) { onError("Cannot find "+package); return false; } @@ -60,7 +60,7 @@ namespace OpenRA.FileFormats } return true; } - + public static bool CopyFiles(string srcPath, string[] files, string destPath, Action onProgress, Action onError) { foreach (var file in files) @@ -77,7 +77,7 @@ namespace OpenRA.FileFormats } return true; } - + public static bool ExtractZip(string zipFile, string dest, Action onProgress, Action onError) { if (!File.Exists(zipFile)) @@ -85,7 +85,7 @@ namespace OpenRA.FileFormats onError("Invalid path: "+zipFile); return false; } - + List extracted = new List(); try { @@ -96,26 +96,26 @@ namespace OpenRA.FileFormats { foreach(var f in extracted) File.Delete(f); - + onError("Invalid archive"); return false; } return true; } - + // TODO: this belongs in FileSystem/ZipFile static void ExtractZip(this ZipInputStream z, string destPath, List extracted, Action onProgress) { foreach (var entry in z.GetEntries()) { if (!entry.IsFile) continue; - + onProgress(entry.Name); - + Directory.CreateDirectory(Path.Combine(destPath, Path.GetDirectoryName(entry.Name))); var path = Path.Combine(destPath, entry.Name); extracted.Add(path); - + using (var f = File.Create(path)) { int bufSize = 2048; @@ -124,7 +124,7 @@ namespace OpenRA.FileFormats f.Write(buf, 0, bufSize); } } - + z.Close(); } } diff --git a/OpenRA.FileFormats/Manifest.cs b/OpenRA.FileFormats/Manifest.cs index 7813dadc79..aa1b0eeb45 100644 --- a/OpenRA.FileFormats/Manifest.cs +++ b/OpenRA.FileFormats/Manifest.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -48,7 +48,7 @@ namespace OpenRA.FileFormats Movies = YamlList(yaml, "Movies"); TileSets = YamlList(yaml, "TileSets"); ChromeMetrics = YamlList(yaml, "ChromeMetrics"); - + LoadScreen = yaml["LoadScreen"]; Fonts = yaml["Fonts"].NodesDict.ToDictionary(x => x.Key, x => Pair.New(x.Value.NodesDict["Font"].Value, int.Parse(x.Value.NodesDict["Size"].Value))); diff --git a/OpenRA.FileFormats/Map/PlayerReference.cs b/OpenRA.FileFormats/Map/PlayerReference.cs index a6eeda80d0..0405325d31 100644 --- a/OpenRA.FileFormats/Map/PlayerReference.cs +++ b/OpenRA.FileFormats/Map/PlayerReference.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.FileFormats public int InitialCash = 0; public string[] Allies = {}; public string[] Enemies = {}; - + public PlayerReference() {} public PlayerReference(MiniYaml my) { diff --git a/OpenRA.FileFormats/Map/SmudgeReference.cs b/OpenRA.FileFormats/Map/SmudgeReference.cs index fcacdc3adf..be712a7c9d 100644 --- a/OpenRA.FileFormats/Map/SmudgeReference.cs +++ b/OpenRA.FileFormats/Map/SmudgeReference.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.FileFormats Location = location; Depth = depth; } - + public override string ToString () { return string.Format("{0} {1},{2} {3}", Type, Location.X,Location.Y, Depth); diff --git a/OpenRA.FileFormats/Map/Terrain.cs b/OpenRA.FileFormats/Map/Terrain.cs index 0707e3a71c..4e5f1326c4 100644 --- a/OpenRA.FileFormats/Map/Terrain.cs +++ b/OpenRA.FileFormats/Map/Terrain.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,35 +18,35 @@ namespace OpenRA.FileFormats public readonly List TileBitmapBytes = new List(); public Terrain( Stream stream, int size ) - { + { // Try loading as a cnc .tem BinaryReader reader = new BinaryReader( stream ); int Width = reader.ReadUInt16(); int Height = reader.ReadUInt16(); - + if( Width != size || Height != size ) throw new InvalidDataException( "{0}x{1} != {2}x{2}".F(Width, Height, size ) ); - + /*NumTiles = */reader.ReadUInt16(); - /*Zero1 = */reader.ReadUInt16(); + /*Zero1 = */reader.ReadUInt16(); /*uint Size = */reader.ReadUInt32(); uint ImgStart = reader.ReadUInt32(); /*Zero2 = */reader.ReadUInt32(); - + int IndexEnd, IndexStart; if (reader.ReadUInt16() == 65535) // ID1 = FFFFh for cnc { - /*ID2 = */reader.ReadUInt16(); + /*ID2 = */reader.ReadUInt16(); IndexEnd = reader.ReadInt32(); IndexStart = reader.ReadInt32(); } else // Load as a ra .tem { - stream.Position = 0; + stream.Position = 0; reader = new BinaryReader( stream ); Width = reader.ReadUInt16(); Height = reader.ReadUInt16(); - + /*NumTiles = */reader.ReadUInt16(); reader.ReadUInt16(); /*XDim = */reader.ReadUInt16(); @@ -57,7 +57,7 @@ namespace OpenRA.FileFormats reader.ReadUInt32(); IndexEnd = reader.ReadInt32(); reader.ReadUInt32(); - IndexStart = reader.ReadInt32(); + IndexStart = reader.ReadInt32(); } stream.Position = IndexStart; diff --git a/OpenRA.FileFormats/Map/TileReference.cs b/OpenRA.FileFormats/Map/TileReference.cs index be12a97943..5a2812904d 100644 --- a/OpenRA.FileFormats/Map/TileReference.cs +++ b/OpenRA.FileFormats/Map/TileReference.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -14,7 +14,7 @@ namespace OpenRA.FileFormats { public T type; public U index; - + public TileReference(T t, U i) { type = t; diff --git a/OpenRA.FileFormats/Map/TileSet.cs b/OpenRA.FileFormats/Map/TileSet.cs index 78f6e76c0a..e2f30a69cd 100644 --- a/OpenRA.FileFormats/Map/TileSet.cs +++ b/OpenRA.FileFormats/Map/TileSet.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.FileFormats public TerrainTypeInfo(MiniYaml my) { FieldLoader.Load(this, my); } public MiniYaml Save() { return FieldSaver.Save(this); } } - + public class TileTemplate { public ushort Id; @@ -37,7 +37,7 @@ namespace OpenRA.FileFormats [FieldLoader.LoadUsing( "LoadTiles" )] public Dictionary Tiles = new Dictionary(); - + public TileTemplate() {} public TileTemplate(MiniYaml my) { @@ -50,7 +50,7 @@ namespace OpenRA.FileFormats t => byte.Parse(t.Key), t => t.Value.Value ); } - + public MiniYaml Save() { var root = new List(); @@ -63,11 +63,11 @@ namespace OpenRA.FileFormats root.Add( new MiniYamlNode( "Tiles", null, Tiles.Select( x => new MiniYamlNode( x.Key.ToString(), x.Value ) ).ToList() ) ); - + return new MiniYaml(null, root); } } - + public class TileSet { public string Name; @@ -84,7 +84,7 @@ namespace OpenRA.FileFormats public TileSet( string filepath ) { var yaml = MiniYaml.DictFromFile( filepath ); - + // General info FieldLoader.Load(this, yaml["General"]); @@ -96,7 +96,7 @@ namespace OpenRA.FileFormats Templates = yaml["Templates"].NodesDict.Values .Select(y => new TileTemplate(y)).ToDictionary(t => t.Id); } - + public void LoadTiles() { foreach (var t in Templates) @@ -106,9 +106,9 @@ namespace OpenRA.FileFormats Tiles.Add( t.Key, new Terrain( s, TileSize ) ); } } - + public void Save(string filepath) - { + { var root = new List(); var gen = new List(); foreach (var field in fields) @@ -119,7 +119,7 @@ namespace OpenRA.FileFormats } root.Add( new MiniYamlNode( "General", null, gen ) ); - root.Add( new MiniYamlNode( "Terrain", null, + root.Add( new MiniYamlNode( "Terrain", null, Terrain.Select( t => new MiniYamlNode( "TerrainType@{0}".F( t.Value.Type ), t.Value.Save() ) ).ToList() ) ); @@ -129,14 +129,14 @@ namespace OpenRA.FileFormats "Template@{0}".F( t.Value.Id ), t.Value.Save() ) ).ToList() ) ); root.WriteToFile(filepath); - } - + } + public byte[] GetBytes(TileReference r) { Terrain tile; if( Tiles.TryGetValue( r.type, out tile ) ) return tile.TileBitmapBytes[ r.index ]; - + byte[] missingTile = new byte[ TileSize * TileSize ]; for( int i = 0 ; i < missingTile.Length ; i++ ) missingTile[ i ] = 0x36; diff --git a/OpenRA.FileFormats/MiniYaml.cs b/OpenRA.FileFormats/MiniYaml.cs index c13f38dde8..f2f8081ee1 100755 --- a/OpenRA.FileFormats/MiniYaml.cs +++ b/OpenRA.FileFormats/MiniYaml.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -98,7 +98,7 @@ namespace OpenRA.FileFormats { return new MiniYaml( null, list.Select( x => new MiniYamlNode( x.ToString(), new MiniYaml( null ) ) ).ToList() ); } - + static List FromLines(string[] lines, string filename) { var levels = new List>(); @@ -121,7 +121,7 @@ namespace OpenRA.FileFormats var d = new List(); var rhs = SplitAtColon( ref t ); levels[ level ].Add( new MiniYamlNode( t, rhs, d, new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo } ) ); - + levels.Add(d); } return levels[ 0 ]; @@ -143,11 +143,11 @@ namespace OpenRA.FileFormats { StreamReader reader = new StreamReader( FileSystem.Open(path) ); List lines = new List(); - + while( !reader.EndOfStream ) lines.Add(reader.ReadLine()); reader.Close(); - + return FromLines(lines.ToArray(), path); } @@ -162,7 +162,7 @@ namespace OpenRA.FileFormats } public static List FromFile( string path ) - { + { return FromLines(File.ReadAllLines( path ), path); } @@ -273,7 +273,7 @@ namespace OpenRA.FileFormats { return string.Join("\n", y.ToLines(true).Select(x => x.TrimEnd()).ToArray()); } - + public static IEnumerable ToLines(this MiniYamlNodes y, bool lowest) { foreach (var kv in y) diff --git a/OpenRA.FileFormats/Mod.cs b/OpenRA.FileFormats/Mod.cs index 9ad0578b1d..08133b4f4a 100644 --- a/OpenRA.FileFormats/Mod.cs +++ b/OpenRA.FileFormats/Mod.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/PackageEntry.cs b/OpenRA.FileFormats/PackageEntry.cs index 8cb6b14ed9..d9a1e42eea 100644 --- a/OpenRA.FileFormats/PackageEntry.cs +++ b/OpenRA.FileFormats/PackageEntry.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,21 +20,21 @@ namespace OpenRA.FileFormats public readonly uint Offset; public readonly uint Length; - + public PackageEntry(uint hash, uint offset, uint length) { Hash = hash; Offset = offset; Length = length; } - + public PackageEntry(BinaryReader r) { Hash = r.ReadUInt32(); Offset = r.ReadUInt32(); Length = r.ReadUInt32(); } - + public void Write(BinaryWriter w) { w.Write(Hash); @@ -63,7 +63,7 @@ namespace OpenRA.FileFormats MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name)); BinaryReader reader = new BinaryReader(ms); - int len = name.Length >> 2; + int len = name.Length >> 2; uint result = 0; while (len-- != 0) @@ -73,7 +73,7 @@ namespace OpenRA.FileFormats } static Dictionary Names = new Dictionary(); - + public static void AddStandardName(string s) { uint hash = HashFilename(s); diff --git a/OpenRA.FileFormats/Palette.cs b/OpenRA.FileFormats/Palette.cs index 976decc629..2205168ea7 100644 --- a/OpenRA.FileFormats/Palette.cs +++ b/OpenRA.FileFormats/Palette.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,26 +23,26 @@ namespace OpenRA.FileFormats { return Color.FromArgb((int)colors[index]); } - + public void SetColor(int index, Color color) { colors[index] = (uint)color.ToArgb(); } - + public void SetColor(int index, uint color) { colors[index] = (uint)color; } - + public uint[] Values - { + { get { return colors; } } public Palette(Stream s, bool remapTransparent) { colors = new uint[256]; - + using (BinaryReader reader = new BinaryReader(s)) { for (int i = 0; i < 256; i++) @@ -69,26 +69,26 @@ namespace OpenRA.FileFormats for(int i = 0; i < 256; i++) colors[i] = (uint)r.GetRemappedColor(Color.FromArgb((int)p.colors[i]),i).ToArgb(); } - + public Palette(Palette p) { colors = (uint[])p.colors.Clone(); } - + public ColorPalette AsSystemPalette() { ColorPalette pal; using (var b = new Bitmap(1, 1, PixelFormat.Format8bppIndexed)) pal = b.Palette; - + for (var i = 0; i < 256; i++) pal.Entries[i] = GetColor(i); // hack around a mono bug -- the palette flags get set wrong. if (Platform.CurrentPlatform != PlatformType.Windows) - typeof(ColorPalette).GetField("flags", + typeof(ColorPalette).GetField("flags", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pal, 1); - + return pal; } } diff --git a/OpenRA.FileFormats/Platform.cs b/OpenRA.FileFormats/Platform.cs index f816e7fe2e..5a27d573c1 100644 --- a/OpenRA.FileFormats/Platform.cs +++ b/OpenRA.FileFormats/Platform.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } } static Lazy currentPlatform = new Lazy(GetCurrentPlatform); - + static PlatformType GetCurrentPlatform() { if (Environment.OSVersion.Platform == PlatformID.Win32NT) diff --git a/OpenRA.FileFormats/PlayerColorRemap.cs b/OpenRA.FileFormats/PlayerColorRemap.cs index 6470f756cd..a866fadac4 100755 --- a/OpenRA.FileFormats/PlayerColorRemap.cs +++ b/OpenRA.FileFormats/PlayerColorRemap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -42,11 +42,11 @@ namespace OpenRA.FileFormats (int)(t * c2.G + (1 - t) * c1.G), (int)(t * c2.B + (1 - t) * c1.B)); } - + public Color GetRemappedColor(Color original, int index) { Color c; - return remapColors.TryGetValue(index, out c) + return remapColors.TryGetValue(index, out c) ? c : original; } } diff --git a/OpenRA.FileFormats/Primitives/ActionQueue.cs b/OpenRA.FileFormats/Primitives/ActionQueue.cs index e88c87fa9f..60f9d65cde 100644 --- a/OpenRA.FileFormats/Primitives/ActionQueue.cs +++ b/OpenRA.FileFormats/Primitives/ActionQueue.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Bits.cs b/OpenRA.FileFormats/Primitives/Bits.cs index f2d900d935..92bdb945ec 100644 --- a/OpenRA.FileFormats/Primitives/Bits.cs +++ b/OpenRA.FileFormats/Primitives/Bits.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Cache.cs b/OpenRA.FileFormats/Primitives/Cache.cs index fefbc5460e..bfcb88cd37 100644 --- a/OpenRA.FileFormats/Primitives/Cache.cs +++ b/OpenRA.FileFormats/Primitives/Cache.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Cached.cs b/OpenRA.FileFormats/Primitives/Cached.cs index 94d55648d9..83964c04e9 100644 --- a/OpenRA.FileFormats/Primitives/Cached.cs +++ b/OpenRA.FileFormats/Primitives/Cached.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -40,7 +40,7 @@ namespace OpenRA.FileFormats } public T Force() { return Value; } - + public void Invalidate() { hasValue = false; diff --git a/OpenRA.FileFormats/Primitives/DisposableAction.cs b/OpenRA.FileFormats/Primitives/DisposableAction.cs index 65bb2b5676..7ce0471634 100644 --- a/OpenRA.FileFormats/Primitives/DisposableAction.cs +++ b/OpenRA.FileFormats/Primitives/DisposableAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Lazy.cs b/OpenRA.FileFormats/Primitives/Lazy.cs index ccdb8fbce3..c21343ff84 100644 --- a/OpenRA.FileFormats/Primitives/Lazy.cs +++ b/OpenRA.FileFormats/Primitives/Lazy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Pair.cs b/OpenRA.FileFormats/Primitives/Pair.cs index 47004138e6..db84ada1cc 100644 --- a/OpenRA.FileFormats/Primitives/Pair.cs +++ b/OpenRA.FileFormats/Primitives/Pair.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -74,7 +74,7 @@ namespace OpenRA.FileFormats public static class Pair { public static Pair New(T t, U u) { return new Pair(t, u); } - + static Pair() { Pair.uc = new ColorEqualityComparer(); diff --git a/OpenRA.FileFormats/Primitives/PriorityQueue.cs b/OpenRA.FileFormats/Primitives/PriorityQueue.cs index 75d3d7423e..b310af1246 100644 --- a/OpenRA.FileFormats/Primitives/PriorityQueue.cs +++ b/OpenRA.FileFormats/Primitives/PriorityQueue.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/Set.cs b/OpenRA.FileFormats/Primitives/Set.cs index 35b30971aa..99943a20db 100755 --- a/OpenRA.FileFormats/Primitives/Set.cs +++ b/OpenRA.FileFormats/Primitives/Set.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/float2.cs b/OpenRA.FileFormats/Primitives/float2.cs index c333b56598..bfebde60b0 100644 --- a/OpenRA.FileFormats/Primitives/float2.cs +++ b/OpenRA.FileFormats/Primitives/float2.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Primitives/int2.cs b/OpenRA.FileFormats/Primitives/int2.cs index 86a5b53460..567b41b611 100644 --- a/OpenRA.FileFormats/Primitives/int2.cs +++ b/OpenRA.FileFormats/Primitives/int2.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -56,7 +56,7 @@ namespace OpenRA public float2 ToFloat2() { return new float2(X, Y); } public override string ToString() { return string.Format("{0},{1}", X, Y); } - + // Change endianness of a uint32 public static uint Swap(uint orig) { @@ -72,13 +72,13 @@ namespace OpenRA { return a + ( b - a ) * mul / div; } - + public int2 Clamp(Rectangle r) { return new int2(Math.Min(r.Right, Math.Max(X, r.Left)), Math.Min(r.Bottom, Math.Max(Y, r.Top))); } - + public static int Dot(int2 a, int2 b) { return a.X * b.X + a.Y * b.Y; } } diff --git a/OpenRA.FileFormats/Properties/AssemblyInfo.cs b/OpenRA.FileFormats/Properties/AssemblyInfo.cs index 6a133254e4..5495a0fa39 100644 --- a/OpenRA.FileFormats/Properties/AssemblyInfo.cs +++ b/OpenRA.FileFormats/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Support/Log.cs b/OpenRA.FileFormats/Support/Log.cs index ac915db7a2..acf6010bfa 100755 --- a/OpenRA.FileFormats/Support/Log.cs +++ b/OpenRA.FileFormats/Support/Log.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA get { return LogPathPrefix; } set { - LogPathPrefix = value; + LogPathPrefix = value; Directory.CreateDirectory(LogPathPrefix); } } @@ -41,7 +41,7 @@ namespace OpenRA static IEnumerable FilenamesForChannel(string channelName, string baseFilename) { for(var i = 0;; i++ ) - yield return Path.Combine(LogPathPrefix, + yield return Path.Combine(LogPathPrefix, i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename); } diff --git a/OpenRA.FileFormats/Support/Stopwatch.cs b/OpenRA.FileFormats/Support/Stopwatch.cs index e2907fab5c..22790e830f 100755 --- a/OpenRA.FileFormats/Support/Stopwatch.cs +++ b/OpenRA.FileFormats/Support/Stopwatch.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Support/Timer.cs b/OpenRA.FileFormats/Support/Timer.cs index 9b060a4b07..6463f7a1fe 100755 --- a/OpenRA.FileFormats/Support/Timer.cs +++ b/OpenRA.FileFormats/Support/Timer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.FileFormats/Thirdparty/Random.cs b/OpenRA.FileFormats/Thirdparty/Random.cs index ce1cd65841..8ef212f0c3 100644 --- a/OpenRA.FileFormats/Thirdparty/Random.cs +++ b/OpenRA.FileFormats/Thirdparty/Random.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,11 +18,11 @@ namespace OpenRA.Thirdparty { uint[] mt = new uint[624]; int index = 0; - + public int Last; public Random() : this(Environment.TickCount) { } - + public Random(int seed) { mt[0] = (uint)seed; diff --git a/OpenRA.FileFormats/TypeDictionary.cs b/OpenRA.FileFormats/TypeDictionary.cs index e4dcd1d6b7..eb28785936 100644 --- a/OpenRA.FileFormats/TypeDictionary.cs +++ b/OpenRA.FileFormats/TypeDictionary.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index ad7c87e6e3..b64a254335 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -34,7 +34,7 @@ namespace OpenRA public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } } public int2 Location { get { return occupySpace.Value.TopLeft; } } - + public int2 CenterLocation { get @@ -44,7 +44,7 @@ namespace OpenRA return HasLocation.PxPosition; } } - + [Sync] public Player Owner; @@ -71,7 +71,7 @@ namespace OpenRA foreach (var trait in Info.TraitsInConstructOrder()) AddTrait(trait.Create(init)); } - + Move = Lazy.New( () => TraitOrDefault() ); Size = Lazy.New(() => @@ -88,7 +88,7 @@ namespace OpenRA ApplyIRender = x => x.Render(this); ApplyRenderModifier = (m, p) => p.ModifyRender(this, m); - + Bounds = Cached.New( () => CalculateBounds(false) ); ExtendedBounds = Cached.New( () => CalculateBounds(true) ); } @@ -97,7 +97,7 @@ namespace OpenRA { Bounds.Invalidate(); ExtendedBounds.Invalidate(); - + currentActivity = Util.RunActivity( this, currentActivity ); } @@ -117,7 +117,7 @@ namespace OpenRA var sprites = TraitsImplementing().SelectMany(ApplyIRender); return mods.Aggregate(sprites, ApplyRenderModifier); } - + // When useAltitude = true, the bounding box is extended // vertically to altitude = 0 to support FindUnitsInCircle queries // When false, the bounding box is given for the actor @@ -126,7 +126,7 @@ namespace OpenRA { var size = Size.Value; var loc = CenterLocation - size / 2; - + var si = Info.Traits.GetOrDefault(); if (si != null && si.Bounds != null && si.Bounds.Length > 2) { @@ -141,7 +141,7 @@ namespace OpenRA if (useAltitude) size = new int2(size.X, size.Y + move.Altitude); } - + return new Rectangle(loc.X, loc.Y, size.X, size.Y); } diff --git a/OpenRA.Game/ActorInitializer.cs b/OpenRA.Game/ActorInitializer.cs index 465eed6721..7dfd385d39 100755 --- a/OpenRA.Game/ActorInitializer.cs +++ b/OpenRA.Game/ActorInitializer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,7 +30,7 @@ namespace OpenRA public U Get() where T : IActorInit { return dict.Get().Value( world ); } public bool Contains() where T : IActorInit { return dict.Contains(); } } - + public interface IActorInit {} public interface IActorInit : IActorInit diff --git a/OpenRA.Game/ActorMap.cs b/OpenRA.Game/ActorMap.cs index 37bac791de..02cb7e6da9 100644 --- a/OpenRA.Game/ActorMap.cs +++ b/OpenRA.Game/ActorMap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA BottomLeft, BottomRight } - + public class ActorMap { class InfluenceNode @@ -35,7 +35,7 @@ namespace OpenRA public SubCell subCell; public Actor actor; } - + InfluenceNode[,] influence; Map map; @@ -56,7 +56,7 @@ namespace OpenRA if (!i.actor.Destroyed) yield return i.actor; } - + public IEnumerable GetUnitsAt( int2 a, SubCell sub ) { if (!map.IsInMap(a)) yield break; @@ -65,12 +65,12 @@ namespace OpenRA if (!i.actor.Destroyed && (i.subCell == sub || i.subCell == SubCell.FullCell)) yield return i.actor; } - + public bool HasFreeSubCell(int2 a) { if (!AnyUnitsAt(a)) return true; - + return new[]{ SubCell.TopLeft, SubCell.TopRight, SubCell.Center, SubCell.BottomLeft, SubCell.BottomRight }.Any(b => !AnyUnitsAt(a,b)); } @@ -79,9 +79,9 @@ namespace OpenRA { return influence[ a.X, a.Y ] != null; } - + public bool AnyUnitsAt(int2 a, SubCell sub) - { + { for( var i = influence[ a.X, a.Y ] ; i != null ; i = i.next ) if (i.subCell == sub || i.subCell == SubCell.FullCell) return true; diff --git a/OpenRA.Game/ActorReference.cs b/OpenRA.Game/ActorReference.cs index 736d2fa545..b442d80fba 100755 --- a/OpenRA.Game/ActorReference.cs +++ b/OpenRA.Game/ActorReference.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Download.cs b/OpenRA.Game/Download.cs index 134b0769ad..f3bfdb12d7 100644 --- a/OpenRA.Game/Download.cs +++ b/OpenRA.Game/Download.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,33 +18,33 @@ namespace OpenRA { WebClient wc; bool cancelled; - + public Download(string url, string path, Action onProgress, Action onComplete) { wc = new WebClient(); wc.Proxy = null; - + wc.DownloadProgressChanged += (_,a) => onProgress(a); wc.DownloadFileCompleted += (_,a) => onComplete(a, cancelled); - + Game.OnQuit += () => Cancel(); wc.DownloadFileCompleted += (_,a) => {Game.OnQuit -= () => Cancel();}; - - wc.DownloadFileAsync(new Uri(url), path); + + wc.DownloadFileAsync(new Uri(url), path); } - + public void Cancel() { Game.OnQuit -= () => Cancel(); wc.CancelAsync(); cancelled = true; } - + public static string FormatErrorMessage(Exception e) { var ex = e as System.Net.WebException; if (ex == null) return e.Message; - + switch(ex.Status) { case WebExceptionStatus.NameResolutionFailure: diff --git a/OpenRA.Game/Effects/DelayedAction.cs b/OpenRA.Game/Effects/DelayedAction.cs index bb77ccf518..64603bc9bf 100755 --- a/OpenRA.Game/Effects/DelayedAction.cs +++ b/OpenRA.Game/Effects/DelayedAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Effects/FlashTarget.cs b/OpenRA.Game/Effects/FlashTarget.cs index d7b727a1a2..17b8fe42fd 100755 --- a/OpenRA.Game/Effects/FlashTarget.cs +++ b/OpenRA.Game/Effects/FlashTarget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -36,7 +36,7 @@ namespace OpenRA.Effects { if (!target.IsInWorld) yield break; - + if (remainingTicks % 2 == 0) foreach (var r in target.Render()) yield return r.WithPalette("highlight"); diff --git a/OpenRA.Game/Effects/IEffect.cs b/OpenRA.Game/Effects/IEffect.cs index 89219f07fd..be2f2fb988 100755 --- a/OpenRA.Game/Effects/IEffect.cs +++ b/OpenRA.Game/Effects/IEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index fea8b57bbe..598ba155e3 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -55,9 +55,9 @@ namespace OpenRA if( !Directory.Exists( path ) ) Directory.CreateDirectory( path ); var replayFile = File.Create( Path.Combine( path, replayFilename ) ); - JoinInner(new OrderManager(host, port, + JoinInner(new OrderManager(host, port, new ReplayRecorderConnection(new NetworkConnection(host, port), replayFile))); - } + } static string ChooseReplayFilename() { @@ -90,14 +90,14 @@ namespace OpenRA public static event Action ConnectionStateChanged = _ => { }; static ConnectionState lastConnectionState = ConnectionState.PreConnecting; public static int LocalClientId { get { return orderManager.Connection.LocalClientId; } } - - + + // Hacky workaround for orderManager visibility public static Widget OpenWindow(World world, string widget) { return Widget.OpenWindow(widget, new WidgetArgs() {{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }}); } - + // Who came up with the great idea of making these things // impossible for the things that want them to access them directly? public static Widget OpenWindow(string widget, WidgetArgs args) @@ -109,7 +109,7 @@ namespace OpenRA { "worldRenderer", worldRenderer }, }); } - + // Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree public static Widget LoadWidget(World world, string id, Widget parent, WidgetArgs args) { @@ -227,7 +227,7 @@ namespace OpenRA { get { return orderManager.Connection.LocalClientId == 0; } } - + public static Dictionary CurrentMods { get { return Mod.AllMods.Where( k => modData.Manifest.Mods.Contains( k.Key )).ToDictionary( k => k.Key, k => k.Value ); } @@ -242,7 +242,7 @@ namespace OpenRA Console.WriteLine("Platform is {0}", Platform.CurrentPlatform); AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly; - + Settings = new Settings(Platform.SupportDir + "settings.yaml", args); Settings.Save(); @@ -254,15 +254,15 @@ namespace OpenRA FileSystem.Mount("."); // Needed to access shaders Renderer.Initialize( Game.Settings.Graphics.Mode ); Renderer = new Renderer(); - + Console.WriteLine("Available mods:"); foreach(var mod in Mod.AllMods) Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version); - + Sound.Create(); InitializeWithMods(Settings.Game.Mods); } - + public static void InitializeWithMods(string[] mods) { // Clear static state if we have switched mods @@ -277,7 +277,7 @@ namespace OpenRA server.Shutdown(); if (orderManager != null) orderManager.Dispose(); - + // Discard any invalid mods var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray(); Console.WriteLine("Loading mods: {0}",string.Join(",",mm)); @@ -287,12 +287,12 @@ namespace OpenRA Sound.StopMusic(); Sound.StopVideo(); Sound.Initialize(); - + modData = new ModData( mm ); Renderer.InitializeFonts(modData.Manifest); modData.LoadInitialAssets(); - - + + PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false; PerfHistory.items["render_widgets"].hasNormalTick = false; @@ -300,23 +300,23 @@ namespace OpenRA JoinLocal(); viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer); - + modData.LoadScreen.StartGame(); } - + public static void LoadShellMap() { StartGame(ChooseShellmap()); } - + static string ChooseShellmap() { var shellmaps = modData.AvailableMaps .Where(m => m.Value.UseAsShellmap); - + if (shellmaps.Count() == 0) throw new InvalidDataException("No valid shellmaps available"); - + return shellmaps.Random(CosmeticRandom).Key; } @@ -336,9 +336,9 @@ namespace OpenRA public static void Debug(string s, params object[] args) { - AddChatLine(Color.White, "Debug", String.Format(s,args)); + AddChatLine(Color.White, "Debug", String.Format(s,args)); } - + public static void Disconnect() { if (orderManager.world != null) @@ -347,7 +347,7 @@ namespace OpenRA JoinLocal(); orderManager.Dispose(); } - + public static void CloseServer() { if (server != null) @@ -358,7 +358,7 @@ namespace OpenRA { return modData.ObjectCreator.CreateObject( name ); } - + public static void CreateServer(ServerSettings settings) { server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort), @@ -366,7 +366,7 @@ namespace OpenRA settings, modData); } - + public static int CreateLocalServer(string map) { var settings = new ServerSettings() diff --git a/OpenRA.Game/GameRules/ActorInfo.cs b/OpenRA.Game/GameRules/ActorInfo.cs index a1c7f3c48d..2f0e382594 100644 --- a/OpenRA.Game/GameRules/ActorInfo.cs +++ b/OpenRA.Game/GameRules/ActorInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/GameRules/MusicInfo.cs b/OpenRA.Game/GameRules/MusicInfo.cs index ae417be5c2..c7d241add7 100644 --- a/OpenRA.Game/GameRules/MusicInfo.cs +++ b/OpenRA.Game/GameRules/MusicInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,16 +28,16 @@ namespace OpenRA.GameRules Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext; if (!FileSystem.Exists(Filename)) return; - + Exists = true; Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename)); } - + public void Reload() { if (!FileSystem.Exists(Filename)) return; - + Exists = true; Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename)); } diff --git a/OpenRA.Game/GameRules/Rules.cs b/OpenRA.Game/GameRules/Rules.cs index cf144a932b..020174334b 100755 --- a/OpenRA.Game/GameRules/Rules.cs +++ b/OpenRA.Game/GameRules/Rules.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA Voices = LoadYamlRules(m.Voices, map.Voices, (k, _) => new VoiceInfo(k.Value)); Music = LoadYamlRules(m.Music, new List(), (k, _) => new MusicInfo(k.Key, k.Value)); Movies = LoadYamlRules(m.Movies, new List(), (k, v) => k.Value.Value); - + TileSets = new Dictionary(); foreach (var file in m.TileSets) { @@ -41,7 +41,7 @@ namespace OpenRA TileSets.Add(t.Id,t); } } - + static Dictionary LoadYamlRules(string[] files, List dict, Func, T> f) { var y = files.Select(a => MiniYaml.FromFile(a)).Aggregate(dict,MiniYaml.MergeLiberal); diff --git a/OpenRA.Game/GameRules/Settings.cs b/OpenRA.Game/GameRules/Settings.cs index 641865a819..a29d0a224f 100755 --- a/OpenRA.Game/GameRules/Settings.cs +++ b/OpenRA.Game/GameRules/Settings.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -98,11 +98,11 @@ namespace OpenRA.GameRules // Internal game settings public int Timestep = 40; } - + public class Settings { string SettingsFile; - + public PlayerSettings Player = new PlayerSettings(); public GameSettings Game = new GameSettings(); public SoundSettings Sound = new SoundSettings(); @@ -111,7 +111,7 @@ namespace OpenRA.GameRules public DebugSettings Debug = new DebugSettings(); public Dictionary Sections; public Settings(string file, Arguments args) - { + { SettingsFile = file; Sections = new Dictionary() { @@ -122,46 +122,46 @@ namespace OpenRA.GameRules {"Server", Server}, {"Debug", Debug}, }; - - + + // Override fieldloader to ignore invalid entries var err1 = FieldLoader.UnknownFieldAction; var err2 = FieldLoader.InvalidValueAction; - + FieldLoader.UnknownFieldAction = (s,f) => { Console.WriteLine( "Ignoring unknown field `{0}` on `{1}`".F( s, f.Name ) ); }; - + if (File.Exists(SettingsFile)) { //Console.WriteLine("Loading settings file {0}",SettingsFile); var yaml = MiniYaml.DictFromFile(SettingsFile); - + foreach (var kv in Sections) if (yaml.ContainsKey(kv.Key)) LoadSectionYaml(yaml[kv.Key], kv.Value); } - + // Override with commandline args foreach (var kv in Sections) foreach (var f in kv.Value.GetType().GetFields()) if (args.Contains(kv.Key+"."+f.Name)) FieldLoader.LoadField( kv.Value, f.Name, args.GetValue(kv.Key+"."+f.Name, "") ); - + FieldLoader.UnknownFieldAction = err1; FieldLoader.InvalidValueAction = err2; } - + public void Save() { var root = new List(); foreach( var kv in Sections ) root.Add( new MiniYamlNode( kv.Key, FieldSaver.SaveDifferences(kv.Value, Activator.CreateInstance(kv.Value.GetType())) ) ); - + root.WriteToFile(SettingsFile); } - + void LoadSectionYaml(MiniYaml yaml, object section) { object defaults = Activator.CreateInstance(section.GetType()); @@ -171,7 +171,7 @@ namespace OpenRA.GameRules System.Console.WriteLine("FieldLoader: Cannot parse `{0}` into `{2}:{1}`; substituting default `{3}`".F(s,t.Name,f,ret) ); return ret; }; - + FieldLoader.Load(section, yaml); } } diff --git a/OpenRA.Game/GameRules/VoiceInfo.cs b/OpenRA.Game/GameRules/VoiceInfo.cs index 9a30286c71..f77c5399b9 100644 --- a/OpenRA.Game/GameRules/VoiceInfo.cs +++ b/OpenRA.Game/GameRules/VoiceInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -36,15 +36,15 @@ namespace OpenRA.GameRules public VoiceInfo( MiniYaml y ) { FieldLoader.Load( this, y ); - Variants = Load(y, "Variants"); + Variants = Load(y, "Variants"); Voices = Load(y, "Voices"); - + if (!Voices.ContainsKey("Attack")) Voices.Add("Attack", Voices["Move"]); if (!Voices.ContainsKey("AttackMove")) Voices.Add("AttackMove", Voices["Move"]); - + Pools = Lazy.New(() => Voices.ToDictionary( a => a.Key, a => new VoicePool(a.Value) )); } } diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 844626fde0..ae28ed5d7e 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.GameRules public class WarheadInfo { public readonly int Spread = 1; // distance (in pixels) from the explosion center at which damage is 1/2. - [FieldLoader.LoadUsing( "LoadVersus" )] + [FieldLoader.LoadUsing( "LoadVersus" )] public readonly Dictionary Versus; // damage vs each armortype public readonly bool Ore = false; // can this damage ore? public readonly string Explosion = null; // explosion effect to use @@ -40,7 +40,7 @@ namespace OpenRA.GameRules if (health == null) return 0f; var armor = self.Info.Traits.GetOrDefault(); if (armor == null || armor.Type == null) return 1; - + float versus; return Versus.TryGetValue(armor.Type, out versus) ? versus : 1; } @@ -49,7 +49,7 @@ namespace OpenRA.GameRules { FieldLoader.Load( this, yaml ); } - + static object LoadVersus( MiniYaml y ) { return y.NodesDict.ContainsKey( "Versus" ) @@ -59,7 +59,7 @@ namespace OpenRA.GameRules : new Dictionary(); } } - + public enum DamageModel diff --git a/OpenRA.Game/Graphics/Animation.cs b/OpenRA.Game/Graphics/Animation.cs index f3e0ca318b..d614fa82cf 100644 --- a/OpenRA.Game/Graphics/Animation.cs +++ b/OpenRA.Game/Graphics/Animation.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -136,7 +136,7 @@ namespace OpenRA.Graphics public void ChangeImage(string newImage, string newAnimIfMissing) { newImage = newImage.ToLowerInvariant(); - + if (name != newImage) { name = newImage.ToLowerInvariant(); diff --git a/OpenRA.Game/Graphics/AnimationWithOffset.cs b/OpenRA.Game/Graphics/AnimationWithOffset.cs index 4f55ede6dc..9c02b5bac1 100644 --- a/OpenRA.Game/Graphics/AnimationWithOffset.cs +++ b/OpenRA.Game/Graphics/AnimationWithOffset.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Graphics/ChromeProvider.cs b/OpenRA.Game/Graphics/ChromeProvider.cs index 0510a8eed2..4035bf402b 100644 --- a/OpenRA.Game/Graphics/ChromeProvider.cs +++ b/OpenRA.Game/Graphics/ChromeProvider.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Graphics public string src; public Dictionary regions; } - + static Dictionary collections; static Dictionary cachedSheets; static Dictionary> cachedSprites; @@ -32,7 +32,7 @@ namespace OpenRA.Graphics collections = new Dictionary(); cachedSheets = new Dictionary(); cachedSprites = new Dictionary>(); - + if (chromeFiles.Length == 0) return; @@ -41,34 +41,34 @@ namespace OpenRA.Graphics foreach (var c in chrome) LoadCollection(c.Key, c.Value); } - + public static void Save(string file) { var root = new List(); foreach (var kv in collections) root.Add(new MiniYamlNode(kv.Key, SaveCollection(kv.Value))); - + root.WriteToFile(file); } - + static MiniYaml SaveCollection(Collection collection) { var root = new List(); foreach (var kv in collection.regions) root.Add(new MiniYamlNode(kv.Key, kv.Value.Save(collection.src))); - + return new MiniYaml(collection.src, root); } static void LoadCollection(string name, MiniYaml yaml) { - Game.modData.LoadScreen.Display(); + Game.modData.LoadScreen.Display(); var collection = new Collection() { src = yaml.Value, regions = yaml.Nodes.ToDictionary(n => n.Key, n => new MappedImage(yaml.Value, n.Value)) }; - + collections.Add(name, collection); } @@ -85,7 +85,7 @@ namespace OpenRA.Graphics throw new InvalidOperationException( "Collection `{0}` does not have an image `{1}`".F(collection, image)); } - + // Cached sheet Sheet sheet; if (cachedSheets.ContainsKey(mi.src)) diff --git a/OpenRA.Game/Graphics/CursorProvider.cs b/OpenRA.Game/Graphics/CursorProvider.cs index a44c1650f4..66cb482862 100644 --- a/OpenRA.Game/Graphics/CursorProvider.cs +++ b/OpenRA.Game/Graphics/CursorProvider.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,12 +20,12 @@ namespace OpenRA.Graphics public static class CursorProvider { static Dictionary cursors; - + public static void Initialize(string[] sequenceFiles) - { + { cursors = new Dictionary(); var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); - + foreach (var s in sequences.NodesDict["Palettes"].Nodes) Game.modData.Palette.AddPalette(s.Key, new Palette(FileSystem.Open(s.Value.Value), false)); @@ -40,7 +40,7 @@ namespace OpenRA.Graphics foreach (var sequence in cursor.Nodes) cursors.Add(sequence.Key, new CursorSequence(cursorSrc, cursor.Value, sequence.Value)); } - + public static bool HasCursorSequence(string cursor) { return cursors.ContainsKey(cursor); diff --git a/OpenRA.Game/Graphics/CursorSequence.cs b/OpenRA.Game/Graphics/CursorSequence.cs index fce809310d..3cda6b1791 100644 --- a/OpenRA.Game/Graphics/CursorSequence.cs +++ b/OpenRA.Game/Graphics/CursorSequence.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA.Graphics start = int.Parse(d["start"].Value); this.palette = palette; - + if ((d.ContainsKey("length") && d["length"].Value == "*") || (d.ContainsKey("end") && d["end"].Value == "*")) length = sprites.Length - start; else if (d.ContainsKey("length")) @@ -42,7 +42,7 @@ namespace OpenRA.Graphics length = int.Parse(d["end"].Value) - start; else length = 1; - + if (d.ContainsKey("x")) int.TryParse(d["x"].Value, out Hotspot.X ); if (d.ContainsKey("y")) diff --git a/OpenRA.Game/Graphics/HardwarePalette.cs b/OpenRA.Game/Graphics/HardwarePalette.cs index fc626d336f..fcda7438e3 100644 --- a/OpenRA.Game/Graphics/HardwarePalette.cs +++ b/OpenRA.Game/Graphics/HardwarePalette.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,18 +21,18 @@ namespace OpenRA.Graphics { public const int MaxPalettes = 256; int allocated = 0; - + ITexture texture; Dictionary palettes; Dictionary indices; - + public HardwarePalette() { palettes = new Dictionary(); indices = new Dictionary(); texture = Game.Renderer.Device.CreateTexture(); } - + public Palette GetPalette(string name) { Palette ret; @@ -48,12 +48,12 @@ namespace OpenRA.Graphics throw new InvalidOperationException("Palette `{0}` does not exist".F(name)); return ret; } - + public void AddPalette(string name, Palette p) { if (palettes.ContainsKey(name)) throw new InvalidOperationException("Palette {0} has already been defined".F(name)); - + palettes.Add(name, p); indices.Add(name, allocated++); } @@ -62,10 +62,10 @@ namespace OpenRA.Graphics public void Update(IEnumerable paletteMods) { var copy = palettes.ToDictionary(p => p.Key, p => new Palette(p.Value)); - + foreach (var mod in paletteMods) mod.AdjustPalette(copy); - + foreach (var pal in copy) { var j = indices[pal.Key]; @@ -73,7 +73,7 @@ namespace OpenRA.Graphics for (var i = 0; i < 256; i++) data[j,i] = c[i]; } - + // Doesn't work texture.SetData(data); Game.Renderer.PaletteTexture = texture; diff --git a/OpenRA.Game/Graphics/LineRenderer.cs b/OpenRA.Game/Graphics/LineRenderer.cs index bc0c3f1431..fb47eafb2a 100644 --- a/OpenRA.Game/Graphics/LineRenderer.cs +++ b/OpenRA.Game/Graphics/LineRenderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -71,7 +71,7 @@ namespace OpenRA.Graphics new float2( endColor.R / 255.0f, endColor.G / 255.0f ), new float2( endColor.B / 255.0f, endColor.A / 255.0f ) ); } - + public void FillRect( RectangleF r, Color color ) { for (float y = r.Top; y < r.Bottom; y++) diff --git a/OpenRA.Game/Graphics/MappedImage.cs b/OpenRA.Game/Graphics/MappedImage.cs index b956c718b2..d69e2598ba 100644 --- a/OpenRA.Game/Graphics/MappedImage.cs +++ b/OpenRA.Game/Graphics/MappedImage.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,13 +33,13 @@ namespace OpenRA.Graphics { return new Sprite(s, rect, TextureChannel.Alpha); } - + public MiniYaml Save(string defaultSrc) { var root = new List(); if (defaultSrc != src) root.Add(new MiniYamlNode("src", src)); - + return new MiniYaml(FieldSaver.FormatValue( this, this.GetType().GetField("rect") ), root); } } diff --git a/OpenRA.Game/Graphics/Minimap.cs b/OpenRA.Game/Graphics/Minimap.cs index b9b7a1a60e..6569663898 100644 --- a/OpenRA.Game/Graphics/Minimap.cs +++ b/OpenRA.Game/Graphics/Minimap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,28 +19,28 @@ using OpenRA.Traits; namespace OpenRA.Graphics { public class Minimap - { + { public static Bitmap TerrainBitmap(Map map) { return TerrainBitmap(map, false); } - + public static Bitmap TerrainBitmap(Map map, bool actualSize) { var tileset = Rules.TileSets[map.Tileset]; var width = map.Bounds.Width; var height = map.Bounds.Height; - + if (!actualSize) { width = height = Exts.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height)); } - + var terrain = new Bitmap(width, height); - + var bitmapData = terrain.LockBits(new Rectangle(0, 0, terrain.Width, terrain.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - + unsafe { int* c = (int*)bitmapData.Scan0; @@ -53,7 +53,7 @@ namespace OpenRA.Graphics var type = tileset.GetTerrainType(map.MapTiles.Value[mapX, mapY]); if (!tileset.Terrain.ContainsKey(type)) throw new InvalidDataException("Tileset {0} lacks terraintype {1}".F(tileset.Id, type)); - + *(c + (y * bitmapData.Stride >> 2) + x) = tileset.Terrain[type].Color.ToArgb(); } } @@ -80,16 +80,16 @@ namespace OpenRA.Graphics for (var y = 0; y < map.Bounds.Height; y++) { var mapX = x + map.Bounds.Left; - var mapY = y + map.Bounds.Top; + var mapY = y + map.Bounds.Top; if (map.MapResources.Value[mapX, mapY].type == 0) continue; - + var res = Rules.Info["world"].Traits.WithInterface() .Where(t => t.ResourceType == map.MapResources.Value[mapX, mapY].type) .Select(t => t.TerrainType).FirstOrDefault(); if (res == null) continue; - + *(c + (y * bitmapData.Stride >> 2) + x) = tileset.Terrain[res].Color.ToArgb(); } } @@ -98,7 +98,7 @@ namespace OpenRA.Graphics return terrain; } - + public static Bitmap CustomTerrainBitmap(World world) { var map = world.Map; @@ -126,15 +126,15 @@ namespace OpenRA.Graphics bitmap.UnlockBits(bitmapData); return bitmap; } - + public static Bitmap ActorsBitmap(World world) - { + { var map = world.Map; var size = Exts.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height)); var bitmap = new Bitmap(size, size); var bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - + unsafe { int* c = (int*)bitmapData.Scan0; @@ -143,7 +143,7 @@ namespace OpenRA.Graphics { if (!world.LocalShroud.IsVisible(t.Actor)) continue; - + var color = t.Trait.RadarSignatureColor(t.Actor); foreach (var cell in t.Trait.RadarSignatureCells(t.Actor)) if (world.Map.IsInMap(cell)) @@ -154,25 +154,25 @@ namespace OpenRA.Graphics bitmap.UnlockBits(bitmapData); return bitmap; } - + public static Bitmap ShroudBitmap(World world) - { + { var map = world.Map; var size = Exts.NextPowerOf2(Math.Max(map.Bounds.Width, map.Bounds.Height)); var bitmap = new Bitmap(size, size); if (world.LocalShroud.Disabled) return bitmap; - + var bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); var shroud = Color.Black.ToArgb(); var fog = Color.FromArgb(128, Color.Black).ToArgb(); - + unsafe { int* c = (int*)bitmapData.Scan0; - + for (var x = 0; x < map.Bounds.Width; x++) for (var y = 0; y < map.Bounds.Height; y++) { @@ -180,7 +180,7 @@ namespace OpenRA.Graphics var mapY = y + map.Bounds.Top; if (!world.LocalShroud.IsExplored(mapX, mapY)) *(c + (y * bitmapData.Stride >> 2) + x) = shroud; - else if (!world.LocalShroud.IsVisible(mapX,mapY)) + else if (!world.LocalShroud.IsVisible(mapX,mapY)) *(c + (y * bitmapData.Stride >> 2) + x) = fog; } } @@ -188,7 +188,7 @@ namespace OpenRA.Graphics bitmap.UnlockBits(bitmapData); return bitmap; } - + public static Bitmap RenderMapPreview(Map map) { Bitmap terrain = TerrainBitmap(map); diff --git a/OpenRA.Game/Graphics/Renderer.cs b/OpenRA.Game/Graphics/Renderer.cs index 14209be963..1963bbfd57 100644 --- a/OpenRA.Game/Graphics/Renderer.cs +++ b/OpenRA.Game/Graphics/Renderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,7 +43,7 @@ namespace OpenRA.Graphics Queue> tempBuffers = new Queue>(); public Dictionary Fonts; - + public Renderer() { TempBufferSize = Game.Settings.Graphics.BatchSize; @@ -65,12 +65,12 @@ namespace OpenRA.Graphics for( int i = 0 ; i < TempBufferCount ; i++ ) tempBuffers.Enqueue( device.CreateVertexBuffer( TempBufferSize ) ); } - + public void InitializeFonts(Manifest m) { Fonts = m.Fonts.ToDictionary(x => x.Key, x => new SpriteFont(x.Value.First, x.Value.Second)); } - + internal IGraphicsDevice Device { get { return device; } } public void BeginFrame(float2 scroll, float zoom) @@ -112,7 +112,7 @@ namespace OpenRA.Graphics device.DrawPrimitives(type, firstVertex, numVertices); PerfHistory.Increment("batches", 1); } - + public void Flush() { CurrentBatchRenderer = null; @@ -144,7 +144,7 @@ namespace OpenRA.Graphics static Size GetResolution(WindowMode windowmode) { var size = (windowmode == WindowMode.Windowed) - ? Game.Settings.Graphics.WindowedSize + ? Game.Settings.Graphics.WindowedSize : Game.Settings.Graphics.FullscreenSize; return new Size(size.X, size.Y); } @@ -156,7 +156,7 @@ namespace OpenRA.Graphics var factory = (IDeviceFactory) r.Type.GetConstructor( Type.EmptyTypes ).Invoke( null ); return factory.Create( new Size( width, height ), window ); } - + throw new InvalidOperationException("Renderer DLL is missing RendererAttribute to tell us what type to use!"); } diff --git a/OpenRA.Game/Graphics/Sequence.cs b/OpenRA.Game/Graphics/Sequence.cs index 0338856f22..5e5c6e77ed 100644 --- a/OpenRA.Game/Graphics/Sequence.cs +++ b/OpenRA.Game/Graphics/Sequence.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.Graphics srcOverride = info.Value; Name = name; var d = info.NodesDict; - + sprites = Game.modData.SpriteLoader.LoadAllSprites(string.IsNullOrEmpty(srcOverride) ? unit : srcOverride ); start = int.Parse(d["Start"].Value); @@ -54,27 +54,27 @@ namespace OpenRA.Graphics else tick = 40; } - + public MiniYaml Save() { var root = new List(); - + root.Add(new MiniYamlNode("Start", start.ToString())); - + if (length > 1 && (start != 0 || length != sprites.Length - start)) root.Add(new MiniYamlNode("Length", length.ToString())); else if (length > 1 && length == sprites.Length - start) root.Add(new MiniYamlNode("Length", "*")); - + if (facings > 1) root.Add(new MiniYamlNode("Facings", facings.ToString())); - + if (tick != 40) - root.Add(new MiniYamlNode("Tick", tick.ToString())); - + root.Add(new MiniYamlNode("Tick", tick.ToString())); + return new MiniYaml(srcOverride, root); } - + public Sprite GetSprite( int frame ) { return GetSprite( frame, 0 ); diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs index 74c3a16cf3..2bd2652f5e 100644 --- a/OpenRA.Game/Graphics/SequenceProvider.cs +++ b/OpenRA.Game/Graphics/SequenceProvider.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Graphics/Sheet.cs b/OpenRA.Game/Graphics/Sheet.cs index 0b725f1c88..2e7277f580 100644 --- a/OpenRA.Game/Graphics/Sheet.cs +++ b/OpenRA.Game/Graphics/Sheet.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Graphics/SheetBuilder.cs b/OpenRA.Game/Graphics/SheetBuilder.cs index 99f6d22ee2..1340e501ce 100644 --- a/OpenRA.Game/Graphics/SheetBuilder.cs +++ b/OpenRA.Game/Graphics/SheetBuilder.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Graphics } Sheet NewSheet() { return new Sheet(new Size( Renderer.SheetSize, Renderer.SheetSize ) ); } - + Sheet current = null; int rowHeight = 0; Point p; diff --git a/OpenRA.Game/Graphics/ShroudRenderer.cs b/OpenRA.Game/Graphics/ShroudRenderer.cs index 6fb5eb469c..24cf83fa8c 100644 --- a/OpenRA.Game/Graphics/ShroudRenderer.cs +++ b/OpenRA.Game/Graphics/ShroudRenderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Graphics Traits.Shroud shroud; Sprite[] shadowBits = Game.modData.SpriteLoader.LoadAllSprites("shadow"); Sprite[,] sprites, fogSprites; - + bool dirty = true; Map map; @@ -26,7 +26,7 @@ namespace OpenRA.Graphics { this.shroud = world.LocalShroud; this.map = world.Map; - + sprites = new Sprite[map.MapSize.X, map.MapSize.Y]; fogSprites = new Sprite[map.MapSize.X, map.MapSize.Y]; shroud.Dirty += () => dirty = true; @@ -51,7 +51,7 @@ namespace OpenRA.Graphics new byte[] { 41 }, new byte[] { 46 }, }; - + Sprite ChooseShroud(int i, int j) { if( !shroud.IsExplored( i, j ) ) return shadowBits[ 0xf ]; @@ -75,7 +75,7 @@ namespace OpenRA.Graphics return shadowBits[ SpecialShroudTiles[ u ^ uSides ][ v ] ]; } - + Sprite ChooseFog(int i, int j) { if (!shroud.IsVisible(i,j)) return shadowBits[0xf]; @@ -102,14 +102,14 @@ namespace OpenRA.Graphics } internal void Draw( WorldRenderer wr ) - { + { if (dirty) { dirty = false; for (int i = map.Bounds.Left; i < map.Bounds.Right; i++) for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++) sprites[i, j] = ChooseShroud(i, j); - + for (int i = map.Bounds.Left; i < map.Bounds.Right; i++) for (int j = map.Bounds.Top; j < map.Bounds.Bottom; j++) fogSprites[i, j] = ChooseFog(i, j); diff --git a/OpenRA.Game/Graphics/Sprite.cs b/OpenRA.Game/Graphics/Sprite.cs index 680c1952c9..cb0aa400c8 100644 --- a/OpenRA.Game/Graphics/Sprite.cs +++ b/OpenRA.Game/Graphics/Sprite.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Graphics/SpriteFont.cs b/OpenRA.Game/Graphics/SpriteFont.cs index 4dbaf0b01c..c5f2572506 100644 --- a/OpenRA.Game/Graphics/SpriteFont.cs +++ b/OpenRA.Game/Graphics/SpriteFont.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -60,9 +60,9 @@ namespace OpenRA.Graphics p = location; continue; } - + var g = glyphs[Pair.New(s, c)]; - Game.Renderer.RgbaSpriteRenderer.DrawSprite(g.Sprite, + Game.Renderer.RgbaSpriteRenderer.DrawSprite(g.Sprite, new float2( (int)Math.Round(p.X + g.Offset.X, 0), p.Y + g.Offset.Y)); @@ -101,7 +101,7 @@ namespace OpenRA.Graphics var _glyph = (FT_GlyphSlotRec)Marshal.PtrToStructure(_face.glyph, typeof(FT_GlyphSlotRec)); var s = builder.Allocate( - new Size(_glyph.metrics.width.ToInt32() >> 6, + new Size(_glyph.metrics.width.ToInt32() >> 6, _glyph.metrics.height.ToInt32() >> 6)); var g = new GlyphInfo diff --git a/OpenRA.Game/Graphics/SpriteLoader.cs b/OpenRA.Game/Graphics/SpriteLoader.cs index 2cb8efa6b4..842232d06b 100644 --- a/OpenRA.Game/Graphics/SpriteLoader.cs +++ b/OpenRA.Game/Graphics/SpriteLoader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ namespace OpenRA.Graphics { public SpriteLoader( string[] exts, SheetBuilder sheetBuilder ) { - SheetBuilder = sheetBuilder; + SheetBuilder = sheetBuilder; this.exts = exts; sprites = new Cache( LoadSprites ); } diff --git a/OpenRA.Game/Graphics/SpriteRenderer.cs b/OpenRA.Game/Graphics/SpriteRenderer.cs index 26e4f4e3cd..957eb6f701 100644 --- a/OpenRA.Game/Graphics/SpriteRenderer.cs +++ b/OpenRA.Game/Graphics/SpriteRenderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -46,17 +46,17 @@ namespace OpenRA.Graphics currentSheet = null; } } - + public void DrawSprite(Sprite s, float2 location, WorldRenderer wr, string palette) { DrawSprite(s, location, wr.GetPaletteIndex(palette), s.size); } - + public void DrawSprite(Sprite s, float2 location, WorldRenderer wr, string palette, float2 size) { DrawSprite(s, location, wr.GetPaletteIndex(palette), size); } - + public void DrawSprite(Sprite s, float2 location, int paletteIndex, float2 size) { Renderer.CurrentBatchRenderer = this; @@ -71,14 +71,14 @@ namespace OpenRA.Graphics Util.FastCreateQuad(vertices, location.ToInt2(), s, paletteIndex, nv, size); nv += 4; } - - + + // For RGBASpriteRenderer, which doesn't use palettes public void DrawSprite(Sprite s, float2 location) { DrawSprite(s, location, 0, s.size); } - + public void DrawSprite(Sprite s, float2 location, float2 size) { DrawSprite(s, location, 0, size); diff --git a/OpenRA.Game/Graphics/TerrainRenderer.cs b/OpenRA.Game/Graphics/TerrainRenderer.cs index da570f0224..5c33e5110e 100644 --- a/OpenRA.Game/Graphics/TerrainRenderer.cs +++ b/OpenRA.Game/Graphics/TerrainRenderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -38,9 +38,9 @@ namespace OpenRA.Graphics terrainSheet = tileMapping[map.MapTiles.Value[map.Bounds.Left, map.Bounds.Top]].sheet; int nv = 0; - + var terrainPalette = Game.modData.Palette.GetPaletteIndex("terrain"); - + for( int j = map.Bounds.Top; j < map.Bounds.Bottom; j++ ) for( int i = map.Bounds.Left; i < map.Bounds.Right; i++ ) { @@ -48,7 +48,7 @@ namespace OpenRA.Graphics // TODO: move GetPaletteIndex out of the inner loop. Util.FastCreateQuad(vertices, Game.CellSize * new float2(i, j), tile, terrainPalette, nv, tile.size); nv += 4; - + if (tileMapping[map.MapTiles.Value[i, j]].sheet != terrainSheet) throw new InvalidOperationException("Terrain sprites span multiple sheets"); } diff --git a/OpenRA.Game/Graphics/Util.cs b/OpenRA.Game/Graphics/Util.cs index a0038900ae..424bf30069 100644 --- a/OpenRA.Game/Graphics/Util.cs +++ b/OpenRA.Game/Graphics/Util.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -48,13 +48,13 @@ namespace OpenRA.Graphics { var attrib = new float2(palette / (float)HardwarePalette.MaxPalettes, channelSelect[(int)r.channel]); - vertices[nv] = new Vertex(o, + vertices[nv] = new Vertex(o, r.FastMapTextureCoords(0), attrib); - vertices[nv + 1] = new Vertex(new float2(o.X + size.X, o.Y), + vertices[nv + 1] = new Vertex(new float2(o.X + size.X, o.Y), r.FastMapTextureCoords(1), attrib); - vertices[nv + 2] = new Vertex(new float2(o.X + size.X, o.Y + size.Y), + vertices[nv + 2] = new Vertex(new float2(o.X + size.X, o.Y + size.Y), r.FastMapTextureCoords(3), attrib); - vertices[nv + 3] = new Vertex(new float2(o.X, o.Y + size.Y), + vertices[nv + 3] = new Vertex(new float2(o.X, o.Y + size.Y), r.FastMapTextureCoords(2), attrib); } @@ -88,7 +88,7 @@ namespace OpenRA.Graphics LerpChannel(t, a.G, b.G), LerpChannel(t, a.B, b.B)); } - + public static int LerpARGBColor(float t, int c1, int c2) { int a = LerpChannel(t, (c1 >> 24) & 255, (c2 >> 24) & 255); diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index c1dc071cd6..b49388ff35 100755 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -87,24 +87,24 @@ namespace OpenRA.Graphics { Scroll(delta, false); } - + public void Scroll(float2 delta, bool ignoreBorders) { // Convert from world-px to viewport-px var d = (1f/Zoom*delta).ToInt2(); var newScrollPosition = scrollPosition + d; - + if(!ignoreBorders) newScrollPosition = NormalizeScrollPosition(newScrollPosition); scrollPosition = newScrollPosition; } - + int2 NormalizeScrollPosition(int2 newScrollPosition) { return newScrollPosition.Clamp(scrollLimits); } - + public ScrollDirection GetBlockedDirections() { var ret = ScrollDirection.None; @@ -124,13 +124,13 @@ namespace OpenRA.Graphics Zoom = Game.Settings.Graphics.PixelDouble ? 2 : 1; scrollPosition = new int2(scrollLimits.Location) + new int2(scrollLimits.Size)/2; } - + public void DrawRegions( WorldRenderer wr, IInputHandler inputHandler ) { renderer.BeginFrame(scrollPosition, Zoom); if (wr != null) wr.Draw(); - + using( new PerfSample("render_widgets") ) { Widget.DoDraw(); @@ -154,17 +154,17 @@ namespace OpenRA.Graphics { cursorFrame += 0.5f; } - + // Convert from viewport coords to cell coords (not px) public float2 ViewToWorld(MouseInput mi) { return ViewToWorld(mi.Location); } public float2 ViewToWorld(int2 loc) { return (1f / Game.CellSize) * (1f/Zoom*loc.ToFloat2() + Location); } - + public int2 ViewToWorldPx(int2 loc) { return (1f/Zoom*loc.ToFloat2() + Location).ToInt2(); } public int2 ViewToWorldPx(MouseInput mi) { return ViewToWorldPx(mi.Location); } - + public void Center(float2 loc) { scrollPosition = NormalizeScrollPosition((Game.CellSize*loc - 1f/(2*Zoom)*screenSize.ToFloat2()).ToInt2()); @@ -179,7 +179,7 @@ namespace OpenRA.Graphics .Aggregate((a, b) => a + b) / actors.Count(); scrollPosition = NormalizeScrollPosition((avgPos - 1f/(2*Zoom)*screenSize.ToFloat2()).ToInt2()); } - + // Rectangle (in viewport coords) that contains things to be drawn public Rectangle ViewBounds(World world) { @@ -195,7 +195,7 @@ namespace OpenRA.Graphics int2 cachedScroll = new int2(int.MaxValue, int.MaxValue); Rectangle cachedRect; - + // Rectangle (in cell coords) of cells that are currently visible on the screen public Rectangle WorldBounds(World world) { @@ -208,7 +208,7 @@ namespace OpenRA.Graphics cachedRect = Rectangle.Intersect(Rectangle.FromLTRB(tl.X, tl.Y, br.X, br.Y), world.Map.Bounds); cachedScroll = scrollPosition; } - + var b = world.LocalShroud.Bounds; return (b.HasValue) ? Rectangle.Intersect(cachedRect, b.Value) : cachedRect; } diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 06f187fa1e..0e6c0e1a22 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,15 +30,15 @@ namespace OpenRA.Graphics this.palette = Game.modData.Palette; foreach( var pal in world.traitDict.ActorsWithTraitMultiple( world ) ) pal.Trait.InitPalette( this ); - + terrainRenderer = new TerrainRenderer(world, this); shroudRenderer = new ShroudRenderer(world); } - + public int GetPaletteIndex(string name) { return palette.GetPaletteIndex(name); } public Palette GetPalette(string name) { return palette.GetPalette(name); } public void AddPalette(string name, Palette pal) { palette.AddPalette(name, pal); } - + class SpriteComparer : IComparer { public int Compare(Renderable x, Renderable y) @@ -79,9 +79,9 @@ namespace OpenRA.Graphics if (!a.Destroyed) foreach (var t in a.TraitsImplementing()) t.RenderBeforeWorld(this, a); - + Game.Renderer.Flush(); - + if (world.OrderGenerator != null) world.OrderGenerator.RenderBeforeWorld(this, world); @@ -98,7 +98,7 @@ namespace OpenRA.Graphics shroudRenderer.Draw( this ); Game.Renderer.DisableScissor(); - + foreach (var a in world.Selection.Actors) if (!a.Destroyed) foreach (var t in a.TraitsImplementing()) @@ -163,7 +163,7 @@ namespace OpenRA.Graphics { var start = location + Game.CellSize * range * float2.FromAngle((float)(Math.PI * i) / 16); var end = location + Game.CellSize * range * float2.FromAngle((float)(Math.PI * (i + 0.7)) / 16); - + Game.Renderer.WorldLineRenderer.DrawLine(start, end, c, c); } } diff --git a/OpenRA.Game/Group.cs b/OpenRA.Game/Group.cs index 082fc6df24..957cb853ec 100644 --- a/OpenRA.Game/Group.cs +++ b/OpenRA.Game/Group.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA static int nextGroup; public IEnumerable Actors { get { return actors; } } - + public Group(IEnumerable actors) { this.actors = actors.ToList(); diff --git a/OpenRA.Game/InputHandler.cs b/OpenRA.Game/InputHandler.cs index 5f9339be0d..d7ba0ba64b 100755 --- a/OpenRA.Game/InputHandler.cs +++ b/OpenRA.Game/InputHandler.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index d062b7aada..54e54c229b 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA { [FieldLoader.Ignore] protected IFolder Container; public string Path {get; protected set;} - + // Yaml map data public string Uid { get; protected set; } public int MapFormat; @@ -37,14 +37,14 @@ namespace OpenRA public string Description; public string Author; public string Tileset; - + [FieldLoader.Ignore] public Lazy> Actors; public int PlayerCount { get { return Players.Count(p => p.Value.Playable); } } public IEnumerable SpawnPoints { get { return Actors.Value.Values.Where(a => a.Type == "mpspawn").Select(a => a.InitDict.Get().value); } } - + public Rectangle Bounds; - + // Yaml map data [FieldLoader.Ignore] public Dictionary Players = new Dictionary(); [FieldLoader.Ignore] public Lazy> Smudges; @@ -73,12 +73,12 @@ namespace OpenRA { // Do nothing; not a valid map (editor hack) } - + public static Map FromTileset(string tileset) { var tile = OpenRA.Rules.TileSets[tileset].Templates.First(); var tileRef = new TileReference { type = tile.Key, index = (byte)0 }; - + Map map = new Map() { Title = "Name your map here", @@ -91,7 +91,7 @@ namespace OpenRA Actors = Lazy.New(() => new Dictionary()), Smudges = Lazy.New(() => new List()) }; - + return map; } @@ -102,7 +102,7 @@ namespace OpenRA public int2 Location = int2.Zero; public string Owner = null; } - + void AssertExists(string filename) { using(var s = Container.GetContent(filename)) @@ -121,7 +121,7 @@ namespace OpenRA var yaml = new MiniYaml( null, MiniYaml.FromStream(Container.GetContent("map.yaml")) ); FieldLoader.Load(this, yaml); Uid = ComputeHash(); - + // 'Simple' metadata FieldLoader.Load( this, yaml ); @@ -130,25 +130,25 @@ namespace OpenRA // Use release-20110511 to convert older maps to format 5 if (MapFormat < 5) throw new InvalidDataException("Map format {0} is not supported.\n File: {1}".F(MapFormat, path)); - + // Load players foreach (var kv in yaml.NodesDict["Players"].NodesDict) { var player = new PlayerReference(kv.Value); Players.Add(player.Name, player); } - + Actors = Lazy.New(() => { var ret = new Dictionary(); // Load actors foreach (var kv in yaml.NodesDict["Actors"].NodesDict) ret.Add(kv.Key, new ActorReference(kv.Value.Value, kv.Value.NodesDict)); - + // Add waypoint actors return ret; }); - + // Smudges Smudges = Lazy.New(() => { @@ -159,10 +159,10 @@ namespace OpenRA string[] loc = vals[1].Split(','); ret.Add(new SmudgeReference(vals[0], new int2(int.Parse(loc[0]), int.Parse(loc[1])), int.Parse(vals[2]))); } - + return ret; }); - + // Rules Rules = yaml.NodesDict["Rules"].Nodes; @@ -172,20 +172,20 @@ namespace OpenRA // Weapons Weapons = (yaml.NodesDict.ContainsKey("Weapons")) ? yaml.NodesDict["Weapons"].Nodes : new List(); - + // Voices Voices = (yaml.NodesDict.ContainsKey("Voices")) ? yaml.NodesDict["Voices"].Nodes : new List(); CustomTerrain = new string[MapSize.X, MapSize.Y]; - + MapTiles = Lazy.New(() => LoadMapTiles()); MapResources = Lazy.New(() => LoadResourceTiles()); } public void Save(string toPath) - { + { MapFormat = 5; - + var root = new List(); var fields = new string[] { @@ -201,7 +201,7 @@ namespace OpenRA "UseAsShellmap", "Type", }; - + foreach (var field in fields) { var f = this.GetType().GetField(field); @@ -224,22 +224,22 @@ namespace OpenRA root.Add(new MiniYamlNode("Sequences", null, Sequences)); root.Add(new MiniYamlNode("Weapons", null, Weapons)); root.Add(new MiniYamlNode("Voices", null, Voices)); - + Dictionary entries = new Dictionary(); entries.Add("map.bin", SaveBinaryData()); var s = root.WriteToString(); entries.Add("map.yaml", Encoding.UTF8.GetBytes(s)); - + // Saving the map to a new location if (toPath != Path) { Path = toPath; - + // Create a new map package // TODO: Add other files (resources, rules) to the entries list Container = FileSystem.CreatePackage(Path, int.MaxValue, entries); } - + // Update existing package Container.Write(entries); } @@ -259,7 +259,7 @@ namespace OpenRA return ret; } - + public TileReference[,] LoadMapTiles() { var tiles = new TileReference[MapSize.X, MapSize.Y]; @@ -290,7 +290,7 @@ namespace OpenRA } return tiles; } - + public TileReference[,] LoadResourceTiles() { var resources = new TileReference[MapSize.X, MapSize.Y]; @@ -306,7 +306,7 @@ namespace OpenRA if (width != MapSize.X || height != MapSize.Y) throw new InvalidDataException("Invalid tile data"); - + // Skip past tile data for (var i = 0; i < 3*MapSize.X*MapSize.Y; i++) ReadByte(dataStream); @@ -347,7 +347,7 @@ namespace OpenRA writer.Write(PickAny ? (byte)(i % 4 + (j % 4) * 4) : MapTiles.Value[i, j].index); } - // Resource data + // Resource data for (int i = 0; i < MapSize.X; i++) for (int j = 0; j < MapSize.Y; j++) { @@ -387,12 +387,12 @@ namespace OpenRA MapResources = Lazy.New(() => ResizeArray(oldMapResources, oldMapResources[0, 0], width, height)); MapSize = new int2(width, height); } - + public void ResizeCordon(int left, int top, int right, int bottom) { Bounds = Rectangle.FromLTRB(left, top, right, bottom); } - + string ComputeHash() { // UID is calculated by taking an SHA1 of the yaml and binary data diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 7ce60a92eb..b8cc61d97a 100755 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,9 +29,9 @@ namespace OpenRA public SheetBuilder SheetBuilder; public SpriteLoader SpriteLoader; public HardwarePalette Palette { get; private set; } - + public ModData( params string[] mods ) - { + { Manifest = new Manifest( mods ); ObjectCreator = new ObjectCreator( Manifest ); LoadScreen = ObjectCreator.CreateObject(Manifest.LoadScreen.Value); @@ -42,7 +42,7 @@ namespace OpenRA public void LoadInitialAssets() { - // all this manipulation of static crap here is nasty and breaks + // all this manipulation of static crap here is nasty and breaks // horribly when you use ModData in unexpected ways. FileSystem.UnmountAll(); @@ -66,7 +66,7 @@ namespace OpenRA if (!AvailableMaps.ContainsKey(uid)) throw new InvalidDataException("Invalid map uid: {0}".F(uid)); var map = new Map(AvailableMaps[uid].Path); - + // Reinit all our assets LoadInitialAssets(); foreach (var pkg in Manifest.Packages) @@ -74,14 +74,14 @@ namespace OpenRA // Mount map package so custom assets can be used. TODO: check priority. FileSystem.Mount(FileSystem.OpenPackage(map.Path, int.MaxValue)); - + Rules.LoadRules(Manifest, map); SpriteLoader = new SpriteLoader( Rules.TileSets[map.Tileset].Extensions, SheetBuilder ); SequenceProvider.Initialize(Manifest.Sequences, map.Sequences); - + return map; } - + public static IEnumerable FindMapsIn(string dir) { string[] NoMaps = { }; @@ -98,7 +98,7 @@ namespace OpenRA { var paths = mods.SelectMany(p => FindMapsIn("mods{0}{1}{0}maps{0}".F(Path.DirectorySeparatorChar, p))) .Concat(mods.SelectMany(p => FindMapsIn("{1}maps{0}{2}{0}".F(Path.DirectorySeparatorChar, Platform.SupportDir, p)))); - + var ret = new Dictionary(); foreach (var path in paths) { @@ -115,9 +115,9 @@ namespace OpenRA } return ret; } - + } - + public interface ILoadScreen { void Init(Dictionary info); diff --git a/OpenRA.Game/Network/Connection.cs b/OpenRA.Game/Network/Connection.cs index f9889dc44a..503793deef 100755 --- a/OpenRA.Game/Network/Connection.cs +++ b/OpenRA.Game/Network/Connection.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -204,7 +204,7 @@ namespace OpenRA.Network using( new PerfSample( "Thread.Join" )) t.Join(); } - + ~NetworkConnection() { Dispose(); } } } diff --git a/OpenRA.Game/Network/FrameData.cs b/OpenRA.Game/Network/FrameData.cs index a8ce757268..f29f95ce69 100755 --- a/OpenRA.Game/Network/FrameData.cs +++ b/OpenRA.Game/Network/FrameData.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs index 9ec144f29a..952b3b7f2d 100644 --- a/OpenRA.Game/Network/GameServer.cs +++ b/OpenRA.Game/Network/GameServer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/Handshake.cs b/OpenRA.Game/Network/Handshake.cs index 3423be34af..c18d58e559 100644 --- a/OpenRA.Game/Network/Handshake.cs +++ b/OpenRA.Game/Network/Handshake.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Network { public string[] Mods; public string Map; - + public string Serialize() { var data = new List(); @@ -34,20 +34,20 @@ namespace OpenRA.Network return handshake; } } - + public class HandshakeResponse { public string[] Mods; public string Password; [FieldLoader.Ignore] public Session.Client Client; - + public string Serialize() { var data = new List(); data.Add( new MiniYamlNode( "Handshake", null, new string[]{ "Mods", "Password" }.Select( p => FieldSaver.SaveField(this, p) ).ToList() ) ); data.Add(new MiniYamlNode("Client", FieldSaver.Save(Client))); - + return data.WriteToString(); } @@ -55,7 +55,7 @@ namespace OpenRA.Network { var handshake = new HandshakeResponse(); handshake.Client = new Session.Client(); - + var ys = MiniYaml.FromString(data); foreach (var y in ys) switch (y.Key) diff --git a/OpenRA.Game/Network/Order.cs b/OpenRA.Game/Network/Order.cs index 85a6a2c38a..00443640c0 100755 --- a/OpenRA.Game/Network/Order.cs +++ b/OpenRA.Game/Network/Order.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,10 +18,10 @@ namespace OpenRA [Flags] enum OrderFields : byte { - TargetActor = 0x01, - TargetLocation = 0x02, - TargetString = 0x04, - Queued = 0x08, + TargetActor = 0x01, + TargetLocation = 0x02, + TargetString = 0x04, + Queued = 0x08, ExtraLocation = 0x10, } @@ -43,10 +43,10 @@ namespace OpenRA public string TargetString; public int2 ExtraLocation; public bool IsImmediate; - + public Player Player { get { return Subject.Owner; } } - Order(string orderString, Actor subject, + Order(string orderString, Actor subject, Actor targetActor, int2 targetLocation, string targetString, bool queued, int2 extraLocation) { this.OrderString = orderString; @@ -57,18 +57,18 @@ namespace OpenRA this.Queued = queued; this.ExtraLocation = extraLocation; } - + // For scripting special powers - public Order() + public Order() : this(null, null, null, int2.Zero, null, false, int2.Zero) { } - - public Order(string orderString, Actor subject, bool queued) + + public Order(string orderString, Actor subject, bool queued) : this(orderString, subject, null, int2.Zero, null, queued, int2.Zero) { } - + public Order(string orderstring, Order order) : this(orderstring, order.Subject, order.TargetActor, order.TargetLocation, order.TargetString, order.Queued, order.ExtraLocation) {} - + public byte[] Serialize() { if (IsImmediate) /* chat, whatever */ @@ -128,7 +128,7 @@ namespace OpenRA var order = r.ReadString(); var subjectId = r.ReadUInt32(); var flags = (OrderFields)r.ReadByte(); - + var targetActorId = flags.HasField(OrderFields.TargetActor) ? r.ReadUInt32() : 0xffffffff; var targetLocation = flags.HasField(OrderFields.TargetLocation) ? r.ReadInt2() : int2.Zero; var targetString = flags.HasField(OrderFields.TargetString) ? r.ReadString() : null; @@ -154,7 +154,7 @@ namespace OpenRA throw new NotImplementedException(); } } - + public override string ToString() { return ("OrderString: \"{0}\" \n\t Subject: \"{1}\". \n\t TargetActor: \"{2}\" \n\t TargetLocation: {3}." + diff --git a/OpenRA.Game/Network/OrderIO.cs b/OpenRA.Game/Network/OrderIO.cs index 40a6fed8d6..3168330a71 100755 --- a/OpenRA.Game/Network/OrderIO.cs +++ b/OpenRA.Game/Network/OrderIO.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/OrderManager.cs b/OpenRA.Game/Network/OrderManager.cs index 853dd36d35..6bffea0ab2 100755 --- a/OpenRA.Game/Network/OrderManager.cs +++ b/OpenRA.Game/Network/OrderManager.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,9 +37,9 @@ namespace OpenRA.Network public bool GameStarted { get { return NetFrameNumber != 0; } } public IConnection Connection { get; private set; } - + public readonly int SyncHeaderSize = 9; - + List localOrders = new List(); public void StartGame() @@ -134,19 +134,19 @@ namespace OpenRA.Network void OutOfSync(int frame, int index) { var orders = frameData.OrdersForFrame( world, frame ); - + // Invalid index if (index >= orders.Count()) OutOfSync(frame); - + throw new InvalidOperationException("Out of sync in frame {0}.\n {1}".F(frame, orders.ElementAt(index).Order.ToString())); } - + void OutOfSync(int frame) { throw new InvalidOperationException("Out of sync in frame {0}.\n".F(frame)); } - + void OutOfSync(int frame, string blame) { throw new InvalidOperationException("Out of sync in frame {0}: Blame {1}.\n".F(frame, blame)); diff --git a/OpenRA.Game/Network/ReplayConnection.cs b/OpenRA.Game/Network/ReplayConnection.cs index 34055db1fa..efae2bf61b 100755 --- a/OpenRA.Game/Network/ReplayConnection.cs +++ b/OpenRA.Game/Network/ReplayConnection.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/ServerList.cs b/OpenRA.Game/Network/ServerList.cs index 3a9f699e02..55cff8dc47 100644 --- a/OpenRA.Game/Network/ServerList.cs +++ b/OpenRA.Game/Network/ServerList.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index ef2c5aa814..e7a2611ddb 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Network/SyncReport.cs b/OpenRA.Game/Network/SyncReport.cs index 9d9cf8cb9a..ca9f0eb37c 100755 --- a/OpenRA.Game/Network/SyncReport.cs +++ b/OpenRA.Game/Network/SyncReport.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,13 +25,13 @@ namespace OpenRA.Network for (var i = 0; i < numSyncReports; i++) syncReports[i] = new SyncReport.Report(); } - + internal void UpdateSyncReport() { GenerateSyncReport(syncReports[curIndex]); curIndex = ++curIndex % numSyncReports; } - + void GenerateSyncReport(Report report) { report.Frame = orderManager.NetFrameNumber; @@ -72,14 +72,14 @@ namespace OpenRA.Network } Log.Write("sync", "No sync report available!"); } - + class Report { public int Frame; public int SyncedRandom; public List Traits = new List(); } - + struct TraitReport { public uint ActorID; diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index 37f8e22bb8..15b03bdd63 100755 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Network { static Player FindPlayerByClient(this World world, Session.Client c) { - /* todo: this is still a hack. + /* todo: this is still a hack. * the cases we're trying to avoid are the extra players on the host's client -- Neutral, other MapPlayers,..*/ return world.Players.FirstOrDefault( p => (p.ClientIndex == c.Index && p.PlayerReference.Playable)); @@ -97,15 +97,15 @@ namespace OpenRA.Network Game.StartGame(orderManager.LobbyInfo.GlobalSettings.Map); break; } - + case "HandshakeRequest": { var request = HandshakeRequest.Deserialize(order.TargetString); - + // Check that the map exists on the client if (!Game.modData.AvailableMaps.ContainsKey(request.Map)) throw new InvalidOperationException("Missing map {0}".F(request.Map)); - + var info = new Session.Client() { Name = Game.Settings.Player.Name, @@ -115,7 +115,7 @@ namespace OpenRA.Network Team = 0, State = Session.ClientState.NotReady }; - + var localMods = orderManager.LobbyInfo.GlobalSettings.Mods.Select(m => "{0}@{1}".F(m,Mod.AllMods[m].Version)).ToArray(); var response = new HandshakeResponse() { @@ -123,7 +123,7 @@ namespace OpenRA.Network Mods = localMods, Password = "Foo" }; - + orderManager.IssueOrder(Order.HandshakeResponse(response.Serialize())); break; } @@ -157,7 +157,7 @@ namespace OpenRA.Network Game.Debug("{0} has set diplomatic stance vs {1} to {2}".F( order.Player.PlayerName, targetPlayer.PlayerName, newStance)); - + // automatically declare war reciprocally if (newStance == Stance.Enemy && targetPlayer.Stances[order.Player] == Stance.Ally) { diff --git a/OpenRA.Game/ObjectCreator.cs b/OpenRA.Game/ObjectCreator.cs index c734aebf10..763c751b07 100755 --- a/OpenRA.Game/ObjectCreator.cs +++ b/OpenRA.Game/ObjectCreator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -38,7 +38,7 @@ namespace OpenRA ModAssemblies = asms.ToArray(); } - public static Action MissingTypeAction = + public static Action MissingTypeAction = s => { throw new InvalidOperationException("Cannot locate type: {0}".F(s)); }; public T CreateObject(string className) diff --git a/OpenRA.Game/Orders/GenericSelectTarget.cs b/OpenRA.Game/Orders/GenericSelectTarget.cs index a911ed0f6f..8025dd5af2 100644 --- a/OpenRA.Game/Orders/GenericSelectTarget.cs +++ b/OpenRA.Game/Orders/GenericSelectTarget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,10 +30,10 @@ namespace OpenRA.Orders expectedButton = button; } - public GenericSelectTarget(IEnumerable subjects, string order, string cursor) + public GenericSelectTarget(IEnumerable subjects, string order, string cursor) : this(subjects, order, cursor, MouseButton.Left) { - + } public GenericSelectTarget(Actor subject, string order, string cursor) diff --git a/OpenRA.Game/Orders/IOrderGenerator.cs b/OpenRA.Game/Orders/IOrderGenerator.cs index c72dfa07da..bb45c00450 100644 --- a/OpenRA.Game/Orders/IOrderGenerator.cs +++ b/OpenRA.Game/Orders/IOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Orders/UnitOrderGenerator.cs b/OpenRA.Game/Orders/UnitOrderGenerator.cs index f25e0d249a..6705051c06 100644 --- a/OpenRA.Game/Orders/UnitOrderGenerator.cs +++ b/OpenRA.Game/Orders/UnitOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Orders { TargetString = string.Join(",", actorsInvolved.Select(a => a.ActorID.ToString()).ToArray()) }; - + foreach (var o in orders) yield return CheckSameOrder(o.iot, o.trait.IssueOrder(o.self, o.iot, o.target, mi.Modifiers.HasModifier(Modifiers.Shift))); @@ -88,7 +88,7 @@ namespace OpenRA.Orders .OrderByDescending( x => x.Order.OrderPriority ) ) { var actorsAt = self.World.ActorMap.GetUnitsAt( xy ).ToList(); - + var forceAttack = mi.Modifiers.HasModifier(Modifiers.Ctrl); var forceQueue = mi.Modifiers.HasModifier(Modifiers.Shift); string cursor = null; diff --git a/OpenRA.Game/Player.cs b/OpenRA.Game/Player.cs index ea9fab513f..c13ad166b7 100644 --- a/OpenRA.Game/Player.cs +++ b/OpenRA.Game/Player.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -45,7 +45,7 @@ namespace OpenRA InternalName = pr.Name; PlayerReference = pr; string botType = null; - + // Real player or host-created bot if (client != null) { diff --git a/OpenRA.Game/Properties/AssemblyInfo.cs b/OpenRA.Game/Properties/AssemblyInfo.cs index 58907345dc..dfc5296618 100644 --- a/OpenRA.Game/Properties/AssemblyInfo.cs +++ b/OpenRA.Game/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index 1c39124954..9be2cd598d 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA foreach (var ns in w.WorldActor.TraitsImplementing()) ns.SelectionChanged(); } - + public bool Contains(Actor a) { return actors.AsEnumerable().Contains(a); diff --git a/OpenRA.Game/Server/Connection.cs b/OpenRA.Game/Server/Connection.cs index 59bbd29ac9..71f0a6cab7 100644 --- a/OpenRA.Game/Server/Connection.cs +++ b/OpenRA.Game/Server/Connection.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -52,13 +52,13 @@ namespace OpenRA.Server server.DropClient(this); break; } - + } catch (SocketException e) { if (e.SocketErrorCode == SocketError.WouldBlock) break; - server.DropClient(this); - return false; + server.DropClient(this); + return false; } } diff --git a/OpenRA.Game/Server/Exts.cs b/OpenRA.Game/Server/Exts.cs index f916efec58..5d0d6a71da 100755 --- a/OpenRA.Game/Server/Exts.cs +++ b/OpenRA.Game/Server/Exts.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Server/ProtocolVersion.cs b/OpenRA.Game/Server/ProtocolVersion.cs index 84c55acf28..2293cbf66e 100644 --- a/OpenRA.Game/Server/ProtocolVersion.cs +++ b/OpenRA.Game/Server/ProtocolVersion.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 32f753acc4..2622d33a8b 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,14 +26,14 @@ namespace OpenRA.Server { // Valid player connections public List conns = new List(); - + // Pre-verified player connections public List preConns = new List(); TcpListener listener = null; Dictionary> inFlightFrames = new Dictionary>(); - + TypeDictionary ServerTraits = new TypeDictionary(); public Session lobbyInfo; public bool GameStarted = false; @@ -50,11 +50,11 @@ namespace OpenRA.Server { shutdown = true; } - + public Server(IPEndPoint endpoint, string[] mods, ServerSettings settings, ModData modData) { Log.AddChannel("server", "server.log"); - + listener = new TcpListener(endpoint); listener.Start(); var localEndpoint = (IPEndPoint)listener.LocalEndpoint; @@ -68,19 +68,19 @@ namespace OpenRA.Server foreach (var trait in modData.Manifest.ServerTraits) ServerTraits.Add( modData.ObjectCreator.CreateObject(trait) ); - + lobbyInfo = new Session( mods ); lobbyInfo.GlobalSettings.RandomSeed = randomSeed; lobbyInfo.GlobalSettings.Map = settings.Map; lobbyInfo.GlobalSettings.ServerName = settings.Name; - + foreach (var t in ServerTraits.WithInterface()) t.ServerStarted(this); - + Log.Write("server", "Initial mods: "); foreach( var m in lobbyInfo.GlobalSettings.Mods ) Log.Write("server","- {0}", m); - + Log.Write("server", "Initial map: {0}",lobbyInfo.GlobalSettings.Map); new Thread( _ => @@ -92,11 +92,11 @@ namespace OpenRA.Server checkRead.Add( listener.Server ); foreach( var c in conns ) checkRead.Add( c.socket ); foreach( var c in preConns ) checkRead.Add( c.socket ); - + Socket.Select( checkRead, null, null, timeout ); if (shutdown) break; - + foreach( Socket s in checkRead ) if( s == listener.Server ) AcceptConnection(); else if (preConns.Count > 0) @@ -108,11 +108,11 @@ namespace OpenRA.Server foreach (var t in ServerTraits.WithInterface()) t.Tick(this); - + if (shutdown) break; } - + GameStarted = false; foreach (var t in ServerTraits.WithInterface()) t.ServerShutdown(this); @@ -124,7 +124,7 @@ namespace OpenRA.Server } ) { IsBackground = true }.Start(); } - /* lobby rework todo: + /* lobby rework todo: * - "teams together" option for team games -- will eliminate most need * for manual spawnpoint choosing. * - 256 max players is a dirty hack @@ -152,7 +152,7 @@ namespace OpenRA.Server { /* could have an exception here when listener 'goes away' when calling AcceptConnection! */ /* alternative would be to use locking but the listener doesnt go away without a reason */ - return; + return; } var newConn = new Connection { socket = newSocket }; @@ -166,7 +166,7 @@ namespace OpenRA.Server newConn.socket.Send(BitConverter.GetBytes(ProtocolVersion.Version)); newConn.socket.Send(BitConverter.GetBytes(newConn.PlayerIndex)); preConns.Add(newConn); - + // Dispatch a handshake order var request = new HandshakeRequest() { @@ -177,40 +177,40 @@ namespace OpenRA.Server } catch (Exception) { DropClient(newConn); } } - + void ValidateClient(Connection newConn, string data) { try { if (GameStarted) { - Log.Write("server", "Rejected connection from {0}; game is already started.", + Log.Write("server", "Rejected connection from {0}; game is already started.", newConn.socket.RemoteEndPoint); - + SendOrderTo(newConn, "ServerError", "The game has already started"); DropClient(newConn); return; } - + var handshake = HandshakeResponse.Deserialize(data); var client = handshake.Client; var mods = handshake.Mods; - + // Check that the client has compatable mods var valid = mods.All( m => m.Contains('@')) && //valid format mods.Count() == Game.CurrentMods.Count() && //same number mods.Select( m => Pair.New(m.Split('@')[0], m.Split('@')[1])).All(kv => Game.CurrentMods.ContainsKey(kv.First) && (kv.Second == "{DEV_VERSION}" || Game.CurrentMods[kv.First].Version == "{DEV_VERSION}" || kv.Second == Game.CurrentMods[kv.First].Version)); - if (!valid) + if (!valid) { - Log.Write("server", "Rejected connection from {0}; mods do not match.", + Log.Write("server", "Rejected connection from {0}; mods do not match.", newConn.socket.RemoteEndPoint); - + SendOrderTo(newConn, "ServerError", "Your mods don't match the server"); DropClient(newConn); return; } - + // Promote connection to a valid client preConns.Remove(newConn); conns.Add(newConn); @@ -218,24 +218,24 @@ namespace OpenRA.Server // Enforce correct PlayerIndex and Slot client.Index = newConn.PlayerIndex; client.Slot = lobbyInfo.FirstEmptySlot(); - + if (client.Slot != null) SyncClientToPlayerReference(client, Map.Players[client.Slot]); - + lobbyInfo.Clients.Add(client); - + Log.Write("server", "Client {0}: Accepted connection from {1}", newConn.PlayerIndex, newConn.socket.RemoteEndPoint); - + foreach (var t in ServerTraits.WithInterface()) t.ClientJoined(this, newConn); - + SyncLobbyInfo(); SendChat(newConn, "has joined the game."); } catch (Exception) { DropClient(newConn); } } - + public static void SyncClientToPlayerReference(Session.Client c, PlayerReference pr) { if (pr == null) @@ -249,7 +249,7 @@ namespace OpenRA.Server if (pr.LockTeam) c.Team = pr.Team; } - + public void UpdateInFlightFrames(Connection conn) { if (conn.Frame == 0) @@ -307,7 +307,7 @@ namespace OpenRA.Server catch (EndOfStreamException) { } catch (NotImplementedException) { } } - + public void SendChatTo(Connection conn, string text) { SendOrderTo(conn, "Chat", text); @@ -318,7 +318,7 @@ namespace OpenRA.Server DispatchOrdersToClient(conn, 0, 0, new ServerOrder(order, data).Serialize()); } - + public void SendChat(Connection asConn, string text) { DispatchOrders(asConn, 0, new ServerOrder("Chat", text).Serialize()); @@ -338,16 +338,16 @@ namespace OpenRA.Server foreach (var t in ServerTraits.WithInterface()) if ((handled = t.InterpretCommand(this, conn, GetClient(conn), so.Data))) break; - + if (!handled) { Log.Write("server", "Unknown server command: {0}", so.Data); SendChatTo(conn, "Unknown server command: {0}".F(so.Data)); } - + break; case "HandshakeResponse": - ValidateClient(conn, so.Data); + ValidateClient(conn, so.Data); break; case "Chat": case "TeamChat": @@ -378,12 +378,12 @@ namespace OpenRA.Server SendDisconnected(toDrop); /* Report disconnection */ lobbyInfo.Clients.RemoveAll(c => c.Index == toDrop.PlayerIndex); - + DispatchOrders( toDrop, toDrop.MostRecentFrame, new byte[] { 0xbf } ); if (conns.Count != 0) SyncLobbyInfo(); - } + } try { @@ -401,7 +401,7 @@ namespace OpenRA.Server foreach (var t in ServerTraits.WithInterface()) t.LobbyInfoSynced(this); } - + public void StartGame() { GameStarted = true; @@ -412,7 +412,7 @@ namespace OpenRA.Server // Drop any unvalidated clients foreach (var c in preConns) DropClient(c); - + DispatchOrders(null, 0, new ServerOrder("StartGame", "").Serialize()); diff --git a/OpenRA.Game/Server/ServerOrder.cs b/OpenRA.Game/Server/ServerOrder.cs index 2fd6787def..cfe09f7e7f 100644 --- a/OpenRA.Game/Server/ServerOrder.cs +++ b/OpenRA.Game/Server/ServerOrder.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Server/TraitInterfaces.cs b/OpenRA.Game/Server/TraitInterfaces.cs index c6c89484d5..87be6475c9 100644 --- a/OpenRA.Game/Server/TraitInterfaces.cs +++ b/OpenRA.Game/Server/TraitInterfaces.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -11,8 +11,8 @@ using System; using OpenRA.Network; namespace OpenRA.Server -{ - // Returns true if order is handled +{ + // Returns true if order is handled public interface IInterpretCommand { bool InterpretCommand(Server server, Connection conn, Session.Client client, string cmd); } public interface INotifySyncLobbyInfo { void LobbyInfoSynced(Server server); } public interface INotifyServerStart { void ServerStarted(Server server); } @@ -24,32 +24,32 @@ namespace OpenRA.Server void Tick(Server server); int TickTimeout { get; } } - + public abstract class ServerTrait {} - + public class DebugServerTrait : ServerTrait, IInterpretCommand, IStartGame, INotifySyncLobbyInfo, INotifyServerStart, INotifyServerShutdown - { + { public bool InterpretCommand(Server server, Connection conn, Session.Client client, string cmd) { Console.WriteLine("Server received command from player {1}: {0}",cmd, conn.PlayerIndex); return false; } - + public void GameStarted(Server server) { Console.WriteLine("GameStarted()"); } - + public void LobbyInfoSynced(Server server) { Console.WriteLine("LobbyInfoSynced()"); } - + public void ServerStarted(Server server) { Console.WriteLine("ServerStarted()"); } - + public void ServerShutdown(Server server) { Console.WriteLine("ServerShutdown()"); diff --git a/OpenRA.Game/Sound.cs b/OpenRA.Game/Sound.cs index fc552aaba1..fbdbf1c892 100644 --- a/OpenRA.Game/Sound.cs +++ b/OpenRA.Game/Sound.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -41,7 +41,7 @@ namespace OpenRA { soundEngine = new OpenAlSoundEngine(); } - + public static void Initialize() { sounds = new Cache(LoadSound); @@ -70,7 +70,7 @@ namespace OpenRA public static ISound Play(string name, float2 pos, float volumeModifier) { return Play(null, name, false, pos, volumeModifier); } public static ISound PlayToPlayer(Player player, string name) { return Play( player, name, true, float2.Zero, 1); } public static ISound PlayToPlayer(Player player, string name, float2 pos) { return Play(player, name, false, pos, 1); } - + public static void PlayVideo(byte[] raw) { rawSource = LoadSoundRaw(raw); @@ -108,17 +108,17 @@ namespace OpenRA static Action OnMusicComplete; public static bool MusicPlaying { get; private set; } public static MusicInfo CurrentMusic { get { return currentMusic; } } - + public static void PlayMusic(MusicInfo m) { PlayMusicThen(m, () => { }); } - + public static void PlayMusicThen(MusicInfo m, Action then) { if (m == null || !m.Exists) return; - + OnMusicComplete = then; if (m == currentMusic && music != null) diff --git a/OpenRA.Game/Support/Arguments.cs b/OpenRA.Game/Support/Arguments.cs index f60bfa45f0..a11cb66f37 100644 --- a/OpenRA.Game/Support/Arguments.cs +++ b/OpenRA.Game/Support/Arguments.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Support/PerfHistory.cs b/OpenRA.Game/Support/PerfHistory.cs index 00610b9dd8..7b73647d37 100644 --- a/OpenRA.Game/Support/PerfHistory.cs +++ b/OpenRA.Game/Support/PerfHistory.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,15 +17,15 @@ namespace OpenRA.Support { public static class PerfHistory { - static readonly Color[] colors = { Color.Red, Color.Green, - Color.Orange, Color.Yellow, - Color.Fuchsia, Color.Lime, - Color.LightBlue, Color.Blue, + static readonly Color[] colors = { Color.Red, Color.Green, + Color.Orange, Color.Yellow, + Color.Fuchsia, Color.Lime, + Color.LightBlue, Color.Blue, Color.White, Color.Teal }; static int nextColor; public static Cache items = new Cache( - s => + s => { var x = new PerfItem(s, colors[nextColor++]); if (nextColor >= colors.Length) nextColor = 0; diff --git a/OpenRA.Game/Support/Program.cs b/OpenRA.Game/Support/Program.cs index c35b1b4a44..5e3468f06d 100644 --- a/OpenRA.Game/Support/Program.cs +++ b/OpenRA.Game/Support/Program.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs index b245898c81..783e9d2b7b 100755 --- a/OpenRA.Game/Sync.cs +++ b/OpenRA.Game/Sync.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/TraitDictionary.cs b/OpenRA.Game/TraitDictionary.cs index db372bacc2..162f24a2b0 100755 --- a/OpenRA.Game/TraitDictionary.cs +++ b/OpenRA.Game/TraitDictionary.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA { return traits.GetOrAdd( t, doCreateTraitContainer ); } - + public void PrintReport() { Log.AddChannel("traitreport", "traitreport.log"); @@ -97,7 +97,7 @@ namespace OpenRA { void Add( Actor actor, object trait ); void RemoveActor( uint actor ); - + int Queries { get; } } @@ -106,7 +106,7 @@ namespace OpenRA List actors = new List(); List traits = new List(); int queries; - + public int Queries { get { return queries; } } public void Add( Actor actor, object trait ) diff --git a/OpenRA.Game/Traits/Activities/Activity.cs b/OpenRA.Game/Traits/Activities/Activity.cs index 59b9693acc..9772e1c98e 100755 --- a/OpenRA.Game/Traits/Activities/Activity.cs +++ b/OpenRA.Game/Traits/Activities/Activity.cs @@ -25,13 +25,13 @@ namespace OpenRA.Traits.Activities else NextActivity = activity; } - + public virtual IEnumerable GetTargets( Actor self ) { yield break; } } - + public static class ActivityExts { public static IEnumerable GetTargetQueue( this Actor self ) diff --git a/OpenRA.Game/Traits/Armor.cs b/OpenRA.Game/Traits/Armor.cs index 47dafb752e..cf518b6e09 100644 --- a/OpenRA.Game/Traits/Armor.cs +++ b/OpenRA.Game/Traits/Armor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/DrawLineToTarget.cs b/OpenRA.Game/Traits/DrawLineToTarget.cs index d5ef371e1a..231fd1fdc3 100644 --- a/OpenRA.Game/Traits/DrawLineToTarget.cs +++ b/OpenRA.Game/Traits/DrawLineToTarget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -72,14 +72,14 @@ namespace OpenRA.Traits } } } - + public static class LineTargetExts { public static void SetTargetLine(this Actor self, Target target, Color color) { self.SetTargetLine(target, color, true); } - + public static void SetTargetLine(this Actor self, Target target, Color color, bool display) { if (self.Owner != self.World.LocalPlayer) @@ -90,10 +90,10 @@ namespace OpenRA.Traits if (self.Destroyed) return; if (target.IsActor && display) w.Add(new FlashTarget(target.Actor)); - + var line = self.TraitOrDefault(); if (line != null) - if (display) + if (display) line.SetTarget(self, target, color); else line.SetTargetSilently(self, target, color); diff --git a/OpenRA.Game/Traits/EditorAppearance.cs b/OpenRA.Game/Traits/EditorAppearance.cs index cfc65e87f0..755a63524a 100644 --- a/OpenRA.Game/Traits/EditorAppearance.cs +++ b/OpenRA.Game/Traits/EditorAppearance.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/EditorTilesetFilter.cs b/OpenRA.Game/Traits/EditorTilesetFilter.cs index ad91c9904f..85d7239b79 100644 --- a/OpenRA.Game/Traits/EditorTilesetFilter.cs +++ b/OpenRA.Game/Traits/EditorTilesetFilter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs index 928dea33ac..198383994e 100755 --- a/OpenRA.Game/Traits/Health.cs +++ b/OpenRA.Game/Traits/Health.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,16 +22,16 @@ namespace OpenRA.Traits } public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead }; - + public class Health : ISync, ITick { public readonly HealthInfo Info; - + [Sync] int hp; public int DisplayHp { get; private set; } - + public Health(ActorInitializer init, HealthInfo info) { Info = info; @@ -40,36 +40,36 @@ namespace OpenRA.Traits hp = init.Contains() ? (int)(init.Get() * MaxHP) : MaxHP; DisplayHp = hp; } - + public int HP { get { return hp; } } public readonly int MaxHP; - + public bool IsDead { get { return hp <= 0; } } public bool RemoveOnDeath = true; - + public DamageState DamageState { - get + get { if (hp <= 0) return DamageState.Dead; - + if (hp < MaxHP * 0.25f) return DamageState.Critical; - + if (hp < MaxHP * 0.5f) return DamageState.Heavy; - + if (hp < MaxHP * 0.75f) return DamageState.Medium; - + if (hp == MaxHP) return DamageState.Undamaged; - + return DamageState.Light; } } - + public void InflictDamage(Actor self, Actor attacker, int damage, WarheadInfo warhead, bool ignoreModifiers) { if (IsDead) return; /* overkill! don't count extra hits as more kills! */ @@ -93,30 +93,30 @@ namespace OpenRA.Traits PreviousDamageState = oldState, Warhead = warhead, }; - + foreach (var nd in self.TraitsImplementing() .Concat(self.Owner.PlayerActor.TraitsImplementing())) nd.Damaged(self, ai); - - + + if (DamageState != oldState) foreach (var nd in self.TraitsImplementing()) nd.DamageStateChanged(self, ai); - + if (attacker != null && attacker.IsInWorld && !attacker.IsDead()) foreach (var nd in attacker.TraitsImplementing() .Concat(attacker.Owner.PlayerActor.TraitsImplementing())) nd.AppliedDamage(attacker, self, ai); - + if (hp == 0) { attacker.Owner.Kills++; self.Owner.Deaths++; - + foreach (var nd in self.TraitsImplementing() .Concat(self.Owner.PlayerActor.TraitsImplementing())) nd.Killed(self, ai); - + if( RemoveOnDeath ) self.Destroy(); @@ -147,11 +147,11 @@ namespace OpenRA.Traits public static bool IsDead(this Actor self) { if (self.Destroyed) return true; - + var health = self.TraitOrDefault(); return (health == null) ? false : health.IsDead; } - + public static DamageState GetDamageState(this Actor self) { if (self.Destroyed) return DamageState.Dead; @@ -159,14 +159,14 @@ namespace OpenRA.Traits var health = self.TraitOrDefault(); return (health == null) ? DamageState.Undamaged : health.DamageState; } - + public static void InflictDamage(this Actor self, Actor attacker, int damage, WarheadInfo warhead) { var health = self.TraitOrDefault(); if (health == null) return; health.InflictDamage(self, attacker, damage, warhead, false); } - + public static void Kill(this Actor self, Actor attacker) { var health = self.TraitOrDefault(); diff --git a/OpenRA.Game/Traits/LintAttributes.cs b/OpenRA.Game/Traits/LintAttributes.cs index 0044db45b7..2989bd7b71 100644 --- a/OpenRA.Game/Traits/LintAttributes.cs +++ b/OpenRA.Game/Traits/LintAttributes.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/Player/DeveloperMode.cs b/OpenRA.Game/Traits/Player/DeveloperMode.cs index 8e0fa22d37..daa6820caf 100644 --- a/OpenRA.Game/Traits/Player/DeveloperMode.cs +++ b/OpenRA.Game/Traits/Player/DeveloperMode.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,10 +21,10 @@ namespace OpenRA.Traits public bool PathDebug = false; public bool UnlimitedPower; public bool BuildAnywhere; - + public object Create (ActorInitializer init) { return new DeveloperMode(this); } } - + public class DeveloperMode : IResolveOrder, ISync { DeveloperModeInfo Info; @@ -46,11 +46,11 @@ namespace OpenRA.Traits UnlimitedPower = info.UnlimitedPower; BuildAnywhere = info.BuildAnywhere; } - + public void ResolveOrder (Actor self, Order order) { if (!self.World.LobbyInfo.GlobalSettings.AllowCheats) return; - + switch(order.OrderString) { case "DevEnableTech": @@ -78,7 +78,7 @@ namespace OpenRA.Traits DisableShroud ^= true; if (self.World.LocalPlayer == self.Owner) self.World.LocalShroud.Disabled = DisableShroud; - break; + break; } case "DevPathDebug": { diff --git a/OpenRA.Game/Traits/Player/EvaAlerts.cs b/OpenRA.Game/Traits/Player/EvaAlerts.cs index 7f310df8e2..8b4f51d206 100644 --- a/OpenRA.Game/Traits/Player/EvaAlerts.cs +++ b/OpenRA.Game/Traits/Player/EvaAlerts.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,11 +18,11 @@ namespace OpenRA.Traits public readonly string CashTickUp = "cashup1.aud"; public readonly string CashTickDown = "cashdn1.aud"; - + // Build Palette public readonly string BuildingCannotPlaceAudio = "nodeply1.aud"; public readonly string NewOptions = "newopt1.aud"; - + // For manual powerup/down in ra-ng public readonly string DisablePower = "bleep11.aud"; public readonly string EnablePower = "bleep12.aud"; @@ -32,10 +32,10 @@ namespace OpenRA.Traits public readonly string LowPower = "lopower1.aud"; public readonly string SilosNeeded = "silond1.aud"; public readonly string PrimaryBuildingSelected = "pribldg1.aud"; - + // Special powers public readonly string AbilityInsufficientPower = "nopowr1.aud"; - + public readonly string LevelUp = "hydrod1.aud"; } diff --git a/OpenRA.Game/Traits/Player/PlayerResources.cs b/OpenRA.Game/Traits/Player/PlayerResources.cs index a5dac670ed..031cdc2fca 100644 --- a/OpenRA.Game/Traits/Player/PlayerResources.cs +++ b/OpenRA.Game/Traits/Player/PlayerResources.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,43 +21,43 @@ namespace OpenRA.Traits public object Create(ActorInitializer init) { return new PlayerResources(init.self, this); } } - + public class DebugResourceCashInfo : ITraitInfo, Requires { public object Create(ActorInitializer init) { return new DebugResourceCash(init.self); } } - + public class DebugResourceCash : ISync { readonly PlayerResources pr; public DebugResourceCash(Actor self) { pr = self.Trait(); } [Sync] public int foo { get { return pr.Cash; } } } - + public class DebugResourceOreInfo : ITraitInfo, Requires { public object Create(ActorInitializer init) { return new DebugResourceOre(init.self); } } - + public class DebugResourceOre : ISync { readonly PlayerResources pr; public DebugResourceOre(Actor self) { pr = self.Trait(); } [Sync] public int foo { get { return pr.Ore; } } } - + public class DebugResourceOreCapacityInfo : ITraitInfo { public object Create(ActorInitializer init) { return new DebugResourceOreCapacity(init.self); } } - + public class DebugResourceOreCapacity : ISync { readonly PlayerResources pr; public DebugResourceOreCapacity(Actor self) { pr = self.Trait(); } [Sync] public int foo { get { return pr.OreCapacity; } } } - + public class PlayerResources : ITick, ISync { readonly Player Owner; @@ -74,7 +74,7 @@ namespace OpenRA.Traits [Sync] public int Cash; - + [Sync] public int Ore; [Sync] @@ -91,39 +91,39 @@ namespace OpenRA.Traits public void GiveOre(int num) { Ore += num; - + if (Ore > OreCapacity) { nextSiloAdviceTime = 0; Ore = OreCapacity; } } - + public bool TakeOre(int num) { if (Ore < num) return false; Ore -= num; - + return true; } - + public void GiveCash(int num) { Cash += num; } - + public bool TakeCash(int num) - { + { if (Cash + Ore < num) return false; - + // Spend ore before cash Ore -= num; if (Ore < 0) { Cash += Ore; - Ore = 0; + Ore = 0; } - + return true; } @@ -138,23 +138,23 @@ namespace OpenRA.Traits OreCapacity = self.World.ActorsWithTrait() .Where(a => a.Actor.Owner == Owner) .Sum(a => a.Trait.Capacity); - + if (Ore > OreCapacity) Ore = OreCapacity; - + if (--nextSiloAdviceTime <= 0) { if (Ore > 0.8*OreCapacity) Owner.GiveAdvice(eva.SilosNeeded); - + nextSiloAdviceTime = AdviceInterval; } - + var diff = Math.Abs(Cash - DisplayCash); var move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame), displayCashDeltaPerFrame), diff); - + if (DisplayCash < Cash) { DisplayCash += move; @@ -165,7 +165,7 @@ namespace OpenRA.Traits DisplayCash -= move; Sound.PlayToPlayer(self.Owner, eva.CashTickDown); } - + diff = Math.Abs(Ore - DisplayOre); move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame), displayCashDeltaPerFrame), diff); diff --git a/OpenRA.Game/Traits/Render/RenderSimple.cs b/OpenRA.Game/Traits/Render/RenderSimple.cs index ab50dc8096..e9465ab1ff 100755 --- a/OpenRA.Game/Traits/Render/RenderSimple.cs +++ b/OpenRA.Game/Traits/Render/RenderSimple.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/RevealsShroud.cs b/OpenRA.Game/Traits/RevealsShroud.cs index bb6a5d52ff..b9f06c475f 100644 --- a/OpenRA.Game/Traits/RevealsShroud.cs +++ b/OpenRA.Game/Traits/RevealsShroud.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ namespace OpenRA.Traits { class RevealsShroudInfo : ITraitInfo { - public readonly int Range = 0; + public readonly int Range = 0; public object Create(ActorInitializer init) { return new RevealsShroud(this); } } @@ -20,14 +20,14 @@ namespace OpenRA.Traits { RevealsShroudInfo Info; int2 previousLocation; - + public RevealsShroud(RevealsShroudInfo info) { Info = info; } - + public void Tick(Actor self) - { + { // todo: don't tick all the time. if (previousLocation != self.Location) @@ -36,7 +36,7 @@ namespace OpenRA.Traits self.World.WorldActor.Trait().UpdateActor(self); } } - + public int RevealRange { get { return Info.Range; } } } } diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 394e3c6f08..99d8a7af32 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -48,7 +48,7 @@ namespace OpenRA.Traits public void DrawRollover(WorldRenderer wr, Actor self) { var bounds = self.Bounds.Value; - + var xy = new float2(bounds.Left, bounds.Top); var Xy = new float2(bounds.Right, bounds.Top); @@ -69,7 +69,7 @@ namespace OpenRA.Traits } } } - + void DrawSelectionBar(Actor self, float2 xy, float2 Xy, float value, Color barColor) { if (!self.IsInWorld) return; @@ -92,20 +92,20 @@ namespace OpenRA.Traits wlr.DrawLine(xy + new float2(0, -2), z + new float2(0, -2), barColor2, barColor2); wlr.DrawLine(xy + new float2(0, -4), z + new float2(0, -4), barColor2, barColor2); } - + void DrawHealthBar(Actor self, float2 xy, float2 Xy) { if (!self.IsInWorld) return; - + var health = self.TraitOrDefault(); if (health == null || health.IsDead) return; - + var c = Color.FromArgb(128, 30, 30, 30); var c2 = Color.FromArgb(128, 10, 10, 10); var healthColor = (health.DamageState == DamageState.Critical) ? Color.Red : (health.DamageState == DamageState.Heavy) ? Color.Yellow : Color.LimeGreen; - + var healthColor2 = Color.FromArgb( 255, healthColor.R / 2, @@ -113,7 +113,7 @@ namespace OpenRA.Traits healthColor.B / 2); var z = float2.Lerp(xy, Xy, (float)health.HP / health.MaxHP); - + var wlr = Game.Renderer.WorldLineRenderer; wlr.DrawLine(xy + new float2(0, -4), Xy + new float2(0, -4), c, c); wlr.DrawLine(xy + new float2(0, -3), Xy + new float2(0, -3), c2, c2); @@ -153,7 +153,7 @@ namespace OpenRA.Traits void DrawPips(WorldRenderer wr, Actor self, float2 basePosition) { if (self.Owner != self.World.LocalPlayer) return; - + var pipSources = self.TraitsImplementing(); if (pipSources.Count() == 0) return; @@ -170,7 +170,7 @@ namespace OpenRA.Traits var thisRow = pips.GetPips(self); if (thisRow == null) continue; - + var width = self.Bounds.Value.Width; foreach (var pip in thisRow) @@ -190,11 +190,11 @@ namespace OpenRA.Traits pipxyOffset.Y -= pipSize.Y + 1; } } - + void DrawTags(WorldRenderer wr, Actor self, float2 basePosition) { if (self.Owner != self.World.LocalPlayer) return; - + // If a mod wants to implement a unit with multiple tags, then they are placed on multiple rows var tagxyBase = basePosition + new float2(-16, 2); // Correct for the offset in the shp file var tagxyOffset = new float2(0, 0); // Correct for offset due to multiple rows @@ -205,17 +205,17 @@ namespace OpenRA.Traits { if (tag == TagType.None) continue; - + var tagImages = new Animation("pips"); tagImages.PlayRepeating(tagStrings[(int)tag]); tagImages.Image.DrawAt(wr, tagxyBase + tagxyOffset, "chrome"); - + // Increment row tagxyOffset.Y += 8; } } } - + void DrawUnitPath(Actor self) { if (self.World.LocalPlayer == null ||!self.World.LocalPlayer.PlayerActor.Trait().PathDebug) return; @@ -243,6 +243,6 @@ namespace OpenRA.Traits } } } - + } } diff --git a/OpenRA.Game/Traits/SubcellInit.cs b/OpenRA.Game/Traits/SubcellInit.cs index 95ff4671ba..bd9241a987 100644 --- a/OpenRA.Game/Traits/SubcellInit.cs +++ b/OpenRA.Game/Traits/SubcellInit.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs index 9de36a3f75..c7b4f1578e 100644 --- a/OpenRA.Game/Traits/Target.cs +++ b/OpenRA.Game/Traits/Target.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -13,7 +13,7 @@ namespace OpenRA.Traits public struct Target // a target: either an actor, or a fixed location. { public static Target[] NoTargets = {}; - + Actor actor; Player owner; int2 pos; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 1462962eb3..a652fbed8c 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/Util.cs b/OpenRA.Game/Traits/Util.cs index 6a05b6a0a4..0d9ff18e76 100755 --- a/OpenRA.Game/Traits/Util.cs +++ b/OpenRA.Game/Traits/Util.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -81,7 +81,7 @@ namespace OpenRA.Traits (cosAngle * v.X + sinAngle * v.Y), ecc * (cosAngle * v.Y - sinAngle * v.X)); } - + public static int2 CenterOfCell(int2 loc) { return new int2( Game.CellSize / 2, Game.CellSize / 2 ) + Game.CellSize * loc; @@ -135,7 +135,7 @@ namespace OpenRA.Traits items.Remove(t); } } - + static IEnumerable Neighbours(int2 c, bool allowDiagonal) { yield return c; @@ -174,7 +174,7 @@ namespace OpenRA.Traits } static int2[] fvecs = - { + { new int2( 0, -1331 ), new int2( -199, -1305 ), new int2( -391, -1229 ), @@ -208,9 +208,9 @@ namespace OpenRA.Traits new int2( 391, -1229 ), new int2( 199, -1305 ) }; - - - public static readonly int2[] SubPxVector = + + + public static readonly int2[] SubPxVector = { new int2( 0, 1024 ), new int2( 25, 1023 ), diff --git a/OpenRA.Game/Traits/ValidateOrder.cs b/OpenRA.Game/Traits/ValidateOrder.cs index 5016d1f31c..595a3a22d0 100644 --- a/OpenRA.Game/Traits/ValidateOrder.cs +++ b/OpenRA.Game/Traits/ValidateOrder.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Traits public class ValidateOrder : IValidateOrder { public bool OrderValidation(OrderManager orderManager, World world, int clientId, Order order) - { + { if (order.Subject == null || order.Subject.Owner == null) return true; diff --git a/OpenRA.Game/Traits/Waypoint.cs b/OpenRA.Game/Traits/Waypoint.cs index 7d49461ca8..04d4ffcef7 100644 --- a/OpenRA.Game/Traits/Waypoint.cs +++ b/OpenRA.Game/Traits/Waypoint.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -14,7 +14,7 @@ using OpenRA.FileFormats; namespace OpenRA.Traits { class WaypointInfo : ITraitInfo - { + { public object Create( ActorInitializer init ) { return new Waypoint( init ); } } diff --git a/OpenRA.Game/Traits/World/Country.cs b/OpenRA.Game/Traits/World/Country.cs index 5f4777d167..0812aeae4a 100644 --- a/OpenRA.Game/Traits/World/Country.cs +++ b/OpenRA.Game/Traits/World/Country.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Traits/World/PlayerColorPalette.cs b/OpenRA.Game/Traits/World/PlayerColorPalette.cs index 4a7fd863ff..8ac20d4daf 100644 --- a/OpenRA.Game/Traits/World/PlayerColorPalette.cs +++ b/OpenRA.Game/Traits/World/PlayerColorPalette.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using OpenRA.FileFormats; using OpenRA.Graphics; namespace OpenRA.Traits -{ +{ public class PlayerColorPaletteInfo : ITraitInfo { public readonly string BasePalette = null; diff --git a/OpenRA.Game/Traits/World/ResourceLayer.cs b/OpenRA.Game/Traits/World/ResourceLayer.cs index d3c508a3d4..1d57707eb3 100644 --- a/OpenRA.Game/Traits/World/ResourceLayer.cs +++ b/OpenRA.Game/Traits/World/ResourceLayer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,9 +23,9 @@ namespace OpenRA.Traits public ResourceType[] resourceTypes; CellContents[,] content; - + bool hasSetupPalettes; - + public void Render( WorldRenderer wr ) { if (!hasSetupPalettes) @@ -128,9 +128,9 @@ namespace OpenRA.Traits return; content[i, j].density = Math.Min( - content[i, j].image.Length - 1, + content[i, j].image.Length - 1, content[i, j].density + n); - + world.Map.CustomTerrain[i,j] = t.info.TerrainType; } diff --git a/OpenRA.Game/Traits/World/ResourceType.cs b/OpenRA.Game/Traits/World/ResourceType.cs index 008cf1db19..499d7fa064 100644 --- a/OpenRA.Game/Traits/World/ResourceType.cs +++ b/OpenRA.Game/Traits/World/ResourceType.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Traits public int PaletteIndex; public PipType PipColor = PipType.Yellow; - + public object Create(ActorInitializer init) { return new ResourceType(this); } } diff --git a/OpenRA.Game/Traits/World/ScreenShaker.cs b/OpenRA.Game/Traits/World/ScreenShaker.cs index 23ba50ffc4..7b9b463a86 100644 --- a/OpenRA.Game/Traits/World/ScreenShaker.cs +++ b/OpenRA.Game/Traits/World/ScreenShaker.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -15,12 +15,12 @@ using System.Linq; namespace OpenRA.Traits { class ScreenShakerInfo : TraitInfo {} - + public class ScreenShaker : ITick { int ticks = 0; List shakeEffects = new List(); - + public void Tick (Actor self) { if(shakeEffects.Any()) @@ -30,29 +30,29 @@ namespace OpenRA.Traits } ticks++; } - + public void AddEffect(int time, float2 position, int intensity) { shakeEffects.Add(new ShakeEffect { ExpiryTime = ticks + time, Position = position, Intensity = intensity }); } - + float2 GetScrollOffset() { int xFreq = 4; int yFreq = 5; - - return GetIntensity() * new float2( - (float) Math.Sin((ticks*2*Math.PI)/xFreq) , + + return GetIntensity() * new float2( + (float) Math.Sin((ticks*2*Math.PI)/xFreq) , (float) Math.Cos((ticks*2*Math.PI)/yFreq)); } - + float GetIntensity() { var cp = Game.viewport.CenterLocation; var intensity = Game.CellSize * Game.CellSize * 100 * shakeEffects.Sum( e => e.Intensity / (e.Position - cp).LengthSquared); - return Math.Min(intensity, 10); + return Math.Min(intensity, 10); } } diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs index dccc25259d..b6cda0c869 100644 --- a/OpenRA.Game/Traits/World/Shroud.cs +++ b/OpenRA.Game/Traits/World/Shroud.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Traits { Map map; World world; - + public int[,] visibleCells; public bool[,] exploredCells; Rectangle? exploredBounds; @@ -34,12 +34,12 @@ namespace OpenRA.Traits get { return disabled || world.LocalPlayer == null; } set { disabled = value; Dirty(); } } - + public Rectangle? Bounds { get { return Disabled ? null : exploredBounds; } } - + public event Action Dirty = () => { }; public Shroud(World world) @@ -76,8 +76,8 @@ namespace OpenRA.Traits { if (!a.HasTrait()) return; - - if (a.Owner == null || a.Owner.World.LocalPlayer == null + + if (a.Owner == null || a.Owner.World.LocalPlayer == null || a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return; if (vis.ContainsKey(a)) @@ -111,12 +111,12 @@ namespace OpenRA.Traits if (!Disabled) Dirty(); } - + public void UpdatePlayerStance(World w, Player player, Stance oldStance, Stance newStance) { if (oldStance == newStance) return; - + // No longer our ally; remove unit vis if (oldStance == Stance.Ally) { @@ -152,14 +152,14 @@ namespace OpenRA.Traits --visibleCells[q.X, q.Y]; vis.Remove(a); - + if (!Disabled) Dirty(); } public void UpdateActor(Actor a) { - if (a.Owner == null || a.Owner.World.LocalPlayer == null + if (a.Owner == null || a.Owner.World.LocalPlayer == null || a.Owner.Stances[a.Owner.World.LocalPlayer] != Stance.Ally) return; RemoveActor(a); AddActor(a); @@ -176,7 +176,7 @@ namespace OpenRA.Traits if (!Disabled) Dirty(); } - + public void ExploreAll(World world) { for (int i = map.Bounds.Left; i < map.Bounds.Right; i++) @@ -197,16 +197,16 @@ namespace OpenRA.Traits if (!Disabled) Dirty(); } - + public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); } public bool IsExplored(int x, int y) { if (!map.IsInMap(x, y)) return false; - + if (Disabled) return true; - + return exploredCells[x,y]; } @@ -215,7 +215,7 @@ namespace OpenRA.Traits { if (Disabled) return true; - + // Visibility is allowed to extend beyond the map cordon so that // the fog tiles are not visible at the edge of the world if (x < 0 || x >= map.MapSize.X || y < 0 || y >= map.MapSize.Y) @@ -223,13 +223,13 @@ namespace OpenRA.Traits return visibleCells[x,y] != 0; } - + // Actors are hidden under shroud, but not under fog by default public bool IsVisible(Actor a) { if (a.TraitsImplementing().Any(t => !t.IsVisible(a))) return false; - + return Disabled || a.Owner == a.World.LocalPlayer || GetVisOrigins(a).Any(o => IsExplored(o)); } } diff --git a/OpenRA.Game/Traits/World/SpatialBins.cs b/OpenRA.Game/Traits/World/SpatialBins.cs index 1739930adb..c6a72ef2a9 100644 --- a/OpenRA.Game/Traits/World/SpatialBins.cs +++ b/OpenRA.Game/Traits/World/SpatialBins.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -58,7 +58,7 @@ namespace OpenRA.Traits var i2 = Math.Min(bins.GetUpperBound(0), bounds.Right / scale); var j1 = Math.Max(0, bounds.Top / scale); var j2 = Math.Min(bins.GetUpperBound(1), bounds.Bottom / scale); - + for (var j = j1; j <= j2; j++) for (var i = i1; i <= i2; i++) bins[i, j].Add(a.Actor); diff --git a/OpenRA.Game/Widgets/BackgroundWidget.cs b/OpenRA.Game/Widgets/BackgroundWidget.cs index da6d30c141..fb6ee8cd94 100644 --- a/OpenRA.Game/Widgets/BackgroundWidget.cs +++ b/OpenRA.Game/Widgets/BackgroundWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,14 +19,14 @@ namespace OpenRA.Widgets { WidgetUtils.DrawPanel(Background, RenderBounds); } - + public BackgroundWidget() : base() { } public override bool HandleMouseInput(MouseInput mi) { return !ClickThrough; } - + protected BackgroundWidget(BackgroundWidget other) : base(other) { diff --git a/OpenRA.Game/Widgets/ButtonWidget.cs b/OpenRA.Game/Widgets/ButtonWidget.cs index 25042782d0..5afec343ae 100644 --- a/OpenRA.Game/Widgets/ButtonWidget.cs +++ b/OpenRA.Game/Widgets/ButtonWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.Widgets // Equivalent to OnMouseUp, but without an input arg public Action OnClick = () => {}; public Action OnKeyPress = _ => {}; - + public ButtonWidget() : base() { @@ -60,12 +60,12 @@ namespace OpenRA.Widgets Depressed = false; return base.LoseFocus(mi); } - + public override bool HandleKeyPress(KeyInput e) { if (e.KeyName != Key || e.Event != KeyInputEvent.Down) return false; - + if (!IsDisabled()) { OnKeyPress(e); @@ -76,12 +76,12 @@ namespace OpenRA.Widgets return true; } - + public override bool HandleMouseInput(MouseInput mi) { if (mi.Button != MouseButton.Left) return false; - + if (mi.Event == MouseInputEvent.Down && !TakeFocus(mi)) return false; @@ -91,7 +91,7 @@ namespace OpenRA.Widgets { if (Depressed && !disabled) OnMouseUp(mi); - + return LoseFocus(mi); } if (mi.Event == MouseInputEvent.Down) @@ -115,19 +115,19 @@ namespace OpenRA.Widgets return Depressed; } - public override int2 ChildOrigin { get { return RenderOrigin + + public override int2 ChildOrigin { get { return RenderOrigin + ((Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0)); } } public override void Draw() { var rb = RenderBounds; var disabled = IsDisabled(); - + var font = Game.Renderer.Fonts[Font]; var text = GetText(); var s = font.Measure(text); var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); - + DrawBackground(rb, disabled, Depressed, Widget.MouseOverWidget == this); font.DrawText(text, new int2(rb.X + (UsableWidth - s.X)/ 2, rb.Y + (Bounds.Height - s.Y) / 2) + stateOffset, disabled ? Color.Gray : Color.White); @@ -143,11 +143,11 @@ namespace OpenRA.Widgets public static void DrawBackground(string baseName, Rectangle rect, bool disabled, bool pressed, bool hover) { - var state = disabled ? "-disabled" : - pressed ? "-pressed" : - hover ? "-hover" : + var state = disabled ? "-disabled" : + pressed ? "-pressed" : + hover ? "-hover" : ""; - + WidgetUtils.DrawPanel(baseName + state, rect); } } diff --git a/OpenRA.Game/Widgets/ChatDisplayWidget.cs b/OpenRA.Game/Widgets/ChatDisplayWidget.cs index 4e3baa89f8..bf9984a4a0 100644 --- a/OpenRA.Game/Widgets/ChatDisplayWidget.cs +++ b/OpenRA.Game/Widgets/ChatDisplayWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Widgets { public readonly int RemoveTime = 0; public readonly bool UseContrast = false; - + const int logLength = 9; public string Notification = ""; public bool DrawBackground = true; @@ -54,11 +54,11 @@ namespace OpenRA.Widgets var owner = line.Owner + ":"; inset = font.Measure(owner).X + 10; - font.DrawTextWithContrast(owner, chatpos, + font.DrawTextWithContrast(owner, chatpos, line.Color, Color.Black, UseContrast ? 1 : 0); } - font.DrawTextWithContrast(line.Text, chatpos + new int2(inset, 0), + font.DrawTextWithContrast(line.Text, chatpos + new int2(inset, 0), Color.White, Color.Black, UseContrast ? 1 : 0); } @@ -78,12 +78,12 @@ namespace OpenRA.Widgets public void RemoveLine() { - if (recentLines.Count > 0) recentLines.RemoveAt(0); + if (recentLines.Count > 0) recentLines.RemoveAt(0); } public void ClearChat() { - recentLines = new List(); + recentLines = new List(); } public override void Tick() diff --git a/OpenRA.Game/Widgets/ChatEntryWidget.cs b/OpenRA.Game/Widgets/ChatEntryWidget.cs index d085bcfb7e..a6b986df10 100755 --- a/OpenRA.Game/Widgets/ChatEntryWidget.cs +++ b/OpenRA.Game/Widgets/ChatEntryWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -53,7 +53,7 @@ namespace OpenRA.Widgets public override bool HandleKeyPress(KeyInput e) { if (e.Event == KeyInputEvent.Up) return false; - + if (e.KeyName == "return" || e.KeyName == "enter" ) { if (composing) diff --git a/OpenRA.Game/Widgets/CheckboxWidget.cs b/OpenRA.Game/Widgets/CheckboxWidget.cs index 2c7e4b3e21..ec41719129 100644 --- a/OpenRA.Game/Widgets/CheckboxWidget.cs +++ b/OpenRA.Game/Widgets/CheckboxWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -47,13 +47,13 @@ namespace OpenRA.Widgets var font = Game.Renderer.Fonts[Font]; var rect = RenderBounds; var check = new Rectangle(rect.Location, new Size(Bounds.Height, Bounds.Height)); - var state = disabled ? "checkbox-disabled" : - Depressed && HasPressedState ? "checkbox-pressed" : - Widget.MouseOverWidget == this ? "checkbox-hover" : + var state = disabled ? "checkbox-disabled" : + Depressed && HasPressedState ? "checkbox-pressed" : + Widget.MouseOverWidget == this ? "checkbox-hover" : "checkbox"; - + WidgetUtils.DrawPanel(state, check); - + var textSize = font.Measure(Text); font.DrawText(Text, new float2(rect.Left + rect.Height * 1.5f, RenderOrigin.Y - BaseLine + (Bounds.Height - textSize.Y)/2), Color.White); diff --git a/OpenRA.Game/Widgets/ChromeMetrics.cs b/OpenRA.Game/Widgets/ChromeMetrics.cs index 5cd98ef9a7..67bbc93916 100644 --- a/OpenRA.Game/Widgets/ChromeMetrics.cs +++ b/OpenRA.Game/Widgets/ChromeMetrics.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Widgets static class ChromeMetrics { static Dictionary data = new Dictionary(); - + public static void Initialize(string[] yaml) { data = new Dictionary(); diff --git a/OpenRA.Game/Widgets/ColorBlockWidget.cs b/OpenRA.Game/Widgets/ColorBlockWidget.cs index c6bcbccf49..4a1c64e2f2 100644 --- a/OpenRA.Game/Widgets/ColorBlockWidget.cs +++ b/OpenRA.Game/Widgets/ColorBlockWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Widgets/DropDownButtonWidget.cs b/OpenRA.Game/Widgets/DropDownButtonWidget.cs index b9c11b1012..96282fcd90 100644 --- a/OpenRA.Game/Widgets/DropDownButtonWidget.cs +++ b/OpenRA.Game/Widgets/DropDownButtonWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Widgets { Widget panel; MaskWidget fullscreenMask; - + public DropDownButtonWidget() : base() { @@ -34,12 +34,12 @@ namespace OpenRA.Widgets { base.Draw(); var stateOffset = (Depressed) ? new int2(VisualHeight, VisualHeight) : new int2(0, 0); - + var image = ChromeProvider.GetImage("scrollbar", IsDisabled() ? "down_pressed" : "down_arrow"); var rb = RenderBounds; - + WidgetUtils.DrawRGBA( image, - stateOffset + new float2( rb.Right - rb.Height + 4, + stateOffset + new float2( rb.Right - rb.Height + 4, rb.Top + (rb.Height - image.bounds.Height) / 2 )); WidgetUtils.FillRectWithColor(new Rectangle(stateOffset.X + rb.Right - rb.Height, @@ -48,9 +48,9 @@ namespace OpenRA.Widgets } public override Widget Clone() { return new DropDownButtonWidget(this); } - + // This is crap - public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */ + public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */ public override void Removed() { @@ -73,7 +73,7 @@ namespace OpenRA.Widgets if (panel != null) throw new InvalidOperationException("Attempted to attach a panel to an open dropdown"); panel = p; - + // Mask to prevent any clicks from being sent to other widgets fullscreenMask = new MaskWidget(); fullscreenMask.Bounds = new Rectangle(0, 0, Game.viewport.Width, Game.viewport.Height); @@ -84,26 +84,26 @@ namespace OpenRA.Widgets panel.Bounds = new Rectangle(RenderOrigin.X, RenderOrigin.Y + Bounds.Height, oldBounds.Width, oldBounds.Height); Widget.RootWidget.AddChild(panel); } - + public void ShowDropDown(string panelTemplate, int height, List options, Func setupItem) { var substitutions = new Dictionary() {{ "DROPDOWN_WIDTH", Bounds.Width }}; var panel = (ScrollPanelWidget)Widget.LoadWidget(panelTemplate, null, new WidgetArgs() {{ "substitutions", substitutions }}); - + var itemTemplate = panel.GetWidget("TEMPLATE"); panel.RemoveChildren(); foreach (var option in options) { var o = option; - + ScrollItemWidget item = setupItem(o, itemTemplate); var onClick = item.OnClick; item.OnClick = () => { onClick(); RemovePanel(); }; - + panel.AddChild(item); } - + panel.Bounds.Height = Math.Min(height, panel.ContentHeight); AttachPanel(panel); } diff --git a/OpenRA.Game/Widgets/ImageWidget.cs b/OpenRA.Game/Widgets/ImageWidget.cs index 594beb69a4..f9f323b3de 100644 --- a/OpenRA.Game/Widgets/ImageWidget.cs +++ b/OpenRA.Game/Widgets/ImageWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,7 +43,7 @@ namespace OpenRA.Widgets var name = GetImageName(); var collection = GetImageCollection(); WidgetUtils.DrawRGBA( - ChromeProvider.GetImage(collection, name), + ChromeProvider.GetImage(collection, name), RenderOrigin); } } diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 8377557bd8..7257b70972 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Widgets public Func GetText; public Func GetColor; public Func GetContrastColor; - + public LabelWidget() : base() { @@ -59,16 +59,16 @@ namespace OpenRA.Widgets var text = GetText(); if (text == null) return; - + int2 textSize = font.Measure(text); int2 position = RenderOrigin; if (VAlign == TextVAlign.Middle) position += new int2(0, (Bounds.Height - textSize.Y)/2); - + if (VAlign == TextVAlign.Bottom) position += new int2(0, Bounds.Height - textSize.Y); - + if (Align == TextAlign.Center) position += new int2((Bounds.Width - textSize.X)/2, 0); diff --git a/OpenRA.Game/Widgets/MapPreviewWidget.cs b/OpenRA.Game/Widgets/MapPreviewWidget.cs index 8d026c8d6f..a28a1f57b5 100644 --- a/OpenRA.Game/Widgets/MapPreviewWidget.cs +++ b/OpenRA.Game/Widgets/MapPreviewWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Widgets public Action OnMouseDown = _ => {}; Cache PreviewCache = new Cache(stub => Minimap.RenderMapPreview( new Map( stub.Path ))); - + public MapPreviewWidget() : base() { } protected MapPreviewWidget(MapPreviewWidget other) : base(other) @@ -47,7 +47,7 @@ namespace OpenRA.Widgets { return new int2(MapRect.X + (int)(PreviewScale*(point.X - map.Bounds.Left)) , MapRect.Y + (int)(PreviewScale*(point.Y - map.Bounds.Top))); } - + Sheet mapChooserSheet; Sprite mapChooserSprite; Map lastMap; @@ -58,7 +58,7 @@ namespace OpenRA.Widgets { var map = Map(); if( map == null ) return; - + if (lastMap != map) { lastMap = map; @@ -70,7 +70,7 @@ namespace OpenRA.Widgets mapChooserSheet.Texture.SetData( preview ); mapChooserSprite = new Sprite( mapChooserSheet, new Rectangle( 0, 0, map.Bounds.Width, map.Bounds.Height ), TextureChannel.Alpha ); - + // Update map rect PreviewScale = Math.Min(RenderBounds.Width * 1.0f / map.Bounds.Width, RenderBounds.Height * 1.0f / map.Bounds.Height); var size = Math.Max(map.Bounds.Width, map.Bounds.Height); @@ -94,7 +94,7 @@ namespace OpenRA.Widgets if (owned) WidgetUtils.FillRectWithColor(new Rectangle(pos.X + offset.X + 2, pos.Y + offset.Y + 2, 12, 12), colors[p]); - + Game.Renderer.RgbaSpriteRenderer.DrawSprite(sprite, pos + offset); } } diff --git a/OpenRA.Game/Widgets/PasswordFieldWidget.cs b/OpenRA.Game/Widgets/PasswordFieldWidget.cs index b6c7468520..1e180945dc 100644 --- a/OpenRA.Game/Widgets/PasswordFieldWidget.cs +++ b/OpenRA.Game/Widgets/PasswordFieldWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Widgets/PerfGraphWidget.cs b/OpenRA.Game/Widgets/PerfGraphWidget.cs index f8da28c6e3..248c4c92a4 100644 --- a/OpenRA.Game/Widgets/PerfGraphWidget.cs +++ b/OpenRA.Game/Widgets/PerfGraphWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Widgets/ProgressBarWidget.cs b/OpenRA.Game/Widgets/ProgressBarWidget.cs index cde32cc8ea..8114476131 100644 --- a/OpenRA.Game/Widgets/ProgressBarWidget.cs +++ b/OpenRA.Game/Widgets/ProgressBarWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ namespace OpenRA.Widgets { public int Percentage = 0; public bool Indeterminate = false; - + // Indeterminant bar properties float offset = 0f; float tickStep = 0.04f; @@ -28,20 +28,20 @@ namespace OpenRA.Widgets { Percentage = widget.Percentage; } - + public override void Draw() { var rb = RenderBounds; WidgetUtils.DrawPanel("progressbar-bg", rb); - - Rectangle barRect = Indeterminate ? - new Rectangle(rb.X + 2 + (int)(0.75*offset*(rb.Width - 4)), rb.Y + 2, (rb.Width - 4) / 4, rb.Height - 4) : + + Rectangle barRect = Indeterminate ? + new Rectangle(rb.X + 2 + (int)(0.75*offset*(rb.Width - 4)), rb.Y + 2, (rb.Width - 4) / 4, rb.Height - 4) : new Rectangle(rb.X + 2, rb.Y + 2, Percentage * (rb.Width - 4) / 100, rb.Height - 4); - + if (barRect.Width > 0) WidgetUtils.DrawPanel("progressbar-thumb", barRect); } - + public override void Tick() { if (Indeterminate) @@ -52,13 +52,13 @@ namespace OpenRA.Widgets tickStep *= -1; } } - + public void SetIndeterminate(bool value) { Indeterminate = value; offset = 0f; } - + public override Widget Clone() { return new ProgressBarWidget(this); } } } \ No newline at end of file diff --git a/OpenRA.Game/Widgets/ScrollItem.cs b/OpenRA.Game/Widgets/ScrollItem.cs index 71cf418544..6860bc770e 100644 --- a/OpenRA.Game/Widgets/ScrollItem.cs +++ b/OpenRA.Game/Widgets/ScrollItem.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -15,7 +15,7 @@ using OpenRA.Graphics; namespace OpenRA.Widgets { public class ScrollItemWidget : ButtonWidget - { + { public ScrollItemWidget() : base() { @@ -23,7 +23,7 @@ namespace OpenRA.Widgets VisualHeight = 0; IgnoreChildMouseOver = true; } - + protected ScrollItemWidget(ScrollItemWidget other) : base(other) { @@ -31,21 +31,21 @@ namespace OpenRA.Widgets VisualHeight = 0; IgnoreChildMouseOver = true; } - + public Func IsSelected = () => false; public override void Draw() { - var state = IsSelected() ? "scrollitem-selected" : - Widget.MouseOverWidget == this ? "scrollitem-hover" : + var state = IsSelected() ? "scrollitem-selected" : + Widget.MouseOverWidget == this ? "scrollitem-hover" : null; - + if (state != null) WidgetUtils.DrawPanel(state, RenderBounds); } - + public override Widget Clone() { return new ScrollItemWidget(this); } - + public static ScrollItemWidget Setup(ScrollItemWidget template, Func isSelected, Action onClick) { var w = template.Clone() as ScrollItemWidget; diff --git a/OpenRA.Game/Widgets/ScrollPanelWidget.cs b/OpenRA.Game/Widgets/ScrollPanelWidget.cs index 788cbe4c27..88bc6d1fbd 100644 --- a/OpenRA.Game/Widgets/ScrollPanelWidget.cs +++ b/OpenRA.Game/Widgets/ScrollPanelWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ namespace OpenRA.Widgets public class ScrollPanelWidget : Widget { public int ScrollbarWidth = 24; - public float ScrollVelocity = 4f; + public float ScrollVelocity = 4f; public int ItemSpacing = 2; public int ButtonDepth = ChromeMetrics.Get("ButtonDepth"); public string Background = "scrollpanel-bg"; @@ -31,45 +31,45 @@ namespace OpenRA.Widgets protected Rectangle backgroundRect; protected Rectangle scrollbarRect; protected Rectangle thumbRect; - + public ScrollPanelWidget() : base() {} protected ScrollPanelWidget(ScrollPanelWidget other) : base(other) { throw new NotImplementedException(); } - + public override void RemoveChildren() { ContentHeight = 0; base.RemoveChildren(); } - + public override void AddChild(Widget child) { // Initial setup of margins/height if (Children.Count == 0) ContentHeight = ItemSpacing; - + child.Bounds.Y += ContentHeight; ContentHeight += child.Bounds.Height + ItemSpacing; base.AddChild(child); } - + public override void DrawOuter() { if (!IsVisible()) return; - + var rb = RenderBounds; - + var ScrollbarHeight = rb.Height - 2 * ScrollbarWidth; - + var thumbHeight = ContentHeight == 0 ? 0 : (int)(ScrollbarHeight*Math.Min(rb.Height*1f/ContentHeight, 1f)); var thumbOrigin = rb.Y + ScrollbarWidth + (int)((ScrollbarHeight - thumbHeight)*(-1f*ListOffset/(ContentHeight - rb.Height))); if (thumbHeight == ScrollbarHeight) thumbHeight = 0; - + backgroundRect = new Rectangle(rb.X, rb.Y, rb.Width - ScrollbarWidth+1, rb.Height); upButtonRect = new Rectangle(rb.Right - ScrollbarWidth, rb.Y, ScrollbarWidth, ScrollbarWidth); downButtonRect = new Rectangle(rb.Right - ScrollbarWidth, rb.Bottom - ScrollbarWidth, ScrollbarWidth, ScrollbarWidth); @@ -87,13 +87,13 @@ namespace OpenRA.Widgets WidgetUtils.DrawPanel("scrollpanel-bg", scrollbarRect); ButtonWidget.DrawBackground("button", upButtonRect, upDisabled, UpPressed, upHover); ButtonWidget.DrawBackground("button", downButtonRect, downDisabled, DownPressed, downHover); - + if (thumbHeight > 0) ButtonWidget.DrawBackground("scrollthumb", thumbRect, false, Focused && thumbHover, thumbHover); - + var upOffset = !UpPressed || upDisabled ? 4 : 4 + ButtonDepth; var downOffset = !DownPressed || downDisabled ? 4 : 4 + ButtonDepth; - + WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", UpPressed || upDisabled ? "up_pressed" : "up_arrow"), new float2(upButtonRect.Left + upOffset, upButtonRect.Top + upOffset)); WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", DownPressed || downDisabled ? "down_pressed" : "down_arrow"), @@ -113,66 +113,66 @@ namespace OpenRA.Widgets { return EventBounds; } - + void Scroll(int direction) { ListOffset += direction*ScrollVelocity; ListOffset = Math.Min(0,Math.Max(Bounds.Height - ContentHeight, ListOffset)); } - + public void ScrollToBottom() { ListOffset = Math.Min(0,Bounds.Height - ContentHeight); } - + public override void Tick () { if (UpPressed) Scroll(1); if (DownPressed) Scroll(-1); } - + public override bool LoseFocus (MouseInput mi) { UpPressed = DownPressed = ThumbPressed = false; return base.LoseFocus(mi); } - + int2 lastMouseLocation; public override bool HandleMouseInput(MouseInput mi) - { + { if (mi.Button == MouseButton.WheelDown) { Scroll(-1); return true; } - + if (mi.Button == MouseButton.WheelUp) { Scroll(1); return true; } - + if (mi.Button != MouseButton.Left) return false; - + if (mi.Event == MouseInputEvent.Down && !TakeFocus(mi)) return false; - + if (!Focused) return false; if (Focused && mi.Event == MouseInputEvent.Up) return LoseFocus(mi); - + if (ThumbPressed && mi.Event == MouseInputEvent.Move) - { + { var rb = RenderBounds; var ScrollbarHeight = rb.Height - 2 * ScrollbarWidth; var thumbHeight = ContentHeight == 0 ? 0 : (int)(ScrollbarHeight*Math.Min(rb.Height*1f/ContentHeight, 1f)); var oldOffset = ListOffset; ListOffset += (int)((lastMouseLocation.Y - mi.Location.Y)*(ContentHeight - rb.Height)*1f/(ScrollbarHeight - thumbHeight)); ListOffset = Math.Min(0,Math.Max(rb.Height - ContentHeight, ListOffset)); - + if (oldOffset != ListOffset) lastMouseLocation = mi.Location; } @@ -184,7 +184,7 @@ namespace OpenRA.Widgets if (ThumbPressed) lastMouseLocation = mi.Location; } - + return (UpPressed || DownPressed || ThumbPressed); } diff --git a/OpenRA.Game/Widgets/ShpImageWidget.cs b/OpenRA.Game/Widgets/ShpImageWidget.cs index 3f4818acb0..36d4cb8ac4 100644 --- a/OpenRA.Game/Widgets/ShpImageWidget.cs +++ b/OpenRA.Game/Widgets/ShpImageWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,11 +18,11 @@ namespace OpenRA.Widgets public string Image = ""; public int Frame = 0; public string Palette = "chrome"; - + public Func GetImage; public Func GetFrame; public Func GetPalette; - + readonly WorldRenderer worldRenderer; [ObjectCreator.UseCtor] public ShpImageWidget([ObjectCreator.Param] WorldRenderer worldRenderer) @@ -48,7 +48,7 @@ namespace OpenRA.Widgets public override Widget Clone() { return new ShpImageWidget(this); } - + Sprite sprite = null; string cachedImage = null; int cachedFrame= -1; @@ -57,7 +57,7 @@ namespace OpenRA.Widgets var image = GetImage(); var frame = GetFrame(); var palette = GetPalette(); - + if (image != cachedImage || frame != cachedFrame) { sprite = Game.modData.SpriteLoader.LoadAllSprites(image)[frame]; diff --git a/OpenRA.Game/Widgets/SliderWidget.cs b/OpenRA.Game/Widgets/SliderWidget.cs index 8b746d1070..d0ceab3817 100755 --- a/OpenRA.Game/Widgets/SliderWidget.cs +++ b/OpenRA.Game/Widgets/SliderWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Widgets/TextFieldWidget.cs b/OpenRA.Game/Widgets/TextFieldWidget.cs index 8d5f156c63..72e80057b6 100644 --- a/OpenRA.Game/Widgets/TextFieldWidget.cs +++ b/OpenRA.Game/Widgets/TextFieldWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,17 +28,17 @@ namespace OpenRA.Widgets public int VisualHeight = 1; public int LeftMargin = 5; public int RightMargin = 5; - + public Func OnEnterKey = () => false; public Func OnTabKey = () => false; public Action OnLoseFocus = () => { }; public int CursorPosition { get; protected set; } - + public Func IsDisabled = () => false; public Color TextColor = Color.White; public Color DisabledColor = Color.Gray; public string Font = "Regular"; - + public TextFieldWidget() : base() {} protected TextFieldWidget(TextFieldWidget widget) : base(widget) @@ -80,17 +80,17 @@ namespace OpenRA.Widgets } protected virtual string GetApparentText() { return text; } - + public int ClosestCursorPosition(int x) { var apparentText = GetApparentText(); var font = Game.Renderer.Fonts[Font]; var textSize = font.Measure(apparentText); - + var start = RenderOrigin.X + LeftMargin; if (textSize.X > Bounds.Width - LeftMargin - RightMargin && Focused) start += Bounds.Width - LeftMargin - RightMargin - textSize.X; - + int minIndex = -1; int minValue = int.MaxValue; for (int i = 0; i <= apparentText.Length; i++) @@ -110,7 +110,7 @@ namespace OpenRA.Widgets return false; if (e.Event == KeyInputEvent.Up) return false; - + // Only take input if we are focused if (!Focused) return false; @@ -136,13 +136,13 @@ namespace OpenRA.Widgets return true; } - + if (e.KeyName == "home") { CursorPosition = 0; return true; } - + if (e.KeyName == "end") { CursorPosition = Text.Length; @@ -167,9 +167,9 @@ namespace OpenRA.Widgets CursorPosition--; Text = Text.Remove(CursorPosition, 1); } - + else if (key.IsValidInput()) - { + { if (MaxLength > 0 && Text.Length >= MaxLength) return; @@ -190,7 +190,7 @@ namespace OpenRA.Widgets showCursor ^= true; } } - + public override void Draw() { var apparentText = GetApparentText(); diff --git a/OpenRA.Game/Widgets/TimerWidget.cs b/OpenRA.Game/Widgets/TimerWidget.cs index 1ea175fd97..420352d896 100644 --- a/OpenRA.Game/Widgets/TimerWidget.cs +++ b/OpenRA.Game/Widgets/TimerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs index a9eb5b9ce1..8abd92bd32 100755 --- a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs +++ b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,13 +25,13 @@ namespace OpenRA.Widgets public ViewportScrollControllerWidget() : base() {} protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {} - + public override bool HandleMouseInput(MouseInput mi) - { + { var scrolltype = Game.Settings.Game.MouseScroll; if (scrolltype == MouseScrollType.Disabled) return false; - + if (mi.Event == MouseInputEvent.Move && (mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right))) { @@ -41,7 +41,7 @@ namespace OpenRA.Widgets } return false; } - + static readonly Dictionary directions = new Dictionary { { ScrollDirection.Up | ScrollDirection.Left, "scroll-tl" }, @@ -61,7 +61,7 @@ namespace OpenRA.Widgets return null; var blockedDirections = Game.viewport.GetBlockedDirections(); - + foreach( var dir in directions ) if (Edge.Includes( dir.Key )) return dir.Value + (blockedDirections.Includes( dir.Key ) ? "-blocked" : ""); @@ -74,9 +74,9 @@ namespace OpenRA.Widgets Keyboard = ScrollDirection.None; return base.LoseFocus(mi); } - + public override bool HandleKeyPress(KeyInput e) - { + { switch (e.KeyName) { case "up": Keyboard = Keyboard.Set(ScrollDirection.Up, (e.Event == KeyInputEvent.Down)); return true; @@ -86,7 +86,7 @@ namespace OpenRA.Widgets } return false; } - + public override void Tick() { Edge = ScrollDirection.None; @@ -102,7 +102,7 @@ namespace OpenRA.Widgets if (Viewport.LastMousePos.Y >= Game.viewport.Height - EdgeScrollThreshold) Edge = Edge.Set(ScrollDirection.Down, true); } - + if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None) { var scroll = new float2(0, 0); @@ -124,7 +124,7 @@ namespace OpenRA.Widgets Game.viewport.Scroll(scroll); } } - + public override Widget Clone() { return new ViewportScrollControllerWidget(this); } } } diff --git a/OpenRA.Game/Widgets/VqaPlayerWidget.cs b/OpenRA.Game/Widgets/VqaPlayerWidget.cs index 32fd64f469..789108deaa 100644 --- a/OpenRA.Game/Widgets/VqaPlayerWidget.cs +++ b/OpenRA.Game/Widgets/VqaPlayerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,33 +25,33 @@ namespace OpenRA.Widgets uint[,] overlay; bool stopped; bool paused; - + Action OnComplete; - + public bool Paused { get { return paused; } } - - + + readonly World world; [ObjectCreator.UseCtor] public VqaPlayerWidget( [ObjectCreator.Param] World world ) { this.world = world; } - + public bool DrawOverlay = true; public void Load(string filename) { if (filename == cachedVideo) return; - + stopped = true; paused = true; Sound.StopVideo(); OnComplete = () => {}; - + cachedVideo = filename; video = new VqaReader(FileSystem.Open(filename)); - + invLength = video.Framerate*1f/video.Frames; var size = Math.Max(video.Width, video.Height); @@ -62,7 +62,7 @@ namespace OpenRA.Widgets var scale = Math.Min(RenderBounds.Width / video.Width, RenderBounds.Height / video.Height); videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale*video.Width)/2, RenderBounds.Y + (RenderBounds.Height - scale*video.Height)/2); videoSize = new float2(video.Width * scale, video.Height * scale); - + if (!DrawOverlay) return; @@ -71,16 +71,16 @@ namespace OpenRA.Widgets for (var y = 0; y < video.Height; y++) for (var x = 0; x < video.Width; x++) overlay[2*y,x] = black; - + overlaySprite = new Sprite(new Sheet(new Size(2*textureSize,2*textureSize)), new Rectangle( 0, 0, video.Width, 2*video.Height ), TextureChannel.Alpha); overlaySprite.sheet.Texture.SetData(overlay); } - + public override void Draw() { if (video == null) return; - + if (!(stopped || paused)) { var nextFrame = (int)float2.Lerp(0, video.Frames, Sound.VideoSeekPosition*invLength); @@ -89,7 +89,7 @@ namespace OpenRA.Widgets Stop(); return; } - + while (nextFrame > video.CurrentFrame) { video.AdvanceFrame(); @@ -97,13 +97,13 @@ namespace OpenRA.Widgets videoSprite.sheet.Texture.SetData(video.FrameData); } } - + Game.Renderer.RgbaSpriteRenderer.DrawSprite(videoSprite, videoOrigin, videoSize); - + if (DrawOverlay) Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, videoSize); } - + public override bool HandleKeyPress(KeyInput e) { if (e.Event == KeyInputEvent.Down) @@ -116,40 +116,40 @@ namespace OpenRA.Widgets } return false; } - + public void Play() { - PlayThen(() => {}); + PlayThen(() => {}); } - + public void PlayThen(Action after) { if (video == null) return; - + OnComplete = after; if (stopped) Sound.PlayVideo(video.AudioData); else Sound.PlayVideo(); - + stopped = paused = false; } - + public void Pause() { if (stopped || paused || video == null) return; - + paused = true; Sound.PauseVideo(); } - + public void Stop() { if (stopped || video == null) return; - + stopped = true; paused = true; Sound.StopVideo(); diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index 3c9d458604..40a91ded1b 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -397,15 +397,15 @@ namespace OpenRA.Widgets public override string GetCursor(int2 pos) { return null; } public override Widget Clone() { return new ContainerWidget(this); } } - + public class WidgetArgs : Dictionary { public WidgetArgs() : base() { } public WidgetArgs(Dictionary args) : base(args) { } public void Add(string key, Action val) { base.Add(key, val); } } - - // TODO: you should use this anywhere you want to do + + // TODO: you should use this anywhere you want to do // something in a logic ctor, but retain debuggability. public interface ILogicWithInit { diff --git a/OpenRA.Game/Widgets/WidgetLoader.cs b/OpenRA.Game/Widgets/WidgetLoader.cs index 1a17674f48..ccca002daf 100644 --- a/OpenRA.Game/Widgets/WidgetLoader.cs +++ b/OpenRA.Game/Widgets/WidgetLoader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,14 +37,14 @@ namespace OpenRA MiniYamlNode ret; if (!widgets.TryGetValue(w, out ret)) throw new InvalidDataException("Cannot find widget with Id `{0}`".F(w)); - + return LoadWidget( args, parent, ret ); } public Widget LoadWidget( WidgetArgs args, Widget parent, MiniYamlNode node) { var widget = NewWidget(node.Key, args); - + if (parent != null) parent.AddChild( widget ); diff --git a/OpenRA.Game/Widgets/WidgetUtils.cs b/OpenRA.Game/Widgets/WidgetUtils.cs index f5abcf2922..75bc26a637 100644 --- a/OpenRA.Game/Widgets/WidgetUtils.cs +++ b/OpenRA.Game/Widgets/WidgetUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,12 +23,12 @@ namespace OpenRA.Widgets { return ChromeProvider.GetImage("chrome-" + world.LocalPlayer.Country.Race, name); } - + public static void DrawRGBA(Sprite s, float2 pos) { Game.Renderer.RgbaSpriteRenderer.DrawSprite(s,pos); } - + public static void DrawSHP(Sprite s, float2 pos, WorldRenderer wr) { Game.Renderer.SpriteRenderer.DrawSprite(s,pos, wr, "chrome"); @@ -38,7 +38,7 @@ namespace OpenRA.Widgets { DrawPanelPartial(collection, Bounds, PanelSides.All); } - + public static void FillRectWithSprite(Rectangle r, Sprite s) { for (var x = r.Left; x < r.Right; x += (int)s.size.X) @@ -57,12 +57,12 @@ namespace OpenRA.Widgets DrawRGBA(ss, new float2(x, y)); } } - + public static void FillRectWithColor(Rectangle r, Color c) { Game.Renderer.LineRenderer.FillRect(new RectangleF(r.X, r.Y, r.Width, r.Height), c); } - + public static int[] GetBorderSizes(string collection) { var images = new[] { "border-t", "border-b", "border-l", "border-r" }; @@ -135,8 +135,8 @@ namespace OpenRA.Widgets if (ps.HasFlags(PanelSides.Right | PanelSides.Bottom)) DrawRGBA(ss[7], new float2(bounds.Right - ss[7].size.X, bounds.Bottom - ss[7].size.Y)); } - - + + public static string FormatTime(int ticks) { var seconds = (int)Math.Ceiling(ticks / 25f); @@ -152,7 +152,7 @@ namespace OpenRA.Widgets else return "{0:D2}:{1:D2}".F(minutes, seconds % 60); } - + public static string WrapText(string text, int width, SpriteFont font) { var textSize = font.Measure(text); @@ -169,7 +169,7 @@ namespace OpenRA.Widgets var m = font.Measure(line); var spaceIndex = 0; var start = line.Length - 1; - + if (m.X <= width) { if (i < lines.Length - 1) diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index fc48e6a0d5..4bf94d91bc 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,14 +23,14 @@ namespace OpenRA.Widgets { protected readonly World world; readonly WorldRenderer worldRenderer; - + [ObjectCreator.UseCtor] public WorldInteractionControllerWidget([ObjectCreator.Param] World world, [ObjectCreator.Param] WorldRenderer worldRenderer) { this.world = world; this.worldRenderer = worldRenderer; } - + public override void Draw() { var selbox = SelectionBox; @@ -46,7 +46,7 @@ namespace OpenRA.Widgets foreach (var u in SelectActorsInBox(world, selbox.Value.First, selbox.Value.Second)) worldRenderer.DrawRollover(u); } - + int2 dragStart, dragEnd; public override bool HandleMouseInput(MouseInput mi) @@ -56,7 +56,7 @@ namespace OpenRA.Widgets { if (!TakeFocus(mi)) return false; - + dragStart = dragEnd = xy; ApplyOrders(world, xy, mi); } @@ -82,10 +82,10 @@ namespace OpenRA.Widgets if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down) if (SelectionBox == null) /* don't issue orders while selecting */ ApplyOrders(world, xy, mi); - + return true; } - + public Pair? SelectionBox { get @@ -94,7 +94,7 @@ namespace OpenRA.Widgets return Pair.New(dragStart, dragEnd); } } - + public void ApplyOrders(World world, int2 xy, MouseInput mi) { if (world.OrderGenerator == null) return; @@ -104,7 +104,7 @@ namespace OpenRA.Widgets world.PlayVoiceForOrders(orders); } - + public override string GetCursor(int2 pos) { return Sync.CheckSyncUnchanged( world, () => @@ -140,7 +140,7 @@ namespace OpenRA.Widgets } return false; } - + static readonly Actor[] NoActors = {}; IEnumerable SelectActorsInBox(World world, int2 a, int2 b) { diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index cb4bcea63b..80db56f0a7 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,16 +43,16 @@ namespace OpenRA public readonly Shroud LocalShroud; public void SetLocalPlayer(string pr) - { + { if (!(orderManager.Connection is ReplayConnection)) LocalPlayer = Players.FirstOrDefault(p => p.InternalName == pr); } - public readonly Actor WorldActor; + public readonly Actor WorldActor; public readonly Map Map; public readonly TileSet TileSet; public readonly ActorMap ActorMap; - + public void IssueOrder( Order o ) { orderManager.IssueOrder( o ); } /* avoid exposing the OM to mod code */ IOrderGenerator orderGenerator_; @@ -83,13 +83,13 @@ namespace OpenRA return true; } } - + internal World(Manifest manifest, Map map, OrderManager orderManager) { this.orderManager = orderManager; orderGenerator_ = new UnitOrderGenerator(); Map = map; - + TileSet = Rules.TileSets[Map.Tileset]; TileSet.LoadTiles(); @@ -101,19 +101,19 @@ namespace OpenRA // Add players foreach (var cmp in WorldActor.TraitsImplementing()) - cmp.CreatePlayers(this); - + cmp.CreatePlayers(this); + // Set defaults for any unset stances foreach (var p in Players) foreach (var q in Players) if (!p.Stances.ContainsKey(q)) - p.Stances[q] = Stance.Neutral; - + p.Stances[q] = Stance.Neutral; + Sound.SoundVolumeModifier = 1.0f; foreach (var wlh in WorldActor.TraitsImplementing()) wlh.WorldLoaded(this); } - + public Actor CreateActor( string name, TypeDictionary initDict ) { return CreateActor( true, name, initDict ); @@ -126,7 +126,7 @@ namespace OpenRA Add( a ); return a; } - + public void Add(Actor a) { a.IsInWorld = true; @@ -160,19 +160,19 @@ namespace OpenRA foreach( var ni in ActorsWithTrait() ) if (ni.Actor.IsIdle) ni.Trait.TickIdle(ni.Actor); - + using( new PerfSample("tick_activities") ) foreach( var a in actors ) a.Tick(); - + ActorsWithTrait().DoTimed( x => { x.Trait.Tick( x.Actor ); }, "[{2}] Trait: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold ); - + effects.DoTimed( e => e.Tick( this ), "[{2}] Effect: {0} ({1:0.000} ms)", Game.Settings.Debug.LongTickThreshold ); } - + while (frameEndActions.Count != 0) frameEndActions.Dequeue()(this); Game.viewport.Tick(); @@ -204,7 +204,7 @@ namespace OpenRA // Hash the shared rng ret += SharedRandom.Last; - + return ret; } } diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index dc0beed76f..65a7191412 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -65,22 +65,22 @@ namespace OpenRA if (r * r >= (new int2(i, j) - a).LengthSquared) yield return new int2(i, j); } - + public static string GetTerrainType(this World world, int2 cell) { var custom = world.Map.CustomTerrain[cell.X, cell.Y]; return custom != null ? custom : world.TileSet.GetTerrainType(world.Map.MapTiles.Value[cell.X, cell.Y]); } - + public static TerrainTypeInfo GetTerrainInfo(this World world, int2 cell) { return world.TileSet.Terrain[world.GetTerrainType(cell)]; } - + public static int2 ClampToWorld( this World world, int2 xy ) { var r = world.Map.Bounds; - return xy.Clamp(new Rectangle(r.X,r.Y,r.Width-1, r.Height-1)); + return xy.Clamp(new Rectangle(r.X,r.Y,r.Width-1, r.Height-1)); } public static int2 ChooseRandomEdgeCell(this World w) @@ -113,7 +113,7 @@ namespace OpenRA .Sum() / samples; } - // Returns a random offset in the range [-1..1,-1..1] with a separable + // Returns a random offset in the range [-1..1,-1..1] with a separable // Gauss distribution with 'samples' values taken for each axis public static float2 Gauss2D(this Thirdparty.Random r, int samples) { @@ -124,7 +124,7 @@ namespace OpenRA { return a.Info.Traits.Contains() && a.Info.Traits.Get().Voice != null; } - + public static VoiceInfo GetVoice(this Actor a) { if (!a.Info.Traits.Contains()) return null; diff --git a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs index 964261cf00..110a09bf90 100644 --- a/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs +++ b/OpenRA.Mods.Cnc/Activities/HarvesterDockSequence.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,12 +31,12 @@ namespace OpenRA.Mods.Cnc Undock, Dragout }; - + readonly Actor proc; readonly Harvester harv; readonly RenderUnit ru; State state; - + int2 startDock; int2 endDock; public HarvesterDockSequence(Actor self, Actor proc) @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Cnc startDock = self.Trait().PxPosition; endDock = proc.Trait().PxPosition + new int2(-15,8); } - + public override Activity Tick(Actor self) { switch (state) diff --git a/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs b/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs index 24596b8015..8605aac481 100644 --- a/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs +++ b/OpenRA.Mods.Cnc/CncColorPickerPaletteModifier.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,15 +21,15 @@ namespace OpenRA.Mods.Cnc public string PlayerPalette = "player"; public object Create( ActorInitializer init ) { return new CncColorPickerPaletteModifier( this ); } } - + class CncColorPickerPaletteModifier : IPalette, IPaletteModifier - { + { CncColorPickerPaletteModifierInfo Info; PaletteFormat format; public ColorRamp Ramp; - + public CncColorPickerPaletteModifier(CncColorPickerPaletteModifierInfo info) { Info = info; } - + public void InitPalette( WorldRenderer wr ) { var info = Rules.Info["player"].Traits.WithInterface() diff --git a/OpenRA.Mods.Cnc/CncLoadScreen.cs b/OpenRA.Mods.Cnc/CncLoadScreen.cs index a9743c3e8e..3fac45cd42 100644 --- a/OpenRA.Mods.Cnc/CncLoadScreen.cs +++ b/OpenRA.Mods.Cnc/CncLoadScreen.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs b/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs index 9dc8e234ed..e4c997ff2d 100644 --- a/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs +++ b/OpenRA.Mods.Cnc/CncMenuPaletteEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,19 +18,19 @@ namespace OpenRA.Mods.Cnc public class CncMenuPaletteEffectInfo : ITraitInfo { public readonly int FadeLength = 10; - + public object Create(ActorInitializer init) { return new CncMenuPaletteEffect(this); } } public class CncMenuPaletteEffect : IPaletteModifier, ITick - { + { public enum EffectType { None, Black, Desaturated } public readonly CncMenuPaletteEffectInfo Info; - + int remainingFrames; EffectType from = EffectType.Black; EffectType to = EffectType.Black; - + public CncMenuPaletteEffect(CncMenuPaletteEffectInfo info) { Info = info; } public void Fade(EffectType type) { @@ -44,7 +44,7 @@ namespace OpenRA.Mods.Cnc if (remainingFrames > 0) remainingFrames--; } - + Color ColorForEffect(EffectType t, Color orig) { switch(t) @@ -59,23 +59,23 @@ namespace OpenRA.Mods.Cnc return orig; } } - + public void AdjustPalette(Dictionary palettes) { if (to == EffectType.None && remainingFrames == 0) return; - + var excludePalettes = new List(){"cursor", "chrome", "colorpicker", "shroud", "fog"}; foreach (var pal in palettes) { if (excludePalettes.Contains(pal.Key)) continue; - + for (var x = 0; x < 256; x++) { var orig = pal.Value.GetColor(x); var t = ColorForEffect(to, orig); - + if (remainingFrames == 0) pal.Value.SetColor(x, t); else diff --git a/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs b/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs index d1e196a9ec..6309af7bc0 100644 --- a/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs +++ b/OpenRA.Mods.Cnc/CncWaterPaletteRotation.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/DeadBuildingState.cs b/OpenRA.Mods.Cnc/DeadBuildingState.cs index 055ef22e4d..0c6a8c62af 100644 --- a/OpenRA.Mods.Cnc/DeadBuildingState.cs +++ b/OpenRA.Mods.Cnc/DeadBuildingState.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index f9ea628ddc..acfb886414 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/IonCannonPower.cs b/OpenRA.Mods.Cnc/IonCannonPower.cs index 84ee0aa402..209268c92c 100644 --- a/OpenRA.Mods.Cnc/IonCannonPower.cs +++ b/OpenRA.Mods.Cnc/IonCannonPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Missions/CncShellmapScript.cs b/OpenRA.Mods.Cnc/Missions/CncShellmapScript.cs index a32dbc64fe..ac79a44ef5 100755 --- a/OpenRA.Mods.Cnc/Missions/CncShellmapScript.cs +++ b/OpenRA.Mods.Cnc/Missions/CncShellmapScript.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA class CncShellmapScriptInfo : TraitInfo { } class CncShellmapScript: IWorldLoaded, ITick - { + { Dictionary Actors; static int2 ViewportOrigin; @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { SetViewport(); - + if (ticks == 0) { LoopTrack(Actors["boat1"], Actors["tl1"].Location, Actors["tr1"].Location); @@ -62,10 +62,10 @@ namespace OpenRA.Mods.RA LoopTrack(Actors["lst2"], Actors["tl2"].Location, Actors["tr2"].Location); LoopTrack(Actors["lst3"], Actors["tl2"].Location, Actors["tr2"].Location); } - + ticks++; } - + void CreateUnitsInTransport(Actor transport, string[] cargo) { var f = transport.Trait(); @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA new FacingInit( f.Facing ), })); } - + void LoopTrack(Actor self, int2 left, int2 right) { var mobile = self.Trait(); diff --git a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs index 0bec84ebe8..5b88c9fd97 100644 --- a/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs +++ b/OpenRA.Mods.Cnc/Missions/Gdi01Script.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,31 +23,31 @@ namespace OpenRA.Mods.Cnc class Gdi01ScriptInfo : TraitInfo, Requires { } class Gdi01Script: IWorldLoaded, ITick - { + { Dictionary Actors; Dictionary Players; - + public void WorldLoaded(World w) { Players = w.Players.ToDictionary(p => p.InternalName); - Actors = w.WorldActor.Trait().Actors; + Actors = w.WorldActor.Trait().Actors; var b = w.Map.Bounds; Game.MoveViewport(new int2(b.Left + b.Width/2, b.Top + b.Height/2)); - - Scripting.Media.PlayFMVFullscreen(w, "gdi1.vqa", + + Scripting.Media.PlayFMVFullscreen(w, "gdi1.vqa", () => Scripting.Media.PlayFMVFullscreen(w, "landing.vqa", () => { Sound.PlayMusic(Rules.Music["aoi"]); started = true; })); } - + public void OnVictory(World w) { started = false; Sound.PlayToPlayer(Players["GoodGuy"], "accom1.aud"); Players["GoodGuy"].WinState = WinState.Won; - + Action afterFMV = () => { Sound.StopMusic(); @@ -57,13 +57,13 @@ namespace OpenRA.Mods.Cnc }; Game.RunAfterDelay(5000, () => Scripting.Media.PlayFMVFullscreen(w, "consyard.vqa", afterFMV)); } - + public void OnLose(World w) { started = false; Sound.PlayToPlayer(Players["GoodGuy"], "fail1.aud"); Players["GoodGuy"].WinState = WinState.Lost; - + Action afterFMV = () => { Sound.StopMusic(); @@ -73,16 +73,16 @@ namespace OpenRA.Mods.Cnc }; Game.RunAfterDelay(5000, () => Scripting.Media.PlayFMVFullscreen(w, "gameover.vqa", afterFMV)); } - + int ticks = 0; bool started = false; - + int lastBadCount = -1; public void Tick(Actor self) { if (!started) return; - + if (ticks == 0) { SetGunboatPath(); @@ -113,61 +113,61 @@ namespace OpenRA.Mods.Cnc { Game.Debug("{0} badguys remain".F(badcount)); lastBadCount = badcount; - + if (badcount == 0) OnVictory(self.World); } - + //GoodGuy lose conditions: MCV/cyard must survive var hasAnything = self.World.ActorsWithTrait() .Any( a => a.Actor.Owner == Players["GoodGuy"] ); if (!hasAnything) OnLose(self.World); - + // GoodGuy reinforcements if (ticks == 25*5) { - ReinforceFromSea(self.World, + ReinforceFromSea(self.World, Actors["lstStart"].Location, Actors["lstEnd"].Location, new int2(53,53), new string[] {"e1","e1","e1"}, Players["GoodGuy"]); } - + if (ticks == 25*15) { - ReinforceFromSea(self.World, + ReinforceFromSea(self.World, Actors["lstStart"].Location, Actors["lstEnd"].Location, new int2(53,53), new string[] {"e1","e1","e1"}, Players["GoodGuy"]); } - + if (ticks == 25*30) { - ReinforceFromSea(self.World, + ReinforceFromSea(self.World, Actors["lstStart"].Location, Actors["lstEnd"].Location, new int2(53,53), new string[] {"jeep"}, Players["GoodGuy"]); } - + if (ticks == 25*60) { - ReinforceFromSea(self.World, + ReinforceFromSea(self.World, Actors["lstStart"].Location, Actors["lstEnd"].Location, new int2(53,53), new string[] {"jeep"}, Players["GoodGuy"]); } - + ticks++; } - + void SetGunboatPath() { var self = Actors[ "Gunboat" ]; @@ -176,14 +176,14 @@ namespace OpenRA.Mods.Cnc self.QueueActivity(mobile.ScriptedMove( Actors["gunboatRight"].Location )); self.QueueActivity(new CallFunc(() => SetGunboatPath())); } - + void ReinforceFromSea(World world, int2 startPos, int2 endPos, int2 unload, string[] items, Player player) { world.AddFrameEndTask(w => { - Sound.PlayToPlayer(w.LocalPlayer,"reinfor1.aud"); + Sound.PlayToPlayer(w.LocalPlayer,"reinfor1.aud"); - var a = w.CreateActor("lst", new TypeDictionary + var a = w.CreateActor("lst", new TypeDictionary { new LocationInit( startPos ), new OwnerInit( player ), @@ -198,7 +198,7 @@ namespace OpenRA.Mods.Cnc new OwnerInit( player ), new FacingInit( 0 ), })); - + a.CancelActivity(); a.QueueActivity(mobile.ScriptedMove(endPos)); a.QueueActivity(new CallFunc(() => diff --git a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs index ebe5e7e0c9..6090f4b160 100644 --- a/OpenRA.Mods.Cnc/PoisonedByTiberium.cs +++ b/OpenRA.Mods.Cnc/PoisonedByTiberium.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -14,7 +14,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Cnc { class PoisonedByTiberiumInfo : ITraitInfo - { + { [WeaponReference] public readonly string Weapon = "Tiberium"; public readonly string[] Resources = { "Tiberium", "BlueTiberium" }; diff --git a/OpenRA.Mods.Cnc/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/ProductionAirdrop.cs index c50c4e4b9d..db867f8117 100644 --- a/OpenRA.Mods.Cnc/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/ProductionAirdrop.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc public readonly string ReadyAudio = "reinfor1.aud"; public override object Create(ActorInitializer init) { return new ProductionAirdrop(this); } } - + class ProductionAirdrop : Production { public ProductionAirdrop(ProductionAirdropInfo info) : base(info) {} @@ -31,34 +31,34 @@ namespace OpenRA.Mods.Cnc public override bool Produce( Actor self, ActorInfo producee ) { var owner = self.Owner; - + // Start a fixed distance away: the width of the map. // This makes the production timing indepent of spawnpoint var startPos = self.Location + new int2(owner.World.Map.Bounds.Width, 0); var endPos = new int2(owner.World.Map.Bounds.Left - 5, self.Location.Y); - + // Assume a single exit point for simplicity var exit = self.Info.Traits.WithInterface().First(); - + var rb = self.Trait(); rb.PlayCustomAnimRepeating(self, "active"); owner.World.AddFrameEndTask(w => { - var a = w.CreateActor("C17", new TypeDictionary + var a = w.CreateActor("C17", new TypeDictionary { new LocationInit( startPos ), new OwnerInit( owner ), new FacingInit( 64 ), new AltitudeInit( Rules.Info["c17"].Traits.Get().CruiseAltitude ), }); - + a.QueueActivity(Fly.ToCell(self.Location + new int2(6,0))); a.QueueActivity(new Land(Target.FromActor(self))); - a.QueueActivity(new CallFunc(() => + a.QueueActivity(new CallFunc(() => { if (!self.IsInWorld || self.IsDead()) return; - + rb.PlayCustomAnimRepeating(self, "idle"); self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit)); Sound.PlayToPlayer(self.Owner, (Info as ProductionAirdropInfo).ReadyAudio); diff --git a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs b/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs index 2e21d6b584..3114f67a3d 100644 --- a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs +++ b/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Properties/AssemblyInfo.cs b/OpenRA.Mods.Cnc/Properties/AssemblyInfo.cs index db90a36308..adf9bff76b 100644 --- a/OpenRA.Mods.Cnc/Properties/AssemblyInfo.cs +++ b/OpenRA.Mods.Cnc/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Mods.Cnc")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.Mods.Cnc/RenderBuildingRefinery.cs b/OpenRA.Mods.Cnc/RenderBuildingRefinery.cs index b8ed7da1fc..105dd9934e 100755 --- a/OpenRA.Mods.Cnc/RenderBuildingRefinery.cs +++ b/OpenRA.Mods.Cnc/RenderBuildingRefinery.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/RenderCargo.cs b/OpenRA.Mods.Cnc/RenderCargo.cs index e8b9efb4fc..ee5b9f926a 100644 --- a/OpenRA.Mods.Cnc/RenderCargo.cs +++ b/OpenRA.Mods.Cnc/RenderCargo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,18 +19,18 @@ namespace OpenRA.Mods.Cnc { public object Create(ActorInitializer init) { return new RenderCargo(init.self); } } - + public class RenderCargo : IRenderModifier { Cargo cargo; IFacing facing; - + public RenderCargo(Actor self) { cargo = self.Trait(); facing = self.TraitOrDefault(); } - + public IEnumerable ModifyRender(Actor self, IEnumerable r) { foreach (var c in cargo.Passengers) diff --git a/OpenRA.Mods.Cnc/RenderGunboat.cs b/OpenRA.Mods.Cnc/RenderGunboat.cs index eb17ed0621..39916c4278 100644 --- a/OpenRA.Mods.Cnc/RenderGunboat.cs +++ b/OpenRA.Mods.Cnc/RenderGunboat.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Render } base.Tick(self); } - + public void DamageStateChanged(Actor self, AttackInfo e) { if (e.DamageState >= DamageState.Critical) diff --git a/OpenRA.Mods.Cnc/SpawnViceroid.cs b/OpenRA.Mods.Cnc/SpawnViceroid.cs index 7ce3405c8b..bef5f2e76c 100644 --- a/OpenRA.Mods.Cnc/SpawnViceroid.cs +++ b/OpenRA.Mods.Cnc/SpawnViceroid.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,31 +21,31 @@ namespace OpenRA.Mods.Cnc public readonly int Probability = 10; public readonly string Owner = "Creeps"; public readonly int InfDeath = 5; - + public object Create(ActorInitializer init) { return new SpawnViceroid(this); } } class SpawnViceroid : INotifyKilled { readonly SpawnViceroidInfo Info; - + public SpawnViceroid(SpawnViceroidInfo info) { Info = info; } - + public void Killed(Actor self, AttackInfo e) { if (e.Warhead != null && e.Warhead.InfDeath == Info.InfDeath && self.World.SharedRandom.Next(100) <= Info.Probability) self.World.AddFrameEndTask(w => { - var td = new TypeDictionary + var td = new TypeDictionary { new LocationInit( self.Location ), new OwnerInit( self.World.Players.First(p => p.InternalName == Info.Owner) ) }; - + if (self.HasTrait()) td.Add(new FacingInit( self.Trait().Facing )); w.CreateActor(Info.ViceroidActor, td); diff --git a/OpenRA.Mods.Cnc/TiberiumRefinery.cs b/OpenRA.Mods.Cnc/TiberiumRefinery.cs index 18b7bea630..b53ac6136b 100644 --- a/OpenRA.Mods.Cnc/TiberiumRefinery.cs +++ b/OpenRA.Mods.Cnc/TiberiumRefinery.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.Cnc { public TiberiumRefinery(Actor self, TiberiumRefineryInfo info) : base(self, info as OreRefineryInfo) {} - + public override Activity DockSequence(Actor harv, Actor self) { return new HarvesterDockSequence(harv, self); diff --git a/OpenRA.Mods.Cnc/Widgets/CncWidgetUtils.cs b/OpenRA.Mods.Cnc/Widgets/CncWidgetUtils.cs index ef3a652c9b..cecb5c34d8 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncWidgetUtils.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncWidgetUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs b/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs index e0fb1256f2..05a3dbd101 100644 --- a/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/CncWorldInteractionControllerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Cnc.Widgets Keyboard = ScrollDirection.None; return base.LoseFocus(mi); } - + public override bool HandleKeyPress(KeyInput e) { switch (e.KeyName) diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs index ac798f1ce8..a8c3b0cc3a 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/ButtonTooltipLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs index e110ac7989..365b1c22c4 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncCheatsLogic.cs @@ -2,17 +2,17 @@ /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. - * + * * OpenRA is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * OpenRA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with OpenRA. If not, see . */ @@ -32,24 +32,24 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic [ObjectCreator.Param] World world) { var panel = widget.GetWidget("CHEATS_PANEL"); - + var devTrait = world.LocalPlayer.PlayerActor.Trait(); var shroudCheckbox = panel.GetWidget("SHROUD_CHECKBOX"); shroudCheckbox.IsChecked = () => devTrait.DisableShroud; shroudCheckbox.OnClick = () => Order(world, "DevShroud"); - + var pathCheckbox = panel.GetWidget("PATHDEBUG_CHECKBOX"); pathCheckbox.IsChecked = () => devTrait.PathDebug; pathCheckbox.OnClick = () => Order(world, "DevPathDebug"); - - - panel.GetWidget("GIVE_CASH_BUTTON").OnClick = () => + + + panel.GetWidget("GIVE_CASH_BUTTON").OnClick = () => world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false)); - + var fastBuildCheckbox = panel.GetWidget("INSTANT_BUILD_CHECKBOX"); fastBuildCheckbox.IsChecked = () => devTrait.FastBuild; fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild"); - + var fastChargeCheckbox = panel.GetWidget("INSTANT_CHARGE_CHECKBOX"); fastChargeCheckbox.IsChecked = () => devTrait.FastCharge; fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge"); @@ -57,7 +57,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var allTechCheckbox = panel.GetWidget("ENABLE_TECH_CHECKBOX"); allTechCheckbox.IsChecked = () => devTrait.AllTech; allTechCheckbox.OnClick = () => Order(world, "DevEnableTech"); - + var powerCheckbox = panel.GetWidget("UNLIMITED_POWER_CHECKBOX"); powerCheckbox.IsChecked = () => devTrait.UnlimitedPower; powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower"); @@ -65,16 +65,16 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var buildAnywhereCheckbox = panel.GetWidget("BUILD_ANYWHERE_CHECKBOX"); buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere; buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere"); - + panel.GetWidget("GIVE_EXPLORATION_BUTTON").OnClick = () => world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false)); - + panel.GetWidget("CLOSE_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); }; } - + public void Order(World world, string order) { - world.IssueOrder(new Order(order, world.LocalPlayer.PlayerActor, false)); + world.IssueOrder(new Order(order, world.LocalPlayer.PlayerActor, false)); } } } diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs index e7dad2e6ed..ae5a69cb3a 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncColorPickerLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,8 +30,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var hueSlider = panel.GetWidget("HUE_SLIDER"); var satSlider = panel.GetWidget("SAT_SLIDER"); var lumSlider = panel.GetWidget("LUM_SLIDER"); - - Action sliderChanged = () => + + Action sliderChanged = () => { ramp = new ColorRamp((byte)(255*hueSlider.Value), (byte)(255*satSlider.Value), @@ -39,25 +39,25 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic 10); onChange(ramp); }; - + hueSlider.OnChange += _ => sliderChanged(); satSlider.OnChange += _ => sliderChanged(); lumSlider.OnChange += _ => sliderChanged(); - + Action updateSliders = () => { hueSlider.Value = ramp.H / 255f; satSlider.Value = ramp.S / 255f; lumSlider.Value = ramp.L / 255f; }; - + panel.GetWidget("SAVE_BUTTON").OnClick = () => onSelect(ramp); - panel.GetWidget("RANDOM_BUTTON").OnClick = () => + panel.GetWidget("RANDOM_BUTTON").OnClick = () => { var hue = (byte)Game.CosmeticRandom.Next(255); var sat = (byte)Game.CosmeticRandom.Next(255); var lum = (byte)Game.CosmeticRandom.Next(51,255); - + ramp = new ColorRamp(hue, sat, lum, 10); updateSliders(); sliderChanged(); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs index a2ea1ee084..da537d651e 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncConnectionLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Action onConnect, onRetry, onAbort; string host; int port; - + void ConnectionStateChanged(OrderManager om) { if (om.Connection.ConnectionState == ConnectionState.Connected) @@ -40,13 +40,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic }); } } - + public void CloseWindow() { Game.ConnectionStateChanged -= ConnectionStateChanged; Widget.CloseWindow(); } - + [ObjectCreator.UseCtor] public CncConnectingLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] string host, @@ -60,16 +60,16 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic this.onConnect = onConnect; this.onRetry = onRetry; this.onAbort = onAbort; - + Game.ConnectionStateChanged += ConnectionStateChanged; var panel = widget.GetWidget("CONNECTING_PANEL"); panel.GetWidget("ABORT_BUTTON").OnClick = () => { CloseWindow(); onAbort(); }; - + widget.GetWidget("CONNECTING_DESC").GetText = () => "Connecting to {0}:{1}...".F(host, port); } - + public static void Connect(string host, int port, Action onConnect, Action onAbort) { Game.JoinServer(host, port); @@ -83,9 +83,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic }); } } - + public class CncConnectionFailedLogic - { + { [ObjectCreator.UseCtor] public CncConnectionFailedLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] string host, @@ -96,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var panel = widget.GetWidget("CONNECTIONFAILED_PANEL"); panel.GetWidget("ABORT_BUTTON").OnClick = () => { Widget.CloseWindow(); onAbort(); }; panel.GetWidget("RETRY_BUTTON").OnClick = () => { Widget.CloseWindow(); onRetry(); }; - + widget.GetWidget("CONNECTING_DESC").GetText = () => "Could not connect to {0}:{1}".F(host, port); } diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs index ac5b6bbca6..4c2f6b392e 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncConquestObjectivesLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncDownloadPackagesLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncDownloadPackagesLogic.cs index ad999a9c51..c1ca3bd83f 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncDownloadPackagesLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncDownloadPackagesLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic ProgressBarWidget progressBar; LabelWidget statusLabel; Action continueLoading; - + [ObjectCreator.UseCtor] public CncDownloadPackagesLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] Dictionary installData, @@ -34,50 +34,50 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { this.installData = installData; this.continueLoading = continueLoading; - + panel = widget.GetWidget("INSTALL_DOWNLOAD_PANEL"); progressBar = panel.GetWidget("PROGRESS_BAR"); statusLabel = panel.GetWidget("STATUS_LABEL"); - + ShowDownloadDialog(); } void ShowDownloadDialog() { - statusLabel.GetText = () => "Initializing..."; + statusLabel.GetText = () => "Initializing..."; progressBar.SetIndeterminate(true); var retryButton = panel.GetWidget("RETRY_BUTTON"); retryButton.IsVisible = () => false; - + var cancelButton = panel.GetWidget("CANCEL_BUTTON"); // Save the package to a temp file var file = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var dest = new string[] { Platform.SupportDir, "Content", "cnc" }.Aggregate(Path.Combine); - + Action onDownloadProgress = i => { if (progressBar.Indeterminate) progressBar.SetIndeterminate(false); - progressBar.Percentage = i.ProgressPercentage; + progressBar.Percentage = i.ProgressPercentage; statusLabel.GetText = () => "Downloading {1}/{2} kB ({0}%)".F(i.ProgressPercentage, i.BytesReceived / 1024, i.TotalBytesToReceive / 1024); }; - + Action onExtractProgress = s => { Game.RunAfterTick(() => statusLabel.GetText = () => s); }; - + Action onError = s => { - Game.RunAfterTick(() => + Game.RunAfterTick(() => { statusLabel.GetText = () => "Error: "+s; retryButton.IsVisible = () => true; }); }; - + Action onDownloadComplete = (i, cancelled) => { if (i.Error != null) @@ -90,7 +90,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic onError("Download cancelled"); return; } - + // Automatically extract statusLabel.GetText = () => "Extracting..."; progressBar.SetIndeterminate(true); @@ -103,9 +103,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic }); } }; - + var dl = new Download(installData["PackageURL"], file, onDownloadProgress, onDownloadComplete); - + cancelButton.OnClick = () => { dl.Cancel(); Widget.CloseWindow(); }; retryButton.OnClick = () => { dl.Cancel(); ShowDownloadDialog(); }; } diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs index 529f09ac40..05bf347b20 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs index 32aef2a3cb..8aa8451824 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameMenuLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -16,7 +16,7 @@ using OpenRA.Widgets; using OpenRA.Mods.RA.Activities; namespace OpenRA.Mods.Cnc.Widgets.Logic -{ +{ public class CncIngameMenuLogic { Widget menu; @@ -30,12 +30,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic menu = widget.GetWidget("INGAME_MENU"); var mpe = world.WorldActor.Trait(); mpe.Fade(CncMenuPaletteEffect.EffectType.Desaturated); - + menu.GetWidget("VERSION_LABEL").GetText = WidgetUtils.ActiveModVersion; bool hideButtons = false; menu.GetWidget("MENU_BUTTONS").IsVisible = () => !hideButtons; - + // TODO: Create a mechanism to do things like this cleaner. Also needed for scripted missions Action onQuit = () => { @@ -49,18 +49,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Game.LoadShellMap(); }); }; - + Action doNothing = () => {}; - + menu.GetWidget("QUIT_BUTTON").OnClick = () => CncWidgetUtils.PromptConfirmAction("Abort Mission", "Leave this game and return to the menu?", onQuit, doNothing); - + Action onSurrender = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); var surrenderButton = menu.GetWidget("SURRENDER_BUTTON"); surrenderButton.IsDisabled = () => (world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined); surrenderButton.OnClick = () => CncWidgetUtils.PromptConfirmAction("Surrender", "Are you sure you want to surrender?", onSurrender, doNothing); - + menu.GetWidget("MUSIC_BUTTON").OnClick = () => { hideButtons = true; @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { "onExit", () => hideButtons = false }, }); }; - + menu.GetWidget("SETTINGS_BUTTON").OnClick = () => { hideButtons = true; @@ -79,10 +79,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { "onExit", () => hideButtons = false }, }); }; - + var resumeButton = menu.GetWidget("RESUME_BUTTON"); resumeButton.IsDisabled = () => resumeDisabled; - resumeButton.OnClick = () => + resumeButton.OnClick = () => { Widget.CloseWindow(); Widget.RootWidget.RemoveChild(menu); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs index 62061a1188..8cbc0027e1 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ using OpenRA.FileFormats.Graphics; using OpenRA.Widgets; namespace OpenRA.Mods.Cnc.Widgets.Logic -{ +{ public class CncInstallFromCDLogic { Widget panel; @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Action continueLoading; ButtonWidget retryButton, backButton; Widget installingContainer, insertDiskContainer; - + [ObjectCreator.UseCtor] public CncInstallFromCDLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] Action continueLoading) @@ -35,18 +35,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic panel = widget.GetWidget("INSTALL_FROMCD_PANEL"); progressBar = panel.GetWidget("PROGRESS_BAR"); statusLabel = panel.GetWidget("STATUS_LABEL"); - + backButton = panel.GetWidget("BACK_BUTTON"); backButton.OnClick = Widget.CloseWindow; - + retryButton = panel.GetWidget("RETRY_BUTTON"); retryButton.OnClick = CheckForDisk; - + installingContainer = panel.GetWidget("INSTALLING"); insertDiskContainer = panel.GetWidget("INSERT_DISK"); CheckForDisk(); } - + void CheckForDisk() { Func ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") && @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic installingContainer.IsVisible = () => false; } } - + void Install(string source) { backButton.IsDisabled = () => true; @@ -74,34 +74,34 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var dest = new string[] { Platform.SupportDir, "Content", "cnc" }.Aggregate(Path.Combine); var copyFiles = new string[] { "CONQUER.MIX", "DESERT.MIX", "SCORES.MIX", "SOUNDS.MIX", "TEMPERAT.MIX", "WINTER.MIX" }; - + var extractPackage = "INSTALL/SETUP.Z"; var extractFiles = new string[] { "speech.mix", "tempicnh.mix", "transit.mix" }; - + var installCounter = 0; var installTotal = copyFiles.Count() + extractFiles.Count(); - var onProgress = (Action)(s => Game.RunAfterTick(() => + var onProgress = (Action)(s => Game.RunAfterTick(() => { progressBar.Percentage = installCounter*100/installTotal; installCounter++; - + statusLabel.GetText = () => s; })); - - var onError = (Action)(s => Game.RunAfterTick(() => + + var onError = (Action)(s => Game.RunAfterTick(() => { statusLabel.GetText = () => "Error: "+s; backButton.IsDisabled = () => false; retryButton.IsDisabled = () => false; })); - + var t = new Thread( _ => { try { if (!InstallUtils.CopyFiles(source, copyFiles, dest, onProgress, onError)) return; - + if (!InstallUtils.ExtractFromPackage(source, extractPackage, extractFiles, dest, onProgress, onError)) return; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs index 7e31f56a81..282e65a0a4 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index 4b3a93ad1e..2a08a9c179 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,12 +25,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic EditableSpectatorTemplate, NonEditableSpectatorTemplate, NewSpectatorTemplate; ScrollPanelWidget chatPanel; Widget chatTemplate; - + ScrollPanelWidget Players; Dictionary CountryNames; string MapUid; Map Map; - + CncColorPickerPaletteModifier PlayerPalettePreview; readonly Action OnGameStart; @@ -44,8 +44,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { // Show connection failed dialog CloseWindow(); - - Action onConnect = () => + + Action onConnect = () => { Game.OpenWindow("SERVER_LOBBY", new WidgetArgs() { @@ -54,23 +54,23 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { "addBots", false } }); }; - + Action onRetry = () => { CloseWindow(); CncConnectingLogic.Connect(om.Host, om.Port, onConnect, onExit); }; - + Widget.OpenWindow("CONNECTIONFAILED_PANEL", new WidgetArgs() { { "onAbort", onExit }, { "onRetry", onRetry }, { "host", om.Host }, { "port", om.Port } - }); + }); } } - + public void CloseWindow() { Game.LobbyInfoChanged -= UpdateCurrentMap; @@ -78,7 +78,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Game.BeforeGameStart -= OnGameStart; Game.AddChatLine -= AddChatLine; Game.ConnectionStateChanged -= ConnectionStateChanged; - + Widget.CloseWindow(); } @@ -93,7 +93,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic this.orderManager = orderManager; this.OnGameStart = () => { CloseWindow(); onStart(); }; this.onExit = onExit; - + Game.LobbyInfoChanged += UpdateCurrentMap; Game.LobbyInfoChanged += UpdatePlayerList; Game.BeforeGameStart += OnGameStart; @@ -215,7 +215,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic chatLabel.Text = (teamChat) ? "Team:" : "Chat:"; return true; }; - + chatPanel = lobby.GetWidget("CHAT_DISPLAY"); chatTemplate = chatPanel.GetWidget("CHAT_TEMPLATE"); chatPanel.RemoveChildren(); @@ -238,7 +238,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic orderManager.IssueOrder(Order.Command("slot_bot {0} {1}".F(slot, bot))); }); } - + public void AddChatLine(Color c, string from, string text) { var template = chatTemplate.Clone() as ContainerWidget; @@ -288,7 +288,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic public string Title; public string Order; public Func Selected; - + public SlotDropDownOption(string title, string order, Func selected) { Title = title; @@ -296,7 +296,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Selected = selected; } } - + void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client) { var options = new List() @@ -322,10 +322,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic item.GetWidget("LABEL").GetText = () => o.Title; return item; }; - + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem); } - + void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client) { Func setupItem = (race, itemTemplate) => @@ -339,10 +339,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic flag.GetImageName = () => race; return item; }; - + dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, CountryNames.Keys.ToList(), setupItem); } - + void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client) { Func setupItem = (ii, itemTemplate) => @@ -353,7 +353,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic item.GetWidget("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString(); return item; }; - + var options = Graphics.Util.MakeArray(Map.SpawnPoints.Count()+1, i => i).ToList(); dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem); } @@ -363,7 +363,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Func setupItem = (ii, itemTemplate) => { var item = ScrollItemWidget.Setup(itemTemplate, - () => client.SpawnPoint == ii, + () => client.SpawnPoint == ii, () => orderManager.IssueOrder(Order.Command("spawn {0} {1}".F(client.Index, ii)))); item.GetWidget("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString(); return item; @@ -390,25 +390,25 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic color.RemovePanel(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, c))); }; - + Action onChange = c => PlayerPalettePreview.Ramp = c; - + var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs() { { "onSelect", onSelect }, { "onChange", onChange }, { "initialRamp", client.ColorRamp } }); - + color.AttachPanel(colorChooser); } - + void UpdatePlayerList() { // This causes problems for people who are in the process of editing their names (the widgets vanish from beneath them) // Todo: handle this nicer Players.RemoveChildren(); - + foreach (var kv in orderManager.LobbyInfo.Slots) { var key = kv.Key; @@ -487,14 +487,14 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var color = template.GetWidget("COLOR"); color.IsDisabled = () => slot.LockColor || ready; color.OnMouseDown = _ => ShowColorDropDown(color, client); - + var colorBlock = color.GetWidget("COLORBLOCK"); colorBlock.GetColor = () => client.ColorRamp.GetColor(0); var faction = template.GetWidget("FACTION"); faction.IsDisabled = () => slot.LockRace || ready; faction.OnMouseDown = _ => ShowRaceDropDown(faction, client); - + var factionname = faction.GetWidget("FACTIONNAME"); factionname.GetText = () => CountryNames[client.Country]; var factionflag = faction.GetWidget("FACTIONFLAG"); @@ -543,7 +543,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var spawn = template.GetWidget("SPAWN"); spawn.GetText = () => (client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(); - template.GetWidget("STATUS_IMAGE").IsVisible = () => + template.GetWidget("STATUS_IMAGE").IsVisible = () => client.Bot != null || client.State == Session.ClientState.Ready; var kickButton = template.GetWidget("KICK"); @@ -605,7 +605,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var color = template.GetWidget("COLOR"); color.GetColor = () => c.ColorRamp.GetColor(0); - template.GetWidget("STATUS_IMAGE").IsVisible = () => + template.GetWidget("STATUS_IMAGE").IsVisible = () => c.Bot != null || c.State == Session.ClientState.Ready; var kickButton = template.GetWidget("KICK"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMapChooserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMapChooserLogic.cs index 4f4f062c78..5c64c5098b 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMapChooserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMapChooserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Map map; Widget scrollpanel; ScrollItemWidget itemTemplate; - + [ObjectCreator.UseCtor] internal CncMapChooserLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] string initialMap, @@ -28,9 +28,9 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic [ObjectCreator.Param] Action onSelect) { map = Game.modData.AvailableMaps[ CncWidgetUtils.ChooseInitialMap(initialMap) ]; - + var panel = widget.GetWidget("MAPCHOOSER_PANEL"); - + panel.GetWidget("MAP_PREVIEW").Map = () => map; panel.GetWidget("CURMAP_TITLE").GetText = () => map.Title; panel.GetWidget("CURMAP_AUTHOR").GetText = () => map.Author; @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic panel.GetWidget("BUTTON_OK").OnClick = () => { Widget.CloseWindow(); onSelect(map); }; panel.GetWidget("BUTTON_CANCEL").OnClick = () => { Widget.CloseWindow(); onExit(); }; - + scrollpanel = panel.GetWidget("MAP_LIST"); itemTemplate = scrollpanel.GetWidget("MAP_TEMPLATE"); EnumerateMaps(); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs index d2030917e3..81a4363705 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMenuLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -85,7 +85,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { "onExit", () => Menu = MenuType.Multiplayer }, { "openLobby", () => OpenLobbyPanel(MenuType.Multiplayer, false) } }); - }; + }; // Settings menu var settingsMenu = widget.GetWidget("SETTINGS_MENU"); @@ -129,7 +129,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { rootMenu.Parent.RemoveChild(rootMenu); } - + void OpenLobbyPanel(MenuType menu, bool addBots) { Menu = MenuType.None; @@ -140,7 +140,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { "addBots", addBots } }); } - + void StartSkirmishGame() { var map = CncWidgetUtils.ChooseInitialMap(Game.Settings.Server.Map); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs index 8d760031a0..af8a5429fd 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncModBrowserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic public class CncModBrowserLogic { Mod currentMod; - + [ObjectCreator.UseCtor] public CncModBrowserLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] Action onSwitch, @@ -30,13 +30,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var loadButton = panel.GetWidget("LOAD_BUTTON"); loadButton.OnClick = () => LoadMod(currentMod.Id, onSwitch); loadButton.IsDisabled = () => currentMod.Id == Game.CurrentMods.Keys.First(); - + panel.GetWidget("BACK_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); }; currentMod = Mod.AllMods[Game.modData.Manifest.Mods[0]]; - + // Mod list var modTemplate = modList.GetWidget("MOD_TEMPLATE"); - + foreach (var m in Mod.AllMods) { var mod = m.Value; @@ -47,12 +47,12 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic modList.AddChild(item); } } - + void LoadMod(string mod, Action onSwitch) { var mods = Mod.AllMods[mod].WithPrerequisites(); - Game.RunAfterTick(() => + Game.RunAfterTick(() => { Widget.CloseWindow(); onSwitch(); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs index bb03199bca..0bcfeacc81 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Widget panel; MusicInfo[] music; MusicInfo[] random; - + ScrollItemWidget itemTemplate; [ObjectCreator.UseCtor] @@ -35,18 +35,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic [ObjectCreator.Param] Action onExit) { panel = widget.GetWidget("MUSIC_PANEL"); - + var ml = panel.GetWidget("MUSIC_LIST"); itemTemplate = ml.GetWidget("MUSIC_TEMPLATE"); - + BuildMusicTable(ml); currentSong = Sound.CurrentMusic ?? GetNextSong(); installed = Rules.Music.Where(m => m.Value.Exists).Any(); Func noMusic = () => !installed; - + panel.GetWidget("BACK_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); }; - + Action afterInstall = () => { // Mount the new mixfile and rebuild the scores list @@ -58,22 +58,22 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Rules.Music.Do(m => m.Value.Reload()); } catch (Exception) { } - + installed = Rules.Music.Where(m => m.Value.Exists).Any(); BuildMusicTable(ml); }; - + var installButton = panel.GetWidget("INSTALL_BUTTON"); installButton.OnClick = () => Widget.OpenWindow("INSTALL_MUSIC_PANEL", new WidgetArgs() {{ "afterInstall", afterInstall }}); installButton.IsVisible = () => music.Length < 3; // Hack around music being split between transit.mix and scores.mix - + panel.GetWidget("NO_MUSIC_LABEL").IsVisible = noMusic; var playButton = panel.GetWidget("BUTTON_PLAY"); playButton.OnClick = Play; playButton.IsDisabled = noMusic; - + var pauseButton = panel.GetWidget("BUTTON_PAUSE"); pauseButton.OnClick = Pause; pauseButton.IsDisabled = noMusic; @@ -81,93 +81,93 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var stopButton = panel.GetWidget("BUTTON_STOP"); stopButton.OnClick = Stop; stopButton.IsDisabled = noMusic; - + var nextButton = panel.GetWidget("BUTTON_NEXT"); nextButton.OnClick = () => { currentSong = GetNextSong(); Play(); }; nextButton.IsDisabled = noMusic; - + var prevButton = panel.GetWidget("BUTTON_PREV"); prevButton.OnClick = () => { currentSong = GetPrevSong(); Play(); }; prevButton.IsDisabled = noMusic; - + var shuffleCheckbox = panel.GetWidget("SHUFFLE"); shuffleCheckbox.IsChecked = () => Game.Settings.Sound.Shuffle; shuffleCheckbox.OnClick = () => Game.Settings.Sound.Shuffle ^= true; - + var repeatCheckbox = panel.GetWidget("REPEAT"); repeatCheckbox.IsChecked = () => Game.Settings.Sound.Repeat; repeatCheckbox.OnClick = () => Game.Settings.Sound.Repeat ^= true; - panel.GetWidget("TIME_LABEL").GetText = () => (currentSong == null) ? "" : + panel.GetWidget("TIME_LABEL").GetText = () => (currentSong == null) ? "" : "{0:D2}:{1:D2} / {2:D2}:{3:D2}".F((int)Sound.MusicSeekPosition / 60, (int)Sound.MusicSeekPosition % 60, currentSong.Length / 60, currentSong.Length % 60); panel.GetWidget("TITLE_LABEL").GetText = () => (currentSong == null) ? "" : currentSong.Title; - + var musicSlider = panel.GetWidget("MUSIC_SLIDER"); musicSlider.OnChange += x => Sound.MusicVolume = x; musicSlider.Value = Sound.MusicVolume; } - + void BuildMusicTable(Widget list) { music = Rules.Music.Where(a => a.Value.Exists).Select(a => a.Value).ToArray(); random = music.Shuffle(Game.CosmeticRandom).ToArray(); - + list.RemoveChildren(); foreach (var s in music) { var song = s; if (currentSong == null) currentSong = song; - + var item = ScrollItemWidget.Setup(itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }); item.GetWidget("TITLE").GetText = () => song.Title; item.GetWidget("LENGTH").GetText = () => SongLengthLabel(song); list.AddChild(item); } } - - + + void Play() { if (currentSong == null) return; - + Sound.PlayMusicThen(currentSong, () => { if (!Game.Settings.Sound.Repeat) currentSong = GetNextSong(); Play(); }); - + panel.GetWidget("BUTTON_PLAY").Visible = false; panel.GetWidget("BUTTON_PAUSE").Visible = true; } - + void Pause() { Sound.PauseMusic(); panel.GetWidget("BUTTON_PAUSE").Visible = false; panel.GetWidget("BUTTON_PLAY").Visible = true; } - + void Stop() { Sound.StopMusic(); panel.GetWidget("BUTTON_PAUSE").Visible = false; - panel.GetWidget("BUTTON_PLAY").Visible = true; + panel.GetWidget("BUTTON_PLAY").Visible = true; } - + string SongLengthLabel(MusicInfo song) { return "{0:D1}:{1:D2}".F(song.Length / 60, song.Length % 60); } - + MusicInfo GetNextSong() { if (!music.Any()) return null; - + var songs = Game.Settings.Sound.Shuffle ? random : music; return songs.SkipWhile(m => m != currentSong) .Skip(1).FirstOrDefault() ?? songs.FirstOrDefault(); @@ -177,14 +177,14 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { if (!music.Any()) return null; - + var songs = Game.Settings.Sound.Shuffle ? random : music; return songs.Reverse().SkipWhile(m => m != currentSong) .Skip(1).FirstOrDefault() ?? songs.Reverse().FirstOrDefault(); } } - - + + public class CncInstallMusicLogic { Widget panel; @@ -193,7 +193,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Action afterInstall; ButtonWidget retryButton, backButton; Widget installingContainer, insertDiskContainer; - + [ObjectCreator.UseCtor] public CncInstallMusicLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] Action afterInstall) @@ -202,18 +202,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic panel = widget.GetWidget("INSTALL_MUSIC_PANEL"); progressBar = panel.GetWidget("PROGRESS_BAR"); statusLabel = panel.GetWidget("STATUS_LABEL"); - + backButton = panel.GetWidget("BACK_BUTTON"); backButton.OnClick = Widget.CloseWindow; - + retryButton = panel.GetWidget("RETRY_BUTTON"); retryButton.OnClick = CheckForDisk; - + installingContainer = panel.GetWidget("INSTALLING"); insertDiskContainer = panel.GetWidget("INSERT_DISK"); CheckForDisk(); } - + void CheckForDisk() { Func ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") && @@ -230,7 +230,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic installingContainer.IsVisible = () => false; } } - + void Install(string source) { backButton.IsDisabled = () => true; @@ -240,34 +240,34 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var dest = new string[] { Platform.SupportDir, "Content", "cnc" }.Aggregate(Path.Combine); var copyFiles = new string[] { "SCORES.MIX" }; - + var extractPackage = "INSTALL/SETUP.Z"; var extractFiles = new string[] { "transit.mix" }; - + var installCounter = 0; var installTotal = copyFiles.Count() + extractFiles.Count(); - var onProgress = (Action)(s => Game.RunAfterTick(() => + var onProgress = (Action)(s => Game.RunAfterTick(() => { progressBar.Percentage = installCounter*100/installTotal; installCounter++; - + statusLabel.GetText = () => s; })); - - var onError = (Action)(s => Game.RunAfterTick(() => + + var onError = (Action)(s => Game.RunAfterTick(() => { statusLabel.GetText = () => "Error: "+s; backButton.IsDisabled = () => false; retryButton.IsDisabled = () => false; })); - + var t = new Thread( _ => { try { if (!InstallUtils.CopyFiles(source, copyFiles, dest, onProgress, onError)) return; - + if (!InstallUtils.ExtractFromPackage(source, extractPackage, extractFiles, dest, onProgress, onError)) return; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs index f5e3ac4e6e..c500f94dc7 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic perfRoot.GetWidget("PERF_GRAPH").IsVisible = () => Game.Settings.Debug.PerfGraph; var text = perfRoot.GetWidget("PERF_TEXT"); text.IsVisible = () => Game.Settings.Debug.PerfText; - text.GetText = () => + text.GetText = () => "Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F( Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs index cff52288c0..6f66f40171 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncReplayBrowserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs index faf39bfbbd..12afa2d042 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerBrowserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -16,7 +16,7 @@ using OpenRA.Network; using OpenRA.Widgets; namespace OpenRA.Mods.Cnc.Widgets.Logic -{ +{ public class CncServerBrowserLogic { GameServer currentServer; @@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Hidden } SearchStatus searchStatus = SearchStatus.Fetching; - + public string ProgressLabelText() { switch (searchStatus) @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { var panel = widget.GetWidget("SERVERBROWSER_PANEL"); var sl = panel.GetWidget("SERVER_LIST"); - + // Menu buttons var refreshButton = panel.GetWidget("REFRESH_BUTTON"); refreshButton.IsDisabled = () => refreshing; @@ -61,11 +61,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { searchStatus = SearchStatus.Fetching; sl.RemoveChildren(); - currentServer = null; + currentServer = null; ServerList.Query(games => RefreshServerList(panel, games)); refreshing = true; }; - + var join = panel.GetWidget("JOIN_BUTTON"); join.IsDisabled = () => currentServer == null || !ServerBrowserLogic.CanJoin(currentServer); join.OnClick = () => @@ -79,23 +79,23 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic Widget.CloseWindow(); CncConnectingLogic.Connect(host, port, openLobby, onExit); }; - + panel.GetWidget("BACK_BUTTON").OnClick = () => { Widget.CloseWindow(); onExit(); }; - + // Server list serverTemplate = sl.GetWidget("SERVER_TEMPLATE"); - + // Display the progress label over the server list // The text is only visible when the list is empty var progressText = panel.GetWidget("PROGRESS_LABEL"); progressText.IsVisible = () => searchStatus != SearchStatus.Hidden; progressText.GetText = ProgressLabelText; - + // Map preview var preview = panel.GetWidget("MAP_PREVIEW"); preview.Map = () => CurrentMap(); preview.IsVisible = () => CurrentMap() != null; - + // Server info var infoPanel = panel.GetWidget("SERVER_INFO"); infoPanel.IsVisible = () => currentServer != null; @@ -103,16 +103,16 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic infoPanel.GetWidget("SERVER_MODS").GetText = () => ServerBrowserLogic.GenerateModsLabel(currentServer); infoPanel.GetWidget("MAP_TITLE").GetText = () => (CurrentMap() != null) ? CurrentMap().Title : "Unknown"; infoPanel.GetWidget("MAP_PLAYERS").GetText = () => GetPlayersLabel(currentServer); - + refreshing = true; ServerList.Query(games => RefreshServerList(panel, games)); } - + string GetPlayersLabel(GameServer game) { if (game == null) return ""; - + var map = GetMap(game.Map); return map == null ? "{0}".F(currentServer.Players) : "{0} / {1}".F(currentServer.Players, map.PlayerCount); } @@ -121,18 +121,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic { return (currentServer == null) ? null : GetMap(currentServer.Map); } - + static Map GetMap(string uid) { return (!Game.modData.AvailableMaps.ContainsKey(uid)) ? null : Game.modData.AvailableMaps[uid]; } - + public void RefreshServerList(Widget panel, IEnumerable games) { refreshing = false; var sl = panel.GetWidget("SERVER_LIST"); - + sl.RemoveChildren(); currentServer = null; @@ -149,14 +149,14 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic searchStatus = SearchStatus.NoGames; return; } - + searchStatus = SearchStatus.Hidden; int i = 0; foreach (var loop in gamesWaiting) { var game = loop; - + var item = ScrollItemWidget.Setup(serverTemplate, () => currentServer == game, () => currentServer = game); item.GetWidget("TITLE").GetText = () => game.Name; // TODO: Use game.MapTitle once the server supports it @@ -182,7 +182,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var panel = widget.GetWidget("DIRECTCONNECT_PANEL"); var ipField = panel.GetWidget("IP"); var portField = panel.GetWidget("PORT"); - + var last = Game.Settings.Player.LastServer.Split(':').ToArray(); ipField.Text = last.Length > 1 ? last[0] : "localhost"; portField.Text = last.Length > 2 ? last[1] : "1234"; @@ -192,10 +192,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic int port; if (!int.TryParse(portField.Text, out port)) port = 1234; - + Game.Settings.Player.LastServer = "{0}:{1}".F(ipField.Text, port); Game.Settings.Save(); - + Widget.CloseWindow(); CncConnectingLogic.Connect(ipField.Text, port, openLobby, onExit); }; diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs index 725bcc05b0..c331fd5951 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncServerCreationLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs index ae12861c58..946b224926 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncSettingsLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ using OpenRA.Widgets; namespace OpenRA.Mods.Cnc.Widgets.Logic { public class CncSettingsLogic - { + { enum PanelType { General, Input } PanelType Settings = PanelType.General; @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic // Video var windowModeDropdown = generalPane.GetWidget("MODE_DROPDOWN"); windowModeDropdown.OnMouseDown = _ => SettingsMenuLogic.ShowWindowModeDropdown(windowModeDropdown, graphicsSettings); - windowModeDropdown.GetText = () => graphicsSettings.Mode == WindowMode.Windowed ? + windowModeDropdown.GetText = () => graphicsSettings.Mode == WindowMode.Windowed ? "Windowed" : graphicsSettings.Mode == WindowMode.Fullscreen ? "Fullscreen" : "Pseudo-Fullscreen"; var pixelDoubleCheckbox = generalPane.GetWidget("PIXELDOUBLE_CHECKBOX"); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs index 2f262ec6ba..a5a8597871 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var costString = "$: {0}".F(cost); costLabel.GetText = () => costString; - costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost + costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost ? Color.White : Color.Red; var leftWidth = Math.Max(font.Measure(tooltip.Name).X, requiresFont.Measure(requiresString).X); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs index 494ddbbc90..93ce65a9a4 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/SimpleTooltipLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs index c384acbfa1..27fa1c2617 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/SupportPowerTooltipLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs index 7996c8b8aa..606909e4e7 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/WorldTooltipLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var doubleHeight = 45; var singleHeight = 25; - tooltipContainer.BeforeRender = () => + tooltipContainer.BeforeRender = () => { if (wic == null || wic.TooltipType == Type.None) return; diff --git a/OpenRA.Mods.Cnc/Widgets/LogicTickerWidget.cs b/OpenRA.Mods.Cnc/Widgets/LogicTickerWidget.cs index e7cd9b1917..5aad99107f 100644 --- a/OpenRA.Mods.Cnc/Widgets/LogicTickerWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/LogicTickerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs index e7fed6f155..69edb27b9a 100755 --- a/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/PowerBarWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -63,22 +63,22 @@ namespace OpenRA.Mods.Cnc.Widgets color = Color.Orange; if (pm.PowerState == PowerState.Critical) color = Color.Red; - + var b = RenderBounds; var rect = new RectangleF(b.X, b.Y + (1-providedFrac)*b.Height, (float)b.Width, providedFrac*b.Height); Game.Renderer.LineRenderer.FillRect(rect, color); - + var indicator = ChromeProvider.GetImage("sidebar-bits", "left-indicator"); - + var drainedFrac = pm.PowerDrained / powerScaleBy; lastDrainedFrac = drainedFrac = float2.Lerp(lastDrainedFrac.GetValueOrDefault(drainedFrac), drainedFrac, .3f); - + float2 pos = new float2(b.X + b.Width - indicator.size.X, b.Y + (1-drainedFrac)*b.Height - indicator.size.Y / 2); - + Game.Renderer.RgbaSpriteRenderer.DrawSprite(indicator, pos); } } diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs index 1dd48f068e..aaef0f59c9 100755 --- a/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionPaletteWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -77,7 +77,7 @@ namespace OpenRA.Mods.Cnc.Widgets cantBuild = new Animation("clock"); cantBuild.PlayFetchIndex("idle", () => 0); clock = new Animation("clock"); - + iconSprites = Rules.Info.Values .Where(u => u.Traits.Contains() && u.Name[0] != '^') .ToDictionary( @@ -114,7 +114,7 @@ namespace OpenRA.Mods.Cnc.Widgets } public override bool HandleMouseInput(MouseInput mi) - { + { if (mi.Event == MouseInputEvent.Move) { var hover = Icons.Where(i => i.Key.Contains(mi.Location)) @@ -129,13 +129,13 @@ namespace OpenRA.Mods.Cnc.Widgets var clicked = Icons.Where(i => i.Key.Contains(mi.Location)) .Select(i => i.Value).FirstOrDefault(); - + if (clicked == null) return true; - + var actor = Rules.Info[clicked.Name]; var first = clicked.Queued.FirstOrDefault(); - + if (mi.Button == MouseButton.Left) { // Pick up a completed building @@ -155,7 +155,7 @@ namespace OpenRA.Mods.Cnc.Widgets { Sound.Play(TabClick); Sound.Play(CurrentQueue.Info.QueuedAudio); - world.IssueOrder(Order.StartProduction(CurrentQueue.self, clicked.Name, + world.IssueOrder(Order.StartProduction(CurrentQueue.self, clicked.Name, Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1)); } else @@ -223,7 +223,7 @@ namespace OpenRA.Mods.Cnc.Widgets var isBuildingSomething = CurrentQueue.CurrentItem() != null; var buildableItems = CurrentQueue.BuildableItems().OrderBy(a => a.Traits.Get().BuildPaletteOrder); - + // Background foreach (var rect in Icons.Keys) WidgetUtils.DrawPanel("panel-black", rect.InflateBy(1,1,1,1)); diff --git a/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs index 42ef4044c2..ee6d5fcdfc 100755 --- a/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ProductionTabsWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -119,7 +119,7 @@ namespace OpenRA.Mods.Cnc.Widgets SelectNextTab(false); } } - + public ProductionQueue CurrentQueue { get diff --git a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs index dffedb80c2..1c4de76b11 100755 --- a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -64,21 +64,21 @@ namespace OpenRA.Mods.Cnc.Widgets color = Color.Orange; if (pr.Ore == pr.OreCapacity) color = Color.Red; - + var b = RenderBounds; var rect = new RectangleF(b.X, b.Y + (1-capacityFrac)*b.Height, (float)b.Width, capacityFrac*b.Height); Game.Renderer.LineRenderer.FillRect(rect, color); - + var indicator = ChromeProvider.GetImage("sidebar-bits", "right-indicator"); - + var storedFrac = pr.Ore / scaleBy; lastStoredFrac = storedFrac = float2.Lerp(lastStoredFrac.GetValueOrDefault(storedFrac), storedFrac, .3f); - + float2 pos = new float2(b.X, b.Y + (1-storedFrac)*b.Height - indicator.size.Y / 2); - + Game.Renderer.RgbaSpriteRenderer.DrawSprite(indicator, pos); } } diff --git a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs index e36897de00..1dec1075a4 100755 --- a/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/SupportPowersWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs b/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs index 8432aae896..b1208c87ae 100644 --- a/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ToggleButtonWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/Widgets/TooltipContainerWidget.cs b/OpenRA.Mods.Cnc/Widgets/TooltipContainerWidget.cs index 6d5838cbc4..d51f7279e1 100755 --- a/OpenRA.Mods.Cnc/Widgets/TooltipContainerWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/TooltipContainerWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/WithFire.cs b/OpenRA.Mods.Cnc/WithFire.cs index c6d4408284..d94c8922a4 100644 --- a/OpenRA.Mods.Cnc/WithFire.cs +++ b/OpenRA.Mods.Cnc/WithFire.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.Cnc/WithRoof.cs b/OpenRA.Mods.Cnc/WithRoof.cs index 210adbff7e..6c32d788ee 100644 --- a/OpenRA.Mods.Cnc/WithRoof.cs +++ b/OpenRA.Mods.Cnc/WithRoof.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/AcceptsSupplies.cs b/OpenRA.Mods.RA/AcceptsSupplies.cs index 68289f2a8f..dcdc1d8e51 100644 --- a/OpenRA.Mods.RA/AcceptsSupplies.cs +++ b/OpenRA.Mods.RA/AcceptsSupplies.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Attack.cs b/OpenRA.Mods.RA/Activities/Attack.cs index b977f3b411..9f830960a2 100755 --- a/OpenRA.Mods.RA/Activities/Attack.cs +++ b/OpenRA.Mods.RA/Activities/Attack.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Activities Target = target; if (target.IsActor) targetable = target.Actor.TraitOrDefault(); - + Range = range; AllowMovement = allowMovement; } diff --git a/OpenRA.Mods.RA/Activities/CallFunc.cs b/OpenRA.Mods.RA/Activities/CallFunc.cs index 0c55263f81..c35b3ed193 100644 --- a/OpenRA.Mods.RA/Activities/CallFunc.cs +++ b/OpenRA.Mods.RA/Activities/CallFunc.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Activities this.a = a; this.interruptable = interruptable; } - + Action a; bool interruptable; diff --git a/OpenRA.Mods.RA/Activities/CaptureActor.cs b/OpenRA.Mods.RA/Activities/CaptureActor.cs index f2c87a69cc..727ffadc67 100644 --- a/OpenRA.Mods.RA/Activities/CaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/CaptureActor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Activities if (IsCanceled) return NextActivity; if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity; if (target.Owner == self.Owner) return NextActivity; - + if( !target.OccupiesSpace.OccupiedCells().Any( x => x.First == self.Location ) ) return NextActivity; @@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Activities w.Remove(target); target.Owner = self.Owner; w.Add(target); - + foreach (var t in target.TraitsImplementing()) t.OnCapture(target, self, oldOwner, self.Owner); diff --git a/OpenRA.Mods.RA/Activities/DeliverResources.cs b/OpenRA.Mods.RA/Activities/DeliverResources.cs index 72cc15b2ef..4257f8d8cf 100755 --- a/OpenRA.Mods.RA/Activities/DeliverResources.cs +++ b/OpenRA.Mods.RA/Activities/DeliverResources.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Activities var proc = harv.LinkedProc; var iao = proc.Trait(); - + self.SetTargetLine(Target.FromActor(proc), Color.Green, false); if( self.Location != proc.Location + iao.DeliverOffset ) return Util.SequenceActivities( mobile.MoveTo(proc.Location + iao.DeliverOffset, 0), this ); @@ -48,10 +48,10 @@ namespace OpenRA.Mods.RA.Activities isDocking = true; iao.OnDock(self, this); } - + return Util.SequenceActivities( new Wait(10), this ); } - + // Cannot be cancelled public override void Cancel(Actor self) { } } diff --git a/OpenRA.Mods.RA/Activities/Demolish.cs b/OpenRA.Mods.RA/Activities/Demolish.cs index 35148a4bb9..e908435fec 100644 --- a/OpenRA.Mods.RA/Activities/Demolish.cs +++ b/OpenRA.Mods.RA/Activities/Demolish.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA.Activities { Actor target; int delay; - + public Demolish( Actor target, int delay ) { this.target = target; @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Activities { if (IsCanceled) return NextActivity; if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity; - + if( !target.OccupiesSpace.OccupiedCells().Any( x => x.First == self.Location ) ) return NextActivity; diff --git a/OpenRA.Mods.RA/Activities/DonateSupplies.cs b/OpenRA.Mods.RA/Activities/DonateSupplies.cs index 98e76b719e..38c4e9f572 100644 --- a/OpenRA.Mods.RA/Activities/DonateSupplies.cs +++ b/OpenRA.Mods.RA/Activities/DonateSupplies.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,8 +20,8 @@ namespace OpenRA.Mods.RA.Activities Actor target; int payload; - public DonateSupplies(Actor target, int payload) - { + public DonateSupplies(Actor target, int payload) + { this.target = target; this.payload = payload; } @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Activities if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity; if (!target.OccupiesSpace.OccupiedCells().Any(x => x.First == self.Location)) return NextActivity; - + target.Owner.PlayerActor.Trait().GiveCash(payload); self.Destroy(); if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) diff --git a/OpenRA.Mods.RA/Activities/Enter.cs b/OpenRA.Mods.RA/Activities/Enter.cs index 19002bfb99..2a7f4ce093 100755 --- a/OpenRA.Mods.RA/Activities/Enter.cs +++ b/OpenRA.Mods.RA/Activities/Enter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/EnterTransport.cs b/OpenRA.Mods.RA/Activities/EnterTransport.cs index 2b9300591d..7779e73789 100644 --- a/OpenRA.Mods.RA/Activities/EnterTransport.cs +++ b/OpenRA.Mods.RA/Activities/EnterTransport.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,13 +30,13 @@ namespace OpenRA.Mods.RA.Activities var cargo = transport.Trait(); if (!cargo.HasSpace(1)) return NextActivity; - - + + // Todo: Queue a move order to the transport? need to be // careful about units that can't path to the transport if ((transport.Location - self.Location).LengthSquared > 2) return NextActivity; - + cargo.Load(transport, self); self.World.AddFrameEndTask(w => w.Remove(self)); diff --git a/OpenRA.Mods.RA/Activities/FindResources.cs b/OpenRA.Mods.RA/Activities/FindResources.cs index 0bf6eb3992..2e6e3320d5 100755 --- a/OpenRA.Mods.RA/Activities/FindResources.cs +++ b/OpenRA.Mods.RA/Activities/FindResources.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Follow.cs b/OpenRA.Mods.RA/Activities/Follow.cs index 000d74e41b..85d755bbb5 100644 --- a/OpenRA.Mods.RA/Activities/Follow.cs +++ b/OpenRA.Mods.RA/Activities/Follow.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Heal.cs b/OpenRA.Mods.RA/Activities/Heal.cs index b6eea8f0b4..b9f29d36d8 100755 --- a/OpenRA.Mods.RA/Activities/Heal.cs +++ b/OpenRA.Mods.RA/Activities/Heal.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Activities { if (Target.IsActor && Target.Actor.GetDamageState() == DamageState.Undamaged) return NextActivity; - + return base.InnerTick(self, attack); } } diff --git a/OpenRA.Mods.RA/Activities/Infiltrate.cs b/OpenRA.Mods.RA/Activities/Infiltrate.cs index 119013bff3..dd59d2c5aa 100644 --- a/OpenRA.Mods.RA/Activities/Infiltrate.cs +++ b/OpenRA.Mods.RA/Activities/Infiltrate.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/LayMines.cs b/OpenRA.Mods.RA/Activities/LayMines.cs index be7080ae03..98ee307b1b 100644 --- a/OpenRA.Mods.RA/Activities/LayMines.cs +++ b/OpenRA.Mods.RA/Activities/LayMines.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Leap.cs b/OpenRA.Mods.RA/Activities/Leap.cs index fa8a2cd027..a403bb227f 100644 --- a/OpenRA.Mods.RA/Activities/Leap.cs +++ b/OpenRA.Mods.RA/Activities/Leap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/MakeAnimation.cs b/OpenRA.Mods.RA/Activities/MakeAnimation.cs index c37a51ef26..ea3eb0026d 100644 --- a/OpenRA.Mods.RA/Activities/MakeAnimation.cs +++ b/OpenRA.Mods.RA/Activities/MakeAnimation.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,14 +22,14 @@ namespace OpenRA.Mods.RA.Activities readonly bool Reversed; readonly Action OnComplete; RenderBuilding rb; - + public MakeAnimation(Actor self, Action onComplete) : this(self, false, onComplete) {} public MakeAnimation(Actor self, bool reversed, Action onComplete) { Reversed = reversed; OnComplete = onComplete; } - + bool complete = false; bool started = false; public override Activity Tick( Actor self ) @@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA.Activities return this; } - + // Cannot be cancelled public override void Cancel( Actor self ) { } } diff --git a/OpenRA.Mods.RA/Activities/MoveAdjacentTo.cs b/OpenRA.Mods.RA/Activities/MoveAdjacentTo.cs index c54b187139..e872ae3a99 100755 --- a/OpenRA.Mods.RA/Activities/MoveAdjacentTo.cs +++ b/OpenRA.Mods.RA/Activities/MoveAdjacentTo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs index 111d5886a8..f0abb69307 100644 --- a/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs +++ b/OpenRA.Mods.RA/Activities/RAHarvesterDockSequence.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA Undock, Complete }; - + readonly Actor proc; readonly Harvester harv; readonly RenderUnit ru; @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA harv = self.Trait(); ru = self.Trait(); } - + public override Activity Tick(Actor self) { switch (state) diff --git a/OpenRA.Mods.RA/Activities/Rearm.cs b/OpenRA.Mods.RA/Activities/Rearm.cs index 1d14e46218..0191245917 100644 --- a/OpenRA.Mods.RA/Activities/Rearm.cs +++ b/OpenRA.Mods.RA/Activities/Rearm.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/RemoveSelf.cs b/OpenRA.Mods.RA/Activities/RemoveSelf.cs index 2267512954..2f0aa1c44b 100755 --- a/OpenRA.Mods.RA/Activities/RemoveSelf.cs +++ b/OpenRA.Mods.RA/Activities/RemoveSelf.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Repair.cs b/OpenRA.Mods.RA/Activities/Repair.cs index 80b6e48152..b28d5997e8 100644 --- a/OpenRA.Mods.RA/Activities/Repair.cs +++ b/OpenRA.Mods.RA/Activities/Repair.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/RepairBuilding.cs b/OpenRA.Mods.RA/Activities/RepairBuilding.cs index 98dcb9c06d..f3450b0a63 100644 --- a/OpenRA.Mods.RA/Activities/RepairBuilding.cs +++ b/OpenRA.Mods.RA/Activities/RepairBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Sell.cs b/OpenRA.Mods.RA/Activities/Sell.cs index 7bbd41b1c5..8a18578bee 100755 --- a/OpenRA.Mods.RA/Activities/Sell.cs +++ b/OpenRA.Mods.RA/Activities/Sell.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -13,7 +13,7 @@ using OpenRA.Traits; using OpenRA.Mods.RA.Effects; using OpenRA.Traits.Activities; using OpenRA.Mods.RA.Buildings; - + namespace OpenRA.Mods.RA.Activities { class Sell : Activity @@ -23,21 +23,21 @@ namespace OpenRA.Mods.RA.Activities var h = self.TraitOrDefault(); var si = self.Info.Traits.Get(); var pr = self.Owner.PlayerActor.Trait(); - + var cost = self.GetSellValue(); - - var refund = (cost * si.RefundPercent * (h == null ? 1 : h.HP)) / (100 * (h == null ? 1 : h.MaxHP)); + + var refund = (cost * si.RefundPercent * (h == null ? 1 : h.HP)) / (100 * (h == null ? 1 : h.MaxHP)); pr.GiveCash(refund); - + foreach (var ns in self.TraitsImplementing()) ns.Sold(self); if (refund > 0 && self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) self.World.AddFrameEndTask( - w => w.Add(new CashTick(refund, 30, 2, - self.CenterLocation, + w => w.Add(new CashTick(refund, 30, 2, + self.CenterLocation, self.Owner.ColorRamp.GetColor(0)))); - + self.Destroy(); return this; } diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index 8b66448ee3..559d7f4200 100755 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/Transform.cs b/OpenRA.Mods.RA/Activities/Transform.cs index d47895784d..3336124751 100644 --- a/OpenRA.Mods.RA/Activities/Transform.cs +++ b/OpenRA.Mods.RA/Activities/Transform.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Activities public int Facing = 96; public string[] Sounds = {}; public int ForceHealthPercentage = 0; - + public Transform(Actor self, string toActor) { this.ToActor = toActor; @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Activities public override Activity Tick( Actor self ) { if (IsCanceled) return NextActivity; - + self.World.AddFrameEndTask(w => { var selected = w.Selection.Contains(self); @@ -57,11 +57,11 @@ namespace OpenRA.Mods.RA.Activities init.Add( new HealthInit( (float)health.HP / health.MaxHP )); } var a = w.CreateActor( ToActor, init ); - + if (selected) w.Selection.Add(w, a); }); - + return this; } } diff --git a/OpenRA.Mods.RA/Activities/Turn.cs b/OpenRA.Mods.RA/Activities/Turn.cs index 0b787f2b10..0140b10c77 100755 --- a/OpenRA.Mods.RA/Activities/Turn.cs +++ b/OpenRA.Mods.RA/Activities/Turn.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Activities/UnloadCargo.cs b/OpenRA.Mods.RA/Activities/UnloadCargo.cs index 6818243b38..23f9fe8819 100644 --- a/OpenRA.Mods.RA/Activities/UnloadCargo.cs +++ b/OpenRA.Mods.RA/Activities/UnloadCargo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,12 +24,12 @@ namespace OpenRA.Mods.RA.Activities // is anyone still hogging this tile? if (self.World.ActorMap.GetUnitsAt(self.Location).Count() > 1) return null; - + var mobile = cargo.Trait(); for (var i = -1; i < 2; i++) for (var j = -1; j < 2; j++) - if ((i != 0 || j != 0) && + if ((i != 0 || j != 0) && mobile.CanEnterCell(self.Location + new int2(i, j))) return self.Location + new int2(i, j); @@ -59,7 +59,7 @@ namespace OpenRA.Mods.RA.Activities ru.PlayCustomAnimation(self, "unload", null); var exitTile = ChooseExitTile(self, cargo.Peek(self)); - if (exitTile == null) + if (exitTile == null) return this; var actor = cargo.Unload(self); diff --git a/OpenRA.Mods.RA/Activities/Wait.cs b/OpenRA.Mods.RA/Activities/Wait.cs index e35007294e..eb66cd697b 100644 --- a/OpenRA.Mods.RA/Activities/Wait.cs +++ b/OpenRA.Mods.RA/Activities/Wait.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Activities remainingTicks = period; this.interruptable = interruptable; } - + public override Activity Tick(Actor self) { return (remainingTicks-- == 0) ? NextActivity: this; diff --git a/OpenRA.Mods.RA/ActorExts.cs b/OpenRA.Mods.RA/ActorExts.cs index 59d9bf0290..9dedf3412b 100644 --- a/OpenRA.Mods.RA/ActorExts.cs +++ b/OpenRA.Mods.RA/ActorExts.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,25 +20,25 @@ namespace OpenRA.Mods.RA var spy = a.TraitOrDefault(); return spy != null && spy.Disguised; } - - public static bool AppearsFriendlyTo(this Actor self, Actor toActor) + + public static bool AppearsFriendlyTo(this Actor self, Actor toActor) { var stance = toActor.Owner.Stances[ self.Owner ]; if (stance == Stance.Ally) return true; - + if (self.IsDisguisedSpy() && !toActor.HasTrait()) return toActor.Owner.Stances[self.Trait().disguisedAsPlayer] == Stance.Ally; return stance == Stance.Ally; } - - public static bool AppearsHostileTo(this Actor self, Actor toActor) - { + + public static bool AppearsHostileTo(this Actor self, Actor toActor) + { var stance = toActor.Owner.Stances[ self.Owner ]; if (stance == Stance.Ally) return false; /* otherwise, we'll hate friendly disguised spies */ - + if (self.IsDisguisedSpy() && !toActor.HasTrait()) return toActor.Owner.Stances[self.Trait().disguisedAsPlayer] == Stance.Enemy; diff --git a/OpenRA.Mods.RA/ActorLostNotification.cs b/OpenRA.Mods.RA/ActorLostNotification.cs index ef2bfe6275..3d6e2c4b7c 100644 --- a/OpenRA.Mods.RA/ActorLostNotification.cs +++ b/OpenRA.Mods.RA/ActorLostNotification.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA { Info = info; } - + public void Killed(Actor self, AttackInfo e) { var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner; diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index e23f4a1fec..8d8e232ef1 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Air public DebugAircraftFacing(Actor self){ a = self.Trait(); } [Sync] public int foo { get { return a.Facing; } } } - + public class DebugAircraftSubPxXInfo : ITraitInfo, Requires { public object Create(ActorInitializer init) { return new DebugAircraftSubPxX(init.self); } @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Air public DebugAircraftSubPxX(Actor self){ a = self.Trait(); } [Sync] public int foo { get { return a.SubPxPosition.Y; } } } - + public class DebugAircraftSubPxYInfo : ITraitInfo, Requires { public object Create(ActorInitializer init) { return new DebugAircraftSubPxY(init.self); } @@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA.Air public DebugAircraftSubPxY(Actor self){ a = self.Trait(); } [Sync] public int foo { get { return a.SubPxPosition.Y; } } } - + public class DebugAircraftAltitudeInfo : ITraitInfo, Requires { public object Create(ActorInitializer init) { return new DebugAircraftAltitude(init.self); } @@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Air public DebugAircraftAltitude(Actor self){ a = self.Trait(); } [Sync] public int foo { get { return a.Altitude; } } } - + public class AircraftInfo : ITraitInfo, IFacingInfo { public readonly int CruiseAltitude = 30; @@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Air public class Aircraft : IMove, IFacing, IOccupySpace, ISync, INotifyKilled, IIssueOrder, IOrderVoice { public IDisposable reservation; - + public void UnReserve() { if (reservation != null) @@ -94,13 +94,13 @@ namespace OpenRA.Mods.RA.Air reservation = null; } } - + public void Killed(Actor self, AttackInfo e) { UnReserve(); } - - + + protected readonly Actor self; [Sync] public int Facing { get; set; } @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA.Air this.self = init.self; if( init.Contains() ) this.SubPxPosition = 1024 * Util.CenterOfCell( init.Get() ); - + this.Facing = init.Contains() ? init.Get() : info.InitialFacing; this.Altitude = init.Contains() ? init.Get() : 0; Info = info; @@ -142,7 +142,7 @@ namespace OpenRA.Mods.RA.Air } public int ROT { get { return Info.ROT; } } - + public int InitialFacing { get { return Info.InitialFacing; } } public void SetPosition(Actor self, int2 cell) @@ -176,7 +176,7 @@ namespace OpenRA.Mods.RA.Air return (int)ret; } } - + Pair[] noCells = new Pair[] { }; public IEnumerable> OccupiedCells() { return noCells; } diff --git a/OpenRA.Mods.RA/Air/AttackHeli.cs b/OpenRA.Mods.RA/Air/AttackHeli.cs index a3b9eb3b51..e0704dc6f3 100755 --- a/OpenRA.Mods.RA/Air/AttackHeli.cs +++ b/OpenRA.Mods.RA/Air/AttackHeli.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Air/AttackPlane.cs b/OpenRA.Mods.RA/Air/AttackPlane.cs index 24b0d04f78..cdbd9a0be1 100755 --- a/OpenRA.Mods.RA/Air/AttackPlane.cs +++ b/OpenRA.Mods.RA/Air/AttackPlane.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Air protected override bool CanAttack(Actor self, Target target) { // dont fire while landed - return base.CanAttack(self, target) + return base.CanAttack(self, target) && self.Trait().Altitude > 0; } } diff --git a/OpenRA.Mods.RA/Air/EjectOnDeath.cs b/OpenRA.Mods.RA/Air/EjectOnDeath.cs index d9dabe84fa..4091deacfe 100644 --- a/OpenRA.Mods.RA/Air/EjectOnDeath.cs +++ b/OpenRA.Mods.RA/Air/EjectOnDeath.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA public void Killed(Actor self, AttackInfo e) { var info = self.Info.Traits.Get(); - var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), + var pilot = self.World.CreateActor(false, info.PilotActor.ToLowerInvariant(), new TypeDictionary { new OwnerInit(self.Owner) }); var r = self.World.SharedRandom.Next(1, 100); var aircraft = self.Trait(); diff --git a/OpenRA.Mods.RA/Air/FallsToEarth.cs b/OpenRA.Mods.RA/Air/FallsToEarth.cs index b86c28f908..8071fddf52 100755 --- a/OpenRA.Mods.RA/Air/FallsToEarth.cs +++ b/OpenRA.Mods.RA/Air/FallsToEarth.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Air/Fly.cs b/OpenRA.Mods.RA/Air/Fly.cs index fdc88faa25..f8df421747 100755 --- a/OpenRA.Mods.RA/Air/Fly.cs +++ b/OpenRA.Mods.RA/Air/Fly.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Air public readonly int2 Pos; Fly( int2 px ) { Pos = px; } - + public static Fly ToPx( int2 px ) { return new Fly( px ); } public static Fly ToCell( int2 pos ) { return new Fly( Util.CenterOfCell( pos ) ); } diff --git a/OpenRA.Mods.RA/Air/FlyAttack.cs b/OpenRA.Mods.RA/Air/FlyAttack.cs index c4fb1369b4..9086ee23f7 100755 --- a/OpenRA.Mods.RA/Air/FlyAttack.cs +++ b/OpenRA.Mods.RA/Air/FlyAttack.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Air/FlyCircle.cs b/OpenRA.Mods.RA/Air/FlyCircle.cs index 4abe50ee4c..ee6bfe66c1 100644 --- a/OpenRA.Mods.RA/Air/FlyCircle.cs +++ b/OpenRA.Mods.RA/Air/FlyCircle.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Air/FlyTimed.cs b/OpenRA.Mods.RA/Air/FlyTimed.cs index d202a04583..761837e1a6 100755 --- a/OpenRA.Mods.RA/Air/FlyTimed.cs +++ b/OpenRA.Mods.RA/Air/FlyTimed.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Air/HeliAttack.cs b/OpenRA.Mods.RA/Air/HeliAttack.cs index 487328afd9..cb12843e33 100755 --- a/OpenRA.Mods.RA/Air/HeliAttack.cs +++ b/OpenRA.Mods.RA/Air/HeliAttack.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Air var reloads = self.TraitOrDefault(); if (limitedAmmo != null && !limitedAmmo.HasAmmo() && reloads == null) return Util.SequenceActivities( new HeliReturn(), NextActivity ); - + var aircraft = self.Trait(); var info = self.Info.Traits.Get(); if (aircraft.Altitude != info.CruiseAltitude) diff --git a/OpenRA.Mods.RA/Air/HeliFly.cs b/OpenRA.Mods.RA/Air/HeliFly.cs index c8e54f99cb..7a5e080c77 100755 --- a/OpenRA.Mods.RA/Air/HeliFly.cs +++ b/OpenRA.Mods.RA/Air/HeliFly.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Air aircraft.Altitude += Math.Sign(info.CruiseAltitude - aircraft.Altitude); return this; } - + var dist = Dest - aircraft.PxPosition; if (float2.WithinEpsilon(float2.Zero, dist, 2)) { diff --git a/OpenRA.Mods.RA/Air/HeliLand.cs b/OpenRA.Mods.RA/Air/HeliLand.cs index 3255b8d880..c91787bcfa 100755 --- a/OpenRA.Mods.RA/Air/HeliLand.cs +++ b/OpenRA.Mods.RA/Air/HeliLand.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Air if (requireSpace && !aircraft.CanLand(self.Location)) return this; - + --aircraft.Altitude; return this; } diff --git a/OpenRA.Mods.RA/Air/HeliReturn.cs b/OpenRA.Mods.RA/Air/HeliReturn.cs index 51880050f0..6251057020 100755 --- a/OpenRA.Mods.RA/Air/HeliReturn.cs +++ b/OpenRA.Mods.RA/Air/HeliReturn.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Air if (dest == null) return Util.SequenceActivities( - new Turn(initialFacing), + new Turn(initialFacing), new HeliLand(true), NextActivity); diff --git a/OpenRA.Mods.RA/Air/Helicopter.cs b/OpenRA.Mods.RA/Air/Helicopter.cs index 115c61e6f8..57907d396f 100755 --- a/OpenRA.Mods.RA/Air/Helicopter.cs +++ b/OpenRA.Mods.RA/Air/Helicopter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,11 +28,11 @@ namespace OpenRA.Mods.RA.Air HelicopterInfo Info; bool firstTick = true; - public Helicopter( ActorInitializer init, HelicopterInfo info) : base( init, info ) + public Helicopter( ActorInitializer init, HelicopterInfo info) : base( init, info ) { Info = info; } - + public void ResolveOrder(Actor self, Order order) { if (reservation != null) @@ -44,11 +44,11 @@ namespace OpenRA.Mods.RA.Air if (order.OrderString == "Move") { var target = self.World.ClampToWorld(order.TargetLocation); - + self.SetTargetLine(Target.FromCell(target), Color.Green); self.CancelActivity(); self.QueueActivity(new HeliFly(Util.CenterOfCell(target))); - + if (Info.LandWhenIdle) { self.QueueActivity(new Turn(Info.InitialFacing)); @@ -65,9 +65,9 @@ namespace OpenRA.Mods.RA.Air var exit = order.TargetActor.Info.Traits.WithInterface().FirstOrDefault(); var offset = exit != null ? exit.SpawnOffset : int2.Zero; - + self.SetTargetLine(Target.FromActor(order.TargetActor), Color.Green); - + self.CancelActivity(); self.QueueActivity(new HeliFly(order.TargetActor.Trait().PxPosition + offset)); self.QueueActivity(new Turn(Info.InitialFacing)); @@ -93,7 +93,7 @@ namespace OpenRA.Mods.RA.Air } } } - + public void Tick(Actor self) { if (firstTick) @@ -117,7 +117,7 @@ namespace OpenRA.Mods.RA.Air var aircraft = self.Trait(); if (aircraft.Altitude <= 0) return; - + var otherHelis = self.World.FindUnitsInCircle(self.CenterLocation, Info.IdealSeparation) .Where(a => a.HasTrait()); @@ -138,7 +138,7 @@ namespace OpenRA.Mods.RA.Air if( h.Trait().Altitude < Altitude ) return int2.Zero; var d = self.CenterLocation - h.CenterLocation; - + if (d.Length > Info.IdealSeparation) return int2.Zero; diff --git a/OpenRA.Mods.RA/Air/Land.cs b/OpenRA.Mods.RA/Air/Land.cs index af7c8b4ab7..e5cc46a90b 100755 --- a/OpenRA.Mods.RA/Air/Land.cs +++ b/OpenRA.Mods.RA/Air/Land.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,12 +20,12 @@ namespace OpenRA.Mods.RA.Air Target Target; public Land(Target t) { Target = t; } - + public override Activity Tick(Actor self) { if (!Target.IsValid) Cancel(self); - + if (IsCanceled) return NextActivity; var d = Target.CenterLocation - self.CenterLocation; diff --git a/OpenRA.Mods.RA/Air/Plane.cs b/OpenRA.Mods.RA/Air/Plane.cs index 4a6730972b..57df553b09 100755 --- a/OpenRA.Mods.RA/Air/Plane.cs +++ b/OpenRA.Mods.RA/Air/Plane.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Air { [Sync] public int2 RTBPathHash; - + public Plane( ActorInitializer init, PlaneInfo info ) : base( init, info ) { } bool firstTick = true; @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA.Air if (order.OrderString == "Move") { UnReserve(); - + var target = self.World.ClampToWorld(order.TargetLocation); self.SetTargetLine(Target.FromCell(target), Color.Green); self.CancelActivity(); diff --git a/OpenRA.Mods.RA/Air/ReturnOnIdle.cs b/OpenRA.Mods.RA/Air/ReturnOnIdle.cs index d907889e1d..d5cdfa0a02 100755 --- a/OpenRA.Mods.RA/Air/ReturnOnIdle.cs +++ b/OpenRA.Mods.RA/Air/ReturnOnIdle.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Air if (someBuilding == null) { - // ... going down the garden to eat worms ... + // ... going down the garden to eat worms ... self.QueueActivity(new FlyOffMap()); self.QueueActivity(new RemoveSelf()); return; diff --git a/OpenRA.Mods.RA/Air/ReturnToBase.cs b/OpenRA.Mods.RA/Air/ReturnToBase.cs index ca7370d1b1..16ac345d65 100755 --- a/OpenRA.Mods.RA/Air/ReturnToBase.cs +++ b/OpenRA.Mods.RA/Air/ReturnToBase.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Air { dest = ChooseAirfield(self); } - + var plane = self.Trait(); var res = dest.TraitOrDefault(); if (res != null) @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Air var aircraft = self.Trait(); var speed = .2f * aircraft.MovementSpeed; - + var approachStart = landPos - new float2(aircraft.Altitude * speed, 0); var turnRadius = (128f / self.Info.Traits.Get().ROT) * speed / (float)Math.PI; diff --git a/OpenRA.Mods.RA/Air/TargetableAircraft.cs b/OpenRA.Mods.RA/Air/TargetableAircraft.cs index e84b4b334c..dabda19e44 100755 --- a/OpenRA.Mods.RA/Air/TargetableAircraft.cs +++ b/OpenRA.Mods.RA/Air/TargetableAircraft.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Air public override string[] TargetTypes { - get { return (Aircraft.Altitude > 0) ? info.TargetTypes + get { return (Aircraft.Altitude > 0) ? info.TargetTypes : info.GroundedTargetTypes; } } } diff --git a/OpenRA.Mods.RA/AnnounceOnBuild.cs b/OpenRA.Mods.RA/AnnounceOnBuild.cs index 5f84a66a64..dc0641a12f 100644 --- a/OpenRA.Mods.RA/AnnounceOnBuild.cs +++ b/OpenRA.Mods.RA/AnnounceOnBuild.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -13,12 +13,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { public class AnnounceOnBuildInfo : ITraitInfo - { + { public object Create(ActorInitializer init) { return new AnnounceOnBuild(init.self); } } public class AnnounceOnBuild - { + { public AnnounceOnBuild(Actor self) { Sound.PlayVoice("Build", self, self.Owner.Country.Race); diff --git a/OpenRA.Mods.RA/AnnounceOnKill.cs b/OpenRA.Mods.RA/AnnounceOnKill.cs index a07e1a23b0..d213a2aa05 100644 --- a/OpenRA.Mods.RA/AnnounceOnKill.cs +++ b/OpenRA.Mods.RA/AnnounceOnKill.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -15,7 +15,7 @@ namespace OpenRA.Mods.RA public class AnnounceOnKillInfo : TraitInfo {} public class AnnounceOnKill : INotifyAppliedDamage - { + { public void AppliedDamage(Actor self, Actor damaged, AttackInfo e) { if (e.DamageState == DamageState.Dead) diff --git a/OpenRA.Mods.RA/AppearsOnRadar.cs b/OpenRA.Mods.RA/AppearsOnRadar.cs index c0fd369897..579d71c5f6 100755 --- a/OpenRA.Mods.RA/AppearsOnRadar.cs +++ b/OpenRA.Mods.RA/AppearsOnRadar.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -35,13 +35,13 @@ namespace OpenRA.Mods.RA else return self.OccupiesSpace.OccupiedCells().Select(c => c.First); } - + public Color RadarSignatureColor(Actor self) { var mod = self.TraitsImplementing().FirstOrDefault(); if (mod != null) return mod.RadarColorOverride(self); - + return self.Owner.ColorRamp.GetColor(0); } } diff --git a/OpenRA.Mods.RA/Attack/AttackBase.cs b/OpenRA.Mods.RA/Attack/AttackBase.cs index e041a3d6ab..b5408ff812 100644 --- a/OpenRA.Mods.RA/Attack/AttackBase.cs +++ b/OpenRA.Mods.RA/Attack/AttackBase.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -70,11 +70,11 @@ namespace OpenRA.Mods.RA Turrets.Add(new Turret(info.SecondaryOffset, info.SecondaryRecoilRecovery)); if (info.PrimaryWeapon != null) - Weapons.Add(new Weapon(info.PrimaryWeapon, + Weapons.Add(new Weapon(info.PrimaryWeapon, Turrets[0], info.PrimaryLocalOffset, info.PrimaryRecoil)); if (info.SecondaryWeapon != null) - Weapons.Add(new Weapon(info.SecondaryWeapon, + Weapons.Add(new Weapon(info.SecondaryWeapon, info.SecondaryOffset != null ? Turrets[1] : Turrets[0], info.SecondaryLocalOffset, info.SecondaryRecoil)); } @@ -83,11 +83,11 @@ namespace OpenRA.Mods.RA if (!target.IsValid) return false; if (Weapons.All(w => w.IsReloading)) return false; if (self.TraitsImplementing().Any(d => d.Disabled)) return false; - + if (target.IsActor && target.Actor.HasTrait() && !target.Actor.Trait().TargetableBy(target.Actor,self)) return false; - + return true; } @@ -169,7 +169,7 @@ namespace OpenRA.Mods.RA self.Trait().desiredFacing = null; } } - + public string VoicePhraseForOrder(Actor self, Order order) { return (order.OrderString == "Attack" || order.OrderString == "AttackHold") ? "Attack" : null; @@ -224,7 +224,7 @@ namespace OpenRA.Mods.RA { if (!self.World.Map.IsInMap(location)) return false; - + IsQueued = forceQueued; cursor = isHeal ? "heal" : "attack"; diff --git a/OpenRA.Mods.RA/Attack/AttackFrontal.cs b/OpenRA.Mods.RA/Attack/AttackFrontal.cs index 65b0c96514..0cedc7a0f7 100644 --- a/OpenRA.Mods.RA/Attack/AttackFrontal.cs +++ b/OpenRA.Mods.RA/Attack/AttackFrontal.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackLeap.cs b/OpenRA.Mods.RA/Attack/AttackLeap.cs index d4dc900d96..0c4edaafdd 100644 --- a/OpenRA.Mods.RA/Attack/AttackLeap.cs +++ b/OpenRA.Mods.RA/Attack/AttackLeap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackMedic.cs b/OpenRA.Mods.RA/Attack/AttackMedic.cs index 168ce16707..8f6da418a1 100644 --- a/OpenRA.Mods.RA/Attack/AttackMedic.cs +++ b/OpenRA.Mods.RA/Attack/AttackMedic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackOmni.cs b/OpenRA.Mods.RA/Attack/AttackOmni.cs index b5ec2db321..401e2b9155 100644 --- a/OpenRA.Mods.RA/Attack/AttackOmni.cs +++ b/OpenRA.Mods.RA/Attack/AttackOmni.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackPopupTurreted.cs b/OpenRA.Mods.RA/Attack/AttackPopupTurreted.cs index 7d892311f8..7405891d76 100644 --- a/OpenRA.Mods.RA/Attack/AttackPopupTurreted.cs +++ b/OpenRA.Mods.RA/Attack/AttackPopupTurreted.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackTesla.cs b/OpenRA.Mods.RA/Attack/AttackTesla.cs index 265d9ce063..b1168e81c9 100644 --- a/OpenRA.Mods.RA/Attack/AttackTesla.cs +++ b/OpenRA.Mods.RA/Attack/AttackTesla.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackTurreted.cs b/OpenRA.Mods.RA/Attack/AttackTurreted.cs index eb0de19de4..16ccb059a2 100644 --- a/OpenRA.Mods.RA/Attack/AttackTurreted.cs +++ b/OpenRA.Mods.RA/Attack/AttackTurreted.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Attack/AttackWander.cs b/OpenRA.Mods.RA/Attack/AttackWander.cs index 4920d44f0a..2d073e8125 100644 --- a/OpenRA.Mods.RA/Attack/AttackWander.cs +++ b/OpenRA.Mods.RA/Attack/AttackWander.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA class AttackWanderInfo : ITraitInfo { public readonly int MoveRadius = 4; - + public object Create(ActorInitializer init) { return new AttackWander(init.self, this); } } @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA { Info = info; } - + public void TickIdle(Actor self) { var target = Util.SubPxVector[self.World.SharedRandom.Next(255)]* Info.MoveRadius / 1024 + self.Location; diff --git a/OpenRA.Mods.RA/AttackMove.cs b/OpenRA.Mods.RA/AttackMove.cs index 9e292f610f..f70f54c710 100644 --- a/OpenRA.Mods.RA/AttackMove.cs +++ b/OpenRA.Mods.RA/AttackMove.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,45 +19,45 @@ namespace OpenRA.Mods.RA class AttackMoveInfo : ITraitInfo { public readonly bool JustMove = false; - + public object Create(ActorInitializer init) { return new AttackMove(init.self, this); } } class AttackMove : IResolveOrder, IOrderVoice, INotifyIdle, ISync { [Sync] public int2 _targetLocation { get { return TargetLocation.HasValue ? TargetLocation.Value : int2.Zero; } } - public int2? TargetLocation = null; - + public int2? TargetLocation = null; + readonly Mobile mobile; readonly AttackMoveInfo Info; - + public AttackMove(Actor self, AttackMoveInfo info) { Info = info; mobile = self.Trait(); } - + public string VoicePhraseForOrder(Actor self, Order order) { if (order.OrderString == "AttackMove") return "AttackMove"; return null; } - - + + void Activate(Actor self) { self.CancelActivity(); self.QueueActivity(new AttackMoveActivity(mobile.MoveTo(TargetLocation.Value, 1))); self.SetTargetLine(Target.FromCell(TargetLocation.Value), Color.Red); } - + public void TickIdle(Actor self) { if (TargetLocation.HasValue) Activate(self); } - + public void ResolveOrder(Actor self, Order order) { TargetLocation = null; @@ -77,9 +77,9 @@ namespace OpenRA.Mods.RA { Activity inner; int scanTicks; - + const int ScanInterval = 7; - + public AttackMoveActivity( Activity inner ) { this.inner = inner; } public override Activity Tick( Actor self ) @@ -92,9 +92,9 @@ namespace OpenRA.Mods.RA if( inner == null ) return NextActivity; - + inner = Util.RunActivity( self, inner ); - + return this; } diff --git a/OpenRA.Mods.RA/AutoHeal.cs b/OpenRA.Mods.RA/AutoHeal.cs index d78c4757f6..ec211dc8c0 100644 --- a/OpenRA.Mods.RA/AutoHeal.cs +++ b/OpenRA.Mods.RA/AutoHeal.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA .Where(a => a.GetDamageState() > DamageState.Undamaged) .Where(a => attack.HasAnyValidWeapons(Target.FromActor(a))) .ClosestTo( self.CenterLocation ); - + if( target != null ) self.QueueActivity(attack.GetAttackActivity(self, Target.FromActor( target ), false )); } diff --git a/OpenRA.Mods.RA/AutoTarget.cs b/OpenRA.Mods.RA/AutoTarget.cs index 5b38fa2b94..2e55548538 100644 --- a/OpenRA.Mods.RA/AutoTarget.cs +++ b/OpenRA.Mods.RA/AutoTarget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA { public readonly bool AllowMovement = true; public readonly int ScanRadius = -1; - + public object Create(ActorInitializer init) { return new AutoTarget(init.self, this); } } @@ -27,16 +27,16 @@ namespace OpenRA.Mods.RA { readonly AutoTargetInfo Info; readonly AttackBase attack; - + [Sync] int nextScanTime = 0; - + public AutoTarget(Actor self, AutoTargetInfo info) { Info = info; attack = self.Trait(); } - + public void Damaged(Actor self, AttackInfo e) { if (!self.IsIdle) return; @@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA Info.AllowMovement)); } } - + public void Tick(Actor self) { --nextScanTime; @@ -74,14 +74,14 @@ namespace OpenRA.Mods.RA public Actor ScanForTarget(Actor self, Actor currentTarget) { var range = Info.ScanRadius > 0 ? Info.ScanRadius : attack.GetMaximumRange(); - + if (self.IsIdle || currentTarget == null || !Combat.IsInRange(self.CenterLocation, range, currentTarget)) if(nextScanTime <= 0) return ChooseTarget(self, range); return currentTarget; } - + public void ScanAndAttack(Actor self, bool allowMovement, bool holdStill) { var targetActor = ScanForTarget(self, null); diff --git a/OpenRA.Mods.RA/BaseBuilding.cs b/OpenRA.Mods.RA/BaseBuilding.cs index 59384284e6..128dda6522 100644 --- a/OpenRA.Mods.RA/BaseBuilding.cs +++ b/OpenRA.Mods.RA/BaseBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/BelowUnits.cs b/OpenRA.Mods.RA/BelowUnits.cs index e39597e5a2..c6336de911 100644 --- a/OpenRA.Mods.RA/BelowUnits.cs +++ b/OpenRA.Mods.RA/BelowUnits.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Bridge.cs b/OpenRA.Mods.RA/Bridge.cs index ffe7ed7257..d6d5e94139 100644 --- a/OpenRA.Mods.RA/Bridge.cs +++ b/OpenRA.Mods.RA/Bridge.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,17 +20,17 @@ namespace OpenRA.Mods.RA class BridgeInfo : ITraitInfo, Requires { public readonly bool Long = false; - - + + public readonly ushort Template = 0; public readonly ushort DamagedTemplate = 0; public readonly ushort DestroyedTemplate = 0; - + // For long bridges public readonly ushort DestroyedPlusNorthTemplate = 0; public readonly ushort DestroyedPlusSouthTemplate = 0; public readonly ushort DestroyedPlusBothTemplate = 0; - + public readonly string[] ShorePieces = {"br1", "br2"}; public readonly int[] NorthOffset = null; public readonly int[] SouthOffset = null; @@ -70,13 +70,13 @@ namespace OpenRA.Mods.RA Dictionary> TileSprites = new Dictionary>(); Dictionary Templates = new Dictionary(); ushort currentTemplate; - + Actor self; BridgeInfo Info; public string Type; Bridge northNeighbour, southNeighbour; Health Health; - + public Bridge(Actor self, BridgeInfo info) { this.self = self; @@ -89,7 +89,7 @@ namespace OpenRA.Mods.RA public void Create(ushort template, Dictionary subtiles) { currentTemplate = template; - + // Create a new cache to store the tile data if (cachedTileset != self.World.Map.Tileset) { @@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA x => Game.modData.SheetBuilder.Add(self.World.TileSet.GetBytes(x), new Size(Game.CellSize, Game.CellSize))); } - + // Cache templates and tiles for the different states foreach (var t in Info.Templates) { @@ -112,14 +112,14 @@ namespace OpenRA.Mods.RA foreach (var c in TileSprites[currentTemplate].Keys) self.World.Map.CustomTerrain[c.X, c.Y] = GetTerrainType(c); } - + public string GetTerrainType(int2 cell) { var dx = cell - self.Location; var index = dx.X + Templates[currentTemplate].Size.X*dx.Y; return self.World.TileSet.GetTerrainType(new TileReference(currentTemplate,(byte)index)); } - + public void LinkNeighbouringBridges(World world, BridgeLayer bridges) { // go looking for our neighbors if this is a long bridge. @@ -128,7 +128,7 @@ namespace OpenRA.Mods.RA if (Info.SouthOffset != null) southNeighbour = GetNeighbor(Info.SouthOffset, bridges); } - + public Bridge GetNeighbor(int[] offset, BridgeLayer bridges) { if (offset == null) return null; @@ -140,7 +140,7 @@ namespace OpenRA.Mods.RA foreach (var t in TileSprites[currentTemplate]) yield return new Renderable(t.Value, Game.CellSize * t.Key, "terrain", Game.CellSize * t.Key.Y); } - + bool IsIntact(Bridge b) { return b != null && !b.self.IsDead(); @@ -153,10 +153,10 @@ namespace OpenRA.Mods.RA if (a.HasTrait() && !a.Trait().CanEnterCell(c)) a.Kill(self); } - + bool dead = false; void UpdateState() - { + { // If this is a long bridge next to a destroyed shore piece, we need die to give clean edges to the break if (Info.Long && Health.DamageState != DamageState.Dead && ((southNeighbour != null && Info.ShorePieces.Contains(southNeighbour.Type) && !IsIntact(southNeighbour)) || diff --git a/OpenRA.Mods.RA/BridgeLayer.cs b/OpenRA.Mods.RA/BridgeLayer.cs index c5f00d2439..c3f8c30367 100644 --- a/OpenRA.Mods.RA/BridgeLayer.cs +++ b/OpenRA.Mods.RA/BridgeLayer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA readonly World world; Dictionary> BridgeTypes = new Dictionary>(); Bridge[,] Bridges; - + public BridgeLayer(Actor self, BridgeLayerInfo Info) { this.Info = Info; @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA public void WorldLoaded(World w) { Bridges = new Bridge[w.Map.MapSize.X, w.Map.MapSize.Y]; - + // Build a list of templates that should be overlayed with bridges foreach(var bridge in Info.Bridges) { @@ -47,31 +47,31 @@ namespace OpenRA.Mods.RA foreach (var template in bi.Templates) BridgeTypes.Add(template.First, Pair.New(bridge, template.Second)); } - + // Loop through the map looking for templates to overlay for (int i = w.Map.Bounds.Left; i < w.Map.Bounds.Right; i++) for (int j = w.Map.Bounds.Top; j < w.Map.Bounds.Bottom; j++) if (BridgeTypes.Keys.Contains(w.Map.MapTiles.Value[i, j].type)) ConvertBridgeToActor(w, i, j); - + // Link adjacent (long)-bridges so that artwork is updated correctly foreach (var b in w.Actors.SelectMany(a => a.TraitsImplementing())) b.LinkNeighbouringBridges(w,this); } - + void ConvertBridgeToActor(World w, int i, int j) - { + { // This cell already has a bridge overlaying it from a previous iteration if (Bridges[i,j] != null) return; - + // Correlate the tile "image" aka subtile with its position to find the template origin var tile = w.Map.MapTiles.Value[i, j].type; var index = w.Map.MapTiles.Value[i, j].index; var template = w.TileSet.Templates[tile]; var ni = i - index % template.Size.X; var nj = j - index / template.Size.X; - + // Create a new actor for this bridge and keep track of which subtiles this bridge includes var bridge = w.CreateActor(BridgeTypes[tile].First, new TypeDictionary { @@ -79,36 +79,36 @@ namespace OpenRA.Mods.RA new OwnerInit( w.WorldActor.Owner ), new HealthInit( BridgeTypes[tile].Second ), }).Trait(); - + Dictionary subTiles = new Dictionary(); - + // For each subtile in the template for (byte ind = 0; ind < template.Size.X*template.Size.Y; ind++) { // Is this tile actually included in the bridge template? if (!template.Tiles.Keys.Contains(ind)) continue; - - // Where do we expect to find the subtile + + // Where do we expect to find the subtile var x = ni + ind % template.Size.X; var y = nj + ind / template.Size.X; - + // This isn't the bridge you're looking for if (!w.Map.IsInMap(x, y) || w.Map.MapTiles.Value[x, y].index != ind) continue; - + subTiles.Add(new int2(x,y),ind); Bridges[x,y] = bridge; } bridge.Create(tile, subTiles); } - + // Used to check for neighbouring bridges public Bridge GetBridge(int2 cell) { if (!world.Map.IsInMap(cell.X, cell.Y)) return null; - + return Bridges[ cell.X, cell.Y ]; } } diff --git a/OpenRA.Mods.RA/Buildable.cs b/OpenRA.Mods.RA/Buildable.cs index 2b6c1edbe5..9a8bca0c3d 100755 --- a/OpenRA.Mods.RA/Buildable.cs +++ b/OpenRA.Mods.RA/Buildable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,9 +17,9 @@ namespace OpenRA.Mods.RA public readonly string[] Prerequisites = { }; [ActorReference] public readonly string[] BuiltAt = { }; - + public readonly string[] Owner = { }; - + public readonly string Queue; public readonly bool Hidden = false; diff --git a/OpenRA.Mods.RA/BuildingCaptureNotification.cs b/OpenRA.Mods.RA/BuildingCaptureNotification.cs index 9ad55db76a..67b23c3ab5 100644 --- a/OpenRA.Mods.RA/BuildingCaptureNotification.cs +++ b/OpenRA.Mods.RA/BuildingCaptureNotification.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,15 +27,15 @@ namespace OpenRA.Mods.RA { Info = info; } - + public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) { if (captor.World.LocalPlayer != captor.Owner) return; - + if (Info.Race != null && Info.Race != oldOwner.Country.Race) return; - + Sound.PlayToPlayer(captor.World.LocalPlayer, Info.Notification); } } diff --git a/OpenRA.Mods.RA/Buildings/BibLayer.cs b/OpenRA.Mods.RA/Buildings/BibLayer.cs index 76e6ca8e45..d5b3859a19 100755 --- a/OpenRA.Mods.RA/Buildings/BibLayer.cs +++ b/OpenRA.Mods.RA/Buildings/BibLayer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,42 +26,42 @@ namespace OpenRA.Mods.RA.Buildings } class BibLayer: IRenderOverlay, IWorldLoaded - { + { World world; BibLayerInfo info; Dictionary> tiles; Sprite[][] bibSprites; - + public BibLayer(Actor self, BibLayerInfo info) { this.info = info; bibSprites = info.BibTypes.Select(x => Game.modData.SpriteLoader.LoadAllSprites(x)).ToArray(); - + self.World.ActorAdded += a => { if (a.HasTrait()) DoBib(a,true); }; self.World.ActorRemoved += a => { if (a.HasTrait()) DoBib(a,false); }; } - + public void WorldLoaded(World w) { world = w; tiles = new Dictionary>(); } - + public void DoBib(Actor b, bool isAdd) { - var buildingInfo = b.Info.Traits.Get(); + var buildingInfo = b.Info.Traits.Get(); var size = buildingInfo.Dimensions.X; var bibOffset = buildingInfo.Dimensions.Y - 1; - + int bib = Array.IndexOf(info.BibWidths,size); if (bib < 0) { Log.Write("debug", "Cannot bib {0}-wide building {1}", size, b.Info.Name); return; } - + for (int i = 0; i < 2 * size; i++) { var p = b.Location + new int2(i % size, i / size + bibOffset); @@ -87,7 +87,7 @@ namespace OpenRA.Mods.RA.Buildings } } } - + public class BibInfo : TraitInfo { } public class Bib { } } diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 65a4283758..46e578b167 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Buildings public readonly int Adjacent = 2; public readonly string Footprint = "x"; public readonly int2 Dimensions = new int2(1, 1); - + public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"}; public readonly string[] SellSounds = {"cashturn.aud"}; @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Buildings var nearnessCandidates = new List(); var bi = world.WorldActor.Trait(); - + for( int y = scanStart.Y ; y < scanEnd.Y ; y++ ) for( int x = scanStart.X ; x < scanEnd.X ; x++ ) { @@ -76,26 +76,26 @@ namespace OpenRA.Mods.RA.Buildings public int2 TopLeft { get { return topLeft; } } public int2 PxPosition { get { return pxPosition; } } - + public IEnumerable ProvidesPrerequisites { get { yield return self.Info.Name; } } - + public Building(ActorInitializer init, BuildingInfo info) { this.self = init.self; this.topLeft = init.Get(); this.Info = info; this.PlayerPower = init.self.Owner.PlayerActor.Trait(); - + occupiedCells = FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft ) .Select(c => Pair.New(c, SubCell.FullCell)).ToArray(); pxPosition = ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2; } - + public int GetPowerUsage() { if (Info.Power <= 0) return Info.Power; - + var health = self.TraitOrDefault(); return health != null ? (Info.Power * health.HP / health.MaxHP) : Info.Power; } diff --git a/OpenRA.Mods.RA/Buildings/BuildingInfluence.cs b/OpenRA.Mods.RA/Buildings/BuildingInfluence.cs index 77d5764ceb..8b011c3ed2 100755 --- a/OpenRA.Mods.RA/Buildings/BuildingInfluence.cs +++ b/OpenRA.Mods.RA/Buildings/BuildingInfluence.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Buildings/CanPowerDown.cs b/OpenRA.Mods.RA/Buildings/CanPowerDown.cs index 03b6bce06e..b5b7380415 100755 --- a/OpenRA.Mods.RA/Buildings/CanPowerDown.cs +++ b/OpenRA.Mods.RA/Buildings/CanPowerDown.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,14 +24,14 @@ namespace OpenRA.Mods.RA.Buildings bool disabled = false; int normalPower = 0; PowerManager PowerManager; - + public CanPowerDown(ActorInitializer init) { PowerManager = init.self.Owner.PlayerActor.Trait(); normalPower = init.self.Info.Traits.Get().Power; } public bool Disabled { get { return disabled; } } - + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "PowerDown") @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Buildings disabled = !disabled; var eva = self.World.WorldActor.Info.Traits.Get(); Sound.PlayToPlayer(self.Owner, disabled ? eva.EnablePower : eva.DisablePower); - + PowerManager.UpdateActor(self, disabled ? 0 : normalPower); if (disabled) @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Buildings w => w.Add(new PowerdownIndicator(self))); } } - + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { PowerManager = newOwner.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Buildings/CustomSellValue.cs b/OpenRA.Mods.RA/Buildings/CustomSellValue.cs index 7a6296d075..989791da50 100755 --- a/OpenRA.Mods.RA/Buildings/CustomSellValue.cs +++ b/OpenRA.Mods.RA/Buildings/CustomSellValue.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,12 +26,12 @@ namespace OpenRA.Mods.RA.Buildings { public static int GetSellValue( this Actor a ) { - var csv = a.Info.Traits.GetOrDefault(); + var csv = a.Info.Traits.GetOrDefault(); if (csv != null) return csv.Value; var valued = a.Info.Traits.GetOrDefault(); if (valued != null) return valued.Cost; - + return 0; } } diff --git a/OpenRA.Mods.RA/Buildings/FootprintUtils.cs b/OpenRA.Mods.RA/Buildings/FootprintUtils.cs index 8cd18e9012..7f93ef2029 100755 --- a/OpenRA.Mods.RA/Buildings/FootprintUtils.cs +++ b/OpenRA.Mods.RA/Buildings/FootprintUtils.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Buildings var dim = buildingInfo.Dimensions; var footprint = buildingInfo.Footprint.Where(x => !char.IsWhiteSpace(x)); - + if (Rules.Info[ name ].Traits.Contains()) { dim.Y += 1; diff --git a/OpenRA.Mods.RA/Buildings/LineBuild.cs b/OpenRA.Mods.RA/Buildings/LineBuild.cs index 3ea1de0393..2b949f977c 100755 --- a/OpenRA.Mods.RA/Buildings/LineBuild.cs +++ b/OpenRA.Mods.RA/Buildings/LineBuild.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Buildings/PowerManager.cs b/OpenRA.Mods.RA/Buildings/PowerManager.cs index 226c974ba2..3bbef31542 100755 --- a/OpenRA.Mods.RA/Buildings/PowerManager.cs +++ b/OpenRA.Mods.RA/Buildings/PowerManager.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Buildings PowerManagerInfo Info; Player Player; DeveloperMode devMode; - + Dictionary PowerDrain = new Dictionary(); [Sync] int totalProvided; public int PowerProvided { get { return totalProvided; } } @@ -38,14 +38,14 @@ namespace OpenRA.Mods.RA.Buildings { Info = info; Player = init.self.Owner; - + init.world.ActorAdded += ActorAdded; init.world.ActorRemoved += ActorRemoved; devMode = init.self.Trait(); wasHackEnabled = devMode.UnlimitedPower; } - + void ActorAdded(Actor a) { if (a.Owner != Player || !a.HasTrait()) @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Buildings PowerDrain.Add(a, a.Trait().GetPowerUsage()); UpdateTotals(); } - + void ActorRemoved(Actor a) { if (a.Owner != Player || !a.HasTrait()) @@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA.Buildings PowerDrain.Remove(a); UpdateTotals(); } - + void UpdateTotals() { totalProvided = 0; @@ -78,16 +78,16 @@ namespace OpenRA.Mods.RA.Buildings if (devMode.UnlimitedPower) totalProvided = 1000000; } - + public void UpdateActor(Actor a, int newPower) { if (a.Owner != Player || !a.HasTrait()) return; - + PowerDrain[a] = newPower; UpdateTotals(); } - + int nextPowerAdviceTime = 0; bool wasLowPower = false; bool wasHackEnabled; @@ -104,16 +104,16 @@ namespace OpenRA.Mods.RA.Buildings if (lowPower && !wasLowPower) nextPowerAdviceTime = 0; wasLowPower = lowPower; - + if (--nextPowerAdviceTime <= 0) { if (lowPower) Player.GiveAdvice(Rules.Info["world"].Traits.Get().LowPower); - + nextPowerAdviceTime = Info.AdviceInterval; } } - + public PowerState PowerState { get { diff --git a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs index a3d24fc7b4..534c8a2ea9 100755 --- a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Buildings/RequiresPower.cs b/OpenRA.Mods.RA/Buildings/RequiresPower.cs index 7e7f9561be..10151e9899 100755 --- a/OpenRA.Mods.RA/Buildings/RequiresPower.cs +++ b/OpenRA.Mods.RA/Buildings/RequiresPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Buildings { get { return power.PowerProvided < power.PowerDrained; } } - + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { power = newOwner.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs b/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs index b7816442b6..e7a39839b8 100644 --- a/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs +++ b/OpenRA.Mods.RA/Buildings/ShakeOnDeath.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Buildings { this.Info = info; } - + public void Killed(Actor self, AttackInfo e) { self.World.WorldActor.Trait().AddEffect(Info.Intensity, self.CenterLocation, 1); diff --git a/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs b/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs index f32b2233fc..7ca74a2237 100644 --- a/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs +++ b/OpenRA.Mods.RA/Buildings/SoundOnDamageTransition.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Render { public readonly string DamagedSound; public readonly string DestroyedSound; - + public object Create(ActorInitializer init) { return new SoundOnDamageTransition(this);} } diff --git a/OpenRA.Mods.RA/Buildings/TechTree.cs b/OpenRA.Mods.RA/Buildings/TechTree.cs index c1d6dffbaf..b35254d5f3 100755 --- a/OpenRA.Mods.RA/Buildings/TechTree.cs +++ b/OpenRA.Mods.RA/Buildings/TechTree.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,20 +30,20 @@ namespace OpenRA.Mods.RA.Buildings init.world.ActorAdded += ActorChanged; init.world.ActorRemoved += ActorChanged; } - + public void ActorChanged(Actor a) { if (a.Owner == player && a.HasTrait()) Update(); } - + public void Update() { var buildings = GatherBuildings(player); foreach(var w in watchers) w.Update(buildings); } - + public void Add(string key, List prerequisites, ITechTreeElement tte) { watchers.Add(new Watcher( key, prerequisites, tte )); @@ -53,22 +53,22 @@ namespace OpenRA.Mods.RA.Buildings { watchers.RemoveAll(x => x.key == key); } - + static Cache> GatherBuildings( Player player ) { var ret = new Cache>( x => new List() ); if (player == null) return ret; - + foreach (var b in player.World.ActorsWithTrait() .Where(a => a.Actor.IsInWorld && !a.Actor.IsDead() && a.Actor.Owner == player)) foreach (var p in b.Trait.ProvidesPrerequisites) ret[ p ].Add( b.Actor ); - + return ret; } - + class Watcher { public readonly string key; @@ -76,7 +76,7 @@ namespace OpenRA.Mods.RA.Buildings public readonly List prerequisites; public readonly ITechTreeElement watcher; bool hasPrerequisites; - + public Watcher(string key, List prerequisites, ITechTreeElement watcher) { this.key = key; @@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA.Buildings } public void Update(Cache> buildings) - { + { var nowHasPrerequisites = true; foreach (var p in prerequisites) if (!buildings.Keys.Contains(p)) @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Buildings nowHasPrerequisites = false; break; } - + if( nowHasPrerequisites && !hasPrerequisites ) watcher.PrerequisitesAvailable(key); @@ -111,12 +111,12 @@ namespace OpenRA.Mods.RA.Buildings void PrerequisitesAvailable(string key); void PrerequisitesUnavailable(string key); } - + public interface ITechTreePrerequisite { IEnumerable ProvidesPrerequisites {get;} } - + public class ProvidesCustomPrerequisiteInfo : ITraitInfo { public string Prerequisite; diff --git a/OpenRA.Mods.RA/Buildings/Util.cs b/OpenRA.Mods.RA/Buildings/Util.cs index c8c743bdfd..14492b7e9c 100755 --- a/OpenRA.Mods.RA/Buildings/Util.cs +++ b/OpenRA.Mods.RA/Buildings/Util.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,12 +20,12 @@ namespace OpenRA.Mods.RA.Buildings { return world.IsCellBuildable(a, bi, null); } - + public static bool IsCellBuildable(this World world, int2 a, BuildingInfo bi, Actor toIgnore) { if (world.WorldActor.Trait().GetBuildingAt(a) != null) return false; if (world.ActorMap.GetUnitsAt(a).Any(b => b != toIgnore)) return false; - + return world.Map.IsInMap(a) && bi.TerrainTypes.Contains(world.GetTerrainType(a)); } diff --git a/OpenRA.Mods.RA/Buildings/Wall.cs b/OpenRA.Mods.RA/Buildings/Wall.cs index d00f39d4d9..f27e23e3ba 100755 --- a/OpenRA.Mods.RA/Buildings/Wall.cs +++ b/OpenRA.Mods.RA/Buildings/Wall.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Buildings { readonly Actor self; readonly WallInfo info; - + public Wall(Actor self, WallInfo info) { this.self = self; diff --git a/OpenRA.Mods.RA/Burns.cs b/OpenRA.Mods.RA/Burns.cs index 2fa9963ce2..11a7c51310 100644 --- a/OpenRA.Mods.RA/Burns.cs +++ b/OpenRA.Mods.RA/Burns.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA [Sync] int ticks; BurnsInfo Info; - + public Burns(Actor self, BurnsInfo info) { Info = info; diff --git a/OpenRA.Mods.RA/C4Demolition.cs b/OpenRA.Mods.RA/C4Demolition.cs index fe53ccfa90..8178c6be10 100644 --- a/OpenRA.Mods.RA/C4Demolition.cs +++ b/OpenRA.Mods.RA/C4Demolition.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,12 +28,12 @@ namespace OpenRA.Mods.RA class C4Demolition : IIssueOrder, IResolveOrder, IOrderVoice { readonly C4DemolitionInfo Info; - + public C4Demolition(C4DemolitionInfo info) { Info = info; } - + public IEnumerable Orders { get { yield return new UnitTraitOrderTargeter( "C4", 6, "c4", true, false ); } @@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA if (order.OrderString == "C4") { self.SetTargetLine(Target.FromOrder(order), Color.Red); - + var mobile = self.Trait(); self.CancelActivity(); self.QueueActivity(new Enter(order.TargetActor)); @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA self.QueueActivity(mobile.MoveTo(self.Location, 0)); } } - + public string VoicePhraseForOrder(Actor self, Order order) { return (order.OrderString == "C4") ? "Attack" : null; diff --git a/OpenRA.Mods.RA/Capturable.cs b/OpenRA.Mods.RA/Capturable.cs index 9fddccffeb..962549d04e 100644 --- a/OpenRA.Mods.RA/Capturable.cs +++ b/OpenRA.Mods.RA/Capturable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Captures.cs b/OpenRA.Mods.RA/Captures.cs index d074716a2c..f7baa8e191 100644 --- a/OpenRA.Mods.RA/Captures.cs +++ b/OpenRA.Mods.RA/Captures.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA public string[] CaptureTypes = {"building"}; public object Create(ActorInitializer init) { return new Captures(this); } } - + class Captures : IIssueOrder, IResolveOrder, IOrderVoice { public readonly CapturesInfo Info; @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA { Info = info; } - + public IEnumerable Orders { get @@ -50,22 +50,22 @@ namespace OpenRA.Mods.RA public string VoicePhraseForOrder(Actor self, Order order) { - return (order.OrderString == "CaptureActor") ? "Attack" : null; + return (order.OrderString == "CaptureActor") ? "Attack" : null; } - + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "CaptureActor") { self.SetTargetLine(Target.FromOrder(order), Color.Red); - + self.CancelActivity(); self.QueueActivity(new Enter(order.TargetActor)); self.QueueActivity(new CaptureActor(order.TargetActor)); } } } - + class CaptureOrderTargeter : UnitTraitOrderTargeter { readonly string[] captureTypes; @@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor) { if( !base.CanTargetActor( self, target, forceAttack, forceQueued, ref cursor ) ) return false; - + var ci = target.Info.Traits.Get(); var playerRelationship = self.Owner.Stances[ target.Owner ]; @@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA cursor = "enter"; return true; } - + return false; } } diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index 61d5203540..38eec01300 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -55,26 +55,26 @@ namespace OpenRA.Mods.RA { if (!CanUnload(self)) return; - + self.CancelActivity(); self.QueueActivity(new UnloadCargo()); } } - + bool CanUnload(Actor self) { if (IsEmpty(self)) return false; - + // Cannot unload mid-air var move = self.TraitOrDefault(); if (move != null && move.Altitude > 0) return false; - + // Todo: Check if there is a free tile to unload to return true; } - + public string CursorForOrder(Actor self, Order order) { if (order.OrderString != "Unload") return null; @@ -83,7 +83,7 @@ namespace OpenRA.Mods.RA public string VoicePhraseForOrder(Actor self, Order order) { - if (order.OrderString != "Unload" || IsEmpty(self)) return null; + if (order.OrderString != "Unload" || IsEmpty(self)) return null; return "Move"; } @@ -91,7 +91,7 @@ namespace OpenRA.Mods.RA public bool IsEmpty(Actor self) { return cargo.Count == 0; } public Actor Peek(Actor self) { return cargo[0]; } - + static int GetWeight(Actor a) { return a.Info.Traits.Get().Weight; } public Actor Unload(Actor self) diff --git a/OpenRA.Mods.RA/CarpetBomb.cs b/OpenRA.Mods.RA/CarpetBomb.cs index e8ef651cb9..d19fbfaaeb 100644 --- a/OpenRA.Mods.RA/CarpetBomb.cs +++ b/OpenRA.Mods.RA/CarpetBomb.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/CashTrickler.cs b/OpenRA.Mods.RA/CashTrickler.cs index 0b4284006e..6fe37b796f 100644 --- a/OpenRA.Mods.RA/CashTrickler.cs +++ b/OpenRA.Mods.RA/CashTrickler.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA public readonly bool ShowTicks = true; public readonly int TickLifetime = 30; public readonly int TickVelocity = 1; - + public object Create (ActorInitializer init) { return new CashTrickler(this); } } @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA { Info = info; } - + public void Tick(Actor self) { if (--ticks < 0) diff --git a/OpenRA.Mods.RA/ChronoshiftDeploy.cs b/OpenRA.Mods.RA/ChronoshiftDeploy.cs index cd5410d29d..c8079f2004 100644 --- a/OpenRA.Mods.RA/ChronoshiftDeploy.cs +++ b/OpenRA.Mods.RA/ChronoshiftDeploy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA { self.World.CancelInputMode(); } - + self.CancelActivity(); self.QueueActivity(new Teleport(order.TargetLocation)); Sound.Play("chrotnk1.aud", self.CenterLocation); @@ -72,7 +72,7 @@ namespace OpenRA.Mods.RA { return (order.OrderString == "ChronoshiftDeploy" && chargeTick <= 0) ? "Move" : null; } - + // Display 5 pips indicating the current charge status public IEnumerable GetPips(Actor self) { diff --git a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs index fe627f6733..0a34c39ad6 100644 --- a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs +++ b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,14 +37,14 @@ namespace OpenRA.Mods.RA { if (remainingFrames == 0) return; - + var frac = (float)remainingFrames / chronoEffectLength; var excludePalettes = new List(){"cursor", "chrome", "colorpicker", "shroud", "fog"}; foreach (var pal in palettes) { if (excludePalettes.Contains(pal.Key)) continue; - + for (var x = 0; x < 256; x++) { var orig = pal.Value.GetColor(x); diff --git a/OpenRA.Mods.RA/Chronoshiftable.cs b/OpenRA.Mods.RA/Chronoshiftable.cs index c062e64d9e..15f50d1e6e 100755 --- a/OpenRA.Mods.RA/Chronoshiftable.cs +++ b/OpenRA.Mods.RA/Chronoshiftable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA self.QueueActivity(new Teleport(chronoshiftOrigin)); } } - + // Can't be used in synced code, except with ignoreVis. public virtual bool CanChronoshiftTo(Actor self, int2 targetLocation, bool ignoreVis) { @@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA /// Set up return-to-sender info chronoshiftOrigin = self.Location; chronoshiftReturnTicks = duration; - + // Kill cargo if (killCargo && self.HasTrait()) { @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA // Set up the teleport self.CancelActivity(); self.QueueActivity(new Teleport(targetLocation)); - + return true; } } diff --git a/OpenRA.Mods.RA/Cloak.cs b/OpenRA.Mods.RA/Cloak.cs index 7dedd326c7..a9ebb58cfd 100644 --- a/OpenRA.Mods.RA/Cloak.cs +++ b/OpenRA.Mods.RA/Cloak.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA public bool Cloaked { get { return remainingTime <= 0; } } public void DamageStateChanged(Actor self, AttackInfo e) - { + { canCloak = (e.DamageState < DamageState.Critical); if (!canCloak) Uncloak(); } @@ -84,8 +84,8 @@ namespace OpenRA.Mods.RA public bool IsVisible(Actor self) { - if (!Cloaked || self.Owner == self.World.LocalPlayer || - self.World.LocalPlayer == null || + if (!Cloaked || self.Owner == self.World.LocalPlayer || + self.World.LocalPlayer == null || self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) return true; @@ -93,7 +93,7 @@ namespace OpenRA.Mods.RA a.Actor.Owner.Stances[self.Owner] != Stance.Ally && (self.Location - a.Actor.Location).Length < a.Actor.Info.Traits.Get().Range); } - + public Color RadarColorOverride(Actor self) { var c = self.Owner.ColorRamp.GetColor(0); diff --git a/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs b/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs index d0f6168894..a5c5d34e0c 100644 --- a/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs +++ b/OpenRA.Mods.RA/ColorPickerPaletteModifier.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,14 +22,14 @@ namespace OpenRA.Mods.RA public string PlayerPalette = "player"; public object Create( ActorInitializer init ) { return new ColorPickerPaletteModifier( this ); } } - + class ColorPickerPaletteModifier : IPalette, IPaletteModifier - { + { ColorPickerPaletteModifierInfo Info; PaletteFormat format; - + public ColorPickerPaletteModifier(ColorPickerPaletteModifierInfo info) { Info = info; } - + public void InitPalette( WorldRenderer wr ) { var info = Rules.Info["player"].Traits.WithInterface() diff --git a/OpenRA.Mods.RA/Combat.cs b/OpenRA.Mods.RA/Combat.cs index a077b78916..03e75c239d 100755 --- a/OpenRA.Mods.RA/Combat.cs +++ b/OpenRA.Mods.RA/Combat.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA w => w.Add(new Explosion(w, args.dest, explosionType, isWater, args.destAltitude))); Sound.Play(GetImpactSound(warhead, isWater), args.dest); - + if (warhead.SmudgeType != null) { var smudgeLayer = world.WorldActor.TraitsImplementing() @@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA else smudgeLayer.AddSmudge(targetTile); } - + if (warhead.Ore) world.WorldActor.Trait().Destroy(targetTile); @@ -132,9 +132,9 @@ namespace OpenRA.Mods.RA DoImpacts(args); } - static readonly float[] falloff = + static readonly float[] falloff = { - 1f, 0.3678795f, 0.1353353f, 0.04978707f, + 1f, 0.3678795f, 0.1353353f, 0.04978707f, 0.01831564f, 0.006737947f, 0.002478752f, 0.000911882f }; @@ -167,7 +167,7 @@ namespace OpenRA.Mods.RA var targetable = target.TraitOrDefault(); if (targetable == null || !weapon.ValidTargets.Intersect(targetable.TargetTypes).Any()) return false; - + if (weapon.Warheads.All( w => w.EffectivenessAgainst(target) <= 0)) return false; @@ -210,7 +210,7 @@ namespace OpenRA.Mods.RA public static float2 GetBarrelPosition(Actor self, IFacing facing, Turret turret, Barrel barrel) { var turreted = self.TraitOrDefault(); - + if (turreted == null && facing == null) return float2.Zero; diff --git a/OpenRA.Mods.RA/ConquestVictoryConditions.cs b/OpenRA.Mods.RA/ConquestVictoryConditions.cs index 9f867def4d..5940de756f 100644 --- a/OpenRA.Mods.RA/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.RA/ConquestVictoryConditions.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,22 +25,22 @@ namespace OpenRA.Mods.RA { ConquestVictoryConditionsInfo Info; public ConquestVictoryConditions(ConquestVictoryConditionsInfo info) { Info = info; } - + public void Tick(Actor self) { if (self.Owner.WinState != WinState.Undefined || self.Owner.NonCombatant) return; - + var hasAnything = self.World.ActorsWithTrait() .Any( a => a.Actor.Owner == self.Owner ); if (!hasAnything && !self.Owner.NonCombatant) Lose(self); - - var others = self.World.Players.Where( p => !p.NonCombatant + + var others = self.World.Players.Where( p => !p.NonCombatant && p != self.Owner && p.Stances[self.Owner] != Stance.Ally ); - if (others.Count() == 0) return; - + if (others.Count() == 0) return; + if(others.All(p => p.WinState == WinState.Lost)) Win(self); } @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA { if (self.Owner.WinState == WinState.Lost) return; self.Owner.WinState = WinState.Lost; - + Game.Debug("{0} is defeated.".F(self.Owner.PlayerName)); foreach (var a in self.World.Actors.Where(a => a.Owner == self.Owner)) @@ -71,12 +71,12 @@ namespace OpenRA.Mods.RA }); } } - - public void Win(Actor self) + + public void Win(Actor self) { if (self.Owner.WinState == WinState.Won) return; self.Owner.WinState = WinState.Won; - + Game.Debug("{0} is victorious.".F(self.Owner.PlayerName)); if (self.Owner == self.World.LocalPlayer) { diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index 2ff3300294..ad402c33d3 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/CrateAction.cs b/OpenRA.Mods.RA/CrateAction.cs index d400cb63b8..fbd684f325 100644 --- a/OpenRA.Mods.RA/CrateAction.cs +++ b/OpenRA.Mods.RA/CrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA { public Actor self; public CrateActionInfo info; - + public CrateAction(Actor self, CrateActionInfo info) { this.self = self; @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA { return info.SelectionShares; } - + public virtual void Activate(Actor collector) { Sound.PlayToPlayer(collector.Owner, info.Notification); diff --git a/OpenRA.Mods.RA/CrateDrop.cs b/OpenRA.Mods.RA/CrateDrop.cs index 2b4f492732..fd7a0c945d 100644 --- a/OpenRA.Mods.RA/CrateDrop.cs +++ b/OpenRA.Mods.RA/CrateDrop.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA public readonly string[] ValidWater = {"Water"}; public readonly int SpawnInterval = 180; // Average time (seconds) between crate spawn public readonly float WaterChance = .2f; // Chance of generating a water crate instead of a land crate - + public object Create (ActorInitializer init) { return new CrateDrop(this); } } @@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA List crates = new List(); int ticks = 0; CrateDropInfo Info; - + public CrateDrop(CrateDropInfo info) { Info = info; } public void Tick(Actor self) @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA ticks = Info.SpawnInterval * 25; // todo: randomize crates.RemoveAll(x => !x.IsInWorld); // BUG: this removes crates that are cargo of a BADR! - + var toSpawn = Math.Max(0, Info.Minimum - crates.Count) + (crates.Count < Info.Maximum ? 1 : 0); @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA SpawnCrate(self); } } - + int2? ChooseDropCell(Actor self, bool inWater, int maxTries) { for( var n = 0; n < maxTries; n++ ) @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA return p; } - + return null; } @@ -79,8 +79,8 @@ namespace OpenRA.Mods.RA var inWater = self.World.SharedRandom.NextDouble() < Info.WaterChance; var pp = ChooseDropCell(self, inWater, 100); if (pp == null) return; - - var p = pp.Value; // + + var p = pp.Value; // self.World.AddFrameEndTask(w => { var crate = w.CreateActor(false, "crate", new TypeDictionary { new OwnerInit(w.WorldActor.Owner) }); @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA new FacingInit( Util.GetFacing(p - startPos, 0) ), new AltitudeInit( Rules.Info["badr"].Traits.Get().CruiseAltitude ), }); - + plane.CancelActivity(); plane.QueueActivity(new FlyAttack(Target.FromCell(p))); plane.Trait().SetLZ(p); diff --git a/OpenRA.Mods.RA/CrateSpawner.cs b/OpenRA.Mods.RA/CrateSpawner.cs index 6e935897c9..59d6dd5e57 100644 --- a/OpenRA.Mods.RA/CrateSpawner.cs +++ b/OpenRA.Mods.RA/CrateSpawner.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA ticks = info.SpawnInterval * 25; // todo: randomize crates.RemoveAll(x => !x.IsInWorld); - + var toSpawn = Math.Max(0, info.Minimum - crates.Count) + (crates.Count < info.Maximum ? 1 : 0); @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA SpawnCrate(self, info); } } - + void SpawnCrate(Actor self, CrateSpawnerInfo info) { var threshold = 100; @@ -57,11 +57,11 @@ namespace OpenRA.Mods.RA for (var n = 0; n < threshold; n++ ) { var p = self.World.ChooseRandomCell(self.World.SharedRandom); - + // Is this valid terrain? var terrainType = self.World.GetTerrainType(p); if (!(inWater ? info.ValidWater : info.ValidGround).Contains(terrainType)) continue; - + // Don't spawn on any actors if (self.World.WorldActor.Trait().GetBuildingAt(p) != null) continue; if (self.World.ActorMap.GetUnitsAt(p).Any()) continue; diff --git a/OpenRA.Mods.RA/Crates/CloakCrateAction.cs b/OpenRA.Mods.RA/Crates/CloakCrateAction.cs index 0254f23845..56698d0948 100644 --- a/OpenRA.Mods.RA/Crates/CloakCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/CloakCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -50,11 +50,11 @@ namespace OpenRA.Mods.RA.Crates collector.World.AddFrameEndTask(w => { w.Remove(collector); - + collector.AddTrait(cloak); if (collector.HasTrait>()) collector.Trait>().RecievedCloak(collector); - + w.Add(collector); }); diff --git a/OpenRA.Mods.RA/Crates/ExplodeCrateAction.cs b/OpenRA.Mods.RA/Crates/ExplodeCrateAction.cs index 325a5003c1..6924c85f8c 100644 --- a/OpenRA.Mods.RA/Crates/ExplodeCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/ExplodeCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Crates/GiveCashCrateAction.cs b/OpenRA.Mods.RA/Crates/GiveCashCrateAction.cs index f7a0840c37..4146d0076d 100644 --- a/OpenRA.Mods.RA/Crates/GiveCashCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GiveCashCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Crates/GiveMcvCrateAction.cs b/OpenRA.Mods.RA/Crates/GiveMcvCrateAction.cs index 01185f03f6..a03b9fa79b 100644 --- a/OpenRA.Mods.RA/Crates/GiveMcvCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GiveMcvCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Crates var hasBase = self.World.ActorsWithTrait() .Any(a => a.Actor.Owner == collector.Owner); - return hasBase ? info.SelectionShares : + return hasBase ? info.SelectionShares : (info as GiveMcvCrateActionInfo).NoBaseSelectionShares; } } diff --git a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs index 817bdfc03b..997e8dbfa1 100644 --- a/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/GiveUnitCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Crates/HideMapCrateAction.cs b/OpenRA.Mods.RA/Crates/HideMapCrateAction.cs index a94353ff27..430ac22b7f 100644 --- a/OpenRA.Mods.RA/Crates/HideMapCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/HideMapCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Crates/LevelUpCrateAction.cs b/OpenRA.Mods.RA/Crates/LevelUpCrateAction.cs index 599363a465..0ce148faa1 100644 --- a/OpenRA.Mods.RA/Crates/LevelUpCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/LevelUpCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,13 +19,13 @@ namespace OpenRA.Mods.RA { public LevelUpCrateAction(Actor self, LevelUpCrateActionInfo info) : base(self,info) {} - + public override int GetSelectionShares(Actor collector) { var ge = collector.TraitOrDefault(); return ge != null && ge.Level < ge.MaxLevel ? info.SelectionShares : 0; } - + public override void Activate(Actor collector) { collector.World.AddFrameEndTask(w => diff --git a/OpenRA.Mods.RA/Crates/RevealMapCrateAction.cs b/OpenRA.Mods.RA/Crates/RevealMapCrateAction.cs index 772696f2c4..7b678f706b 100644 --- a/OpenRA.Mods.RA/Crates/RevealMapCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/RevealMapCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs b/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs index bdcb8ffd44..92580d1ce3 100644 --- a/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/CreateMPPlayers.cs b/OpenRA.Mods.RA/CreateMPPlayers.cs index e0e2e869ed..4cf069dcb7 100644 --- a/OpenRA.Mods.RA/CreateMPPlayers.cs +++ b/OpenRA.Mods.RA/CreateMPPlayers.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA if (client.Index == Game.LocalClientId) w.SetLocalPlayer(player.InternalName); } - + foreach (var p in w.Players) foreach (var q in w.Players) if (!p.Stances.ContainsKey(q)) diff --git a/OpenRA.Mods.RA/CrushableInfantry.cs b/OpenRA.Mods.RA/CrushableInfantry.cs index 11109fdcf5..5c4600250c 100644 --- a/OpenRA.Mods.RA/CrushableInfantry.cs +++ b/OpenRA.Mods.RA/CrushableInfantry.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/DemoTruck.cs b/OpenRA.Mods.RA/DemoTruck.cs index aff206a862..d8de762a82 100644 --- a/OpenRA.Mods.RA/DemoTruck.cs +++ b/OpenRA.Mods.RA/DemoTruck.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA { if (self.Destroyed) return; Combat.DoExplosion(self, info.PrimaryWeapon, self.CenterLocation, altitude); - + // Remove from world self.Kill(self); detonatedBy.Owner.Kills++; diff --git a/OpenRA.Mods.RA/DetectCloaked.cs b/OpenRA.Mods.RA/DetectCloaked.cs index 9933f40000..3bc907390c 100644 --- a/OpenRA.Mods.RA/DetectCloaked.cs +++ b/OpenRA.Mods.RA/DetectCloaked.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index b9d8ba4110..cf09ad6f3f 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Effects { readonly BulletInfo Info; readonly ProjectileArgs Args; - + int t = 0; Animation anim; @@ -92,8 +92,8 @@ namespace OpenRA.Mods.RA.Effects var u = (rawFacing % 128) / 128f; var scale = 512 * u * (1 - u); - return (int)(rawFacing < 128 - ? rawFacing - scale * attitude + return (int)(rawFacing < 128 + ? rawFacing - scale * attitude : rawFacing + scale * attitude); } diff --git a/OpenRA.Mods.RA/Effects/CashTick.cs b/OpenRA.Mods.RA/Effects/CashTick.cs index b7033fca29..768c4cfe98 100644 --- a/OpenRA.Mods.RA/Effects/CashTick.cs +++ b/OpenRA.Mods.RA/Effects/CashTick.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/Contrail.cs b/OpenRA.Mods.RA/Effects/Contrail.cs index 3675639f7e..d51ac31de7 100755 --- a/OpenRA.Mods.RA/Effects/Contrail.cs +++ b/OpenRA.Mods.RA/Effects/Contrail.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/Corpse.cs b/OpenRA.Mods.RA/Effects/Corpse.cs index 55aa334bed..be596e9b32 100644 --- a/OpenRA.Mods.RA/Effects/Corpse.cs +++ b/OpenRA.Mods.RA/Effects/Corpse.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/CrateEffect.cs b/OpenRA.Mods.RA/Effects/CrateEffect.cs index 4533a0999e..5eb9d21540 100644 --- a/OpenRA.Mods.RA/Effects/CrateEffect.cs +++ b/OpenRA.Mods.RA/Effects/CrateEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Effects { anim.Tick(); } - + public IEnumerable Render() { if (a.IsInWorld) diff --git a/OpenRA.Mods.RA/Effects/Explosion.cs b/OpenRA.Mods.RA/Effects/Explosion.cs index c7d0704547..2a3e27ebd9 100644 --- a/OpenRA.Mods.RA/Effects/Explosion.cs +++ b/OpenRA.Mods.RA/Effects/Explosion.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -34,8 +34,8 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render() { - yield return new Renderable(anim.Image, - pos - .5f * anim.Image.size - new int2(0,altitude), + yield return new Renderable(anim.Image, + pos - .5f * anim.Image.size - new int2(0,altitude), "effect", (int)pos.Y - altitude); } diff --git a/OpenRA.Mods.RA/Effects/GpsDot.cs b/OpenRA.Mods.RA/Effects/GpsDot.cs index 78af0132a2..78fabc2415 100644 --- a/OpenRA.Mods.RA/Effects/GpsDot.cs +++ b/OpenRA.Mods.RA/Effects/GpsDot.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Effects if (self.Destroyed) world.AddFrameEndTask(w => w.Remove(this)); - + if (world.LocalPlayer == null) return; diff --git a/OpenRA.Mods.RA/Effects/GpsSatellite.cs b/OpenRA.Mods.RA/Effects/GpsSatellite.cs index a41550be4b..30d0d63df3 100644 --- a/OpenRA.Mods.RA/Effects/GpsSatellite.cs +++ b/OpenRA.Mods.RA/Effects/GpsSatellite.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,11 +31,11 @@ namespace OpenRA.Mods.RA.Effects { anim.Tick(); offset.Y -= heightPerTick; - + if (offset.Y < 0) world.AddFrameEndTask(w => w.Remove(this)); } - + public IEnumerable Render() { yield return new Renderable(anim.Image,offset, "effect", (int)offset.Y); diff --git a/OpenRA.Mods.RA/Effects/GravityBomb.cs b/OpenRA.Mods.RA/Effects/GravityBomb.cs index 6d18e17823..b2b6f83ff6 100755 --- a/OpenRA.Mods.RA/Effects/GravityBomb.cs +++ b/OpenRA.Mods.RA/Effects/GravityBomb.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render() { - yield return new Renderable(anim.Image, + yield return new Renderable(anim.Image, Args.dest - new int2(0, altitude) - .5f * anim.Image.size, "effect", Args.dest.Y); } } diff --git a/OpenRA.Mods.RA/Effects/InvulnEffect.cs b/OpenRA.Mods.RA/Effects/InvulnEffect.cs index ba316c839b..1e17098892 100644 --- a/OpenRA.Mods.RA/Effects/InvulnEffect.cs +++ b/OpenRA.Mods.RA/Effects/InvulnEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/LaserZap.cs b/OpenRA.Mods.RA/Effects/LaserZap.cs index 0e6a437b2e..25a3360684 100755 --- a/OpenRA.Mods.RA/Effects/LaserZap.cs +++ b/OpenRA.Mods.RA/Effects/LaserZap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects public readonly Color Color = Color.Red; public readonly string Explosion = "laserfire"; - public IEffect Create(ProjectileArgs args) + public IEffect Create(ProjectileArgs args) { var c = UsePlayerColor ? args.firedBy.Owner.ColorRamp.GetColor(0) : Color; return new LaserZap(args, this, c); @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Effects Color color; bool doneDamage; Animation explosion; - + public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color) { this.args = args; diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index 9f6784e5bb..6a717ce850 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Effects int2 offset; public int2 SubPxPosition; public int2 PxPosition { get { return new int2( SubPxPosition.X / 1024, SubPxPosition.Y / 1024 ); } } - + readonly Animation anim; int Facing; int t; @@ -81,24 +81,24 @@ namespace OpenRA.Mods.RA.Effects Info.ContrailDelay); } } - + // In pixels const int MissileCloseEnough = 7; int ticksToNextSmoke; - + public void Tick( World world ) { t += 40; // In pixels var dist = Args.target.CenterLocation + offset - PxPosition; - + var targetAltitude = 0; if (Args.target.IsValid && Args.target.IsActor && Args.target.Actor.HasTrait()) targetAltitude = Args.target.Actor.Trait().Altitude; - + Altitude += Math.Sign(targetAltitude - Altitude); - + Facing = Traits.Util.TickFacing(Facing, Traits.Util.GetFacing(dist, Facing), Info.ROT); @@ -107,15 +107,15 @@ namespace OpenRA.Mods.RA.Effects if (dist.LengthSquared < MissileCloseEnough * MissileCloseEnough || !Args.target.IsValid ) Explode(world); - + // TODO: Replace this with a lookup table var dir = (-float2.FromAngle((float)(Facing / 128f * Math.PI))*1024).ToInt2(); - + var move = Info.Speed * dir; if (targetAltitude > 0 && Info.TurboBoost) move = (move * 3) / 2; move = move / 5; - + SubPxPosition += move; if (Info.Trail != null) @@ -128,7 +128,7 @@ namespace OpenRA.Mods.RA.Effects ticksToNextSmoke = Info.TrailInterval; } } - + if (Info.RangeLimit != 0 && t > Info.RangeLimit * 40) Explode(world); @@ -155,7 +155,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render() { if (Args.firedBy.World.LocalShroud.IsVisible(OpenRA.Traits.Util.CellContaining(PxPosition.ToFloat2()))) - yield return new Renderable(anim.Image,PxPosition.ToFloat2() - 0.5f * anim.Image.size - new float2(0, Altitude), + yield return new Renderable(anim.Image,PxPosition.ToFloat2() - 0.5f * anim.Image.size - new float2(0, Altitude), Args.weapon.Underwater ? "shadow" : "effect", PxPosition.Y); if (Trail != null) diff --git a/OpenRA.Mods.RA/Effects/NukeLaunch.cs b/OpenRA.Mods.RA/Effects/NukeLaunch.cs index 1e72aa680b..1db21fb3ea 100755 --- a/OpenRA.Mods.RA/Effects/NukeLaunch.cs +++ b/OpenRA.Mods.RA/Effects/NukeLaunch.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Effects this.weapon = weapon; anim = new Animation(weapon); anim.PlayRepeating("up"); - + if (silo == null) { altitude = firedBy.World.Map.Bounds.Height*Game.CellSize; @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Effects anim.PlayRepeating("down"); goingUp = false; } - + public void Tick(World world) { anim.Tick(); @@ -79,7 +79,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render() { - yield return new Renderable(anim.Image, pos - 0.5f * anim.Image.size - new float2(0, altitude), + yield return new Renderable(anim.Image, pos - 0.5f * anim.Image.size - new float2(0, altitude), "effect", (int)pos.Y); } } diff --git a/OpenRA.Mods.RA/Effects/Parachute.cs b/OpenRA.Mods.RA/Effects/Parachute.cs index 4fbe73c275..3f3eb7c9b2 100644 --- a/OpenRA.Mods.RA/Effects/Parachute.cs +++ b/OpenRA.Mods.RA/Effects/Parachute.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Effects readonly string palette; readonly Animation paraAnim; readonly float2 location; - + readonly Actor cargo; int2 offset; @@ -38,24 +38,24 @@ namespace OpenRA.Mods.RA.Effects var rs = cargo.Trait(); var image = rs.anim.Name; palette = rs.Palette(owner); - + anim = new Animation(image); if (anim.HasSequence("idle")) anim.PlayFetchIndex("idle", () => 0); else anim.PlayFetchIndex("stand", () => 0); anim.Tick(); - + var pai = cargo.Info.Traits.GetOrDefault(); paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach"); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); - + if (pai != null) offset = pai.Offset; } public void Tick(World world) - { + { paraAnim.Tick(); altitude -= fallRate; diff --git a/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs b/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs index 165488177a..b4f63ec4d2 100644 --- a/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs +++ b/OpenRA.Mods.RA/Effects/PowerdownIndicator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/RallyPoint.cs b/OpenRA.Mods.RA/Effects/RallyPoint.cs index f028698085..0dccf825e0 100755 --- a/OpenRA.Mods.RA/Effects/RallyPoint.cs +++ b/OpenRA.Mods.RA/Effects/RallyPoint.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,9 +22,9 @@ namespace OpenRA.Mods.RA.Effects RA.RallyPoint rp; public Animation flag = new Animation("rallypoint"); public Animation circles = new Animation("rallypoint"); - - public RallyPoint(Actor building) - { + + public RallyPoint(Actor building) + { this.building = building; rp = building.Trait(); flag.PlayRepeating("flag"); @@ -41,25 +41,25 @@ namespace OpenRA.Mods.RA.Effects cachedLocation = rp.rallyPoint; circles.Play("circles"); } - + if (!building.IsInWorld || building.IsDead()) world.AddFrameEndTask(w => w.Remove(this)); } public IEnumerable Render() { - if (building.IsInWorld && building.Owner == building.World.LocalPlayer + if (building.IsInWorld && building.Owner == building.World.LocalPlayer && building.World.Selection.Actors.Contains(building)) { var pos = Traits.Util.CenterOfCell(rp.rallyPoint); var palette = building.Trait().Palette(building.Owner); - yield return new Renderable(circles.Image, - pos - .5f * circles.Image.size, + yield return new Renderable(circles.Image, + pos - .5f * circles.Image.size, palette, (int)pos.Y); - yield return new Renderable(flag.Image, - pos + new float2(-1,-17), + yield return new Renderable(flag.Image, + pos + new float2(-1,-17), palette, (int)pos.Y); } } diff --git a/OpenRA.Mods.RA/Effects/RepairIndicator.cs b/OpenRA.Mods.RA/Effects/RepairIndicator.cs index fe021a5bf1..5e4c6ac951 100755 --- a/OpenRA.Mods.RA/Effects/RepairIndicator.cs +++ b/OpenRA.Mods.RA/Effects/RepairIndicator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs index 95bdcb6156..ed7cd7c62e 100644 --- a/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs +++ b/OpenRA.Mods.RA/Effects/SatelliteLaunch.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,20 +26,20 @@ namespace OpenRA.Mods.RA.Effects { doors.PlayThen("active", () => a.World.AddFrameEndTask(w => w.Remove(this))); - + pos = a.CenterLocation - .5f * doors.Image.size + doorOffset; } public void Tick( World world ) { doors.Tick(); - + if (++frame == 19) { world.AddFrameEndTask(w => w.Add(new GpsSatellite(pos))); } } - + public IEnumerable Render() { yield return new Renderable(doors.Image, pos, "effect", (int)doorOffset.Y); diff --git a/OpenRA.Mods.RA/Effects/Smoke.cs b/OpenRA.Mods.RA/Effects/Smoke.cs index cdffcba482..360e0a24a2 100644 --- a/OpenRA.Mods.RA/Effects/Smoke.cs +++ b/OpenRA.Mods.RA/Effects/Smoke.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Effects/TeslaZap.cs b/OpenRA.Mods.RA/Effects/TeslaZap.cs index 2f05a42f54..e006047a45 100755 --- a/OpenRA.Mods.RA/Effects/TeslaZap.cs +++ b/OpenRA.Mods.RA/Effects/TeslaZap.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -115,8 +115,8 @@ namespace OpenRA.Mods.RA.Effects return rs; } - static int[][] steps = new [] - { + static int[][] steps = new [] + { new int[] { 8, 8, -8, -8, 0 }, new int[] { -8, -8, -16, -16, 0 }, new int[] { 8, 0, -8, -8, 1 }, diff --git a/OpenRA.Mods.RA/EmitInfantryOnSell.cs b/OpenRA.Mods.RA/EmitInfantryOnSell.cs index ce8497cefe..7404dd58a5 100644 --- a/OpenRA.Mods.RA/EmitInfantryOnSell.cs +++ b/OpenRA.Mods.RA/EmitInfantryOnSell.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -34,13 +34,13 @@ namespace OpenRA.Mods.RA var csv = self.Info.Traits.GetOrDefault(); var valued = self.Info.Traits.GetOrDefault(); var cost = csv != null ? csv.Value : (valued != null ? valued.Cost : 0); - + var health = self.TraitOrDefault(); var dudesValue = info.ValuePercent * cost; if (health != null) dudesValue = dudesValue*health.HP / health.MaxHP; dudesValue /= 100; - + var eligibleLocations = FootprintUtils.Tiles(self).ToList(); var actorTypes = info.ActorTypes.Select(a => new { Name = a, Cost = Rules.Info[a].Traits.Get().Cost }).ToArray(); @@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA eligibleLocations.Remove(loc); dudesValue -= at.Cost; - self.World.AddFrameEndTask(w => w.CreateActor(at.Name, new TypeDictionary + self.World.AddFrameEndTask(w => w.CreateActor(at.Name, new TypeDictionary { new LocationInit( loc ), new OwnerInit( self.Owner ), diff --git a/OpenRA.Mods.RA/EngineerRepair.cs b/OpenRA.Mods.RA/EngineerRepair.cs index 9224c2c96e..571e16ed55 100644 --- a/OpenRA.Mods.RA/EngineerRepair.cs +++ b/OpenRA.Mods.RA/EngineerRepair.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,14 +39,14 @@ namespace OpenRA.Mods.RA return (order.OrderString == "EngineerRepair" && order.TargetActor.GetDamageState() > DamageState.Undamaged) ? "Attack" : null; } - + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "EngineerRepair" && order.TargetActor.GetDamageState() > DamageState.Undamaged) { self.SetTargetLine(Target.FromOrder(order), Color.Yellow); - + self.CancelActivity(); self.QueueActivity(new Enter(order.TargetActor)); self.QueueActivity(new RepairBuilding(order.TargetActor)); diff --git a/OpenRA.Mods.RA/Explodes.cs b/OpenRA.Mods.RA/Explodes.cs index 47a1914d0b..7d64a67aa2 100644 --- a/OpenRA.Mods.RA/Explodes.cs +++ b/OpenRA.Mods.RA/Explodes.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Fake.cs b/OpenRA.Mods.RA/Fake.cs index 6e739315ff..a8b523d43e 100644 --- a/OpenRA.Mods.RA/Fake.cs +++ b/OpenRA.Mods.RA/Fake.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/FreeActor.cs b/OpenRA.Mods.RA/FreeActor.cs index fe978e5b21..942964989b 100644 --- a/OpenRA.Mods.RA/FreeActor.cs +++ b/OpenRA.Mods.RA/FreeActor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,14 +21,14 @@ namespace OpenRA.Mods.RA public readonly string InitialActivity = null; public readonly int2 SpawnOffset = int2.Zero; public readonly int Facing = 0; - + public object Create( ActorInitializer init ) { return new FreeActor(init.self, this); } } public class FreeActor { public FreeActor(Actor self, FreeActorInfo info) - { + { self.World.AddFrameEndTask( w => { diff --git a/OpenRA.Mods.RA/GainsExperience.cs b/OpenRA.Mods.RA/GainsExperience.cs index e3e70778d3..57c59b03e8 100644 --- a/OpenRA.Mods.RA/GainsExperience.cs +++ b/OpenRA.Mods.RA/GainsExperience.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/GivesBounty.cs b/OpenRA.Mods.RA/GivesBounty.cs index f15c9e44c0..c96a1f5b73 100644 --- a/OpenRA.Mods.RA/GivesBounty.cs +++ b/OpenRA.Mods.RA/GivesBounty.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/GivesExperience.cs b/OpenRA.Mods.RA/GivesExperience.cs index 570870b24e..537d9d07b5 100644 --- a/OpenRA.Mods.RA/GivesExperience.cs +++ b/OpenRA.Mods.RA/GivesExperience.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 670428a0c5..cee2e90737 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -224,7 +224,7 @@ namespace OpenRA.Mods.RA return possibleTargets.Any() ? possibleTargets.Random(random) : (int2?)null; } - + int assignRolesTicks = 0; void AssignRolesToIdleUnits(Actor self) @@ -234,7 +234,7 @@ namespace OpenRA.Mods.RA activeUnits.RemoveAll(a => a.Destroyed); unitsHangingAroundTheBase.RemoveAll(a => a.Destroyed); attackForce.RemoveAll(a => a.Destroyed); - + if (--assignRolesTicks > 0) return; else @@ -256,7 +256,7 @@ namespace OpenRA.Mods.RA activeUnits.Add(a); } - + /* Create an attack force when we have enough units around our base. */ // (don't bother leaving any behind for defense.) @@ -335,7 +335,7 @@ namespace OpenRA.Mods.RA void SetRallyPointsForNewProductionBuildings(Actor self) { var buildings = self.World.ActorsWithTrait() - .Where(rp => rp.Actor.Owner == p && + .Where(rp => rp.Actor.Owner == p && !IsRallyPointValid(rp.Trait.rallyPoint)).ToArray(); if (buildings.Length > 0) @@ -432,7 +432,7 @@ namespace OpenRA.Mods.RA class BaseBuilder { enum BuildState { ChooseItem, WaitForProduction, WaitForFeedback } - + BuildState state = BuildState.WaitForFeedback; string category; HackyAI ai; diff --git a/OpenRA.Mods.RA/Harvester.cs b/OpenRA.Mods.RA/Harvester.cs index ff29131f44..ec7d7b4f8a 100644 --- a/OpenRA.Mods.RA/Harvester.cs +++ b/OpenRA.Mods.RA/Harvester.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,34 +29,34 @@ namespace OpenRA.Mods.RA public object Create(ActorInitializer init) { return new Harvester(init.self, this); } } - public class Harvester : IIssueOrder, IResolveOrder, IPips, + public class Harvester : IIssueOrder, IResolveOrder, IPips, IExplodeModifier, IOrderVoice, ISpeedModifier, ISync { Dictionary contents = new Dictionary(); [Sync] public Actor LinkedProc = null; - + public int2? LastHarvestedCell = null; - + [Sync] public int ContentValue { get { return contents.Sum(c => c.Key.ValuePerUnit*c.Value); } } - + [Sync] int currentUnloadTicks; - + readonly HarvesterInfo Info; public Harvester(Actor self, HarvesterInfo info) { Info = info; self.QueueActivity( new CallFunc( () => ChooseNewProc(self, null))); } - + public void ChooseNewProc(Actor self, Actor ignore) { LinkedProc = ClosestProc(self, ignore); } - + public void ContinueHarvesting(Actor self) { if (LastHarvestedCell.HasValue) @@ -89,7 +89,7 @@ namespace OpenRA.Mods.RA public bool IsFull { get { return contents.Values.Sum() == Info.Capacity; } } public bool IsEmpty { get { return contents.Values.Sum() == 0; } } public int Fullness { get { return contents.Values.Sum() * 100 / Info.Capacity; } } - + public void AcceptResource(ResourceType type) { if (!contents.ContainsKey(type.info)) contents[type.info] = 1; @@ -101,28 +101,28 @@ namespace OpenRA.Mods.RA { if (!proc.IsInWorld) return false; // fail to deliver if there is no proc. - + // Wait until the next bale is ready if (--currentUnloadTicks > 0) return false; - + if (contents.Keys.Count > 0) { var type = contents.First().Key; var iao = proc.Trait(); if (!iao.CanGiveOre(type.ValuePerUnit)) return false; - + iao.GiveOre(type.ValuePerUnit); if (--contents[type] == 0) contents.Remove(type); - + currentUnloadTicks = Info.UnloadTicksPerBale; } - + return contents.Count == 0; } - + public IEnumerable Orders { get @@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA { return (order.OrderString == "Harvest" || (order.OrderString == "Deliver" && !IsEmpty)) ? "Move" : null; } - + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Harvest") @@ -166,17 +166,17 @@ namespace OpenRA.Mods.RA if (order.TargetActor != LinkedProc) LinkedProc = order.TargetActor; - + if (IsEmpty) return; - + self.SetTargetLine(Target.FromOrder(order), Color.Green); self.CancelActivity(); self.QueueActivity(new DeliverResources()); } } - + public void UnlinkProc(Actor self, Actor proc) { if (LinkedProc != proc) @@ -197,7 +197,7 @@ namespace OpenRA.Mods.RA return PipType.Transparent; } - + public IEnumerable GetPips(Actor self) { int numPips = Info.PipCount; diff --git a/OpenRA.Mods.RA/HarvesterHuskModifier.cs b/OpenRA.Mods.RA/HarvesterHuskModifier.cs index 47150ca1e5..8846aace6e 100644 --- a/OpenRA.Mods.RA/HarvesterHuskModifier.cs +++ b/OpenRA.Mods.RA/HarvesterHuskModifier.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Husk.cs b/OpenRA.Mods.RA/Husk.cs index 10cabf1d59..013d61e3bf 100644 --- a/OpenRA.Mods.RA/Husk.cs +++ b/OpenRA.Mods.RA/Husk.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/InfiltrateForSupportPower.cs b/OpenRA.Mods.RA/InfiltrateForSupportPower.cs index a6f183e056..3a2e054ebe 100644 --- a/OpenRA.Mods.RA/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.RA/InfiltrateForSupportPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA public readonly string Proxy = null; public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); } } - + class InfiltrateForSupportPower : IAcceptSpy { InfiltrateForSupportPowerInfo Info; diff --git a/OpenRA.Mods.RA/InvisibleToEnemy.cs b/OpenRA.Mods.RA/InvisibleToEnemy.cs index 117f6815c6..bce440b9f0 100644 --- a/OpenRA.Mods.RA/InvisibleToEnemy.cs +++ b/OpenRA.Mods.RA/InvisibleToEnemy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA { return self.World.LocalPlayer == null || self.Owner == self.World.LocalPlayer; } - + public Color RadarColorOverride(Actor self) { // todo: why is making this half-opaque conflated with hiding the actor from non-allies? diff --git a/OpenRA.Mods.RA/Invulnerable.cs b/OpenRA.Mods.RA/Invulnerable.cs index c8ce3f2596..59243f4a3c 100644 --- a/OpenRA.Mods.RA/Invulnerable.cs +++ b/OpenRA.Mods.RA/Invulnerable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/IronCurtainable.cs b/OpenRA.Mods.RA/IronCurtainable.cs index 47e5e25fe3..427dc92574 100644 --- a/OpenRA.Mods.RA/IronCurtainable.cs +++ b/OpenRA.Mods.RA/IronCurtainable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/LeavesHusk.cs b/OpenRA.Mods.RA/LeavesHusk.cs index eeae249670..a125ba1341 100644 --- a/OpenRA.Mods.RA/LeavesHusk.cs +++ b/OpenRA.Mods.RA/LeavesHusk.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/LightPaletteRotator.cs b/OpenRA.Mods.RA/LightPaletteRotator.cs index 80fca8631a..7a07f8c9d0 100644 --- a/OpenRA.Mods.RA/LightPaletteRotator.cs +++ b/OpenRA.Mods.RA/LightPaletteRotator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA { t += .5f; } - + static readonly string[] ExcludePalettes = { "cursor", "chrome", "colorpicker" }; public void AdjustPalette(Dictionary palettes) @@ -32,11 +32,11 @@ namespace OpenRA.Mods.RA { if (ExcludePalettes.Contains(pal.Key)) continue; - + var rotate = (int)t % 18; if (rotate > 9) rotate = 18 - rotate; - + pal.Value.SetColor(0x67, pal.Value.GetColor(230+rotate)); } } diff --git a/OpenRA.Mods.RA/LimitedAmmo.cs b/OpenRA.Mods.RA/LimitedAmmo.cs index d0f5184732..8db0d62568 100644 --- a/OpenRA.Mods.RA/LimitedAmmo.cs +++ b/OpenRA.Mods.RA/LimitedAmmo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA [Sync] int ammo; LimitedAmmoInfo Info; - + public LimitedAmmo(LimitedAmmoInfo info) { ammo = info.Ammo; @@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA public IEnumerable GetPips(Actor self) { var pips = Info.PipCount != 0 ? Info.PipCount : Info.Ammo; - return Graphics.Util.MakeArray(pips, + return Graphics.Util.MakeArray(pips, i => (ammo * pips) / Info.Ammo > i ? PipType.Green : PipType.Transparent); } } diff --git a/OpenRA.Mods.RA/Lint/CheckActorReferences.cs b/OpenRA.Mods.RA/Lint/CheckActorReferences.cs index 861201f4e0..f391b24c61 100644 --- a/OpenRA.Mods.RA/Lint/CheckActorReferences.cs +++ b/OpenRA.Mods.RA/Lint/CheckActorReferences.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,11 +18,11 @@ namespace OpenRA.Mods.RA public class CheckActorReferences : ILintPass { Action EmitError; - + public void Run(Action emitError, Action emitWarning) { EmitError = emitError; - + foreach (var actorInfo in Rules.Info) foreach (var traitInfo in actorInfo.Value.Traits.WithInterface()) CheckTrait(actorInfo.Value, traitInfo); diff --git a/OpenRA.Mods.RA/Lint/CheckAutotargetWiring.cs b/OpenRA.Mods.RA/Lint/CheckAutotargetWiring.cs index 49f835668f..ad8d839284 100644 --- a/OpenRA.Mods.RA/Lint/CheckAutotargetWiring.cs +++ b/OpenRA.Mods.RA/Lint/CheckAutotargetWiring.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Lint/CheckSyncAnnotations.cs b/OpenRA.Mods.RA/Lint/CheckSyncAnnotations.cs index 6a7b343a54..048aff930d 100644 --- a/OpenRA.Mods.RA/Lint/CheckSyncAnnotations.cs +++ b/OpenRA.Mods.RA/Lint/CheckSyncAnnotations.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA if (!HasAnySyncFields(t)) emitWarning("{0} has ISync but nothing marked with [Sync]".F(t.Name)); } - + bool HasAnySyncFields(Type t) { var flags = BindingFlags.Public | BindingFlags.NonPublic diff --git a/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs b/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs index f8f9e8bd63..ab8ddd694f 100644 --- a/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs +++ b/OpenRA.Mods.RA/Lint/CheckTraitPrerequisites.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs b/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs index bd220c3d18..b10eb76f30 100644 --- a/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs +++ b/OpenRA.Mods.RA/Lint/LintBuildablePrerequisites.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,11 +21,11 @@ namespace OpenRA.Mods.RA { public void Run(Action emitError, Action emitWarning) { - var providedPrereqs = Rules.Info.Keys.Concat( + var providedPrereqs = Rules.Info.Keys.Concat( Rules.Info.SelectMany( a => a.Value.Traits .WithInterface() .Select( p => p.Prerequisite ))).ToArray(); - + foreach( var i in Rules.Info ) { var bi = i.Value.Traits.GetOrDefault(); diff --git a/OpenRA.Mods.RA/MPStartLocations.cs b/OpenRA.Mods.RA/MPStartLocations.cs index 73a3aa4e01..df5344a370 100755 --- a/OpenRA.Mods.RA/MPStartLocations.cs +++ b/OpenRA.Mods.RA/MPStartLocations.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA { public readonly int InitialExploreRange = 5; } - + public class MPStartLocations : IWorldLoaded { public Dictionary Start = new Dictionary(); @@ -45,13 +45,13 @@ namespace OpenRA.Mods.RA Start.Add(player, spid); } - + // Explore allied shroud foreach (var p in Start) if ((world.LocalPlayer != null ) &&(p.Key == world.LocalPlayer || p.Key.Stances[world.LocalPlayer] == Stance.Ally)) world.WorldActor.Trait().Explore(world, p.Value, world.WorldActor.Info.Traits.Get().InitialExploreRange); - + // Set viewport if (world.LocalPlayer != null && Start.ContainsKey(world.LocalPlayer)) Game.viewport.Center(Start[world.LocalPlayer]); @@ -61,7 +61,7 @@ namespace OpenRA.Mods.RA { return world.Players.FirstOrDefault(p => p.PlayerReference.Name == pr); } - + static int2 ChooseSpawnPoint(World world, List available, List taken) { if (available.Count == 0) diff --git a/OpenRA.Mods.RA/Mine.cs b/OpenRA.Mods.RA/Mine.cs index 5c320b5f6e..5e47506726 100644 --- a/OpenRA.Mods.RA/Mine.cs +++ b/OpenRA.Mods.RA/Mine.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Minelayer.cs b/OpenRA.Mods.RA/Minelayer.cs index 404650a3e7..1484516c4d 100644 --- a/OpenRA.Mods.RA/Minelayer.cs +++ b/OpenRA.Mods.RA/Minelayer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync { - /* [Sync] when sync can cope with arrays! */ + /* [Sync] when sync can cope with arrays! */ public int2[] minefield = null; [Sync] int2 minefieldStart; @@ -102,7 +102,7 @@ namespace OpenRA.Mods.RA } var underCursor = world.FindUnitsAtMouse(mi.Location) - .OrderByDescending(a => a.Info.Traits.Contains() + .OrderByDescending(a => a.Info.Traits.Contains() ? a.Info.Traits.Get().Priority : int.MinValue) .FirstOrDefault(); @@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA return; var movement = minelayer.Trait(); - var minefield = GetMinefieldCells(minefieldStart, lastMousePos, + var minefield = GetMinefieldCells(minefieldStart, lastMousePos, minelayer.Info.Traits.Get().MinefieldDepth) .Where(p => movement.CanEnterCell(p)).ToArray(); @@ -142,7 +142,7 @@ namespace OpenRA.Mods.RA { if (self.Owner != self.World.LocalPlayer) return; - + if (minefield != null) wr.DrawLocus(Color.Cyan, minefield); } @@ -161,7 +161,7 @@ namespace OpenRA.Mods.RA { if (!self.World.Map.IsInMap(location)) return false; - + cursor = "ability"; IsQueued = forceQueued; diff --git a/OpenRA.Mods.RA/Missions/DefaultShellmapScript.cs b/OpenRA.Mods.RA/Missions/DefaultShellmapScript.cs index a3f246aa27..603e1788b6 100644 --- a/OpenRA.Mods.RA/Missions/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/Missions/DefaultShellmapScript.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,10 +19,10 @@ namespace OpenRA.Mods.RA class DefaultShellmapScriptInfo : TraitInfo { } class DefaultShellmapScript: IWorldLoaded, ITick - { + { Dictionary Actors; static int2 ViewportOrigin; - + public void WorldLoaded(World w) { var b = w.Map.Bounds; @@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA Actors = w.WorldActor.Trait().Actors; Sound.SoundVolumeModifier = 0.25f; } - + int ticks = 0; float speed = 4f; public void Tick(Actor self) @@ -42,7 +42,7 @@ namespace OpenRA.Mods.RA (float)(System.Math.Cos((ticks + 45) % (360f * speed) * (Math.PI / 180) * 1f / speed) * 10f + ViewportOrigin.Y)); Game.MoveViewport(loc); - + if (ticks == 250) { Scripting.RASpecialPowers.Chronoshift(self.World, new List>() @@ -51,25 +51,25 @@ namespace OpenRA.Mods.RA Pair.New(Actors["ca2"], new int2(92, 71)) }, Actors["pdox"], -1, false); } - - + + if (ticks == 100) Actors["mslo1"].Trait().Activate(Actors["mslo1"], new Order(){ TargetLocation = new int2(98, 52) }); if (ticks == 140) Actors["mslo2"].Trait().Activate(Actors["mslo2"], new Order(){ TargetLocation = new int2(95, 54) }); if (ticks == 180) Actors["mslo3"].Trait().Activate(Actors["mslo3"], new Order(){ TargetLocation = new int2(95, 49) }); - + if (ticks == 430) { Actors["mig1"].Trait().AttackTarget(Target.FromActor(Actors["greeceweap"]), false, true); Actors["mig2"].Trait().AttackTarget(Target.FromActor(Actors["greeceweap"]), false, true); Actors["mig3"].Trait().AttackTarget(Target.FromActor(Actors["greeceweap"]), false, true); } - + ticks++; } } - + } diff --git a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs index a0bb074099..7fb35e0b2f 100644 --- a/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs +++ b/OpenRA.Mods.RA/Modifiers/FrozenUnderFog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,8 +22,8 @@ namespace OpenRA.Mods.RA { return Shroud.GetVisOrigins(self).Any(o => self.World.LocalShroud.IsVisible(o)); } - - Renderable[] cache = { }; + + Renderable[] cache = { }; public IEnumerable ModifyRender(Actor self, IEnumerable r) { if (IsVisible(self)) diff --git a/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs b/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs index d1bdd7583a..15a898671f 100644 --- a/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs +++ b/OpenRA.Mods.RA/Modifiers/HiddenUnderFog.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Move/Drag.cs b/OpenRA.Mods.RA/Move/Drag.cs index b697c901c2..e5608344de 100755 --- a/OpenRA.Mods.RA/Move/Drag.cs +++ b/OpenRA.Mods.RA/Move/Drag.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,13 +26,13 @@ namespace OpenRA.Mods.RA.Move endLocation = end; this.length = length; } - + int ticks = 0; public override Activity Tick( Actor self ) { var mobile = self.Trait(); mobile.PxPosition = int2.Lerp(startLocation, endLocation, ticks, length - 1); - + if (++ticks >= length) { mobile.IsMoving = false; diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index d8de266451..ef2f15f3b6 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Move return TerrainSpeeds[type].Cost; } - + public readonly Dictionary SubCellOffsets = new Dictionary() { {SubCell.TopLeft, new int2(-7,-6)}, @@ -76,15 +76,15 @@ namespace OpenRA.Mods.RA.Move {SubCell.BottomRight, new int2(6,6)}, {SubCell.FullCell, new int2(0,0)}, }; - + public bool CanEnterCell(World world, Player owner, int2 cell, Actor ignoreActor, bool checkTransientActors) { if (MovementCostForCell(world, cell) == int.MaxValue) return false; - + if (SharesCell && world.ActorMap.HasFreeSubCell(cell)) return true; - + var blockingActors = world.ActorMap.GetUnitsAt(cell).Where(x => x != ignoreActor).ToList(); if (checkTransientActors && blockingActors.Count > 0) { @@ -110,7 +110,7 @@ namespace OpenRA.Mods.RA.Move int __facing; int2 __fromCell, __toCell; public SubCell fromSubCell, toSubCell; - + int __altitude; [Sync] @@ -165,7 +165,7 @@ namespace OpenRA.Mods.RA.Move { this.fromSubCell = this.toSubCell = init.Get(); } - + if (init.Contains()) { this.__fromCell = this.__toCell = init.Get(); @@ -228,7 +228,7 @@ namespace OpenRA.Mods.RA.Move // Couldn't find a cell return target; } - + void PerformMoveInner(Actor self, int2 targetLocation, bool queued) { int2 currentLocation = NearestMoveableCell(targetLocation); @@ -247,7 +247,7 @@ namespace OpenRA.Mods.RA.Move self.SetTargetLine(Target.FromCell(currentLocation), Color.Green); } - + protected void PerformMove(Actor self, int2 targetLocation, bool queued) { if (queued) @@ -264,7 +264,7 @@ namespace OpenRA.Mods.RA.Move if (order.OrderString == "Stop") self.CancelActivity(); - + if (order.OrderString == "Scatter") OnNudge(self, self, true); } @@ -296,15 +296,15 @@ namespace OpenRA.Mods.RA.Move yield return Pair.New(toCell, toSubCell); } } - + public SubCell GetDesiredSubcell(int2 a, Actor ignoreActor) { if (!Info.SharesCell) return SubCell.FullCell; - + // Prioritise the current subcell return new[]{ fromSubCell, SubCell.TopLeft, SubCell.TopRight, SubCell.Center, - SubCell.BottomLeft, SubCell.BottomRight}.First(b => + SubCell.BottomLeft, SubCell.BottomRight}.First(b => { var blockingActors = self.World.ActorMap.GetUnitsAt(a,b).Where(c => c != ignoreActor); if (blockingActors.Count() > 0) @@ -320,7 +320,7 @@ namespace OpenRA.Mods.RA.Move return true; }); } - + public bool CanEnterCell(int2 p) { return CanEnterCell(p, null, true); diff --git a/OpenRA.Mods.RA/Move/Move.cs b/OpenRA.Mods.RA/Move/Move.cs index e067df7a14..b409dc119a 100755 --- a/OpenRA.Mods.RA/Move/Move.cs +++ b/OpenRA.Mods.RA/Move/Move.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Move public List path; Func> getPath; public Actor ignoreBuilding; - + // Scriptable move order // Ignores lane bias and nearby units public Move( int2 destination ) @@ -39,16 +39,16 @@ namespace OpenRA.Mods.RA.Move this.nearEnough = 0; } - public Move( int2 destination, int nearEnough ) + public Move( int2 destination, int nearEnough ) { this.getPath = (self,mobile) => self.World.WorldActor.Trait().FindUnitPath( mobile.toCell, destination, self ); this.destination = destination; this.nearEnough = nearEnough; } - + public Move(int2 destination, Actor ignoreBuilding) { - this.getPath = (self,mobile) => + this.getPath = (self,mobile) => self.World.WorldActor.Trait().FindPath( PathSearch.FromPoint( self.World, mobile.Info, self.Owner, mobile.toCell, destination, false ) .WithIgnoredBuilding( ignoreBuilding )); @@ -88,7 +88,7 @@ namespace OpenRA.Mods.RA.Move { var path = getPath(self, mobile).TakeWhile(a => a != mobile.toCell).ToList(); mobile.PathHash = HashList(path); - Log.Write("debug", "EvalPathHash #{0} {1}", + Log.Write("debug", "EvalPathHash #{0} {1}", self.ActorID, mobile.PathHash); return path; } @@ -111,7 +111,7 @@ namespace OpenRA.Mods.RA.Move path = EvalPath(self, mobile); SanityCheckPath( mobile ); } - + if( path.Count == 0 ) { destination = mobile.toCell; @@ -219,7 +219,7 @@ namespace OpenRA.Mods.RA.Move hasNudged = false; hasWaited = false; path.RemoveAt( path.Count - 1 ); - + var subCell = mobile.GetDesiredSubcell(nextCell, ignoreBuilding); return Pair.New(nextCell, subCell); } @@ -357,7 +357,7 @@ namespace OpenRA.Mods.RA.Move mobile.Facing, mobile.Facing, moveFraction - moveFractionTotal ); - + mobile.EnteringCell(self); mobile.SetLocation( mobile.toCell, mobile.toSubCell, mobile.toCell, mobile.toSubCell ); return ret2; diff --git a/OpenRA.Mods.RA/Move/PathFinder.cs b/OpenRA.Mods.RA/Move/PathFinder.cs index b9bfc6ade0..6da067ec42 100755 --- a/OpenRA.Mods.RA/Move/PathFinder.cs +++ b/OpenRA.Mods.RA/Move/PathFinder.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Move cached.tick = world.FrameNumber; return new List(cached.result); } - + var mi = self.Info.Traits.Get(); var pb = FindBidiPath( @@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Move PathSearch.FromPoints(world, mi, self.Owner, tilesInRange, src, true), PathSearch.FromPoint(world, mi, self.Owner, src, target, true) .InReverse()); - + return path; } } diff --git a/OpenRA.Mods.RA/Move/PathSearch.cs b/OpenRA.Mods.RA/Move/PathSearch.cs index 1d21c18991..95222b2dc3 100755 --- a/OpenRA.Mods.RA/Move/PathSearch.cs +++ b/OpenRA.Mods.RA/Move/PathSearch.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,10 +25,10 @@ namespace OpenRA.Mods.RA.Move public bool checkForBlocked; public Actor ignoreBuilding; public bool inReverse; - + MobileInfo mobileInfo; Player owner; - + public PathSearch(World world, MobileInfo mobileInfo, Player owner) { this.world = world; @@ -61,19 +61,19 @@ namespace OpenRA.Mods.RA.Move heuristic = h; return this; } - + public PathSearch WithoutLaneBias() { LaneBias = 0; return this; } - + public PathSearch FromPoint(int2 from) { AddInitialCell( from ); return this; } - + int LaneBias = 1; public int2 Expand( World world ) @@ -86,10 +86,10 @@ namespace OpenRA.Mods.RA.Move p = queue.Pop(); cellInfo[p.Location.X, p.Location.Y].Seen = true; - + var thisCost = mobileInfo.MovementCostForCell(world, p.Location); - if (thisCost == int.MaxValue) + if (thisCost == int.MaxValue) return p.Location; foreach( int2 d in directions ) @@ -101,16 +101,16 @@ namespace OpenRA.Mods.RA.Move continue; var costHere = mobileInfo.MovementCostForCell(world, newHere); - + if (costHere == int.MaxValue) continue; if (!mobileInfo.CanEnterCell(world, owner, newHere, ignoreBuilding, checkForBlocked)) continue; - + if (customBlock != null && customBlock(newHere)) continue; - + var est = heuristic( newHere ); if( est == int.MaxValue ) continue; @@ -136,7 +136,7 @@ namespace OpenRA.Mods.RA.Move cellInfo[ newHere.X, newHere.Y ].MinCost = newCost; queue.Add( new PathDistance( newCost + est, newHere ) ); - + } return p.Location; } @@ -161,14 +161,14 @@ namespace OpenRA.Mods.RA.Move cellInfo[ location.X, location.Y ] = new CellInfo( 0, location, false ); queue.Add( new PathDistance( heuristic( location ), location ) ); } - + public static PathSearch Search( World world, MobileInfo mi, Player owner, bool checkForBlocked ) { var search = new PathSearch(world, mi, owner) { checkForBlocked = checkForBlocked }; return search; } - + public static PathSearch FromPoint( World world, MobileInfo mi, Player owner, int2 from, int2 target, bool checkForBlocked ) { var search = new PathSearch(world, mi, owner) { diff --git a/OpenRA.Mods.RA/NukePaletteEffect.cs b/OpenRA.Mods.RA/NukePaletteEffect.cs index 195e3a3c02..ad4be642ad 100644 --- a/OpenRA.Mods.RA/NukePaletteEffect.cs +++ b/OpenRA.Mods.RA/NukePaletteEffect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,15 +37,15 @@ namespace OpenRA.Mods.RA { if (remainingFrames == 0) return; - + var frac = (float)remainingFrames / nukeEffectLength; - + var excludePalettes = new List(){"cursor", "chrome", "colorpicker", "shroud", "fog"}; foreach (var pal in palettes) { if (excludePalettes.Contains(pal.Key)) continue; - + for (var x = 0; x < 256; x++) { var orig = pal.Value.GetColor(x); diff --git a/OpenRA.Mods.RA/NullLoadScreen.cs b/OpenRA.Mods.RA/NullLoadScreen.cs index c58134f50b..b4ec3d5375 100644 --- a/OpenRA.Mods.RA/NullLoadScreen.cs +++ b/OpenRA.Mods.RA/NullLoadScreen.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,12 +20,12 @@ namespace OpenRA.Mods.RA { if (Game.Renderer == null) return; - + // Draw a black screen Game.Renderer.BeginFrame(float2.Zero, 1f); Game.Renderer.EndFrame( new NullInputHandler() ); } - + public void StartGame() { Widget.ResetAll(); diff --git a/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs b/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs index 65d454f9f5..67116d78a1 100644 --- a/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs +++ b/OpenRA.Mods.RA/OpenWidgetAtGameStart.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,12 +30,12 @@ namespace OpenRA.Mods.RA { this.Info = Info; } - + public void WorldLoaded(World world) { // Remove all open widgets Widget.ResetAll(); - + if (world.LocalPlayer != null) Game.OpenWindow(world, Info.Widget); else if (Info.ObserverWidget != null) @@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA // Clear any existing widget state if (Info.ClearRootWidget) Widget.ResetAll(); - + Game.LoadWidget(world, Info.Widget, Widget.RootWidget, new WidgetArgs()); } } diff --git a/OpenRA.Mods.RA/Orders/DeployOrderTargeter.cs b/OpenRA.Mods.RA/Orders/DeployOrderTargeter.cs index 059e92a9a0..6ba22e3383 100755 --- a/OpenRA.Mods.RA/Orders/DeployOrderTargeter.cs +++ b/OpenRA.Mods.RA/Orders/DeployOrderTargeter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Orders/EnterBuildingOrderTargeter.cs b/OpenRA.Mods.RA/Orders/EnterBuildingOrderTargeter.cs index 6a2f41529e..076ae61f19 100755 --- a/OpenRA.Mods.RA/Orders/EnterBuildingOrderTargeter.cs +++ b/OpenRA.Mods.RA/Orders/EnterBuildingOrderTargeter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs index cab8c6b98c..f3e18e5385 100755 --- a/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/PlaceBuildingOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Orders Producer = producer; Building = name; BuildingInfo = Rules.Info[Building].Traits.Get(); - + Preview = Rules.Info[Building].Traits.Get() .RenderPreview(Rules.Info[Building], producer.Owner); @@ -62,13 +62,13 @@ namespace OpenRA.Mods.RA.Orders Sound.Play(eva.BuildingCannotPlaceAudio); yield break; } - + var isLineBuild = Rules.Info[ Building ].Traits.Contains(); yield return new Order(isLineBuild ? "LineBuild" : "PlaceBuilding", Producer.Owner.PlayerActor, false) { TargetLocation = topLeft, TargetString = Building }; } } - + public void Tick( World world ) {} public void RenderAfterWorld( WorldRenderer wr, World world ) {} public void RenderBeforeWorld( WorldRenderer wr, World world ) @@ -79,7 +79,7 @@ namespace OpenRA.Mods.RA.Orders var actorInfo = Rules.Info[Building]; foreach (var dec in actorInfo.Traits.WithInterface()) dec.Render(wr, world, actorInfo, Traits.Util.CenterOfCell(position)); /* hack hack */ - + var cells = new Dictionary(); // Linebuild for walls. // Assumes a 1x1 footprint; weird things will happen for other footprints @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA.Orders r.Sprite.DrawAt(Game.CellSize*topLeft + r.Pos, wr.GetPaletteIndex(r.Palette), r.Scale*r.Sprite.size); - + var res = world.WorldActor.Trait(); var isCloseEnough = BuildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, Building, topLeft); foreach (var t in FootprintUtils.Tiles(Building, BuildingInfo, topLeft)) diff --git a/OpenRA.Mods.RA/Orders/PowerDownOrderGenerator.cs b/OpenRA.Mods.RA/Orders/PowerDownOrderGenerator.cs index d281327746..acf7d2fa4c 100755 --- a/OpenRA.Mods.RA/Orders/PowerDownOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/PowerDownOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Orders/RepairOrderGenerator.cs b/OpenRA.Mods.RA/Orders/RepairOrderGenerator.cs index 42c46fe53f..627a6e551e 100644 --- a/OpenRA.Mods.RA/Orders/RepairOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/RepairOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Orders/SellOrderGenerator.cs b/OpenRA.Mods.RA/Orders/SellOrderGenerator.cs index 45fc494cdb..e16f78274b 100755 --- a/OpenRA.Mods.RA/Orders/SellOrderGenerator.cs +++ b/OpenRA.Mods.RA/Orders/SellOrderGenerator.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Orders var underCursor = world.FindUnitsAtMouse(mi.Location) .Where(a => a.Owner == world.LocalPlayer && a.HasTrait()).FirstOrDefault(); - + if (underCursor != null) yield return new Order("Sell", underCursor, false); } diff --git a/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs b/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs index 94cc87ef42..e59b6a38cf 100644 --- a/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs +++ b/OpenRA.Mods.RA/Orders/SetChronoTankDestination.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Orders/UnitOrderTargeter.cs b/OpenRA.Mods.RA/Orders/UnitOrderTargeter.cs index e5d3809eea..1d764a3ff1 100755 --- a/OpenRA.Mods.RA/Orders/UnitOrderTargeter.cs +++ b/OpenRA.Mods.RA/Orders/UnitOrderTargeter.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/OreRefinery.cs b/OpenRA.Mods.RA/OreRefinery.cs index 8ccc381664..996a1039ab 100644 --- a/OpenRA.Mods.RA/OreRefinery.cs +++ b/OpenRA.Mods.RA/OreRefinery.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA public readonly int PipCount = 0; public readonly PipType PipColor = PipType.Red; public readonly int2 DockOffset = new int2 (1, 2); - + public readonly bool ShowTicks = true; public readonly int TickLifetime = 30; public readonly int TickVelocity = 2; @@ -39,10 +39,10 @@ namespace OpenRA.Mods.RA readonly Actor self; readonly OreRefineryInfo Info; PlayerResources PlayerResources; - + int currentDisplayTick = 0; int currentDisplayValue = 0; - + [Sync] public int Ore = 0; @@ -50,14 +50,14 @@ namespace OpenRA.Mods.RA Actor dockedHarv = null; [Sync] bool preventDock = false; - + public bool AllowDocking { get { return !preventDock; } } public int2 DeliverOffset { get { return Info.DockOffset; } } public virtual Activity DockSequence(Actor harv, Actor self) { return new RAHarvesterDockSequence(harv, self); } - + public OreRefinery(Actor self, OreRefineryInfo info) { this.self = self; @@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA return self.World.ActorsWithTrait() .Where(a => a.Trait.LinkedProc == self); } - + public bool CanGiveOre(int amount) { return PlayerResources.CanGiveOre(amount); @@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA if (dockedHarv != null && !dockedHarv.IsDead()) dockedHarv.CancelActivity(); } - + public void Tick(Actor self) { // Harvester was killed while unloading @@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA self.Trait().CancelCustomAnim(self); dockedHarv = null; } - + if (Info.ShowTicks && currentDisplayValue > 0 && --currentDisplayTick <= 0) { var temp = currentDisplayValue; @@ -125,18 +125,18 @@ namespace OpenRA.Mods.RA { harv.QueueActivity( new CallFunc( () => dockedHarv = harv, false ) ); harv.QueueActivity( DockSequence(harv, self) ); - harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) ); + harv.QueueActivity( new CallFunc( () => dockedHarv = null, false ) ); } harv.QueueActivity( new CallFunc( () => harv.Trait().ContinueHarvesting(harv) ) ); } - - + + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) - { + { // Steal any docked harv too if (dockedHarv != null) dockedHarv.ChangeOwner(newOwner); - + // Unlink any non-docked harvs foreach (var harv in GetLinkedHarvesters()) if (harv.Actor.Owner == oldOwner) diff --git a/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs b/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs index 305d2ded2b..ab6db57594 100644 --- a/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs +++ b/OpenRA.Mods.RA/PaletteFromCurrentTileset.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/PaletteFromFile.cs b/OpenRA.Mods.RA/PaletteFromFile.cs index e33519277d..8ea64870b9 100644 --- a/OpenRA.Mods.RA/PaletteFromFile.cs +++ b/OpenRA.Mods.RA/PaletteFromFile.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/PaletteFromRGBA.cs b/OpenRA.Mods.RA/PaletteFromRGBA.cs index a4856746ee..95ebef6905 100644 --- a/OpenRA.Mods.RA/PaletteFromRGBA.cs +++ b/OpenRA.Mods.RA/PaletteFromRGBA.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ParaDrop.cs b/OpenRA.Mods.RA/ParaDrop.cs index 4518aeb460..8eb87429de 100644 --- a/OpenRA.Mods.RA/ParaDrop.cs +++ b/OpenRA.Mods.RA/ParaDrop.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ParachuteAttachment.cs b/OpenRA.Mods.RA/ParachuteAttachment.cs index 964cd98d5b..4e44e2d659 100644 --- a/OpenRA.Mods.RA/ParachuteAttachment.cs +++ b/OpenRA.Mods.RA/ParachuteAttachment.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -14,13 +14,13 @@ using System.Drawing; using System.Linq; using OpenRA.Traits; -namespace OpenRA.Mods.RA +namespace OpenRA.Mods.RA { class ParachuteAttachmentInfo : TraitInfo { public readonly string ParachuteSprite = "parach"; public readonly int2 Offset = new int2(0,0); } - + class ParachuteAttachment {} } \ No newline at end of file diff --git a/OpenRA.Mods.RA/Passenger.cs b/OpenRA.Mods.RA/Passenger.cs index 7971828f8d..b1c54c8aa1 100644 --- a/OpenRA.Mods.RA/Passenger.cs +++ b/OpenRA.Mods.RA/Passenger.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -59,14 +59,14 @@ namespace OpenRA.Mods.RA var cargo = target.TraitOrDefault(); return cargo != null && cargo.HasSpace(info.Weight); } - + public string VoicePhraseForOrder(Actor self, Order order) { if (order.OrderString != "EnterTransport" || !CanEnter(order.TargetActor)) return null; return "Move"; } - + public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "EnterTransport") @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA var target = Target.FromOrder(order); self.SetTargetLine(target, Color.Green); - + self.CancelActivity(); self.QueueActivity(new MoveAdjacentTo(target)); self.QueueActivity(new EnterTransport(self, order.TargetActor)); diff --git a/OpenRA.Mods.RA/Player/ActorGroupProxy.cs b/OpenRA.Mods.RA/Player/ActorGroupProxy.cs index 35c5b404a6..19d41baa6e 100755 --- a/OpenRA.Mods.RA/Player/ActorGroupProxy.cs +++ b/OpenRA.Mods.RA/Player/ActorGroupProxy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Player/AllyRepair.cs b/OpenRA.Mods.RA/Player/AllyRepair.cs index 628c17d054..58227318e8 100644 --- a/OpenRA.Mods.RA/Player/AllyRepair.cs +++ b/OpenRA.Mods.RA/Player/AllyRepair.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index b2ccc9caee..5583481987 100755 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,15 +24,15 @@ namespace OpenRA.Mods.RA { public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info ) : base(self, self, info) {} - + [Sync] bool isActive = false; - + public override void Tick( Actor self ) { isActive = self.World.ActorsWithTrait() - .Any(x => x.Actor.Owner == self.Owner + .Any(x => x.Actor.Owner == self.Owner && x.Trait.Info.Produces.Contains(Info.Type)); - + base.Tick(self); } @@ -46,12 +46,12 @@ namespace OpenRA.Mods.RA { return isActive ? base.BuildableItems() : None; } - + protected override bool BuildUnit( string name ) - { + { // Find a production structure to build this actor var producers = self.World.ActorsWithTrait() - .Where(x => x.Actor.Owner == self.Owner + .Where(x => x.Actor.Owner == self.Owner && x.Trait.Info.Produces.Contains(Info.Type)) .OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary. @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA CancelProduction(name,1); return true; } - + foreach (var p in producers) { if (IsDisabledBuilding(p.Actor)) continue; diff --git a/OpenRA.Mods.RA/Player/PlaceBuilding.cs b/OpenRA.Mods.RA/Player/PlaceBuilding.cs index 72d70433c4..54a18aff10 100755 --- a/OpenRA.Mods.RA/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.RA/Player/PlaceBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,19 +27,19 @@ namespace OpenRA.Mods.RA self.World.AddFrameEndTask(w => { var prevItems = GetNumBuildables(self.Owner); - + // Find the queue with the target actor var queue = w.ActorsWithTrait() .Where(p => p.Actor.Owner == self.Owner && - p.Trait.CurrentItem() != null && - p.Trait.CurrentItem().Item == order.TargetString && + p.Trait.CurrentItem() != null && + p.Trait.CurrentItem().Item == order.TargetString && p.Trait.CurrentItem().RemainingTime == 0) .Select(p => p.Trait) .FirstOrDefault(); - + if (queue == null) return; - + var unit = Rules.Info[order.TargetString]; var buildingInfo = unit.Traits.Get(); @@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA new LocationInit( t ), new OwnerInit( order.Player ), }); - + if (playSounds) foreach (var s in buildingInfo.BuildSounds) Sound.PlayToPlayer(order.Player, s, building.CenterLocation); @@ -94,7 +94,7 @@ namespace OpenRA.Mods.RA var bi = unit.Traits.GetOrDefault(); if (bi == null) return; - + var producers = self.World.ActorsWithTrait() .Where( x => x.Actor.Owner == self.Owner && x.Actor.Info.Traits.Get().Produces.Contains( bi.Queue ) ) @@ -109,7 +109,7 @@ namespace OpenRA.Mods.RA static int GetNumBuildables(Player p) { if (p != p.World.LocalPlayer) return 0; // this only matters for local players. - + return p.World.ActorsWithTrait() .Where(a => a.Actor.Owner == p) .SelectMany(a => a.Trait.BuildableItems()).Distinct().Count(); diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index db7366d462..bbdc714660 100755 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,13 +23,13 @@ namespace OpenRA.Mods.RA public float BuildSpeed = 0.4f; public readonly int LowPowerSlowdown = 3; - + public readonly string ReadyAudio = "unitrdy1.aud"; public readonly string BlockedAudio = "nobuild1.aud"; public readonly string QueuedAudio = "train1.aud"; public readonly string OnHoldAudio = "onhold1.aud"; public readonly string CancelledAudio = "cancld1.aud"; - + public virtual object Create(ActorInitializer init) { return new ProductionQueue(init.self, init.self.Owner.PlayerActor, this); } } @@ -40,10 +40,10 @@ namespace OpenRA.Mods.RA PowerManager PlayerPower; PlayerResources playerResources; string Race; - + // A list of things we are currently building public List Queue = new List(); - + [Sync] public int QueueLength { get { return Queue.Count; } } [Sync] @@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA public bool CurrentPaused { get { return QueueLength == 0 ? false : Queue[0].Paused; } } [Sync] public bool CurrentDone { get { return QueueLength == 0 ? false : Queue[0].Done; } } - + // A list of things we could possibly build, even if our race doesn't normally get it public Dictionary Produceable; @@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA this.Info = info; playerResources = playerActor.Trait(); PlayerPower = playerActor.Trait(); - + Race = self.Owner.Country.Race; Produceable = InitTech(playerActor); } @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA return tech; } - + IEnumerable AllBuildables(string category) { return Rules.Info.Values @@ -126,20 +126,20 @@ namespace OpenRA.Mods.RA .Where( x => x.Traits.Contains() ) .Where( x => x.Traits.Get().Queue == category ); } - + public void OverrideProduction(ActorInfo type, bool buildable) { Produceable[type].Buildable = buildable; Produceable[type].Sticky = true; } - + public void PrerequisitesAvailable(string key) { var ps = Produceable[ Rules.Info[key] ]; if (!ps.Sticky) ps.Buildable = true; } - + public void PrerequisitesUnavailable(string key) { var ps = Produceable[ Rules.Info[key] ]; @@ -151,35 +151,35 @@ namespace OpenRA.Mods.RA { return Queue.ElementAtOrDefault(0); } - + public IEnumerable AllQueued() { return Queue; } - + public virtual IEnumerable AllItems() - { + { if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().AllTech) return Produceable.Select(a => a.Key); - + return Produceable.Where(a => a.Value.Buildable || a.Value.Visible).Select(a => a.Key); } - + public virtual IEnumerable BuildableItems() { if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().AllTech) return Produceable.Select(a => a.Key); - + return Produceable.Where(a => a.Value.Buildable).Select(a => a.Key); } - + public bool CanBuild(ActorInfo actor) { return Produceable.ContainsKey(actor) && Produceable[actor].Buildable; } - + public virtual void Tick(Actor self) - { + { while (Queue.Count > 0 && !BuildableItems().Any(b => b.Name == Queue[ 0 ].Item)) { playerResources.GiveCash(Queue[0].TotalCost - Queue[0].RemainingCost); // refund what's been paid so far. @@ -199,13 +199,13 @@ namespace OpenRA.Mods.RA var bi = unit.Traits.Get(); if (bi.Queue != Info.Type) return; /* Not built by this queue */ - + var cost = unit.Traits.Contains() ? unit.Traits.Get().Cost : 0; var time = GetBuildTime(order.TargetString); if (!BuildableItems().Any(b => b.Name == order.TargetString)) return; /* you can't build that!! */ - + for (var n = 0; n < order.TargetLocation.X; n++) // repeat count { bool hasPlayedSound = false; @@ -214,7 +214,7 @@ namespace OpenRA.Mods.RA _ => { var isBuilding = unit.Traits.Contains(); - + if (isBuilding && !hasPlayedSound) { Sound.PlayToPlayer(order.Player, Info.ReadyAudio); @@ -247,13 +247,13 @@ namespace OpenRA.Mods.RA } } } - + public int GetBuildTime(String unitString) { var unit = Rules.Info[unitString]; if (unit == null || ! unit.Traits.Contains()) return 0; - + if (self.World.LobbyInfo.GlobalSettings.AllowCheats && self.Owner.PlayerActor.Trait().FastBuild) return 0; var cost = unit.Traits.Contains() ? unit.Traits.Get().Cost : 0; var time = cost @@ -302,14 +302,14 @@ namespace OpenRA.Mods.RA // Builds a unit from the actor that holds this queue (1 queue per building) // Returns false if the unit can't be built protected virtual bool BuildUnit( string name ) - { + { // Cannot produce if i'm dead if (!self.IsInWorld || self.IsDead()) { CancelProduction(name, 1); return true; } - + var sp = self.TraitsImplementing().FirstOrDefault(p => p.Info.Produces.Contains(Info.Type)); if (sp != null && !IsDisabledBuilding(self) && sp.Produce(self, Rules.Info[ name ])) { @@ -326,7 +326,7 @@ namespace OpenRA.Mods.RA public bool Buildable = false; public bool Sticky = false; } - + public class ProductionItem { public readonly string Item; @@ -374,7 +374,7 @@ namespace OpenRA.Mods.RA if (pm.PowerState != PowerState.Normal) { if (--slowdown <= 0) - slowdown = Queue.Info.LowPowerSlowdown; + slowdown = Queue.Info.LowPowerSlowdown; else return; } diff --git a/OpenRA.Mods.RA/Player/SurrenderOnDisconnect.cs b/OpenRA.Mods.RA/Player/SurrenderOnDisconnect.cs index 68411a11a1..2b2083689f 100644 --- a/OpenRA.Mods.RA/Player/SurrenderOnDisconnect.cs +++ b/OpenRA.Mods.RA/Player/SurrenderOnDisconnect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/PrimaryBuilding.cs b/OpenRA.Mods.RA/PrimaryBuilding.cs index 9d322a2b14..709cc5f793 100755 --- a/OpenRA.Mods.RA/PrimaryBuilding.cs +++ b/OpenRA.Mods.RA/PrimaryBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA { yield return (isPrimary) ? TagType.Primary : TagType.None; } - + public IEnumerable Orders { get { yield return new DeployOrderTargeter( "PrimaryProducer", 1 ); } diff --git a/OpenRA.Mods.RA/Production.cs b/OpenRA.Mods.RA/Production.cs index aee456a973..0f74cb8260 100755 --- a/OpenRA.Mods.RA/Production.cs +++ b/OpenRA.Mods.RA/Production.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA public class ProductionInfo : ITraitInfo { public readonly string[] Produces = { }; - + public virtual object Create(ActorInitializer init) { return new Production(this); } } @@ -31,15 +31,15 @@ namespace OpenRA.Mods.RA public readonly int Facing = -1; } public class Exit {} - + public class Production - { + { public ProductionInfo Info; public Production(ProductionInfo info) { Info = info; } - + public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo) { var newUnit = self.World.CreateActor(false, producee.Name, new TypeDictionary @@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA var teleportable = newUnit.Trait(); var facing = newUnit.TraitOrDefault(); - + // Set the physical position of the unit as the exit cell teleportable.SetPosition(newUnit,exit); var to = Util.CenterOfCell(exit); @@ -71,7 +71,7 @@ namespace OpenRA.Mods.RA } var target = MoveToRallyPoint(self, newUnit, exit); - + newUnit.SetTargetLine(Target.FromCell(target), Color.Green, false); foreach (var t in self.TraitsImplementing()) t.UnitProduced(self, newUnit, exit); @@ -123,7 +123,7 @@ namespace OpenRA.Mods.RA { var mobileInfo = producee.Traits.GetOrDefault(); - return mobileInfo == null || + return mobileInfo == null || mobileInfo.CanEnterCell(self.World, self.Owner, self.Location + s.ExitCell, self, true); } } diff --git a/OpenRA.Mods.RA/ProductionBar.cs b/OpenRA.Mods.RA/ProductionBar.cs index 8179113323..a678598c3c 100644 --- a/OpenRA.Mods.RA/ProductionBar.cs +++ b/OpenRA.Mods.RA/ProductionBar.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Properties/AssemblyInfo.cs b/OpenRA.Mods.RA/Properties/AssemblyInfo.cs index 06774d9dcf..42dfd22c6b 100644 --- a/OpenRA.Mods.RA/Properties/AssemblyInfo.cs +++ b/OpenRA.Mods.RA/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Mods.RA")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.Mods.RA/ProvidesRadar.cs b/OpenRA.Mods.RA/ProvidesRadar.cs index c6c3a8d113..8ac6d28813 100755 --- a/OpenRA.Mods.RA/ProvidesRadar.cs +++ b/OpenRA.Mods.RA/ProvidesRadar.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ProximityCaptor.cs b/OpenRA.Mods.RA/ProximityCaptor.cs index 07602d7be4..f7301e457e 100644 --- a/OpenRA.Mods.RA/ProximityCaptor.cs +++ b/OpenRA.Mods.RA/ProximityCaptor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ProximityCapturable.cs b/OpenRA.Mods.RA/ProximityCapturable.cs index a52c8d23cb..4670e2e364 100644 --- a/OpenRA.Mods.RA/ProximityCapturable.cs +++ b/OpenRA.Mods.RA/ProximityCapturable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/RALoadScreen.cs b/OpenRA.Mods.RA/RALoadScreen.cs index b3feccff6a..d4924db465 100644 --- a/OpenRA.Mods.RA/RALoadScreen.cs +++ b/OpenRA.Mods.RA/RALoadScreen.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,19 +20,19 @@ using OpenRA.Widgets; namespace OpenRA.Mods.RA { public class RALoadScreen : ILoadScreen - { + { Dictionary Info; static string[] Comments = new[] { "Filling Crates...", "Charging Capacitors...", "Reticulating Splines...", "Planting Trees...", "Building Bridges...", "Aging Empires...", "Compiling EVA...", "Constructing Pylons...", "Activating Skynet...", "Splitting Atoms..." }; - + Stopwatch lastLoadScreen = new Stopwatch(); Rectangle StripeRect; Sprite Stripe, Logo; float2 LogoPos; - + Renderer r; public void Init(Dictionary info) { @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA // can display loadscreen as early as possible r = Game.Renderer; if (r == null) return; - + var s = new Sheet("mods/ra/uibits/loadscreen.png"); Logo = new Sprite(s, new Rectangle(0,0,256,256), TextureChannel.Alpha); Stripe = new Sprite(s, new Rectangle(256,0,256,256), TextureChannel.Alpha); @@ -53,17 +53,17 @@ namespace OpenRA.Mods.RA { if (r == null) return; - + // Update text at most every 0.5 seconds if (lastLoadScreen.ElapsedTime() < 0.5) return; - + lastLoadScreen.Reset(); var text = Comments.Random(Game.CosmeticRandom); var textSize = r.Fonts["Bold"].Measure(text); - + r.BeginFrame(float2.Zero, 1f); - WidgetUtils.FillRectWithSprite(StripeRect, Stripe); + WidgetUtils.FillRectWithSprite(StripeRect, Stripe); r.RgbaSpriteRenderer.DrawSprite(Logo, LogoPos); r.Fonts["Bold"].DrawText(text, new float2(Renderer.Resolution.Width - textSize.X - 20, Renderer.Resolution.Height - textSize.Y - 20), Color.White); r.EndFrame( new NullInputHandler() ); diff --git a/OpenRA.Mods.RA/RadarColorFromTerrain.cs b/OpenRA.Mods.RA/RadarColorFromTerrain.cs index 4907286bc5..da3dd40d08 100644 --- a/OpenRA.Mods.RA/RadarColorFromTerrain.cs +++ b/OpenRA.Mods.RA/RadarColorFromTerrain.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA { c = self.World.TileSet.Terrain[terrain].Color; } - + public bool VisibleOnRadar(Actor self) { return true; } public Color RadarColorOverride(Actor self) { diff --git a/OpenRA.Mods.RA/RallyPoint.cs b/OpenRA.Mods.RA/RallyPoint.cs index b1855179b4..e357d1bb23 100755 --- a/OpenRA.Mods.RA/RallyPoint.cs +++ b/OpenRA.Mods.RA/RallyPoint.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Reloads.cs b/OpenRA.Mods.RA/Reloads.cs index e9424f53e5..f66957dbb3 100644 --- a/OpenRA.Mods.RA/Reloads.cs +++ b/OpenRA.Mods.RA/Reloads.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,14 +26,14 @@ namespace OpenRA.Mods.RA int remainingTicks; ReloadsInfo Info; LimitedAmmo la; - + public Reloads(Actor self, ReloadsInfo info) { Info = info; remainingTicks = info.Period; la = self.Trait(); } - + public void Tick(Actor self) { if (--remainingTicks == 0) diff --git a/OpenRA.Mods.RA/Render/RenderBuilding.cs b/OpenRA.Mods.RA/Render/RenderBuilding.cs index 1424875578..d246ffa300 100755 --- a/OpenRA.Mods.RA/Render/RenderBuilding.cs +++ b/OpenRA.Mods.RA/Render/RenderBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Render public readonly bool HasMakeAnimation = true; public readonly float2 Origin = float2.Zero; public override object Create(ActorInitializer init) { return new RenderBuilding(init, this);} - + public override IEnumerable RenderPreview(ActorInfo building, Player owner) { return base.RenderPreview(building, owner) @@ -35,10 +35,10 @@ namespace OpenRA.Mods.RA.Render public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier { readonly RenderBuildingInfo Info; - + public RenderBuilding( ActorInitializer init, RenderBuildingInfo info ) : this(init, info, () => 0) { } - + public RenderBuilding( ActorInitializer init, RenderBuildingInfo info, Func baseFacing ) : base(init.self, baseFacing) { @@ -46,14 +46,14 @@ namespace OpenRA.Mods.RA.Render var self = init.self; // Work around a bogus crash anim.PlayRepeating( NormalizeSequence(self, "idle") ); - + // Can't call Complete() directly from ctor because other traits haven't been inited yet if (self.Info.Traits.Get().HasMakeAnimation && !init.Contains()) self.QueueActivity(new MakeAnimation(self, () => Complete(self))); - else + else self.QueueActivity(new CallFunc(() => Complete(self))); } - + public IEnumerable ModifyRender(Actor self, IEnumerable r) { var disabled = self.TraitsImplementing().Any(d => d.Disabled); @@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Render yield return ret.WithPalette("disabled").WithZOffset(1); } } - + void Complete( Actor self ) { anim.PlayRepeating( NormalizeSequence(self, "idle") ); @@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA.Render anim.PlayThen(NormalizeSequence(self, name), () => { anim.PlayRepeating(NormalizeSequence(self, "idle")); a(); }); } - + public void PlayCustomAnimRepeating(Actor self, string name) { anim.PlayThen(NormalizeSequence(self, name), @@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Render { anim.PlayRepeating( NormalizeSequence(self, "idle") ); } - + public virtual void DamageStateChanged(Actor self, AttackInfo e) { if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy) diff --git a/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs b/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs index 9e288e6cfe..5e2ec1d079 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingCharge.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA.Render public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); } } - /* used for tesla */ + /* used for tesla */ public class RenderBuildingCharge : RenderBuilding { RenderBuildingChargeInfo info; @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Render public void PlayCharge(Actor self) { Sound.Play(info.ChargeAudio, self.CenterLocation); - anim.PlayThen(NormalizeSequence(self, "active"), + anim.PlayThen(NormalizeSequence(self, "active"), () => anim.PlayRepeating(NormalizeSequence(self, "idle"))); } } diff --git a/OpenRA.Mods.RA/Render/RenderBuildingSilo.cs b/OpenRA.Mods.RA/Render/RenderBuildingSilo.cs index d19efb8eb3..89552d3221 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingSilo.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingSilo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Render class RenderBuildingSilo : RenderBuilding, INotifyBuildComplete, INotifyCapture { PlayerResources playerResources; - + public RenderBuildingSilo( ActorInitializer init, RenderBuildingInfo info ) : base(init, info) { @@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Render ? (49 * playerResources.Ore) / (10 * playerResources.OreCapacity) : 0); } - + public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) { playerResources = newOwner.PlayerActor.Trait(); diff --git a/OpenRA.Mods.RA/Render/RenderBuildingTurreted.cs b/OpenRA.Mods.RA/Render/RenderBuildingTurreted.cs index 682845b29f..450d682704 100644 --- a/OpenRA.Mods.RA/Render/RenderBuildingTurreted.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingTurreted.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWall.cs b/OpenRA.Mods.RA/Render/RenderBuildingWall.cs index f50d35790e..7feb201ae0 100644 --- a/OpenRA.Mods.RA/Render/RenderBuildingWall.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWall.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,18 +23,18 @@ namespace OpenRA.Mods.RA.Render { string seqName; int adjacentWalls = 0; - + public RenderBuildingWall( ActorInitializer init, RenderBuildingInfo info ) : base(init, info) { seqName = "idle"; } - + public void BuildingComplete( Actor self ) { anim.PlayFetchIndex(seqName, () => adjacentWalls); } - + public override void DamageStateChanged(Actor self, AttackInfo e) { if (e.DamageState == DamageState.Medium && anim.HasSequence("scratched-idle")) diff --git a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs index 93e6287e9e..00afee5a48 100755 --- a/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs +++ b/OpenRA.Mods.RA/Render/RenderBuildingWarFactory.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA.Render bool isOpen; [Sync] int2 openExit; - + bool buildComplete; public RenderBuildingWarFactory(ActorInitializer init, RenderBuildingInfo info) : base(init, info) @@ -96,7 +96,7 @@ namespace OpenRA.Mods.RA.Render { anims.Remove("roof"); } - + public void Sold(Actor self) { } } } diff --git a/OpenRA.Mods.RA/Render/RenderEditorOnly.cs b/OpenRA.Mods.RA/Render/RenderEditorOnly.cs index 70d820b1b0..9339f58d4c 100644 --- a/OpenRA.Mods.RA/Render/RenderEditorOnly.cs +++ b/OpenRA.Mods.RA/Render/RenderEditorOnly.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/RenderFlare.cs b/OpenRA.Mods.RA/Render/RenderFlare.cs index e63641de88..9475849bdb 100755 --- a/OpenRA.Mods.RA/Render/RenderFlare.cs +++ b/OpenRA.Mods.RA/Render/RenderFlare.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/RenderHarvester.cs b/OpenRA.Mods.RA/Render/RenderHarvester.cs index e567b5d9c1..0bef4c064e 100644 --- a/OpenRA.Mods.RA/Render/RenderHarvester.cs +++ b/OpenRA.Mods.RA/Render/RenderHarvester.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,11 +26,11 @@ namespace OpenRA.Mods.RA.Render { Harvester harv; RenderHarvesterInfo info; - - public RenderHarvester(Actor self, RenderHarvesterInfo info) : base(self) + + public RenderHarvester(Actor self, RenderHarvesterInfo info) : base(self) { this.info = info; - + harv = self.Trait(); foreach( var image in info.ImagesByFullness ) new Animation( image ); /* just force these to get loaded upfront */ diff --git a/OpenRA.Mods.RA/Render/RenderInfantry.cs b/OpenRA.Mods.RA/Render/RenderInfantry.cs index d1f68b92ac..26a3586477 100644 --- a/OpenRA.Mods.RA/Render/RenderInfantry.cs +++ b/OpenRA.Mods.RA/Render/RenderInfantry.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA.Render public readonly int MinIdleWaitTicks = 30; public readonly int MaxIdleWaitTicks = 110; public readonly string[] IdleAnimations = {}; - + public override object Create(ActorInitializer init) { return new RenderInfantry(init.self, this); } } @@ -37,24 +37,24 @@ namespace OpenRA.Mods.RA.Render }; protected bool dirty = false; - + RenderInfantryInfo Info; string idleSequence; int idleDelay; Mobile mobile; - + protected virtual string NormalizeInfantrySequence(Actor self, string baseSequence) { return baseSequence; } - + protected virtual bool AllowIdleAnimation(Actor self) { return Info.IdleAnimations.Length > 0; } - + public AnimationState State { get; private set; } - + public RenderInfantry(Actor self, RenderInfantryInfo info) : base(self, RenderSimple.MakeFacingFunc(self)) { @@ -76,7 +76,7 @@ namespace OpenRA.Mods.RA.Render public override void Tick(Actor self) { base.Tick(self); - + if ((State == AnimationState.Moving || dirty) && !mobile.IsMoving) { State = AnimationState.Waiting; @@ -89,14 +89,14 @@ namespace OpenRA.Mods.RA.Render } dirty = false; } - + public void TickIdle(Actor self) { if (State != AnimationState.Idle && State != AnimationState.IdleAnimating) { anim.PlayFetchIndex(NormalizeInfantrySequence(self, "stand"), () => 0); State = AnimationState.Idle; - + if (Info.IdleAnimations.Length > 0) { idleSequence = Info.IdleAnimations.Random(self.World.SharedRandom); diff --git a/OpenRA.Mods.RA/Render/RenderSpy.cs b/OpenRA.Mods.RA/Render/RenderSpy.cs index c20e97903f..80a571ae08 100755 --- a/OpenRA.Mods.RA/Render/RenderSpy.cs +++ b/OpenRA.Mods.RA/Render/RenderSpy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,9 +24,9 @@ namespace OpenRA.Mods.RA.Render { string disguisedAsSprite; Spy spy; - - public RenderSpy(Actor self, RenderSpyInfo info) : base(self, info) - { + + public RenderSpy(Actor self, RenderSpyInfo info) : base(self, info) + { spy = self.Trait(); disguisedAsSprite = spy.disguisedAsSprite; } diff --git a/OpenRA.Mods.RA/Render/RenderUnit.cs b/OpenRA.Mods.RA/Render/RenderUnit.cs index 276406c8d9..d280ab04c1 100644 --- a/OpenRA.Mods.RA/Render/RenderUnit.cs +++ b/OpenRA.Mods.RA/Render/RenderUnit.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Render { anim.PlayThen(newAnim, () => { anim.Play("idle"); if (after != null) after(); }); } - + public void PlayCustomAnimRepeating(Actor self, string name) { anim.PlayThen(name, diff --git a/OpenRA.Mods.RA/Render/RenderUnitReload.cs b/OpenRA.Mods.RA/Render/RenderUnitReload.cs index 32d736dd64..e7ca29c48c 100755 --- a/OpenRA.Mods.RA/Render/RenderUnitReload.cs +++ b/OpenRA.Mods.RA/Render/RenderUnitReload.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/RenderUnitSpinner.cs b/OpenRA.Mods.RA/Render/RenderUnitSpinner.cs index c6da43cc43..87378d49b4 100755 --- a/OpenRA.Mods.RA/Render/RenderUnitSpinner.cs +++ b/OpenRA.Mods.RA/Render/RenderUnitSpinner.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/RenderUnitTurreted.cs b/OpenRA.Mods.RA/Render/RenderUnitTurreted.cs index 4941a006d5..d1a996c4f4 100755 --- a/OpenRA.Mods.RA/Render/RenderUnitTurreted.cs +++ b/OpenRA.Mods.RA/Render/RenderUnitTurreted.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Render for( var i = 0; i < attack.Turrets.Count; i++ ) { var turret = attack.Turrets[i]; - anims.Add( "turret_{0}".F(i), + anims.Add( "turret_{0}".F(i), new AnimationWithOffset( turretAnim, () => Combat.GetTurretPosition( self, facing, turret ), null)); diff --git a/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs index 3e35945673..0a2eb2a6a9 100755 --- a/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs +++ b/OpenRA.Mods.RA/Render/WithBuildingExplosion.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs index c2ce4a0082..00f5585ecb 100644 --- a/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs +++ b/OpenRA.Mods.RA/Render/WithMuzzleFlash.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Render/WithRotor.cs b/OpenRA.Mods.RA/Render/WithRotor.cs index d65cba2071..d44cf2c38a 100755 --- a/OpenRA.Mods.RA/Render/WithRotor.cs +++ b/OpenRA.Mods.RA/Render/WithRotor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA.Render public void Tick(Actor self) { var isFlying = self.Trait().Altitude > 0 && !self.IsDead(); - if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor")) + if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor")) return; rotorAnim.ReplaceAnim(isFlying ? "rotor" : "slow-rotor"); diff --git a/OpenRA.Mods.RA/Render/WithShadow.cs b/OpenRA.Mods.RA/Render/WithShadow.cs index 2c43b9e27a..4ef6c30d9b 100644 --- a/OpenRA.Mods.RA/Render/WithShadow.cs +++ b/OpenRA.Mods.RA/Render/WithShadow.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA.Render var move = self.Trait(); var shadowSprites = r.Select(a => a.WithPalette("shadow")); - var flyingSprites = (move.Altitude <= 0) ? r + var flyingSprites = (move.Altitude <= 0) ? r : r.Select(a => a.WithPos(a.Pos - new float2(0, move.Altitude)).WithZOffset(move.Altitude)); return shadowSprites.Concat(flyingSprites); diff --git a/OpenRA.Mods.RA/Render/WithSmoke.cs b/OpenRA.Mods.RA/Render/WithSmoke.cs index 9f84e056d7..a31363b801 100644 --- a/OpenRA.Mods.RA/Render/WithSmoke.cs +++ b/OpenRA.Mods.RA/Render/WithSmoke.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/RenderDetectionCircle.cs b/OpenRA.Mods.RA/RenderDetectionCircle.cs index 54e5300b46..30645533e4 100644 --- a/OpenRA.Mods.RA/RenderDetectionCircle.cs +++ b/OpenRA.Mods.RA/RenderDetectionCircle.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA { if (self.Owner != self.World.LocalPlayer) return; - + wr.DrawRangeCircle( Color.FromArgb(128, Color.LimeGreen), self.CenterLocation, self.Info.Traits.Get().Range); diff --git a/OpenRA.Mods.RA/RenderRangeCircle.cs b/OpenRA.Mods.RA/RenderRangeCircle.cs index cca5e7ae85..98d0de88cd 100644 --- a/OpenRA.Mods.RA/RenderRangeCircle.cs +++ b/OpenRA.Mods.RA/RenderRangeCircle.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA { if (self.Owner != self.World.LocalPlayer) return; - + wr.DrawRangeCircle( Color.FromArgb(128, Color.Yellow), self.CenterLocation, (int)self.Trait().GetMaximumRange()); diff --git a/OpenRA.Mods.RA/Repairable.cs b/OpenRA.Mods.RA/Repairable.cs index 69ab12f55b..972660b23f 100644 --- a/OpenRA.Mods.RA/Repairable.cs +++ b/OpenRA.Mods.RA/Repairable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { class RepairableInfo : ITraitInfo, Requires - { + { public readonly string[] RepairBuildings = { "fix" }; public virtual object Create(ActorInitializer init) { return new Repairable(init.self); } } @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA this.self = self; Health = self.Trait(); } - + public IEnumerable Orders { get { yield return new EnterOrderTargeter( "Repair", 5, false, true, target => CanRepairAt( target ), _ => CanRepair() ); } @@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA var rp = order.TargetActor.TraitOrDefault(); if (rp != null) - self.QueueActivity(new CallFunc(() => + self.QueueActivity(new CallFunc(() => { self.SetTargetLine(Target.FromCell(rp.rallyPoint), Color.Green); self.QueueActivity(mobile.MoveTo(rp.rallyPoint, order.TargetActor)); diff --git a/OpenRA.Mods.RA/RepairableNear.cs b/OpenRA.Mods.RA/RepairableNear.cs index ed40d60c71..7e08097401 100644 --- a/OpenRA.Mods.RA/RepairableNear.cs +++ b/OpenRA.Mods.RA/RepairableNear.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/RepairsUnits.cs b/OpenRA.Mods.RA/RepairsUnits.cs index 9f2cc82a4c..9b31a97bfd 100644 --- a/OpenRA.Mods.RA/RepairsUnits.cs +++ b/OpenRA.Mods.RA/RepairsUnits.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ReplaceWithActor.cs b/OpenRA.Mods.RA/ReplaceWithActor.cs index 895a3a84b7..d09e6b2294 100644 --- a/OpenRA.Mods.RA/ReplaceWithActor.cs +++ b/OpenRA.Mods.RA/ReplaceWithActor.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA [ActorReference] public readonly string Actor = null; - public object Create(ActorInitializer init) { return new ReplaceWithActor(init.self, this); } + public object Create(ActorInitializer init) { return new ReplaceWithActor(init.self, this); } } class ReplaceWithActor diff --git a/OpenRA.Mods.RA/Reservable.cs b/OpenRA.Mods.RA/Reservable.cs index daf86d50d1..c1ce3a4423 100755 --- a/OpenRA.Mods.RA/Reservable.cs +++ b/OpenRA.Mods.RA/Reservable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { - if (reservedFor == null) + if (reservedFor == null) return; /* nothing to do */ if (!Target.FromActor( reservedFor ).IsValid) @@ -51,15 +51,15 @@ namespace OpenRA.Mods.RA var res = a.TraitOrDefault(); return res != null && res.reservedFor != null; } - + public void Killed(Actor self, AttackInfo e) { if (herp != null) herp.UnReserve(); } - + public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) - { + { if (herp != null) herp.UnReserve(); } diff --git a/OpenRA.Mods.RA/ScaredyCat.cs b/OpenRA.Mods.RA/ScaredyCat.cs index 7512d5104c..d4203dc362 100644 --- a/OpenRA.Mods.RA/ScaredyCat.cs +++ b/OpenRA.Mods.RA/ScaredyCat.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA class ScaredyCatInfo : ITraitInfo { public readonly int MoveRadius = 2; - + public object Create(ActorInitializer init) { return new ScaredyCat(init.self, this); } } @@ -31,58 +31,58 @@ namespace OpenRA.Mods.RA { Info = info; } - + public void TickIdle(Actor self) { if (!Panicked) return; - + var target = Util.SubPxVector[self.World.SharedRandom.Next(255)]* Info.MoveRadius / 1024 + self.Location; self.Trait().ResolveOrder(self, new Order("Move", self, false) { TargetLocation = target }); } - + public void Damaged(Actor self, AttackInfo e) { Panicked = true; } } - + class RenderInfantryPanicInfo : RenderInfantryInfo, Requires { public override object Create(ActorInitializer init) { return new RenderInfantryPanic(init.self, this); } } - + class RenderInfantryPanic : RenderInfantry { readonly ScaredyCat sc; bool wasPanic; - + public RenderInfantryPanic(Actor self, RenderInfantryPanicInfo info) : base(self, info) { sc = self.Trait(); } - + protected override string NormalizeInfantrySequence(Actor self, string baseSequence) { var prefix = sc != null && sc.Panicked ? "panic-" : ""; - + if (anim.HasSequence(prefix + baseSequence)) return prefix + baseSequence; else return baseSequence; } - + protected override bool AllowIdleAnimation(Actor self) { return base.AllowIdleAnimation(self) && !sc.Panicked; } - + public override void Tick (Actor self) { if (wasPanic != sc.Panicked) dirty = true; - + wasPanic = sc.Panicked; base.Tick(self); } diff --git a/OpenRA.Mods.RA/Scripting/Media.cs b/OpenRA.Mods.RA/Scripting/Media.cs index 11ea6bc20d..97dd9b0ee8 100644 --- a/OpenRA.Mods.RA/Scripting/Media.cs +++ b/OpenRA.Mods.RA/Scripting/Media.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -14,29 +14,29 @@ using OpenRA.Widgets; namespace OpenRA.Scripting { public class Media - { + { public static void PlayFMVFullscreen(World w, string movie, Action onComplete) { var playerRoot = Game.OpenWindow(w, "FMVPLAYER"); var player = playerRoot.GetWidget("PLAYER"); w.DisableTick = true; - player.Load(movie); - + player.Load(movie); + // Mute world sounds var oldModifier = Sound.SoundVolumeModifier; // Todo: this also modifies vqa audio //Sound.SoundVolumeModifier = 0f; - + // Stop music while fmv plays var music = Sound.MusicPlaying; if (music) Sound.PauseMusic(); - + player.PlayThen(() => { if (music) Sound.PlayMusic(); - + Widget.CloseWindow(); Sound.SoundVolumeModifier = oldModifier; w.DisableTick = false; diff --git a/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs b/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs index 7f5e6bb6df..5429dfc629 100644 --- a/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs +++ b/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,20 +17,20 @@ using OpenRA.Mods.RA.Render; namespace OpenRA.Scripting { public class RASpecialPowers - { + { public static void Chronoshift(World world, List>units, Actor chronosphere, int duration, bool killCargo) { if (chronosphere != null) chronosphere.Trait().PlayCustomAnim(chronosphere, "active"); - + // Trigger screen desaturate effect foreach (var a in world.ActorsWithTrait()) a.Trait.Enable(); - + Sound.Play("chrono2.aud", units.First().First.CenterLocation); - + foreach (var kv in units) - { + { var target = kv.First; var targetCell = kv.Second; var cs = target.Trait(); @@ -42,7 +42,7 @@ namespace OpenRA.Scripting chronosphere); } - + } } } diff --git a/OpenRA.Mods.RA/SeedsResource.cs b/OpenRA.Mods.RA/SeedsResource.cs index 77f2438881..ce94ccd980 100644 --- a/OpenRA.Mods.RA/SeedsResource.cs +++ b/OpenRA.Mods.RA/SeedsResource.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -49,8 +49,8 @@ namespace OpenRA.Mods.RA .Cast().FirstOrDefault(); // Todo: Valid terrain should be specified in the resource - if (cell != null && self.World.Map.IsInMap(cell.Value) && - (resLayer.GetResource(cell.Value) == resourceType + if (cell != null && self.World.Map.IsInMap(cell.Value) && + (resLayer.GetResource(cell.Value) == resourceType || (resLayer.GetResource(cell.Value) == null && resLayer.AllowResourceAt(resourceType, cell.Value)))) resLayer.AddResource(resourceType, cell.Value.X, cell.Value.Y, 1); diff --git a/OpenRA.Mods.RA/SelfHealing.cs b/OpenRA.Mods.RA/SelfHealing.cs index 2f1810e885..e5714051bf 100644 --- a/OpenRA.Mods.RA/SelfHealing.cs +++ b/OpenRA.Mods.RA/SelfHealing.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA public readonly int Step = 5; public readonly int Ticks = 5; public readonly float HealIfBelow = .5f; - + public virtual object Create(ActorInitializer init) { return new SelfHealing(this); } } @@ -26,14 +26,14 @@ namespace OpenRA.Mods.RA [Sync] int ticks; SelfHealingInfo Info; - + public SelfHealing(SelfHealingInfo info) { Info = info; } public void Tick(Actor self) { if (self.IsDead()) return; - + var health = self.Trait(); if (health.HP >= Info.HealIfBelow*health.MaxHP) return; diff --git a/OpenRA.Mods.RA/Sellable.cs b/OpenRA.Mods.RA/Sellable.cs index 71ab7d34e1..2b301ec016 100644 --- a/OpenRA.Mods.RA/Sellable.cs +++ b/OpenRA.Mods.RA/Sellable.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,11 +17,11 @@ using OpenRA.Mods.RA.Activities; namespace OpenRA.Mods.RA { - class SellableInfo : TraitInfo + class SellableInfo : TraitInfo { public readonly int RefundPercent = 50; } - + class Sellable : IResolveOrder { bool selling = false; @@ -30,12 +30,12 @@ namespace OpenRA.Mods.RA if (order.OrderString == "Sell" && !selling) { selling = true; - + foreach( var ns in self.TraitsImplementing() ) ns.Selling( self ); - + self.CancelActivity(); - + var rb = self.TraitOrDefault(); if (rb != null && self.Info.Traits.Get().HasMakeAnimation) self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index de9e9accca..c161031ca5 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -49,7 +49,7 @@ namespace OpenRA.Mods.RA.Server server.SendChatTo(conn, "Cannot change state when marked as ready."); return false; } - + return true; } @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Server { if (!ValidateCommand(server, conn, client, cmd)) return false; - + var dict = new Dictionary> { { "ready", @@ -73,14 +73,14 @@ namespace OpenRA.Mods.RA.Server conn.socket.RemoteEndPoint, client.State); server.SyncLobbyInfo(); - + if (server.conns.Count > 0 && server.conns.All(c => server.GetClient(c).State == Session.ClientState.Ready)) InterpretCommand(server, conn, client, "startgame"); - + return true; }}, - { "startgame", - s => + { "startgame", + s => { server.StartGame(); return true; @@ -260,7 +260,7 @@ namespace OpenRA.Mods.RA.Server else if (c.Bot != null) server.lobbyInfo.Clients.Remove(c); } - + server.SyncLobbyInfo(); return true; }}, @@ -272,7 +272,7 @@ namespace OpenRA.Mods.RA.Server server.SendChatTo( conn, "Only the host can set that option" ); return true; } - + bool.TryParse(s, out server.lobbyInfo.GlobalSettings.LockTeams); server.SyncLobbyInfo(); return true; @@ -285,13 +285,13 @@ namespace OpenRA.Mods.RA.Server server.SendChatTo( conn, "Only the host can set that option" ); return true; } - + bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllowCheats); server.SyncLobbyInfo(); return true; }}, { "kick", - s => + s => { if (conn.PlayerIndex != 0) @@ -304,12 +304,12 @@ namespace OpenRA.Mods.RA.Server int.TryParse( s, out clientID ); var connToKick = server.conns.SingleOrDefault( c => server.GetClient(c) != null && server.GetClient(c).Index == clientID); - if (connToKick == null) + if (connToKick == null) { server.SendChatTo( conn, "Noone in that slot." ); return true; } - + server.SendOrderTo(connToKick, "ServerError", "You have been kicked from the server"); server.DropClient(connToKick); server.SyncLobbyInfo(); @@ -417,17 +417,17 @@ namespace OpenRA.Mods.RA.Server return true; }} }; - + var cmdName = cmd.Split(' ').First(); var cmdValue = string.Join(" ", cmd.Split(' ').Skip(1).ToArray()); Func a; if (!dict.TryGetValue(cmdName, out a)) return false; - + return a(cmdValue); } - + public void ServerStarted(S server) { LoadMap(server); } static Session.Slot MakeSlotFromPlayerReference(PlayerReference pr) { diff --git a/OpenRA.Mods.RA/ServerTraits/MasterServerPinger.cs b/OpenRA.Mods.RA/ServerTraits/MasterServerPinger.cs index afb03aade3..5247932659 100644 --- a/OpenRA.Mods.RA/ServerTraits/MasterServerPinger.cs +++ b/OpenRA.Mods.RA/ServerTraits/MasterServerPinger.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,16 +30,16 @@ namespace OpenRA.Mods.RA.Server lock (masterServerMessages) while (masterServerMessages.Count > 0) server.SendChat(null, masterServerMessages.Dequeue()); - + } - - + + public void LobbyInfoSynced(S server) { PingMasterServer(server); } public void GameStarted(S server) { PingMasterServer(server); } int lastPing = 0; bool isInitialPing = true; - + volatile bool isBusy; Queue masterServerMessages = new Queue(); public void PingMasterServer(S server) diff --git a/OpenRA.Mods.RA/ShroudPalette.cs b/OpenRA.Mods.RA/ShroudPalette.cs index ae3e036ac2..e479ba1823 100644 --- a/OpenRA.Mods.RA/ShroudPalette.cs +++ b/OpenRA.Mods.RA/ShroudPalette.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -45,20 +45,20 @@ namespace OpenRA.Mods.RA public Color GetRemappedColor(Color original, int index) { if (isFog) - return new[] { - Color.Transparent, Color.Green, - Color.Blue, Color.Yellow, - Color.FromArgb(128,0,0,0), - Color.FromArgb(128,0,0,0), - Color.FromArgb(128,0,0,0), + return new[] { + Color.Transparent, Color.Green, + Color.Blue, Color.Yellow, + Color.FromArgb(128,0,0,0), + Color.FromArgb(128,0,0,0), + Color.FromArgb(128,0,0,0), Color.FromArgb(64,0,0,0)}[index % 8]; else - return new[] { - Color.Transparent, Color.Green, - Color.Blue, Color.Yellow, - Color.Black, - Color.FromArgb(128,0,0,0), - Color.Transparent, + return new[] { + Color.Transparent, Color.Green, + Color.Blue, Color.Yellow, + Color.Black, + Color.FromArgb(128,0,0,0), + Color.Transparent, Color.Transparent}[index % 8]; } } diff --git a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs index 2a086b375b..e17450c8a5 100644 --- a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/SpawnMPUnits.cs b/OpenRA.Mods.RA/SpawnMPUnits.cs index 4076b34ffb..15ba45845e 100644 --- a/OpenRA.Mods.RA/SpawnMPUnits.cs +++ b/OpenRA.Mods.RA/SpawnMPUnits.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -28,8 +28,8 @@ namespace OpenRA.Mods.RA if (!p.PlayerReference.DefaultStartingUnits) return; /* they don't want an mcv, the map provides something else for them */ - p.World.CreateActor("mcv", new TypeDictionary - { + p.World.CreateActor("mcv", new TypeDictionary + { new LocationInit( sp ), new OwnerInit( p ), }); diff --git a/OpenRA.Mods.RA/SpawnMapActors.cs b/OpenRA.Mods.RA/SpawnMapActors.cs index 1e28a81c42..2d116499f4 100644 --- a/OpenRA.Mods.RA/SpawnMapActors.cs +++ b/OpenRA.Mods.RA/SpawnMapActors.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Spy.cs b/OpenRA.Mods.RA/Spy.cs index 0262b4f52f..4fad953cee 100644 --- a/OpenRA.Mods.RA/Spy.cs +++ b/OpenRA.Mods.RA/Spy.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,46 +23,46 @@ namespace OpenRA.Mods.RA { public override object Create (ActorInitializer init) { return new SpyToolTip(init.self, this); } } - + class SpyToolTip : IToolTip { Actor self; TooltipInfo Info; Spy spy; - + public string Name() - { + { if (spy.Disguised) { if (self.Owner == self.World.LocalPlayer) return "{0} ({1})".F(Info.Name, spy.disguisedAsName); return spy.disguisedAsName; } - return Info.Name; + return Info.Name; } - + public Player Owner() - { + { if (spy.Disguised) { if (self.Owner == self.World.LocalPlayer) return self.Owner; return spy.disguisedAsPlayer; } - return self.Owner; + return self.Owner; } - + public Stance Stance() - { + { if (spy.Disguised) { if (self.Owner == self.World.LocalPlayer) - return self.World.LocalPlayer.Stances[self.Owner]; + return self.World.LocalPlayer.Stances[self.Owner]; return self.World.LocalPlayer.Stances[spy.disguisedAsPlayer]; } - return self.World.LocalPlayer.Stances[self.Owner]; + return self.World.LocalPlayer.Stances[self.Owner]; } - + public SpyToolTip( Actor self, TooltipInfo info ) { this.self = self; @@ -70,22 +70,22 @@ namespace OpenRA.Mods.RA spy = self.Trait(); } } - - + + class SpyInfo : TraitInfo { } class Spy : IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier { public Player disguisedAsPlayer; public string disguisedAsSprite, disguisedAsName; - + public bool Disguised { get { return disguisedAsPlayer != null; } } - + public IEnumerable Orders { - get - { - yield return new UnitTraitOrderTargeter( "SpyInfiltrate", 5, "enter", true, false ); + get + { + yield return new UnitTraitOrderTargeter( "SpyInfiltrate", 5, "enter", true, false ); yield return new UnitTraitOrderTargeter( "Disguise", 5, "ability", true, true ); } } @@ -104,7 +104,7 @@ namespace OpenRA.Mods.RA if (order.OrderString == "SpyInfiltrate") { self.SetTargetLine(Target.FromOrder(order), Color.Red); - + self.CancelActivity(); self.QueueActivity(new Enter(order.TargetActor)); self.QueueActivity(new Infiltrate(order.TargetActor)); @@ -112,7 +112,7 @@ namespace OpenRA.Mods.RA if (order.OrderString == "Disguise") { var target = order.TargetActor == self ? null : order.TargetActor; - + if (target != null && target.IsInWorld) { var tooltip = target.TraitsImplementing().FirstOrDefault(); @@ -128,7 +128,7 @@ namespace OpenRA.Mods.RA } } } - + public string VoicePhraseForOrder(Actor self, Order order) { return order.OrderString == "Disguise" ? "Attack" : null; @@ -136,14 +136,14 @@ namespace OpenRA.Mods.RA public Color RadarColorOverride(Actor self) { - if (!Disguised || self.World.LocalPlayer == null || + if (!Disguised || self.World.LocalPlayer == null || self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) return self.Owner.ColorRamp.GetColor(0); return disguisedAsPlayer.ColorRamp.GetColor(0); } } - + class IgnoresDisguiseInfo : TraitInfo {} class IgnoresDisguise {} } diff --git a/OpenRA.Mods.RA/StoresOre.cs b/OpenRA.Mods.RA/StoresOre.cs index 28d4fac516..aa474bfce8 100644 --- a/OpenRA.Mods.RA/StoresOre.cs +++ b/OpenRA.Mods.RA/StoresOre.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,21 +22,21 @@ namespace OpenRA.Mods.RA } class StoresOre : IPips, INotifyCapture, INotifyKilled, IExplodeModifier, IStoreOre, ISync - { + { readonly StoresOreInfo Info; - + [Sync] public int Stored { get { return Player.OreCapacity == 0 ? 0 : Info.Capacity * Player.Ore / Player.OreCapacity; } } - + PlayerResources Player; public StoresOre(Actor self, StoresOreInfo info) { Player = self.Owner.PlayerActor.Trait(); Info = info; } - + public int Capacity { get { return Info.Capacity; } } - + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { var ore = Stored; @@ -44,16 +44,16 @@ namespace OpenRA.Mods.RA Player = newOwner.PlayerActor.Trait(); Player.GiveOre(ore); } - + public void Killed(Actor self, AttackInfo e) { Player.TakeOre(Stored); // Lose the stored ore } - + public IEnumerable GetPips(Actor self) { - return Graphics.Util.MakeArray( Info.PipCount, - i => ( Player.Ore * Info.PipCount > i * Player.OreCapacity ) + return Graphics.Util.MakeArray( Info.PipCount, + i => ( Player.Ore * Info.PipCount > i * Player.OreCapacity ) ? Info.PipColor : PipType.Transparent ); } diff --git a/OpenRA.Mods.RA/StrategicVictoryConditions.cs b/OpenRA.Mods.RA/StrategicVictoryConditions.cs index e729893a96..15f508be29 100644 --- a/OpenRA.Mods.RA/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.RA/StrategicVictoryConditions.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,14 +17,14 @@ namespace OpenRA.Mods.RA { public class StrategicPointInfo : TraitInfo {} public class StrategicPoint {} - + public class StrategicVictoryConditionsInfo : ITraitInfo, Requires { public readonly int TicksToHold = 25 * 60 * 5; // ~5 minutes public readonly bool ResetOnHoldLost = true; public readonly float RatioRequired = 0.5f; // 50% required of all koth locations - public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.self, this); } + public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.self, this); } } public class StrategicVictoryConditions : ITick, ISync diff --git a/OpenRA.Mods.RA/SupplyTruck.cs b/OpenRA.Mods.RA/SupplyTruck.cs index e98ba80cd0..bd633fe926 100644 --- a/OpenRA.Mods.RA/SupplyTruck.cs +++ b/OpenRA.Mods.RA/SupplyTruck.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA public override bool CanTargetActor(Actor self, Actor target, bool forceAttack, bool forceQueued, ref string cursor) { if (!base.CanTargetActor(self, target, forceAttack, forceQueued, ref cursor)) return false; - if (target.AppearsHostileTo(self)) return false; + if (target.AppearsHostileTo(self)) return false; if (!target.HasTrait()) return false; IsQueued = forceQueued; diff --git a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs index b2e8a120de..4909596e0c 100755 --- a/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/AirstrikePower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { class AirstrikePowerInfo : SupportPowerInfo - { + { [ActorReference] public readonly string UnitType = "badr.bomber"; [ActorReference] @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA flare.QueueActivity(new Wait(info.FlareTime)); flare.QueueActivity(new RemoveSelf()); } - + var a = w.CreateActor(info.UnitType, new TypeDictionary { new LocationInit( startPos ), diff --git a/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs index 26b4f2ca9d..9d34027384 100755 --- a/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ChronoshiftPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,28 +23,28 @@ namespace OpenRA.Mods.RA public readonly int Range = 1; // Range in cells public readonly int Duration = 30; // Seconds public readonly bool KillCargo = true; - + public override object Create(ActorInitializer init) { return new ChronoshiftPower(init.self,this); } } class ChronoshiftPower : SupportPower - { + { public ChronoshiftPower(Actor self, ChronoshiftPowerInfo info) : base(self, info) { } - + public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager) { Sound.PlayToPlayer(manager.self.Owner, Info.SelectTargetSound); return new SelectTarget(order, manager, this); } - + public override void Activate(Actor self, Order order) { self.Trait().PlayCustomAnim(self, "active"); - + // Trigger screen desaturate effect foreach (var a in self.World.ActorsWithTrait()) a.Trait.Enable(); - + Sound.Play("chrono2.aud", Game.CellSize * order.TargetLocation); Sound.Play("chrono2.aud", Game.CellSize * order.ExtraLocation); foreach (var target in UnitsInRange(order.ExtraLocation)) @@ -66,10 +66,10 @@ namespace OpenRA.Mods.RA var units = new List(); foreach (var t in tiles) units.AddRange(self.World.ActorMap.GetUnitsAt(t)); - + return units.Distinct().Where(a => a.HasTrait()); } - + class SelectTarget : IOrderGenerator { readonly ChronoshiftPower power; @@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA readonly Sprite tile; readonly SupportPowerManager manager; readonly string order; - + public SelectTarget(string order, SupportPowerManager manager, ChronoshiftPower power) { this.manager = manager; @@ -102,7 +102,7 @@ namespace OpenRA.Mods.RA if (!manager.Powers.ContainsKey(order)) world.CancelInputMode(); } - + public void RenderAfterWorld(WorldRenderer wr, World world) { var xy = Game.viewport.ViewToWorld(Viewport.LastMousePos).ToInt2(); @@ -133,7 +133,7 @@ namespace OpenRA.Mods.RA readonly Sprite validTile, invalidTile, sourceTile; readonly SupportPowerManager manager; readonly string order; - + public SelectDestination(string order, SupportPowerManager manager, ChronoshiftPower power, int2 sourceLocation) { this.manager = manager; @@ -146,7 +146,7 @@ namespace OpenRA.Mods.RA invalidTile = SequenceProvider.GetSequence("overlay", "target-invalid").GetSprite(0); sourceTile = SequenceProvider.GetSequence("overlay", "target-select").GetSprite(0); } - + public IEnumerable Order(World world, int2 xy, MouseInput mi) { if (mi.Button == MouseButton.Right) @@ -154,11 +154,11 @@ namespace OpenRA.Mods.RA world.CancelInputMode(); yield break; } - + var ret = OrderInner( world, xy, mi ).FirstOrDefault(); if (ret == null) yield break; - + world.CancelInputMode(); yield return ret; } @@ -173,7 +173,7 @@ namespace OpenRA.Mods.RA ExtraLocation = sourceLocation }; } - + public void Tick(World world) { // Cancel the OG if we can't use the power @@ -194,11 +194,11 @@ namespace OpenRA.Mods.RA // Source tiles foreach (var t in world.FindTilesInCircle(sourceLocation, range)) sourceTile.DrawAt( wr, Game.CellSize * t, "terrain" ); - + // Destination tiles foreach (var t in world.FindTilesInCircle(xy, range)) sourceTile.DrawAt( wr, Game.CellSize * t, "terrain" ); - + // Unit previews foreach (var unit in power.UnitsInRange(sourceLocation)) { @@ -208,7 +208,7 @@ namespace OpenRA.Mods.RA wr.GetPaletteIndex(r.Palette), r.Scale*r.Sprite.size); } - + // Unit tiles foreach (var unit in power.UnitsInRange(sourceLocation)) { @@ -233,7 +233,7 @@ namespace OpenRA.Mods.RA } return canTeleport; } - + public string GetCursor(World world, int2 xy, MouseInput mi) { return IsValidTarget(xy) ? "chrono-target" : "move-blocked"; diff --git a/OpenRA.Mods.RA/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/SupportPowers/GpsPower.cs index 03f7797baf..6131919390 100755 --- a/OpenRA.Mods.RA/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/GpsPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA { public object Create (ActorInitializer init) { return new GpsWatcher(init.self.Owner); } } - + class GpsWatcher : ISync { [Sync] bool Launched = false; @@ -98,7 +98,7 @@ namespace OpenRA.Mods.RA { self.Owner.PlayerActor.Trait().Powers[key].Activate(new Order()); } - + public override void Activate(Actor self, Order order) { self.World.AddFrameEndTask(w => @@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA { owner.RefreshGps(self); } - + public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) { RemoveGps(self); diff --git a/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs b/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs index 4384431c76..42da8338f0 100755 --- a/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/IronCurtainPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA Sound.PlayToPlayer(manager.self.Owner, Info.SelectTargetSound); return new SelectTarget(order, manager, this); } - + public override void Activate(Actor self, Order order) { self.Trait().PlayCustomAnim(self, "active"); @@ -52,10 +52,10 @@ namespace OpenRA.Mods.RA var units = new List(); foreach (var t in tiles) units.AddRange(self.World.ActorMap.GetUnitsAt(t)); - + return units.Distinct().Where(a => a.HasTrait()); } - + class SelectTarget : IOrderGenerator { readonly IronCurtainPower power; @@ -63,7 +63,7 @@ namespace OpenRA.Mods.RA readonly Sprite tile; readonly SupportPowerManager manager; readonly string order; - + public SelectTarget(string order, SupportPowerManager manager, IronCurtainPower power) { this.manager = manager; @@ -75,11 +75,11 @@ namespace OpenRA.Mods.RA public IEnumerable Order(World world, int2 xy, MouseInput mi) { - world.CancelInputMode(); + world.CancelInputMode(); if (mi.Button == MouseButton.Left && power.UnitsInRange(xy).Any()) yield return new Order(order, manager.self, false) { TargetLocation = xy }; } - + public void Tick(World world) { // Cancel the OG if we can't use the power diff --git a/OpenRA.Mods.RA/SupportPowers/NukePower.cs b/OpenRA.Mods.RA/SupportPowers/NukePower.cs index 8c048c1d7d..ac9e6c54c9 100755 --- a/OpenRA.Mods.RA/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/NukePower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA [WeaponReference] public readonly string MissileWeapon = ""; public readonly int2 SpawnOffset = int2.Zero; - + public override object Create(ActorInitializer init) { return new NukePower(init.self, this); } } @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA Sound.PlayToPlayer(manager.self.Owner, Info.SelectTargetSound); return new SelectGenericPowerTarget(order, manager, "nuke", MouseButton.Left); } - + public override void Activate(Actor self, Order order) { // Play to everyone but the current player @@ -39,10 +39,10 @@ namespace OpenRA.Mods.RA Sound.Play(Info.LaunchSound); var npi = Info as NukePowerInfo; - + self.Trait().PlayCustomAnim(self, "active"); self.World.AddFrameEndTask(w => w.Add( - new NukeLaunch(self.Owner, self, npi.MissileWeapon, npi.SpawnOffset, + new NukeLaunch(self.Owner, self, npi.MissileWeapon, npi.SpawnOffset, order.TargetLocation))); } } diff --git a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs index ab4bb2532a..df44e428f6 100755 --- a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA { var items = (Info as ParatroopersPowerInfo).DropItems; var startPos = self.World.ChooseRandomEdgeCell(); - + self.World.AddFrameEndTask(w => { var info = (Info as ParatroopersPowerInfo); @@ -53,21 +53,21 @@ namespace OpenRA.Mods.RA flare.QueueActivity(new RemoveSelf()); } - var a = w.CreateActor(info.UnitType, new TypeDictionary + var a = w.CreateActor(info.UnitType, new TypeDictionary { new LocationInit( startPos ), new OwnerInit( self.Owner ), new FacingInit( Util.GetFacing(order.TargetLocation - startPos, 0) ), new AltitudeInit( Rules.Info[info.UnitType].Traits.Get().CruiseAltitude ), }); - + a.CancelActivity(); a.QueueActivity(new FlyAttack(Target.FromOrder(order))); a.Trait().SetLZ(order.TargetLocation); var cargo = a.Trait(); foreach (var i in items) - cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(), + cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(), new TypeDictionary { new OwnerInit( a.Owner ) })); }); } diff --git a/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs b/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs index b69afa71df..142b7ac81c 100755 --- a/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/SupportPowers/SpyPlanePower.cs b/OpenRA.Mods.RA/SupportPowers/SpyPlanePower.cs index 77e75a3fb0..7d35e51a3c 100755 --- a/OpenRA.Mods.RA/SupportPowers/SpyPlanePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/SpyPlanePower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA { var enterCell = self.World.ChooseRandomEdgeCell(); - var plane = self.World.CreateActor("u2", new TypeDictionary + var plane = self.World.CreateActor("u2", new TypeDictionary { new LocationInit( enterCell ), new OwnerInit( self.Owner ), @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA plane.CancelActivity(); plane.QueueActivity(Fly.ToCell(order.TargetLocation)); - plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w => + plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w => { var camera = w.CreateActor("camera", new TypeDictionary { diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPower.cs b/OpenRA.Mods.RA/SupportPowers/SupportPower.cs index 610ec3c50e..8ae0f094b2 100755 --- a/OpenRA.Mods.RA/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPower.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA public readonly string LongDesc = ""; public readonly bool AllowMultiple = false; public readonly bool OneShot = false; - + public readonly string BeginChargeSound = null; public readonly string EndChargeSound = null; public readonly string SelectTargetSound = null; @@ -38,18 +38,18 @@ namespace OpenRA.Mods.RA { public readonly Actor self; public readonly SupportPowerInfo Info; - + public SupportPower(Actor self, SupportPowerInfo info) { Info = info; this.self = self; } - + public virtual void Charging(Actor self, string key) { Sound.PlayToPlayer(self.Owner, Info.BeginChargeSound); } - + public virtual void Charged(Actor self, string key) { Sound.PlayToPlayer(self.Owner, Info.EndChargeSound); diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs b/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs index c20c3b5e60..57c6735cdd 100644 --- a/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPowerChargeBar.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs index ebd17d62a2..41db5c0e1e 100755 --- a/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA { public readonly Actor self; public Dictionary Powers = new Dictionary(); - + public readonly DeveloperMode devMode; public SupportPowerManager(ActorInitializer init) { @@ -40,16 +40,16 @@ namespace OpenRA.Mods.RA { return sp.Info.AllowMultiple ? sp.Info.OrderName + "_" + sp.self.ActorID : sp.Info.OrderName; } - + void ActorAdded(Actor a) { if (a.Owner != self.Owner || !a.HasTrait()) return; - + foreach (var t in a.TraitsImplementing()) { var key = MakeKey(t); - + if (Powers.ContainsKey(key)) { Powers[key].Instances.Add(t); @@ -62,17 +62,17 @@ namespace OpenRA.Mods.RA RemainingTime = t.Info.ChargeTime * 25, TotalTime = t.Info.ChargeTime * 25, }; - + Powers.Add(key, si); } } } - + void ActorRemoved(Actor a) { if (a.Owner != self.Owner || !a.HasTrait()) return; - + foreach (var t in a.TraitsImplementing()) { var key = MakeKey(t); @@ -81,27 +81,27 @@ namespace OpenRA.Mods.RA Powers.Remove(key); } } - + public void Tick(Actor self) { foreach(var power in Powers.Values) power.Tick(); } - + public void ResolveOrder(Actor self, Order order) { // order.OrderString is the key of the support power if (Powers.ContainsKey(order.OrderString)) Powers[order.OrderString].Activate(order); } - + public void Target(string key) { if (Powers.ContainsKey(key)) Powers[key].Target(); } - static readonly SupportPowerInstance[] NoInstances = {}; + static readonly SupportPowerInstance[] NoInstances = {}; public IEnumerable GetPowersForActor(Actor a) { @@ -111,21 +111,21 @@ namespace OpenRA.Mods.RA return a.TraitsImplementing() .Select(t => Powers[MakeKey(t)]); } - + public class SupportPowerInstance { readonly SupportPowerManager Manager; readonly string Key; - + public List Instances; public int RemainingTime; public int TotalTime; public bool Active { get; private set; } public bool Disabled { get; private set; } - + public SupportPowerInfo Info { get { return Instances.First().Info; } } public bool Ready { get { return Active && RemainingTime == 0; } } - + public SupportPowerInstance(string key, SupportPowerManager manager) { Manager = manager; @@ -136,7 +136,7 @@ namespace OpenRA.Mods.RA { return sp.self.TraitsImplementing().Any(d => d.Disabled); } - + bool notifiedCharging; bool notifiedReady; public void Tick() @@ -148,14 +148,14 @@ namespace OpenRA.Mods.RA var power = Instances.First(); if (Manager.devMode.FastCharge && RemainingTime > 25) RemainingTime = 25; - + if (RemainingTime > 0) --RemainingTime; if (!notifiedCharging) { power.Charging(power.self, Key); notifiedCharging = true; } - + if (RemainingTime == 0 && !notifiedReady) { @@ -164,7 +164,7 @@ namespace OpenRA.Mods.RA } } } - + public void Target() { if (!Ready) @@ -172,7 +172,7 @@ namespace OpenRA.Mods.RA Manager.self.World.OrderGenerator = Instances.First().OrderGenerator(Key, Manager); } - + public void Activate(Order order) { if (!Ready) @@ -184,13 +184,13 @@ namespace OpenRA.Mods.RA power.Activate(power.self, order); RemainingTime = TotalTime; notifiedCharging = notifiedReady = false; - + if (Info.OneShot) Disabled = true; } } } - + public class SelectGenericPowerTarget : IOrderGenerator { readonly SupportPowerManager manager; @@ -208,7 +208,7 @@ namespace OpenRA.Mods.RA public IEnumerable Order(World world, int2 xy, MouseInput mi) { - world.CancelInputMode(); + world.CancelInputMode(); if (mi.Button == expectedButton && world.Map.IsInMap(xy)) yield return new Order(order, manager.self, false) { TargetLocation = xy }; } @@ -219,7 +219,7 @@ namespace OpenRA.Mods.RA if (!manager.Powers.ContainsKey(order)) world.CancelInputMode(); } - + public void RenderBeforeWorld(WorldRenderer wr, World world) { } public void RenderAfterWorld(WorldRenderer wr, World world) { } public string GetCursor(World world, int2 xy, MouseInput mi) { return world.Map.IsInMap(xy) ? cursor : "generic-blocked"; } diff --git a/OpenRA.Mods.RA/TakeCover.cs b/OpenRA.Mods.RA/TakeCover.cs index 70f79a3ba3..9eed4f941e 100644 --- a/OpenRA.Mods.RA/TakeCover.cs +++ b/OpenRA.Mods.RA/TakeCover.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA TakeCoverInfo Info; [Sync] int remainingProneTime = 0; - + public TakeCover(TakeCoverInfo info) { Info = info; @@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA return IsProne ? Info.ProneSpeed : 1m; } } - + class RenderInfantryProneInfo : RenderInfantryInfo, Requires { public override object Create(ActorInitializer init) { return new RenderInfantryProne(init.self, this); } @@ -94,28 +94,28 @@ namespace OpenRA.Mods.RA { readonly TakeCover tc; bool wasProne; - + public RenderInfantryProne(Actor self, RenderInfantryProneInfo info) : base(self, info) { tc = self.Trait(); } - + protected override string NormalizeInfantrySequence(Actor self, string baseSequence) { var prefix = tc != null && tc.IsProne ? "prone-" : ""; - + if (anim.HasSequence(prefix + baseSequence)) return prefix + baseSequence; else return baseSequence; } - + protected override bool AllowIdleAnimation(Actor self) { return base.AllowIdleAnimation(self) && !tc.IsProne; } - + public override void Tick(Actor self) { if (wasProne != tc.IsProne) diff --git a/OpenRA.Mods.RA/TargetableBuilding.cs b/OpenRA.Mods.RA/TargetableBuilding.cs index 4935ce9cdf..f31cc9cf8e 100755 --- a/OpenRA.Mods.RA/TargetableBuilding.cs +++ b/OpenRA.Mods.RA/TargetableBuilding.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/TargetableSubmarine.cs b/OpenRA.Mods.RA/TargetableSubmarine.cs index 2abc83a923..1d620b2d05 100644 --- a/OpenRA.Mods.RA/TargetableSubmarine.cs +++ b/OpenRA.Mods.RA/TargetableSubmarine.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA { public TargetableSubmarine(Actor self, TargetableSubmarineInfo info) : base(self, info) {} - + public override string[] TargetTypes { get { return (Cloak.Cloaked) ? info.CloakedTargetTypes diff --git a/OpenRA.Mods.RA/TargetableUnit.cs b/OpenRA.Mods.RA/TargetableUnit.cs index 72e8c4db7c..4380f8a922 100755 --- a/OpenRA.Mods.RA/TargetableUnit.cs +++ b/OpenRA.Mods.RA/TargetableUnit.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA { protected readonly Info info; protected Cloak Cloak; - + public TargetableUnit( Actor self, Info info ) { this.info = info; @@ -39,15 +39,15 @@ namespace OpenRA.Mods.RA { Cloak = self.TraitOrDefault(); } - + public virtual bool TargetableBy(Actor self, Actor byActor) { if (Cloak == null) return true; - + if (!Cloak.Cloaked || self.Owner == byActor.Owner || self.Owner.Stances[byActor.Owner] == Stance.Ally) return true; - + return self.World.ActorsWithTrait().Any(a => (self.Location - a.Actor.Location).Length < a.Actor.Info.Traits.Get().Range); } diff --git a/OpenRA.Mods.RA/TeslaInstantKills.cs b/OpenRA.Mods.RA/TeslaInstantKills.cs index 97d7c73918..df50b42947 100755 --- a/OpenRA.Mods.RA/TeslaInstantKills.cs +++ b/OpenRA.Mods.RA/TeslaInstantKills.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/ThrowsParticle.cs b/OpenRA.Mods.RA/ThrowsParticle.cs index afa49d8f4e..0710a359ce 100644 --- a/OpenRA.Mods.RA/ThrowsParticle.cs +++ b/OpenRA.Mods.RA/ThrowsParticle.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/TraitsInterfaces.cs b/OpenRA.Mods.RA/TraitsInterfaces.cs index a977c3e173..000e6832a5 100755 --- a/OpenRA.Mods.RA/TraitsInterfaces.cs +++ b/OpenRA.Mods.RA/TraitsInterfaces.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA int2 DeliverOffset { get; } bool AllowDocking { get; } } - + public interface IAcceptOreDockAction { void OnDock(Actor self, Actor harv, DeliverResources dockOrder); diff --git a/OpenRA.Mods.RA/TransformOnCapture.cs b/OpenRA.Mods.RA/TransformOnCapture.cs index d60d2d90cb..9d159c943c 100644 --- a/OpenRA.Mods.RA/TransformOnCapture.cs +++ b/OpenRA.Mods.RA/TransformOnCapture.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,14 +27,14 @@ namespace OpenRA.Mods.RA class TransformOnCapture : INotifyCapture { TransformOnCaptureInfo Info; - + public TransformOnCapture(TransformOnCaptureInfo info) { Info = info; } - + public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) - { + { self.QueueActivity(new Transform(self, Info.IntoActor) {ForceHealthPercentage = Info.ForceHealthPercentage, Facing = self.Trait().Facing}); } } diff --git a/OpenRA.Mods.RA/Transforms.cs b/OpenRA.Mods.RA/Transforms.cs index 9361aea513..488be91324 100644 --- a/OpenRA.Mods.RA/Transforms.cs +++ b/OpenRA.Mods.RA/Transforms.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA public readonly int Facing = 96; public readonly string[] TransformSounds = {}; public readonly string[] NoTransformSounds = {}; - + public virtual object Create(ActorInitializer init) { return new Transforms(init.self, this); } } @@ -34,19 +34,19 @@ namespace OpenRA.Mods.RA Actor self; TransformsInfo Info; BuildingInfo bi; - + public Transforms(Actor self, TransformsInfo info) { this.self = self; Info = info; bi = Rules.Info[info.IntoActor].Traits.GetOrDefault(); } - + public string VoicePhraseForOrder(Actor self, Order order) { return (order.OrderString == "DeployTransform") ? "Move" : null; } - + bool CanDeploy() { return (bi == null || self.World.CanPlaceBuilding(Info.IntoActor, bi, self.Location + Info.Offset, self)); @@ -76,14 +76,14 @@ namespace OpenRA.Mods.RA return; } self.CancelActivity(); - + if (self.HasTrait()) self.QueueActivity(new Turn(Info.Facing)); - + var rb = self.TraitOrDefault(); if (rb != null && self.Info.Traits.Get().HasMakeAnimation) self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make"))); - + self.QueueActivity(new Transform(self, Info.IntoActor) {Offset = Info.Offset, Facing = Info.Facing, Sounds = Info.TransformSounds}); } } diff --git a/OpenRA.Mods.RA/Turreted.cs b/OpenRA.Mods.RA/Turreted.cs index b561764157..84aac24be7 100755 --- a/OpenRA.Mods.RA/Turreted.cs +++ b/OpenRA.Mods.RA/Turreted.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA public int? desiredFacing; TurretedInfo info; IFacing facing; - + public static int GetInitialTurretFacing(ActorInitializer init, int def) { if (init.Contains()) diff --git a/OpenRA.Mods.RA/Valued.cs b/OpenRA.Mods.RA/Valued.cs index 12e482374e..4f693c7a9d 100755 --- a/OpenRA.Mods.RA/Valued.cs +++ b/OpenRA.Mods.RA/Valued.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,23 +22,23 @@ namespace OpenRA.Mods.RA public readonly string Description = ""; public readonly string Name = ""; public readonly string Icon = null; - + public virtual object Create (ActorInitializer init) { return new Tooltip(init.self, this); } } - + public class Valued { } - - public class Tooltip : IToolTip + + public class Tooltip : IToolTip { Actor self; TooltipInfo Info; - + public string Name() { return Info.Name; } - + public Player Owner() { return self.Owner; } - + public Stance Stance() { return self.World.LocalPlayer.Stances[self.Owner]; } - + public Tooltip( Actor self, TooltipInfo info ) { this.self = self; diff --git a/OpenRA.Mods.RA/WaterPaletteRotation.cs b/OpenRA.Mods.RA/WaterPaletteRotation.cs index 4917bde189..65fb14bc2b 100644 --- a/OpenRA.Mods.RA/WaterPaletteRotation.cs +++ b/OpenRA.Mods.RA/WaterPaletteRotation.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Weapon.cs b/OpenRA.Mods.RA/Weapon.cs index 206cd0c1f4..146236b2f7 100644 --- a/OpenRA.Mods.RA/Weapon.cs +++ b/OpenRA.Mods.RA/Weapon.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -103,7 +103,7 @@ namespace OpenRA.Mods.RA } public void CheckFire(Actor self, AttackBase attack, IMove move, IFacing facing, Target target) - { + { if (FireDelay > 0) return; var limitedAmmo = self.TraitOrDefault(); @@ -114,7 +114,7 @@ namespace OpenRA.Mods.RA return; if( Combat.IsInRange( self.CenterLocation, Info.MinRange, target ) ) return; - + if (!IsValidAgainst(self.World, target)) return; var barrel = Barrels[Burst % Barrels.Length]; @@ -132,8 +132,8 @@ namespace OpenRA.Mods.RA srcAltitude = move != null ? move.Altitude : 0, dest = target.CenterLocation, destAltitude = destMove != null ? destMove.Altitude : 0, - - facing = barrel.Facing + + + facing = barrel.Facing + (self.HasTrait() ? self.Trait().turretFacing : facing != null ? facing.Facing : Util.GetFacing(target.CenterLocation - self.CenterLocation, 0)), @@ -141,7 +141,7 @@ namespace OpenRA.Mods.RA .Select(a => a.GetFirepowerModifier()) .Product() }; - + attack.ScheduleDelayedAction( attack.FireDelay( self, target, self.Info.Traits.Get() ), () => { if (args.weapon.Projectile != null) diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index 08e56165a4..2b99b191e9 100755 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,21 +25,21 @@ namespace OpenRA.Mods.RA.Widgets { public int Columns = 3; public int Rows = 5; - + ProductionQueue CurrentQueue; List VisibleQueues; bool paletteOpen = false; Dictionary iconSprites; - + float2 paletteOpenOrigin = new float2(Game.viewport.Width - 215, 280); float2 paletteClosedOrigin = new float2(Game.viewport.Width - 16, 280); float2 paletteOrigin; - + int paletteAnimationLength = 7; int paletteAnimationFrame = 0; bool paletteAnimating = false; - + List>> buttons = new List>>(); List>> tabs = new List>>(); Animation cantBuild; @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Widgets { this.world = world; this.worldRenderer = worldRenderer; - + cantBuild = new Animation("clock"); cantBuild.PlayFetchIndex("idle", () => 0); ready = new Animation("pips"); @@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA.Widgets paletteOrigin = paletteClosedOrigin; VisibleQueues = new List(); CurrentQueue = null; - + iconSprites = Rules.Info.Values .Where(u => u.Traits.Contains() && u.Name[0] != '^') .ToDictionary( @@ -74,23 +74,23 @@ namespace OpenRA.Mods.RA.Widgets u => Game.modData.SpriteLoader.LoadAllSprites( u.Traits.Get().Icon ?? (u.Name + "icon"))[0]); } - + public override Rectangle EventBounds { get { return new Rectangle((int)(paletteOrigin.X) - 24, (int)(paletteOrigin.Y), 215, Math.Max(48 * numActualRows, 40 * tabs.Count + 9)); } } - + public override void Tick() { VisibleQueues.Clear(); - + var queues = world.ActorsWithTrait() .Where(p => p.Actor.Owner == world.LocalPlayer) .Select(p => p.Trait); - + if (CurrentQueue != null && CurrentQueue.self.Destroyed) CurrentQueue = null; - + foreach (var queue in queues) { if (queue.AllItems().Count() > 0) @@ -100,12 +100,12 @@ namespace OpenRA.Mods.RA.Widgets } if (CurrentQueue == null) CurrentQueue = VisibleQueues.FirstOrDefault(); - + TickPaletteAnimation(world); } - + void TickPaletteAnimation(World world) - { + { if (!paletteAnimating) return; @@ -114,11 +114,11 @@ namespace OpenRA.Mods.RA.Widgets paletteAnimationFrame++; else paletteAnimationFrame--; - + // Calculate palette position if (paletteAnimationFrame <= paletteAnimationLength) paletteOrigin = float2.Lerp(paletteClosedOrigin, paletteOpenOrigin, paletteAnimationFrame * 1.0f / paletteAnimationLength); - + // Play palette-open sound at the start of the activate anim (open) if (paletteAnimationFrame == 1 && paletteOpen) Sound.Play(BuildPaletteOpen); @@ -134,12 +134,12 @@ namespace OpenRA.Mods.RA.Widgets paletteAnimating = false; } } - + public void SetCurrentTab(ProductionQueue queue) { if (!paletteOpen) paletteAnimating = true; - + paletteOpen = true; CurrentQueue = queue; } @@ -155,53 +155,53 @@ namespace OpenRA.Mods.RA.Widgets return DoBuildingHotkey(e.KeyName, world); } - + public override bool HandleMouseInput(MouseInput mi) - { + { if (mi.Event != MouseInputEvent.Down) return false; - + var action = tabs.Where(a => a.First.Contains(mi.Location)) .Select(a => a.Second).FirstOrDefault(); if (action == null && paletteOpen) action = buttons.Where(a => a.First.Contains(mi.Location)) .Select(a => a.Second).FirstOrDefault(); - + if (action == null) return false; - + action(mi); return true; } - + public override void Draw() - { + { if (!IsVisible()) return; // todo: fix - + int paletteHeight = DrawPalette(CurrentQueue); DrawBuildTabs(world, paletteHeight); } - + int numActualRows = 5; int DrawPalette(ProductionQueue queue) { buttons.Clear(); - + string paletteCollection = "palette-" + world.LocalPlayer.Country.Race; float2 origin = new float2(paletteOrigin.X + 9, paletteOrigin.Y + 9); var x = 0; var y = 0; - + if (queue != null) { var buildableItems = queue.BuildableItems().ToArray(); var allBuildables = queue.AllItems().OrderBy(a => a.Traits.Get().BuildPaletteOrder).ToArray(); - + var overlayBits = new List>(); var textBits = new List>(); numActualRows = Math.Max((allBuildables.Count() + Columns - 1) / Columns, Rows); - + // Palette Background WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "top"), new float2(origin.X - 9, origin.Y - 9)); for (var w = 0; w < numActualRows; w++) @@ -210,8 +210,8 @@ namespace OpenRA.Mods.RA.Widgets new float2(origin.X - 9, origin.Y + 48 * w)); WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "bottom"), new float2(origin.X - 9, origin.Y - 1 + 48 * numActualRows)); - - + + // Icons string tooltipItem = null; foreach (var item in allBuildables) @@ -219,14 +219,14 @@ namespace OpenRA.Mods.RA.Widgets var rect = new RectangleF(origin.X + x * 64, origin.Y + 48 * y, 64, 48); var drawPos = new float2(rect.Location); WidgetUtils.DrawSHP(iconSprites[item.Name], drawPos, worldRenderer); - + var firstOfThis = queue.AllQueued().FirstOrDefault(a => a.Item == item.Name); - + if (rect.Contains(Viewport.LastMousePos)) tooltipItem = item.Name; - + var overlayPos = drawPos + new float2(32, 16); - + if (firstOfThis != null) { clock.PlayFetchIndex("idle", @@ -234,10 +234,10 @@ namespace OpenRA.Mods.RA.Widgets * (clock.CurrentSequence.Length - 1) / firstOfThis.TotalTime); clock.Tick(); WidgetUtils.DrawSHP(clock.Image, drawPos, worldRenderer); - + if (queue.CurrentItem() == firstOfThis) textBits.Add( Pair.New( overlayPos, GetOverlayForItem(firstOfThis) ) ); - + var repeats = queue.AllQueued().Count(a => a.Item == item.Name); if (repeats > 1 || queue.CurrentItem() != firstOfThis) { @@ -258,11 +258,11 @@ namespace OpenRA.Mods.RA.Widgets var closureName = buildableItems.Any(a => a.Name == item.Name) ? item.Name : null; buttons.Add(Pair.New(new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height), HandleClick(closureName, world))); - + if (++x == Columns) { x = 0; y++; } } if (x != 0) y++; - + foreach (var ob in overlayBits) WidgetUtils.DrawSHP(ob.First, ob.Second, worldRenderer); @@ -276,10 +276,10 @@ namespace OpenRA.Mods.RA.Widgets // Tooltip if (tooltipItem != null && !paletteAnimating && paletteOpen) - DrawProductionTooltip(world, tooltipItem, + DrawProductionTooltip(world, tooltipItem, new float2(Game.viewport.Width, origin.Y + numActualRows * 48 + 9).ToInt2()); } - + // Palette Dock WidgetUtils.DrawRGBA(ChromeProvider.GetImage(paletteCollection, "dock-top"), new float2(Game.viewport.Width - 14, origin.Y - 23)); @@ -305,18 +305,18 @@ namespace OpenRA.Mods.RA.Widgets { return mi => { Sound.Play(TabClick); - + if (name != null) HandleBuildPalette(world, name, (mi.Button == MouseButton.Left)); }; } - + Action HandleTabClick(ProductionQueue queue, World world) { return mi => { if (mi.Button != MouseButton.Left) return; - + Sound.Play(TabClick); var wasOpen = paletteOpen; paletteOpen = (CurrentQueue == queue && wasOpen) ? false : true; @@ -325,7 +325,7 @@ namespace OpenRA.Mods.RA.Widgets paletteAnimating = true; }; } - + static string Description( string a ) { // hack hack hack - going to die soon anyway @@ -337,15 +337,15 @@ namespace OpenRA.Mods.RA.Widgets return "Tech Center"; if (a == "anypower") return "Power Plant"; - + ActorInfo ai; Rules.Info.TryGetValue(a.ToLowerInvariant(), out ai); if (ai != null && ai.Traits.Contains()) return ai.Traits.Get().Name; - + return a; } - + void HandleBuildPalette( World world, string item, bool isLmb ) { var unit = Rules.Info[item]; @@ -393,32 +393,32 @@ namespace OpenRA.Mods.RA.Widgets } } } - + void StartProduction( World world, string item ) { Sound.Play(CurrentQueue.Info.QueuedAudio); - world.IssueOrder(Order.StartProduction(CurrentQueue.self, item, + world.IssueOrder(Order.StartProduction(CurrentQueue.self, item, Game.GetModifierKeys().HasModifier(Modifiers.Shift) ? 5 : 1)); } - + void DrawBuildTabs( World world, int paletteHeight) { const int tabWidth = 24; const int tabHeight = 40; var x = paletteOrigin.X - tabWidth; var y = paletteOrigin.Y + 9; - + tabs.Clear(); foreach (var queue in VisibleQueues) - { + { string[] tabKeys = { "normal", "ready", "selected" }; var producing = queue.CurrentItem(); var index = queue == CurrentQueue ? 2 : (producing != null && producing.Done) ? 1 : 0; - + var race = world.LocalPlayer.Country.Race; WidgetUtils.DrawRGBA(ChromeProvider.GetImage("tabs-"+tabKeys[index], race+"-"+queue.Info.Type), new float2(x, y)); - + var rect = new Rectangle((int)x,(int)y,(int)tabWidth,(int)tabHeight); tabs.Add(Pair.New(rect, HandleTabClick(queue, world))); @@ -456,12 +456,12 @@ namespace OpenRA.Mods.RA.Widgets var buildable = info.Traits.Get(); var cost = info.Traits.Get().Cost; var canBuildThis = CurrentQueue.CanBuild(info); - + var longDescSize = Game.Renderer.Fonts["Regular"].Measure(tooltip.Description.Replace("\\n", "\n")).Y; if (!canBuildThis) longDescSize += 8; WidgetUtils.DrawPanel("dialog4", new Rectangle(Game.viewport.Width - 300, pos.Y, 300, longDescSize + 65)); - + Game.Renderer.Fonts["Bold"].DrawText( tooltip.Name + ((buildable.Hotkey != null)? " ({0})".F(buildable.Hotkey.ToUpper()) : ""), p.ToInt2() + new int2(5, 5), Color.White); @@ -471,9 +471,9 @@ namespace OpenRA.Mods.RA.Widgets DrawRightAligned("${0}".F(cost), pos + new int2(-5, 5), (resources.DisplayCash + resources.DisplayOre >= cost ? Color.White : Color.Red )); - + var lowpower = power.PowerState != PowerState.Normal; - var time = CurrentQueue.GetBuildTime(info.Name) + var time = CurrentQueue.GetBuildTime(info.Name) * ((lowpower)? CurrentQueue.Info.LowPowerSlowdown : 1); DrawRightAligned(WidgetUtils.FormatTime(time), pos + new int2(-5, 35), lowpower ? Color.Red: Color.White); @@ -481,14 +481,14 @@ namespace OpenRA.Mods.RA.Widgets if (bi != null) DrawRightAligned("{1}{0}".F(bi.Power, bi.Power > 0 ? "+" : ""), pos + new int2(-5, 20), ((power.PowerProvided - power.PowerDrained) >= -bi.Power || bi.Power > 0)? Color.White: Color.Red); - + p += new int2(5, 35); if (!canBuildThis) { var prereqs = buildable.Prerequisites .Select( a => Description( a ) ); Game.Renderer.Fonts["Regular"].DrawText( - "Requires {0}".F(string.Join(", ", prereqs.ToArray())), + "Requires {0}".F(string.Join(", ", prereqs.ToArray())), p.ToInt2(), Color.White); @@ -496,7 +496,7 @@ namespace OpenRA.Mods.RA.Widgets } p += new int2(0, 15); - Game.Renderer.Fonts["Regular"].DrawText(tooltip.Description.Replace("\\n", "\n"), + Game.Renderer.Fonts["Regular"].DrawText(tooltip.Description.Replace("\\n", "\n"), p.ToInt2(), Color.White); } @@ -516,7 +516,7 @@ namespace OpenRA.Mods.RA.Widgets return false; } - + void TabChange(bool shift) { var queues = VisibleQueues.Concat(VisibleQueues); diff --git a/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs index 30baa434aa..2f5b39b16f 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ConnectionDialogsLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic widget.GetWidget("CONNECTION_BUTTON_RETRY").OnClick = () => Game.JoinServer(orderManager.Host, orderManager.Port); - widget.GetWidget("CONNECTION_FAILED_DESC").GetText = () => string.IsNullOrEmpty(orderManager.ServerError) ? + widget.GetWidget("CONNECTION_FAILED_DESC").GetText = () => string.IsNullOrEmpty(orderManager.ServerError) ? "Could not connect to {0}:{1}".F(orderManager.Host, orderManager.Port) : orderManager.ServerError; } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs index 4c18f287b1..33a33316cd 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/CreateServerMenuLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,16 +30,16 @@ namespace OpenRA.Mods.RA.Widgets.Logic settings.Server.ExternalPort = int.Parse(cs.GetWidget("EXTERNAL_PORT").Text); settings.Server.Map = Game.modData.AvailableMaps.FirstOrDefault(m => m.Value.Selectable).Key; settings.Save(); - + // Take a copy so that subsequent settings changes don't affect the server Game.CreateServer(new ServerSettings(Game.Settings.Server)); Game.JoinServer(IPAddress.Loopback.ToString(), settings.Server.ListenPort); }; - + cs.GetWidget("GAME_TITLE").Text = settings.Server.Name ?? ""; cs.GetWidget("LISTEN_PORT").Text = settings.Server.ListenPort.ToString(); cs.GetWidget("EXTERNAL_PORT").Text = settings.Server.ExternalPort.ToString(); - + var onlineCheckbox = cs.GetWidget("CHECKBOX_ONLINE"); onlineCheckbox.IsChecked = () => settings.Server.AdvertiseOnline; onlineCheckbox.OnClick = () => { settings.Server.AdvertiseOnline ^= true; settings.Save(); }; diff --git a/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs index 71f64cc395..040757c8c7 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DeveloperModeLogic.cs @@ -2,17 +2,17 @@ /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. - * + * * OpenRA is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * OpenRA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with OpenRA. If not, see . */ @@ -35,19 +35,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic devModeButton.OnClick = () => devmodeBG.Visible ^= true; var devTrait = world.LocalPlayer.PlayerActor.Trait(); - + var shroudCheckbox = devmodeBG.GetWidget("CHECKBOX_SHROUD"); shroudCheckbox.IsChecked = () => devTrait.DisableShroud; shroudCheckbox.OnClick = () => Order(world, "DevShroud"); - + var pathCheckbox = devmodeBG.GetWidget("CHECKBOX_PATHDEBUG"); pathCheckbox.IsChecked = () => devTrait.PathDebug; pathCheckbox.OnClick = () => Order(world, "DevPathDebug"); - + var fastBuildCheckbox = devmodeBG.GetWidget("INSTANT_BUILD"); fastBuildCheckbox.IsChecked = () => devTrait.FastBuild; fastBuildCheckbox.OnClick = () => Order(world, "DevFastBuild"); - + var fastChargeCheckbox = devmodeBG.GetWidget("INSTANT_CHARGE"); fastChargeCheckbox.IsChecked = () => devTrait.FastCharge; fastChargeCheckbox.OnClick = () => Order(world, "DevFastCharge"); @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var allTechCheckbox = devmodeBG.GetWidget("ENABLE_TECH"); allTechCheckbox.IsChecked = () => devTrait.AllTech; allTechCheckbox.OnClick = () => Order(world, "DevEnableTech"); - + var powerCheckbox = devmodeBG.GetWidget("UNLIMITED_POWER"); powerCheckbox.IsChecked = () => devTrait.UnlimitedPower; powerCheckbox.OnClick = () => Order(world, "DevUnlimitedPower"); @@ -63,19 +63,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic var buildAnywhereCheckbox = devmodeBG.GetWidget("BUILD_ANYWHERE"); buildAnywhereCheckbox.IsChecked = () => devTrait.BuildAnywhere; buildAnywhereCheckbox.OnClick = () => Order(world, "DevBuildAnywhere"); - - devmodeBG.GetWidget("GIVE_CASH").OnClick = () => + + devmodeBG.GetWidget("GIVE_CASH").OnClick = () => world.IssueOrder(new Order("DevGiveCash", world.LocalPlayer.PlayerActor, false)); - + devmodeBG.GetWidget("GIVE_EXPLORATION").OnClick = () => world.IssueOrder(new Order("DevGiveExploration", world.LocalPlayer.PlayerActor, false)); - + devModeButton.IsVisible = () => { return world.LobbyInfo.GlobalSettings.AllowCheats; }; } public void Order(World world, string order) { - world.IssueOrder(new Order(order, world.LocalPlayer.PlayerActor, false)); + world.IssueOrder(new Order(order, world.LocalPlayer.PlayerActor, false)); } } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs index 929057f20a..15ab8c3319 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/DiplomacyLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -31,14 +31,14 @@ namespace OpenRA.Mods.RA.Widgets.Logic var root = Widget.RootWidget.GetWidget("INGAME_ROOT"); var diplomacyBG = root.GetWidget("DIPLOMACY_BG"); var diplomacy = root.GetWidget("INGAME_DIPLOMACY_BUTTON"); - + diplomacy.OnClick = () => { diplomacyBG.Visible = !diplomacyBG.Visible; if (diplomacyBG.IsVisible()) LayoutDialog(diplomacyBG); }; - + validPlayers = world.Players.Where(a => a != world.LocalPlayer && !a.NonCombatant).Count(); diplomacy.IsVisible = () => (validPlayers > 0); } @@ -115,7 +115,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic bg.AddChild(myStance); controls.Add(myStance); - + y += 35; } } @@ -128,11 +128,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic var item = ScrollItemWidget.Setup(template, () => s == world.LocalPlayer.Stances[ p ], () => SetStance(dropdown, p, s)); - + item.GetWidget("LABEL").GetText = () => s.ToString(); return item; }; - + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, stances, setupItem); } diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs index 7bc902458c..df4c4727d0 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic optionsBG.GetWidget("MUSIC").OnClick = () => Widget.OpenWindow("MUSIC_MENU"); optionsBG.GetWidget("RESUME").OnClick = () => optionsBG.Visible = false; - optionsBG.GetWidget("SURRENDER").OnClick = () => + optionsBG.GetWidget("SURRENDER").OnClick = () => world.IssueOrder(new Order("Surrender", world.LocalPlayer.PlayerActor, false)); optionsBG.GetWidget("SURRENDER").IsVisible = () => (world.LocalPlayer != null && world.LocalPlayer.WinState == WinState.Undefined); diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs index 45b39157db..1623298288 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameObserverChromeLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,21 +17,21 @@ namespace OpenRA.Mods.RA.Widgets.Logic public class IngameObserverChromeLogic { Widget gameRoot; - + // WTF duplication [ObjectCreator.UseCtor] public IngameObserverChromeLogic([ObjectCreator.Param] World world) { Game.AddChatLine += AddChatLine; Game.BeforeGameStart += UnregisterEvents; - + var r = Widget.RootWidget; gameRoot = r.GetWidget("OBSERVER_ROOT"); var optionsBG = gameRoot.GetWidget("INGAME_OPTIONS_BG"); - + r.GetWidget("INGAME_OPTIONS_BUTTON").OnClick = () => optionsBG.Visible = !optionsBG.Visible; - + optionsBG.GetWidget("DISCONNECT").OnClick = () => { optionsBG.Visible = false; @@ -40,19 +40,19 @@ namespace OpenRA.Mods.RA.Widgets.Logic Widget.CloseWindow(); Widget.OpenWindow("MAINMENU_BG"); }; - + optionsBG.GetWidget("SETTINGS").OnClick = () => Widget.OpenWindow("SETTINGS_MENU"); optionsBG.GetWidget("MUSIC").OnClick = () => Widget.OpenWindow("MUSIC_MENU"); optionsBG.GetWidget("RESUME").OnClick = () => optionsBG.Visible = false; optionsBG.GetWidget("SURRENDER").IsVisible = () => false; } - + void UnregisterEvents() { Game.AddChatLine -= AddChatLine; Game.BeforeGameStart -= UnregisterEvents; } - + void AddChatLine(Color c, string from, string text) { gameRoot.GetWidget("CHAT_DISPLAY").AddLine(c, from, text); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 53f28c7426..475284a954 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { Widget lobby, LocalPlayerTemplate, RemotePlayerTemplate, EmptySlotTemplate, EmptySlotTemplateHost, LocalSpectatorTemplate, RemoteSpectatorTemplate, NewSpectatorTemplate; - + ScrollPanelWidget Players; Dictionary CountryNames; string MapUid; @@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Game.LobbyInfoChanged += UpdateCurrentMap; Game.LobbyInfoChanged += UpdatePlayerList; UpdateCurrentMap(); - + CurrentColorPreview = Game.Settings.Player.ColorRamp; Players = lobby.GetWidget("PLAYERS"); @@ -126,7 +126,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic orderManager.IssueOrder(Order.Command( "allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats))); }; - + var startGameButton = lobby.GetWidget("START_GAME_BUTTON"); startGameButton.OnClick = () => { @@ -134,10 +134,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic disconnectButton.Visible = false; orderManager.IssueOrder(Order.Command("startgame")); }; - + // Todo: Only show if the map requirements are met for player slots startGameButton.IsVisible = () => Game.IsHost; - + bool teamChat = false; var chatLabel = lobby.GetWidget("LABEL_CHATTYPE"); var chatTextField = lobby.GetWidget("CHAT_TEXTFIELD"); @@ -157,25 +157,25 @@ namespace OpenRA.Mods.RA.Widgets.Logic chatLabel.Text = (teamChat) ? "Team:" : "Chat:"; return true; }; - + Game.AddChatLine += AddChatLine; } - + public void CloseWindow() { Game.LobbyInfoChanged -= UpdateCurrentMap; Game.LobbyInfoChanged -= UpdatePlayerList; Game.AddChatLine -= AddChatLine; Game.BeforeGameStart -= CloseWindow; - + Widget.CloseWindow(); } - + void AddChatLine(Color c, string from, string text) { lobby.GetWidget("CHAT_DISPLAY").AddLine(c, from, text); } - + void UpdatePlayerColor(float hf, float sf, float lf, float r) { var ramp = new ColorRamp((byte) (hf*255), (byte) (sf*255), (byte) (lf*255), (byte)(r*255)); @@ -183,7 +183,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Game.Settings.Save(); orderManager.IssueOrder(Order.Command("color {0} {1}".F(orderManager.LocalClient.Index, ramp))); } - + void UpdateColorPreview(float hf, float sf, float lf, float r) { CurrentColorPreview = new ColorRamp((byte)(hf * 255), (byte)(sf * 255), (byte)(lf * 255), (byte)(r * 255)); @@ -198,13 +198,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic var title = Widget.RootWidget.GetWidget("LOBBY_TITLE"); title.Text = "OpenRA Multiplayer Lobby - " + orderManager.LobbyInfo.GlobalSettings.ServerName; } - + class SlotDropDownOption { public string Title; public string Order; public Func Selected; - + public SlotDropDownOption(string title, string order, Func selected) { Title = title; @@ -212,7 +212,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Selected = selected; } } - + void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client) { var options = new List() @@ -220,7 +220,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)), new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed) }; - + if (slot.AllowBots) foreach (var b in Rules.Info["player"].Traits.WithInterface().Select(t => t.Name)) { @@ -238,10 +238,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic item.GetWidget("LABEL").GetText = () => o.Title; return item; }; - + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem); } - + void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client) { Func setupItem = (race, itemTemplate) => @@ -255,10 +255,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic flag.GetImageName = () => race; return item; }; - + dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, CountryNames.Keys.ToList(), setupItem); } - + void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client) { Func setupItem = (ii, itemTemplate) => @@ -269,23 +269,23 @@ namespace OpenRA.Mods.RA.Widgets.Logic item.GetWidget("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString(); return item; }; - + var options = Graphics.Util.MakeArray(Map.PlayerCount, i => i).ToList(); dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem); } - + void ShowColorDropDown(DropDownButtonWidget color, Session.Client client) { var colorChooser = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs() { {"worldRenderer", worldRenderer} }, null, "COLOR_CHOOSER" ); var hueSlider = colorChooser.GetWidget("HUE_SLIDER"); hueSlider.Value = orderManager.LocalClient.ColorRamp.H / 255f; - + var satSlider = colorChooser.GetWidget("SAT_SLIDER"); satSlider.Value = orderManager.LocalClient.ColorRamp.S / 255f; var lumSlider = colorChooser.GetWidget("LUM_SLIDER"); lumSlider.Value = orderManager.LocalClient.ColorRamp.L / 255f; - + var rangeSlider = colorChooser.GetWidget("RANGE_SLIDER"); rangeSlider.Value = orderManager.LocalClient.ColorRamp.R / 255f; @@ -296,23 +296,23 @@ namespace OpenRA.Mods.RA.Widgets.Logic lumSlider.OnChange += _ => updateColorPreview(); rangeSlider.OnChange += _ => updateColorPreview(); updateColorPreview(); - + colorChooser.GetWidget("BUTTON_OK").OnClick = () => { updateColorPreview(); UpdatePlayerColor(hueSlider.Value, satSlider.Value, lumSlider.Value, rangeSlider.Value); color.RemovePanel(); }; - + color.AttachPanel(colorChooser); } - + void UpdatePlayerList() { // This causes problems for people who are in the process of editing their names (the widgets vanish from beneath them) // Todo: handle this nicer Players.RemoveChildren(); - + foreach (var kv in orderManager.LobbyInfo.Slots) { var s = kv.Value; @@ -341,7 +341,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic join.OnClick = () => orderManager.IssueOrder(Order.Command("slot " + s.PlayerReference)); join.IsVisible = () => !s.Closed && c == null && orderManager.LocalClient.State != Session.ClientState.Ready; } - + template.GetWidget("BOT").IsVisible = () => c != null; } else if (c.Index == orderManager.LocalClient.Index && c.State != Session.ClientState.Ready) @@ -359,7 +359,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var faction = template.GetWidget("FACTION"); faction.IsDisabled = () => s.LockRace; faction.OnMouseDown = _ => ShowRaceDropDown(faction, c); - + var factionname = faction.GetWidget("FACTIONNAME"); factionname.GetText = () => CountryNames[c.Country]; var factionflag = faction.GetWidget("FACTIONFLAG"); @@ -405,7 +405,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic template.IsVisible = () => true; Players.AddChild(template); } - + // Add spectators foreach (var client in orderManager.LobbyInfo.Clients.Where(client => client.Slot == null)) { @@ -416,7 +416,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { template = LocalSpectatorTemplate.Clone(); SetupNameWidget(c, template.GetWidget("NAME")); - + var color = template.GetWidget("COLOR"); color.OnMouseDown = _ => ShowColorDropDown(color, c); @@ -459,7 +459,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Players.AddChild(spec); } } - + void SetupNameWidget(Session.Client c, TextFieldWidget name) { name.Text = c.Name; diff --git a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs index fce68a3e4a..16550c5382 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -27,24 +27,24 @@ namespace OpenRA.Mods.RA.Widgets.Logic widget.GetWidget("MAINMENU_BUTTON_MUSIC").OnClick = () => Widget.OpenWindow("MUSIC_MENU"); widget.GetWidget("MAINMENU_BUTTON_REPLAY_VIEWER").OnClick = () => Widget.OpenWindow("REPLAYBROWSER_BG"); widget.GetWidget("MAINMENU_BUTTON_QUIT").OnClick = () => Game.Exit(); - + DisplayModSelector(); } - + public static void DisplayModSelector() { var selector = Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Widget.RootWidget, "QUICKMODSWITCHER" ); var switcher = selector.GetWidget("SWITCHER"); switcher.OnMouseDown = _ => ShowModsDropDown(switcher); switcher.GetText = WidgetUtils.ActiveModTitle; - selector.GetWidget("VERSION").GetText = WidgetUtils.ActiveModVersion; + selector.GetWidget("VERSION").GetText = WidgetUtils.ActiveModVersion; } - + static void LoadMod(string mod) { var mods = Mod.AllMods[mod].WithPrerequisites(); - if (Game.CurrentMods.Keys.ToArray().SymmetricDifference(mods.ToArray()).Any()) + if (Game.CurrentMods.Keys.ToArray().SymmetricDifference(mods.ToArray()).Any()) Game.RunAfterTick(() => Game.InitializeWithMods(mods.ToArray())); } @@ -53,12 +53,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic Func setupItem = (m, itemTemplate) => { var item = ScrollItemWidget.Setup(itemTemplate, - () => m == Game.CurrentMods.Keys.First(), + () => m == Game.CurrentMods.Keys.First(), () => LoadMod(m)); item.GetWidget("LABEL").GetText = () => Mod.AllMods[m].Title; return item; }; - + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, Mod.AllMods.Keys.ToList(), setupItem); } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs index 839171f7ba..9445e380a3 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MapChooserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Map Map = null; Widget scrollpanel; ScrollItemWidget itemTemplate; - + [ObjectCreator.UseCtor] internal MapChooserLogic( [ObjectCreator.Param( "widget" )] Widget bg, @@ -50,12 +50,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic }; bg.GetWidget("BUTTON_CANCEL").OnClick = () => Widget.CloseWindow(); - + scrollpanel = bg.GetWidget("MAP_LIST"); itemTemplate = scrollpanel.GetWidget("MAP_TEMPLATE"); EnumerateMaps(); } - + void EnumerateMaps() { scrollpanel.RemoveChildren(); @@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic var map = kv.Value; if (!map.Selectable) continue; - + var item = ScrollItemWidget.Setup(itemTemplate, () => Map == map, () => Map = map); item.GetWidget("TITLE").GetText = () => map.Title; item.GetWidget("PLAYERS").GetText = () => "{0}".F(map.PlayerCount); diff --git a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs index 41303ced71..423eb59e6c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -22,43 +22,43 @@ namespace OpenRA.Mods.RA.Widgets.Logic { string CurrentSong = null; Widget bg; - + public void Play(string song) { CurrentSong = song; if (CurrentSong == null) return; - + Sound.PlayMusicThen(Rules.Music[CurrentSong], () => Play( Game.Settings.Sound.Repeat ? CurrentSong : GetNextSong() )); } - + public MusicPlayerLogic() { bg = Widget.RootWidget.GetWidget("MUSIC_MENU"); CurrentSong = GetNextSong(); - + bg.GetWidget( "BUTTON_PAUSE" ).IsVisible = () => Sound.MusicPlaying; bg.GetWidget( "BUTTON_PLAY" ).IsVisible = () => !Sound.MusicPlaying; bg.GetWidget("BUTTON_CLOSE").OnClick = () => { Game.Settings.Save(); Widget.CloseWindow(); }; - + bg.GetWidget("BUTTON_INSTALL").IsVisible = () => false; - + bg.GetWidget("BUTTON_PLAY").OnClick = () => Play( CurrentSong ); bg.GetWidget("BUTTON_PAUSE").OnClick = Sound.PauseMusic; bg.GetWidget("BUTTON_STOP").OnClick = Sound.StopMusic; bg.GetWidget("BUTTON_NEXT").OnClick = () => Play( GetNextSong() ); bg.GetWidget("BUTTON_PREV").OnClick = () => Play( GetPrevSong() ); - + var shuffleCheckbox = bg.GetWidget("SHUFFLE"); shuffleCheckbox.IsChecked = () => Game.Settings.Sound.Shuffle; shuffleCheckbox.OnClick = () => Game.Settings.Sound.Shuffle ^= true; - + var repeatCheckbox = bg.GetWidget("REPEAT"); repeatCheckbox.IsChecked = () => Game.Settings.Sound.Repeat; repeatCheckbox.OnClick = () => Game.Settings.Sound.Repeat ^= true; - + bg.GetWidget("TIME").GetText = () => { if (CurrentSong == null) @@ -67,17 +67,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic WidgetUtils.FormatTimeSeconds( (int)Sound.MusicSeekPosition ), WidgetUtils.FormatTimeSeconds( Rules.Music[CurrentSong].Length )); }; - + var ml = bg.GetWidget("MUSIC_LIST"); var itemTemplate = ml.GetWidget("MUSIC_TEMPLATE"); - + if (!Rules.InstalledMusic.Any()) { itemTemplate.IsVisible = () => true; itemTemplate.GetWidget("TITLE").GetText = () => "No Music Installed"; itemTemplate.GetWidget("TITLE").Align = LabelWidget.TextAlign.Center; } - + foreach (var kv in Rules.InstalledMusic) { var song = kv.Key; diff --git a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs index b207840c7a..2acf436ff7 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/OrderButtonsChromeLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,23 +21,23 @@ namespace OpenRA.Mods.RA.Widgets.Logic { var r = Widget.RootWidget; var gameRoot = r.GetWidget("INGAME_ROOT"); - + var moneybin = gameRoot.GetWidget("INGAME_MONEY_BIN"); - + var sell = moneybin.GetWidget("SELL"); if (sell != null) { sell.Pressed = () => world.OrderGenerator is SellOrderGenerator; sell.OnMouseDown = mi => world.ToggleInputMode(); } - + var powerdown = moneybin.GetWidget("POWER_DOWN"); if (powerdown != null) { powerdown.Pressed = () => world.OrderGenerator is PowerDownOrderGenerator; powerdown.OnMouseDown = mi => world.ToggleInputMode(); } - + var repair = moneybin.GetWidget("REPAIR"); if (repair != null) { diff --git a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs index 3ecc084da3..7acb5be232 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Widgets/Logic/RADownloadPackagesLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/RADownloadPackagesLogic.cs index d0cf8fcc90..c2e2d753f5 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/RADownloadPackagesLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/RADownloadPackagesLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs index 9a5dd5c288..5a1951b943 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/RAInstallFromCDLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -17,7 +17,7 @@ using OpenRA.FileFormats.Graphics; using OpenRA.Widgets; namespace OpenRA.Mods.RA.Widgets.Logic -{ +{ public class RAInstallFromCDLogic { Widget panel; @@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic Action continueLoading; ButtonWidget retryButton, backButton; Widget installingContainer, insertDiskContainer; - + [ObjectCreator.UseCtor] public RAInstallFromCDLogic([ObjectCreator.Param] Widget widget, [ObjectCreator.Param] Action continueLoading) @@ -35,18 +35,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic panel = widget.GetWidget("INSTALL_FROMCD_PANEL"); progressBar = panel.GetWidget("PROGRESS_BAR"); statusLabel = panel.GetWidget("STATUS_LABEL"); - + backButton = panel.GetWidget("BACK_BUTTON"); backButton.OnClick = Widget.CloseWindow; - + retryButton = panel.GetWidget("RETRY_BUTTON"); retryButton.OnClick = CheckForDisk; - + installingContainer = panel.GetWidget("INSTALLING"); insertDiskContainer = panel.GetWidget("INSERT_DISK"); CheckForDisk(); } - + void CheckForDisk() { Func ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"MAIN.MIX") && @@ -62,45 +62,45 @@ namespace OpenRA.Mods.RA.Widgets.Logic installingContainer.IsVisible = () => false; } } - + void Install(string source) { backButton.IsDisabled = () => true; retryButton.IsDisabled = () => true; insertDiskContainer.IsVisible = () => false; installingContainer.IsVisible = () => true; - + var dest = new string[] { Platform.SupportDir, "Content", "ra" }.Aggregate(Path.Combine); var copyFiles = new string[] { "INSTALL/REDALERT.MIX" }; - + var extractPackage = "MAIN.MIX"; var extractFiles = new string[] { "conquer.mix", "russian.mix", "allies.mix", "sounds.mix", "scores.mix", "snow.mix", "interior.mix", "temperat.mix" }; - + var installCounter = 0; var installTotal = copyFiles.Count() + extractFiles.Count(); - var onProgress = (Action)(s => Game.RunAfterTick(() => + var onProgress = (Action)(s => Game.RunAfterTick(() => { progressBar.Percentage = installCounter*100/installTotal; installCounter++; - + statusLabel.GetText = () => s; })); - - var onError = (Action)(s => Game.RunAfterTick(() => + + var onError = (Action)(s => Game.RunAfterTick(() => { statusLabel.GetText = () => "Error: "+s; backButton.IsDisabled = () => false; retryButton.IsDisabled = () => false; })); - + var t = new Thread( _ => { try { if (!InstallUtils.CopyFiles(source, copyFiles, dest, onProgress, onError)) return; - + if (!InstallUtils.ExtractFromPackage(source, extractPackage, extractFiles, dest, onProgress, onError)) return; diff --git a/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs index d5cb7a1440..c1b802d108 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/RAInstallLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs index 097f566a04..73f1f65a2c 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ReplayBrowserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class ReplayBrowserLogic { - Widget widget; + Widget widget; [ObjectCreator.UseCtor] public ReplayBrowserLogic( [ObjectCreator.Param] Widget widget ) @@ -81,7 +81,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic } } } - + void AddReplay(ScrollPanelWidget list, string filename, ScrollItemWidget template) { var item = ScrollItemWidget.Setup(template, diff --git a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs index a12d09a6c9..8162948200 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/ServerBrowserLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -85,11 +85,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic return (currentServer == null || !Game.modData.AvailableMaps.ContainsKey(currentServer.Map)) ? null : Game.modData.AvailableMaps[currentServer.Map]; } - + public static string GenerateModsLabel(GameServer s) { return string.Join("\n", s.UsefulMods - .Select(m => + .Select(m => Mod.AllMods.ContainsKey(m.Key) ? string.Format("{0} ({1})", Mod.AllMods[m.Key].Title, m.Value) : string.Format("Unknown Mod: {0}",m.Key)).ToArray()); } @@ -136,22 +136,22 @@ namespace OpenRA.Mods.RA.Widgets.Logic i++; } } - + public static bool CanJoin(GameServer game) { //"waiting for players" if (game.State != 1) return false; - + // Mods won't match if there are a different number if (Game.CurrentMods.Count != game.Mods.Count()) return false; - + return game.Mods.All( m => m.Contains('@')) && game.Mods.Select( m => Pair.New(m.Split('@')[0], m.Split('@')[1])) .All(kv => Game.CurrentMods.ContainsKey(kv.First) && (kv.Second == "{DEV_VERSION}" || Game.CurrentMods[kv.First].Version == "{DEV_VERSION}" || kv.Second == Game.CurrentMods[kv.First].Version)); } - + } public class DirectConnectLogic diff --git a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs index 8e4d350d5b..5804511489 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/SettingsMenuLogic.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,34 +24,34 @@ namespace OpenRA.Mods.RA.Widgets.Logic { bg = Widget.RootWidget.GetWidget("SETTINGS_MENU"); var tabs = bg.GetWidget("TAB_CONTAINER"); - + //Tabs tabs.GetWidget("GENERAL").OnClick = () => FlipToTab("GENERAL_PANE"); tabs.GetWidget("AUDIO").OnClick = () => FlipToTab("AUDIO_PANE"); tabs.GetWidget("DISPLAY").OnClick = () => FlipToTab("DISPLAY_PANE"); tabs.GetWidget("DEBUG").OnClick = () => FlipToTab("DEBUG_PANE"); FlipToTab("GENERAL_PANE"); - + //General var general = bg.GetWidget("GENERAL_PANE"); - + var name = general.GetWidget("NAME"); name.Text = Game.Settings.Player.Name; name.OnLoseFocus = () => { name.Text = name.Text.Trim(); - + if (name.Text.Length == 0) name.Text = Game.Settings.Player.Name; else Game.Settings.Player.Name = name.Text; }; name.OnEnterKey = () => { name.LoseFocus(); return true; }; - + var edgescrollCheckbox = general.GetWidget("EDGE_SCROLL"); edgescrollCheckbox.IsChecked = () => Game.Settings.Game.ViewportEdgeScroll; edgescrollCheckbox.OnClick = () => Game.Settings.Game.ViewportEdgeScroll ^= true; - + var edgeScrollSlider = general.GetWidget("EDGE_SCROLL_AMOUNT"); edgeScrollSlider.Value = Game.Settings.Game.ViewportEdgeScrollStep; edgeScrollSlider.OnChange += x => Game.Settings.Game.ViewportEdgeScrollStep = x; @@ -59,18 +59,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic var inversescroll = general.GetWidget("INVERSE_SCROLL"); inversescroll.IsChecked = () => Game.Settings.Game.MouseScroll == MouseScrollType.Inverted; inversescroll.OnClick = () => Game.Settings.Game.MouseScroll = (Game.Settings.Game.MouseScroll == MouseScrollType.Inverted) ? MouseScrollType.Standard : MouseScrollType.Inverted; - + var teamchatCheckbox = general.GetWidget("TEAMCHAT_TOGGLE"); teamchatCheckbox.IsChecked = () => Game.Settings.Game.TeamChatToggle; teamchatCheckbox.OnClick = () => Game.Settings.Game.TeamChatToggle ^= true; - + // Audio var audio = bg.GetWidget("AUDIO_PANE"); - + var soundslider = audio.GetWidget("SOUND_VOLUME"); soundslider.OnChange += x => Sound.SoundVolume = x; soundslider.Value = Sound.SoundVolume; - + var musicslider = audio.GetWidget("MUSIC_VOLUME"); musicslider.OnChange += x => Sound.MusicVolume = x; musicslider.Value = Sound.MusicVolume; diff --git a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs index f9d5572f18..0fb3c6faf8 100755 --- a/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/MoneyBinWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs index da9624dacb..26192907f9 100755 --- a/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs +++ b/OpenRA.Mods.RA/Widgets/OrderButtonWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -19,23 +19,23 @@ namespace OpenRA.Mods.RA.Widgets { public Func Enabled = () => true; public Func Pressed = () => false; - + public string Image, Description, LongDesc = ""; - + public Func GetImage, GetDescription, GetLongDesc; - + public OrderButtonWidget() { GetImage = () => Enabled() ? Pressed() ? "pressed" : "normal" : "disabled"; GetDescription = () => Description; GetLongDesc = () => LongDesc; } - + public override void Draw() { var image = ChromeProvider.GetImage(Image + "-button", GetImage()); var rect = new Rectangle(RenderBounds.X, RenderBounds.Y, (int)image.size.X, (int)image.size.Y); - + if (rect.Contains(Viewport.LastMousePos)) { rect = rect.InflateBy(3, 3, 3, 3); @@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA.Widgets pos += new int2(0, 20); Game.Renderer.Fonts["Regular"].DrawText(GetLongDesc().Replace("\\n", "\n"), pos, Color.White); } - + Game.Renderer.RgbaSpriteRenderer.DrawSprite(image, new int2(RenderBounds.X, RenderBounds.Y)); } } diff --git a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs index 05772ba184..6c66dd1963 100755 --- a/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/PowerBinWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Widgets { public class PowerBinWidget : Widget { - // Power bar + // Power bar float2 powerOrigin = new float2(42, 205); // Relative to radarOrigin Size powerSize = new Size(138, 5); diff --git a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs index 99cc476c12..3871b99e69 100755 --- a/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarBinWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets public class RadarBinWidget : Widget { public string WorldInteractionController = null; - + static float2 radarOpenOrigin = new float2(Game.viewport.Width - 215, 29); static float2 radarClosedOrigin = new float2(Game.viewport.Width - 215, -166); float2 radarOrigin = radarClosedOrigin; @@ -31,11 +31,11 @@ namespace OpenRA.Mods.RA.Widgets bool radarAnimating = false; bool hasRadar = false; string radarCollection; - + float previewScale = 0; RectangleF mapRect = Rectangle.Empty; int2 previewOrigin; - + Sprite terrainSprite; Sprite customTerrainSprite; Sprite actorSprite; @@ -66,12 +66,12 @@ namespace OpenRA.Mods.RA.Widgets actorSprite = new Sprite(new Sheet(s), r, TextureChannel.Alpha); shroudSprite = new Sprite(new Sheet(s), r, TextureChannel.Alpha); } - + public override string GetCursor(int2 pos) - { + { if (world == null || !hasRadar) return null; - + var loc = MinimapPixelToCell(pos); var mi = new MouseInput @@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA.Widgets var cursor = world.OrderGenerator.GetCursor( world, loc, mi ); if (cursor == null) return "default"; - + return CursorProvider.HasCursorSequence(cursor+"-minimap") ? cursor+"-minimap" : cursor; } @@ -137,7 +137,7 @@ namespace OpenRA.Mods.RA.Widgets rsr.DrawSprite(ChromeProvider.GetImage(radarCollection, "right"), radarOrigin + new float2(201, 0)); rsr.DrawSprite(ChromeProvider.GetImage(radarCollection, "bottom"), radarOrigin + new float2(0, 192)); rsr.DrawSprite(ChromeProvider.GetImage(radarCollection, "bg"), radarOrigin + new float2(9, 0)); - + // Don't draw the radar if the tray is moving if (radarAnimationFrame >= radarSlideAnimationLength) { @@ -169,12 +169,12 @@ namespace OpenRA.Mods.RA.Widgets var hasRadarNew = world .ActorsWithTrait() .Any(a => a.Actor.Owner == world.LocalPlayer && a.Trait.IsActive); - + if (hasRadarNew != hasRadar) radarAnimating = true; - + hasRadar = hasRadarNew; - + // Build the radar image if (hasRadar) { @@ -184,17 +184,17 @@ namespace OpenRA.Mods.RA.Widgets updateTicks = 12; customTerrainSprite.sheet.Texture.SetData(Minimap.CustomTerrainBitmap(world)); } - + if (updateTicks == 8) actorSprite.sheet.Texture.SetData(Minimap.ActorsBitmap(world)); - + if (updateTicks == 4) shroudSprite.sheet.Texture.SetData(Minimap.ShroudBitmap(world)); } - + if (!radarAnimating) return; - + // Increment frame if (hasRadar) radarAnimationFrame++; @@ -223,12 +223,12 @@ namespace OpenRA.Mods.RA.Widgets if (radarAnimationFrame == (hasRadar ? radarSlideAnimationLength + radarActivateAnimationLength : 0)) radarAnimating = false; } - + int2 CellToMinimapPixel(int2 p) { return new int2((int)(mapRect.X +previewScale*(p.X - world.Map.Bounds.Left)), (int)(mapRect.Y + previewScale*(p.Y - world.Map.Bounds.Top))); } - + int2 MinimapPixelToCell(int2 p) { return new int2(world.Map.Bounds.Left + (int)((p.X - mapRect.X)/previewScale), world.Map.Bounds.Top + (int)((p.Y - mapRect.Y)/previewScale)); diff --git a/OpenRA.Mods.RA/Widgets/RadarWidget.cs b/OpenRA.Mods.RA/Widgets/RadarWidget.cs index 493a79bdf4..c6b3f708ca 100755 --- a/OpenRA.Mods.RA/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.RA/Widgets/RadarWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,11 +24,11 @@ namespace OpenRA.Mods.RA.Widgets float radarMinimapHeight; int AnimationFrame = 0; bool hasRadar = false; - + float previewScale = 0; RectangleF mapRect = Rectangle.Empty; int2 previewOrigin; - + Sprite terrainSprite; Sprite customTerrainSprite; Sprite actorSprite; @@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA.Widgets { this.world = world; } - + public override void Initialize(WidgetArgs args) { base.Initialize(args); @@ -62,12 +62,12 @@ namespace OpenRA.Mods.RA.Widgets actorSprite = new Sprite(new Sheet(s), r, TextureChannel.Alpha); shroudSprite = new Sprite(new Sheet(s), r, TextureChannel.Alpha); } - + public override string GetCursor(int2 pos) - { + { if (world == null || !hasRadar) return null; - + var loc = MinimapPixelToCell(pos); var mi = new MouseInput @@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Widgets var cursor = world.OrderGenerator.GetCursor( world, loc, mi ); if (cursor == null) return "default"; - + return CursorProvider.HasCursorSequence(cursor+"-minimap") ? cursor+"-minimap" : cursor; } @@ -148,21 +148,21 @@ namespace OpenRA.Mods.RA.Widgets Game.Renderer.DisableScissor(); } } - + bool Animating = false; int updateTicks = 0; public override void Tick() { var hasRadarNew = world.LocalPlayer == null || world.LocalPlayer.WinState != WinState.Undefined || world.ActorsWithTrait().Any(a => a.Actor.Owner == world.LocalPlayer && a.Trait.IsActive); - + if (hasRadarNew != hasRadar) { Animating = true; Sound.Play(hasRadarNew ? RadarOnlineSound : RadarOfflineSound); } hasRadar = hasRadarNew; - + // Build the radar image if (hasRadar) { @@ -172,17 +172,17 @@ namespace OpenRA.Mods.RA.Widgets updateTicks = 12; customTerrainSprite.sheet.Texture.SetData(Minimap.CustomTerrainBitmap(world)); } - + if (updateTicks == 8) actorSprite.sheet.Texture.SetData(Minimap.ActorsBitmap(world)); - + if (updateTicks == 4) shroudSprite.sheet.Texture.SetData(Minimap.ShroudBitmap(world)); } - + if (!Animating) return; - + // Increment frame if (hasRadar) AnimationFrame++; @@ -196,12 +196,12 @@ namespace OpenRA.Mods.RA.Widgets if (AnimationFrame == (hasRadar ? AnimationLength : 0)) Animating = false; } - + int2 CellToMinimapPixel(int2 p) { return new int2((int)(mapRect.X + previewScale*(p.X - world.Map.Bounds.Left)), (int)(mapRect.Y + previewScale*(p.Y - world.Map.Bounds.Top))); } - + int2 MinimapPixelToCell(int2 p) { return new int2(world.Map.Bounds.Left + (int)((p.X - mapRect.X)/previewScale), world.Map.Bounds.Top + (int)((p.Y - mapRect.Y)/previewScale)); diff --git a/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs b/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs index 6af4d57853..e308a86f56 100644 --- a/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs +++ b/OpenRA.Mods.RA/Widgets/StrategicProgressWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -24,7 +24,7 @@ namespace OpenRA.Mods.RA.Widgets [ObjectCreator.UseCtor] public StrategicProgressWidget([ObjectCreator.Param] World world) - { + { IsVisible = () => true; this.world = world; } @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Widgets curX += 32; } - + offset += new int2(0, 32); if (world.LocalPlayer == null) return; @@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA.Widgets WidgetUtils.FormatTime(winnerSvc.TicksLeft)); var font = Game.Renderer.Fonts["Bold"]; - + var size = font.Measure(tc); font.DrawTextWithContrast(tc, offset + new float2(rb.Left - size.X / 2 + 1, rb.Top + 1), Color.White, Color.Black, 1); offset += new int2(0, size.Y + 1); diff --git a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs index d4a592b2a9..2d736b1be7 100755 --- a/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs +++ b/OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -56,20 +56,20 @@ namespace OpenRA.Mods.RA.Widgets } public override bool HandleMouseInput(MouseInput mi) - { + { if (mi.Event == MouseInputEvent.Down) { var action = buttons.Where(a => a.First.Contains(mi.Location)) .Select(a => a.Second).FirstOrDefault(); if (action == null) return false; - + action(mi); return true; } return false; - } + } public override void Draw() { @@ -103,7 +103,7 @@ namespace OpenRA.Mods.RA.Widgets if (rect.Contains(Viewport.LastMousePos)) { - var pos = drawPos.ToInt2(); + var pos = drawPos.ToInt2(); var tl = new int2(pos.X-3,pos.Y-3); var m = new int2(pos.X+64+3,pos.Y+48+3); var br = tl + new int2(64+3+20,40); @@ -124,17 +124,17 @@ namespace OpenRA.Mods.RA.Widgets PanelSides.Top | PanelSides.Right | PanelSides.Center); WidgetUtils.DrawPanelPartial("dialog4", Rectangle.FromLTRB(m.X, m.Y - border[1], br.X, br.Y), PanelSides.Left | PanelSides.Right | PanelSides.Bottom | PanelSides.Center); - + pos += new int2(77, 5); Game.Renderer.Fonts["Bold"].DrawText(sp.Info.Description, pos, Color.White); - + if (sp.TotalTime > 0) { pos += new int2(0,20); Game.Renderer.Fonts["Bold"].DrawText(WidgetUtils.FormatTime(sp.RemainingTime).ToString(), pos, Color.White); - Game.Renderer.Fonts["Bold"].DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White); + Game.Renderer.Fonts["Bold"].DrawText("/ {0}".F(WidgetUtils.FormatTime(sp.TotalTime)), pos + new int2(45,0), Color.White); } - + if (sp.Info.LongDesc != null) { pos += new int2(0, 20); @@ -163,7 +163,7 @@ namespace OpenRA.Mods.RA.Widgets y += 51; } } - + Action HandleSupportPower(string key, SupportPowerManager manager) { return mi => { if (mi.Button == MouseButton.Left) manager.Target(key); }; diff --git a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs index 8575a27919..1d5228d0b7 100644 --- a/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.RA/Widgets/WorldCommandWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -52,23 +52,23 @@ namespace OpenRA.Mods.RA.Widgets { if (e.KeyName == BaseCycleKey) return CycleBases(); - + if (!World.Selection.Actors.Any()) return false; - + if (e.KeyName == AttackMoveKey) return PerformAttackMove(); if (e.KeyName == StopKey) return PerformStop(); - + if (e.KeyName == ScatterKey) return PerformScatter(); if (e.KeyName == DeployKey) return PerformDeploy(); } - + return false; } @@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Widgets .Where(a => a.Owner == World.LocalPlayer).ToArray(); if (actors.Length > 0) - World.OrderGenerator = new GenericSelectTarget(actors, "AttackMove", + World.OrderGenerator = new GenericSelectTarget(actors, "AttackMove", "attackmove", MouseButton.Right); return true; @@ -99,10 +99,10 @@ namespace OpenRA.Mods.RA.Widgets PerformKeyboardOrderOnSelection(a => new Order("Stop", a, false)); return true; } - + bool PerformScatter() { - PerformKeyboardOrderOnSelection(a => new Order("Scatter", a, false)); + PerformKeyboardOrderOnSelection(a => new Order("Scatter", a, false)); return true; } diff --git a/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs b/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs index 10c233cc71..37d0c8c89b 100755 --- a/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs +++ b/OpenRA.Mods.RA/Widgets/WorldTooltipWidget.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -34,19 +34,19 @@ namespace OpenRA.Mods.RA.Widgets var cell = Game.viewport.ViewToWorld(Viewport.LastMousePos).ToInt2(); if (!world.Map.IsInMap(cell)) return; - + if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(cell)) { var utext = "Unexplored Terrain"; var usz = Game.Renderer.Fonts["Bold"].Measure(utext) + new int2(20, 24); - + WidgetUtils.DrawPanel("dialog4", Rectangle.FromLTRB( Viewport.LastMousePos.X + 20, Viewport.LastMousePos.Y + 20, Viewport.LastMousePos.X + usz.X + 20, Viewport.LastMousePos.Y + usz.Y + 20)); - + Game.Renderer.Fonts["Bold"].DrawText(utext, new float2(Viewport.LastMousePos.X + 30, Viewport.LastMousePos.Y + 30), Color.White); - + return; } @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Widgets var itt = actor.TraitsImplementing().FirstOrDefault(); if (itt == null) return; - + var owner = itt.Owner(); var nameText = itt.Name(); var ownerText = !owner.NonCombatant ? owner.PlayerName : ""; @@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA.Widgets { Game.Renderer.Fonts["Regular"].DrawText(ownerText, new float2(Viewport.LastMousePos.X + 65, Viewport.LastMousePos.Y + 50), actor.Owner.ColorRamp.GetColor(0)); - + Game.Renderer.Fonts["Regular"].DrawText(stanceText, new float2(Viewport.LastMousePos.X + 65 + ownerSize.X, Viewport.LastMousePos.Y + 50), Color.White); diff --git a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs index e5561327a9..b9ed84019d 100644 --- a/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs +++ b/OpenRA.Mods.RA/World/ChooseBuildTabOnSelect.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -33,14 +33,14 @@ namespace OpenRA.Mods.RA.Widgets // Queue-per-structure var perqueue = world.Selection.Actors.FirstOrDefault( a => a.IsInWorld && a.World.LocalPlayer == a.Owner && a.HasTrait()); - + if (perqueue != null) { Widget.RootWidget.GetWidget("INGAME_BUILD_PALETTE") .SetCurrentTab(perqueue.TraitsImplementing().First()); return; } - + // Queue-per-player var types = world.Selection.Actors.Where(a => a.IsInWorld && (a.World.LocalPlayer == a.Owner)) .SelectMany(a => a.TraitsImplementing()) @@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Widgets .ToArray(); if (types.Length == 0) - return; + return; Widget.RootWidget.GetWidget("INGAME_BUILD_PALETTE") .SetCurrentTab(world.LocalPlayer.PlayerActor.TraitsImplementing().FirstOrDefault(t => types.Contains(t.Info.Type))); diff --git a/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs b/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs index 3367033878..50479329ec 100644 --- a/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs +++ b/OpenRA.Mods.RA/World/PlayMusicOnMapLoad.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Mods.RA/World/SmudgeLayer.cs b/OpenRA.Mods.RA/World/SmudgeLayer.cs index d9db41794d..329b6fca0c 100755 --- a/OpenRA.Mods.RA/World/SmudgeLayer.cs +++ b/OpenRA.Mods.RA/World/SmudgeLayer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA } public class SmudgeLayer: IRenderOverlay, IWorldLoaded - { + { public SmudgeLayerInfo Info; Dictionary> tiles; Sprite[][] smudgeSprites; @@ -41,23 +41,23 @@ namespace OpenRA.Mods.RA this.Info = info; smudgeSprites = Info.Types.Select(x => Game.modData.SpriteLoader.LoadAllSprites(x)).ToArray(); } - + public void WorldLoaded(World w) { world = w; tiles = new Dictionary>(); - + // Add map smudges foreach (var s in w.Map.Smudges.Value.Where( s => Info.Types.Contains(s.Type ))) tiles.Add(s.Location,new TileReference((byte)Array.IndexOf(Info.Types,s.Type), (byte)s.Depth)); } - + public void AddSmudge(int2 loc) { if (!world.GetTerrainInfo(loc).AcceptSmudge) return; - + if (Game.CosmeticRandom.Next(0,100) <= Info.SmokePercentage) world.AddFrameEndTask(w => w.Add(new Smoke(w, Traits.Util.CenterOfCell(loc), Info.SmokeType))); @@ -68,7 +68,7 @@ namespace OpenRA.Mods.RA tiles.Add(loc, new TileReference(st,(byte)0)); return; } - + var tile = tiles[loc]; // Existing smudge; make it deeper int depth = Info.Depths[tile.type-1]; @@ -78,7 +78,7 @@ namespace OpenRA.Mods.RA tiles[loc] = tile; // struct semantics. } } - + public void Render( WorldRenderer wr ) { var cliprect = Game.viewport.WorldBounds(world); diff --git a/OpenRA.Renderer.Cg/GraphicsDevice.cs b/OpenRA.Renderer.Cg/GraphicsDevice.cs index 9ddc6816c2..afa309152d 100755 --- a/OpenRA.Renderer.Cg/GraphicsDevice.cs +++ b/OpenRA.Renderer.Cg/GraphicsDevice.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) -* This file is part of OpenRA, which is free software. It is made +* This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -54,14 +54,14 @@ namespace OpenRA.Renderer.Cg { Console.WriteLine("Using Cg renderer"); windowSize = size; - + var extensions = new string[] { "GL_ARB_vertex_program", "GL_ARB_fragment_program", "GL_ARB_vertex_buffer_object", }; - + surf = SdlGraphics.InitializeSdlGl(ref windowSize, window, extensions); cgContext = Tao.Cg.Cg.cgCreateContext(); @@ -79,7 +79,7 @@ namespace OpenRA.Renderer.Cg ErrorHandler.CheckGlError(); Sdl.SDL_SetModState( 0 ); // i have had enough. - + input = new SdlInput( surf ); } diff --git a/OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs b/OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs index b0f38107f0..c9ffb260b8 100644 --- a/OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs +++ b/OpenRA.Renderer.Cg/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Renderer.Cg")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.Renderer.Cg/Shader.cs b/OpenRA.Renderer.Cg/Shader.cs index ab56fb4882..5ca8df7092 100644 --- a/OpenRA.Renderer.Cg/Shader.cs +++ b/OpenRA.Renderer.Cg/Shader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Renderer.Gl/GraphicsDevice.cs b/OpenRA.Renderer.Gl/GraphicsDevice.cs index 21efffde4a..ba1689b60a 100755 --- a/OpenRA.Renderer.Gl/GraphicsDevice.cs +++ b/OpenRA.Renderer.Gl/GraphicsDevice.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) -* This file is part of OpenRA, which is free software. It is made +* This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -43,23 +43,23 @@ namespace OpenRA.Renderer.Glsl { Console.WriteLine("Using Gl renderer"); windowSize = size; - + var extensions = new string[] { "GL_ARB_vertex_shader", "GL_ARB_fragment_shader", "GL_ARB_vertex_buffer_object", }; - + surf = SdlGraphics.InitializeSdlGl( ref windowSize, window, extensions ); - + Gl.glEnableClientState( Gl.GL_VERTEX_ARRAY ); ErrorHandler.CheckGlError(); Gl.glEnableClientState( Gl.GL_TEXTURE_COORD_ARRAY ); ErrorHandler.CheckGlError(); Sdl.SDL_SetModState( 0 ); - + input = new SdlInput( surf ); } diff --git a/OpenRA.Renderer.Gl/Properties/AssemblyInfo.cs b/OpenRA.Renderer.Gl/Properties/AssemblyInfo.cs index cd1665bf81..ac5e1a30a3 100644 --- a/OpenRA.Renderer.Gl/Properties/AssemblyInfo.cs +++ b/OpenRA.Renderer.Gl/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("OpenRA.Renderer.Gl")] @@ -19,7 +19,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/OpenRA.Renderer.Gl/Shader.cs b/OpenRA.Renderer.Gl/Shader.cs index 4d168620d2..a4d12fb7fe 100644 --- a/OpenRA.Renderer.Gl/Shader.cs +++ b/OpenRA.Renderer.Gl/Shader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,25 +25,25 @@ namespace OpenRA.Renderer.Glsl readonly Dictionary samplers = new Dictionary(); public Shader(GraphicsDevice dev, string type) - { + { // Vertex shader string vertexCode; using (var file = new StreamReader(FileSystem.Open("glsl{0}{1}.vert".F(Path.DirectorySeparatorChar, type)))) vertexCode = file.ReadToEnd(); - + int v = Gl.glCreateShaderObjectARB(Gl.GL_VERTEX_SHADER_ARB); ErrorHandler.CheckGlError(); Gl.glShaderSourceARB(v,1,new string[]{vertexCode},null); ErrorHandler.CheckGlError(); Gl.glCompileShaderARB(v); ErrorHandler.CheckGlError(); - + int success; Gl.glGetObjectParameterivARB(v, Gl.GL_OBJECT_COMPILE_STATUS_ARB, out success); ErrorHandler.CheckGlError(); if (success == 0) throw new InvalidProgramException("Compile error in {0}{1}.vert".F(Path.DirectorySeparatorChar, type)); - + // Fragment shader string fragmentCode; using (var file = new StreamReader(FileSystem.Open("glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, type)))) @@ -54,13 +54,13 @@ namespace OpenRA.Renderer.Glsl ErrorHandler.CheckGlError(); Gl.glCompileShaderARB(f); ErrorHandler.CheckGlError(); - + Gl.glGetObjectParameterivARB(f, Gl.GL_OBJECT_COMPILE_STATUS_ARB, out success); ErrorHandler.CheckGlError(); if (success == 0) throw new InvalidProgramException("Compile error in glsl{0}{1}.frag".F(Path.DirectorySeparatorChar, type)); - - + + // Assemble program program = Gl.glCreateProgramObjectARB(); ErrorHandler.CheckGlError(); @@ -68,19 +68,19 @@ namespace OpenRA.Renderer.Glsl ErrorHandler.CheckGlError(); Gl.glAttachObjectARB(program,f); ErrorHandler.CheckGlError(); - + Gl.glLinkProgramARB(program); ErrorHandler.CheckGlError(); - + Gl.glGetObjectParameterivARB(program, Gl.GL_OBJECT_LINK_STATUS_ARB, out success); ErrorHandler.CheckGlError(); if (success == 0) throw new InvalidProgramException("Linking error in {0} shader".F(type)); - - + + Gl.glUseProgramObjectARB(program); ErrorHandler.CheckGlError(); - + int numUniforms; Gl.glGetObjectParameterivARB( program, Gl.GL_ACTIVE_UNIFORMS, out numUniforms ); ErrorHandler.CheckGlError(); @@ -136,13 +136,13 @@ namespace OpenRA.Renderer.Glsl Gl.glActiveTextureARB( Gl.GL_TEXTURE0_ARB ); } } - + public void SetValue(string name, float x, float y) { Gl.glUseProgramObjectARB(program); ErrorHandler.CheckGlError(); int param = Gl.glGetUniformLocationARB(program, name); - ErrorHandler.CheckGlError(); + ErrorHandler.CheckGlError(); Gl.glUniform2fARB(param,x,y); ErrorHandler.CheckGlError(); } diff --git a/OpenRA.Renderer.Null/NullGraphicsDevice.cs b/OpenRA.Renderer.Null/NullGraphicsDevice.cs index b25d02b5c3..63d86b9657 100644 --- a/OpenRA.Renderer.Null/NullGraphicsDevice.cs +++ b/OpenRA.Renderer.Null/NullGraphicsDevice.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -57,7 +57,7 @@ namespace OpenRA.Renderer.Null public int GpuMemoryUsed { get { return 0; } } } - + public class NullShader : IShader { public void SetValue(string name, float x, float y) { } @@ -65,14 +65,14 @@ namespace OpenRA.Renderer.Null public void Commit() { } public void Render(Action a) { } } - + public class NullTexture : ITexture { public void SetData(Bitmap bitmap) { } public void SetData(uint[,] colors) { } public void SetData(byte[] colors, int width, int height) { } } - + class NullVertexBuffer : IVertexBuffer { public void Bind() { } diff --git a/OpenRA.Renderer.Null/Properties/AssemblyInfo.cs b/OpenRA.Renderer.Null/Properties/AssemblyInfo.cs index 8c0f1d342e..6bd6705fc4 100644 --- a/OpenRA.Renderer.Null/Properties/AssemblyInfo.cs +++ b/OpenRA.Renderer.Null/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Renderer.Null")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.Renderer.SdlCommon/ErrorHandler.cs b/OpenRA.Renderer.SdlCommon/ErrorHandler.cs index 635740d852..85f4e78dd9 100644 --- a/OpenRA.Renderer.SdlCommon/ErrorHandler.cs +++ b/OpenRA.Renderer.SdlCommon/ErrorHandler.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) -* This file is part of OpenRA, which is free software. It is made +* This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -39,7 +39,7 @@ namespace OpenRA.Renderer.SdlCommon throw new InvalidOperationException("OpenGL Error: See graphics.log for details."); } } - + public static void WriteGraphicsLog(string message) { Log.AddChannel("graphics", "graphics.log"); diff --git a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs index 84f9f91c47..5fbb45dae4 100644 --- a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs +++ b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) -* This file is part of OpenRA, which is free software. It is made +* This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -83,7 +83,7 @@ namespace OpenRA.Renderer.SdlCommon .F(string.Join(",", missingExtensions))); throw new InvalidProgramException("Unsupported GPU. See graphics.log for details."); } - + return surf; } } diff --git a/OpenRA.Renderer.SdlCommon/SdlInput.cs b/OpenRA.Renderer.SdlCommon/SdlInput.cs index 2fe8cb95b4..66eefb1e1b 100644 --- a/OpenRA.Renderer.SdlCommon/SdlInput.cs +++ b/OpenRA.Renderer.SdlCommon/SdlInput.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) -* This file is part of OpenRA, which is free software. It is made +* This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -20,7 +20,7 @@ namespace OpenRA.Renderer.SdlCommon { MouseButton lastButtonBits = (MouseButton)0; IntPtr surface; - + public SdlInput( IntPtr surface ) { this.surface = surface; } MouseButton MakeButton( byte b ) @@ -40,7 +40,7 @@ namespace OpenRA.Renderer.SdlCommon | ( ( raw & Sdl.KMOD_META ) != 0 ? Modifiers.Meta : 0 ) | ( ( raw & Sdl.KMOD_SHIFT ) != 0 ? Modifiers.Shift : 0 ); } - + public void PumpInput( IInputHandler inputHandler ) { Game.HasInputFocus = 0 != ( Sdl.SDL_GetAppState() & Sdl.SDL_APPINPUTFOCUS ); diff --git a/OpenRA.Renderer.SdlCommon/Texture.cs b/OpenRA.Renderer.SdlCommon/Texture.cs index f1c490ad71..85b87d5f55 100644 --- a/OpenRA.Renderer.SdlCommon/Texture.cs +++ b/OpenRA.Renderer.SdlCommon/Texture.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -21,13 +21,13 @@ namespace OpenRA.Renderer.SdlCommon public class Texture : ITexture { public int texture; /* temp: can be internal again once shaders are in shared code */ - + public Texture() { Gl.glGenTextures(1, out texture); ErrorHandler.CheckGlError(); } - + public Texture(Bitmap bitmap) { Gl.glGenTextures(1, out texture); @@ -47,7 +47,7 @@ namespace OpenRA.Renderer.SdlCommon ErrorHandler.CheckGlError(); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST); ErrorHandler.CheckGlError(); - + Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_BASE_LEVEL, 0); ErrorHandler.CheckGlError(); Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAX_LEVEL, 0); @@ -77,10 +77,10 @@ namespace OpenRA.Renderer.SdlCommon { int width = colors.GetUpperBound(1) + 1; int height = colors.GetUpperBound(0) + 1; - + if (!IsPowerOf2(width) || !IsPowerOf2(height)) throw new InvalidDataException("Non-power-of-two array {0}x{1}".F(width,height)); - + unsafe { fixed (uint* ptr = &colors[0,0]) @@ -93,7 +93,7 @@ namespace OpenRA.Renderer.SdlCommon } } } - + public void SetData(Bitmap bitmap) { if (!IsPowerOf2(bitmap.Width) || !IsPowerOf2(bitmap.Height)) @@ -101,12 +101,12 @@ namespace OpenRA.Renderer.SdlCommon //throw new InvalidOperationException( "non-power-of-2-texture" ); bitmap = new Bitmap(bitmap, new Size(Exts.NextPowerOf2(bitmap.Width), Exts.NextPowerOf2(bitmap.Height))); } - + var bits = bitmap.LockBits( new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - + PrepareTexture(); Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, bits.Width, bits.Height, 0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, bits.Scan0); // todo: weird strides diff --git a/OpenRA.Renderer.SdlCommon/VertexBuffer.cs b/OpenRA.Renderer.SdlCommon/VertexBuffer.cs index 2718e5cfe9..82618c9c0a 100644 --- a/OpenRA.Renderer.SdlCommon/VertexBuffer.cs +++ b/OpenRA.Renderer.SdlCommon/VertexBuffer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.TilesetBuilder/Form1.Designer.cs b/OpenRA.TilesetBuilder/Form1.Designer.cs index 89322ff618..2caa846896 100644 --- a/OpenRA.TilesetBuilder/Form1.Designer.cs +++ b/OpenRA.TilesetBuilder/Form1.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -64,12 +64,12 @@ namespace OpenRA.TilesetBuilder this.panel1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); - // + // // toolStripContainer1 - // - // + // + // // toolStripContainer1.ContentPanel - // + // this.toolStripContainer1.ContentPanel.Controls.Add(this.panel1); this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(745, 571); this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -78,13 +78,13 @@ namespace OpenRA.TilesetBuilder this.toolStripContainer1.Size = new System.Drawing.Size(745, 596); this.toolStripContainer1.TabIndex = 0; this.toolStripContainer1.Text = "toolStripContainer1"; - // + // // toolStripContainer1.TopToolStripPanel - // + // this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1); - // + // // panel1 - // + // this.panel1.AutoScroll = true; this.panel1.Controls.Add(this.surface1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -92,18 +92,18 @@ namespace OpenRA.TilesetBuilder this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(745, 571); this.panel1.TabIndex = 0; - // + // // surface1 - // + // this.surface1.BackColor = System.Drawing.Color.Black; this.surface1.Location = new System.Drawing.Point(0, 0); this.surface1.Name = "surface1"; this.surface1.Size = new System.Drawing.Size(598, 372); this.surface1.TabIndex = 2; this.surface1.Text = "surface1"; - // + // // toolStrip1 - // + // this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButton2, @@ -125,41 +125,41 @@ namespace OpenRA.TilesetBuilder this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(602, 25); this.toolStrip1.TabIndex = 0; - // + // // toolStripButton2 - // + // this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton2.Name = "toolStripButton2"; this.toolStripButton2.Size = new System.Drawing.Size(51, 22); this.toolStripButton2.Text = "Save"; this.toolStripButton2.Click += new System.EventHandler(this.SaveClicked); - // + // // toolStripButton14 - // + // this.toolStripButton14.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton14.Image"))); this.toolStripButton14.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton14.Name = "toolStripButton14"; this.toolStripButton14.Size = new System.Drawing.Size(60, 22); this.toolStripButton14.Text = "Export"; this.toolStripButton14.Click += new System.EventHandler(this.ExportClicked); - // + // // toolStripButton3 - // + // this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton3.Name = "toolStripButton3"; this.toolStripButton3.Size = new System.Drawing.Size(104, 22); this.toolStripButton3.Text = "Show Overlays"; this.toolStripButton3.Click += new System.EventHandler(this.ShowOverlaysClicked); - // + // // toolStripSeparator1 - // + // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // + // // toolStripButton4 - // + // this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton4.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton4.Image"))); this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -168,9 +168,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton4.Tag = "0"; this.toolStripButton4.Text = "tt0"; this.toolStripButton4.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton12 - // + // this.toolStripButton12.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton12.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton12.Image"))); this.toolStripButton12.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -179,9 +179,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton12.Tag = "1"; this.toolStripButton12.Text = "tt1"; this.toolStripButton12.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton11 - // + // this.toolStripButton11.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton11.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton11.Image"))); this.toolStripButton11.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -190,9 +190,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton11.Tag = "2"; this.toolStripButton11.Text = "tt2"; this.toolStripButton11.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton10 - // + // this.toolStripButton10.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton10.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton10.Image"))); this.toolStripButton10.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -201,9 +201,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton10.Tag = "3"; this.toolStripButton10.Text = "tt3"; this.toolStripButton10.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton9 - // + // this.toolStripButton9.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton9.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton9.Image"))); this.toolStripButton9.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -212,9 +212,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton9.Tag = "4"; this.toolStripButton9.Text = "tt4"; this.toolStripButton9.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton8 - // + // this.toolStripButton8.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton8.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton8.Image"))); this.toolStripButton8.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -223,9 +223,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton8.Tag = "5"; this.toolStripButton8.Text = "tt5"; this.toolStripButton8.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton7 - // + // this.toolStripButton7.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton7.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton7.Image"))); this.toolStripButton7.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -234,9 +234,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton7.Tag = "6"; this.toolStripButton7.Text = "tt6"; this.toolStripButton7.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton6 - // + // this.toolStripButton6.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton6.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton6.Image"))); this.toolStripButton6.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -245,9 +245,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton6.Tag = "7"; this.toolStripButton6.Text = "tt7"; this.toolStripButton6.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton5 - // + // this.toolStripButton5.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton5.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton5.Image"))); this.toolStripButton5.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -256,9 +256,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton5.Tag = "8"; this.toolStripButton5.Text = "tt8"; this.toolStripButton5.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // toolStripButton13 - // + // this.toolStripButton13.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton13.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton13.Image"))); this.toolStripButton13.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -266,9 +266,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton13.Size = new System.Drawing.Size(25, 22); this.toolStripButton13.Tag = "9"; this.toolStripButton13.Text = "tt9"; - // + // // toolStripButton1 - // + // this.toolStripButton1.Checked = true; this.toolStripButton1.CheckState = System.Windows.Forms.CheckState.Checked; this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; @@ -278,9 +278,9 @@ namespace OpenRA.TilesetBuilder this.toolStripButton1.Size = new System.Drawing.Size(88, 22); this.toolStripButton1.Text = "Template Tool"; this.toolStripButton1.Click += new System.EventHandler(this.TerrainTypeSelectorClicked); - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(745, 596); diff --git a/OpenRA.TilesetBuilder/Form1.cs b/OpenRA.TilesetBuilder/Form1.cs index dd2d26bdeb..8147f7aa25 100644 --- a/OpenRA.TilesetBuilder/Form1.cs +++ b/OpenRA.TilesetBuilder/Form1.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -65,7 +65,7 @@ namespace OpenRA.TilesetBuilder public void Save() { - using (var w = XmlWriter.Create(Path.ChangeExtension(srcfile, "tsx"), + using (var w = XmlWriter.Create(Path.ChangeExtension(srcfile, "tsx"), new XmlWriterSettings { Indent = true, IndentChars = " " })) { w.WriteStartDocument(); @@ -109,7 +109,7 @@ namespace OpenRA.TilesetBuilder tsb.Checked = false; (sender as ToolStripButton).Checked = true; } - + void SaveClicked(object sender, EventArgs e) { Save(); } void ShowOverlaysClicked(object sender, EventArgs e) { surface1.ShowTerrainTypes ^= true; } @@ -130,18 +130,18 @@ namespace OpenRA.TilesetBuilder Palette = "arrakis.pal", Extensions = new string[] {".arr", ".shp"} }; - + // List of files to add to the mix file List fileList = new List(); - + // Export palette (use the embedded palette) var p = surface1.Image.Palette.Entries.ToList(); fileList.Add(ExportPalette(p, Path.Combine(dir, tileset.Palette))); - + // Export tile artwork foreach (var t in surface1.Templates) - fileList.Add(ExportTemplate(t, surface1.Templates.IndexOf(t), tileset.Extensions.First(), dir)); - + fileList.Add(ExportTemplate(t, surface1.Templates.IndexOf(t), tileset.Extensions.First(), dir)); + // Add the terraintypes // Todo: add support for multiple/different terraintypes var terraintype = new TerrainTypeInfo() @@ -152,7 +152,7 @@ namespace OpenRA.TilesetBuilder Color = Color.White }; tileset.Terrain.Add("Clear", terraintype); - + // Add the templates ushort cur = 0; foreach (var tp in surface1.Templates) @@ -163,7 +163,7 @@ namespace OpenRA.TilesetBuilder Image = "t{0:00}".F(cur), Size = new int2(tp.Width,tp.Height), }; - + // Todo: add support for different terraintypes // Todo: restrict cells? this doesn't work: .Where( c => surface1.TerrainTypes[c.Key.X, c.Key.Y] != 0 ) foreach (var t in tp.Cells) @@ -172,7 +172,7 @@ namespace OpenRA.TilesetBuilder tileset.Templates.Add(cur, template); cur++; } - + tileset.Save(Path.Combine(dir, tilesetFile)); throw new NotImplementedException("NotI"); //PackageWriter.CreateMix(Path.Combine(dir, mixFile),fileList); @@ -180,11 +180,11 @@ namespace OpenRA.TilesetBuilder // Cleanup foreach (var file in fileList) File.Delete(file); - + Console.WriteLine("Finished export"); */ } - + string ExportPalette(List p, string file) { while (p.Count < 256) p.Add(Color.Black); // pad the palette out with extra blacks @@ -211,7 +211,7 @@ namespace OpenRA.TilesetBuilder bw.Write((uint)0); // filesize placeholder bw.Flush(); bw.Write((uint)ms.Position + 24); // image start - bw.Write((uint)0); // 0 (32bits) + bw.Write((uint)0); // 0 (32bits) bw.Write((uint)0x2c730f8a); // magic? bw.Write((uint)0); // flags start bw.Write((uint)0); // walk start @@ -272,7 +272,7 @@ namespace OpenRA.TilesetBuilder File.WriteAllBytes(filename, bytes); } - + return filename; } } diff --git a/OpenRA.TilesetBuilder/Program.cs b/OpenRA.TilesetBuilder/Program.cs index 04d69000aa..9038b5dd44 100644 --- a/OpenRA.TilesetBuilder/Program.cs +++ b/OpenRA.TilesetBuilder/Program.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.TilesetBuilder/Properties/AssemblyInfo.cs b/OpenRA.TilesetBuilder/Properties/AssemblyInfo.cs index bbd3ee46a6..51e30891aa 100644 --- a/OpenRA.TilesetBuilder/Properties/AssemblyInfo.cs +++ b/OpenRA.TilesetBuilder/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.TilesetBuilder")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/OpenRA.TilesetBuilder/Surface.cs b/OpenRA.TilesetBuilder/Surface.cs index 906a4cd0af..e9477ac75c 100644 --- a/OpenRA.TilesetBuilder/Surface.cs +++ b/OpenRA.TilesetBuilder/Surface.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.TilesetBuilder/Template.cs b/OpenRA.TilesetBuilder/Template.cs index cc2d3a181c..a5b25f948e 100644 --- a/OpenRA.TilesetBuilder/Template.cs +++ b/OpenRA.TilesetBuilder/Template.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index 9507159560..11cdc7806f 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -72,7 +72,7 @@ namespace OpenRA.Utility yield return bytes; } } - + static Palette LoadPalette( string filename ) { using( var s = File.OpenRead( filename ) ) @@ -114,16 +114,16 @@ namespace OpenRA.Utility { var src = args[1]; var dest = args[2]; - + Dune2ShpReader srcImage = null; using( var s = File.OpenRead( src ) ) srcImage = new Dune2ShpReader(s); - + var size = srcImage.First().Size; - + if (!srcImage.All( im => im.Size == size )) throw new InvalidOperationException("All the frames must be the same size to convert from Dune2 to RA"); - + using( var destStream = File.Create(dest) ) ShpWriter.Write(destStream, size.Width, size.Height, srcImage.Select( im => im.Image )); diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index fcf60b7a24..78776d5c77 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -45,7 +45,7 @@ namespace OpenRA.Utility Log.AddChannel("utility", "utility.log"); Log.Write("utility", "Received args: {0}", string.Join(" ", args)); Log.Write("utility", "{0}", e.ToString()); - + Console.WriteLine("Error: Utility application crashed. See utility.log for details"); throw; } diff --git a/OpenRA.Utility/Properties/AssemblyInfo.cs b/OpenRA.Utility/Properties/AssemblyInfo.cs index 6d0af3c69d..a720f041a1 100644 --- a/OpenRA.Utility/Properties/AssemblyInfo.cs +++ b/OpenRA.Utility/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("OpenRA.Utility")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/RALint/Properties/AssemblyInfo.cs b/RALint/Properties/AssemblyInfo.cs index 458f02ba09..c378c83436 100644 --- a/RALint/Properties/AssemblyInfo.cs +++ b/RALint/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("RALint")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/RALint/RALint.cs b/RALint/RALint.cs index ca24fc2644..4d30243ad2 100644 --- a/RALint/RALint.cs +++ b/RALint/RALint.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -37,9 +37,9 @@ namespace RALint { var options = args.Where(a => a.StartsWith("-")); var mods = args.Where(a => !options.Contains(a)).ToArray(); - + var verbose = options.Contains( "-v" ) || options.Contains( "--verbose" ); - + // bind some nonfatal error handling into FieldLoader, so we don't just *explode*. ObjectCreator.MissingTypeAction = s => EmitError("Missing Type: {0}".F(s)); FieldLoader.UnknownFieldAction = (s, f) => EmitError("FieldLoader: Missing field `{0}` on `{1}`".F(s, f.Name)); diff --git a/SequenceEditor/Form1.Designer.cs b/SequenceEditor/Form1.Designer.cs index ac4f4161fd..6be8662da0 100644 --- a/SequenceEditor/Form1.Designer.cs +++ b/SequenceEditor/Form1.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -51,12 +51,12 @@ namespace SequenceEditor this.toolStrip1.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); - // + // // toolStripContainer1 - // - // + // + // // toolStripContainer1.ContentPanel - // + // this.toolStripContainer1.ContentPanel.Controls.Add(this.panel1); this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(708, 518); this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -65,13 +65,13 @@ namespace SequenceEditor this.toolStripContainer1.Size = new System.Drawing.Size(708, 543); this.toolStripContainer1.TabIndex = 0; this.toolStripContainer1.Text = "toolStripContainer1"; - // + // // toolStripContainer1.TopToolStripPanel - // + // this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.toolStrip1); - // + // // toolStrip1 - // + // this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None; this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButton1, @@ -80,9 +80,9 @@ namespace SequenceEditor this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(160, 25); this.toolStrip1.TabIndex = 0; - // + // // toolStripButton1 - // + // this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -90,9 +90,9 @@ namespace SequenceEditor this.toolStripButton1.Size = new System.Drawing.Size(113, 22); this.toolStripButton1.Text = "Add Another SHP..."; this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); - // + // // toolStripButton2 - // + // this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; @@ -100,9 +100,9 @@ namespace SequenceEditor this.toolStripButton2.Size = new System.Drawing.Size(35, 22); this.toolStripButton2.Text = "Save"; this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); - // + // // panel1 - // + // this.panel1.AutoScroll = true; this.panel1.Controls.Add(this.surface1); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -110,18 +110,18 @@ namespace SequenceEditor this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(708, 518); this.panel1.TabIndex = 0; - // + // // surface1 - // + // this.surface1.Dock = System.Windows.Forms.DockStyle.Top; this.surface1.Location = new System.Drawing.Point(0, 0); this.surface1.Name = "surface1"; this.surface1.Size = new System.Drawing.Size(708, 518); this.surface1.TabIndex = 0; this.surface1.Text = "surface1"; - // + // // Form1 - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(708, 543); diff --git a/SequenceEditor/Form1.cs b/SequenceEditor/Form1.cs index 4f066d7e3d..2f3794337c 100644 --- a/SequenceEditor/Form1.cs +++ b/SequenceEditor/Form1.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/SequenceEditor/GetTextForm.Designer.cs b/SequenceEditor/GetTextForm.Designer.cs index 7132ec2bf6..1ccb89b569 100644 --- a/SequenceEditor/GetTextForm.Designer.cs +++ b/SequenceEditor/GetTextForm.Designer.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -42,18 +42,18 @@ namespace SequenceEditor this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); - // + // // textBox1 - // + // this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.textBox1.Location = new System.Drawing.Point(13, 13); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(337, 20); this.textBox1.TabIndex = 0; - // + // // button1 - // + // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; this.button1.Location = new System.Drawing.Point(194, 50); @@ -62,9 +62,9 @@ namespace SequenceEditor this.button1.TabIndex = 1; this.button1.Text = "OK"; this.button1.UseVisualStyleBackColor = true; - // + // // button2 - // + // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.button2.Location = new System.Drawing.Point(275, 50); @@ -73,9 +73,9 @@ namespace SequenceEditor this.button2.TabIndex = 2; this.button2.Text = "Cancel"; this.button2.UseVisualStyleBackColor = true; - // + // // GetTextForm - // + // this.AcceptButton = this.button1; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; diff --git a/SequenceEditor/GetTextForm.cs b/SequenceEditor/GetTextForm.cs index 5e196180a6..e5ad3c7dad 100644 --- a/SequenceEditor/GetTextForm.cs +++ b/SequenceEditor/GetTextForm.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. diff --git a/SequenceEditor/Program.cs b/SequenceEditor/Program.cs index 35d3aebeae..cb633a68ef 100644 --- a/SequenceEditor/Program.cs +++ b/SequenceEditor/Program.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -90,7 +90,7 @@ namespace SequenceEditor FileSystem.LoadFromManifest( manifest ); XmlFilename = args[1]; - Doc = new XmlDocument(); + Doc = new XmlDocument(); Doc.Load(XmlFilename); var tempPal = new Palette(FileSystem.Open(args[2]), true); @@ -100,7 +100,7 @@ namespace SequenceEditor if (string.IsNullOrEmpty(UnitName)) return; - LoadAndResolve(UnitName); + LoadAndResolve(UnitName); var xpath = string.Format("//unit[@name=\"{0}\"]/sequence", UnitName); foreach (XmlElement e in Doc.SelectNodes(xpath)) diff --git a/SequenceEditor/Properties/AssemblyInfo.cs b/SequenceEditor/Properties/AssemblyInfo.cs index a9fe82add8..7b68706d29 100644 --- a/SequenceEditor/Properties/AssemblyInfo.cs +++ b/SequenceEditor/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -12,7 +12,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SequenceEditor")] @@ -24,8 +24,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -35,11 +35,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/SequenceEditor/Surface.cs b/SequenceEditor/Surface.cs index b168477a18..80bf9af6a7 100644 --- a/SequenceEditor/Surface.cs +++ b/SequenceEditor/Surface.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -26,7 +26,7 @@ namespace SequenceEditor UpdateStyles(); } - Dictionary> items + Dictionary> items = new Dictionary>(); Point mousePos; @@ -120,7 +120,7 @@ namespace SequenceEditor { base.OnPaint(e); - var x = 0; + var x = 0; var y = 0; Point? toolPoint = null; @@ -142,11 +142,11 @@ namespace SequenceEditor var start = FindFrameAt(clickPos); var end = FindFrameAt(mousePos); - if (start != null && end != null + if (start != null && end != null && start.Value.First == end.Value.First) - tempSequence = new Sequence() { - start = start.Value.Second, - length = end.Value.Second - start.Value.Second + 1, + tempSequence = new Sequence() { + start = start.Value.Second, + length = end.Value.Second - start.Value.Second + 1, shp = start.Value.First }; } diff --git a/packaging/fixheader.cs b/packaging/fixheader.cs index 693311cf03..1c0eb9dbb3 100644 --- a/packaging/fixheader.cs +++ b/packaging/fixheader.cs @@ -1,7 +1,7 @@ #region Copyright & License Information /* * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made + * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, * see COPYING. @@ -25,7 +25,7 @@ namespace fixheader peOffset = BitConverter.ToInt32(data, 0x3c); var corHeaderRva = BitConverter.ToInt32(data, peOffset + 20 + 100 + 14 * 8); var corHeaderOffset = RvaToOffset(corHeaderRva); - + data[corHeaderOffset + 16] |= 2; File.WriteAllBytes(args[0], data); @@ -36,7 +36,7 @@ namespace fixheader var numSections = BitConverter.ToInt16(data, peOffset + 6); var numDataDirectories = BitConverter.ToInt32(data, peOffset + 24 + 92); var sectionTableStart = peOffset + 24 + 96 + 8 * numDataDirectories; - + for (var i = 0; i < numSections; i++) { var virtualSize = BitConverter.ToInt32(data, sectionTableStart + 40 * i + 8);