diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | dialogue.cpp | 33 | ||||
m--------- | vendor/rawr-ebooks | 0 |
3 files changed, 25 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fe3ba2..f563ae5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | cmake_minimum_required (VERSION 3.1) | 1 | cmake_minimum_required (VERSION 3.1) |
2 | project (rawr-ebooks) | 2 | project (rawr-ebooks) |
3 | 3 | ||
4 | add_subdirectory(vendor/rawr-ebooks) | 4 | add_subdirectory(vendor/rawr-ebooks EXCLUDE_FROM_ALL) |
5 | 5 | ||
6 | include_directories(vendor/rawr-ebooks) | 6 | include_directories(vendor/rawr-ebooks) |
7 | 7 | ||
diff --git a/dialogue.cpp b/dialogue.cpp index dd34ee5..0e0c7bc 100644 --- a/dialogue.cpp +++ b/dialogue.cpp | |||
@@ -81,32 +81,47 @@ int main(int, char**) | |||
81 | 81 | ||
82 | for (;;) | 82 | for (;;) |
83 | { | 83 | { |
84 | std::set<speaker_id> pastSpeakers; | ||
85 | |||
86 | |||
84 | speaker_id curSpeaker = allSpeakers.next(); | 87 | speaker_id curSpeaker = allSpeakers.next(); |
85 | 88 | ||
86 | std::ostringstream theEnd; | 89 | std::ostringstream theEnd; |
90 | int maxLines = rand() % 4 + 3; | ||
87 | 91 | ||
88 | for (int i = 0; i < 5; i++) | 92 | for (int i = 0; i < maxLines; i++) |
89 | { | 93 | { |
90 | speaker_data& curSd = speakerData.at(curSpeaker); | 94 | pastSpeakers.insert(curSpeaker); |
91 | 95 | ||
92 | //std::ostringstream thisLine; | 96 | speaker_data& curSd = speakerData.at(curSpeaker); |
93 | 97 | ||
94 | if (curSd.name != "") | 98 | if (curSd.name != "") |
95 | { | 99 | { |
96 | theEnd << curSd.name << ": "; | 100 | theEnd << curSd.name << ": "; |
97 | } | 101 | } |
98 | 102 | ||
99 | theEnd << curSd.chain.randomSentence(1); | 103 | std::string curLine = curSd.chain.randomSentence(rand() % 30 + 1); |
100 | 104 | ||
101 | /*if (i > 0 && theEnd.str().length() + thisLine.str().length() > 280) | 105 | if (curSd.name == "" && |
106 | curLine[0] != '[' && | ||
107 | curLine[0] != '(' && | ||
108 | curLine[0] != '*') | ||
102 | { | 109 | { |
103 | break; | 110 | theEnd << "[" << curLine << "]"; |
104 | }*/ | 111 | } else { |
112 | theEnd << curLine; | ||
113 | } | ||
105 | 114 | ||
106 | theEnd << std::endl; | 115 | theEnd << std::endl; |
107 | //theEnd << thisLine.str(); | ||
108 | 116 | ||
109 | curSpeaker = curSd.nextSpeaker.next(); | 117 | speaker_id repeatSpeaker = *std::next(std::begin(pastSpeakers), rand() % pastSpeakers.size()); |
118 | if (repeatSpeaker != curSpeaker && | ||
119 | rand() % 3 == 0) | ||
120 | { | ||
121 | curSpeaker = repeatSpeaker; | ||
122 | } else { | ||
123 | curSpeaker = curSd.nextSpeaker.next(); | ||
124 | } | ||
110 | } | 125 | } |
111 | 126 | ||
112 | std::string output = theEnd.str(); | 127 | std::string output = theEnd.str(); |
diff --git a/vendor/rawr-ebooks b/vendor/rawr-ebooks | |||
Subproject d75685e69f9a5d3cfc255aa921005fc40ae6e58 | Subproject 1890eb5d4a496aea5e9114550081ca63bd280f3 | ||