… | |
… | |
444 | } |
444 | } |
445 | |
445 | |
446 | sub refresh_hook { |
446 | sub refresh_hook { |
447 | my ($self) = @_; |
447 | my ($self) = @_; |
448 | |
448 | |
449 | if ($::MAP) { |
449 | if ($::MAP && $::CONN) { |
450 | if (delete $self->{need_update}) { |
450 | if (delete $self->{need_update}) { |
451 | my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; |
451 | my $tilesize = $self->{ctilesize} = (int $self->{tilesize} * $::CFG->{map_scale}) || 1; |
452 | |
452 | |
453 | my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; |
453 | my $sw = $self->{sw} = 1 + CFPlus::ceil $self->{w} / $tilesize; |
454 | my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; |
454 | my $sh = $self->{sh} = 1 + CFPlus::ceil $self->{h} / $tilesize; |
… | |
… | |
479 | |
479 | |
480 | glPushMatrix; |
480 | glPushMatrix; |
481 | glTranslate $sx0, $sy0; |
481 | glTranslate $sx0, $sy0; |
482 | glScale $::CFG->{map_scale}, $::CFG->{map_scale}; |
482 | glScale $::CFG->{map_scale}, $::CFG->{map_scale}; |
483 | |
483 | |
484 | $::MAP->draw ($dx, $dy, $sw, $sh, $self->{tilesize}); |
484 | my $missing = $::MAP->draw ($dx, $dy, $sw, $sh, $self->{tilesize}); |
485 | |
485 | |
486 | glScale $self->{tilesize}, $self->{tilesize}; |
486 | glScale $self->{tilesize}, $self->{tilesize}; |
487 | |
487 | |
488 | if (my $tex = $self->{fow_texture}) { |
488 | if (my $tex = $self->{fow_texture}) { |
489 | glPushMatrix; |
489 | glPushMatrix; |
… | |
… | |
509 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
509 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
510 | } |
510 | } |
511 | |
511 | |
512 | glPopMatrix; |
512 | glPopMatrix; |
513 | glEndList; |
513 | glEndList; |
|
|
514 | |
|
|
515 | for my $tile (@$missing) { |
|
|
516 | $tile = $::CONN->{texture}[$tile] |
|
|
517 | or next; |
|
|
518 | next if $tile->{loading}; |
|
|
519 | $tile->upload; |
|
|
520 | } |
514 | } |
521 | } |
515 | } else { |
522 | } else { |
516 | glDeleteList delete $self->{list} |
523 | glDeleteList delete $self->{list} |
517 | if $self->{list}; |
524 | if $self->{list}; |
518 | } |
525 | } |