Skip to content

Commit

Permalink
Move around some terrain class (and its test) so we can add a dummy
Browse files Browse the repository at this point in the history
harvestable terrain
  • Loading branch information
stefanhendriks committed Apr 10, 2017
1 parent 7734671 commit c633703
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
@@ -1,6 +1,5 @@
package com.fundynamic.d2tm.game.state;

import com.fundynamic.d2tm.*;
import com.fundynamic.d2tm.Game;
import com.fundynamic.d2tm.game.controls.Mouse;
import com.fundynamic.d2tm.game.entities.Entity;
Expand Down Expand Up @@ -30,6 +29,7 @@
import org.newdawn.slick.state.StateBasedGame;

import static com.fundynamic.d2tm.Game.*;
import static com.fundynamic.d2tm.game.entities.entitiesdata.EntitiesData.HARVESTER;

public class PlayingState extends BasicGameState {

Expand Down Expand Up @@ -192,10 +192,12 @@ public void initializeMap(EntityRepository entityRepository, Player human, Playe

// TODO: read from SCENARIO.INI file
// human entities
entityRepository.placeUnitOnMap(MapCoordinate.create(2, 2), "HARVESTER", human);
entityRepository.placeUnitOnMap(MapCoordinate.create(2, 2), HARVESTER, human);
entityRepository.placeUnitOnMap(MapCoordinate.create(3, 2), "QUAD", human);
entityRepository.placeStructureOnMap(MapCoordinate.create(5, 5), EntitiesData.CONSTRUCTION_YARD, human);

// cpu entities
// entityRepository.placeUnitOnMap(MapCoordinate.create(3, 3), "QUAD", cpu);
entityRepository.placeStructureOnMap(MapCoordinate.create(57, 57), EntitiesData.CONSTRUCTION_YARD, cpu);
}

Expand Down
@@ -1,6 +1,6 @@
package com.fundynamic.d2tm.game.terrain;
package com.fundynamic.d2tm.game.terrain.impl;

import com.fundynamic.d2tm.game.terrain.impl.EmptyTerrain;
import com.fundynamic.d2tm.game.terrain.Terrain;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
Expand Down
@@ -0,0 +1,22 @@
package com.fundynamic.d2tm.game.terrain.impl;

import com.fundynamic.d2tm.game.terrain.Harvestable;
import org.newdawn.slick.Image;

/**
* A stub for harvestable terrain used for testing purposes
*/
public class HarvestableTerrain extends EmptyTerrain implements Harvestable {

private int amount;

public HarvestableTerrain(Image image, int amount) {
super(image);
this.amount = amount;
}

@Override
public int harvest(int amount) {
return this.amount -= amount;
}
}

0 comments on commit c633703

Please sign in to comment.