summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/speechbubble.cpp7
-rw-r--r--src/gui/speechbubble.h2
-rw-r--r--src/gui/textbox.cpp31
-rw-r--r--src/main.cpp14
-rw-r--r--src/net/beinghandler.cpp28
-rw-r--r--src/net/protocol.h2
-rw-r--r--src/player.h9
-rw-r--r--src/resources/itemdb.cpp14
8 files changed, 67 insertions, 40 deletions
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index c5c653e7..0ccbebc0 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -59,8 +59,13 @@ SpeechBubble::SpeechBubble()//:
mSpeechBox->setTextWrapped( "" );
}
-void SpeechBubble::setText(const std::string mText)
+void SpeechBubble::setText(std::string mText)
{
+ while (mText[0] == ' ')
+ {
+ mText = mText.substr(1, mText.size());
+ }
+
mSpeechBox->setMinWidth(140);
mSpeechBox->setTextWrapped( mText );
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index c4ca9109..7a2a73b8 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -35,7 +35,7 @@ class SpeechBubble : public Window
SpeechBubble();
- void setText(const std::string mText);
+ void setText(std::string mText);
void setLocation(int x, int y);
unsigned int getNumRows();
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index 1a689ad5..f2d9b6ee 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -92,13 +92,31 @@ void TextBox::setTextWrapped(const std::string &text)
if (xpos > minWidth)
{
minWidth = xpos;
- if (minWidth > mMinWidth)
- {
- mMinWidth = minWidth;
- }
+ }
+ // The window wasn't big enough. Resize it and try again.
+ if (minWidth > mMinWidth)
+ {
+ mMinWidth = minWidth;
+ // This is a reaaaly ugly hack for getting the string stream
+ // to clear itself. Don't mess with the spacer in the stream
+ // reset, as well as removing the break. These are all there
+ // because there are several compilers that I have tried
+ // that do not properly reset the string stream.
+ // You have been warned!
+ wrappedStream.str(" ");
+ spacePos = 0;
+ lastNewlinePos = 0;
+ newlinePos = text.find("\n", lastNewlinePos);
+ line = text.substr(lastNewlinePos, newlinePos -
+ lastNewlinePos);
+ width = 0;
+ break;
+ }
+ else
+ {
+ wrappedStream << "\n" << word;
}
xpos = width;
- wrappedStream << "\n" << word;
}
lastSpacePos = spacePos + 1;
}
@@ -116,9 +134,10 @@ void TextBox::setTextWrapped(const std::string &text)
{
minWidth = xpos;
}
+ mMinWidth = minWidth;
if (minWidth > mMinWidth)
{
- mMinWidth = minWidth;
+ setTextWrapped(text);
}
gcn::TextBox::setText(wrappedStream.str());
diff --git a/src/main.cpp b/src/main.cpp
index 4427b4d4..f9061c42 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -163,6 +163,8 @@ struct Options
*/
void setUpdatesDir()
{
+ std::stringstream updates;
+
// If updatesHost is currently empty, fill it from config file
if (updateHost.empty()) {
updateHost =
@@ -174,8 +176,9 @@ void setUpdatesDir()
pos = updateHost.find("://");
if (pos != updateHost.npos) {
if (pos + 3 < updateHost.length()) {
- updatesDir =
- "updates/" + updateHost.substr(pos + 3);
+ updates << "updates/" << updateHost.substr(pos + 3)
+ << "-" << loginData.port;
+ updatesDir = updates.str();
} else {
logger->log("Error: Invalid update host: %s", updateHost.c_str());
errorMessage = "Invalid update host: " + updateHost;
@@ -183,7 +186,8 @@ void setUpdatesDir()
}
} else {
logger->log("Warning: no protocol was specified for the update host");
- updatesDir = "updates/" + updateHost;
+ updates << "updates/" << updateHost << "-" << loginData.port;
+ updatesDir = updates.str();
}
ResourceManager *resman = ResourceManager::getInstance();
@@ -708,8 +712,8 @@ int main(int argc, char *argv[])
if (!options.password.empty()) {
loginData.password = options.password;
}
- loginData.hostname = config.getValue("host", "216.139.126.36");
- loginData.port = (short)config.getValue("port", 0);
+ loginData.hostname = config.getValue("host", "www.aethyra.org");
+ loginData.port = (short)config.getValue("port", 21001);
loginData.remember = config.getValue("remember", 0);
loginData.registerLogin = false;
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 87e4c8a4..baca0cfc 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -51,7 +51,7 @@ BeingHandler::BeingHandler(bool enableSync):
SMSG_BEING_MOVE2,
SMSG_BEING_REMOVE,
SMSG_BEING_ACTION,
- SMSG_BEING_LEVELUP,
+ SMSG_BEING_SELFEFFECT,
SMSG_BEING_EMOTION,
SMSG_BEING_CHANGE_LOOKS,
SMSG_BEING_CHANGE_LOOKS2,
@@ -263,27 +263,17 @@ void BeingHandler::handleMessage(MessageIn *msg)
}
break;
- case SMSG_BEING_LEVELUP:
+ case SMSG_BEING_SELFEFFECT: {
id = (Uint32)msg->readInt32();
+ if (!beingManager->findBeing(id))
+ break;
+
+ int effectType = msg->readInt32();
+
+ beingManager->findBeing(id)->triggerEffect(effectType);
- if (id == player_node->getId()) {
- logger->log("Level up");
- sound.playSfx("sfx/levelup.ogg");
- }
- else {
- logger->log("Someone else went level up");
- }
- Particle *levelupFX;
- if (msg->readInt32() == 0) { // type
- levelupFX = particleEngine->addEffect(
- "graphics/particles/levelup.particle.xml", 0, 0);
- }
- else {
- levelupFX = particleEngine->addEffect(
- "graphics/particles/skillup.particle.xml", 0, 0);
- }
- beingManager->findBeing(id)->controlParticle(levelupFX);
break;
+ }
case SMSG_BEING_EMOTION:
if (!(dstBeing = beingManager->findBeing(msg->readInt32())))
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 7d5edf94..5e1d3c62 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -65,7 +65,7 @@
#define SMSG_BEING_REMOVE 0x0080
#define SMSG_BEING_CHANGE_LOOKS 0x00c3
#define SMSG_BEING_CHANGE_LOOKS2 0x01d7 /**< Same as 0x00c3, but 16 bit ID */
-#define SMSG_BEING_LEVELUP 0x019b
+#define SMSG_BEING_SELFEFFECT 0x019b
#define SMSG_BEING_EMOTION 0x00c0
#define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */
#define SMSG_BEING_CHAT 0x008d /**< A being talks */
diff --git a/src/player.h b/src/player.h
index fdca64e8..6def34a5 100644
--- a/src/player.h
+++ b/src/player.h
@@ -79,6 +79,15 @@ class Player : public Being
* Flash the player's name
*/
void flash(int time);
+
+ /**
+ * Triggers a visual/audio effect, such as `level up'
+ *
+ * \param effect_id ID of the effect to trigger
+ */
+ virtual void
+ triggerEffect(int effectId) { internalTriggerEffect(effectId, true, true); }
+
protected:
void updateCoords();
private:
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 4d78aa1c..fbab5380 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -84,14 +84,14 @@ void ItemDB::load()
}
int type = XML::getProperty(node, "type", 0);
- int weight = XML::getProperty(node, "weight", 0);
+ //int weight = XML::getProperty(node, "weight", 0);
int view = XML::getProperty(node, "view", 0);
std::string name = XML::getProperty(node, "name", "");
std::string image = XML::getProperty(node, "image", "");
std::string description = XML::getProperty(node, "description", "");
- std::string effect = XML::getProperty(node, "effect", "");
- int weaponType = XML::getProperty(node, "weapon_type", 0);
+ //std::string effect = XML::getProperty(node, "effect", ""); // Not used by Aethyra
+ //int weaponType = XML::getProperty(node, "weapon_type", 0);
if (id)
{
@@ -99,11 +99,11 @@ void ItemDB::load()
itemInfo->setImageName(image);
itemInfo->setName((name == "") ? "Unnamed" : name);
itemInfo->setDescription(description);
- itemInfo->setEffect(effect);
+ //itemInfo->setEffect(effect);
itemInfo->setType(type);
itemInfo->setView(view);
- itemInfo->setWeight(weight);
- itemInfo->setWeaponType(weaponType);
+ //itemInfo->setWeight(weight);
+ //itemInfo->setWeaponType(weaponType);
for_each_xml_child_node(itemChild, node)
{
@@ -127,7 +127,7 @@ void ItemDB::load()
CHECK_PARAM(name, "");
CHECK_PARAM(image, "");
CHECK_PARAM(description, "");
- CHECK_PARAM(effect, "");
+ //CHECK_PARAM(effect, "");
// CHECK_PARAM(type, 0);
// CHECK_PARAM(weight, 0);
// CHECK_PARAM(slot, 0);