aboutsummaryrefslogtreecommitdiff
path: root/textures_gravelback
diff options
context:
space:
mode:
Diffstat (limited to 'textures_gravelback')
-rw-r--r--textures_gravelback/advtrains_track_cr.pngbin84648 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_cr_45.pngbin85734 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_st.pngbin67368 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_st_45.pngbin88782 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swl_cr.pngbin83089 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swl_cr_45.pngbin90284 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swl_st.pngbin82548 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swl_st_45.pngbin90485 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swr_cr.pngbin84070 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swr_cr_45.pngbin90410 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swr_st.pngbin83421 -> 0 bytes
-rw-r--r--textures_gravelback/advtrains_track_swr_st_45.pngbin90641 -> 0 bytes
12 files changed, 0 insertions, 0 deletions
diff --git a/textures_gravelback/advtrains_track_cr.png b/textures_gravelback/advtrains_track_cr.png
deleted file mode 100644
index a21b970..0000000
--- a/textures_gravelback/advtrains_track_cr.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_cr_45.png b/textures_gravelback/advtrains_track_cr_45.png
deleted file mode 100644
index b30a8ca..0000000
--- a/textures_gravelback/advtrains_track_cr_45.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_st.png b/textures_gravelback/advtrains_track_st.png
deleted file mode 100644
index ac94158..0000000
--- a/textures_gravelback/advtrains_track_st.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_st_45.png b/textures_gravelback/advtrains_track_st_45.png
deleted file mode 100644
index e541853..0000000
--- a/textures_gravelback/advtrains_track_st_45.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swl_cr.png b/textures_gravelback/advtrains_track_swl_cr.png
deleted file mode 100644
index 769b92d..0000000
--- a/textures_gravelback/advtrains_track_swl_cr.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swl_cr_45.png b/textures_gravelback/advtrains_track_swl_cr_45.png
deleted file mode 100644
index 6ff8b4b..0000000
--- a/textures_gravelback/advtrains_track_swl_cr_45.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swl_st.png b/textures_gravelback/advtrains_track_swl_st.png
deleted file mode 100644
index e4d5a0c..0000000
--- a/textures_gravelback/advtrains_track_swl_st.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swl_st_45.png b/textures_gravelback/advtrains_track_swl_st_45.png
deleted file mode 100644
index 2dba2f6..0000000
--- a/textures_gravelback/advtrains_track_swl_st_45.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swr_cr.png b/textures_gravelback/advtrains_track_swr_cr.png
deleted file mode 100644
index e13bd2e..0000000
--- a/textures_gravelback/advtrains_track_swr_cr.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swr_cr_45.png b/textures_gravelback/advtrains_track_swr_cr_45.png
deleted file mode 100644
index e0b36ff..0000000
--- a/textures_gravelback/advtrains_track_swr_cr_45.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swr_st.png b/textures_gravelback/advtrains_track_swr_st.png
deleted file mode 100644
index 52d272d..0000000
--- a/textures_gravelback/advtrains_track_swr_st.png
+++ /dev/null
Binary files differ
diff --git a/textures_gravelback/advtrains_track_swr_st_45.png b/textures_gravelback/advtrains_track_swr_st_45.png
deleted file mode 100644
index b81df2c..0000000
--- a/textures_gravelback/advtrains_track_swr_st_45.png
+++ /dev/null
Binary files differ
0 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 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
/*
Minetest
Copyright (C) 2010-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 "string.h"
#include "pointer.h"
#include "numeric.h"
#include "log.h"

#include "hex.h"
#include "../porting.h"

#include <sstream>
#include <iomanip>
#include <map>

#ifndef _WIN32
	#include <iconv.h>
#else
	#define _WIN32_WINNT 0x0501
	#include <windows.h>
#endif

#if defined(_ICONV_H_) && (defined(__FreeBSD__) || defined(__NetBSD__) || \
	defined(__OpenBSD__) || defined(__DragonFly__))
	#define BSD_ICONV_USED
#endif

static bool parseHexColorString(const std::string &value, video::SColor &color);
static bool parseNamedColorString(const std::string &value, video::SColor &color);

#ifndef _WIN32

bool convert(const char *to, const char *from, char *outbuf,
		size_t outbuf_size, char *inbuf, size_t inbuf_size)
{
	iconv_t cd = iconv_open(to, from);

#ifdef BSD_ICONV_USED
	const char *inbuf_ptr = inbuf;
#else
	char *inbuf_ptr = inbuf;
#endif

	char *outbuf_ptr = outbuf;

	size_t *inbuf_left_ptr = &inbuf_size;
	size_t *outbuf_left_ptr = &outbuf_size;

	size_t old_size = inbuf_size;
	while (inbuf_size > 0) {
		iconv(cd, &inbuf_ptr, inbuf_left_ptr, &outbuf_ptr, outbuf_left_ptr);
		if (inbuf_size == old_size) {
			iconv_close(cd);
			return false;
		}
		old_size = inbuf_size;
	}

	iconv_close(cd);
	return true;
}

std::wstring utf8_to_wide(const std::string &input)
{
	size_t inbuf_size = input.length() + 1;
	// maximum possible size, every character is sizeof(wchar_t) bytes
	size_t outbuf_size = (input.length() + 1) * sizeof(wchar_t);

	char *inbuf = new char[inbuf_size];
	memcpy(inbuf, input.c_str(), inbuf_size);
	char *outbuf = new char[outbuf_size];
	memset(outbuf, 0, outbuf_size);

	if (!convert("WCHAR_T", "UTF-8", outbuf, outbuf_size, inbuf, inbuf_size)) {
		infostream << "Couldn't convert UTF-8 string 0x" << hex_encode(input)
			<< " into wstring" << std::endl;
		delete[] inbuf;
		delete[] outbuf;
		return L"<invalid UTF-8 string>";
	}
	std::wstring out((wchar_t *)outbuf);

	delete[] inbuf;
	delete[] outbuf;

	return out;
}

#ifdef __ANDROID__
// TODO: this is an ugly fix for wide_to_utf8 somehow not working on android
std::string wide_to_utf8(const std::wstring &input)
{
	return wide_to_narrow(input);
}
#else
std::string wide_to_utf8(const std::wstring &input)
{
	size_t inbuf_size = (input.length() + 1) * sizeof(wchar_t);
	// maximum possible size: utf-8 encodes codepoints using 1 up to 6 bytes
	size_t outbuf_size = (input.length() + 1) * 6;

	char *inbuf = new char[inbuf_size];
	memcpy(inbuf, input.c_str(), inbuf_size);
	char *outbuf = new char[outbuf_size];
	memset(outbuf, 0, outbuf_size);

	if (!convert("UTF-8", "WCHAR_T", outbuf, outbuf_size, inbuf, inbuf_size)) {
		infostream << "Couldn't convert wstring 0x" << hex_encode(inbuf, inbuf_size)
			<< " into UTF-8 string" << std::endl;
		delete[] inbuf;
		delete[] outbuf;
		return "<invalid wstring>";
	}
	std::string out(outbuf);

	delete[] inbuf;
	delete[] outbuf;

	return out;
}

#endif
#else // _WIN32

std::wstring utf8_to_wide(const std::string &input)
{
	size_t outbuf_size = input.size() + 1;
	wchar_t *outbuf = new wchar_t[outbuf_size];
	memset(outbuf, 0, outbuf_size * sizeof(wchar_t));
	MultiByteToWideChar(CP_UTF8, 0, input.c_str(), input.size(),
		outbuf, outbuf_size);
	std::wstring out(outbuf);
	delete[] outbuf;
	return out;
}

std::string wide_to_utf8(const std::wstring &input)
{
	size_t outbuf_size = (input.size() + 1) * 6;
	char *outbuf = new char[outbuf_size];
	memset(outbuf, 0, outbuf_size);
	WideCharToMultiByte(CP_UTF8, 0, input.c_str(), input.size(),
		outbuf, outbuf_size, NULL, NULL);
	std::string out(outbuf);
	delete[] outbuf;
	return out;
}

#endif // _WIN32

wchar_t *utf8_to_wide_c(const char *str)
{
	std::wstring ret = utf8_to_wide(std::string(str)).c_str();
	size_t len = ret.length();
	wchar_t *ret_c = new wchar_t[len + 1];
	memset(ret_c, 0, (len + 1) * sizeof(wchar_t));
	memcpy(ret_c, ret.c_str(), len * sizeof(wchar_t));
	return ret_c;
}

// You must free the returned string!
// The returned string is allocated using new
wchar_t *narrow_to_wide_c(const char *str)
{
	wchar_t *nstr = NULL;
#if defined(_WIN32)
	int nResult = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) str, -1, 0, 0);
	if (nResult == 0) {
		errorstream<<"gettext: MultiByteToWideChar returned null"<<std::endl;
	} else {
		nstr = new wchar_t[nResult];
		MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) str, -1, (WCHAR *) nstr, nResult);
	}
#else
	size_t len = strlen(str);
	nstr = new wchar_t[len + 1];

	std::wstring intermediate = narrow_to_wide(str);
	memset(nstr, 0, (len + 1) * sizeof(wchar_t));
	memcpy(nstr, intermediate.c_str(), len * sizeof(wchar_t));
#endif

	return nstr;
}


#ifdef __ANDROID__

const wchar_t* wide_chars =
	L" !\"#$%&'()*+,-./0123456789:;<=>?@"
	L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
	L"abcdefghijklmnopqrstuvwxyz{|}~";

int wctomb(char *s, wchar_t wc)
{
	for (unsigned int j = 0; j < (sizeof(wide_chars)/sizeof(wchar_t));j++) {
		if (wc == wide_chars[j]) {
			*s = (char) (j+32);
			return 1;
		}
		else if (wc == L'\n') {
			*s = '\n';
			return 1;
		}
	}
	return -1;
}

int mbtowc(wchar_t *pwc, const char *s, size_t n)
{
	std::wstring intermediate = narrow_to_wide(s);

	if (intermediate.length() > 0) {
		*pwc = intermediate[0];