aboutsummaryrefslogtreecommitdiff
path: root/textures/advtrains_dtrack_cr_45.png
blob: 95e246070da6406b43806b7eccc87545f3be7915 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 20 00 00 00 20 08 06 00 00 00 73 7a 7a .PNG........IHDR.............szz
0020 f4 00 00 00 06 62 4b 47 44 00 ff 00 ff 00 ff a0 bd a7 93 00 00 00 09 70 48 59 73 00 00 0b 13 00 .....bKGD..............pHYs.....
0040 00 0b 13 01 00 9a 9c 18 00 00 00 07 74 49 4d 45 07 e0 07 04 0b 11 11 d2 ee 16 66 00 00 00 19 74 ............tIME..........f....t
0060 45 58 74 43 6f 6d 6d 65 6e 74 00 43 72 65 61 74 65 64 20 77 69 74 68 20 47 49 4d 50 57 81 0e 17 EXtComment.Created.with.GIMPW...
0080 00 00 01 21 49 44 41 54 58 c3 ed d6 cd 2a 45 01 14 c5 f1 df b9 2e a2 88 81 89 81 52 8a f2 51 22 ...!IDATX....*E............R..Q"
00a0 24 33 45 31 95 4c 3d 84 07 f1 14 32 a6 4c 7d 95 01 13 c9 95 92 52 46 22 14 29 1f 6d 93 fb 00 d7 $3E1.L=....2.L}......RF".).m....
00c0 71 3a a7 b8 6b be d7 7f ed bd 26 9b ba fe 8b 82 8e 22 e1 93 c1 7a b0 58 14 7c 27 88 6a 88 8e bc q:..k.....&......"...z.X.|'.j...
00e0 e1 95 2a bc 12 b4 17 b5 f9 4e 30 55 87 d7 e1 75 f8 9f 83 f7 07 9b c1 57 11 f0 a6 60 29 78 09 ae ..*......N0U...u.......W...`)x..
0100 83 99 b4 5e a5 94 73 2d 98 c0 3d 36 70 9e e7 f6 e5 60 3a 78 a8 9e 7f f6 37 7e e5 94 57 1b c5 1d ...^..s-..=6p....`:x....7~..W...
0120 36 71 16 24 09 91 57 05 03 58 40 17 2e f0 96 16 9e b6 82 b9 e0 39 38 ce c2 af f4 43 78 37 56 f0 6q.$..W..X@..........98....Cx7V.
0140 86 ad a0 33 b7 00 41 23 46 30 8e 1b 1c 26 3c e6 16 20 e1 03 bd 18 c6 3e 76 73 ad 20 18 c3 32 6e ...3..A#F0...&<........>vs....2n
0160 51 41 73 de cf e5 7c f0 1a 6c 67 e9 5b aa 11 de 87 55 bc e0 20 cb cf b6 54 03 bc 09 83 18 c2 25 QAs...|..lg.[....U......T......%
0180 f6 12 9e 72 0b 90 f0 8e 9e 6a 88 a3 4f 4e b2 ac a0 5c c3 05 5a 71 85 35 9c 96 15 a0 a0 25 68 0b ...r.....j..ON...\..Zq.5.....%h.
01a0 1a b2 f6 fe 06 de e3 9e eb 12 15 c5 27 00 00 00 00 49 45 4e 44 ae 42 60 82 ............'....IEND.B`.
n124'>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 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
/*
Minetest
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Kahrl <kahrl@gmx.net>

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 "itemdef.h"

#include "nodedef.h"
#include "tool.h"
#include "inventory.h"
#ifndef SERVER
#include "mapblock_mesh.h"
#include "mesh.h"
#include "wieldmesh.h"
#include "client/tile.h"
#include "client.h"
#endif
#include "log.h"
#include "settings.h"
#include "util/serialize.h"
#include "util/container.h"
#include "util/thread.h"
#include <map>
#include <set>

#ifdef __ANDROID__
#include <GLES/gl.h>
#endif

/*
	ItemDefinition
*/
ItemDefinition::ItemDefinition()
{
	resetInitial();
}

ItemDefinition::ItemDefinition(const ItemDefinition &def)
{
	resetInitial();
	*this = def;
}

ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
{
	if(this == &def)
		return *this;

	reset();

	type = def.type;
	name = def.name;
	description = def.description;
	inventory_image = def.inventory_image;
	inventory_overlay = def.inventory_overlay;
	wield_image = def.wield_image;
	wield_overlay = def.wield_overlay;
	wield_scale = def.wield_scale;
	stack_max = def.stack_max;
	usable = def.usable;
	liquids_pointable = def.liquids_pointable;
	if(def.tool_capabilities)
	{
		tool_capabilities = new ToolCapabilities(
				*def.tool_capabilities);
	}
	groups = def.groups;
	node_placement_prediction = def.node_placement_prediction;
	sound_place = def.sound_place;
	sound_place_failed = def.sound_place_failed;
	range = def.range;
	palette_image = def.palette_image;
	color = def.color;
	return *this;
}

ItemDefinition::~ItemDefinition()
{
	reset();
}

void ItemDefinition::resetInitial()
{
	// Initialize pointers to NULL so reset() does not delete undefined pointers
	tool_capabilities = NULL;
	reset();
}

void ItemDefinition::reset()
{
	type = ITEM_NONE;
	name = "";
	description = "";
	inventory_image = "";
	inventory_overlay = "";
	wield_image = "";
	wield_overlay = "";
	palette_image = "";
	color = video::SColor(0xFFFFFFFF);
	wield_scale = v3f(1.0, 1.0, 1.0);
	stack_max = 99;
	usable = false;
	liquids_pointable = false;
	delete tool_capabilities;
	tool_capabilities = NULL;
	groups.clear();
	sound_place = SimpleSoundSpec();
	sound_place_failed = SimpleSoundSpec();
	range = -1;

	node_placement_prediction = "";
}

void ItemDefinition::serialize(std::ostream &os, u16 protocol_version) const
{
	u8 version = (protocol_version >= 34) ? 4 : 3;
	writeU8(os, version);
	writeU8(os, type);
	os << serializeString(name);
	os << serializeString(description);
	os << serializeString(inventory_image);
	os << serializeString(wield_image);
	writeV3F1000(os, wield_scale);
	writeS16(os, stack_max);
	writeU8(os, usable);
	writeU8(os, liquids_pointable);
	std::string tool_capabilities_s;
	if(tool_capabilities){
		std::ostringstream tmp_os(std::ios::binary);
		tool_capabilities->serialize(tmp_os, protocol_version);
		tool_capabilities_s = tmp_os.str();
	}
	os << serializeString(tool_capabilities_s);
	writeU16(os, groups.size());
	for (const auto &group : groups) {
		os << serializeString(group.first);
		writeS16(os, group.second);
	}
	os << serializeString(node_placement_prediction);
	os << serializeString(sound_place.name);
	writeF1000(os, sound_place.gain);
	writeF1000(os, range);
	os << serializeString(sound_place_failed.name);
	writeF1000(os, sound_place_failed.gain);
	os << serializeString(palette_image);
	writeU32(os, color.color);

	if (version >= 4) {
		writeF1000(os, sound_place.pitch);
		writeF1000(os, sound_place_failed.pitch);
		os << serializeString(inventory_overlay);
		os << serializeString(wield_overlay);
	}
}

void ItemDefinition::deSerialize(std::istream &is)
{
	// Reset everything
	reset();

	// Deserialize
	int version = readU8(is);
	if (version < 1 || version > 4)
		throw SerializationError("unsupported ItemDefinition version");
	type = (enum ItemType)readU8(is);
	name = deSerializeString(is);
	description = deSerializeString(is);
	inventory_image = deSerializeString(is);
	wield_image = deSerializeString(is);
	wield_scale = readV3F1000(is);
	stack_max = readS16(is);
	usable = readU8(is);
	liquids_pointable = readU8(is);
	std::string tool_capabilities_s = deSerializeString(is);
	if(!tool_capabilities_s.empty())
	{
		std::istringstream tmp_is(tool_capabilities_s, std::ios::binary);
		tool_capabilities = new ToolCapabilities;
		tool_capabilities->deSerialize(tmp_is);
	}
	groups.clear();
	u32 groups_size = readU16(is);
	for(u32 i=0; i<groups_size; i++){
		std::string name = deSerializeString(is);