merge CreateMapPlayers into CreateMPPlayers
This commit is contained in:
@@ -21,6 +21,18 @@ namespace OpenRA.Mods.RA
|
||||
public void CreatePlayers(World w)
|
||||
{
|
||||
var playerIndex = 0;
|
||||
var mapPlayerIndex = -1; // todo: unhack this, but people still rely on it.
|
||||
|
||||
// create the unplayable map players -- neutral, shellmap, scripted, etc.
|
||||
foreach (var kv in w.Map.Players.Where(p => !p.Value.Playable))
|
||||
{
|
||||
var player = new Player(w, kv.Value, mapPlayerIndex--);
|
||||
w.AddPlayer(player);
|
||||
if (kv.Value.OwnsWorld)
|
||||
w.WorldActor.Owner = player;
|
||||
}
|
||||
|
||||
// create the players which are bound through slots.
|
||||
foreach (var slot in Game.LobbyInfo.Slots)
|
||||
{
|
||||
var client = Game.LobbyInfo.Clients.FirstOrDefault(c => c.Slot == slot.Index);
|
||||
@@ -57,6 +69,11 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
if (p == q) return Stance.Ally;
|
||||
|
||||
if (p.PlayerRef.Allies.Contains(q.InternalName))
|
||||
return Stance.Ally;
|
||||
if (p.PlayerRef.Enemies.Contains(q.InternalName))
|
||||
return Stance.Enemy;
|
||||
|
||||
// Hack: All map players are neutral wrt everyone else
|
||||
if (p.Index < 0 || q.Index < 0) return Stance.Neutral;
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#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
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class CreateMapPlayersInfo : TraitInfo<CreateMapPlayers> { }
|
||||
|
||||
public class CreateMapPlayers : ICreatePlayers
|
||||
{
|
||||
public Dictionary<string, Player> Players = new Dictionary<string, Player>();
|
||||
|
||||
public void CreatePlayers(World w)
|
||||
{
|
||||
int mapPlayerIndex = -1;
|
||||
|
||||
foreach (var kv in w.Map.Players)
|
||||
{
|
||||
if (kv.Value.Playable)
|
||||
continue; // these will be created another way.
|
||||
|
||||
var player = new Player(w, kv.Value, mapPlayerIndex--);
|
||||
w.AddPlayer(player);
|
||||
Players.Add(kv.Key,player);
|
||||
if (kv.Value.OwnsWorld)
|
||||
w.WorldActor.Owner = player;
|
||||
}
|
||||
|
||||
foreach(var p in Players)
|
||||
{
|
||||
// foreach(var q in w.Map.Players[p.Key].Allies)
|
||||
// p.Value.Stances[Players[q]] = Stance.Ally;
|
||||
|
||||
// foreach(var q in w.Map.Players[p.Key].Enemies)
|
||||
// p.Value.Stances[Players[q]] = Stance.Enemy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -235,7 +235,6 @@
|
||||
<Compile Include="Crates\RevealMapCrateAction.cs" />
|
||||
<Compile Include="TargetableCloaked.cs" />
|
||||
<Compile Include="SpawnMPUnits.cs" />
|
||||
<Compile Include="CreateMapPlayers.cs" />
|
||||
<Compile Include="CreateMPPlayers.cs" />
|
||||
<Compile Include="HackyAI.cs" />
|
||||
<Compile Include="RALoadScreen.cs" />
|
||||
|
||||
@@ -115,7 +115,6 @@ World:
|
||||
Type:Crater
|
||||
Types:cr1,cr2,cr3,cr4,cr5,cr6
|
||||
Depths:5,5,5,5,5,5
|
||||
CreateMapPlayers:
|
||||
SpawnMapActors:
|
||||
CreateMPPlayers:
|
||||
SpawnMPUnits:
|
||||
|
||||
@@ -1235,6 +1235,5 @@ Smudges:
|
||||
Rules:
|
||||
World:
|
||||
DefaultShellmapScript:
|
||||
-CreateMPPlayers:
|
||||
-SpawnMPUnits:
|
||||
-MPStartLocations:
|
||||
|
||||
@@ -172,7 +172,6 @@ World:
|
||||
Type:Crater
|
||||
Types:cr1,cr2,cr3,cr4,cr5,cr6
|
||||
Depths:5,5,5,5,5,5
|
||||
CreateMapPlayers:
|
||||
SpawnMapActors:
|
||||
CreateMPPlayers:
|
||||
MPStartLocations:
|
||||
|
||||
Reference in New Issue
Block a user