Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'bugfixes'

  • Loading branch information...
commit 1fb55c6fdadb2aad713b348ecab8e4c6e57cc21a 2 parents 6688d82 + 282efa8
automerge authored cybersphinx committed
View
27 data/base/components/weapons/scavmra.pie
@@ -0,0 +1,27 @@
+PIE 3
+TYPE 200
+TEXTURE 0 page-7-barbarians-arizona.png 256 256
+LEVELS 1
+LEVEL 1
+POINTS 8
+ 11 11.3794 -14.1687
+ 11 5.37938 10.8313
+ -10 5.37938 10.8313
+ -10 11.3794 -14.1687
+ -10 16.3794 13.8313
+ 11 16.3794 13.8313
+ 11 23.3794 -11.1687
+ -10 23.3794 -11.1687
+POLYGONS 12
+ 200 3 0 1 2 0 0.445312 0 0.492188 0.082031 0.492188
+ 200 3 0 2 3 0 0.445312 0.082031 0.492188 0.082031 0.445312
+ 200 3 4 5 6 0 0.507812 0.082031 0.507812 0.082031 0.410156
+ 200 3 4 6 7 0 0.507812 0.082031 0.410156 0 0.410156
+ 200 3 7 6 0 0.867188 0.695312 0.945312 0.695312 0.945312 0.742188
+ 200 3 7 0 3 0.867188 0.695312 0.945312 0.742188 0.867188 0.742188
+ 200 3 6 5 1 0 0.515625 0.078125 0.515625 0.078125 0.558594
+ 200 3 6 1 0 0 0.515625 0.078125 0.558594 0 0.558594
+ 200 3 5 4 2 0.863281 0.746094 0.949219 0.746094 0.949219 0.773438
+ 200 3 5 2 1 0.863281 0.746094 0.949219 0.773438 0.863281 0.773438
+ 200 3 4 7 3 0.074219 0.496094 0 0.496094 0 0.554688
+ 200 3 4 3 2 0.074219 0.496094 0 0.554688 0.074219 0.554688
View
2  data/base/stats/weapons.txt
@@ -84,7 +84,7 @@ Bomb3-VTOL-LtINC,Level Two-Three,175,700,500,1,10,10,0,trlvtlin.PIE,FXLRocPd.PIE
Bomb2-VTOL-HvHE,Level Two-Three,200,800,10000,1,10,50,0,trmvtlhe.PIE,FXLRocPd.PIE,Fxmbmbx2.PIE,FXLExp.PIE,FXLExp.PIE,FXMSplsh.PIE,0,384,512,80,70,1,1,2,2,500,156,99,400,0,0,0,10,10,475,20,YES,KINETIC,BOMB,ERRATIC-DIRECT,ARTILLERY ROUND,180,0,-80,YES,NO,10,0,YES,200,0,1,1,0
Bomb1-VTOL-LtHE,Level Two-Three,150,600,500,1,10,10,0,trlvtlhe.PIE,FXLRocPd.PIE,Fxlbmbx1.PIE,FXLExp.PIE,FXLExp.PIE,FXMSplsh.PIE,0,384,512,80,70,1,2,3,100,100,192,99,60,0,0,0,10,10,475,20,YES,KINETIC,BOMB,DIRECT,ARTILLERY ROUND,180,0,-80,YES,NO,10,0,YES,100,0,1,1,0
BJeepMG,Level One,4,16,1,1,1,1,0,0,FXLMgun.PIE,FXTracRD.PIE,FXMETHIT.PIE,FXDIRTsp.PIE,FXSSplsh.PIE,0,640,960,60,50,5,1,0,0,14,0,0,0,0,0,0,10,0,1000,20,YES,KINETIC,MACHINE GUN,DIRECT,ANTI PERSONNEL,180,90,-30,YES,NO,20,0,NO,100,0,0,0,0
-BabaRocket,Level One,10,10,100,1,10,10,GNLRCKT.PIE,TRLRCKT.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXGRDexl.PIE,FXGRDexl.PIE,FXSSplsh.PIE,0,640,960,30,20,1,2,6,100,20,64,80,20,0,0,0,0,10,1200,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,0,90,-30,YES,NO,0,128,YES,50,0,0,0,0
+BabaRocket,Level One,10,10,100,1,10,10,scavmra.pie,TRLRCKT.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXGRDexl.PIE,FXGRDexl.PIE,FXSSplsh.PIE,0,640,960,30,20,1,2,6,100,20,64,80,20,0,0,0,0,10,1200,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,0,90,-30,YES,NO,0,128,YES,50,0,0,0,0
BabaPitRocketAT,Level One,100,500,500,1,10,20,GNLMSL.PIE,TRLRCKT.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXSExp.PIE,FXSExp.PIE,FXSSplsh.PIE,0,640,960,50,30,3,2,2,120,50,0,0,0,0,0,0,0,10,1200,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,180,90,-30,YES,NO,0,128,YES,100,0,0,0,0
BabaPitRocket,Level One,75,375,250,1,10,10,GNLRCKTP.PIE,TRLRCKTP.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXMPExp.PIE,FXMPExp.PIE,FXSSplsh.PIE,0,640,960,60,30,6,2,0,0,16,0,0,0,0,0,0,10,10,1200,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,180,90,-30,YES,NO,10,128,YES,25,0,0,0,0
BaBaMG,Level One-Two,1,1,1,1,1,1,0,0,FXLMgun.PIE,FXTracer.PIE,FXMETHIT.PIE,FXDIRTsp.PIE,FXSSplsh.PIE,0,640,960,50,40,4,1,0,0,10,0,0,0,0,0,0,10,0,1000,20,YES,KINETIC,MACHINE GUN,DIRECT,ANTI PERSONNEL,0,90,-30,YES,NO,20,0,NO,100,0,0,0,0
View
1  data/base/wrf/piestats.wrf
@@ -284,6 +284,7 @@ file IMD "gnmair2.pie"
file IMD "gnmair3.pie"
file IMD "trmair2.pie"
file IMD "trmair3.pie"
+file IMD "scavmra.pie"
directory "components/bodies"
file IMD "drhbod09.pie"
file IMD "drhbod10.pie"
View
27 data/mp/components/weapons/scavmra.pie
@@ -0,0 +1,27 @@
+PIE 3
+TYPE 200
+TEXTURE 0 page-7-barbarians-arizona.png 256 256
+LEVELS 1
+LEVEL 1
+POINTS 8
+ 11 11.3794 -14.1687
+ 11 5.37938 10.8313
+ -10 5.37938 10.8313
+ -10 11.3794 -14.1687
+ -10 16.3794 13.8313
+ 11 16.3794 13.8313
+ 11 23.3794 -11.1687
+ -10 23.3794 -11.1687
+POLYGONS 12
+ 200 3 0 1 2 0 0.445312 0 0.492188 0.082031 0.492188
+ 200 3 0 2 3 0 0.445312 0.082031 0.492188 0.082031 0.445312
+ 200 3 4 5 6 0 0.507812 0.082031 0.507812 0.082031 0.410156
+ 200 3 4 6 7 0 0.507812 0.082031 0.410156 0 0.410156
+ 200 3 7 6 0 0.867188 0.695312 0.945312 0.695312 0.945312 0.742188
+ 200 3 7 0 3 0.867188 0.695312 0.945312 0.742188 0.867188 0.742188
+ 200 3 6 5 1 0 0.515625 0.078125 0.515625 0.078125 0.558594
+ 200 3 6 1 0 0 0.515625 0.078125 0.558594 0 0.558594
+ 200 3 5 4 2 0.863281 0.746094 0.949219 0.746094 0.949219 0.773438
+ 200 3 5 2 1 0.863281 0.746094 0.949219 0.773438 0.863281 0.773438
+ 200 3 4 7 3 0.074219 0.496094 0 0.496094 0 0.554688
+ 200 3 4 3 2 0.074219 0.496094 0 0.554688 0.074219 0.554688
View
2  data/mp/stats/weapons.txt
@@ -115,7 +115,7 @@ Bomb3-VTOL-LtINC,Level Two-Three,175,700,2400,1,10,320,0,trlvtlin.PIE,FXLRocPd.P
Bomb2-VTOL-HvHE,Level Two-Three,200,800,3800,1,10,480,0,trmvtlhe.PIE,FXLRocPd.PIE,Fxmbmbx2.PIE,FXLExp.PIE,FXLExp.PIE,FXMSplsh.PIE,0,384,384,80,80,10,10,3,100,500,256,100,300,0,0,0,10,10,475,20,YES,KINETIC,BOMB,ERRATIC-DIRECT,ARTILLERY ROUND,180,0,-80,YES,NO,10,0,YES,200,0,1,1,0
Bomb1-VTOL-LtHE,Level Two-Three,150,600,2400,1,10,420,0,trlvtlhe.PIE,FXLRocPd.PIE,Fxlbmbx1.PIE,FXLExp.PIE,FXLExp.PIE,FXMSplsh.PIE,0,384,384,80,80,10,10,3,100,120,192,100,72,0,0,0,10,10,475,20,YES,KINETIC,BOMB,ERRATIC-DIRECT,ARTILLERY ROUND,180,0,-80,YES,NO,10,0,YES,100,0,1,1,0
BJeepMG,Level One,4,16,1,1,1,1,0,0,FXLMgun.PIE,FXTracRD.PIE,FXMETHIT.PIE,FXDIRTsp.PIE,FXSSplsh.PIE,0,640,960,60,50,5,1,0,0,14,0,0,0,0,0,0,10,0,1500,20,YES,KINETIC,MACHINE GUN,DIRECT,ANTI PERSONNEL,180,90,-30,YES,NO,20,0,NO,100,0,0,0,0
-BabaRocket,Level One,10,10,100,1,10,10,GNLRCKT.PIE,TRLRCKT.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXGRDexl.PIE,FXGRDexl.PIE,FXSSplsh.PIE,0,640,960,30,20,1,2,6,100,20,64,100,20,0,0,0,0,10,1800,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,0,90,-30,YES,NO,0,128,YES,50,0,0,0,0
+BabaRocket,Level One,10,10,100,1,10,10,scavmra.pie,TRLRCKT.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXGRDexl.PIE,FXGRDexl.PIE,FXSSplsh.PIE,0,640,960,30,20,1,2,6,100,20,64,100,20,0,0,0,0,10,1800,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,0,90,-30,YES,NO,0,128,YES,50,0,0,0,0
BabaPitRocketAT,Level One,100,500,500,1,10,20,GNLMSL.PIE,TRLRCKT.PIE,FXLRocPd.PIE,FXMRocAt.PIE,FXSExp.PIE,FXSExp.PIE,FXSSplsh.PIE,0,640,960,50,30,3,2,2,120,50,0,0,0,0,0,0,0,10,1800,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,180,90,-30,YES,NO,0,128,YES,100,0,0,0,0
BabaPitRocket,Level One,75,375,250,1,10,10,GNLRCKTP.PIE,TRLRCKTP.PIE,FXLRocPd.PIE,FXMFLARE.PIE,FXMPExp.PIE,FXMPExp.PIE,FXSSplsh.PIE,0,640,960,60,30,6,2,0,0,16,0,0,0,0,0,0,10,10,1800,20,YES,KINETIC,ROCKET,DIRECT,ANTI TANK,180,90,-30,YES,NO,10,128,YES,25,0,0,0,0
BaBaMG,Level One-Two,1,1,1,1,1,1,0,0,FXLMgun.PIE,FXTracer.PIE,FXMETHIT.PIE,FXDIRTsp.PIE,FXSSplsh.PIE,0,640,960,50,40,4,1,0,0,10,0,0,0,0,0,0,10,0,1500,20,YES,KINETIC,MACHINE GUN,DIRECT,ANTI PERSONNEL,0,90,-30,YES,NO,20,0,NO,100,0,0,0,0
View
1  data/mp/wrf/piestats.wrf
@@ -287,6 +287,7 @@ file IMD "gnmair2.pie"
file IMD "gnmair3.pie"
file IMD "trmair2.pie"
file IMD "trmair3.pie"
+file IMD "scavmra.pie"
directory "components/bodies"
file IMD "drhbod09.pie"
file IMD "drhbod10.pie"
View
12 lib/gamelib/gtime.cpp
@@ -216,8 +216,8 @@ void gameTimeUpdate(bool mayUpdate)
updateLatency();
if (crcError)
{
- debug(LOG_ERROR, "Synch error, gameTimes were: {%s}", listToString("%10u", ", ", gameQueueCheckTime, gameQueueCheckTime + game.maxPlayers).c_str());
- debug(LOG_ERROR, "Synch error, CRCs were: {%s}", listToString("0x%08X", ", ", gameQueueCheckCrc, gameQueueCheckCrc + game.maxPlayers).c_str());
+ debug(LOG_ERROR, "Synch error, gameTimes were: {%s}", listToString("%7u", ", ", gameQueueCheckTime, gameQueueCheckTime + game.maxPlayers).c_str());
+ debug(LOG_ERROR, "Synch error, CRCs were: {%s}", listToString(" 0x%04X", ", ", gameQueueCheckCrc, gameQueueCheckCrc + game.maxPlayers).c_str());
crcError = false;
}
}
@@ -362,7 +362,7 @@ void sendPlayerGameTime()
unsigned player;
uint32_t latencyTicks = discreteChosenLatency / GAME_TICKS_PER_UPDATE;
uint32_t checkTime = gameTime;
- uint32_t checkCrc = nextDebugSync();
+ GameCrcType checkCrc = nextDebugSync();
for (player = 0; player < game.maxPlayers; ++player)
{
@@ -374,7 +374,7 @@ void sendPlayerGameTime()
NETbeginEncode(NETgameQueue(player), GAME_GAME_TIME);
NETuint32_t(&latencyTicks);
NETuint32_t(&checkTime);
- NETuint32_tLarge(&checkCrc);
+ NETuint16_t(&checkCrc);
NETuint16_t(&wantedLatency);
NETend();
}
@@ -384,12 +384,12 @@ void recvPlayerGameTime(NETQUEUE queue)
{
uint32_t latencyTicks = 0;
uint32_t checkTime = 0;
- uint32_t checkCrc = 0;
+ GameCrcType checkCrc = 0;
NETbeginDecode(queue, GAME_GAME_TIME);
NETuint32_t(&latencyTicks);
NETuint32_t(&checkTime);
- NETuint32_tLarge(&checkCrc);
+ NETuint16_t(&checkCrc);
NETuint16_t(&wantedLatencies[queue.index]);
NETend();
View
150 lib/netplay/netplay.cpp
@@ -95,12 +95,17 @@ SYNC_COUNTER sync_counter; // keeps track on how well we are in sync
// ////////////////////////////////////////////////////////////////////////
// Types
+struct Statistic
+{
+ unsigned sent;
+ unsigned received;
+};
+
struct NETSTATS // data regarding the last one second or so.
{
- UDWORD bytesRecvd;
- UDWORD bytesSent; // number of bytes sent in about 1 sec.
- UDWORD packetsSent;
- UDWORD packetsRecvd;
+ Statistic rawBytes; // Number of actual bytes, in about 1 sec.
+ Statistic uncompressedBytes; // Number of bytes sent, before compression, in about 1 sec.
+ Statistic packets; // Number of calls to writeAll, in about 1 sec.
};
struct NET_PLAYER_DATA
@@ -151,10 +156,15 @@ static char lanaddr[16];
static Socket* tmp_socket[MAX_TMP_SOCKETS] = { NULL };
static SocketSet* tmp_socket_set = NULL;
-static NETSTATS nStats = { 0, 0, 0, 0 };
static int32_t NetGameFlags[4] = { 0, 0, 0, 0 };
char iptoconnect[PATH_MAX] = "\0"; // holds IP/hostname from command line
+static NETSTATS nStats = {{0, 0}, {0, 0}, {0, 0}};
+static NETSTATS nStatsLastSec = {{0, 0}, {0, 0}, {0, 0}};
+static NETSTATS nStatsSecondLastSec = {{0, 0}, {0, 0}, {0, 0}};
+static const NETSTATS nZeroStats = {{0, 0}, {0, 0}, {0, 0}};
+static int nStatsLastUpdateTime = 0;
+
unsigned NET_PlayerConnectionStatus[CONNECTIONSTATUS_NORMAL][MAX_PLAYERS];
// ////////////////////////////////////////////////////////////////////////////
@@ -207,10 +217,15 @@ static size_t NET_fillBuffer(Socket **pSocket, SocketSet* socket_set, uint8_t *b
return 0;
}
- size = readNoInt(socket, bufstart, bufsize);
+ size_t rawBytes;
+ size = readNoInt(socket, bufstart, bufsize, &rawBytes);
if ((size != 0 || !socketReadDisconnected(socket)) && size != SOCKET_ERROR)
{
+ nStats.rawBytes.received += rawBytes;
+ nStats.uncompressedBytes.received += size;
+ nStats.packets.received += 1;
+
return size;
}
else
@@ -1084,6 +1099,12 @@ int NETshutdown(void)
{
NETremRedirects();
}
+
+ // Reset net usage statistics.
+ nStats = nZeroStats;
+ nStatsLastSec = nZeroStats;
+ nStatsSecondLastSec = nZeroStats;
+
return 0;
}
@@ -1167,80 +1188,31 @@ int NETclose(void)
// ////////////////////////////////////////////////////////////////////////
// return bytes of data sent recently.
-UDWORD NETgetBytesSent(void)
-{
- static UDWORD lastsec=0;
- static UDWORD timy=0;
-
- if( (UDWORD)clock() > (timy+CLOCKS_PER_SEC) )
- {
- timy = clock();
- lastsec = nStats.bytesSent;
- nStats.bytesSent = 0;
- }
-
- return lastsec;
-}
-
-UDWORD NETgetRecentBytesSent(void)
-{
- return nStats.bytesSent;
-}
-
-
-UDWORD NETgetBytesRecvd(void)
+unsigned NETgetStatistic(NetStatisticType type, bool sent, bool isTotal)
{
- static UDWORD lastsec=0;
- static UDWORD timy=0;
- if( (UDWORD)clock() > (timy+CLOCKS_PER_SEC) )
+ unsigned Statistic::*statisticType = sent? &Statistic::sent : &Statistic::received;
+ Statistic NETSTATS::*statsType;
+ switch (type)
{
- timy = clock();
- lastsec = nStats.bytesRecvd;
- nStats.bytesRecvd = 0;
+ case NetStatisticRawBytes: statsType = &NETSTATS::rawBytes; break;
+ case NetStatisticUncompressedBytes: statsType = &NETSTATS::uncompressedBytes; break;
+ case NetStatisticPackets: statsType = &NETSTATS::packets; break;
+ default: ASSERT(false, " "); return 0;
}
- return lastsec;
-}
-
-UDWORD NETgetRecentBytesRecvd(void)
-{
- return nStats.bytesRecvd;
-}
-
-
-//return number of packets sent last sec.
-UDWORD NETgetPacketsSent(void)
-{
- static UDWORD lastsec=0;
- static UDWORD timy=0;
- if( (UDWORD)clock() > (timy+CLOCKS_PER_SEC) )
+ int time = wzGetTicks();
+ if ((unsigned)(time - nStatsLastUpdateTime) >= (unsigned)GAME_TICKS_PER_SEC)
{
- timy = clock();
- lastsec = nStats.packetsSent;
- nStats.packetsSent = 0;
+ nStatsLastUpdateTime = time;
+ nStatsSecondLastSec = nStatsLastSec;
+ nStatsLastSec = nStats;
}
- return lastsec;
-}
-
-
-UDWORD NETgetRecentPacketsSent(void)
-{
- return nStats.packetsSent;
-}
-
-
-UDWORD NETgetPacketsRecvd(void)
-{
- static UDWORD lastsec=0;
- static UDWORD timy=0;
- if( (UDWORD)clock() > (timy+CLOCKS_PER_SEC) )
+ if (isTotal)
{
- timy = clock();
- lastsec = nStats.packetsRecvd;
- nStats.packetsRecvd = 0;
+ return nStats.*statsType.*statisticType;
}
- return lastsec;
+ return nStatsLastSec.*statsType.*statisticType - nStatsSecondLastSec.*statsType.*statisticType;
}
@@ -1287,13 +1259,15 @@ bool NETsend(NETQUEUE queue, NetMessage const *message)
{
uint8_t *rawData = message->rawDataDup();
ssize_t rawLen = message->rawLen();
- result = writeAll(sockets[player], rawData, rawLen);
+ size_t compressedRawLen;
+ result = writeAll(sockets[player], rawData, rawLen, &compressedRawLen);
delete[] rawData; // Done with the data.
if (result == rawLen)
{
- nStats.bytesSent += rawLen;
- nStats.packetsSent += 1;
+ nStats.rawBytes.sent += compressedRawLen;
+ nStats.uncompressedBytes.sent += rawLen;
+ nStats.packets.sent += 1;
}
else if (result == SOCKET_ERROR)
{
@@ -1316,13 +1290,15 @@ bool NETsend(NETQUEUE queue, NetMessage const *message)
{
uint8_t *rawData = message->rawDataDup();
ssize_t rawLen = message->rawLen();
- result = writeAll(tcp_socket, rawData, rawLen);
+ size_t compressedRawLen;
+ result = writeAll(tcp_socket, rawData, rawLen, &compressedRawLen);
delete[] rawData; // Done with the data.
if (result == rawLen)
{
- nStats.bytesSent += rawLen;
- nStats.packetsSent += 1;
+ nStats.rawBytes.sent += compressedRawLen;
+ nStats.uncompressedBytes.sent += rawLen;
+ nStats.packets.sent += 1;
}
else if (result == SOCKET_ERROR)
{
@@ -1365,6 +1341,7 @@ void NETflush()
NETflushGameQueues();
+ size_t compressedRawLen;
if (NetPlay.isHost)
{
for (int player = 0; player < MAX_CONNECTED_PLAYERS; ++player)
@@ -1372,7 +1349,8 @@ void NETflush()
// We are the host, send directly to player.
if (connected_bsocket[player] != NULL)
{
- socketFlush(connected_bsocket[player]);
+ socketFlush(connected_bsocket[player], &compressedRawLen);
+ nStats.rawBytes.sent += compressedRawLen;
}
}
for (int player = 0; player < MAX_TMP_SOCKETS; ++player)
@@ -1380,7 +1358,8 @@ void NETflush()
// We are the host, send directly to player.
if (tmp_socket[player] != NULL)
{
- socketFlush(tmp_socket[player]);
+ socketFlush(tmp_socket[player], &compressedRawLen);
+ nStats.rawBytes.sent += compressedRawLen;
}
}
}
@@ -1388,7 +1367,8 @@ void NETflush()
{
if (bsocket != NULL)
{
- socketFlush(bsocket);
+ socketFlush(bsocket, &compressedRawLen);
+ nStats.rawBytes.sent += compressedRawLen;
}
}
}
@@ -3428,7 +3408,7 @@ void resetSyncDebug()
syncDebugNumDumps = 0;
}
-uint32_t nextDebugSync(void)
+GameCrcType nextDebugSync()
{
uint32_t ret = syncDebugLog[syncDebugNext].getCrc();
@@ -3439,7 +3419,7 @@ uint32_t nextDebugSync(void)
syncDebugNext = (syncDebugNext + 1)%MAX_SYNC_HISTORY;
syncDebugLog[syncDebugNext].clear();
- return ret;
+ return (GameCrcType)ret;
}
static void dumpDebugSync(uint8_t *buf, size_t bufLen, uint32_t time, unsigned player)
@@ -3483,7 +3463,7 @@ static void recvDebugSync(NETQUEUE queue)
dumpDebugSync(debugSyncTmpBuf, bufLen, time, queue.index);
}
-bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc)
+bool checkDebugSync(uint32_t checkGameTime, GameCrcType checkCrc)
{
if (checkGameTime == syncDebugLog[syncDebugNext].getGameTime()) // Can't happen - and syncDebugGameTime[] == 0, until just before sending the CRC, anyway.
{
@@ -3496,7 +3476,7 @@ bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc)
{
if (syncDebugLog[logIndex].getGameTime() == checkGameTime)
{
- if (syncDebugLog[logIndex].getCrc() == checkCrc) // Invert bits, since everyone else seems to do that with CRCs...
+ if ((GameCrcType)syncDebugLog[logIndex].getCrc() == checkCrc)
{
return true; // Check passed. (So far... There might still be more players to compare CRCs with.)
}
@@ -3507,7 +3487,7 @@ bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc)
if (logIndex >= MAX_SYNC_HISTORY && syncDebugExtraGameTime == checkGameTime)
{
- if (syncDebugExtraCrc == checkCrc)
+ if ((GameCrcType)syncDebugExtraCrc == checkCrc)
{
return true;
}
View
16 lib/netplay/netplay.h
@@ -301,13 +301,8 @@ extern void NETaddRedirects(void);
extern void NETremRedirects(void);
extern void NETdiscoverUPnPDevices(void);
-extern UDWORD NETgetBytesSent(void); // return bytes sent/recv. call regularly for good results
-extern UDWORD NETgetPacketsSent(void); // return packets sent/recv. call regularly for good results
-extern UDWORD NETgetBytesRecvd(void); // return bytes sent/recv. call regularly for good results
-extern UDWORD NETgetPacketsRecvd(void); // return packets sent/recv. call regularly for good results
-extern UDWORD NETgetRecentBytesSent(void); // more immediate functions.
-extern UDWORD NETgetRecentPacketsSent(void);
-extern UDWORD NETgetRecentBytesRecvd(void);
+enum NetStatisticType {NetStatisticRawBytes, NetStatisticUncompressedBytes, NetStatisticPackets};
+unsigned NETgetStatistic(NetStatisticType type, bool sent, bool isTotal = false); // Return some statistic. Call regularly for good results.
extern void NETplayerKicked(UDWORD index); // Cleanup after player has been kicked
@@ -357,8 +352,9 @@ void _syncDebugIntList(const char *function, const char *str, int *ints, size_t
#define syncDebugBacktrace() do { _syncDebugBacktrace(__FUNCTION__); } while(0)
void _syncDebugBacktrace(const char *function); ///< Adds a backtrace to syncDebug, if the platform supports it. Can be a bit slow, don't call way too often, unless desperate.
-void resetSyncDebug(void); ///< Resets the syncDebug, so syncDebug from a previous game doesn't cause a spurious desynch dump.
-uint32_t nextDebugSync(void); ///< Returns a CRC corresponding to all syncDebug() calls since the last nextDebugSync() or resetSyncDebug() call.
-bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc); ///< Dumps all syncDebug() calls from that gameTime, if the CRC doesn't match.
+typedef uint16_t GameCrcType; // Truncate CRC of game state to 16 bits, to save a bit of bandwidth.
+void resetSyncDebug(); ///< Resets the syncDebug, so syncDebug from a previous game doesn't cause a spurious desynch dump.
+GameCrcType nextDebugSync(); ///< Returns a CRC corresponding to all syncDebug() calls since the last nextDebugSync() or resetSyncDebug() call.
+bool checkDebugSync(uint32_t checkGameTime, GameCrcType checkCrc); ///< Dumps all syncDebug() calls from that gameTime, if the CRC doesn't match.
#endif
View
26 lib/netplay/netsocket.cpp
@@ -473,8 +473,12 @@ static int socketThreadFunction(void *)
* Similar to read(2) with the exception that this function won't be
* interrupted by signals (EINTR).
*/
-ssize_t readNoInt(Socket* sock, void* buf, size_t max_size)
+ssize_t readNoInt(Socket* sock, void* buf, size_t max_size, size_t *rawByteCount)
{
+ size_t ignored;
+ size_t &rawBytes = rawByteCount != NULL? *rawByteCount : ignored;
+ rawBytes = 0;
+
if (sock->fd[SOCK_CONNECTION] == INVALID_SOCKET)
{
debug(LOG_ERROR, "Invalid socket");
@@ -502,6 +506,7 @@ ssize_t readNoInt(Socket* sock, void* buf, size_t max_size)
sock->zInflate.next_in = &sock->zInflateInBuf[0];
sock->zInflate.avail_in = received;
+ rawBytes = received;
if (received == 0)
{
@@ -551,6 +556,7 @@ ssize_t readNoInt(Socket* sock, void* buf, size_t max_size)
sock->ready = false;
+ rawBytes = received;
return received;
}
@@ -565,8 +571,12 @@ bool socketReadDisconnected(Socket *sock)
*
* @return @c size when succesful or @c SOCKET_ERROR if an error occurred.
*/
-ssize_t writeAll(Socket* sock, const void* buf, size_t size)
+ssize_t writeAll(Socket* sock, const void* buf, size_t size, size_t *rawByteCount)
{
+ size_t ignored;
+ size_t &rawBytes = rawByteCount != NULL? *rawByteCount : ignored;
+ rawBytes = 0;
+
if (!sock
|| sock->fd[SOCK_CONNECTION] == INVALID_SOCKET)
{
@@ -592,6 +602,7 @@ ssize_t writeAll(Socket* sock, const void* buf, size_t size)
std::vector<uint8_t> &writeQueue = socketThreadWrites[sock];
writeQueue.insert(writeQueue.end(), static_cast<char const *>(buf), static_cast<char const *>(buf) + size);
wzMutexUnlock(socketThreadMutex);
+ rawBytes = size;
}
else
{
@@ -619,8 +630,12 @@ ssize_t writeAll(Socket* sock, const void* buf, size_t size)
return size;
}
-void socketFlush(Socket *sock)
+void socketFlush(Socket *sock, size_t *rawByteCount)
{
+ size_t ignored;
+ size_t &rawBytes = rawByteCount != NULL? *rawByteCount : ignored;
+ rawBytes = 0;
+
if (!sock->isCompressed)
{
return; // Not compressed, so don't mess with zlib.
@@ -663,6 +678,7 @@ void socketFlush(Socket *sock)
//printf("\n");
// Data sent, don't send again.
+ rawBytes = sock->zDeflateOutBuf.size();
sock->zDeflateInSize = 0;
sock->zDeflateOutBuf.clear();
}
@@ -848,7 +864,7 @@ int checkSockets(const SocketSet* set, unsigned int timeout)
fd_set fds;
do
{
- struct timeval tv = { timeout / 1000, (timeout % 1000) * 1000 };
+ struct timeval tv = {(int)(timeout / 1000), (int)(timeout % 1000) * 1000}; // Cast to int to avoid narrowing needed for C++11.
FD_ZERO(&fds);
for (size_t i = 0; i < set->fds.size(); ++i)
@@ -1132,7 +1148,7 @@ Socket *socketOpen(const SocketAddress *addr, unsigned timeout)
do
{
- struct timeval tv = { timeout / 1000, (timeout % 1000) * 1000 };
+ struct timeval tv = {(int)(timeout / 1000), (int)(timeout % 1000) * 1000}; // Cast to int to avoid narrowing needed for C++11.
FD_ZERO(&conReady);
FD_SET(conn->fd[SOCK_CONNECTION], &conReady);
View
6 lib/netplay/netsocket.h
@@ -103,14 +103,14 @@ void socketArrayClose(Socket **sockets, size_t maxSockets); ///< Clo
char const *getSocketTextAddress(Socket const *sock); ///< Gets a string with the socket address.
bool socketReadReady(Socket const *sock); ///< Returns if checkSockets found data to read from this Socket.
-ssize_t readNoInt(Socket *sock, void *buf, size_t max_size); ///< Reads up to max_size bytes from the Socket.
+ssize_t readNoInt(Socket *sock, void *buf, size_t max_size, size_t *rawByteCount = NULL); ///< Reads up to max_size bytes from the Socket. Raw count of bytes (after compression) returned in rawByteCount.
ssize_t readAll(Socket* sock, void *buf, size_t size, unsigned timeout);///< Reads exactly size bytes from the Socket, or blocks until the timeout expires.
-ssize_t writeAll(Socket *sock, const void* buf, size_t size); ///< Nonblocking write of size bytes to the Socket. All bytes will be written asynchronously, by a separate thread.
+ssize_t writeAll(Socket *sock, const void* buf, size_t size, size_t *rawByteCount = NULL); ///< Nonblocking write of size bytes to the Socket. All bytes will be written asynchronously, by a separate thread. Raw count of bytes (after compression) returned in rawByteCount, which will often be 0 until the socket is flushed.
// Sockets, compressed.
void socketBeginCompression(Socket *sock); ///< Makes future data sent compressed, and future data received expected to be compressed.
bool socketReadDisconnected(Socket *sock); ///< If readNoInt returned 0, returns true if this is the result of a disconnect, or false if the input compressed data just hasn't produced any output bytes.
-void socketFlush(Socket *sock); ///< Actually sends the data written with writeAll. Only useful on compressed sockets. Note that flushing too often makes compression less effective.
+void socketFlush(Socket *sock, size_t *rawByteCount = NULL); ///< Actually sends the data written with writeAll. Only useful on compressed sockets. Note that flushing too often makes compression less effective. Raw count of bytes (after compression) returned in rawByteCount.
// Socket sets.
SocketSet *allocSocketSet(void); ///< Constructs a SocketSet.
View
30 lib/netplay/nettypes.cpp
@@ -126,18 +126,6 @@ static void queue(const Q &q, uint32_t &vOrig)
}
template<class Q>
-static void queueLarge(const Q &q, uint32_t &v)
-{
- uint16_t b[2] = {uint16_t(v>>16), uint16_t(v)};
- queue(q, b[0]);
- queue(q, b[1]);
- if (Q::Direction == Q::Read)
- {
- v = b[0]<<16 | b[1];
- }
-}
-
-template<class Q>
static void queue(const Q &q, uint64_t &v)
{
uint32_t b[2] = {uint32_t(v>>32), uint32_t(v)};
@@ -287,19 +275,6 @@ static void queueAuto(T &v)
}
}
-template<class T>
-static void queueAutoLarge(T &v)
-{
- if (NETgetPacketDir() == PACKET_ENCODE)
- {
- queueLarge(writer, v);
- }
- else if (NETgetPacketDir() == PACKET_DECODE)
- {
- queueLarge(reader, v);
- }
-}
-
// Queue selection functions
/// Gets the &NetQueuePair::send or NetQueue *, corresponding to queue.
@@ -577,11 +552,6 @@ void NETuint32_t(uint32_t *ip)
queueAuto(*ip);
}
-void NETuint32_tLarge(uint32_t *ip)
-{
- queueAutoLarge(*ip);
-}
-
void NETint64_t(int64_t *ip)
{
queueAuto(*ip);
View
1  lib/netplay/nettypes.h
@@ -77,7 +77,6 @@ void NETint16_t(int16_t *ip);
void NETuint16_t(uint16_t *ip);
void NETint32_t(int32_t *ip); ///< Encodes small values (< 836 288) in at most 3 bytes, large values (≥ 22 888 448) in 5 bytes.
void NETuint32_t(uint32_t *ip); ///< Encodes small values (< 1 672 576) in at most 3 bytes, large values (≥ 45 776 896) in 5 bytes.
-void NETuint32_tLarge(uint32_t *ip); ///< Encodes all values in exactly 4 bytes.
void NETint64_t(int64_t *ip);
void NETuint64_t(uint64_t *ip);
void NETbool(bool *bp);
View
15 src/droid.cpp
@@ -249,9 +249,7 @@ int32_t droidDamage(DROID *psDroid, unsigned damage, WEAPON_CLASS weaponClass, W
#endif
bool droidCheckReferences(DROID *psVictimDroid)
{
- int plr;
-
- for (plr = 0; plr < MAX_PLAYERS; plr++)
+ for (int plr = 0; plr < MAX_PLAYERS; plr++)
{
for (STRUCTURE *psStruct = apsStructLists[plr]; psStruct != NULL; psStruct = psStruct->psNext)
{
@@ -269,11 +267,7 @@ bool droidCheckReferences(DROID *psVictimDroid)
debug(LOG_DEATH, DROIDREF(psDroid->targetFunc, psDroid->targetLine));
return false;
}
- if (psVictimDroid != psDroid)
- {
- debug(LOG_DEATH, "Death cleanup is postponed for this unit %p, (id %d name %s), we are still in primary list.", psVictimDroid, psVictimDroid->id, psVictimDroid->aName);
- return false;
- }
+
for (int i = 0; i < psDroid->numWeaps; i++)
{
if (psDroid->psActionTarget[i] == psVictimDroid)
@@ -283,11 +277,6 @@ bool droidCheckReferences(DROID *psVictimDroid)
debug(LOG_DEATH, DROIDREF(psDroid->actionTargetFunc[i], psDroid->actionTargetLine[i]));
return false;
}
- if (psVictimDroid != psDroid)
- {
- debug(LOG_DEATH, "Death cleanup is postponed for this unit %p, (id %d name %s), we are still in primary list.", psVictimDroid, psVictimDroid->id, psVictimDroid->aName);
- return false;
- }
}
}
}
View
44 src/keybind.cpp
@@ -93,6 +93,8 @@
#include "research.h"
#include "template.h"
#include "qtscript.h"
+#include "multigifts.h"
+
/*
KeyBind.c
Holds all the functions that can be mapped to a key.
@@ -147,10 +149,21 @@ void kf_AutoGame(void)
return;
}
#endif
- // obviously, this just sets a flag, the AI scripts still need to take care of the request
- // FIXME: move to script side
- NetPlay.players[selectedPlayer].autoGame = !NetPlay.players[selectedPlayer].autoGame;
- CONPRINTF(ConsoleString, (ConsoleString, "autogame request is %s. AI script *must* support this command!", NetPlay.players[selectedPlayer].autoGame ? "Enabled" : "Disabled"));
+ if (game.type == CAMPAIGN)
+ {
+ CONPRINTF(ConsoleString, (ConsoleString, "Not possible with the campaign!"));
+ return;
+ }
+ // Notify all human players that we are trying to enable autogame
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ if(NetPlay.players[i].allocated)
+ {
+ sendGift(AUTOGAME_GIFT, i);
+ }
+ }
+
+ CONPRINTF(ConsoleString, (ConsoleString, "autogame request has been sent to all players. AI script *must* support this command!"));
}
void kf_ToggleMissionTimer( void )
@@ -582,12 +595,13 @@ void kf_FrameRate( void )
frameRate(), loopPieCount, loopPolyCount, loopStateChanges));
if (runningMultiplayer())
{
- CONPRINTF(ConsoleString,(ConsoleString,
- "NETWORK: Bytes: s-%d r-%d Packets: s-%d r-%d",
- NETgetBytesSent(),
- NETgetBytesRecvd(),
- NETgetPacketsSent(),
- NETgetPacketsRecvd() ));
+ CONPRINTF(ConsoleString, (ConsoleString, "NETWORK: Bytes: s-%d r-%d Uncompressed Bytes: s-%d r-%d Packets: s-%d r-%d",
+ NETgetStatistic(NetStatisticRawBytes, true),
+ NETgetStatistic(NetStatisticRawBytes, false),
+ NETgetStatistic(NetStatisticUncompressedBytes, true),
+ NETgetStatistic(NetStatisticUncompressedBytes, false),
+ NETgetStatistic(NetStatisticPackets, true),
+ NETgetStatistic(NetStatisticPackets, false)));
}
gameStats = !gameStats;
CONPRINTF(ConsoleString, (ConsoleString,"Built at %s on %s",__TIME__,__DATE__));
@@ -857,6 +871,11 @@ void kf_MapCheck(void)
/* Raises the tile under the mouse */
void kf_RaiseTile( void )
{
+ if (runningMultiplayer())
+ {
+ return; // Don't desynch if pressing 'W'...
+ }
+
raiseTile(mouseTileX, mouseTileY);
}
@@ -865,6 +884,11 @@ void kf_RaiseTile( void )
/* Lowers the tile under the mouse */
void kf_LowerTile( void )
{
+ if (runningMultiplayer())
+ {
+ return; // Don't desynch if pressing 'A'...
+ }
+
lowerTile(mouseTileX, mouseTileY);
}
View
7 src/loop.cpp
@@ -432,6 +432,7 @@ static void gameStateUpdate()
sendQueuedDroidInfo();
sendPlayerGameTime();
+ NETflush(); // Make sure the game time tick message is really sent over the network.
if (!paused && !scriptPaused() && !editPaused())
{
@@ -651,7 +652,6 @@ GAMECODE gameLoop(void)
const Rational renderFraction(2, 5); // Minimum fraction of time spent rendering.
const Rational updateFraction = Rational(1) - renderFraction;
- bool didTick = false;
while (true)
{
// Receive NET_BLAH messages.
@@ -665,7 +665,6 @@ GAMECODE gameLoop(void)
{
break; // Not doing a game state update.
}
- didTick = true;
ASSERT(!paused && !gameUpdatePaused() && !editPaused(), "Nonsensical pause values.");
@@ -682,10 +681,10 @@ GAMECODE gameLoop(void)
ASSERT(deltaGraphicsTime == 0, "Shouldn't update graphics and game state at once.");
}
- if (didTick || realTime - lastFlushTime < 400u)
+ if (realTime - lastFlushTime < 400u)
{
lastFlushTime = realTime;
- NETflush(); // Make sure the game time tick message is really sent over the network, and that we aren't waiting too long to send data.
+ NETflush(); // Make sure that we aren't waiting too long to send data.
}
unsigned before = wzGetTicks();
View
39 src/multigifts.cpp
@@ -62,7 +62,7 @@
static void recvGiftDroids (uint8_t from, uint8_t to, uint32_t droidID);
static void sendGiftDroids (uint8_t from, uint8_t to);
static void giftResearch (uint8_t from, uint8_t to, bool send);
-
+static void giftAutoGame(uint8_t from, uint8_t to, bool send);
///////////////////////////////////////////////////////////////////////////////
// gifts..
@@ -105,6 +105,10 @@ bool recvGift(NETQUEUE queue)
audioTrack = ID_POWER_TRANSMIT;
giftPower(from, to, droidID, false);
break;
+ case AUTOGAME_GIFT:
+ audioTrack = ID_SOUND_NEXUS_SYNAPTIC_LINK;
+ giftAutoGame(from, to, false);
+ break;
default:
debug(LOG_ERROR, "recvGift: Unknown Gift recvd");
return false;
@@ -141,6 +145,10 @@ bool sendGift(uint8_t type, uint8_t to)
audioTrack = ID_POWER_TRANSMIT;
giftPower(selectedPlayer, to, 0, true);
break;
+ case AUTOGAME_GIFT:
+ giftAutoGame(selectedPlayer, to, true);
+ return true;
+ break;
default:
debug( LOG_ERROR, "Unknown Gift sent" );
@@ -154,6 +162,35 @@ bool sendGift(uint8_t type, uint8_t to)
return true;
}
+static void giftAutoGame(uint8_t from, uint8_t to, bool send)
+{
+ uint32_t dummy = 0;
+
+ if (send)
+ {
+ uint8_t subType = AUTOGAME_GIFT;
+
+ NETbeginEncode(NETgameQueue(selectedPlayer), GAME_GIFT);
+ NETuint8_t(&subType);
+ NETuint8_t(&from);
+ NETuint8_t(&to);
+ NETuint32_t(&dummy);
+ NETend();
+ debug(LOG_SYNC, "We (%d) are telling %d we want to enable/disable a autogame", from, to);
+ }
+ // If we are recieving the "gift"
+ else
+ {
+ if (to == selectedPlayer)
+ {
+ NetPlay.players[from].autoGame = !NetPlay.players[from].autoGame ;
+ CONPRINTF(ConsoleString, (ConsoleString, "%s has %s the autoGame command", getPlayerName(from), NetPlay.players[from].autoGame ? "Enabled" : "Disabled"));
+ debug(LOG_SYNC, "We (%d) are being told that %d has %s autogame", selectedPlayer, from, NetPlay.players[from].autoGame ? "Enabled" : "Disabled");
+ }
+ }
+}
+
+
// ////////////////////////////////////////////////////////////////////////////
// give radar information
void giftRadar(uint8_t from, uint8_t to, bool send)
View
1  src/multigifts.h
@@ -48,5 +48,6 @@ extern void giftRadar (uint8_t from, uint8_t to, bool send);
#define RESEARCH_GIFT 3
#define POWER_GIFT 4
#define STRUCTURE_GIFT 5 // Unused
+#define AUTOGAME_GIFT 6 // Notify others that we are now being controled by the AI
#endif // __INCLUDED_SRC_MULTIGIFTS_H__
View
27 src/multimenu.cpp
@@ -812,14 +812,29 @@ static void displayExtraGubbins(UDWORD height)
}
#ifdef DEBUG
- unsigned int width;
+ iV_SetFont(font_small);
+ for (unsigned q = 0; q < 2; ++q)
+ {
+ unsigned xPos = 0;
+ unsigned yPos = q*12;
+ bool isTotal = q != 0;
+
+ char const *srText[2] = {_("Sent/Received per sec —"), _("Total Sent/Received —")};
+ sprintf(str, srText[q]);
+ iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + MULTIMENU_FORM_H + yPos);
+ xPos += iV_GetTextWidth(str) + 20;
- sprintf(str,"Traf: %u/%u", NETgetBytesSent(), NETgetBytesRecvd());
- width = iV_GetTextWidth(str);
- iV_DrawText(str, MULTIMENU_FORM_X, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
+ sprintf(str, _("Traf: %u/%u"), NETgetStatistic(NetStatisticRawBytes, true, isTotal), NETgetStatistic(NetStatisticRawBytes, false, isTotal));
+ iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + MULTIMENU_FORM_H + yPos);
+ xPos += iV_GetTextWidth(str) + 20;
- sprintf(str,"Pack: %u/%u", NETgetPacketsSent(), NETgetPacketsRecvd());
- iV_DrawText(str, MULTIMENU_FORM_X + 20 + width, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
+ sprintf(str, _("Uncompressed: %u/%u"), NETgetStatistic(NetStatisticUncompressedBytes, true, isTotal), NETgetStatistic(NetStatisticUncompressedBytes, false, isTotal));
+ iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + MULTIMENU_FORM_H + yPos);
+ xPos += iV_GetTextWidth(str) + 20;
+
+ sprintf(str, _("Pack: %u/%u"), NETgetStatistic(NetStatisticPackets, true, isTotal), NETgetStatistic(NetStatisticPackets, false, isTotal));
+ iV_DrawText(str, MULTIMENU_FORM_X + xPos, MULTIMENU_FORM_Y + MULTIMENU_FORM_H + yPos);
+ }
#endif
return;
}
View
16 src/objmem.cpp
@@ -92,7 +92,7 @@ void objmemShutdown(void)
/* Remove an object from the destroyed list, finally freeing its memory
* Hopefully by this time, no pointers still refer to it! */
-static void objmemDestroy(BASE_OBJECT *psObj)
+static bool objmemDestroy(BASE_OBJECT *psObj)
{
switch (psObj->type)
{
@@ -100,7 +100,7 @@ static void objmemDestroy(BASE_OBJECT *psObj)
debug(LOG_MEMORY, "freeing droid at %p", psObj);
if (!droidCheckReferences((DROID *)psObj))
{
- return;
+ return false;
}
break;
@@ -108,7 +108,7 @@ static void objmemDestroy(BASE_OBJECT *psObj)
debug(LOG_MEMORY, "freeing structure at %p", psObj);
if (!structureCheckReferences((STRUCTURE *)psObj))
{
- return;
+ return false;
}
break;
@@ -121,6 +121,7 @@ static void objmemDestroy(BASE_OBJECT *psObj)
}
delete psObj;
debug(LOG_MEMORY, "BASE_OBJECT* 0x%p is freed.", psObj);
+ return true;
}
/* General housekeeping for the object system */
@@ -146,7 +147,14 @@ void objmemUpdate(void)
while (psDestroyedObj != NULL && psDestroyedObj->died <= gameTime - deltaGameTime)
{
psNext = psDestroyedObj->psNext;
- objmemDestroy(psDestroyedObj);
+ if (!objmemDestroy(psDestroyedObj))
+ {
+ if (psDestroyedObj->type == OBJ_DROID)
+ {
+ debug(LOG_DEATH, "skipping %p (%s: id %u) this round, will try again later.", psDestroyedObj, ((DROID *)psDestroyedObj)->aName, ((DROID *)psDestroyedObj)->id);
+ return;
+ }
+ }
psDestroyedObj = psNext;
}
View
14 src/structure.cpp
@@ -1258,16 +1258,11 @@ static void buildFlatten(STRUCTURE *pStructure, int h)
{
for (int width = 0; width <= b.size.x; ++width)
{
- if (pStructure->pStructureType->type != REF_WALL
- && pStructure->pStructureType->type != REF_WALLCORNER
- && pStructure->pStructureType->type != REF_GATE)
+ setTileHeight(b.map.x + width, b.map.y + breadth, h);
+ // We need to raise features on raised tiles to the new height
+ if (TileHasFeature(mapTile(b.map.x + width, b.map.y + breadth)))
{
- setTileHeight(b.map.x + width, b.map.y + breadth, h);
- // We need to raise features on raised tiles to the new height
- if (TileHasFeature(mapTile(b.map.x + width, b.map.y + breadth)))
- {
- getTileFeature(b.map.x + width, b.map.y + breadth)->pos.z = h;
- }
+ getTileFeature(b.map.x + width, b.map.y + breadth)->pos.z = h;
}
}
}
@@ -1292,6 +1287,7 @@ void alignStructure(STRUCTURE *psBuilding)
// Align surrounding structures.
StructureBounds b = getStructureBounds(psBuilding);
+ syncDebug("Flattened (%d+%d, %d+%d) to %d for %d(p%d)", b.map.x, b.size.x, b.map.y, b.size.y, mapH, psBuilding->id, psBuilding->player);
for (int breadth = -1; breadth <= b.size.y; ++breadth)
{
for (int width = -1; width <= b.size.x; ++width)
Please sign in to comment.
Something went wrong with that request. Please try again.