aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/FindCURL.cmake
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-07-24 22:50:42 +0100
committerparamat <mat.gregory@virginmedia.com>2017-07-26 02:41:30 +0100
commitf61928d3fc5ef90bd913af2e633275d65adce057 (patch)
tree504566887ee98d60f9ae6e8612e899f2cb86568b /cmake/Modules/FindCURL.cmake
parent31b84ce1f2c4f9c6264f32427c3e7be1215360f1 (diff)
downloadminetest-f61928d3fc5ef90bd913af2e633275d65adce057.tar.gz
minetest-f61928d3fc5ef90bd913af2e633275d65adce057.tar.bz2
minetest-f61928d3fc5ef90bd913af2e633275d65adce057.zip
Mgv7: Add 'mount_zero_level' parameter
Allows setting of the mountain 'zero level' (y where density gradient is zero). It is easy to vertically shift smooth terrain by editing noise parameter 'offset', but vertically shifting mountain terrain was complex and imprecise, involving making a calculation based on an average of the mountain height parameter.
Diffstat (limited to 'cmake/Modules/FindCURL.cmake')
0 files changed, 0 insertions, 0 deletions
'n137' href='#n137'>137 138 139 140 141 142 143 144 145 146 147 148 149 150
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#ifndef CLIENTMEDIA_HEADER
#define CLIENTMEDIA_HEADER

#include "irrlichttypes.h"
#include "filecache.h"
#include <ostream>
#include <map>
#include <set>
#include <vector>

class Client;
struct HTTPFetchResult;

#define MTHASHSET_FILE_SIGNATURE 0x4d544853 // 'MTHS'
#define MTHASHSET_FILE_NAME "index.mth"

class ClientMediaDownloader
{
public:
	ClientMediaDownloader();
	~ClientMediaDownloader();

	float getProgress() const {
		if (m_uncached_count >= 1)
			return 1.0 * m_uncached_received_count /
				m_uncached_count;
		else
			return 0.0;
	}

	bool isStarted() const {
		return m_initial_step_done;
	}

	// If this returns true, the downloader is done and can be deleted
	bool isDone() const {
		return m_initial_step_done &&
			m_uncached_received_count == m_uncached_count;
	}

	// Add a file to the list of required file (but don't fetch it yet)
	void addFile(std::string name, std::string sha1);

	// Add a remote server to the list; ignored if not built with cURL
	void addRemoteServer(std::string baseurl);

	// Steps the media downloader:
	// - May load media into client by calling client->loadMedia()
	// - May check media cache for files
	// - May add files to media cache
	// - May start remote transfers by calling httpfetch_async
	// - May check for completion of current remote transfers
	// - May start conventional transfers by calling client->request_media()
	// - May inform server that all media has been loaded
	//   by calling client->received_media()
	// After step has been called once, don't call addFile/addRemoteServer.
	void step(Client *client);

	// Must be called for each file received through TOCLIENT_MEDIA
	void conventionalTransferDone(
			const std::string &name,
			const std::string &data,
			Client *client);

private:
	struct FileStatus {
		bool received;
		std::string sha1;
		s32 current_remote;
		std::vector<s32> available_remotes;
	};

	struct RemoteServerStatus {
		std::string baseurl;
		s32 active_count;
		bool request_by_filename;
	};

	void initialStep(Client *client);