diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | data/help/Makefile.am | 3 | ||||
-rw-r--r-- | data/help/accounts.txt | 17 | ||||
-rw-r--r-- | data/help/index.txt | 1 | ||||
-rw-r--r-- | src/gui/help.cpp | 43 | ||||
-rw-r--r-- | src/gui/help.h | 10 |
7 files changed, 32 insertions, 46 deletions
@@ -6,6 +6,7 @@ - Added button to show/hide equipment window - Added framerate limiter to config options - Added ability to auto attack +- Added in-game help window - Upgraded to Guichan 0.4.0 - Dialogs are now modal when appropriate - Fixed a crash in OpenGL mode @@ -1,7 +1,7 @@ THE MANA WORLD ============== - Version: 0.0.12 Date: 1/5/2005 + Version: 0.0.13 Date: 5/6/2005 Development team: @@ -38,6 +38,7 @@ over NPC's feet to talk to them or over a monster to attack it. Other keys: - Left Ctrl attack - Alt + 0-9 show emotions +- F1 show the online help - F5 sit down / stand up - F6 toggle debug pathfinding feature - F7 play test sound diff --git a/data/help/Makefile.am b/data/help/Makefile.am index 1ddd7d11..4c52f26c 100644 --- a/data/help/Makefile.am +++ b/data/help/Makefile.am @@ -2,9 +2,8 @@ helpdir = $(pkgdatadir)/data/help help_DATA = \ - accounts.txt \ changes.txt \ - commands.txt \ + commands.txt \ index.txt \ skills.txt \ support.txt \ diff --git a/data/help/accounts.txt b/data/help/accounts.txt deleted file mode 100644 index d6308fe8..00000000 --- a/data/help/accounts.txt +++ /dev/null @@ -1,17 +0,0 @@ - T H E M A N A W O R L D - ========================================== - - Version: 0.0.13 Date: 5 June 2005 - - Website: http://themanaworld.org - - -@index-> Back to Index - - - === ACCOUNTS === - - To create an account, add "_M" after your username when you login for - the first time and enter a password of your choice. - - Remember that the server is only for demo and development purposes. diff --git a/data/help/index.txt b/data/help/index.txt index 5f29e76b..a6eb81df 100644 --- a/data/help/index.txt +++ b/data/help/index.txt @@ -10,7 +10,6 @@ @team-> Development team @changes-> Recent Changes -@accounts-> Accounts @commands-> Commands @skills-> Skills @support-> Support diff --git a/src/gui/help.cpp b/src/gui/help.cpp index d1e13174..515ff96a 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -22,6 +22,9 @@ */ #include "help.h" +#include "scrollarea.h" +#include "button.h" +#include "textbox.h" #include "../main.h" #include <fstream> @@ -29,7 +32,7 @@ HelpWindow::HelpWindow(): Window("Help") { setContentSize(455, 350); - + textBox = new TextBox(); textBox->setEditable(false); scrollArea = new ScrollArea(textBox); @@ -57,7 +60,6 @@ HelpWindow::~HelpWindow() delete textBox; delete scrollArea; links.clear(); - } void HelpWindow::action(const std::string& eventId) @@ -69,13 +71,13 @@ void HelpWindow::mousePress(int mx, int my, int button) { getParent()->moveToTop(this); - if (button == gcn::MouseInput::LEFT) { - + if (button == gcn::MouseInput::LEFT) + { int x1 = scrollArea->getX() + 10; int y1 = scrollArea->getY() + 15; int x2 = x1 + scrollArea->getWidth() - 25; int y2 = y1 + scrollArea->getHeight(); - + if ((mx >= x1) && (my >= y1) && (mx <= x2) && (my <= y2)) { for (unsigned int i = 0; i < links.size(); i++) @@ -83,8 +85,9 @@ void HelpWindow::mousePress(int mx, int my, int button) int y1 = links[i].yPos * textBox->getFont()->getHeight() + 5 - scrollArea->getVerticalScrollAmount(); int y2 = y1 + textBox->getFont()->getHeight(); - if ((my > y1) && (my < y2)) { - std::string tmp = links[i].file; + + if ((my > y1) && (my < y2)) + { loadHelp(links[i].file); } } @@ -95,20 +98,21 @@ void HelpWindow::mousePress(int mx, int my, int button) mMouseXOffset = mx; mMouseYOffset = my; } - } + } } -void HelpWindow::loadHelp(std::string helpFile) { - helpFile = TMW_DATADIR "data/help/" + helpFile + ".txt"; - +void HelpWindow::loadHelp(const std::string &helpFile) +{ + std::string helpPath = TMW_DATADIR "data/help/" + helpFile + ".txt"; + std::ifstream fin; - fin.open(helpFile.c_str()); + fin.open(helpPath.c_str()); if (fin.fail()) { - logger->log("Couldn't load help file: %s", helpFile.c_str()); + logger->log("Couldn't load help file: %s", helpPath.c_str()); return; } - + links.clear(); textBox->setText(""); @@ -116,23 +120,24 @@ void HelpWindow::loadHelp(std::string helpFile) { { std::string line = ""; getline(fin, line); - + // Check for links if (line.substr(0, 1) == "@") - { + { int idx = line.find("->"); HELP_LINK hlink; hlink.yPos = textBox->getNumberOfRows() + 1; hlink.file = line.substr(1, idx - 1); links.push_back(hlink); - + line = " " + line.erase(0, idx); } - + textBox->addRow(line); } + scrollArea->setVerticalScrollAmount(0); setVisible(true); - fin.close(); + fin.close(); } diff --git a/src/gui/help.h b/src/gui/help.h index 6c6bec13..366bd418 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -24,10 +24,8 @@ #ifndef _TMW_HELP_H #define _TMW_HELP_H +#include <guichan.hpp> #include "window.h" -#include "scrollarea.h" -#include "button.h" -#include "textbox.h" struct HELP_LINK { int yPos; @@ -63,13 +61,13 @@ class HelpWindow : public Window, public gcn::ActionListener /** * Load help in the dialog. */ - void loadHelp(std::string helpFile); + void loadHelp(const std::string &helpFile); private: - std::vector<HELP_LINK> links; + std::vector<HELP_LINK> links; gcn::Button *okButton; gcn::TextBox *textBox; - ScrollArea *scrollArea; + gcn::ScrollArea *scrollArea; }; #endif |