Skip to content

Commit

Permalink
Don't load empty titles or backdrops
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Sep 7, 2015
1 parent ac07865 commit c7921da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions src/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ Background::Background(const std::string& name) :

Graphics::RegisterDrawable(this);

FileRequestAsync* request = AsyncHandler::RequestFile("Backdrop", name);
request->Bind(&Background::OnBackgroundGraphicReady, this);
request->Start();
if (!name.empty()) {
FileRequestAsync* request = AsyncHandler::RequestFile("Backdrop", name);
request->Bind(&Background::OnBackgroundGraphicReady, this);
request->Start();
}
}

Background::Background(int terrain_id) :
Expand All @@ -48,17 +50,19 @@ Background::Background(int terrain_id) :

const RPG::Terrain& terrain = Data::terrains[terrain_id - 1];

if (terrain.background_type == 0) {
FileRequestAsync* request = AsyncHandler::RequestFile("Backdrop", terrain.background_name);
if (!terrain.background_name.empty()) {
if (terrain.background_type == 0) {
FileRequestAsync* request = AsyncHandler::RequestFile("Backdrop", terrain.background_name);
request->Bind(&Background::OnBackgroundGraphicReady, this);
request->Start();
return;
}

FileRequestAsync* request = AsyncHandler::RequestFile("Frame", terrain.background_a_name);
request->Bind(&Background::OnBackgroundGraphicReady, this);
request->Start();
return;
}

FileRequestAsync* request = AsyncHandler::RequestFile("Frame", terrain.background_a_name);
request->Bind(&Background::OnBackgroundGraphicReady, this);
request->Start();

bg_hscroll = terrain.background_a_scrollh ? terrain.background_a_scrollh_speed : 0;
bg_vscroll = terrain.background_a_scrollv ? terrain.background_a_scrollv_speed : 0;

Expand Down
2 changes: 1 addition & 1 deletion src/scene_title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ bool Scene_Title::CheckContinue() {

void Scene_Title::CreateTitleGraphic() {
// Load Title Graphic
if (!title) // No need to recreate Title on Resume
if (!title && !Data::system.title_name.empty()) // No need to recreate Title on Resume
{
title.reset(new Sprite());
FileRequestAsync* request = AsyncHandler::RequestFile("Title", Data::system.title_name);
Expand Down

0 comments on commit c7921da

Please sign in to comment.