Skip to content

Commit

Permalink
* (bug 4959) Merge some vm changes from upstream (thanks /dev/humanco…
Browse files Browse the repository at this point in the history
…ntroller)
  • Loading branch information
cschwarz committed Aug 2, 2011
1 parent 620554c commit fe8d688
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
23 changes: 10 additions & 13 deletions src/game/bg_lib.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/bg_lib.h
Expand Up @@ -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) )
Expand Down
13 changes: 13 additions & 0 deletions src/game/g_mover.c
Expand Up @@ -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;

Expand Down

0 comments on commit fe8d688

Please sign in to comment.