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);
	}
}

@@ -218,41 +218,8 @@
  %7B%0A%0A
-%09private static int next_id = 0;%0A
 %09pri
@@ -412,46 +412,75 @@
 %7B%0A%09%09
-this.next_id++;%0A%09%09%0A%09%09int id = next_id;
+objs.add(obj);%0A%09%7D%0A%0A%09public void addObject(int id, GameObject obj) %7B
 %0A%09%09o
@@ -491,13 +491,8 @@
 d = 
-next_
 id;%0A
@@ -517,16 +517,16 @@
 , obj);%0A
-
 %09%09objs.a
@@ -525,32 +525,36 @@
 %09%09objs.add(obj);
+%09%09%09%09
 %0A%09%7D%0A%0A%09public voi

Remove ID from default GameObjects