Skip to content

Use project path in standalone mode for client’s ressources #10

Description

@Ge0

Currently, the client fetches all its ressources at the current path (.). Basically, it means that at this current path should reside folders like chipset and maps (for now).

It would be way better to tell the client, when run in standalone mode (no server needed), that the project root would be elsewhere than ..

The current behaviour is explained here: https://github.com/dummymeuporg/dummyclient/blob/master/src/resource_provider.cpp

The ResourceProvider class is responsible for fetching resources.

Here:

ResourceProvider::ResourceProvider()
    : m_localProject(std::string(".")) {}

It is told that the resources shall be fetched in the current directory. So we should parametrize this setting.

There is a drawback according to the current solution though: the ResourceProvider acts as a singleton class, and it is called by a lot of components – widgets, game, and so on.

Its project has to be set by the right component, and should not be modifiable by any other component. That is, it has to be constructed with the right component. At the moment, since it is a singleton instance, its construction is not handled by any of the game component.

What we want is something like:

ResourceProvider::ResourceProvider(const std::string& projectPath)
    : m_localProject(projectPath) {}

I will be thinking about a new design soon. In between, if you have any ideas, shoot them up here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions