func (srv *CityService) GetAll(p RouteArgs) {
	user_id, err := strconv.ParseInt(p.Vars["user"], 10, 64)
	if err != nil {
		fmt.Fprintf(p.Writer, "no such player %s", p.Vars["user"])
		return
	}
	player := srv.World.Players[core.PlayerId(user_id)]

	response := make([]CityResponse, len(core.Cities))
	i := 0
	for _, city := range core.Cities {
		response[i] = CityResponse{
			Id:    int64(city.Id),
			Name:  city.Name,
			Stock: make([]CrateResponse, 0),
		}

		/* Player stock */
		if crates, ok := city.Stock.Crates[player]; ok {
			for _, crate := range crates {
				response[i].Stock = append(response[i].Stock, CrateResponse{
					Type:      crate.Type.Type(),
					Commodity: crate.Type.Name,
					Quantity:  crate.Qty,
					Owner:     crate.Owner.Name,
					Weight:    crate.Weight().String(),
				})
			}

			sort.Sort(CrateByType(response[i].Stock))
		}

		i++
	}

	/* Sort responses by City Id */
	sort.Sort(CityById(response))

	p.Writer.Header().Set("Content-Type", "application/json")
	json, err := json.Marshal(response)
	if err == nil {
		p.Writer.Write(json)
	}
}
func (srv *VehicleService) GetAll(p RouteArgs) {
	user_id, err := strconv.ParseInt(p.Vars["user"], 10, 64)
	if err != nil {
		fmt.Fprintf(p.Writer, "no such player %s", p.Vars["user"])
		return
	}
	player := srv.World.Players[core.PlayerId(user_id)]

	response := make([]VehicleResponse, len(player.Vehicles))
	i := 0
	for _, v := range player.Vehicles {
		response[i] = NewVehicleResponse(v, player)
		i++
	}

	p.Writer.Header().Set("Content-Type", "application/json")
	js, _ := json.Marshal(response)
	p.Writer.Write(js)
}
func (srv *VehicleService) Get(p RouteArgs) {
	user_id, err := strconv.ParseInt(p.Vars["user"], 10, 64)
	if err != nil {
		fmt.Fprintf(p.Writer, "no player id")
		return
	}
	player := srv.World.Players[core.PlayerId(user_id)]

	vehicle_id, err := strconv.ParseInt(p.Vars["vehicle"], 10, 64)
	if err != nil {
		fmt.Fprintf(p.Writer, "no vehicle id")
		return
	}
	exists, vehicle := core.World.Vehicles.Find(core.VehicleId(vehicle_id))
	if exists {
		response := NewVehicleResponse(vehicle, player)

		p.Writer.Header().Set("Content-Type", "application/json")
		js, _ := json.Marshal(response)
		p.Writer.Write(js)
	} else {
		fmt.Fprintf(p.Writer, "Vehicle %d not found", vehicle_id)
	}
}