Ignore:
Timestamp:
2017-05-27T22:56:30+02:00 (9 years ago)
Author:
stoecker
Message:

checkstyle fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wms-turbo-challenge2/src/wmsturbochallenge/GameWindow.java

    r32914 r33342  
    11/*
    22 * GPLv2 or 3, Copyright (c) 2010  Andrzej Zaborowski
    3  *
    4  * This implements the game logic.
    53 */
    64package wmsturbochallenge;
     
    3836import org.openstreetmap.josm.gui.layer.Layer;
    3937
     38/**
     39 * This implements the game logic.
     40 */
    4041public class GameWindow extends JFrame implements ActionListener {
    4142    public GameWindow(Layer ground) {
     
    4849
    4950        while (s.getScreenSize().width < width * scale ||
    50                 s.getScreenSize().height < height * scale)
    51             scale --;
     51                s.getScreenSize().height < height * scale) {
     52            scale--;
     53        }
    5254        add(panel);
    5355
     
    7981        car_engine.start();
    8082
    81         for (int i = 0; i < maxsprites; i ++)
     83        for (int i = 0; i < maxsprites; i++) {
    8284            sprites[i] = new sprite_pos();
     85        }
    8386
    8487        generate_sky();
     
    120123        public void save_trace() {
    121124            int len = 0;
    122             for (Collection<WayPoint> seg : trackSegs)
     125            for (Collection<WayPoint> seg : trackSegs) {
    123126                len += seg.size();
     127            }
    124128
    125129            /* Don't save traces shorter than 5s */
     
    343347    int frame;
    344348    boolean downloading = false;
     349
    345350    protected void screen_repaint() {
    346351        /* Draw background first */
     
    351356
    352357        /* Messages */
    353         frame ++;
    354         if ((frame & 8) == 0 && downloading)
     358        frame++;
     359        if ((frame & 8) == 0 && downloading) {
    355360            screen.drawImage(loading.getImage(), centre -
    356361                    loading.getIconWidth() / 2, 50, this);
     362        }
    357363
    358364        /* Sprites */
     
    408414        ground.paint(ground_view.graphics, ground_view, null);
    409415
    410         for (int y = (int) (height * horizon + 0.1); y < height; y ++) {
     416        for (int y = (int) (height * horizon + 0.1); y < height; y++) {
    411417            /* Assume a 60 deg vertical Field of View when
    412418             * calculating the distance at given pixel.  */
     
    415421            double lon_off = lon + (dist - cardist) * sin;
    416422
    417             for (int x = 0; x < width; x ++) {
     423            for (int x = 0; x < width; x++) {
    418424                double p_x = dist * (x - centre) / height;
    419425
     
    439445
    440446        int n = (int) (Math.random() * sw * 0.03);
    441         for (int i = 0; i < n; i ++) {
     447        for (int i = 0; i < n; i++) {
    442448            int t = (int) (Math.random() * 5.0);
    443449            int x = (int) (Math.random() *
     
    490496    }
    491497
    492     /* sizes decides how many zoom levels the sprites have.  We
     498    /** sizes decides how many zoom levels the sprites have.  We
    493499     * could do just normal scalling according to distance but
    494500     * that's not what old games did, they had prescaled sprites
    495501     * for the different distances and you could see the feature
    496502     * grow discretely as you approached it.  */
    497     protected final static int sizes = 8;
    498 
    499     protected final static int maxsprites = 32;
     503    protected static final int sizes = 8;
     504
     505    protected static final int maxsprites = 32;
    500506    protected sprite_pos sprites[] = new sprite_pos[maxsprites];
    501507
     
    537543            int sy = cactus[type].getIconHeight();
    538544
    539             sprite_pos pos = sprites[i ++];
     545            sprite_pos pos = sprites[i++];
    540546            pos.dist = dist;
    541547            pos.sprite = cactus[type].getImage();
     
    548554        Arrays.sort(sprites, 0, i);
    549555        for (sprite_pos sprite : sprites)
    550             if (i --> 0)
     556            if (i-- > 0)
    551557                screen.drawImage(sprite.sprite,
    552558                        sprite.x, sprite.y,
     
    556562
    557563        if (splashframe >= 0) {
    558             splashframe ++;
     564            splashframe++;
    559565            if (splashframe >= 8)
    560566                splashframe = -1;
     
    566572            Image image = cactus[type].getImage();
    567573
    568             for (i = 0; i < 50; i ++) {
     574            for (i = 0; i < 50; i++) {
    569575                int x = (int) (Math.random() * sx);
    570576                int y = (int) (Math.random() * sy);
     
    584590
    585591    public boolean no_super_repaint = false;
     592
    586593    protected class GamePanel extends JPanel {
    587594        public GamePanel() {
     
    607614        }
    608615    }
     616
    609617    JPanel panel = new GamePanel();
    610618
     
    631639     */
    632640    protected Timer timer;
     641
    633642    @Override
    634643    public void actionPerformed(ActionEvent e) {
     
    681690            /* Switch vehicle */
    682691            if (key == KeyEvent.VK_V)
    683                 if (current_car ++>= 1)
     692                if (current_car++ >= 1)
    684693                    current_car = 0;
    685694        }
     
    702711        }
    703712    }
     713
    704714    protected FakeMapView ground_view;
    705715}
Note: See TracChangeset for help on using the changeset viewer.