fix issues

- fix usage error of ckid getter in bmap wrapper.
- fix CKObject flag init value error.
- fix CKFileWriter writing empty object name error.
- regulate some statement.
This commit is contained in:
2023-11-30 22:48:40 +08:00
parent 279fa1eccb
commit 74d8f02588
5 changed files with 16 additions and 11 deletions

View File

@ -175,10 +175,15 @@ namespace LibCmo::CK2 {
hdrparser->Write(&obj.FileIndex);
if (XContainer::NSXString::ToCKSTRING(obj.Name) != nullptr) {
// if have name, write it
m_Ctx->GetNativeString(obj.Name, name_conv);
CKDWORD namelen = static_cast<CKDWORD>(name_conv.size());
hdrparser->Write(&namelen);
hdrparser->Write(name_conv.data(), namelen);
} else {
// otherwise, write 0 to indicate no name
CKDWORD namelen = 0;
hdrparser->Write(&namelen);
}
}