1 | # |
1 | # |
2 | # This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | # This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | # |
3 | # |
4 | # Copyright (©) 2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | # Copyright (©) 2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | # |
5 | # |
6 | # Deliantra is free software: you can redistribute it and/or modify it under |
6 | # Deliantra is free software: you can redistribute it and/or modify it under |
7 | # the terms of the Affero GNU General Public License as published by the |
7 | # the terms of the Affero GNU General Public License as published by the |
8 | # Free Software Foundation, either version 3 of the License, or (at your |
8 | # Free Software Foundation, either version 3 of the License, or (at your |
9 | # option) any later version. |
9 | # option) any later version. |
10 | # |
10 | # |
11 | # This program is distributed in the hope that it will be useful, |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | # GNU General Public License for more details. |
14 | # GNU General Public License for more details. |
15 | # |
15 | # |
16 | # You should have received a copy of the Affero GNU General Public License |
16 | # You should have received a copy of the Affero GNU General Public License |
17 | # and the GNU General Public License along with this program. If not, see |
17 | # and the GNU General Public License along with this program. If not, see |
18 | # <http://www.gnu.org/licenses/>. |
18 | # <http://www.gnu.org/licenses/>. |
19 | # |
19 | # |
20 | # The authors can be reached via e-mail to <support@deliantra.net> |
20 | # The authors can be reached via e-mail to <support@deliantra.net> |
21 | # |
21 | # |
22 | |
22 | |
23 | package cf; |
23 | package cf; |
24 | |
24 | |
… | |
… | |
3503 | =cut |
3503 | =cut |
3504 | |
3504 | |
3505 | ############################################################################# |
3505 | ############################################################################# |
3506 | # the server's init and main functions |
3506 | # the server's init and main functions |
3507 | |
3507 | |
|
|
3508 | our %FACEHASH; # hash => idx, #d# HACK for http server |
|
|
3509 | |
3508 | sub load_facedata($) { |
3510 | sub load_facedata($) { |
3509 | my ($path) = @_; |
3511 | my ($path) = @_; |
3510 | |
3512 | |
3511 | # HACK to clear player env face cache, we need some signal framework |
3513 | # HACK to clear player env face cache, we need some signal framework |
3512 | # for this (global event?) |
3514 | # for this (global event?) |
… | |
… | |
3539 | cf::face::set_visibility $idx, $info->{visibility}; |
3541 | cf::face::set_visibility $idx, $info->{visibility}; |
3540 | cf::face::set_magicmap $idx, $info->{magicmap}; |
3542 | cf::face::set_magicmap $idx, $info->{magicmap}; |
3541 | cf::face::set_data $idx, 0, $info->{data32}, $info->{hash32}; |
3543 | cf::face::set_data $idx, 0, $info->{data32}, $info->{hash32}; |
3542 | cf::face::set_data $idx, 1, $info->{data64}, $info->{hash64}; |
3544 | cf::face::set_data $idx, 1, $info->{data64}, $info->{hash64}; |
3543 | cf::face::set_data $idx, 2, $info->{glyph} , $info->{glyph} ; |
3545 | cf::face::set_data $idx, 2, $info->{glyph} , $info->{glyph} ; |
|
|
3546 | $FACEHASH{$info->{hash64}} = $idx;#d# |
3544 | |
3547 | |
3545 | cf::cede_to_tick; |
3548 | cf::cede_to_tick; |
3546 | } |
3549 | } |
3547 | |
3550 | |
3548 | while (my ($face, $info) = each %$faces) { |
3551 | while (my ($face, $info) = each %$faces) { |
… | |
… | |
3582 | my $idx = (cf::face::find $name) || cf::face::alloc $name; |
3585 | my $idx = (cf::face::find $name) || cf::face::alloc $name; |
3583 | |
3586 | |
3584 | cf::face::set_data $idx, 0, $info->{data}, $info->{hash}; |
3587 | cf::face::set_data $idx, 0, $info->{data}, $info->{hash}; |
3585 | cf::face::set_type $idx, $type; |
3588 | cf::face::set_type $idx, $type; |
3586 | cf::face::set_meta $idx, $type & 1 ? undef : $info->{meta}; # preserve meta unless prepended already |
3589 | cf::face::set_meta $idx, $type & 1 ? undef : $info->{meta}; # preserve meta unless prepended already |
|
|
3590 | $FACEHASH{$info->{hash}} = $idx;#d# |
3587 | } else { |
3591 | } else { |
3588 | # $RESOURCE{$name} = $info; # unused |
3592 | # $RESOURCE{$name} = $info; # unused |
3589 | } |
3593 | } |
3590 | |
3594 | |
3591 | cf::cede_to_tick; |
3595 | cf::cede_to_tick; |