summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-01-08 09:00:07 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2016-01-08 09:00:07 +0100
commita2ea4e5ef5233c7373ceeaaccc3d8df72dc6359e (patch)
tree61de354d2e2a098e58340b4e86ad37cf69cd818b /src/control
parent00970b9faa9338817ec3dddced6dadef69d86fe3 (diff)
downloadrpgedit-a2ea4e5ef5233c7373ceeaaccc3d8df72dc6359e.tar
rpgedit-a2ea4e5ef5233c7373ceeaaccc3d8df72dc6359e.zip
Be explicit about return types, fix a few visibilities
Diffstat (limited to 'src/control')
-rw-r--r--src/control/MapContext.ts19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/control/MapContext.ts b/src/control/MapContext.ts
index 73b3c4d..1660ad4 100644
--- a/src/control/MapContext.ts
+++ b/src/control/MapContext.ts
@@ -13,13 +13,12 @@ import MapView from '../view/MapView';
export default class MapContext {
- view: MapView;
+ private view: MapView;
- entities: EntityPosition[] = [];
- playerEntity: EntityPosition;
+ private entities: EntityPosition[] = [];
+ private playerEntity: EntityPosition;
-
- collision: number[][];
+ private collision: number[][];
constructor(private map: MapData, private inputHandler: InputHandler) {
@@ -63,12 +62,12 @@ export default class MapContext {
return p.x >= 0 && p.x < this.map.width && p.y >= 0 && p.y < this.map.height;
}
- private incCollision(p: Position) {
+ private incCollision(p: Position): void {
if (this.inMap(p))
this.collision[p.x][p.y]++;
}
- private decCollision(p: Position) {
+ private decCollision(p: Position): void {
if (this.inMap(p))
this.collision[p.x][p.y]--;
}
@@ -77,19 +76,19 @@ export default class MapContext {
return (!this.inMap(p)) || (this.collision[p.x][p.y] > 0);
}
- private addEntity(entity: EntityPosition) {
+ private addEntity(entity: EntityPosition): void {
this.entities.push(entity);
this.incCollision(entity.position);
}
- private addTransition(entity: EntityPosition, dest: Position, start: number, dur: number) {
+ private addTransition(entity: EntityPosition, dest: Position, start: number, dur: number): void {
entity.transition = new Transition(start, start+dur, entity.position, dest);
this.incCollision(dest);
}
- private finishTransition(entity: EntityPosition) {
+ private finishTransition(entity: EntityPosition): void {
this.decCollision(entity.position);
entity.position = entity.transition.dest;