|
From: <al...@us...> - 2013-06-24 18:45:12
|
Revision: 22821
http://sourceforge.net/p/bzflag/code/22821
Author: allejo
Date: 2013-06-24 18:45:07 +0000 (Mon, 24 Jun 2013)
Log Message:
-----------
Applied patch #572 and added allejo to authors file
Modified Paths:
--------------
trunk/bzflag/AUTHORS
trunk/bzflag/include/bzfsAPI.h
trunk/bzflag/src/bzfs/bzfs.cxx
trunk/bzflag/src/bzfs/bzfs.h
trunk/bzflag/src/bzfs/bzfsAPI.cxx
Modified: trunk/bzflag/AUTHORS
===================================================================
--- trunk/bzflag/AUTHORS 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/AUTHORS 2013-06-24 18:45:07 UTC (rev 22821)
@@ -225,6 +225,8 @@
Ryan Kavanagh (ryanakca)
Konstantinos Kanavouras (alezakos)
Lee Marshall (bizarrefish)
+-- 2013 --
+Vladimir Jimenez (allejo)
GOOGLE SUMMER OF CODE
---------------------
Modified: trunk/bzflag/include/bzfsAPI.h
===================================================================
--- trunk/bzflag/include/bzfsAPI.h 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/include/bzfsAPI.h 2013-06-24 18:45:07 UTC (rev 22821)
@@ -1064,7 +1064,7 @@
class BZF_API bz_GetPlayerMottoData_V2 : public bz_GetPlayerMottoData_V1
{
public:
- bz_GetPlayerMottoData_V2(const char* m)
+ bz_GetPlayerMottoData_V2(const char* m)
: bz_GetPlayerMottoData_V1(m)
{
}
@@ -1624,7 +1624,7 @@
virtual void URLDone ( const char* URL, const void * data, unsigned int size, bool complete ) = 0;
virtual void URLTimeout ( const char* /*URL*/, int /*errorCode*/ ){};
virtual void URLError ( const char* /*URL*/, int /*errorCode*/, const char * /*errorString*/ ){};
-
+
int version;
};
@@ -1684,6 +1684,8 @@
BZF_API void bz_startCountdown ( int delay, float limit, const char *byWho );
// server control
+BZF_API bool bz_getShotMismatch();
+BZF_API void bz_setShotMismatch(bool value);
BZF_API void bz_shutdown();
BZF_API void bz_superkill();
BZF_API void bz_gameOver(int playerID, bz_eTeamType team = eNoTeam);
Modified: trunk/bzflag/src/bzfs/bzfs.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfs.cxx 2013-06-24 18:45:07 UTC (rev 22821)
@@ -140,6 +140,7 @@
char worldSettings[4 + WorldSettingsSize];
float pluginWorldSize = -1;
float pluginWorldHeight = -1;
+bool checkShotMismatch = true;
Filter filter;
BasesList bases;
@@ -566,12 +567,12 @@
void sendPlayerScores(GameKeeper::Player ** players, int nPlayers) {
void *buf, *bufStart;
bufStart = getDirectMessageBuffer();
-
+
buf = nboPackUByte(bufStart, nPlayers);
-
+
for(int i = 0; i < nPlayers; i++) {
GameKeeper::Player *player = players[i];
-
+
buf = nboPackUByte(buf, player->getIndex());
buf = player->score.pack(buf);
}
@@ -685,21 +686,21 @@
// Players to notify of new scores
GameKeeper::Player **playersToUpdate = new GameKeeper::Player*[curMaxPlayers];
int nPlayersToUpdate = 0;
-
+
for (int i = 0; i < curMaxPlayers; i++) {
GameKeeper::Player *player;
-
+
player = GameKeeper::Player::getPlayerByIndex(i);
-
+
if(player) {
player->score.reset();
playersToUpdate[nPlayersToUpdate++] = player;
}
}
-
+
// Tell the players the new scores
sendPlayerScores(playersToUpdate, nPlayersToUpdate);
-
+
delete[] playersToUpdate;
}
@@ -1477,9 +1478,9 @@
}
msg = filtered;
-
+
}
-
+
// if the message is empty, stop.
if (strlen(msg) == 0)
{
@@ -2261,7 +2262,7 @@
{
// NOTE -- must not be called until world is defined
assert(world != NULL);
-
+
// first drop the flag if someone has it
if (flag.flag.status == FlagOnTank) {
int player = flag.player;
@@ -2367,7 +2368,7 @@
int player = flag.player;
sendDrop(flag);
-
+
// trigger the API event
bz_FlagDroppedEventData_V1 data;
data.playerID = player;
@@ -2508,7 +2509,7 @@
void flushKilledByCounts( int removeID )
{
- for (int i = 0; i < curMaxPlayers; i++)
+ for (int i = 0; i < curMaxPlayers; i++)
{
GameKeeper::Player *player = GameKeeper::Player::getPlayerByIndex(i);
if (player)
@@ -3037,7 +3038,7 @@
killerData->score.kill();
}
}
-
+
// send killer & victim
GameKeeper::Player *kAndV[] = {killerData, victimData};
sendPlayerScores(kAndV, 2);
@@ -3045,7 +3046,7 @@
// send victim
sendPlayerScores(&victimData, 1);
}
-
+
if (handicapAllowed()) {
bufStart = getDirectMessageBuffer();
if (killer) {
@@ -3214,7 +3215,7 @@
playerData->player.haveFlag() ||
(checkPos && flag.flag.status != FlagOnGround))
return;
-
+
const float* fpos = flag.flag.position;
if (checkPos) {
//last Pos might be lagged by TankSpeed so include in calculation
@@ -3224,7 +3225,7 @@
const float* tpos = playerData->lastState.pos;
const float delta = (tpos[0] - fpos[0]) * (tpos[0] - fpos[0]) +
(tpos[1] - fpos[1]) * (tpos[1] - fpos[1]);
-
+
if ((fabs(tpos[2] - fpos[2]) < 0.1f) && (delta > radius2)) {
logDebugMessage(2,"Player %s [%d] %f %f %f tried to grab distant flag %f %f %f: distance=%f\n",
playerData->player.getCallSign(), playerIndex,
@@ -3373,14 +3374,14 @@
// notify of new flag state
sendFlagUpdate(drpFlag);
-
+
// trigger the api event
bz_FlagDroppedEventData_V1 data;
data.playerID = player;
data.flagID = flagIndex;
data.flagType = drpFlag.flag.type->flagAbbv.c_str();
memcpy(data.pos, pos, sizeof(float)*3);
-
+
worldEventManager.callEvents(bz_eFlagDroppedEvent,&data);
}
@@ -3617,7 +3618,7 @@
}
// probably a cheater using wrong shots.. exception for thief since they steal someone elses
- if (firingInfo.flagType != Flags::Thief) {
+ if (firingInfo.flagType != Flags::Thief && checkShotMismatch) {
// bye bye supposed cheater
logDebugMessage(1,"Kicking Player %s [%d] Player using wrong shots\n", shooter.getCallSign(), playerIndex);
sendMessage(ServerPlayer, playerIndex, "Autokick: Your shots do not to match the expected shot type.");
@@ -3714,11 +3715,11 @@
shotEvent.pos[0] = shot.pos[0];
shotEvent.pos[1] = shot.pos[1];
shotEvent.pos[2] = shot.pos[2];
-
+
shotEvent.vel[0] = shot.vel[0];
shotEvent.vel[1] = shot.vel[1];
shotEvent.vel[2] = shot.vel[2];
-
+
shotEvent.playerID = shooter.getPlayerIndex();
shotEvent.type = firingInfo.flagType->flagAbbv;
@@ -4421,7 +4422,7 @@
buf = nboUnpackShort(buf, shot);
buf = nboUnpackUShort(buf, reason);
shotEnded(sourcePlayer, shot, reason);
-
+
break;
}
@@ -5295,8 +5296,8 @@
{
peer.netHandler->bufferedSend(NULL, 0);
return;
- }
-
+ }
+
if (peer.sendChunks.empty())
{
if (peer.deleteWhenDoneSending && peer.sent && !peer.netHandler->hasTcpOutbound())
@@ -6410,7 +6411,7 @@
// quietly reset team scores in case of a capture during the countdown
resetTeamScores();
-
+
// reset player scores
resetPlayerScores();
@@ -6709,7 +6710,7 @@
sendMessage(ServerPlayer, v, "You have been killed due to sufficient votes");
playerKilled(v, curMaxPlayers, 0, -1, Flags::Null, -1);
}
- }
+ }
else if (action == "set")
{
Modified: trunk/bzflag/src/bzfs/bzfs.h
===================================================================
--- trunk/bzflag/src/bzfs/bzfs.h 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfs.h 2013-06-24 18:45:07 UTC (rev 22821)
@@ -157,7 +157,7 @@
extern uint16_t maxRealPlayers;
extern float pluginWorldSize;
extern float pluginWorldHeight;
-
+extern bool checkShotMismatch;
extern bool publiclyDisconnected;
extern Shots::Manager ShotManager;
Modified: trunk/bzflag/src/bzfs/bzfsAPI.cxx
===================================================================
--- trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-06-24 03:29:46 UTC (rev 22820)
+++ trunk/bzflag/src/bzfs/bzfsAPI.cxx 2013-06-24 18:45:07 UTC (rev 22821)
@@ -2760,7 +2760,7 @@
return false;
// if (playerID == BZ_SERVER || !soundName)
// return false;
-//
+//
// void *buf, *bufStart = getDirectMessageBuffer();
// buf = nboPackUShort(bufStart, LocalCustomSound);
// buf = nboPackUShort(buf, (unsigned short)strlen(soundName));
@@ -2769,7 +2769,7 @@
// broadcastMessage(MsgCustomSound, (char*)buf - (char*)bufStart, bufStart);
// else
// directMessage(playerID,MsgCustomSound, (char*)buf - (char*)bufStart, bufStart);
-//
+//
// return true;
}
@@ -3456,6 +3456,16 @@
// server control
+BZF_API bool bz_getShotMismatch( void )
+{
+ return checkShotMismatch;
+}
+
+BZF_API void bz_setShotMismatch ( bool value )
+{
+ checkShotMismatch = value;
+}
+
BZF_API void bz_shutdown ( void )
{
shutdownCommand(NULL,NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|