diff options
author | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-05 19:06:10 +0000 |
---|---|---|
committer | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-05 19:06:10 +0000 |
commit | 2ad7d3b71555eca328d0380e915cf52a18a4f95c (patch) | |
tree | d5229cc86cd1d2c153d4671c68187dfa901a5d36 | |
parent | 3048e0d1b548bb66318575ee6cdb064a85a8f79d (diff) | |
download | ioquake3-aero-2ad7d3b71555eca328d0380e915cf52a18a4f95c.tar.gz ioquake3-aero-2ad7d3b71555eca328d0380e915cf52a18a4f95c.zip |
- put ALIGN macro into q_shared.h
- yet another alignment fix for botlib
git-svn-id: svn://svn.icculus.org/quake3/trunk@282 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r-- | code/botlib/be_aas_route.c | 4 | ||||
-rw-r--r-- | code/botlib/be_ai_chat.c | 17 | ||||
-rw-r--r-- | code/qcommon/q_shared.h | 1 |
3 files changed, 7 insertions, 15 deletions
diff --git a/code/botlib/be_aas_route.c b/code/botlib/be_aas_route.c index 56b1613..de8cc03 100644 --- a/code/botlib/be_aas_route.c +++ b/code/botlib/be_aas_route.c @@ -521,7 +521,7 @@ void AAS_CalculateAreaTravelTimes(void) // size += settings->numreachableareas * sizeof(unsigned short *); // - size += settings->numreachableareas * revreach->numlinks * sizeof(unsigned short); + size += settings->numreachableareas * ALIGN(revreach->numlinks) * sizeof(unsigned short); } //end for //allocate memory for the area travel times ptr = (char *) GetClearedMemory(size); @@ -541,7 +541,7 @@ void AAS_CalculateAreaTravelTimes(void) for (l = 0; l < settings->numreachableareas; l++) { aasworld.areatraveltimes[i][l] = (unsigned short *) ptr; - ptr += revreach->numlinks * sizeof(unsigned short); + ptr += ALIGN(revreach->numlinks) * sizeof(unsigned short); //reachability link reach = &aasworld.reachability[settings->firstreachablearea + l]; // diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c index 85050e9..c71df9a 100644 --- a/code/botlib/be_ai_chat.c +++ b/code/botlib/be_ai_chat.c @@ -20,15 +20,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#if 1 -#define ALIGN(x) \ - do { \ - x = (x+sizeof(void*)-1) & ~(sizeof(void*)-1L); \ - } while(0) -#else -#define ALIGN(x) -#endif - /***************************************************************************** * name: be_ai_chat.c * @@ -699,7 +690,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename) return NULL; } //end if len = strlen(token.string) + 1; - ALIGN(len); + len = ALIGN(len); size += sizeof(bot_synonym_t) + len; if (pass) { @@ -998,7 +989,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename) return NULL; } //end if len = strlen(token.string) + 1; - ALIGN(len); + len = ALIGN(len); size += sizeof(bot_randomlist_t) + len; if (pass) { @@ -1029,7 +1020,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename) return NULL; } //end if len = strlen(chatmessagestring) + 1; - ALIGN(len); + len = ALIGN(len); size += sizeof(bot_randomstring_t) + len; if (pass) { @@ -2132,7 +2123,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname) return NULL; } //end if len = strlen(chatmessagestring) + 1; - ALIGN(len); + len = ALIGN(len); if (pass) { chatmessage = (bot_chatmessage_t *) ptr; diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index c981941..20f15e1 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -111,6 +111,7 @@ typedef int sfxHandle_t; typedef int fileHandle_t; typedef int clipHandle_t; +#define ALIGN(x) ((x+sizeof(long)-1) & ~(sizeof(long)-1)) #ifndef NULL #define NULL ((void *)0) |