Skip to content

Commit

Permalink
fix: return & continue on separate line (#1504)
Browse files Browse the repository at this point in the history
* fix: return & continue on separate line

* Update Assets/Mirror/Runtime/Transport/Telepathy/Server.cs
  • Loading branch information
MrGadget committed Feb 17, 2020
1 parent c70a43b commit 61fdd89
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 23 deletions.
12 changes: 8 additions & 4 deletions Assets/Mirror/Components/NetworkAnimator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ public void ResetTrigger(int hash)
void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, int layerId, byte[] parameters)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;
if (!clientAuthority)
return;

if (LogFilter.Debug) Debug.Log("OnAnimationMessage for netId=" + netId);

Expand All @@ -467,7 +468,8 @@ void CmdOnAnimationServerMessage(int stateHash, float normalizedTime, int layerI
void CmdOnAnimationParametersServerMessage(byte[] parameters)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;
if (!clientAuthority)
return;

// handle and broadcast
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(parameters))
Expand All @@ -481,7 +483,8 @@ void CmdOnAnimationParametersServerMessage(byte[] parameters)
void CmdOnAnimationTriggerServerMessage(int hash)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;
if (!clientAuthority)
return;

// handle and broadcast
HandleAnimTriggerMsg(hash);
Expand All @@ -492,7 +495,8 @@ void CmdOnAnimationTriggerServerMessage(int hash)
void CmdOnAnimationResetTriggerServerMessage(int hash)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;
if (!clientAuthority)
return;

