mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 20:54:08 +01:00
Codechange: rename byte to uint8_t (#12308)
This commit is contained in:
@@ -33,10 +33,10 @@ static inline OldChunkType GetOldChunkType(OldChunkType type) {return (OldCh
|
||||
static inline OldChunkType GetOldChunkVarType(OldChunkType type) {return (OldChunkType)(GB(type, 8, 8) << 8);}
|
||||
static inline OldChunkType GetOldChunkFileType(OldChunkType type) {return (OldChunkType)(GB(type, 16, 8) << 16);}
|
||||
|
||||
static inline byte CalcOldVarLen(OldChunkType type)
|
||||
static inline uint8_t CalcOldVarLen(OldChunkType type)
|
||||
{
|
||||
static const byte type_mem_size[] = {0, 1, 1, 2, 2, 4, 4, 8};
|
||||
byte length = GB(type, 8, 8);
|
||||
static const uint8_t type_mem_size[] = {0, 1, 1, 2, 2, 4, 4, 8};
|
||||
uint8_t length = GB(type, 8, 8);
|
||||
assert(length != 0 && length < lengthof(type_mem_size));
|
||||
return type_mem_size[length];
|
||||
}
|
||||
@@ -46,7 +46,7 @@ static inline byte CalcOldVarLen(OldChunkType type)
|
||||
* Reads a byte from a file (do not call yourself, use ReadByte())
|
||||
*
|
||||
*/
|
||||
static byte ReadByteFromFile(LoadgameState *ls)
|
||||
static uint8_t ReadByteFromFile(LoadgameState *ls)
|
||||
{
|
||||
/* To avoid slow reads, we read BUFFER_SIZE of bytes per time
|
||||
and just return a byte per time */
|
||||
@@ -73,7 +73,7 @@ static byte ReadByteFromFile(LoadgameState *ls)
|
||||
* Reads a byte from the buffer and decompress if needed
|
||||
*
|
||||
*/
|
||||
byte ReadByte(LoadgameState *ls)
|
||||
uint8_t ReadByte(LoadgameState *ls)
|
||||
{
|
||||
/* Old savegames have a nice compression algorithm (RLE)
|
||||
which means that we have a chunk, which starts with a length
|
||||
@@ -116,8 +116,8 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
|
||||
continue;
|
||||
}
|
||||
|
||||
byte *ptr = (byte*)chunk->ptr;
|
||||
if (chunk->type & OC_DEREFERENCE_POINTER) ptr = *(byte**)ptr;
|
||||
uint8_t *ptr = (uint8_t*)chunk->ptr;
|
||||
if (chunk->type & OC_DEREFERENCE_POINTER) ptr = *(uint8_t**)ptr;
|
||||
|
||||
for (uint i = 0; i < chunk->amount; i++) {
|
||||
/* Handle simple types */
|
||||
@@ -155,7 +155,7 @@ bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
|
||||
if (base == nullptr && chunk->ptr == nullptr) continue;
|
||||
|
||||
/* Chunk refers to a struct member, get address in base. */
|
||||
if (chunk->ptr == nullptr) ptr = (byte *)chunk->offset(base);
|
||||
if (chunk->ptr == nullptr) ptr = (uint8_t *)chunk->offset(base);
|
||||
|
||||
/* Write the data */
|
||||
switch (GetOldChunkVarType(chunk->type)) {
|
||||
|
||||
Reference in New Issue
Block a user