summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aethyra.cbp10
-rw-r--r--src/main.cpp48
-rw-r--r--src/recorder.h20
-rw-r--r--src/resources/resourcemanager.cpp4
4 files changed, 59 insertions, 23 deletions
diff --git a/aethyra.cbp b/aethyra.cbp
index 68d4a609..633cea8d 100644
--- a/aethyra.cbp
+++ b/aethyra.cbp
@@ -159,8 +159,8 @@
<Unit filename="src\gui\gui.h" />
<Unit filename="src\gui\help.cpp" />
<Unit filename="src\gui\help.h" />
- <Unit filename="src\gui\inttextbox.cpp" />
- <Unit filename="src\gui\inttextbox.h" />
+ <Unit filename="src\gui\inttextfield.cpp" />
+ <Unit filename="src\gui\inttextfield.h" />
<Unit filename="src\gui\inventorywindow.cpp" />
<Unit filename="src\gui\inventorywindow.h" />
<Unit filename="src\gui\item_amount.cpp" />
@@ -184,8 +184,12 @@
<Unit filename="src\gui\ministatus.h" />
<Unit filename="src\gui\npc_text.cpp" />
<Unit filename="src\gui\npc_text.h" />
+ <Unit filename="src\gui\npcintegerdialog.cpp" />
+ <Unit filename="src\gui\npcintegerdialog.h" />
<Unit filename="src\gui\npclistdialog.cpp" />
<Unit filename="src\gui\npclistdialog.h" />
+ <Unit filename="src\gui\npcstringdialog.cpp" />
+ <Unit filename="src\gui\npcstringdialog.h" />
<Unit filename="src\gui\ok_dialog.cpp" />
<Unit filename="src\gui\ok_dialog.h" />
<Unit filename="src\gui\passwordfield.cpp" />
@@ -257,6 +261,8 @@
<Unit filename="src\gui\widgets\dropdown.h" />
<Unit filename="src\gui\widgets\layout.cpp" />
<Unit filename="src\gui\widgets\layout.h" />
+ <Unit filename="src\gui\widgets\layouthelper.cpp" />
+ <Unit filename="src\gui\widgets\layouthelper.h" />
<Unit filename="src\gui\widgets\resizegrip.cpp" />
<Unit filename="src\gui\widgets\resizegrip.h" />
<Unit filename="src\gui\widgets\tab.cpp" />
diff --git a/src/main.cpp b/src/main.cpp
index ea120fc4..a0066c66 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -101,7 +101,8 @@
#include <sys/stat.h>
#endif
-namespace {
+namespace
+{
Window *setupWindow = 0;
struct SetupListener : public gcn::ActionListener
@@ -186,7 +187,8 @@ void setUpdatesDir()
std::stringstream updates;
// If updatesHost is currently empty, fill it from config file
- if (updateHost.empty()) {
+ if (updateHost.empty())
+ {
updateHost =
config.getValue("updatehost", "http://www.aethyra.org/updates");
}
@@ -198,31 +200,59 @@ void setUpdatesDir()
// Parse out any "http://" or "ftp://", and set the updates directory
size_t pos;
pos = updateHost.find("://");
- if (pos != updateHost.npos) {
- if (pos + 3 < updateHost.length()) {
+ if (pos != updateHost.npos)
+ {
+ if (pos + 3 < updateHost.length())
+ {
updates << "updates/" << updateHost.substr(pos + 3)
<< "/" << loginData.port;
updatesDir = updates.str();
- } else {
+ }
+ else
+ {
logger->log(_("Error: Invalid update host: %s"), updateHost.c_str());
errorMessage = _("Invalid update host: ") + updateHost;
state = ERROR_STATE;
}
- } else {
+ }
+ else
+ {
logger->log(_("Warning: no protocol was specified for the update host"));
- updates << "updates/" << updateHost << "/" << loginData.port;
+ updates << "updates/" << updateHost << "/" << loginData.port;
updatesDir = updates.str();
}
ResourceManager *resman = ResourceManager::getInstance();
// Verify that the updates directory exists. Create if necessary.
- if (!resman->isDirectory("/" + updatesDir)) {
- if (!resman->mkdir("/" + updatesDir)) {
+ if (!resman->isDirectory("/" + updatesDir))
+ {
+ if (!resman->mkdir("/" + updatesDir))
+ {
+#if defined WIN32
+ std::string newDir = homeDir + "\\" + updatesDir;
+ std::string::size_type loc = newDir.find("/", 0);
+
+ while (loc != std::string::npos)
+ {
+ newDir.replace(loc, 1, "\\");
+ loc = newDir.find("/", loc);
+ }
+
+ if (!CreateDirectory(newDir.c_str(), 0) &&
+ GetLastError() != ERROR_ALREADY_EXISTS)
+ {
+ logger->log(_("Error: %s can't be made, but doesn't exist!"),
+ newDir.c_str());
+ errorMessage = _("Error creating updates directory!");
+ state = ERROR_STATE;
+ }
+#else
logger->log(_("Error: %s/%s can't be made, but doesn't exist!"),
homeDir.c_str(), updatesDir.c_str());
errorMessage = _("Error creating updates directory!");
state = ERROR_STATE;
+#endif
}
}
}
diff --git a/src/recorder.h b/src/recorder.h
index fe49810f..eeaf4821 100644
--- a/src/recorder.h
+++ b/src/recorder.h
@@ -31,18 +31,18 @@ class ChatWindow;
class Recorder : public ButtonBoxListener
{
+ private:
+ ChatWindow *mChat;
+ std::ofstream mStream;
+ ButtonBox *mButtonBox;
public:
Recorder(ChatWindow *chat);
- void record(const std::string &msg);
- void respond(const std::string &msg);
- void help() const;
- void help(const std::string &args) const;
- void buttonBoxRespond();
- bool isRecording() const {return mStream.is_open();}
+ void record(const std::string &msg);
+ void respond(const std::string &msg);
+ void help() const;
+ void help(const std::string &args) const;
+ void buttonBoxRespond();
+ bool isRecording() {return (bool) mStream.is_open();}
virtual ~Recorder();
- private:
- ChatWindow *mChat;
- std::ofstream mStream;
- ButtonBox *mButtonBox;
};
#endif
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 99b84506..7f2cba1d 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -153,8 +153,8 @@ bool ResourceManager::addToSearchPath(const std::string &path, bool append)
}
void ResourceManager::searchAndAddArchives(const std::string &path,
- const std::string &ext,
- bool append)
+ const std::string &ext,
+ bool append)
{
const char *dirSep = PHYSFS_getDirSeparator();
char **list = PHYSFS_enumerateFiles(path.c_str());