r252 - trunk/code/botlib

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Nov 3 17:32:39 EST 2005


Author: ludwig
Date: 2005-11-03 17:32:39 -0500 (Thu, 03 Nov 2005)
New Revision: 252

Modified:
   trunk/code/botlib/be_ai_chat.c
Log:
found the bug. alignment reenabled.


Modified: trunk/code/botlib/be_ai_chat.c
===================================================================
--- trunk/code/botlib/be_ai_chat.c	2005-11-03 22:26:59 UTC (rev 251)
+++ trunk/code/botlib/be_ai_chat.c	2005-11-03 22:32:39 UTC (rev 252)
@@ -20,13 +20,10 @@
 ===========================================================================
 */
 
-#if 0
+#if 1
 #define ALIGN(x) \
 	do { \
-		size_t oldx = x; \
 		x = (x+sizeof(void*)-1) & ~(sizeof(void*)-1L); \
-		if(x != oldx) \
-			botimport.Print(PRT_MESSAGE, "size %zd -> %zd\n", oldx, x); \
 	} while(0)
 #else
 #define ALIGN(x) 
@@ -2128,14 +2125,16 @@
 						//read the chat messages
 						while(!PC_CheckTokenString(source, "}"))
 						{
+							size_t len;
 							if (!BotLoadChatMessage(source, chatmessagestring))
 							{
 								FreeSource(source);
 								return NULL;
 							} //end if
+							len = strlen(chatmessagestring) + 1;
+							ALIGN(len);
 							if (pass)
 							{
-								size_t len;
 								chatmessage = (bot_chatmessage_t *) ptr;
 								chatmessage->time = -2*CHATMESSAGE_RECENTTIME;
 								//put the chat message in the list
@@ -2145,13 +2144,11 @@
 								ptr += sizeof(bot_chatmessage_t);
 								chatmessage->chatmessage = ptr;
 								strcpy(chatmessage->chatmessage, chatmessagestring);
-								len = strlen(chatmessagestring) + 1;
-								ALIGN(len);
 								ptr += len;
 								//the number of chat messages increased
 								chattype->numchatmessages++;
 							} //end if
-							size += sizeof(bot_chatmessage_t) + strlen(chatmessagestring) + 1;
+							size += sizeof(bot_chatmessage_t) + len;
 						} //end if
 					} //end while
 				} //end if




More information about the quake3-commits mailing list