about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/client.cpp13
-rw-r--r--src/engine/client/graphics.cpp4
-rw-r--r--src/engine/client/text.cpp2
3 files changed, 12 insertions, 7 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index 613a8137..eae5ef3a 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1123,6 +1123,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
 						int DeltaSize;
 						unsigned char aTmpBuffer2[CSnapshot::MAX_SIZE];
 						unsigned char aTmpBuffer3[CSnapshot::MAX_SIZE];
+						CSnapshot *pTmpBuffer3 = (CSnapshot*)aTmpBuffer3;	// Fix compiler warning for strict-aliasing
 						int SnapSize;
 
 						CompleteSize = (NumParts-1) * MAX_SNAPSHOT_PACKSIZE + PartSize;
@@ -1169,19 +1170,19 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
 
 						// unpack delta
 						PurgeTick = DeltaTick;
-						SnapSize = m_SnapshotDelta.UnpackDelta(pDeltaShot, (CSnapshot*)aTmpBuffer3, pDeltaData, DeltaSize);
+						SnapSize = m_SnapshotDelta.UnpackDelta(pDeltaShot, pTmpBuffer3, pDeltaData, DeltaSize);
 						if(SnapSize < 0)
 						{
 							dbg_msg("client", "delta unpack failed!");
 							return;
 						}
 
-						if(Msg != NETMSG_SNAPEMPTY && ((CSnapshot*)aTmpBuffer3)->Crc() != Crc)
+						if(Msg != NETMSG_SNAPEMPTY && pTmpBuffer3->Crc() != Crc)
 						{
 							if(g_Config.m_Debug)
 							{
 								dbg_msg("client", "snapshot crc error #%d - tick=%d wantedcrc=%d gotcrc=%d compressed_size=%d delta_tick=%d",
-									m_SnapCrcErrors, GameTick, Crc, ((CSnapshot*)aTmpBuffer3)->Crc(), CompleteSize, DeltaTick);
+									m_SnapCrcErrors, GameTick, Crc, pTmpBuffer3->Crc(), CompleteSize, DeltaTick);
 							}
 
 							m_SnapCrcErrors++;
@@ -1209,13 +1210,13 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
 						m_SnapshotStorage.PurgeUntil(PurgeTick);
 
 						// add new
-						m_SnapshotStorage.Add(GameTick, time_get(), SnapSize, (CSnapshot*)aTmpBuffer3, 1);
+						m_SnapshotStorage.Add(GameTick, time_get(), SnapSize, pTmpBuffer3, 1);
 
 						// add snapshot to demo
 						if(m_DemoRecorder.IsRecording())
 						{
 							// write snapshot
-							m_DemoRecorder.RecordSnapshot(GameTick, aTmpBuffer3, SnapSize);
+							m_DemoRecorder.RecordSnapshot(GameTick, pTmpBuffer3, SnapSize);
 						}
 
 						// apply snapshot, cycle pointers
@@ -1963,7 +1964,7 @@ int main(int argc, const char **argv) // ignore_convention
 	m_Client.RegisterInterfaces();
 
 	// create the components
-	IConsole *pConsole = CreateConsole();
+	IConsole *pConsole = CreateConsole(CFGFLAG_CLIENT);
 	IStorage *pStorage = CreateStorage("Teeworlds", argv[0]); // ignore_convention
 	IConfig *pConfig = CreateConfig();
 	IEngineGraphics *pEngineGraphics = CreateEngineGraphics();
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index e2f4ae4c..bf3f42ea 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -422,7 +422,11 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename)
 	int h = m_ScreenHeight;
 	unsigned char *pPixelData = (unsigned char *)mem_alloc(w*(h+1)*3, 1);
 	unsigned char *pTempRow = pPixelData+w*h*3;
+	GLint Alignment;
+	glGetIntegerv(GL_PACK_ALIGNMENT, &Alignment);
+	glPixelStorei(GL_PACK_ALIGNMENT, 1);
 	glReadPixels(0,0, w, h, GL_RGB, GL_UNSIGNED_BYTE, pPixelData);
+	glPixelStorei(GL_PACK_ALIGNMENT, Alignment);
 	
 	// flip the pixel because opengl works from bottom left corner
 	for(y = 0; y < h/2; y++)
diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp
index 57e1b43b..8fa8efee 100644
--- a/src/engine/client/text.cpp
+++ b/src/engine/client/text.cpp
@@ -681,7 +681,7 @@ public:
 						Advance = pChr->m_AdvanceX + Kerning(pFont, Character, Nextcharacter)/Size;
 					}
 									
-					if(pCursor->m_Flags&TEXTFLAG_STOP_AT_END && DrawX+Advance*Size-pCursor->m_StartX > pCursor->m_LineWidth)
+					if(pCursor->m_Flags&TEXTFLAG_STOP_AT_END && DrawX+(Advance+pChr->m_Width)*Size-pCursor->m_StartX > pCursor->m_LineWidth)
 					{
 						// we hit the end of the line, no more to render or count
 						pCurrent = pEnd;