Skip to content

Commit

Permalink
Fix NRE in Online Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonidas committed Jan 7, 2021
1 parent 2627f38 commit 51d570f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 16 deletions.
3 changes: 0 additions & 3 deletions Assets/src/PieceMovements.cs
Expand Up @@ -512,9 +512,6 @@ public List<int[]> handle_piece(int row, int col, string type, int[,] boardArray
Debug.Log($"Turn is {turn}");
Debug.Log($"Row, Col is {row}, {col}");


this.PrintArray2d(boardArray, 8, 8);

List<int[]> Cords2d = new List<int[]>();
switch (type) {
case "solider":
Expand Down
7 changes: 3 additions & 4 deletions Assets/src/client.cs
Expand Up @@ -87,7 +87,6 @@ void SendAsyncMessage(byte[] message)
}

public void onSubmit() {
print("submitted");
string value = input.text;
if (value.Length == 0)
return;
Expand Down Expand Up @@ -196,6 +195,9 @@ void SendAsyncMessage(byte[] message)
CHESS.BLACK_ID = this.BLACK_ID;
CHESS.WHITE_ID = this.WHITE_ID;

CHESS.winnerBlack = this.winnerBlack;
CHESS.winnerWhite = this.winnerWhite;

CHESS.__init__dicts();
CHESS.__init__();
CHESS.init_dead_positions();
Expand Down Expand Up @@ -255,7 +257,6 @@ void Start()

void handle_message(IDictionary<string, string> MSG)
{
print(MSG["type"]);
switch (MSG["type"].ToLower()) {
case "admin_msg":
if (!started) {
Expand Down Expand Up @@ -399,8 +400,6 @@ void HandleMoveMessage(IDictionary<string, string> moveMessage)

void Update()
{
print($"Chess is {CHESS.turn}, Movements is {CHESS.movements.turn}");

if (!awaiting)
{
bool ReceiveAsync = client_socket.ReceiveAsync(e);
Expand Down
1 change: 0 additions & 1 deletion Assets/src/menu.cs
Expand Up @@ -153,7 +153,6 @@ void Start()
AddListener(IP_INPUT, 16);
AddListener(PORT_INPUT, 5);
AddListener(USERNAME_INPUT, 16);

}

string get_text_box(GameObject input, string set_string=null) {
Expand Down
6 changes: 0 additions & 6 deletions Assets/src/objectSelect.cs
Expand Up @@ -7,11 +7,6 @@

public class objectSelect : MonoBehaviour
{

void OnCollisionEnter(Collision collision) {
print($"Print collided with object of tag {collision.gameObject.tag}!");
}

public AudioSource MOVE_AUDIO;

/* Piece's Gameobject References */
Expand Down Expand Up @@ -180,7 +175,6 @@ public class objectSelect : MonoBehaviour


public void setTurn(string color) {
print($"Setting turn to {color}");
this.turn = color;
movements.turn = color;

Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/EditorBuildSettings.asset
Expand Up @@ -5,13 +5,13 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 0
- enabled: 1
path: Assets/Scenes/menu.unity
guid: 6d5a9fd8fc3e84fe19cd3f095834eb7d
- enabled: 1
path: Assets/Scenes/2 player.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
- enabled: 0
- enabled: 1
path: Assets/Scenes/multiplaer.unity
guid: e60c50c98c346d5ecb2f092743d09fbd
m_configObjects: {}
1 change: 1 addition & 0 deletions ProjectSettings/GraphicsSettings.asset
Expand Up @@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
Expand Down

0 comments on commit 51d570f

Please sign in to comment.