fix license headers; fix crate spawn for non-128x128 maps
This commit is contained in:
@@ -1,7 +1,25 @@
|
|||||||
using OpenRA.Graphics;
|
#region Copyright & License Information
|
||||||
using System.Drawing;
|
/*
|
||||||
using System.Collections.Generic;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class BackgroundWidget : Widget
|
class BackgroundWidget : Widget
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
using OpenRA.Graphics;
|
#region Copyright & License Information
|
||||||
using System.Drawing;
|
/*
|
||||||
using System.Collections.Generic;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class ButtonWidget : Widget
|
class ButtonWidget : Widget
|
||||||
|
|||||||
@@ -1,7 +1,25 @@
|
|||||||
using OpenRA.Graphics;
|
#region Copyright & License Information
|
||||||
using System.Drawing;
|
/*
|
||||||
using System.Collections.Generic;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class CheckboxWidget : Widget
|
class CheckboxWidget : Widget
|
||||||
|
|||||||
@@ -1,9 +1,27 @@
|
|||||||
using System.Collections.Generic;
|
#region Copyright & License Information
|
||||||
using System.Linq;
|
/*
|
||||||
using System.Drawing;
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
using System.Net;
|
* This file is part of OpenRA.
|
||||||
using OpenRA.FileFormats;
|
*
|
||||||
using OpenRA.Graphics;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using OpenRA.Server;
|
using OpenRA.Server;
|
||||||
|
|
||||||
namespace OpenRA.Widgets.Delegates
|
namespace OpenRA.Widgets.Delegates
|
||||||
|
|||||||
@@ -1,7 +1,25 @@
|
|||||||
using OpenRA.Graphics;
|
#region Copyright & License Information
|
||||||
using System.Drawing;
|
/*
|
||||||
using System.Collections.Generic;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class LabelWidget : Widget
|
class LabelWidget : Widget
|
||||||
|
|||||||
@@ -1,9 +1,29 @@
|
|||||||
using System;
|
#region Copyright & License Information
|
||||||
using System.Collections.Generic;
|
/*
|
||||||
using System.Drawing;
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Widgets.Delegates;
|
using OpenRA.Widgets.Delegates;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,27 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,22 +57,23 @@ namespace OpenRA.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int ChooseCrateLocationAttempts = 100;
|
||||||
|
|
||||||
void SpawnCrate(Actor self, CrateSpawnerInfo info)
|
void SpawnCrate(Actor self, CrateSpawnerInfo info)
|
||||||
{
|
{
|
||||||
var inWater = self.World.SharedRandom.NextDouble() < info.WaterChance;
|
var inWater = self.World.SharedRandom.NextDouble() < info.WaterChance;
|
||||||
var umt = inWater ? UnitMovementType.Float : UnitMovementType.Wheel;
|
var umt = inWater ? UnitMovementType.Float : UnitMovementType.Wheel;
|
||||||
int count = 0, threshold = 100;
|
|
||||||
for (; ; )
|
for (var n = 0; n < ChooseCrateLocationAttempts; n++)
|
||||||
{
|
{
|
||||||
var p = new int2(self.World.SharedRandom.Next(0, 127), self.World.SharedRandom.Next(0, 127));
|
var p = self.World.ChooseRandomCell(self.World.SharedRandom);
|
||||||
|
|
||||||
if (self.World.IsCellBuildable(p, umt))
|
if (self.World.IsCellBuildable(p, umt))
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(
|
self.World.AddFrameEndTask(
|
||||||
w => crates.Add(w.CreateActor("crate", p, self.Owner)));
|
w => crates.Add(w.CreateActor("crate", p, self.Owner)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (count++ > threshold)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,13 @@ namespace OpenRA
|
|||||||
: (edge ? w.Map.YOffset : w.Map.YOffset + w.Map.Height));
|
: (edge ? w.Map.YOffset : w.Map.YOffset + w.Map.Height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int2 ChooseRandomCell(this World w, Thirdparty.Random r)
|
||||||
|
{
|
||||||
|
return new int2(
|
||||||
|
r.Next(w.Map.XOffset, w.Map.XOffset + w.Map.Width),
|
||||||
|
r.Next(w.Map.YOffset, w.Map.YOffset + w.Map.Height));
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<CountryInfo> GetCountries(this World w)
|
public static IEnumerable<CountryInfo> GetCountries(this World w)
|
||||||
{
|
{
|
||||||
return w.WorldActor.Info.Traits.WithInterface<CountryInfo>();
|
return w.WorldActor.Info.Traits.WithInterface<CountryInfo>();
|
||||||
|
|||||||
@@ -31,10 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class RenderSpy : RenderInfantry, IRenderModifier
|
class RenderSpy : RenderInfantry, IRenderModifier
|
||||||
{
|
{
|
||||||
public RenderSpy(Actor self)
|
public RenderSpy(Actor self) : base(self) { }
|
||||||
: base(self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user