1 | #ifdef _WIN32 |
1 | #ifdef _WIN32 |
2 | # define WIN32_LEAN_AND_MEAN |
2 | # define WIN32_LEAN_AND_MEAN |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
3 | # define _WIN32_WINNT 0x0500 // needed to get win2000 api calls |
4 | # include <malloc.h> |
4 | # include <malloc.h> |
5 | # include <windows.h> |
5 | # include <windows.h> |
|
|
6 | # include <wininet.h> |
6 | # pragma warning(disable:4244) |
7 | # pragma warning(disable:4244) |
|
|
8 | # pragma warning(disable:4761) |
7 | #endif |
9 | #endif |
8 | |
10 | |
9 | #include "EXTERN.h" |
11 | #include "EXTERN.h" |
10 | #include "perl.h" |
12 | #include "perl.h" |
11 | #include "XSUB.h" |
13 | #include "XSUB.h" |
… | |
… | |
36 | # include <sys/types.h> |
38 | # include <sys/types.h> |
37 | # include <sys/socket.h> |
39 | # include <sys/socket.h> |
38 | # include <netinet/in.h> |
40 | # include <netinet/in.h> |
39 | # include <netinet/tcp.h> |
41 | # include <netinet/tcp.h> |
40 | # include <inttypes.h> |
42 | # include <inttypes.h> |
41 | #else |
|
|
42 | typedef unsigned char uint8_t; |
|
|
43 | typedef unsigned short uint16_t; |
|
|
44 | typedef unsigned int uint32_t; |
|
|
45 | typedef signed char int8_t; |
|
|
46 | typedef signed short int16_t; |
|
|
47 | typedef signed int int32_t; |
|
|
48 | #endif |
43 | #endif |
49 | |
44 | |
50 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, objetc replacement character */ |
45 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ |
51 | |
46 | |
52 | #define FOW_DARKNESS 32 |
47 | #define FOW_DARKNESS 32 |
53 | |
48 | |
54 | #define MAP_EXTEND_X 32 |
49 | #define MAP_EXTEND_X 32 |
55 | #define MAP_EXTEND_Y 512 |
50 | #define MAP_EXTEND_Y 512 |
… | |
… | |
651 | #ifndef _WIN32 |
646 | #ifndef _WIN32 |
652 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
647 | setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof (val)); |
653 | #endif |
648 | #endif |
654 | |
649 | |
655 | void |
650 | void |
|
|
651 | win32_proxy_info () |
|
|
652 | PPCODE: |
|
|
653 | { |
|
|
654 | #ifdef _WIN32 |
|
|
655 | char buffer[2048]; |
|
|
656 | DWORD buflen; |
|
|
657 | |
|
|
658 | EXTEND (SP, 3); |
|
|
659 | |
|
|
660 | buflen = sizeof (buffer); |
|
|
661 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY, (void *)buffer, &buflen)) |
|
|
662 | if (((INTERNET_PROXY_INFO *)buffer)->dwAccessType == INTERNET_OPEN_TYPE_PROXY) |
|
|
663 | { |
|
|
664 | PUSHs (newSVpv (((INTERNET_PROXY_INFO *)buffer)->lpszProxy, 0)); |
|
|
665 | |
|
|
666 | buflen = sizeof (buffer); |
|
|
667 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_USERNAME, (void *)buffer, &buflen)) |
|
|
668 | { |
|
|
669 | PUSHs (newSVpv (buffer, 0)); |
|
|
670 | |
|
|
671 | buflen = sizeof (buffer); |
|
|
672 | if (InternetQueryOption (0, INTERNET_OPTION_PROXY_PASSWORD, (void *)buffer, &buflen)) |
|
|
673 | PUSHs (newSVpv (buffer, 0)); |
|
|
674 | } |
|
|
675 | } |
|
|
676 | #endif |
|
|
677 | } |
|
|
678 | |
|
|
679 | void |
656 | add_font (char *file) |
680 | add_font (char *file) |
657 | CODE: |
681 | CODE: |
658 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
682 | FcConfigAppFontAddFile (0, (const FcChar8 *)file); |
659 | |
683 | |
660 | void |
684 | void |
… | |
… | |
762 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
786 | MessageBox (0, message, "Crossfire+ Fatal Error", MB_OK | MB_ICONERROR); |
763 | #endif |
787 | #endif |
764 | _exit (1); |
788 | _exit (1); |
765 | |
789 | |
766 | void |
790 | void |
767 | _exit (int retval) |
791 | _exit (int retval = 0) |
768 | CODE: |
792 | CODE: |
|
|
793 | #ifdef WIN32 |
|
|
794 | ExitThread (retval); // unclean, please beam me up |
|
|
795 | #else |
769 | _exit (retval); |
796 | _exit (retval); |
|
|
797 | #endif |
770 | |
798 | |
771 | MODULE = CFPlus PACKAGE = CFPlus::Font |
799 | MODULE = CFPlus PACKAGE = CFPlus::Font |
772 | |
800 | |
773 | CFPlus::Font |
801 | CFPlus::Font |
774 | new_from_file (SV *class, char *path, int id = 0) |
802 | new_from_file (SV *class, char *path, int id = 0) |
… | |
… | |
1333 | } |
1361 | } |
1334 | while (ext & 0x80); |
1362 | while (ext & 0x80); |
1335 | } |
1363 | } |
1336 | else |
1364 | else |
1337 | cell->darkness = *data++ + 1; |
1365 | cell->darkness = *data++ + 1; |
1338 | |
|
|
1339 | } |
1366 | } |
1340 | |
1367 | |
1341 | if (flags & 4) |
1368 | if (flags & 4) |
1342 | { |
1369 | { |
1343 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1370 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |