1 | #! perl |
1 | #! perl # MANDATORY |
2 | |
2 | |
3 | # check client version and string for old clients and possibly issue warnings for them |
3 | # check client version and string for old clients and possibly issue warnings for them |
4 | |
4 | |
5 | cf::player->attach ( |
5 | cf::client->attach ( |
6 | on_login => sub { |
6 | on_addme => sub { |
7 | my ($pl) = @_; |
7 | my ($ns) = @_; |
8 | |
8 | |
9 | my $client = $pl->ns->version; |
9 | my $client = $ns->version; |
10 | |
10 | |
11 | my $is_cf = $client =~ /^(?:GTK|X11) (?:Unix|Win32) Client ([.0-9]+)/ |
11 | my $is_cf = $client =~ /^(?:GTK2?|X11) (?:Unix|Win32) Client ([.0-9]+)/ |
12 | ? join "", map chr, split /\./, $1 |
12 | ? join "", map chr, split /\./, $1 |
13 | : undef; |
13 | : undef; |
14 | |
14 | |
15 | my $is_jx = $client =~ /^JCrossclient 1.0 alpha-(\d+)/ |
15 | my $is_jx = $client =~ /^JCrossclient 1.0 alpha-(\d+)/ |
16 | ? join "", map chr, split /\./, $1 |
16 | ? join "", map chr, split /\./, $1 |
17 | : undef; |
17 | : undef; |
18 | |
18 | |
|
|
19 | if ($client =~ /^(JCrossclient) /) { |
|
|
20 | $ns->send_drawinfo ("(enabling workaround for map redraw bug)", cf::NDI_RED); |
|
|
21 | $ns->force_image_newmap (1); |
|
|
22 | } |
|
|
23 | |
19 | if ($is_cf) { # && $is_cf lt v1.9.2) { |
24 | if ($is_cf) { # && $is_cf lt v1.9.2) { |
20 | $pl->ob->message ("(enabling workaround for client buffer overflow)", cf::NDI_RED | cf::NDI_UNIQUE); |
25 | $ns->send_drawinfo ("(enabling workaround for client buffer overflow)", cf::NDI_RED); |
21 | $pl->ns->buggy_mapscroll (1); |
26 | $ns->buggy_mapscroll (1); |
|
|
27 | $ns->send_drawinfo ("(enabling workaround for broken face caching)", cf::NDI_RED); |
|
|
28 | $ns->force_bad_checksum (1); |
22 | } |
29 | } |
23 | |
30 | |
24 | if ($is_jx) { |
31 | if ($is_jx) { |
25 | $pl->ob->message ("(enabling buggy map scroll workaround)", cf::NDI_RED | cf::NDI_UNIQUE); |
32 | $ns->send_drawinfo ("(enabling buggy map scroll workaround)", cf::NDI_RED); |
26 | $pl->ns->buggy_mapscroll (1); |
33 | $ns->buggy_mapscroll (1); |
27 | } |
34 | } |
28 | |
35 | |
29 | if ($is_jx) { |
36 | if ($is_jx) { |
30 | $pl->ob->message ("You are using a known to be buggy client (an alpha version, too). " |
37 | $ns->send_drawinfo ("You are using a known to be buggy client (an alpha version, too). " |
31 | . "If you encounter map freezes or other bugs, consider using a more stable client " |
38 | . "If you encounter map freezes or other bugs, consider using a more stable client " |
32 | . "such as CFPlus or gcfclient or gcfclient2"); |
39 | . "such as CFPlus or gcfclient or gcfclient2", cf::NDI_RED); |
33 | } |
40 | } |
34 | |
41 | |
35 | if ($is_cf && $is_cf lt v1.9.1) { |
42 | if ($is_cf && $is_cf lt v1.9.1) { |
36 | $pl->ob->message (<<EOF, cf::NDI_RED | cf::NDI_UNIQUE); |
43 | $ns->send_drawinfo (<<EOF, cf::NDI_RED); |
37 | |
44 | |
38 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
45 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
39 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
46 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
40 | *** WARNING: Your client is BUGGY |
47 | *** WARNING: Your client is BUGGY |
41 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
48 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** |