diff options
| author | scosu <scosu@gmx.de> | 2008-11-28 07:17:54 +0000 |
|---|---|---|
| committer | scosu <scosu@gmx.de> | 2008-11-28 07:17:54 +0000 |
| commit | 61d18702f63cc4731c923e9ca8cd8d98cdaca4ad (patch) | |
| tree | 83275c7e2983faabfbfc636a987c880f57b999d7 /src/game/gamecore.hpp | |
| parent | e294ca61d99ddf7eac2ca8b52aae779539378d50 (diff) | |
| download | zcatch-61d18702f63cc4731c923e9ca8cd8d98cdaca4ad.tar.gz zcatch-61d18702f63cc4731c923e9ca8cd8d98cdaca4ad.zip | |
Fix for ticket #530. The problem was signed char in those functions
Diffstat (limited to 'src/game/gamecore.hpp')
| -rw-r--r-- | src/game/gamecore.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/game/gamecore.hpp b/src/game/gamecore.hpp index 5ff68ca7..2734820c 100644 --- a/src/game/gamecore.hpp +++ b/src/game/gamecore.hpp @@ -61,7 +61,7 @@ inline void str_to_ints(int *ints, int num, const char *str) char buf[4] = {0,0,0,0}; for(int c = 0; c < 4 && str[index]; c++, index++) buf[c] = str[index]; - *ints = (buf[0]<<24)|(buf[1]<<16)|(buf[2]<<8)|buf[3]; + *ints = ((buf[0]+128)<<24)|((buf[1]+128)<<16)|((buf[2]+128)<<8)|(buf[3]+128); ints++; num--; } @@ -74,10 +74,10 @@ inline void ints_to_str(const int *ints, int num, char *str) { while(num) { - str[0] = ((*ints)>>24)&0xff; - str[1] = ((*ints)>>16)&0xff; - str[2] = ((*ints)>>8)&0xff; - str[3] = (*ints)&0xff; + str[0] = (((*ints)>>24)&0xff)-128; + str[1] = (((*ints)>>16)&0xff)-128; + str[2] = (((*ints)>>8)&0xff)-128; + str[3] = ((*ints)&0xff)-128; str += 4; ints++; num--; |