Skip to content

Commit

Permalink
Fix Not Loading Fixed Tilesets
Browse files Browse the repository at this point in the history
How did I miss this.
  • Loading branch information
Gota7 committed May 8, 2022
1 parent f12c28b commit d781a7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/ed/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ void Editor::InitEditor()
{
UnloadTileset(t.first);
}
LoadFixedTilesets();
rsc = settings.rscPath;
level = settings.lastLevel;
levelClosed = false;
LoadFixedTilesets();
LoadLevel();
InitSubeditors();
}
Expand All @@ -375,6 +375,7 @@ void Editor::InitSubeditors()

void Editor::LoadTileset(std::string tilesetName)
{
printf("%s\n", tilesetName.c_str());
Tileset t;
t.Load(rsc, tilesetName);
tilesets[tilesetName] = t;
Expand Down
6 changes: 3 additions & 3 deletions src/px/pxmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void Map::Load(std::string rsc_k, std::string mapName, std::map<std::string, Til
}

GFile f = GFile(mapPath.c_str());
if (strcmp(f.ReadStr().c_str(), "PXPACK121127a**"))
if (f.ReadStr() != "PXPACK121127a**")
{
throw std::string("Invalid pack attribute magic.");
}
Expand All @@ -246,7 +246,7 @@ void Map::Load(std::string rsc_k, std::string mapName, std::map<std::string, Til
references[i].Read(&f);
}

if (strcmp(this->references[RT_NPC_PALETTE].dat.c_str(), "") != 0)
if (this->references[RT_NPC_PALETTE].dat != "")
{
Tileset t;
t.Load(rsc_k, this->references[RT_NPC_PALETTE].dat);
Expand All @@ -261,7 +261,7 @@ void Map::Load(std::string rsc_k, std::string mapName, std::map<std::string, Til
for (int i = 0; i < NUM_TILESETS; i++)
{
this->tilesets[i].Read(&f);
if (strcmp(this->tilesets[i].dat.c_str(), "") != 0)
if (this->tilesets[i].dat != "")
{
tilesets[this->tilesets[i].dat].Unload();
Tileset t;
Expand Down
1 change: 0 additions & 1 deletion src/px/tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ void Tileset::Load(std::string rsc_k, std::string tilesetName)
// Load the tileset.
for (auto& path : lookupPaths) {
std::string imagePath = rsc_k + path + tilesetName + ".png";

if (GFile::FileExists(imagePath.c_str()))
{
Image image = LoadImage(imagePath.c_str());
Expand Down

0 comments on commit d781a7c

Please sign in to comment.