… | |
… | |
116 | |
116 | |
117 | $MAP = new CFClient::Map $mapsize, $mapsize; |
117 | $MAP = new CFClient::Map $mapsize, $mapsize; |
118 | |
118 | |
119 | my ($host, $port) = split /:/, $CFG->{host}; |
119 | my ($host, $port) = split /:/, $CFG->{host}; |
120 | |
120 | |
121 | $CONN = new conn |
121 | $CONN = eval { |
|
|
122 | new conn |
122 | host => $host, |
123 | host => $host, |
123 | port => $port || 13327, |
124 | port => $port || 13327, |
124 | user => $CFG->{user}, |
125 | user => $CFG->{user}, |
125 | pass => $CFG->{password}, |
126 | pass => $CFG->{password}, |
126 | mapw => $mapsize, |
127 | mapw => $mapsize, |
127 | maph => $mapsize, |
128 | maph => $mapsize, |
|
|
129 | ; |
128 | ; |
130 | }; |
129 | |
131 | |
|
|
132 | if ($CONN) { |
130 | status "login successful"; |
133 | status "login successful"; |
131 | |
134 | |
132 | CFClient::lowdelay fileno $CONN->{fh}; |
135 | CFClient::lowdelay fileno $CONN->{fh}; |
|
|
136 | } else { |
|
|
137 | status "unable to connect"; |
|
|
138 | } |
133 | } |
139 | } |
134 | |
140 | |
135 | sub stop_game { |
141 | sub stop_game { |
136 | undef $CONN; |
142 | undef $CONN; |
137 | } |
143 | } |
… | |
… | |
1323 | sub update_floorbox { |
1329 | sub update_floorbox { |
1324 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1330 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1325 | $FLOORBOX->clear; |
1331 | $FLOORBOX->clear; |
1326 | $FLOORBOX->add (new CFClient::UI::Empty expand => 1); |
1332 | $FLOORBOX->add (new CFClient::UI::Empty expand => 1); |
1327 | |
1333 | |
1328 | my @items = values %{ $CONN->{container}{0} }; |
|
|
1329 | |
|
|
1330 | # we basically have to use the same sorting as everybody else |
1334 | # we basically have to use the same sorting as everybody else |
1331 | @items = sort { $a->{type} <=> $b->{type} } @items; |
1335 | for my $item (@{ $CONN->{container}{0} }) { |
1332 | |
|
|
1333 | for my $item (reverse @items) { |
|
|
1334 | my $desc = $item->{nrof} < 2 |
1336 | my $desc = $item->{nrof} < 2 |
1335 | ? $item->{name} |
1337 | ? $item->{name} |
1336 | : "$item->{nrof} $item->{name_pl}"; |
1338 | : "$item->{nrof} $item->{name_pl}"; |
1337 | # todo: animation widget, face widget, weight(?) etc. |
1339 | # todo: animation widget, face widget, weight(?) etc. |
1338 | $FLOORBOX->add (my $hbox = new CFClient::UI::HBox |
1340 | $FLOORBOX->add (my $hbox = new CFClient::UI::HBox |
… | |
… | |
1453 | |
1455 | |
1454 | ############################################################################# |
1456 | ############################################################################# |
1455 | |
1457 | |
1456 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1458 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1457 | |
1459 | |
|
|
1460 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
|
|
1461 | |
1458 | $TILECACHE = CFClient::db_table "tilecache"; |
1462 | $TILECACHE = CFClient::db_table "tilecache"; |
1459 | $FACEMAP = CFClient::db_table "facemap"; |
1463 | $FACEMAP = CFClient::db_table "facemap"; |
1460 | |
|
|
1461 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
|
|
1462 | |
1464 | |
1463 | my %DEF_CFG = ( |
1465 | my %DEF_CFG = ( |
1464 | sdl_mode => 0, |
1466 | sdl_mode => 0, |
1465 | width => 640, |
1467 | width => 640, |
1466 | height => 480, |
1468 | height => 480, |