From: <sv...@ww...> - 2004-12-02 18:18:19
|
Author: delta Date: 2004-12-02 10:18:12 -0800 (Thu, 02 Dec 2004) New Revision: 1336 Modified: trunk/CSP/SimNet/MessageQueue.h trunk/CSP/SimNet/NetBase.h trunk/CSP/SimNet/NetworkInterface.cpp trunk/CSP/SimNet/PeerInfo.cpp trunk/CSP/SimNet/RecordCodec.cpp trunk/CSP/SimNet/RoutingHandler.cpp trunk/CSP/SimNet/VisualStudio2003/SimNet.vcproj Log: * Cleaned up the custom build step and other setup. * Got ride of a few cast warnings. * Removed redondant (for vc++) declaration of a few const statics in source files. * Changed the syntax of a few tautological loops. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1336 Modified: trunk/CSP/SimNet/MessageQueue.h =================================================================== --- trunk/CSP/SimNet/MessageQueue.h 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/MessageQueue.h 2004-12-02 18:18:12 UTC (rev 1336) @@ -115,7 +115,7 @@ m_Queue.pop_front(); SIMNET_LOG(MESSAGE, ALERT, "SENDING MESSAGE " << message->getCustomId() << " " << message->getName()); header->destination = destination; - header->message_id = message->getCustomId(); + header->message_id = static_cast<simdata::uint16>(message->getCustomId()); header->routing_type = message->getRoutingType(); header->routing_data = message->getRoutingData(); Modified: trunk/CSP/SimNet/NetBase.h =================================================================== --- trunk/CSP/SimNet/NetBase.h 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/NetBase.h 2004-12-02 18:18:12 UTC (rev 1336) @@ -99,13 +99,13 @@ if (reliable) flags |= 1; else flags &= ~1; } inline void setPriority(int priority) { - flags = (flags & ~0x06) | ((priority & 3) << 1); + flags = static_cast<simdata::uint16>((flags & ~0x06) | ((priority & 3) << 1)); } inline void setStatMode(int statmode) { - flags = (flags & ~0x20) | ((statmode & 1) << 5); + flags = static_cast<simdata::uint16>((flags & ~0x20) | ((statmode & 1) << 5)); } inline void setConnStat(int connstat) { - flags = (flags & 0x3f) | (connstat << 6); + flags = static_cast<simdata::uint16>((flags & 0x3f) | (connstat << 6)); } }; Modified: trunk/CSP/SimNet/NetworkInterface.cpp =================================================================== --- trunk/CSP/SimNet/NetworkInterface.cpp 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/NetworkInterface.cpp 2004-12-02 18:18:12 UTC (rev 1336) @@ -76,13 +76,7 @@ const simdata::uint32 NetworkInterface::HeaderSize = sizeof(PacketHeader); const simdata::uint32 NetworkInterface::ReceiptHeaderSize = sizeof(PacketReceiptHeader); -const simdata::uint16 NetworkInterface::PingID; -const simdata::uint32 NetworkInterface::PeerIndexSize; -const simdata::uint32 NetworkInterface::MaxPayloadLength; -const PeerId NetworkInterface::InitialClientId; -const PeerId NetworkInterface::ServerId; - /** Callback for HandlerSet<PacketHandler>::apply, to call the handlePacket * method of each of the handlers in the set. */ @@ -125,7 +119,7 @@ StopWatch watch(timeout, swd); watch.start(); - while (true) { + for (;;) { // TODO abstract the scheduling strategy if (queue->isEmpty() || count <= 0) { @@ -401,7 +395,7 @@ StopWatch watch(timeout, swd); watch.start(); - while (true) { + for(;;) { if (!m_Socket->isPendingReceive(0)) { watch.calibrate(); @@ -571,7 +565,7 @@ int DEBUG_exitcode = 0; - while (true) { + for (;;) { // TODO abstract the scheduling strategy if (queue->isEmpty() || count <= 0) { @@ -782,7 +776,7 @@ // use LastAssignedPeerId to rotate through assignments, rather than always // reassigning low ids. greatly increases the average time to recycle an id. assert(m_LastAssignedPeerId > 1); - for (PeerId id = m_LastAssignedPeerId + 1; true; ++id) { + for (PeerId id = m_LastAssignedPeerId + 1; ; ++id) { if (id == PeerIndexSize) id = 2; if (!m_PeerIndex[id].isActive()) { if (m_PeerIndex[id].getLastDeactivationTime() < cutoff) { Modified: trunk/CSP/SimNet/PeerInfo.cpp =================================================================== --- trunk/CSP/SimNet/PeerInfo.cpp 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/PeerInfo.cpp 2004-12-02 18:18:12 UTC (rev 1336) @@ -39,10 +39,6 @@ return x * (1.0 - f) + y * f; } - -const simdata::uint32 PeerInfo::UDP_OVERHEAD; - - static int DEBUG_connection_display_loop = 0; PeerInfo::PeerInfo(): @@ -275,7 +271,7 @@ peer->update(m_ElapsedTime, scale_desired_peer_to_self); desired_rate_to_self += peer->getDesiredRatePeerToSelf(); if (peer->needsPing()) ni->pingPeer(peer); - while (true) { + for(;;) { ReliablePacket::Ref packet = peer->getNextResend(now); if (!packet) break; ni->resend(packet); Modified: trunk/CSP/SimNet/RecordCodec.cpp =================================================================== --- trunk/CSP/SimNet/RecordCodec.cpp 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/RecordCodec.cpp 2004-12-02 18:18:12 UTC (rev 1336) @@ -102,8 +102,5 @@ return true; } -const int RecordCodec::MAX_MESSAGE_IDS; - - } // namespace simnet Modified: trunk/CSP/SimNet/RoutingHandler.cpp =================================================================== --- trunk/CSP/SimNet/RoutingHandler.cpp 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/RoutingHandler.cpp 2004-12-02 18:18:12 UTC (rev 1336) @@ -31,9 +31,6 @@ namespace simnet { - -const unsigned RoutingHandler::RoutingTableSize; - RoutingHandler::RoutingHandler() { } Modified: trunk/CSP/SimNet/VisualStudio2003/SimNet.vcproj =================================================================== --- trunk/CSP/SimNet/VisualStudio2003/SimNet.vcproj 2004-12-02 18:02:11 UTC (rev 1335) +++ trunk/CSP/SimNet/VisualStudio2003/SimNet.vcproj 2004-12-02 18:18:12 UTC (rev 1336) @@ -25,7 +25,7 @@ RuntimeTypeInfo="TRUE" WarningLevel="4" DebugInformationFormat="3" - DisableSpecificWarnings="4275;4100;4512;4511"/> + DisableSpecificWarnings="4511;4512;4100"/> <Tool Name="VCCustomBuildTool"/> <Tool @@ -67,8 +67,7 @@ PreprocessorDefinitions="WIN32" RuntimeLibrary="2" RuntimeTypeInfo="TRUE" - WarningLevel="3" - DisableSpecificWarnings="4275"/> + WarningLevel="3"/> <Tool Name="VCCustomBuildTool"/> <Tool @@ -146,6 +145,9 @@ RelativePath="..\ClientServer.h"> </File> <File + RelativePath="..\ClientServerMessages.h"> + </File> + <File RelativePath="..\DispatchCache.h"> </File> <File @@ -231,7 +233,7 @@ Name="VCCustomBuildTool" CommandLine="..\..\SimData\Tools\TaggedRecordCompiler\trc.py --header=..\$(InputName).h --source=..\$(InputName).cpp ..\$(InputName).net " - Outputs="$(InputName).h $(InputName).cpp"/> + Outputs="../$(InputName).h;../$(InputName).cpp"/> </FileConfiguration> <FileConfiguration Name="Release|Win32"> |