ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.155 by root, Thu Sep 21 00:16:42 2006 UTC vs.
Revision 1.163 by root, Wed Oct 18 12:53:45 2006 UTC

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
655void 650void
651win32_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
679void
656add_font (char *file) 680add_font (char *file)
657 CODE: 681 CODE:
658 FcConfigAppFontAddFile (0, (const FcChar8 *)file); 682 FcConfigAppFontAddFile (0, (const FcChar8 *)file);
659 683
660void 684void
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
766void 790void
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
771MODULE = CFPlus PACKAGE = CFPlus::Font 799MODULE = CFPlus PACKAGE = CFPlus::Font
772 800
773CFPlus::Font 801CFPlus::Font
774new_from_file (SV *class, char *path, int id = 0) 802new_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;
1425 int vx, vy; 1452 int vx, vy;
1426 int x, y, z; 1453 int x, y, z;
1427 int last_name; 1454 int last_name;
1428 mapface face; 1455 mapface face;
1429 1456
1430 vx = self->x + self->w / 2 - sw / 2 - shift_x; 1457 vx = self->x + ((self->w - sw) >> 1) - shift_x;
1431 vy = self->y + self->h / 2 - sh / 2 - shift_y; 1458 vy = self->y + ((self->h - sh) >> 1) - shift_y;
1432 1459
1433 /* 1460 /*
1434 int vx = self->vx = self->w >= sw 1461 int vx = self->vx = self->w >= sw
1435 ? self->x + (self->w - sw) / 2 1462 ? self->x + (self->w - sw) / 2
1436 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); 1463 : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines