about summary refs log tree commit diff stats
path: root/data/maps/the_digital/rooms
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-10-27 10:12:58 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-10-27 10:12:58 -0400
commitcf638697c17ec186b5da88ea92fc005371c9eab7 (patch)
tree14e0968de95350d72a4f6e8f4384e47d8a97d8a5 /data/maps/the_digital/rooms
parent9cff6398c142822325154633e24d033a591b217e (diff)
downloadlingo2-archipelago-cf638697c17ec186b5da88ea92fc005371c9eab7.tar.gz
lingo2-archipelago-cf638697c17ec186b5da88ea92fc005371c9eab7.tar.bz2
lingo2-archipelago-cf638697c17ec186b5da88ea92fc005371c9eab7.zip
Assign stable IDs for shuffleable worldports
Diffstat (limited to 'data/maps/the_digital/rooms')
0 files changed, 0 insertions, 0 deletions
>
9bd863c ^
6746da6 ^
9bd863c ^
6746da6 ^
eef5de6 ^
6746da6 ^
9bd863c ^
6746da6 ^
9bd863c ^









































































eef5de6 ^
9bd863c ^
eef5de6 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

                    
                   

                  
 
                                                 
 
                                                                    
 
                                                                         
 
                                                                                                                       
 
                                                                              
   
                                     
 
                                            









































































                                                                                         
   
 
  
#include "frame.h"
#include <sqlite3.h>
#include <json.hpp>

namespace verbly {

  const object frame::objectType = object::frame;

  const std::list<std::string> frame::select = {"frame_id", "data"};

  const field frame::id = field::integerField(object::frame, "frame_id");

  const field frame::group = field::joinThrough(object::frame, "frame_id", object::group, "groups_frames", "group_id");

  frame::frame(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true)
  {
    id_ = sqlite3_column_int(row, 0);

    // TODO: Initialize frame data from row.
    std::string partsJsonStr(reinterpret_cast<const char*>(sqlite3_column_blob(row, 1)));
    nlohmann::json partsJson = nlohmann::json::parse(std::move(partsJsonStr));

    for (const nlohmann::json& partJson : partsJson)
    {
      part::type partType = static_cast<part::type>(partJson["type"].get<int>());

      switch (partType)
      {
        case part::type::noun_phrase:
        {
          std::set<std::string> synrestrs;
          for (const nlohmann::json& synrestrJson : partJson["synrestrs"])
          {
            synrestrs.insert(synrestrJson.get<std::string>());
          }

          parts_.push_back(part::createNounPhrase(
            partJson["role"].get<std::string>(),
            selrestr(partJson["selrestrs"]),
            std::move(synrestrs)));

          break;
        }

        case part::type::preposition:
        {
          std::vector<std::string> choices;
          for (const nlohmann::json& choiceJson : partJson["choices"])
          {
            choices.push_back(choiceJson.get<std::string>());
          }

          parts_.push_back(part::createPreposition(
            std::move(choices),
            partJson["literal"].get<bool>()));

          break;
        }

        case part::type::verb:
        {
          parts_.push_back(part::createVerb());

          break;
        }

        case part::type::adjective:
        {
          parts_.push_back(part::createAdjective());

          break;
        }

        case part::type::adverb:
        {
          parts_.push_back(part::createAdverb());

          break;
        }

        case part::type::literal:
        {
          parts_.push_back(part::createLiteral(partJson["value"].get<std::string>()));

          break;
        }

        case part::type::invalid:
        {
          throw std::domain_error("Invalid part data");
        }
      }
    }
  }

};