From cbd154a4834f56146dbe744ee2d2c6dccc04c5cb Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 5 Jan 2017 07:31:32 -0500 Subject: todo finder --- .gitignore | 1 + include/components.hpp | 7 ++++++- src/components.cpp | 15 ++++++++++++++- src/world.cpp | 2 ++ todo.sh | 27 +++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 todo.sh diff --git a/.gitignore b/.gitignore index 4398992..d913368 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ xml/*.dat brice.dat config/settings.xml setup.mk +TODOS diff --git a/include/components.hpp b/include/components.hpp index 5c067dd..5bafa02 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -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. diff --git a/src/components.cpp b/src/components.cpp index 7322208..140d02b 100644 --- a/src/components.cpp +++ b/src/components.cpp @@ -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()) { auto& countdown = entity.component()->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 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()) diff --git a/src/world.cpp b/src/world.cpp index 6b18542..b10edac 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -375,6 +375,8 @@ void WorldSystem::load(const std::string& file) entity.assign(); } else if (tname == "Wander") { entity.assign(); + } else if (tname == "Hop" ) { + entity.assign(); } else if (tname == "Animation") { auto entan = entity.assign(); auto animx = abcd->FirstChildElement(); diff --git a/todo.sh b/todo.sh new file mode 100755 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." -- cgit v1.2.3