diff --git a/TouchyTickets/Attractions/Attraction.cs b/TouchyTickets/Attractions/Attraction.cs index 94be9c5..a864d53 100644 --- a/TouchyTickets/Attractions/Attraction.cs +++ b/TouchyTickets/Attractions/Attraction.cs @@ -21,21 +21,21 @@ namespace TouchyTickets.Attractions { [DataMember] public readonly AttractionType Type; [DataMember] - private float ticketPercentage; + private double ticketPercentage; private float animationSizeModifier; public Attraction(AttractionType type) { this.Type = type; } - public float Update(GameTime time, TimeSpan passed, ParkMap map, Point position) { + public double Update(GameTime time, TimeSpan passed, ParkMap map, Point position) { var genRate = this.GetGenerationRate(map, position); // apply generation rate to ticket amount - this.ticketPercentage += genRate * (float) passed.TotalSeconds; - var total = this.ticketPercentage.Floor(); + this.ticketPercentage += genRate * passed.TotalSeconds; + var total = (BigInteger) this.ticketPercentage; if (total > 0) { GameImpl.Instance.Tickets += total; - this.ticketPercentage -= total; + this.ticketPercentage -= (double) total; } // animation stuff @@ -55,12 +55,12 @@ namespace TouchyTickets.Attractions { batch.Draw(tex, position + center * scale, Color.White * alpha, 0, center, drawScale, SpriteEffects.None, 0); } - public float GetGenerationRate(ParkMap map, Point position) { + public double GetGenerationRate(ParkMap map, Point position) { var genRate = this.Type.GetGenerationRate(); // apply attraction modifiers foreach (var modifier in this.Modifiers) - genRate *= (float) Math.Pow(modifier.Modifier.Multiplier, modifier.Amount); + genRate *= Math.Pow(modifier.Modifier.Multiplier, modifier.Amount); // apply star upgrades if (Upgrade.FerrisWheelModifier.IsActive() && this.GetSurrounding(map, position, FerrisWheel).Any()) @@ -91,9 +91,9 @@ namespace TouchyTickets.Attractions { return this.Modifiers.Where(m => modifier == null || m.Modifier == modifier).Sum(m => m.Amount); } - public long GetModifierPrice(AttractionModifier modifier) { + public BigInteger GetModifierPrice(AttractionModifier modifier) { var amount = this.GetModifierAmount(modifier); - return (long) Math.Ceiling(modifier.InitialPrice * Math.Pow(1 + 0.4F, amount)); + return (BigInteger) Math.Ceiling(modifier.InitialPrice * Math.Pow(1 + 0.4F, amount)); } public void Wobble() { diff --git a/TouchyTickets/Attractions/AttractionType.cs b/TouchyTickets/Attractions/AttractionType.cs index 043e140..93971da 100644 --- a/TouchyTickets/Attractions/AttractionType.cs +++ b/TouchyTickets/Attractions/AttractionType.cs @@ -48,7 +48,7 @@ namespace TouchyTickets.Attractions { return new Attraction(this); } - public float GetGenerationRate() { + public double GetGenerationRate() { var genRate = this.generationPerSecond; if (this.Flags.HasFlag(FastCars) && Upgrade.RollerCoasterModifier.IsActive()) diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index 9fd3964..2ed488e 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -26,7 +26,7 @@ namespace TouchyTickets { private readonly Dictionary fencePositions = new Dictionary(); private readonly Attraction[,] attractionGrid; - public float TicketsPerSecond { get; private set; } + public double TicketsPerSecond { get; private set; } public Attraction PlacingAttraction; public AttractionModifier PlacingModifier; public Point PlacingPosition; @@ -68,7 +68,7 @@ namespace TouchyTickets { } public void Update(GameTime time, TimeSpan passed) { - var tickets = 0F; + var tickets = 0D; foreach (var (pos, attraction) in this.attractions) { var genPerSecond = attraction.Update(time, passed, this, pos); tickets += genPerSecond; diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 2ebd5ea..6b20d14 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -146,7 +146,7 @@ namespace TouchyTickets { IsHidden = true }; foreach (var attraction in AttractionType.Attractions) { - long price = 0; + BigInteger price = 0; var attractionAmount = 0; var button = buyUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) { ChildPadding = new Vector2(4), @@ -168,7 +168,7 @@ namespace TouchyTickets { ActionSound = new SoundEffectInfo(Assets.PlaceSound), OnPressed = e2 => { GameImpl.Instance.Tickets -= price; - GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Attraction", attraction.Key); + GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", (long) price, "Attraction", attraction.Key); map.Place(map.PlacingPosition, map.PlacingAttraction); map.PlacingAttraction.Wobble(); @@ -185,7 +185,7 @@ namespace TouchyTickets { // only update the price when the area updates, since it won't change while we're in the buy ui attractionAmount = GameImpl.Instance.Map.GetAttractionAmount(attraction.Value); // yay compound interest - price = (long) Math.Ceiling(attraction.Value.InitialPrice * Math.Pow(1 + 0.1F, attractionAmount)); + price = (BigInteger) Math.Ceiling(attraction.Value.InitialPrice * Math.Pow(1 + 0.1F, attractionAmount)); } }); var image = button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), Assets.AttractionTexture[attraction.Value.TextureRegion]) { @@ -249,7 +249,7 @@ namespace TouchyTickets { if (GameImpl.Instance.Tickets < price) break; GameImpl.Instance.Tickets -= price; - GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", price, "Modifier", modifier.Name); + GameImpl.Instance.Platform.AddResourceEvent(true, "Tickets", (long)price, "Modifier", modifier.Name); attraction.ApplyModifier(map.PlacingModifier); } attraction.Wobble(); @@ -264,7 +264,7 @@ namespace TouchyTickets { } }); addButton.Text.GetTextCallback = p => { - var price = map.PlacingModifier.InitialPrice; + BigInteger price = map.PlacingModifier.InitialPrice; if (map.SelectedPosition != null) { var attraction = map.GetAttractionAt(map.SelectedPosition.Value); if (attraction != null && map.PlacingModifier.IsAffected(attraction))