]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
todo finder
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 5 Jan 2017 12:31:32 +0000 (07:31 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 5 Jan 2017 12:31:32 +0000 (07:31 -0500)
.gitignore
include/components.hpp
src/components.cpp
src/world.cpp
todo.sh [new file with mode: 0755]

index 43989929c9390e89781d7d1bffcbc0a4625bddd3..d913368eda2d376a74a2d6f66f94e5a1275d41ad 100644 (file)
@@ -5,3 +5,4 @@ xml/*.dat
 brice.dat\r
 config/settings.xml\r
 setup.mk\r
+TODOS\r
index 5c067dd24717c80241b2d75ede544d634a95686c..5bafa0243315332db968d8967e9d8221c0e643d6 100644 (file)
@@ -295,7 +295,12 @@ struct Dialog {
 /**
  * Causes the entity to hop around.
  */
-struct Hop {}; // TODO require wander, for range?
+struct Hop {
+       Hop(float r = 0)
+               : hopRatio(r) {}
+
+       float hopRatio;
+};
 
 /**
  * Causes the entity to wander about.
index 7322208386fa64ed8108bdf4c6913e4b6eb18260..140d02bd3a98d99567039a80b730de0c1210a268 100644 (file)
@@ -35,6 +35,8 @@ void MovementSystem::update(entityx::EntityManager &en, entityx::EventManager &e
                                        fl = (direction.x < 0);
                        }
 
+                       // make the entity wander
+                       // TODO initialX and range?
                        if (entity.has_component<Wander>()) {
                                auto& countdown = entity.component<Wander>()->countdown;
 
@@ -226,6 +228,17 @@ void DialogSystem::receive(const MouseClickEvent &mce)
                                                        } while((qxml = qxml->NextSiblingElement()));
                                                }
 
+                                               auto xxml = exml->FirstChildElement("option");
+                                               std::string options;
+                                               std::vector<int> optionNexts;
+                                               if (xxml != nullptr) {
+                                                       do {
+                                                               options += '\"' + xxml->StrAttribute("name");
+                                                               optionNexts.emplace_back(xxml->IntAttribute("value"));
+                                                               xxml = xxml->NextSiblingElement();
+                                                       } while (xxml != nullptr);
+                                               }
+
                                                auto cxml = exml->FirstChildElement("content");
                                                const char *content;
                                                if (cxml == nullptr) {
@@ -235,7 +248,7 @@ void DialogSystem::receive(const MouseClickEvent &mce)
                                                        while (*++content && isspace(*content));
                                                }
 
-                                               ui::dialogBox(name.name, "", false, content);
+                                               ui::dialogBox(name.name, options, false, content);
                                                ui::waitForDialog();
 
                                                if (!questAssignedText.empty())
index 6b1854207bd4e22436c610e5290876af10bbb9e3..b10edacbc1650e9294d66239f1473e11b03ac093 100644 (file)
@@ -375,6 +375,8 @@ void WorldSystem::load(const std::string& file)
                                                entity.assign<Grounded>();
                                        } else if (tname == "Wander") {
                                                entity.assign<Wander>();
+                                       } else if (tname == "Hop" ) {
+                                               entity.assign<Hop>();
                                        } else if (tname == "Animation") {
                                                auto entan = entity.assign<Animate>();
                                                auto animx = abcd->FirstChildElement();
diff --git a/todo.sh b/todo.sh
new file mode 100755 (executable)
index 0000000..5f053a2
--- /dev/null
+++ b/todo.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+#
+# Searches for all TODOs and tosses them in a file.
+#
+TODO_COUNT=0
+rm -f TODOS
+touch TODOS
+for file in include/*.hpp
+do
+       echo "########################################" >> TODOS
+       echo $file >> TODOS
+       echo "========================================" >> TODOS
+       grep -n -B 5 -A 5 "TODO" $file | sed s/--/========================================/g >> TODOS
+       TODO_COUNT=$((TODO_COUNT+$(grep -c "TODO" $file)))
+done
+
+for file in src/*.cpp
+do
+       echo "########################################" >> TODOS
+       echo $file >> TODOS
+       echo "========================================" >> TODOS
+       grep -n -B 5 -A 5 "TODO" $file | sed s/--/========================================/g >> TODOS
+       TODO_COUNT=$((TODO_COUNT+$(grep -c "TODO" $file)))
+done
+
+echo "Found" $TODO_COUNT "TODOs."