Fix syncing when hashes are not required

This commit is contained in:
Sofia 2017-05-12 01:24:34 +03:00
parent 59fb38ff1b
commit 7b7e1552ea
2 changed files with 5 additions and 9 deletions

View File

@ -133,8 +133,6 @@ namespace Cyber.Networking.Serverside {
Spawner = GetComponent<Spawner>(); Spawner = GetComponent<Spawner>();
Spawner.SyncDB.SetStaticObjectsIDs();
ConnectionConfig Config = new ConnectionConfig(); ConnectionConfig Config = new ConnectionConfig();
NetworkChannelID.ReliableSequenced = Config.AddChannel(QosType.ReliableSequenced); NetworkChannelID.ReliableSequenced = Config.AddChannel(QosType.ReliableSequenced);
NetworkChannelID.UnreliableSequenced = Config.AddChannel(QosType.UnreliableSequenced); NetworkChannelID.UnreliableSequenced = Config.AddChannel(QosType.UnreliableSequenced);
@ -143,6 +141,8 @@ namespace Cyber.Networking.Serverside {
NetworkServer.Listen(port); NetworkServer.Listen(port);
Spawner.SyncDB.SetStaticObjectsIDs();
NetworkServer.RegisterHandler(PktType.TextMessage, HandlePacket); NetworkServer.RegisterHandler(PktType.TextMessage, HandlePacket);
NetworkServer.RegisterHandler(PktType.MoveCreature, HandlePacket); NetworkServer.RegisterHandler(PktType.MoveCreature, HandlePacket);
NetworkServer.RegisterHandler(PktType.Interact, HandlePacket); NetworkServer.RegisterHandler(PktType.Interact, HandlePacket);

View File

@ -1,4 +1,5 @@
 
using Cyber.Console;
using Cyber.Entities; using Cyber.Entities;
using Cyber.Entities.SyncBases; using Cyber.Entities.SyncBases;
using Cyber.Networking.Messages; using Cyber.Networking.Messages;
@ -55,7 +56,8 @@ namespace Cyber.Networking.Serverside {
SyncHandletype Handletype = Database.GetSyncHandletypes()[type]; SyncHandletype Handletype = Database.GetSyncHandletypes()[type];
if (TickCounter % Handletype.TickInterval == 0) { if (TickCounter % Handletype.TickInterval == 0) {
foreach (int SyncBaseID in Categorized[type]) { foreach (int SyncBaseID in Categorized[type]) {
if (DirtySyncBases.Contains(SyncBaseID)) { bool Contains = DirtySyncBases.Contains(SyncBaseID);
if (Contains == Handletype.RequireHash || Contains) {
QueueSyncBase(SyncBaseID); QueueSyncBase(SyncBaseID);
} }
} }
@ -71,12 +73,6 @@ namespace Cyber.Networking.Serverside {
DirtySyncBases.Clear(); DirtySyncBases.Clear();
} }
if (Categorized.ContainsKey(typeof(Character))) {
foreach (int i in Categorized[typeof(Character)]) {
DirtSyncBase(i);
}
}
if (TickCounter < int.MaxValue) { if (TickCounter < int.MaxValue) {
TickCounter++; TickCounter++;