summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/bg_lib.c23
-rw-r--r--src/game/bg_lib.h2
-rw-r--r--src/game/g_mover.c13
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;