diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 43597f0..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,20 +0,0 @@ -version: 1.0.{build} -skip_tags: true -image: Visual Studio 2019 -configuration: release -before_build: -- git submodule update --init --recursive -- ps: tools\premake5.exe vs2019 --set-version="$env:APPVEYOR_BUILD_VERSION" -build: - project: build/zonetool.sln - verbosity: minimal -test: off -artifacts: -- path: build/bin/*.dll -- path: build/bin/*.pdb -deploy: -- provider: GitHub - auth_token: - secure: IyUTCaq8tOpcOwDfqa2bH2UCEgPNoLpgqZtJOetSchzZcs1rJT8b/oQ/DTq2ecwc - on: - branch: master \ No newline at end of file diff --git a/src/IW4/Assets/StringTable.cpp b/src/IW4/Assets/StringTable.cpp index a3a9a37..8ce9760 100644 --- a/src/IW4/Assets/StringTable.cpp +++ b/src/IW4/Assets/StringTable.cpp @@ -113,19 +113,19 @@ namespace ZoneTool StringTable* StringTable_Parse(std::string name, ZoneMemory* mem) { auto table = std::make_unique(name); - auto stringtable = mem->Alloc(); + auto* stringtable = mem->Alloc(); - stringtable->name = mem->StrDup(name.c_str()); - stringtable->rows = table->rows(); - stringtable->columns = table->max_columns(); + stringtable->name = mem->StrDup(name); + stringtable->rows = static_cast(table->rows()); + stringtable->columns = static_cast(table->max_columns()); stringtable->strings = mem->Alloc(stringtable->rows * stringtable->columns); - for (int row = 0; row < table->rows(); row++) + for (size_t row = 0; row < table->rows(); row++) { - for (int col = 0; col < table->columns(row); col++) + for (size_t col = 0; col < table->columns(row); col++) { - int entry = (row * stringtable->columns) + col; - stringtable->strings[entry].string = mem->StrDup(table->entry(row, col).c_str()); + size_t entry = (row * stringtable->columns) + col; + stringtable->strings[entry].string = mem->StrDup(table->entry(row, col)); stringtable->strings[entry].hash = StringTable_Hash(stringtable->strings[entry].string); } } @@ -136,11 +136,11 @@ namespace ZoneTool void IStringTable::init(const std::string& name, ZoneMemory* mem) { this->name_ = name; - this->asset_ = DB_FindXAssetHeader(this->type(), this->name().data()).stringtable; + this->asset_ = DB_FindXAssetHeader(this->type(), this->name().c_str()).stringtable; if (FileSystem::FileExists(name)) { - ZONETOOL_INFO("Parsing stringtable %s...", name.data()); + ZONETOOL_INFO("Parsing stringtable %s...", name.c_str()); this->asset_ = StringTable_Parse(name, mem); } } diff --git a/src/IW5/Assets/AttachmentDef.cpp b/src/IW5/Assets/AttachmentDef.cpp index 43aff38..897be14 100644 --- a/src/IW5/Assets/AttachmentDef.cpp +++ b/src/IW5/Assets/AttachmentDef.cpp @@ -422,17 +422,17 @@ namespace ZoneTool buf->align(3); auto ui = buf->write(data->ui); + if (ui->dpadIcon) + { + ui->dpadIcon = reinterpret_cast(zone->get_asset_pointer(material, ui->dpadIcon->name)); + } + if (ui->ammoCounterIcon) { ui->ammoCounterIcon = reinterpret_cast(zone->get_asset_pointer( material, ui->ammoCounterIcon->name)); } - if (ui->dpadIcon) - { - ui->dpadIcon = reinterpret_cast(zone->get_asset_pointer(material, ui->dpadIcon->name)); - } - ZoneBuffer::clear_pointer(&dest->ui); } diff --git a/src/IW5/Assets/StringTable.cpp b/src/IW5/Assets/StringTable.cpp index ff96f79..9b4afa1 100644 --- a/src/IW5/Assets/StringTable.cpp +++ b/src/IW5/Assets/StringTable.cpp @@ -113,19 +113,19 @@ namespace ZoneTool StringTable* StringTable_Parse(std::string name, ZoneMemory* mem) { auto table = std::make_unique(name); - auto stringtable = mem->Alloc(); + auto* stringtable = mem->Alloc(); - stringtable->name = mem->StrDup(name.c_str()); - stringtable->rows = table->rows(); - stringtable->columns = table->max_columns(); + stringtable->name = mem->StrDup(name); + stringtable->rows = static_cast(table->rows()); + stringtable->columns = static_cast(table->max_columns()); stringtable->strings = mem->Alloc(stringtable->rows * stringtable->columns); - for (int row = 0; row < table->rows(); row++) + for (size_t row = 0; row < table->rows(); row++) { - for (int col = 0; col < table->columns(row); col++) + for (size_t col = 0; col < table->columns(row); col++) { - int entry = (row * stringtable->columns) + col; - stringtable->strings[entry].string = mem->StrDup(table->entry(row, col).c_str()); + size_t entry = (row * stringtable->columns) + col; + stringtable->strings[entry].string = mem->StrDup(table->entry(row, col)); stringtable->strings[entry].hash = StringTable_Hash(stringtable->strings[entry].string); } } @@ -136,11 +136,11 @@ namespace ZoneTool void IStringTable::init(const std::string& name, ZoneMemory* mem) { this->name_ = name; - this->asset_ = DB_FindXAssetHeader(this->type(), this->name().data(), 1).stringtable; + this->asset_ = DB_FindXAssetHeader(this->type(), this->name().c_str(), 1).stringtable; if (FileSystem::FileExists(name)) { - ZONETOOL_INFO("Parsing stringtable %s...", name.data()); + ZONETOOL_INFO("Parsing stringtable %s...", name.c_str()); this->asset_ = StringTable_Parse(name, mem); } } diff --git a/src/ZoneUtils/Zone/ZoneMemory.hpp b/src/ZoneUtils/Zone/ZoneMemory.hpp index 01c1109..da13065 100644 --- a/src/ZoneUtils/Zone/ZoneMemory.hpp +++ b/src/ZoneUtils/Zone/ZoneMemory.hpp @@ -66,8 +66,10 @@ namespace ZoneTool // get string length auto len = strlen(name) + 1; - auto pointer = this->ManualAlloc(len); + auto* pointer = this->ManualAlloc(len); + assert(pointer != nullptr); memcpy(pointer, name, len); + pointer[len - 1] = '\0'; // return pointer return pointer; @@ -76,7 +78,7 @@ namespace ZoneTool char* StrDup(const std::string& name) { std::lock_guard g(this->mutex_); - return this->StrDup(name.data()); + return this->StrDup(name.c_str()); } template @@ -99,7 +101,8 @@ namespace ZoneTool std::lock_guard g(this->mutex_); // alloc pointer and zero it out - auto pointer = reinterpret_cast(memory_pool_) + mem_pos_; + auto* pointer = reinterpret_cast(memory_pool_) + mem_pos_; + assert(pointer != nullptr); memset(pointer, 0, size * count); mem_pos_ += size * count;