# The Host Reservation

## What is The Host Reservation

The **Host Reservation** is a set of reservations that will be registered immediately when a `KronosReservationHost` is created.

{% hint style="warning" %}
In order to keep the reservation system in sync with the session, the **Host Reservation** must be set properly before changing maps (e.g. from lobby to game).
{% endhint %}

## When To Use The Host Reservation

You must set the **Host Reservation** before changing maps in online matches.

Imagine that you are hosting a match for your friends. After finishing the current match, you simply want to change maps and continue playing. The issue is that your `KronosReservationHost` beacon will be destroyed once you begin changing maps, and your friends who are already in the session won't request a reservation again since they are already in the session. So in order to keep the reservation system in sync with the session, you (the host) must set the host reservation to one that includes everyone in the current match before initiating the map change.

## Setting The Host Reservation

Use the `SetHostReservations` in combination with the `CopyRegisteredReservations` function before changing maps in online matches (e.g. from lobby to game) to ensure that all players will have a valid reservation when they attempt join the new map.

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="https://3833329260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfIkwZ5xO6YLccFyQBEgv%2Fuploads%2FzO5VPTjGXAPZluu9n5MK%2FHostReservation.jpg?alt=media&#x26;token=48d57ff5-a627-43f5-81f9-a5f69fe9dc22" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
#include "KronosReservationManager.h"
```

```cpp
// Get the reservation manager.
UKronosReservationManager* ReservationManager = UKronosReservationManager::Get(this);
if (ReservationManager->IsReservationHost())
{
    // Get the reservations that we want to register.
    // Here we are making a copy of the current reservations to keep all players
    // reservations intact when changing maps.
    // Note that this reservation is still data only, it needs to be registered!
    const TArray<FKronosReservation> Reservations = ReservationManager->CopyRegisteredReservations();
    
    // Register the reservations.
    ReservationManager->SetHostReservations(Reservations);
}
```

{% endtab %}
{% endtabs %}

If the **Host Reservation** is empty, a reservation will be made for the local player automatically. Once it is register it will be consume - meaning it is reset into an empty reservation.
