[Opentnl-cvs] tnl/zap ZAP.vcproj,1.15,1.16 main.cpp,1.27,1.28 masterConnection.h,1.1,1.2
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-05-12 01:38:09
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28526/zap Modified Files: ZAP.vcproj main.cpp masterConnection.h Log Message: Made Zap master connection client adaptive Added buncha stuff to journaling Fixed nasty netConnection bug (thanks, Journaling!) Index: main.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/main.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** main.cpp 11 May 2004 18:26:25 -0000 1.27 --- main.cpp 12 May 2004 01:38:00 -0000 1.28 *************** *** 57,60 **** --- 57,63 ---- const char *gMasterAddressString = "IP:master.opentnl.org:29005"; Address gMasterAddress; + Address gConnectAddress; + Address gBindAddress(IPProtocol, Address::Any, 28000); + const char *gLevelList = "level4.txt level2.txt level1.txt level2.txt level3.txt level2.txt"; *************** *** 72,75 **** --- 75,79 ---- TNL_DECLARE_JOURNAL_ENTRYPOINT(idle, (U32 timeDelta)); TNL_DECLARE_JOURNAL_ENTRYPOINT(display, ()); + TNL_DECLARE_JOURNAL_ENTRYPOINT(startup, (bool hasClient, bool hasServer, bool connectLocal, bool connectRemote, bool nameSet)); }; *************** *** 264,268 **** void logString(const char *string) { ! printf("%s\r\n", string); } } gStdoutLogConsumer; --- 268,272 ---- void logString(const char *string) { ! printf("%s\n", string); } } gStdoutLogConsumer; *************** *** 288,292 **** { if(f) ! fprintf(f, "%s\r\n", string); } } gFileLogConsumer; --- 292,299 ---- { if(f) ! { ! fprintf(f, "%s\n", string); ! fflush(f); ! } } } gFileLogConsumer; *************** *** 348,351 **** --- 355,377 ---- extern void InitController(); + TNL_IMPLEMENT_JOURNAL_ENTRYPOINT(ZapJournal, startup, (bool hasClient, bool hasServer, bool connectLocal, bool connectRemote, bool nameSet)) + { + if(hasClient) + gClientGame = new ClientGame(Address()); + + if(hasServer) + hostGame(hasClient == false, gBindAddress); + else if(connectRemote) + joinGame(gConnectAddress, false); + + if(!connectLocal && !connectRemote) + { + if(!nameSet) + gNameEntryUserInterface.activate(); + else + gMainMenuUserInterface.activate(); + } + } + }; *************** *** 354,359 **** --- 380,389 ---- int main(int argc, char **argv) { + //TNLLogEnable(LogConnectionProtocol, true); + //TNLLogEnable(LogNetConnection, true); TNLLogEnable(LogNetInterface, true); TNLLogEnable(LogPlatform, true); + //TNLLogEnable(LogBlah, true); + bool hasClient = true; bool hasServer = false; *************** *** 362,367 **** bool nameSet = false; - Address connectAddress; - Address bindAddress(IPProtocol, Address::Any, 28000); U32 maxPlayers = 128; --- 392,395 ---- *************** *** 375,379 **** connectLocal = true; if(hasAdditionalArg) ! bindAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-connect")) --- 403,407 ---- connectLocal = true; if(hasAdditionalArg) ! gBindAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-connect")) *************** *** 381,385 **** connectRemote = true; if(hasAdditionalArg) ! connectAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-master")) --- 409,413 ---- connectRemote = true; if(hasAdditionalArg) ! gConnectAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-master")) *************** *** 414,418 **** hasServer = true; if(hasAdditionalArg) ! bindAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-name")) --- 442,446 ---- hasServer = true; if(hasAdditionalArg) ! gBindAddress.set(argv[i+1]); } else if(!stricmp(argv[i], "-name")) *************** *** 441,461 **** } gMasterAddress.set(gMasterAddressString); if(hasClient) - gClientGame = new ClientGame(Address()); - - if(hasServer) - hostGame(hasClient == false, bindAddress); - else if(connectRemote) - joinGame(connectAddress, false); - - if(!connectLocal && !connectRemote) - { - if(!nameSet) - gNameEntryUserInterface.activate(); - else - gMainMenuUserInterface.activate(); - } - if(hasClient) { SFXObject::init(); --- 469,475 ---- } gMasterAddress.set(gMasterAddressString); + gZapJournal.startup(hasClient, hasServer, connectLocal, connectRemote, nameSet); if(hasClient) { SFXObject::init(); *************** *** 487,497 **** atexit(endGame); glutMainLoop(); } else - { dedicatedServerLoop(); - } return 0; ! } ! --- 501,509 ---- atexit(endGame); + glutMainLoop(); } else dedicatedServerLoop(); return 0; ! } \ No newline at end of file Index: masterConnection.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/masterConnection.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** masterConnection.h 20 Apr 2004 04:27:20 -0000 1.1 --- masterConnection.h 12 May 2004 01:38:00 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- mCurrentQueryId = 0; setIsConnectionToServer(); + setIsAdaptive(); } Index: ZAP.vcproj =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/ZAP.vcproj,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ZAP.vcproj 9 May 2004 20:35:17 -0000 1.15 --- ZAP.vcproj 12 May 2004 01:38:00 -0000 1.16 *************** *** 73,77 **** OptimizeForWindowsApplication="TRUE" AdditionalIncludeDirectories="../tnl;../glut;../openal" ! PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" RuntimeLibrary="4" RuntimeTypeInfo="TRUE" --- 73,77 ---- OptimizeForWindowsApplication="TRUE" AdditionalIncludeDirectories="../tnl;../glut;../openal" ! PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;TNL_ENABLE_LOGGING" RuntimeLibrary="4" RuntimeTypeInfo="TRUE" |