package net.mueller_martin.turirun;

import java.util.HashMap;
import java.util.ArrayList;
import net.mueller_martin.turirun.gameobjects.GameObject;

/**
 * Created by DM on 06.11.15.
 */
public class ObjectController {

	private static int next_id = 0;
	private HashMap<Integer,GameObject> objs_map = new HashMap<Integer,GameObject>();
	private ArrayList<GameObject> objs = new ArrayList<GameObject>();

	public void addObject(GameObject obj) {
		this.next_id++;
		
		int id = next_id;
		obj.id = next_id;

		objs_map.put(id, obj);
		objs.add(obj);
	}

	public void removeObject(GameObject obj) {
		objs_map.remove(obj.id);
		objs.remove(obj);
	}

	public ArrayList<GameObject> getObjects() {
		return objs;
	}

	public GameObject getObject(int id) {
		return objs_map.get(id);
	}
}

@@ -216,125 +216,8 @@
 er %7B
-%0A%0A%09private static int next_id = 0;%0A%09private HashMap%3CInteger,GameObject%3E objs_map = new HashMap%3CInteger,GameObject%3E();
 %0A%09pr
@@ -326,95 +326,8 @@
 ) %7B%0A
-%09%09this.next_id++;%0A%09%09%0A%09%09int id = next_id;%0A%09%09obj.id = next_id;%0A%0A%09%09objs_map.put(id, obj);%0A
 %09%09ob
@@ -391,35 +391,8 @@
 ) %7B%0A
-%09%09objs_map.remove(obj.id);%0A
 %09%09ob
@@ -452,24 +452,24 @@
 Objects() %7B%0A
+
 %09%09return obj
@@ -477,77 +477,7 @@
 ;%0A%09%7D
-%0A%0A%09public GameObject getObject(int id) %7B%0A%09%09return objs_map.get(id);%0A%09%7D
 %0A%7D%0A

Remove id attributes from ObjectController