From: <Jef...@us...> - 2008-04-23 06:47:20
|
Revision: 17081 http://bzflag.svn.sourceforge.net/bzflag/?rev=17081&view=rev Author: JeffM2501 Date: 2008-04-22 23:47:27 -0700 (Tue, 22 Apr 2008) Log Message: ----------- more shot end cleanups Modified Paths: -------------- branches/v2_99_shot_branch/include/bzfsAPI.h branches/v2_99_shot_branch/src/bzflag/RemotePlayer.cxx branches/v2_99_shot_branch/src/bzflag/RobotPlayer.cxx branches/v2_99_shot_branch/src/bzflag/ShotList.cxx branches/v2_99_shot_branch/src/bzfs/GameKeeper.cxx branches/v2_99_shot_branch/src/bzfs/RecordReplay.cxx branches/v2_99_shot_branch/src/bzfs/WorldWeapons.cxx branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx branches/v2_99_shot_branch/src/bzfs/bzfsClientMessages.cxx branches/v2_99_shot_branch/src/bzfs/bzfsMessages.cxx Modified: branches/v2_99_shot_branch/include/bzfsAPI.h =================================================================== --- branches/v2_99_shot_branch/include/bzfsAPI.h 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/include/bzfsAPI.h 2008-04-23 06:47:27 UTC (rev 17081) @@ -1540,7 +1540,7 @@ BZF_API bool bz_getStandardSpawn ( int playerID, float pos[3], float *rot ); // dying -BZF_API bool bz_killPlayer ( int playerID, bool spawnOnBase, int killerID = -1, const char* flagID = NULL ); +BZF_API bool bz_killPlayer ( int playerID, bool spawnOnBase ); // flags BZF_API bool bz_givePlayerFlag ( int playerID, const char* flagType, bool force ); @@ -2042,7 +2042,7 @@ virtual void grabFlag ( int player, int flagID, const char* flagType, bz_eShotType shotType ); virtual void setShotType ( int player, bz_eShotType shotType ); virtual void shotFired ( int player, int shotID, bz_eShotType shotType ); - virtual void shotEnded( int player, int shotID, unsigned short reason ); + virtual void shotEnded( int shotID, unsigned short reason ); virtual void playerTeleported( int player, unsigned short from, unsigned short to ); virtual void playerAutopilot( int player, bool autopilot ); virtual void allowSpawn( bool canSpawn ); Modified: branches/v2_99_shot_branch/src/bzflag/RemotePlayer.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzflag/RemotePlayer.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzflag/RemotePlayer.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -16,6 +16,7 @@ /* common implementation headers */ #include "World.h" #include "SyncClock.h" +#include "playing.h" RemotePlayer::RemotePlayer(const PlayerId& _id, TeamColor _team, @@ -25,7 +26,7 @@ { if (World::getWorld()) { - for ( int i = 0; i < World::getWorld()->getMaxShots(); i++ ) + for ( size_t i = 0; i < World::getWorld()->getMaxShots(); i++ ) shotSlots.push_back(ShotSlot()); } } Modified: branches/v2_99_shot_branch/src/bzflag/RobotPlayer.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzflag/RobotPlayer.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzflag/RobotPlayer.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -25,6 +25,7 @@ #include "Intersect.h" #include "TargetingUtils.h" #include "ShotList.h" +#include "playing.h" std::vector<BzfRegion*>* RobotPlayer::obstacleList = NULL; Modified: branches/v2_99_shot_branch/src/bzflag/ShotList.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzflag/ShotList.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzflag/ShotList.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -13,7 +13,7 @@ // interface header #include "ShotList.h" #include "SyncClock.h" - +#include "playing.h" // // ShotList // @@ -161,7 +161,7 @@ return false; if(explode) - addShotExplosion(itr->second.getPosition()); + addShotExplosion(itr->second->getPosition()); delete(itr->second); shots.erase(itr); Modified: branches/v2_99_shot_branch/src/bzfs/GameKeeper.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/GameKeeper.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/GameKeeper.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -495,13 +495,6 @@ return getCurrentStateAsState().pack(buf,code,increment); } - -size_t GameKeeper::Player::totalShotSlots = 0; -void GameKeeper::Player::setMaxShots(size_t maxShots) -{ - totalShotSlots = maxShots; -} - bool GameKeeper::Player::canShoot ( void ) { if (shotSlots.size() > totalShotSlots) @@ -576,12 +569,12 @@ lifeTime *= BZDB.eval(StateDatabase::BZDB_THIEFADLIFE); // fill up the slot - shotSlots[s].expireTime = startTime + lifeTime; - shotSlots[s].present = true; - shotSlots[s].running = true; + shotSlots[freeSlot].expireTime = startTime + lifeTime; + shotSlots[freeSlot].present = true; + shotSlots[freeSlot].running = true; // track our live shots by global ID, keep the local ID around for the rare case where we die from our own shot before we get the globalID - liveShots.push_back(globalID) = localID; + liveShots[globalID)] = localID; return true; } Modified: branches/v2_99_shot_branch/src/bzfs/RecordReplay.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/RecordReplay.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/RecordReplay.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -2585,7 +2585,6 @@ STRING_CASE (MsgExit); STRING_CASE (MsgFlagUpdate); STRING_CASE (MsgGrabFlag); - STRING_CASE (MsgGMUpdate); STRING_CASE (MsgGetWorld); STRING_CASE (MsgKilled); STRING_CASE (MsgMessage); Modified: branches/v2_99_shot_branch/src/bzfs/WorldWeapons.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/WorldWeapons.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/WorldWeapons.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -57,7 +57,7 @@ firingInfo.shotType = type->flagShot; firingInfo.shot.team = teamColor; - firingInfo.shot.id = ShotManager::instance().newShot(firingInfo); + firingInfo.shot.id = ShotManager::instance().newShot(&firingInfo); NetMsg msg = MSGMGR.newMessage(); firingInfo.pack(msg); Modified: branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/bzfsAPI.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -2505,7 +2505,7 @@ //------------------------------------------------------------------------- -BZF_API bool bz_killPlayer(int playerID, bool spawnOnBase, int killerID, const char *flagType) +BZF_API bool bz_killPlayer(int playerID, bool spawnOnBase) { GameKeeper::Player *player=GameKeeper::Player::getPlayerByIndex(playerID); if(!player) @@ -2514,21 +2514,8 @@ if(!player->player.isAlive()) return false; - if(killerID==-1) - killerID = ServerPlayer; + smitePlayer(playerID, GotKilledMsg, spawnOnBase); - FlagType *flag=NULL; - if(flagType) - { - FlagTypeMap &flagMap=FlagType::getFlagMap(); - if(flagMap.find(std::string(flagType))==flagMap.end()) - return false; - - flag=flagMap.find(std::string(flagType))->second; - } - - playerKilled(playerID, killerID, GotKilledMsg, -1, flag ? flag : Flags::Null, -1, spawnOnBase); - return true; } @@ -4194,7 +4181,7 @@ void bz_ServerSidePlayerHandler::shotFired(int, int, bz_eShotType ){} -void bz_ServerSidePlayerHandler::shotEnded(int, int, unsigned short){} +void bz_ServerSidePlayerHandler::shotEnded(int, unsigned short){} void bz_ServerSidePlayerHandler::playerTeleported( int, unsigned short, unsigned short ){} Modified: branches/v2_99_shot_branch/src/bzfs/bzfsClientMessages.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/bzfsClientMessages.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/bzfsClientMessages.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -639,27 +639,8 @@ if (!player || len < 3) return false; - if (player->player.isObserver()) - return true; + // we never get these anymore, the server ends them - int shot; - uint16_t reason; - buf = nboUnpackInt(buf, shot); - buf = nboUnpackUShort(buf, reason); - - // ask the API if it wants to modify this shot - bz_ShotEndedEventData_V1 shotEvent; - shotEvent.playerID = (int)player->getIndex(); - shotEvent.shotID = shot; - shotEvent.explode = reason == 0; - worldEventManager.callEvents(bz_eShotEndedEvent,&shotEvent); - - FiringInfo firingInfo; - player->removeShot(shot); - ShotManager::instance().removeShot(shot,false); - - sendMsgShotEnd(player->getIndex(),shot,reason); - return true; } }; @@ -726,10 +707,10 @@ ShotManager::instance().removeShot(id,false); if (shooterData->removeShot(id)) { - sendMsgShotEnd( shot, 1); + sendMsgShotEnd( id, 1); FlagInfo *flagInfo = FlagInfo::get(player->player.getFlag()); - if (!flagInfo || flagInfo != Flags::Shield) + if (!flagInfo || flagInfo->flag.type != Flags::Shield) playerKilled(hitPlayer, GotShot, id, false); else zapFlagByPlayer(hitPlayer); Modified: branches/v2_99_shot_branch/src/bzfs/bzfsMessages.cxx =================================================================== --- branches/v2_99_shot_branch/src/bzfs/bzfsMessages.cxx 2008-04-23 06:23:21 UTC (rev 17080) +++ branches/v2_99_shot_branch/src/bzfs/bzfsMessages.cxx 2008-04-23 06:47:27 UTC (rev 17081) @@ -589,7 +589,7 @@ for (int i = 0; i < curMaxPlayers; i++) { GameKeeper::Player* otherData = GameKeeper::Player::getPlayerByIndex(i); if (otherData && otherData->playerHandler) - otherData->playerHandler->shotEnded(player,id,reason); + otherData->playerHandler->shotEnded(id,reason); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |