Skip to content

Commit

Permalink
Hotfix 0.16.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
3e849f2e5c committed Feb 25, 2022
1 parent 102e089 commit a83f375
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 24 deletions.
31 changes: 27 additions & 4 deletions Barotrauma/BarotraumaClient/ClientSource/Fonts/ScalableFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ScalableFont : IDisposable
{
private static List<ScalableFont> FontList = new List<ScalableFont>();
private static Library Lib = null;
private static object mutex = new object();
private readonly object mutex = new object();

private string filename;
private Face face;
Expand Down Expand Up @@ -256,10 +256,33 @@ private void RenderAtlas(GraphicsDevice gd, uint[] charRanges = null, int texDim
}

private void DynamicRenderAtlas(GraphicsDevice gd, uint character, int texDims = 1024, uint baseChar = 0x54)
=> DynamicRenderAtlas(gd, character.ToEnumerable(), texDims, baseChar);
{
bool missingCharacterFound = false;
lock (mutex)
{
missingCharacterFound = !texCoords.ContainsKey(character);
}
if (!missingCharacterFound) { return; }
DynamicRenderAtlas(gd, character.ToEnumerable(), texDims, baseChar);
}

private void DynamicRenderAtlas(GraphicsDevice gd, string str, int texDims = 1024, uint baseChar = 0x54)
=> DynamicRenderAtlas(gd, str.Distinct().Select(c => (uint)c), texDims, baseChar);
{
bool missingCharacterFound = false;
var distinctChrs = str.Distinct().Select(c => (uint)c).ToArray();
lock (mutex)
{
foreach (var character in distinctChrs)
{
if (texCoords.ContainsKey(character)) { continue; }

missingCharacterFound = true;
break;
}
}
if (!missingCharacterFound) { return; }
DynamicRenderAtlas(gd, distinctChrs, texDims, baseChar);
}

private void DynamicRenderAtlas(GraphicsDevice gd, IEnumerable<uint> characters, int texDims = 1024, uint baseChar = 0x54)
{
Expand All @@ -268,7 +291,7 @@ private void DynamicRenderAtlas(GraphicsDevice gd, IEnumerable<uint> characters,
CrossThread.RequestExecutionOnMainThread(() =>
{
DynamicRenderAtlas(gd, characters, texDims, baseChar);
});
});
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ private int TryAdjustIndex(int amount)

private bool CreateOrder(Order order, Hull targetHull = null)
{
var sub = Character.Controlled.Submarine;
var sub = Character.Controlled?.Submarine;

if (sub == null || sub.TeamID != Character.Controlled.TeamID || sub.Info.IsWreck) { return false; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2984,6 +2984,8 @@ public void SetupNewCampaign(SubmarineInfo sub, string saveName, string mapSeed,

public void SetupLoadCampaign(string saveName)
{
if (clientPeer == null) { return; }

GameMain.NetLobbyScreen.CampaignSetupFrame.Visible = false;
GameMain.NetLobbyScreen.CampaignFrame.Visible = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,7 @@ public bool ToggleSpectate(GUITickBox tickBox)

public void SetSpectate(bool spectate)
{
if (GameMain.Client == null) { return; }
this.spectateBox.Selected = spectate;
if (spectate)
{
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/LinuxClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/MacClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/WindowsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/LinuxServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/MacServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/WindowsServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.16.6.1</Version>
<Version>0.16.7.0</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ private bool IsCharacterAway(Character character)

const int maxDist = 1000;

if (level != null)
if (level != null && !level.Removed)
{
foreach (var ruin in level.Ruins)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,18 @@ public AndComponent(Item item, XElement element)

public override void Update(float deltaTime, Camera cam)
{
bool sendOutput = true;
bool state = true;
for (int i = 0; i < timeSinceReceived.Length; i++)
{
if (timeSinceReceived[i] > timeFrame) { sendOutput = false; }
if (timeSinceReceived[i] > timeFrame) { state = false; }
timeSinceReceived[i] += deltaTime;
}

string signalOut = sendOutput ? output : falseOutput;
string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut))
{
IsActive = false;
//deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ public OrComponent(Item item, XElement element)

public override void Update(float deltaTime, Camera cam)
{
bool sendOutput = false;
bool state = false;
for (int i = 0; i < timeSinceReceived.Length; i++)
{
if (timeSinceReceived[i] <= timeFrame) { sendOutput = true; }
if (timeSinceReceived[i] <= timeFrame) { state = true; }
timeSinceReceived[i] += deltaTime;
}

string signalOut = sendOutput ? output : falseOutput;
string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut))
{
IsActive = false;
//deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ public XorComponent(Item item, XElement element)

public override void Update(float deltaTime, Camera cam)
{
int sendOutput = 0;
int receivedInputs = 0;
for (int i = 0; i < timeSinceReceived.Length; i++)
{
if (timeSinceReceived[i] <= timeFrame) { sendOutput += 1; }
if (timeSinceReceived[i] <= timeFrame) { receivedInputs += 1; }
timeSinceReceived[i] += deltaTime;
}

string signalOut = sendOutput == 1 ? output : falseOutput;
bool state = receivedInputs == 1;
string signalOut = state ? output : falseOutput;
if (string.IsNullOrEmpty(signalOut))
{
IsActive = false;
//deactivate the component if state is false and there's no false output (will be woken up by non-zero signals in ReceiveSignal)
if (!state) { IsActive = false; }
return;
}

Expand Down
8 changes: 8 additions & 0 deletions Barotrauma/BarotraumaShared/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------------
v0.16.7.0
---------------------------------------------------------------------------------------------------------

- Fixed excessive loading times when playing in Chinese, Japanese or Korean.
- Fixed certain logic components (and/or/xor with an empty output and non-empty false output) stopping to work altogether when they stop sending a signal.
- Fixes to crashes when trying to interact with certain elements in the server lobby while getting disconnected.

---------------------------------------------------------------------------------------------------------
v0.16.6.1
---------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit a83f375

Please sign in to comment.