Thread: [Opentnl-cvs] tnl/zap Makefile,1.15,1.16 controlObjectConnection.cpp,1.11,1.12 controlObjectConnecti
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2004-08-23 19:32:56
|
Update of /cvsroot/opentnl/tnl/zap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8486/zap Modified Files: Makefile controlObjectConnection.cpp controlObjectConnection.h game.cpp Log Message: Updated linux makefile Added time creditor for player moves, so that cheating by clock manipulation won't work Index: controlObjectConnection.h =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/controlObjectConnection.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** controlObjectConnection.h 2 Jun 2004 21:01:58 -0000 1.5 --- controlObjectConnection.h 23 Aug 2004 19:32:44 -0000 1.6 *************** *** 47,50 **** --- 47,51 ---- enum { MaxPendingMoves = 63, + MaxMoveTimeCredit = 512, }; Vector<Move> pendingMoves; *************** *** 57,60 **** --- 58,62 ---- U32 firstMoveIndex; U32 highSendIndex[3]; + U32 mMoveTimeCredit; public: *************** *** 84,87 **** --- 86,95 ---- void packetReceived(PacketNotify *notify); void processMoveServer(Move *theMove); + void addToTimeCredit(U32 timeAmount) + { + mMoveTimeCredit += timeAmount; + if(mMoveTimeCredit > MaxMoveTimeCredit) + mMoveTimeCredit = MaxMoveTimeCredit; + } bool isDataToTransmit() { return true; } Index: Makefile =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/Makefile,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Makefile 1 Jul 2004 23:30:39 -0000 1.15 --- Makefile 23 Aug 2004 19:32:44 -0000 1.16 *************** *** 8,63 **** OBJECTS_ZAP=\ ! CTFGame.o\ ! game.o\ ! gameConnection.o\ ! controlObjectConnection.o\ ! engineeredObjects.o\ ! LoadoutZone.o\ ! footballGame.o\ ! flagItem.o\ ! gameItems.o\ ! gameLoader.o\ ! gameNetInterface.o\ ! gameObject.o\ ! gameObjectRender.o\ ! gameType.o\ ! gameWeapons.o\ ! goalZone.o\ ! gridDB.o\ ! huntersGame.o\ ! item.o\ ! loadoutSelect.o\ ! masterConnection.o\ ../master/masterInterface.o\ - moveObject.o\ - UI.o\ - UIEditor.o\ - UIInstructions.o\ - UIGame.o\ - UIMenus.o\ - UINameEntry.o\ - UIQueryServers.o\ - UICredits.o\ - projectile.o\ - quickChat.o\ - rabbitGame.o\ - retrieveGame.o\ - ship.o\ - sfx.o\ - soccerGame.o\ - SweptEllipsoid.o\ - sparkManager.o\ - teleporter.o\ - barrier.o\ - voiceCodec.o\ - lpc10dec.o\ - lpc10enc.o\ - gsm_decode.o\ - gsm_encode.o\ - gsm_state.o\ - input.o\ - linuxInput.o\ - main.o - CFLAGS= --- 8,57 ---- OBJECTS_ZAP=\ ! CTFGame.o\ ! LoadoutZone.o\ ! SweptEllipsoid.o\ ! UI.o\ ! UICredits.o\ ! UIEditor.o\ ! UIGame.o\ ! UIInstructions.o\ ! UIMenus.o\ ! UINameEntry.o\ ! UIQueryServers.o\ ! barrier.o\ ! controlObjectConnection.o\ ! engineeredObjects.o\ ! flagItem.o\ ! footballGame.o\ ! game.o\ ! gameConnection.o\ ! gameItems.o\ ! gameLoader.o\ ! gameNetInterface.o\ ! gameObject.o\ ! gameObjectRender.o\ ! gameType.o\ ! gameWeapons.o\ ! goalZone.o\ ! gridDB.o\ ! huntersGame.o\ ! input.o\ ! item.o\ ! linuxInput.o\ ! loadoutSelect.o\ ! main.o\ ! masterConnection.o\ ! moveObject.o\ ! projectile.o\ ! quickChat.o\ ! rabbitGame.o\ ! retrieveGame.o\ ! sfx.o\ ! ship.o\ ! soccerGame.o\ ! sparkManager.o\ ! teleporter.o\ ! voiceCodec.o\ ../master/masterInterface.o\ CFLAGS= Index: controlObjectConnection.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/controlObjectConnection.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** controlObjectConnection.cpp 9 Jun 2004 01:10:47 -0000 1.11 --- controlObjectConnection.cpp 23 Aug 2004 19:32:44 -0000 1.12 *************** *** 39,42 **** --- 39,43 ---- mLastClientControlCRC = 0; firstMoveIndex = 1; + mMoveTimeCredit = 0; } *************** *** 159,164 **** // process the move, including crediting time to the client // and all that joy. ! if(controlObject.isValid() && !(controlObject->getObjectTypeMask() & DeletedType)) { controlObject->setCurrentMove(theMove); controlObject->idle(GameObject::ServerIdleControlFromClient); --- 160,168 ---- // process the move, including crediting time to the client // and all that joy. ! // The time crediting prevents clients from hacking speed cheats ! // that feed more moves to the server than are allowed. ! if(mMoveTimeCredit >= theMove.time && controlObject.isValid() && !(controlObject->getObjectTypeMask() & DeletedType)) { + mMoveTimeCredit -= theMove.time; controlObject->setCurrentMove(theMove); controlObject->idle(GameObject::ServerIdleControlFromClient); Index: game.cpp =================================================================== RCS file: /cvsroot/opentnl/tnl/zap/game.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** game.cpp 6 Aug 2004 00:02:47 -0000 1.48 --- game.cpp 23 Aug 2004 19:32:44 -0000 1.49 *************** *** 339,342 **** --- 339,345 ---- mNetInterface->checkIncomingPackets(); Game::checkConnectionToMaster(timeDelta); + for(GameConnection *walk = GameConnection::getClientList(); walk ; walk = walk->getNextClient()) + walk->addToTimeCredit(timeDelta); + for(S32 i = 0; i < mGameObjects.size(); i++) { |