/// <summary> /// Transmit all alterations to current SubWorld for systems at given priority. /// </summary> /// <param name="priority">Required priority of systems for to have its messages gathered.</param> public override void TransmitAtlerations(int priority) { if (!CurrentWorld.DummyWorld) // If the current SubWorld isn't an inactive dummy world... { // Start Message Queue to hold produced Massages. MessageQueue queue = new MessageQueue(); // Gather all alterations from current SubWorld and send them to Client. queue.Add(CurrentWorld.GatherAlterations(priority)); SendQueue(CurrentWorld.Client, queue); // Create another Message Queue. queue = new MessageQueue(); // Get previous transmitted alterations from opponent SubWorld. SubWorld opponent = CurrentWorld.Opponent; List <Message> messages = opponent.GetPreviousAlterations(); // Set each message to be relating to the opponent. messages.ForEach((m) => { m.Player = 0; }); if (messages.Count > 0) // If there are more than one messages... { // ... Add them to the queue and send. queue.Add(messages); SendQueue(CurrentWorld.Client, queue); } } else // ... Otherwise... { // Gather current SubWorld alterations. CurrentWorld.GatherAlterations(priority); } }