… | |
… | |
128 | # return random map parameters, or undef |
128 | # return random map parameters, or undef |
129 | sub random_map_params { |
129 | sub random_map_params { |
130 | my ($self) = @_; |
130 | my ($self) = @_; |
131 | |
131 | |
132 | $self->{random} |
132 | $self->{random} |
|
|
133 | } |
|
|
134 | |
|
|
135 | # this is somewhat ugly, but style maps do need special treatment |
|
|
136 | sub is_style_map { |
|
|
137 | $_[0]{path} =~ m{^/styles/} |
133 | } |
138 | } |
134 | } |
139 | } |
135 | |
140 | |
136 | sub write_runtime { |
141 | sub write_runtime { |
137 | my $runtime = cf::localdir . "/runtime"; |
142 | my $runtime = cf::localdir . "/runtime"; |
… | |
… | |
343 | } |
348 | } |
344 | } |
349 | } |
345 | |
350 | |
346 | # now do the right thing for maps |
351 | # now do the right thing for maps |
347 | $self->link_multipart_objects; |
352 | $self->link_multipart_objects; |
|
|
353 | |
|
|
354 | unless ($self->{path}->is_style_map) { |
348 | $self->fix_auto_apply; |
355 | $self->fix_auto_apply; |
349 | $self->decay_objects; |
356 | $self->decay_objects; |
350 | $self->update_buttons; |
357 | $self->update_buttons; |
351 | $self->set_darkness_map; |
358 | $self->set_darkness_map; |
352 | $self->difficulty ($self->estimate_difficulty) |
359 | $self->difficulty ($self->estimate_difficulty) |
353 | unless $self->difficulty; |
360 | unless $self->difficulty; |
354 | $self->activate; |
361 | $self->activate; |
|
|
362 | } |
355 | |
363 | |
356 | $self->in_memory (cf::MAP_IN_MEMORY); |
364 | $self->in_memory (cf::MAP_IN_MEMORY); |
357 | } |
365 | } |
358 | |
366 | |
359 | sub cf::map::load_map_sync { |
367 | sub cf::map::load_map_sync { |
… | |
… | |
381 | |
389 | |
382 | return unless $self->dirty; |
390 | return unless $self->dirty; |
383 | |
391 | |
384 | $self->{load_path} = $save; |
392 | $self->{load_path} = $save; |
385 | |
393 | |
386 | return if $self->{path}{path} =~ /^\/styles\//; |
394 | return if $self->{path}->is_style_map; |
387 | |
395 | |
388 | warn "saving map ", $self->path; |
396 | warn "saving map ", $self->path; |
389 | |
397 | |
390 | if ($uniq) { |
398 | if ($uniq) { |
391 | $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS); |
399 | $self->save_objects ($save, cf::IO_HEADER | cf::IO_OBJECTS); |