From 8b778dda61c45f5d7a4dc416478c42ff4aa1de7f Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 23 Feb 2022 23:13:27 +0100 Subject: Moved content management out to ContentBundle --- Stars45/Game.cpp | 58 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 56 deletions(-) (limited to 'Stars45/Game.cpp') diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp index 4a2e8d8..5ec6c0c 100644 --- a/Stars45/Game.cpp +++ b/Stars45/Game.cpp @@ -46,7 +46,7 @@ Game::Game() : world(0), video_factory(0), video(0), video_settings(0), soundcard(0), gamma(128), max_tex_size(2048), screen(0), totaltime(0), hInst(0), hwnd(0), frame_rate(0), frame_count(0), frame_count0(0), - frame_time(0), frame_time0(0), gui_seconds(0), content(0), + frame_time(0), frame_time0(0), gui_seconds(0), status(Game::OK), exit_code(0), window_style(0) { if (!game) { @@ -87,7 +87,6 @@ Game::~Game() if (game == this) game = 0; - delete content; delete world; delete screen; delete video_factory; @@ -127,17 +126,6 @@ bool Game::IsWindowed() // +--------------------------------------------------------------------+ -Text -Game::GetText(const char* key) -{ - if (game && game->content && game->content->IsLoaded()) - return game->content->GetText(key); - - return key; -} - -// +--------------------------------------------------------------------+ - int Game::GammaLevel() { @@ -276,7 +264,7 @@ Game::Init(HINSTANCE hi, HINSTANCE hpi, LPSTR cmdline, int nCmdShow) if (status == OK) { Print(" Initializing content...\n"); - InitContent(); + ContentBundle::GetInstance()->Init(); Print(" Initializing game...\n"); if (!InitGame()) { @@ -712,48 +700,6 @@ Game::InitGame() return true; } - -// +--------------------------------------------------------------------+ - -bool -Game::InitContent() -{ - DataLoader* loader = DataLoader::GetLoader(); - List bundles; - - loader->SetDataPath("Content/"); - loader->ListFiles("content*", bundles); - - ListIter iter = bundles; - while (++iter) { - Text* filename = iter.value(); - int n = filename->indexOf('_'); - - if (n > 0) { - Locale::ParseLocale(filename->data() + n); - } - else { - delete content; - content = new(__FILE__,__LINE__) ContentBundle("content", 0); - } - } - - loader->SetDataPath(0); - return true; -} - -void -Game::UseLocale(Locale* locale) -{ - DataLoader* loader = DataLoader::GetLoader(); - loader->SetDataPath("Content/"); - delete content; - - content = new(__FILE__,__LINE__) ContentBundle("content", locale); - - loader->SetDataPath(0); -} - // +--------------------------------------------------------------------+ bool -- cgit v1.1