aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/up_arrow.png
blob: 840040fcb26f797484dca380263b888a2b151598 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 80 00 00 00 80 02 03 00 00 00 be 50 89 .PNG........IHDR..............P.
0020 58 00 00 00 09 50 4c 54 45 00 00 00 ff ff ff ff ff ff 73 78 a5 63 00 00 00 02 74 52 4e 53 00 00 X....PLTE.........sx.c....tRNS..
0040 76 93 cd 38 00 00 01 19 49 44 41 54 78 5e ed d5 b1 6d c4 30 14 04 51 e2 82 0b 58 0a 4b 53 15 2a v..8....IDATx^...m.0..Q...X.KS.*
0060 c1 25 28 94 b6 4a 83 81 31 c1 7e 6e 68 1b 07 fe e4 92 59 e1 5d c4 f6 0f ef 78 72 f0 92 ce 18 74 .%(..J..1.~nh.....Y.]....xr....t
0080 e9 8a c1 90 ee 18 e8 1e ca 84 af 77 44 74 b5 16 11 e3 69 ed 48 88 b9 ee 8a 84 d6 40 d4 04 10 0b ...........wDt....i.H......@....
00a0 c2 12 c1 b6 2b 12 d6 08 a6 ba 02 21 20 58 76 05 42 40 30 04 e1 84 84 60 07 c2 09 20 02 01 84 13 ....+......!.Xv.B@0....`........
00c0 40 44 02 08 27 80 48 04 10 4e 00 11 09 20 9c 00 22 12 40 38 01 44 5c 80 70 02 88 a8 06 01 21 22 @D..'.H..N......".@8.D\.p.....!"
00e0 e8 41 44 02 08 f2 84 80 e0 08 ea 80 80 e0 08 e2 84 80 e0 08 da 80 80 e0 08 d2 84 80 e0 08 ca 84 .AD.............................
0100 80 e0 08 c2 84 80 e0 08 ba 80 80 50 22 20 d4 08 27 38 e2 80 e0 88 39 86 50 21 66 d0 c2 fd 56 70 ...........P"...'8....9.P!f...Vp
0120 a6 57 ce 9f 0f ff 9b 43 5a 30 24 dd b3 92 74 d6 df 97 2e 7e ed 58 1e eb e0 f9 69 eb 80 d9 27 04 .W.....CZ0$...t....~.X....i...'.
0140 3b d8 c1 0e 76 b0 83 bb 0a 06 c1 5b 55 20 9e e4 97 ca 3b 89 eb a0 71 a3 0a 26 0c 84 1f 84 3f bf ;...v......[U.....;...q..&....?.
0160 6f 7e 3c 0d ab 68 43 ca c7 00 00 00 00 49 45 4e 44 ae 42 60 82 o~<..hC......IEND.B`.
href='#n94'>94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
/*
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.
*/

#include "config.h"

#if USE_LEVELDB

#include "database-leveldb.h"

#include "log.h"
#include "filesys.h"
#include "exceptions.h"
#include "remoteplayer.h"
#include "server/player_sao.h"
#include "util/serialize.h"
#include "util/string.h"

#include "leveldb/db.h"


#define ENSURE_STATUS_OK(s) \
	if (!(s).ok()) { \
		throw DatabaseException(std::string("LevelDB error: ") + \
				(s).ToString()); \
	}


Database_LevelDB::Database_LevelDB(const std::string &savedir)
{
	leveldb::Options options;
	options.create_if_missing = true;
	leveldb::Status status = leveldb::DB::Open(options,
		savedir + DIR_DELIM + "map.db", &m_database);
	ENSURE_STATUS_OK(status);
}

Database_LevelDB::~Database_LevelDB()
{
	delete m_database;
}

bool Database_LevelDB::saveBlock(const v3s16 &pos, const std::string &data)
{
	leveldb::Status status = m_database->Put(leveldb::WriteOptions(),
			i64tos(getBlockAsInteger(pos)), data);
	if (!status.ok()) {
		warningstream << "saveBlock: LevelDB error saving block "
			<< PP(pos) << ": " << status.ToString() << std::endl;
		return false;
	}

	return true;
}

void Database_LevelDB::loadBlock(const v3s16 &pos, std::string *block)
{
	std::string datastr;
	leveldb::Status status = m_database->Get(leveldb::ReadOptions(),
		i64tos(getBlockAsInteger(pos)), &datastr);

	*block = (status.ok()) ? datastr : "";
}

bool Database_LevelDB::deleteBlock(const v3s16 &pos)
{
	leveldb::Status status = m_database->Delete(leveldb::WriteOptions(),
			i64tos(getBlockAsInteger(pos)));
	if (!status.ok()) {
		warningstream << "deleteBlock: LevelDB error deleting block "
			<< PP(pos) << ": " << status.ToString() << std::endl;
		return false;
	}

	return true;
}

void Database_LevelDB::listAllLoadableBlocks(std::vector<v3s16> &dst)
{
	leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions());
	for (it->SeekToFirst(); it->Valid(); it->Next()) {
		dst.push_back(getIntegerAsBlock(stoi64(it->key().ToString())));