Example #1
0
// This is called from main() to start up the Radiant stuff.
void Radiant_Initialise (void)
{
	// Load the ColourSchemes from the registry
	ColourSchemes().loadColourSchemes();

	// Load the other modules
	Radiant_Construct(GlobalRadiantModuleServer());

	g_VFSModuleObserver.realise();
	GlobalTextureBrowser().createWidget();

	// Rebuild the map path basing on the userGamePath
	std::string newMapPath = GlobalRadiant().getFullGamePath() + "maps/";
	g_mkdir_with_parents(newMapPath.c_str(), 0755);
	Environment::Instance().setMapsPath(newMapPath);

	g_gameToolsPathObservers.realise();
	g_gameModeObservers.realise();

	GlobalUMPSystem().init();

	// Construct the MRU commands and menu structure
	GlobalMRU().constructMenu();

	// Initialise the most recently used files list
	GlobalMRU().loadRecentFiles();

	gtkutil::MultiMonitor::printMonitorInfo();
}
Example #2
0
bool Map::saveAs()
{
    if (_saveInProgress) return false; // safeguard

    std::string filename =
        MapFileManager::getMapFilename(false, _("Save Map"), "map", getMapName());

    if (!filename.empty()) {
        // Remember the old name, we might need to revert
        std::string oldFilename = _mapName;

        // Rename the file and try to save
        rename(filename);

        // Try to save the file, this might fail
        bool success = save();

        if (success) {
            GlobalMRU().insert(filename);
        }
        else if (!success) {
            // Revert the name change if the file could not be saved
            rename(oldFilename);
        }

        return success;
    }
    else {
        // Invalid filename entered, return false
        return false;
    }
}
Example #3
0
void Radiant_Shutdown (void)
{
	Environment::Instance().deletePathsFromRegistry();

	GlobalMRU().saveRecentFiles();

	g_VFSModuleObserver.unrealise();
	Environment::Instance().setMapsPath("");
	g_gameModeObservers.unrealise();
	g_gameToolsPathObservers.unrealise();

	Radiant_Destroy();
}
Example #4
0
void Map::openMap(const cmd::ArgumentList& args) {
    if (!GlobalMap().askForSave(_("Open Map")))
        return;

    // Get the map file name to load
    std::string filename = MapFileManager::getMapFilename(true, _("Open map"));

    if (!filename.empty()) {
        GlobalMRU().insert(filename);

        GlobalMap().freeMap();
        GlobalMap().load(filename);
    }
}