about summary refs log tree commit diff stats
path: root/data/maps/daedalus/rooms/Pepper Room.txtpb
Commit message (Expand)AuthorAgeFilesLines
* Changed how door location names are formattedStar Rauchenberger2025-08-301-1/+2
* Added daedalusStar Rauchenberger2025-08-241-0/+9
5'>65 66 67 68 69
#ifndef ORDER_H_0EC669D5
#define ORDER_H_0EC669D5

#include <stdexcept>
#include "field.h"

namespace verbly {

  class order {
  public:
    enum class type {
      random,
      field
    };

    // Type

    type getType() const
    {
      return type_;
    }

    // Random

    order() : type_(type::random)
    {
    }

    // Field

    order(
      field arg,
      bool asc = true) :
        type_(type::field),
        sortField_(std::move(arg)),
        ascending_(asc)
    {
    }

    field getSortField() const
    {
      if (type_ != type::field)
      {
        throw std::domain_error("Invalid access to non-field order");
      }

      return sortField_;
    }

    bool isAscending() const
    {
      if (type_ != type::field)
      {
        throw std::domain_error("Invalid access to non-field order");
      }

      return ascending_;
    }

  private:
    type type_;
    field sortField_;
    bool ascending_;

  };

};

#endif /* end of include guard: ORDER_H_0EC669D5 */