Store level name in World.

This commit is contained in:
Bartosz Taudul
2026-06-22 15:10:28 +02:00
parent 415197bd5d
commit 67bb927d61
2 changed files with 3 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ namespace dyna
World::World( const std::string& level_fn, bool with_player )
: map_( std::make_unique<Map>( level_fn ) )
, name_( level_fn.substr( level_fn.rfind( '/' ) + 1 ) )
{
if( with_player )
{

View File

@@ -28,6 +28,7 @@ public:
Map& map() { return *map_; }
const Map& map() const { return *map_; }
Player* player() { return player_.get(); } // null on the menu screen
const std::string& name() const { return name_; }
void tick();
void draw();
@@ -39,6 +40,7 @@ public:
private:
std::unique_ptr<Map> map_;
std::unique_ptr<Player> player_;
std::string name_;
};
}