//everything is already checked, locked, checked again //write and unlock will also be done by the caller public Ship buildShip(int newShipId, ShipTemplate template, Field field, int userId, Colony colony, bool fastBuild) { Ship newShip = new Ship(newShipId); newShip.userid = userId; newShip.FormerOwner = userId; newShip.initFromTemplate(template, newShip.id); newShip.initFromField(field); newShip.initFromColony(colony); StatisticsCalculator.calc(newShip, Core.Instance); Core.Instance.ships[newShip.id] = newShip; Core.Instance.addShipToField(newShip); Core.Instance.users[userId].ships.Add(newShip); //remove ressources removeGoods(colony, template, fastBuild); return(newShip); }