Draw shellmap actors
This commit is contained in:
@@ -146,7 +146,8 @@ namespace OpenRA
|
||||
public void Tick(World world)
|
||||
{
|
||||
if (!Game.IsStarted) return;
|
||||
|
||||
if (world.LocalPlayer == null) return;
|
||||
|
||||
TickPaletteAnimation();
|
||||
TickRadarAnimation();
|
||||
|
||||
|
||||
@@ -185,12 +185,13 @@ namespace OpenRA
|
||||
AvailableMaps = FindMaps(LobbyInfo.GlobalSettings.Mods);
|
||||
|
||||
ChangeMods();
|
||||
LoadMap(new Manifest(LobbyInfo.GlobalSettings.Mods).ShellmapUid);
|
||||
|
||||
if( Settings.Replay != "" )
|
||||
orderManager = new OrderManager( new ReplayConnection( Settings.Replay ) );
|
||||
else
|
||||
JoinLocal();
|
||||
|
||||
LoadShellMap(new Manifest(LobbyInfo.GlobalSettings.Mods).ShellmapUid);
|
||||
}
|
||||
|
||||
public static string CurrentHost = "";
|
||||
@@ -340,7 +341,21 @@ namespace OpenRA
|
||||
public static void IssueOrder(Order o) { orderManager.IssueOrder(o); } /* avoid exposing the OM to mod code */
|
||||
|
||||
public static bool IsStarted { get { return orderManager.GameStarted; } }
|
||||
|
||||
public static void LoadShellMap(string map)
|
||||
{
|
||||
LoadMap(map);
|
||||
world.Queries = new World.AllQueries(world);
|
||||
|
||||
foreach (var p in world.players.Values)
|
||||
foreach (var q in world.players.Values)
|
||||
p.Stances[q] = ChooseInitialStance(p, q);
|
||||
|
||||
foreach (var gs in world.WorldActor.traits.WithInterface<IGameStarted>())
|
||||
gs.GameStarted(world);
|
||||
orderManager.StartGame();
|
||||
}
|
||||
|
||||
public static void StartGame()
|
||||
{
|
||||
LoadMap(LobbyInfo.GlobalSettings.Map);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#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.
|
||||
@@ -43,6 +43,9 @@ namespace OpenRA.GameRules
|
||||
public Cache<string, List<Actor>> GatherBuildings( Player player )
|
||||
{
|
||||
var ret = new Cache<string, List<Actor>>( x => new List<Actor>() );
|
||||
if (player == null)
|
||||
return ret;
|
||||
|
||||
foreach( var b in player.World.Queries.OwnedBy[player].Where( x=>x.Info.Traits.Contains<BuildingInfo>() ) )
|
||||
{
|
||||
ret[ b.Info.Name ].Add( b );
|
||||
@@ -56,6 +59,9 @@ namespace OpenRA.GameRules
|
||||
|
||||
public bool CanBuild( ActorInfo info, Player player, Cache<string, List<Actor>> playerBuildings )
|
||||
{
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
var bi = info.Traits.GetOrDefault<BuildableInfo>();
|
||||
if( bi == null ) return false;
|
||||
|
||||
@@ -74,6 +80,9 @@ namespace OpenRA.GameRules
|
||||
|
||||
public IEnumerable<string> BuildableItems( Player player, params string[] categories )
|
||||
{
|
||||
if (player == null)
|
||||
yield break;
|
||||
|
||||
var playerBuildings = GatherBuildings( player );
|
||||
foreach (var unit in AllBuildables(categories))
|
||||
if( CanBuild( unit, player, playerBuildings ) )
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace OpenRA.Graphics
|
||||
world.WorldRenderer.Draw();
|
||||
if( Game.orderManager.GameStarted )
|
||||
{
|
||||
Game.chrome.Draw( world );
|
||||
if (world.LocalPlayer != null)
|
||||
Game.chrome.Draw( world );
|
||||
|
||||
if( Game.orderManager.Connection.ConnectionState == ConnectionState.NotConnected )
|
||||
Game.chrome.DrawDialog("Connection lost.");
|
||||
|
||||
@@ -23,7 +23,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
using System;
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
public class WorldRenderer
|
||||
@@ -118,7 +118,7 @@ namespace OpenRA.Graphics
|
||||
var actors = world.FindUnits(
|
||||
new float2(bounds.Left, bounds.Top),
|
||||
new float2(bounds.Right, bounds.Bottom));
|
||||
|
||||
|
||||
var renderables = actors.SelectMany(a => a.Render())
|
||||
.OrderBy(r => r, comparer);
|
||||
|
||||
|
||||
@@ -155,7 +155,10 @@ namespace OpenRA
|
||||
frameEndActions = new List<Action<World>>();
|
||||
foreach (var a in acts) a(this);
|
||||
|
||||
Minimap.Update();
|
||||
// TODO: This doesn't even belong here -> move into a widget
|
||||
if (LocalPlayer != null)
|
||||
Minimap.Update();
|
||||
|
||||
foreach (var player in players.Values)
|
||||
player.Tick();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user