diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2011-08-02 04:47:33 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:18:11 +0000 |
commit | 93776794c920a6be1f4f671076f45dbb997b296b (patch) | |
tree | 4f8c4daedad9912e50469cf0bf822e44dd8f2fb5 /src/game | |
parent | c96977d5d3058311e8632a90e191979347d69eb4 (diff) |
* (bug 4959) Merge some vm changes from upstream (thanks /dev/humancontroller)
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_lib.c | 23 | ||||
-rw-r--r-- | src/game/bg_lib.h | 2 | ||||
-rw-r--r-- | src/game/g_mover.c | 13 |
3 files changed, 24 insertions, 14 deletions
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index 45ddf632..dd31e946 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -331,17 +331,21 @@ int toupper( int c ) void *memmove( void *dest, const void *src, size_t count ) { - int i; + size_t i; if( dest > src ) { - for( i = count - 1; i >= 0; i-- ) - ( (char *)dest )[ i ] = ( (char *)src )[ i ]; + i = count; + while( i > 0 ) + { + i--; + ((char *)dest)[ i ] = ((char *)src)[ i ]; + } } else { for( i = 0; i < count; i++ ) - ( (char *)dest )[ i ] = ( (char *)src )[ i ]; + ((char *) dest)[ i ] = ((char *)src)[ i ]; } return dest; @@ -2385,13 +2389,8 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) break; /* some picky compilers need this */ } } - if (buffer != NULL) - { - if (currlen < maxlen - 1) - buffer[currlen] = '\0'; - else - buffer[maxlen - 1] = '\0'; - } + if (maxlen > 0) + buffer[currlen] = '\0'; return total; } @@ -2714,8 +2713,6 @@ static int dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) int Q_vsnprintf(char *str, size_t length, const char *fmt, va_list args) { - if (str != NULL) - str[0] = 0; return dopr(str, length, fmt, args); } diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h index aafdd8fd..ec62eeac 100644 --- a/src/game/bg_lib.h +++ b/src/game/bg_lib.h @@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define NULL ((void *)0) #endif -typedef int size_t; +typedef unsigned int size_t; typedef char * va_list; #define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) ) diff --git a/src/game/g_mover.c b/src/game/g_mover.c index ad660d0a..c6b2007f 100644 --- a/src/game/g_mover.c +++ b/src/game/g_mover.c @@ -2051,6 +2051,19 @@ void Reached_Train( gentity_t *ent ) ent->s.pos.trDuration = length * 1000 / speed; + // Be sure to send to clients after any fast move case + ent->r.svFlags &= ~SVF_NOCLIENT; + + // Fast move case + if( ent->s.pos.trDuration < 1 ) + { + // As trDuration is used later in a division, we need to avoid that case now + ent->s.pos.trDuration = 1; + + // Don't send entity to clients so it becomes really invisible + ent->r.svFlags |= SVF_NOCLIENT; + } + // looping sound ent->s.loopSound = next->soundLoop; |