/** * Adds vehicle to World and announces it's change * * @param vehicle Vehicle that is spawned */ public void addVehicle(Vehicle vehicle) { vehicles.add(vehicle); renderables.add(vehicle); // Check if this function was called right after deserialization recoverChangesListeners(); listeners.forEach(IChangesListener::OnWorldChanged); }
/** * Tries to create a Harbour on x, y position * * @param xStr x coord * @param yStr y coord */ public void createHarbor(String xStr, String yStr) { Location loc = parseAndCheckLocation(xStr, yStr); if (loc != null) { Harbor a = new Harbor(loc); harbors.push(a); buildings.push(a); renderables.add(a); iVoyageTargets.add(a); // Check if this function was called right after deserialization recoverChangesListeners(); listeners.forEach(IChangesListener::OnWorldChanged); } }
/** * Tries to create MilitaryAirport on x, y position * * @param xStr x coord as string * @param yStr y coord as string * @param capStr capacity of that airport */ public void createMilitaryAirport(String xStr, String yStr, String capStr) { Location loc = parseAndCheckLocation(xStr, yStr); if (loc != null) { MilitaryAirport a = new MilitaryAirport(loc, Integer.valueOf(capStr)); airports.push(a); buildings.push(a); renderables.add(a); militaryAirports.add(a); // Check if this function was called right after deserialization recoverChangesListeners(); listeners.forEach(IChangesListener::OnWorldChanged); } }