From d9aded54150ed157c391d0e524a6c07a41646dca Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Sun, 7 Aug 2016 23:03:43 +0100 Subject: [PATCH] Cleanup SCMFile --- rwengine/src/script/SCMFile.cpp | 26 +++++++++++++------------- rwengine/src/script/SCMFile.hpp | 33 ++++++++++++++------------------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/rwengine/src/script/SCMFile.cpp b/rwengine/src/script/SCMFile.cpp index e806e3e4..c139260f 100644 --- a/rwengine/src/script/SCMFile.cpp +++ b/rwengine/src/script/SCMFile.cpp @@ -11,14 +11,14 @@ void SCMFile::loadFile(char *data, unsigned int size) _target = static_cast(_data[jumpOpSize]); globalSectionOffset = jumpOpSize+1u; - modelSectionOffset = read(jumpParamSize) + jumpOpSize + 1u; - missionSectionOffset = read(modelSectionOffset-jumpOpSize-1u+jumpParamSize) + jumpOpSize + 1u; - codeSectionOffset = read(missionSectionOffset-jumpOpSize-1u+jumpParamSize); + modelSectionOffset = read(jumpParamSize) + jumpOpSize + 1u; + missionSectionOffset = read(modelSectionOffset-jumpOpSize-1u+jumpParamSize) + jumpOpSize + 1u; + codeSectionOffset = read(missionSectionOffset-jumpOpSize-1u+jumpParamSize); - unsigned int model_count = read(modelSectionOffset); + unsigned int model_count = read(modelSectionOffset); models.reserve(model_count); - int i = modelSectionOffset + sizeof(uint32); + int i = modelSectionOffset + sizeof(uint32_t); for(unsigned int m = 0; m < model_count; ++m) { char model_name[24]; for(size_t c = 0; c < 24; ++c) { @@ -28,16 +28,16 @@ void SCMFile::loadFile(char *data, unsigned int size) } i = missionSectionOffset; - mainSize = read(i); - i += sizeof(uint32); - missionLargestSize = read(i); - i += sizeof(uint32); - unsigned int missionCount = read(i); + mainSize = read(i); + i += sizeof(uint32_t); + missionLargestSize = read(i); + i += sizeof(uint32_t); + unsigned int missionCount = read(i); missionOffsets.reserve(missionCount); - i += sizeof(uint32); + i += sizeof(uint32_t); for(unsigned int m = 0; m < missionCount; ++m) { - missionOffsets.push_back(read(i)); - i += sizeof(uint32); + missionOffsets.push_back(read(i)); + i += sizeof(uint32_t); } } diff --git a/rwengine/src/script/SCMFile.hpp b/rwengine/src/script/SCMFile.hpp index 59431500..8ac25981 100644 --- a/rwengine/src/script/SCMFile.hpp +++ b/rwengine/src/script/SCMFile.hpp @@ -1,6 +1,5 @@ -#pragma once -#ifndef _SCMFILE_HPP_ -#define _SCMFILE_HPP_ +#ifndef RWENGINE_SCMFILE_HPP +#define RWENGINE_SCMFILE_HPP #include #include #include