CStateManager: Silence sign conversion and truncation warnings in LoadScriptObjects()

This commit is contained in:
Lioncash 2020-05-09 17:16:51 -04:00
parent f8670a2bdb
commit 439a55ed98
1 changed files with 15 additions and 9 deletions

View File

@ -1308,18 +1308,24 @@ CStateManager::GetIdListForScript(TEditorId id) const {
void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector<TEditorId>& idsOut) { void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector<TEditorId>& idsOut) {
in.readUByte(); in.readUByte();
int objCount = in.readUint32Big();
const u32 objCount = in.readUint32Big();
idsOut.reserve(idsOut.size() + objCount); idsOut.reserve(idsOut.size() + objCount);
for (int i = 0; i < objCount; ++i) {
EScriptObjectType objType = EScriptObjectType(in.readUByte()); for (u32 i = 0; i < objCount; ++i) {
u32 objSize = in.readUint32Big(); const auto objType = static_cast<EScriptObjectType>(in.readUByte());
u32 pos = in.position(); const u32 objSize = in.readUint32Big();
auto id = LoadScriptObject(aid, objType, objSize, in); const u32 pos = static_cast<u32>(in.position());
if (id.first == kInvalidEditorId) const auto id = LoadScriptObject(aid, objType, objSize, in);
if (id.first == kInvalidEditorId) {
continue; continue;
auto build = GetBuildForScript(id.first); }
if (build.first)
const auto build = GetBuildForScript(id.first);
if (build.first) {
continue; continue;
}
x8a4_loadedScriptObjects[id.first] = SScriptObjectStream{objType, pos, objSize}; x8a4_loadedScriptObjects[id.first] = SScriptObjectStream{objType, pos, objSize};
idsOut.push_back(id.first); idsOut.push_back(id.first);
} }