// handle and broadcast
HandleAnimResetTriggerMsg(hash);
Expand Down
9 changes: 6 additions & 3 deletions Assets/Mirror/Components/NetworkRoomManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ void SceneLoadedForPlayer(NetworkConnection conn, GameObject roomPlayer)
/// </summary>
public void CheckReadyToBegin()
{
if (SceneManager.GetActiveScene().name != RoomScene) return;
if (SceneManager.GetActiveScene().name != RoomScene)
return;

if (minPlayers > 0 && NetworkServer.connections.Count(conn => conn.Value != null && conn.Value.identity.gameObject.GetComponent<NetworkRoomPlayer>().readyToBegin) < minPlayers)
{
Expand Down Expand Up @@ -270,7 +271,8 @@ public override void OnServerAddPlayer(NetworkConnection conn)
{
if (SceneManager.GetActiveScene().name == RoomScene)
{
if (roomSlots.Count == maxConnections) return;
if (roomSlots.Count == maxConnections)
return;

allPlayersReady = false;

Expand Down Expand Up @@ -308,7 +310,8 @@ public override void ServerChangeScene(string sceneName)
{
foreach (NetworkRoomPlayer roomPlayer in roomSlots)
{
if (roomPlayer == null) continue;
if (roomPlayer == null)
continue;

// find the game-player object for this connection, and destroy it
NetworkIdentity identity = roomPlayer.GetComponent<NetworkIdentity>();
Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Components/NetworkTransformBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ public override void OnDeserialize(NetworkReader reader, bool initialState)
void CmdClientToServerSync(byte[] payload)
{
// Ignore messages from client if not in client authority mode
if (!clientAuthority) return;
if (!clientAuthority)
return;

// deserialize payload
using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(payload))
Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ static void OnCompilationFinished(string assemblyPath, CompilerMessage[] message
dependencyPaths.Add(Path.GetDirectoryName(assemblyPath));
foreach (UnityAssembly unityAsm in CompilationPipeline.GetAssemblies())
{
if (unityAsm.outputPath != assemblyPath) continue;
if (unityAsm.outputPath != assemblyPath)
continue;

foreach (string unityAsmRef in unityAsm.compiledAssemblyReferences)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void OnDisable()

void Update()
{
if (!isLocalPlayer) return;
if (!isLocalPlayer)
return;

horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxis("Vertical");
Expand Down Expand Up @@ -80,7 +81,8 @@ void Update()

void FixedUpdate()
{
if (!isLocalPlayer || characterController == null) return;
if (!isLocalPlayer || characterController == null)
return;

transform.Rotate(0f, turn * Time.fixedDeltaTime, 0f);

Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Examples/Chat/Scripts/ChatWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ private void OnPlayerMessage(Player player, string message)

public void OnSend()
{
if (chatMessage.text.Trim() == "") return;
if (chatMessage.text.Trim() == "")
return;

// get our player
Player player = NetworkClient.connection.identity.GetComponent<Player>();
Expand Down
6 changes: 4 additions & 2 deletions Assets/Mirror/Examples/Room/Scripts/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void OnDisable()

void Update()
{
if (!isLocalPlayer) return;
if (!isLocalPlayer)
return;

horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxis("Vertical");
Expand Down Expand Up @@ -80,7 +81,8 @@ void Update()

void FixedUpdate()
{
if (!isLocalPlayer || characterController == null) return;
if (!isLocalPlayer || characterController == null)
return;

transform.Rotate(0f, turn * Time.fixedDeltaTime, 0f);

Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Examples/Tanks/Scripts/Tank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public class Tank : NetworkBehaviour
void Update()
{
// movement for local player
if (!isLocalPlayer) return;
if (!isLocalPlayer)
return;

// rotate
float horizontal = Input.GetAxis("Horizontal");
Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Runtime/NetworkReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ public static byte[] ReadBytes(this NetworkReader reader, int count)
public static NetworkIdentity ReadNetworkIdentity(this NetworkReader reader)
{
uint netId = reader.ReadPackedUInt32();
if (netId == 0) return null;
if (netId == 0)
return null;

if (NetworkIdentity.spawned.TryGetValue(netId, out NetworkIdentity identity))
{
Expand Down
6 changes: 4 additions & 2 deletions Assets/Mirror/Runtime/Transport/LLAPITransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ public override bool ClientSend(int channelId, ArraySegment<byte> segment)

public bool ProcessClientMessage()
{
if (clientId == -1) return false;
if (clientId == -1)
return false;

NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(clientId, out int connectionId, out int channel, clientReceiveBuffer, clientReceiveBuffer.Length, out int receivedSize, out error);

Expand Down Expand Up @@ -280,7 +281,8 @@ public override bool ServerSend(List<int> connectionIds, int channelId, ArraySeg

public bool ProcessServerMessage()
{
if (serverHostId == -1) return false;
if (serverHostId == -1)
return false;

NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(serverHostId, out int connectionId, out int channel, serverReceiveBuffer, serverReceiveBuffer.Length, out int receivedSize, out error);

Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Runtime/Transport/Telepathy/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ void ReceiveThreadFunction(string ip, int port)
public void Connect(string ip, int port)
{
// not if already started
if (Connecting || Connected) return;
if (Connecting || Connected)
return;

// We are connecting from now until Connect succeeds or fails
_Connecting = true;
Expand Down
6 changes: 4 additions & 2 deletions Assets/Mirror/Runtime/Transport/Telepathy/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ void Listen(int port)
public bool Start(int port)
{
// not if already started
if (Active) return false;
if (Active)
return false;

// clear old messages in queue, just to be sure that the caller
// doesn't receive data from last time and gets out of sync.
Expand All @@ -202,7 +203,8 @@ public bool Start(int port)
public void Stop()
{
// only if started
if (!Active) return;
if (!Active)
return;

Logger.Log("Server: stopping...");

Expand Down
3 changes: 2 additions & 1 deletion Assets/Mirror/Runtime/Transport/Websocket/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ async Task<ArraySegment<byte>> ReadFrames(int connectionId, WebSocketReceiveResu
public void Stop()
{
// only if started
if (!Active) return;
if (!Active)
return;

Debug.Log("Server: stopping...");
cancellation.Cancel();
Expand Down
4 changes: 3 additions & 1 deletion Assets/Mirror/Tests/Editor/WeaverAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public static void ClearReferences()
// Delete output dll / pdb / mdb
public static void DeleteOutput()
{
if (OutputFile.Length < 5) return; // "x.dll" shortest possible dll name
// "x.dll" shortest possible dll name
if (OutputFile.Length < 5)
return;

string projPathFile = OutputDirectory + OutputFile;

Expand Down

0 comments on commit 61fdd89

Please sign in to comment.