ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/00_map_handling.ext
(Generate patch)

Comparing deliantra/server/ext/00_map_handling.ext (file contents):
Revision 1.11 by root, Sun Dec 31 21:02:04 2006 UTC vs.
Revision 1.12 by root, Sun Dec 31 22:23:12 2006 UTC

90} 90}
91 91
92sub prepare_random_map { 92sub prepare_random_map {
93 my ($exit) = @_; 93 my ($exit) = @_;
94 94
95 # all this does is basically rpelace the /! path by 95 # all this does is basically replace the /! path by
96 # a new random map path (?random/...) with a seed 96 # a new random map path (?random/...) with a seed
97 # that depends on the exit object 97 # that depends on the exit object
98 98
99 my $rmp = parse_random_map_params $exit->msg; 99 my $rmp = parse_random_map_params $exit->msg;
100 100
103 $rmp->{origin_map} = $exit->map->path; 103 $rmp->{origin_map} = $exit->map->path;
104 $rmp->{origin_x} = $exit->x; 104 $rmp->{origin_x} = $exit->x;
105 $rmp->{origin_y} = $exit->y; 105 $rmp->{origin_y} = $exit->y;
106 } 106 }
107 107
108 $rmp->{random_seed} = $exit->random_seed; 108 $rmp->{random_seed} ||= $exit->random_seed;
109 109
110 $exit->slaying ("?random/" . cf::to_json $rmp); 110 my $data = cf::to_json $rmp;
111 my $md5 = Digest::MD5::md5_hex $data;
112
113 if (my $fh = aio_open "$cf::RANDOM_MAPS/$md5.meta", O_WRONLY | O_CREAT, 0666) {
114 aio_write $fh, 0, (length $data), $data, 0;
115
116 $exit->slaying ("?random/$md5");
111 $exit->msg (undef); 117 $exit->msg (undef);
118 }
112} 119}
113 120
114# and all this just because we cannot iterate over 121# and all this just because we cannot iterate over
115# all maps in C++... 122# all maps in C++...
116sub cf::map::change_all_map_light { 123sub cf::map::change_all_map_light {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines