summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt12
-rw-r--r--src/Makefile.am26
-rw-r--r--[-rwxr-xr-x]src/SDLMain.h0
-rw-r--r--[-rwxr-xr-x]src/SDLMain.m0
-rw-r--r--src/animatedsprite.cpp5
-rw-r--r--src/animatedsprite.h8
-rw-r--r--src/animationparticle.cpp5
-rw-r--r--src/animationparticle.h5
-rw-r--r--src/being.cpp255
-rw-r--r--src/being.h103
-rw-r--r--src/beingmanager.cpp8
-rw-r--r--src/beingmanager.h5
-rw-r--r--src/configlistener.h5
-rw-r--r--src/configuration.cpp14
-rw-r--r--src/configuration.h18
-rw-r--r--src/effectmanager.cpp3
-rw-r--r--src/effectmanager.h3
-rw-r--r--src/emoteshortcut.cpp3
-rw-r--r--src/emoteshortcut.h3
-rw-r--r--src/engine.cpp5
-rw-r--r--src/engine.h3
-rw-r--r--src/equipment.cpp5
-rw-r--r--src/equipment.h5
-rw-r--r--src/floor_item.cpp11
-rw-r--r--src/floor_item.h11
-rw-r--r--src/flooritemmanager.cpp8
-rw-r--r--src/flooritemmanager.h3
-rw-r--r--src/game.cpp172
-rw-r--r--src/game.h7
-rw-r--r--src/graphics.cpp5
-rw-r--r--src/graphics.h5
-rw-r--r--src/gui/browserbox.cpp5
-rw-r--r--src/gui/browserbox.h5
-rw-r--r--src/gui/button.cpp5
-rw-r--r--src/gui/button.h5
-rw-r--r--src/gui/buy.cpp24
-rw-r--r--src/gui/buy.h10
-rw-r--r--src/gui/buysell.cpp12
-rw-r--r--src/gui/buysell.h8
-rw-r--r--src/gui/char_select.cpp30
-rw-r--r--src/gui/char_select.h7
-rw-r--r--src/gui/char_server.cpp9
-rw-r--r--src/gui/char_server.h5
-rw-r--r--src/gui/chat.cpp32
-rw-r--r--src/gui/chat.h10
-rw-r--r--src/gui/chatinput.cpp5
-rw-r--r--src/gui/chatinput.h5
-rw-r--r--src/gui/checkbox.cpp5
-rw-r--r--src/gui/checkbox.h5
-rw-r--r--src/gui/confirm_dialog.cpp9
-rw-r--r--src/gui/confirm_dialog.h6
-rw-r--r--src/gui/connection.cpp7
-rw-r--r--src/gui/connection.h5
-rw-r--r--src/gui/debugwindow.cpp5
-rw-r--r--src/gui/debugwindow.h5
-rw-r--r--src/gui/emotecontainer.cpp3
-rw-r--r--src/gui/emotecontainer.h3
-rw-r--r--src/gui/emoteshortcutcontainer.cpp3
-rw-r--r--src/gui/emoteshortcutcontainer.h3
-rw-r--r--src/gui/emotewindow.cpp6
-rw-r--r--src/gui/emotewindow.h2
-rw-r--r--src/gui/equipmentwindow.cpp9
-rw-r--r--src/gui/equipmentwindow.h19
-rw-r--r--src/gui/focushandler.cpp5
-rw-r--r--src/gui/focushandler.h5
-rw-r--r--src/gui/gccontainer.cpp5
-rw-r--r--src/gui/gccontainer.h5
-rw-r--r--src/gui/gui.cpp9
-rw-r--r--src/gui/gui.h5
-rw-r--r--src/gui/help.cpp9
-rw-r--r--src/gui/help.h5
-rw-r--r--src/gui/inttextfield.cpp32
-rw-r--r--src/gui/inttextfield.h11
-rw-r--r--src/gui/inventorywindow.cpp25
-rw-r--r--src/gui/inventorywindow.h14
-rw-r--r--src/gui/item_amount.cpp5
-rw-r--r--src/gui/item_amount.h5
-rw-r--r--src/gui/itemcontainer.cpp11
-rw-r--r--src/gui/itemcontainer.h13
-rw-r--r--src/gui/itemlinkhandler.cpp13
-rw-r--r--src/gui/itemlinkhandler.h17
-rw-r--r--src/gui/itempopup.cpp21
-rw-r--r--src/gui/itempopup.h5
-rw-r--r--src/gui/itemshortcutcontainer.cpp9
-rw-r--r--src/gui/itemshortcutcontainer.h5
-rw-r--r--src/gui/linkhandler.h5
-rw-r--r--src/gui/listbox.cpp5
-rw-r--r--src/gui/listbox.h5
-rw-r--r--src/gui/login.cpp20
-rw-r--r--src/gui/login.h5
-rw-r--r--src/gui/menuwindow.cpp5
-rw-r--r--src/gui/menuwindow.h5
-rw-r--r--src/gui/minimap.cpp7
-rw-r--r--src/gui/minimap.h5
-rw-r--r--src/gui/ministatus.cpp61
-rw-r--r--src/gui/ministatus.h19
-rw-r--r--src/gui/npc_text.cpp58
-rw-r--r--src/gui/npc_text.h16
-rw-r--r--src/gui/npcintegerdialog.cpp43
-rw-r--r--src/gui/npcintegerdialog.h19
-rw-r--r--src/gui/npclistdialog.cpp35
-rw-r--r--src/gui/npclistdialog.h14
-rw-r--r--src/gui/npcstringdialog.cpp41
-rw-r--r--src/gui/npcstringdialog.h14
-rw-r--r--src/gui/ok_dialog.cpp11
-rw-r--r--src/gui/ok_dialog.h14
-rw-r--r--src/gui/palette.cpp16
-rw-r--r--src/gui/palette.h30
-rw-r--r--src/gui/passwordfield.cpp5
-rw-r--r--src/gui/passwordfield.h5
-rw-r--r--src/gui/playerbox.cpp5
-rw-r--r--src/gui/playerbox.h5
-rw-r--r--src/gui/popupmenu.cpp69
-rw-r--r--src/gui/popupmenu.h5
-rw-r--r--src/gui/progressbar.cpp5
-rw-r--r--src/gui/progressbar.h7
-rw-r--r--src/gui/radiobutton.cpp5
-rw-r--r--src/gui/radiobutton.h5
-rw-r--r--src/gui/recorder.cpp7
-rw-r--r--src/gui/recorder.h2
-rw-r--r--src/gui/register.cpp7
-rw-r--r--src/gui/register.h5
-rw-r--r--src/gui/scrollarea.cpp18
-rw-r--r--src/gui/scrollarea.h14
-rw-r--r--src/gui/sell.cpp28
-rw-r--r--src/gui/sell.h10
-rw-r--r--src/gui/setup.cpp7
-rw-r--r--src/gui/setup.h7
-rw-r--r--src/gui/setup_audio.cpp5
-rw-r--r--src/gui/setup_audio.h5
-rw-r--r--src/gui/setup_colors.cpp8
-rw-r--r--src/gui/setup_colors.h2
-rw-r--r--src/gui/setup_joystick.cpp5
-rw-r--r--src/gui/setup_joystick.h5
-rw-r--r--src/gui/setup_keyboard.cpp10
-rw-r--r--src/gui/setup_keyboard.h7
-rw-r--r--src/gui/setup_players.cpp39
-rw-r--r--src/gui/setup_players.h5
-rw-r--r--src/gui/setup_video.cpp19
-rw-r--r--src/gui/setup_video.h13
-rw-r--r--src/gui/setuptab.h5
-rw-r--r--src/gui/shop.cpp5
-rw-r--r--src/gui/shop.h5
-rw-r--r--src/gui/shoplistbox.cpp5
-rw-r--r--src/gui/shoplistbox.h5
-rw-r--r--src/gui/shortcutcontainer.cpp7
-rw-r--r--src/gui/shortcutcontainer.h11
-rw-r--r--src/gui/shortcutwindow.cpp7
-rw-r--r--src/gui/shortcutwindow.h7
-rw-r--r--src/gui/skill.cpp27
-rw-r--r--src/gui/skill.h7
-rw-r--r--src/gui/slider.cpp5
-rw-r--r--src/gui/slider.h5
-rw-r--r--src/gui/speechbubble.cpp9
-rw-r--r--src/gui/speechbubble.h7
-rw-r--r--src/gui/status.cpp134
-rw-r--r--src/gui/status.h11
-rw-r--r--src/gui/storagewindow.cpp2
-rw-r--r--src/gui/storagewindow.h3
-rw-r--r--src/gui/table.cpp51
-rw-r--r--src/gui/table.h42
-rw-r--r--src/gui/table_model.cpp21
-rw-r--r--src/gui/table_model.h40
-rw-r--r--src/gui/textbox.cpp5
-rw-r--r--src/gui/textbox.h5
-rw-r--r--src/gui/textfield.cpp5
-rw-r--r--src/gui/textfield.h5
-rw-r--r--src/gui/textrenderer.h5
-rw-r--r--src/gui/trade.cpp13
-rw-r--r--src/gui/trade.h5
-rw-r--r--src/gui/truetypefont.cpp26
-rw-r--r--src/gui/truetypefont.h15
-rw-r--r--src/gui/updatewindow.cpp11
-rw-r--r--src/gui/updatewindow.h5
-rw-r--r--src/gui/viewport.cpp16
-rw-r--r--src/gui/viewport.h5
-rw-r--r--src/gui/widgets/dropdown.cpp9
-rw-r--r--src/gui/widgets/dropdown.h7
-rw-r--r--src/gui/widgets/layout.cpp5
-rw-r--r--src/gui/widgets/layout.h5
-rw-r--r--src/gui/widgets/layouthelper.cpp5
-rw-r--r--src/gui/widgets/layouthelper.h5
-rw-r--r--src/gui/widgets/resizegrip.cpp5
-rw-r--r--src/gui/widgets/resizegrip.h5
-rw-r--r--src/gui/widgets/tab.cpp5
-rw-r--r--src/gui/widgets/tab.h5
-rw-r--r--src/gui/widgets/tabbedarea.cpp7
-rw-r--r--src/gui/widgets/tabbedarea.h5
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/textpreview.h2
-rw-r--r--src/gui/window.cpp21
-rw-r--r--src/gui/window.h21
-rw-r--r--src/gui/windowcontainer.cpp5
-rw-r--r--src/gui/windowcontainer.h5
-rw-r--r--src/guichanfwd.h5
-rw-r--r--src/imageparticle.cpp5
-rw-r--r--src/imageparticle.h5
-rw-r--r--src/inventory.cpp5
-rw-r--r--src/inventory.h5
-rw-r--r--src/item.cpp5
-rw-r--r--src/item.h5
-rw-r--r--src/itemshortcut.cpp5
-rw-r--r--src/itemshortcut.h5
-rw-r--r--src/joystick.cpp5
-rw-r--r--src/joystick.h5
-rw-r--r--src/keyboardconfig.cpp7
-rw-r--r--src/keyboardconfig.h7
-rw-r--r--src/localplayer.cpp104
-rw-r--r--src/localplayer.h11
-rw-r--r--src/lockedarray.h5
-rw-r--r--src/log.cpp5
-rw-r--r--src/log.h5
-rw-r--r--src/logindata.h5
-rw-r--r--src/main.cpp107
-rw-r--r--src/main.h5
-rw-r--r--src/map.cpp18
-rw-r--r--src/map.h5
-rw-r--r--src/monster.cpp5
-rw-r--r--src/monster.h5
-rw-r--r--src/net/beinghandler.cpp97
-rw-r--r--src/net/beinghandler.h5
-rw-r--r--src/net/buysellhandler.cpp5
-rw-r--r--src/net/buysellhandler.h5
-rw-r--r--src/net/charserverhandler.cpp5
-rw-r--r--src/net/charserverhandler.h5
-rw-r--r--src/net/chathandler.cpp5
-rw-r--r--src/net/chathandler.h5
-rw-r--r--src/net/equipmenthandler.cpp5
-rw-r--r--src/net/equipmenthandler.h5
-rw-r--r--src/net/inventoryhandler.cpp7
-rw-r--r--src/net/inventoryhandler.h5
-rw-r--r--src/net/itemhandler.cpp5
-rw-r--r--src/net/itemhandler.h5
-rw-r--r--src/net/loginhandler.cpp5
-rw-r--r--src/net/loginhandler.h5
-rw-r--r--src/net/maploginhandler.cpp5
-rw-r--r--src/net/maploginhandler.h5
-rw-r--r--src/net/messagehandler.cpp5
-rw-r--r--src/net/messagehandler.h5
-rw-r--r--src/net/messagein.cpp5
-rw-r--r--src/net/messagein.h5
-rw-r--r--src/net/messageout.cpp5
-rw-r--r--src/net/messageout.h5
-rw-r--r--src/net/network.cpp5
-rw-r--r--src/net/network.h5
-rw-r--r--src/net/npchandler.cpp23
-rw-r--r--src/net/npchandler.h5
-rw-r--r--src/net/partyhandler.cpp6
-rw-r--r--src/net/partyhandler.h6
-rw-r--r--src/net/playerhandler.cpp14
-rw-r--r--src/net/playerhandler.h5
-rw-r--r--src/net/protocol.cpp5
-rw-r--r--src/net/protocol.h5
-rw-r--r--src/net/skillhandler.cpp5
-rw-r--r--src/net/skillhandler.h5
-rw-r--r--src/net/tradehandler.cpp5
-rw-r--r--src/net/tradehandler.h5
-rw-r--r--src/npc.cpp12
-rw-r--r--src/npc.h10
-rw-r--r--src/openglgraphics.cpp9
-rw-r--r--src/openglgraphics.h5
-rw-r--r--src/particle.cpp7
-rw-r--r--src/particle.h11
-rw-r--r--src/particlecontainer.cpp38
-rw-r--r--src/particlecontainer.h11
-rw-r--r--src/particleemitter.cpp5
-rw-r--r--src/particleemitter.h5
-rw-r--r--src/particleemitterprop.h5
-rw-r--r--src/party.cpp6
-rw-r--r--src/party.h6
-rw-r--r--src/player.cpp5
-rw-r--r--src/player.h5
-rw-r--r--src/player_relations.cpp7
-rw-r--r--src/player_relations.h6
-rw-r--r--src/position.cpp5
-rw-r--r--src/position.h5
-rw-r--r--src/properties.h10
-rw-r--r--src/resources/action.cpp5
-rw-r--r--src/resources/action.h5
-rw-r--r--src/resources/ambientoverlay.cpp5
-rw-r--r--src/resources/ambientoverlay.h5
-rw-r--r--src/resources/animation.cpp5
-rw-r--r--src/resources/animation.h5
-rw-r--r--src/resources/colordb.cpp10
-rw-r--r--src/resources/colordb.h12
-rw-r--r--src/resources/dye.cpp5
-rw-r--r--src/resources/dye.h5
-rw-r--r--src/resources/emotedb.cpp8
-rw-r--r--src/resources/emotedb.h8
-rw-r--r--src/resources/image.cpp5
-rw-r--r--src/resources/image.h5
-rw-r--r--src/resources/imageloader.cpp7
-rw-r--r--src/resources/imageloader.h8
-rw-r--r--src/resources/imageset.cpp5
-rw-r--r--src/resources/imageset.h5
-rw-r--r--src/resources/imagewriter.cpp5
-rw-r--r--src/resources/imagewriter.h5
-rw-r--r--src/resources/itemdb.cpp7
-rw-r--r--src/resources/itemdb.h5
-rw-r--r--src/resources/iteminfo.cpp5
-rw-r--r--src/resources/iteminfo.h5
-rw-r--r--src/resources/mapreader.cpp23
-rw-r--r--src/resources/mapreader.h5
-rw-r--r--src/resources/monsterdb.cpp7
-rw-r--r--src/resources/monsterdb.h5
-rw-r--r--src/resources/monsterinfo.cpp5
-rw-r--r--src/resources/monsterinfo.h5
-rw-r--r--src/resources/music.cpp5
-rw-r--r--src/resources/music.h5
-rw-r--r--src/resources/npcdb.cpp5
-rw-r--r--src/resources/npcdb.h5
-rw-r--r--src/resources/resource.cpp5
-rw-r--r--src/resources/resource.h5
-rw-r--r--src/resources/resourcemanager.cpp17
-rw-r--r--src/resources/resourcemanager.h11
-rw-r--r--src/resources/soundeffect.cpp5
-rw-r--r--src/resources/soundeffect.h5
-rw-r--r--src/resources/spritedef.cpp19
-rw-r--r--src/resources/spritedef.h30
-rw-r--r--src/serverinfo.h5
-rw-r--r--src/shopitem.cpp17
-rw-r--r--src/shopitem.h5
-rw-r--r--src/simpleanimation.cpp9
-rw-r--r--src/simpleanimation.h5
-rw-r--r--src/sound.cpp5
-rw-r--r--src/sound.h5
-rw-r--r--src/sprite.h5
-rw-r--r--src/statuseffect.cpp174
-rw-r--r--src/statuseffect.h110
-rw-r--r--src/text.cpp74
-rw-r--r--src/text.h15
-rw-r--r--src/textmanager.cpp5
-rw-r--r--src/textmanager.h2
-rw-r--r--src/textparticle.cpp5
-rw-r--r--src/textparticle.h9
-rw-r--r--src/tileset.h5
-rw-r--r--src/tmw.rc (renamed from src/aethyra.rc)43
-rw-r--r--src/units.cpp232
-rw-r--r--src/units.h46
-rw-r--r--src/utils/dtor.h6
-rw-r--r--src/utils/gettext.h5
-rw-r--r--src/utils/mutex.h5
-rw-r--r--src/utils/stringutils.cpp5
-rw-r--r--src/utils/stringutils.h5
-rw-r--r--src/utils/strprintf.cpp5
-rw-r--r--src/utils/strprintf.h5
-rw-r--r--src/utils/xml.cpp13
-rw-r--r--src/utils/xml.h12
-rw-r--r--src/vector.cpp5
-rw-r--r--src/vector.h5
-rw-r--r--src/winver.h10
351 files changed, 2892 insertions, 1802 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0176e617..bca38598 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,7 +8,7 @@ FIND_PACKAGE(PhysFS REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-SET(FLAGS "${FLAGS} -DAETHYRA_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+SET(FLAGS "${FLAGS} -DTMW_DATADIR=\\\"${PKG_DATADIR}/\\\"")
SET(GUICHAN_COMPONENTS "SDL")
IF (WITH_OPENGL)
@@ -398,13 +398,15 @@ SET(SRCS
textparticle.cpp
textparticle.h
tileset.h
+ units.cpp
+ units.h
vector.cpp
vector.h
)
-ADD_EXECUTABLE(aethyra ${SRCS})
+ADD_EXECUTABLE(tmw ${SRCS})
-TARGET_LINK_LIBRARIES(aethyra
+TARGET_LINK_LIBRARIES(tmw
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
${SDLMIXER_LIBRARY}
@@ -417,6 +419,6 @@ TARGET_LINK_LIBRARIES(aethyra
${OPENGL_LIBRARIES}
)
-INSTALL(TARGETS aethyra RUNTIME DESTINATION ${PKG_BINDIR})
+INSTALL(TARGETS tmw RUNTIME DESTINATION ${PKG_BINDIR})
-SET_TARGET_PROPERTIES(aethyra PROPERTIES COMPILE_FLAGS "${FLAGS}")
+SET_TARGET_PROPERTIES(tmw PROPERTIES COMPILE_FLAGS "${FLAGS}")
diff --git a/src/Makefile.am b/src/Makefile.am
index 5029697a..e37e007c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,8 @@
AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = aethyra
-aethyra_SOURCES = gui/widgets/dropdown.cpp \
- gui/widgets/dropdown.h \
+bin_PROGRAMS = tmw
+tmw_SOURCES = gui/widgets/dropdown.cpp \
+ gui/widgets/dropdown.h \
gui/widgets/layout.cpp \
gui/widgets/layout.h \
gui/widgets/layouthelper.cpp \
@@ -106,8 +106,8 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \
gui/progressbar.h \
gui/radiobutton.cpp \
gui/radiobutton.h \
- gui/recorder.cpp \
- gui/recorder.h \
+ gui/recorder.cpp \
+ gui/recorder.h \
gui/register.cpp \
gui/register.h \
gui/scrollarea.cpp \
@@ -344,6 +344,8 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \
sound.cpp \
sound.h \
sprite.h \
+ statuseffect.cpp \
+ statuseffect.h \
text.cpp \
text.h \
textmanager.cpp \
@@ -351,17 +353,13 @@ aethyra_SOURCES = gui/widgets/dropdown.cpp \
textparticle.cpp \
textparticle.h \
tileset.h \
+ units.cpp \
+ units.h \
vector.cpp \
vector.h
# set the include path found by configure
INCLUDES = \
- $(all_includes) \
- -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
- -DLOCALEDIR=\""$(localedir)/"\"
-
-# the library search path.
-aethyra_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0`
-aethyra_CXXFLAGS = -Wall $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` $(CURL_CFLAGS)
-aethyra_LDADD = $(LIBSDL_LIBS) -lguichan_sdl $(CURL_LIBS)
-aethyra_TARGET = aethyra
+ $(all_includes) \
+ -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
+ -DLOCALEDIR=\""$(localedir)"\"
diff --git a/src/SDLMain.h b/src/SDLMain.h
index 4683df57..4683df57 100755..100644
--- a/src/SDLMain.h
+++ b/src/SDLMain.h
diff --git a/src/SDLMain.m b/src/SDLMain.m
index 3d02719c..3d02719c 100755..100644
--- a/src/SDLMain.m
+++ b/src/SDLMain.m
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 108f5166..aa2fb4ee 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 756d9aed..43248731 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +50,8 @@ class AnimatedSprite
* @param filename the file of the sprite to animate
* @param variant the sprite variant
*/
- static AnimatedSprite *load(std::string const &filename, int variant = 0);
+ static AnimatedSprite *load(const std::string &filename,
+ int variant = 0);
/**
* Destructor.
diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp
index 4e1c348b..9c1f7ccb 100644
--- a/src/animationparticle.cpp
+++ b/src/animationparticle.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/animationparticle.h b/src/animationparticle.h
index 444703f3..03065eb7 100644
--- a/src/animationparticle.h
+++ b/src/animationparticle.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/being.cpp b/src/being.cpp
index 3a772fbd..f14fd64e 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,11 +19,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cassert>
-#include <cmath>
+#include "being.h"
#include "animatedsprite.h"
-#include "being.h"
#include "configuration.h"
#include "effectmanager.h"
#include "game.h"
@@ -36,6 +33,7 @@
#include "simpleanimation.h"
#include "sound.h"
#include "text.h"
+#include "statuseffect.h"
#include "gui/speechbubble.h"
@@ -53,8 +51,17 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
+#include "utils/xml.h"
+
+#include <cassert>
+#include <cmath>
+#define BEING_EFFECTS_FILE "effects.xml"
+#define HAIR_FILE "hair.xml"
+
+int Being::mNumberOfHairColors = 1;
int Being::mNumberOfHairstyles = 1;
+std::vector<std::string> Being::hairColors;
static const int X_SPEECH_OFFSET = 18;
static const int Y_SPEECH_OFFSET = 60;
@@ -81,15 +88,18 @@ Being::Being(int id, int job, Map *map):
mHairStyle(1), mHairColor(0),
mGender(GENDER_UNSPECIFIED),
mPx(0), mPy(0),
+ mStunMode(0),
mSprites(VECTOREND_SPRITE, NULL),
mSpriteIDs(VECTOREND_SPRITE, 0),
mSpriteColors(VECTOREND_SPRITE, ""),
- mChildParticleEffects(),
+ mStatusParticleEffects(&mStunParticleEffects, false),
+ mChildParticleEffects(&mStatusParticleEffects, false),
+ mMustResetParticles(false),
mUsedTargetCursor(NULL)
{
setMap(map);
- mSpeechBubble = new SpeechBubble();
+ mSpeechBubble = new SpeechBubble;
mSpeech = "";
mNameColor = &guiPalette->getColor(Palette::CHAT);
@@ -224,15 +234,21 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
color = &guiPalette->getColor(Palette::HIT_MONSTER_PLAYER);
}
- if (amount > 0 && type == CRITICAL)
- {
- particleEngine->addTextSplashEffect("crit!", mPx + 16, mPy + 16,
- color, font, true);
- }
-
// Show damage number
particleEngine->addTextSplashEffect(damage, mPx + 16, mPy + 16,
- color, font, true);
+ color, font, true);
+
+ if (amount > 0)
+ {
+ if (type != CRITICAL)
+ {
+ effectManager->trigger(26, this);
+ }
+ else
+ {
+ effectManager->trigger(28, this);
+ }
+ }
}
void Being::handleAttack(Being *victim, int damage, AttackType type)
@@ -256,6 +272,7 @@ void Being::setMap(Map *map)
// Clear particle effect list because child particles became invalid
mChildParticleEffects.clear();
+ mMustResetParticles = true; // Reset status particles on next redraw
}
void Being::controlParticle(Particle *particle)
@@ -410,7 +427,7 @@ void Being::logic()
}
// Update sprite animations
- if (mUsedTargetCursor != NULL)
+ if (mUsedTargetCursor)
mUsedTargetCursor->update(tick_time * 10);
for (int i = 0; i < VECTOREND_SPRITE; i++)
@@ -419,6 +436,17 @@ void Being::logic()
mSprites[i]->update(tick_time * 10);
}
+ // Restart status/particle effects, if needed
+ if (mMustResetParticles) {
+ mMustResetParticles = false;
+ for (std::set<int>::iterator it = mStatusEffects.begin();
+ it != mStatusEffects.end(); it++) {
+ const StatusEffect *effect = StatusEffect::getStatusEffect(*it, true);
+ if (effect && effect->particleEffectIsPersistent())
+ updateStatusEffect(*it, true);
+ }
+ }
+
// Update particle effects
mChildParticleEffects.moveTo((float) mPx + 16.0f, (float) mPy + 32.0f);
}
@@ -428,7 +456,7 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
int px = mPx + offsetX;
int py = mPy + offsetY;
- if (mUsedTargetCursor != NULL)
+ if (mUsedTargetCursor)
mUsedTargetCursor->draw(graphics, px, py);
for (int i = 0; i < VECTOREND_SPRITE; i++)
@@ -512,6 +540,62 @@ Being::Type Being::getType() const
return UNKNOWN;
}
+void Being::setStatusEffectBlock(int offset, Uint16 newEffects)
+{
+ for (int i = 0; i < STATUS_EFFECTS; i++) {
+ int index = StatusEffect::blockEffectIndexToEffectIndex(offset + i);
+
+ if (index != -1)
+ setStatusEffect(index, (newEffects & (1 << i)) > 0);
+ }
+}
+
+void Being::handleStatusEffect(StatusEffect *effect, int effectId)
+{
+ if (!effect)
+ return;
+
+ // TODO: Find out how this is meant to be used
+ // (SpriteAction != Being::Action)
+ //SpriteAction action = effect->getAction();
+ //if (action != ACTION_INVALID)
+ // setAction(action);
+
+ Particle *particle = effect->getParticle();
+
+ if (effectId >= 0)
+ mStatusParticleEffects.setLocally(effectId, particle);
+ else {
+ mStunParticleEffects.clearLocally();
+ if (particle)
+ mStunParticleEffects.addLocally(particle);
+ }
+}
+
+void Being::updateStunMode(int oldMode, int newMode)
+{
+ handleStatusEffect(StatusEffect::getStatusEffect(oldMode, false), -1);
+ handleStatusEffect(StatusEffect::getStatusEffect(newMode, true), -1);
+}
+
+void Being::updateStatusEffect(int index, bool newStatus)
+{
+ handleStatusEffect(StatusEffect::getStatusEffect(index, newStatus), index);
+}
+
+void Being::setStatusEffect(int index, bool active)
+{
+ const bool wasActive = mStatusEffects.find(index) != mStatusEffects.end();
+
+ if (active != wasActive) {
+ updateStatusEffect(index, active);
+ if (active)
+ mStatusEffects.insert(index);
+ else
+ mStatusEffects.erase(index);
+ }
+}
+
int Being::getOffset(char pos, char neg) const
{
// Check whether we're walking in the requested direction
@@ -568,6 +652,114 @@ void Being::setTargetAnimation(SimpleAnimation* animation)
mUsedTargetCursor->reset();
}
+struct EffectDescription {
+ std::string mGFXEffect;
+ std::string mSFXEffect;
+};
+
+static EffectDescription *default_effect = NULL;
+static std::map<int, EffectDescription *> effects;
+static bool effects_initialized = false;
+
+static EffectDescription *getEffectDescription(xmlNodePtr node, int *id)
+{
+ EffectDescription *ed = new EffectDescription;
+
+ *id = atoi(XML::getProperty(node, "id", "-1").c_str());
+ ed->mSFXEffect = XML::getProperty(node, "audio", "");
+ ed->mGFXEffect = XML::getProperty(node, "particle", "");
+
+ return ed;
+}
+
+static EffectDescription *getEffectDescription(int effectId)
+{
+ if (!effects_initialized)
+ {
+ XML::Document doc(BEING_EFFECTS_FILE);
+ xmlNodePtr root = doc.rootNode();
+
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
+ {
+ logger->log("Error loading being effects file: "
+ BEING_EFFECTS_FILE);
+ return NULL;
+ }
+
+ for_each_xml_child_node(node, root)
+ {
+ int id;
+
+ if (xmlStrEqual(node->name, BAD_CAST "effect"))
+ {
+ EffectDescription *EffectDescription =
+ getEffectDescription(node, &id);
+ effects[id] = EffectDescription;
+ } else if (xmlStrEqual(node->name, BAD_CAST "default"))
+ {
+ EffectDescription *EffectDescription =
+ getEffectDescription(node, &id);
+
+ if (default_effect)
+ delete default_effect;
+
+ default_effect = EffectDescription;
+ }
+ }
+
+ effects_initialized = true;
+ } // done initializing
+
+ EffectDescription *ed = effects[effectId];
+
+ if (!ed)
+ return default_effect;
+ else
+ return ed;
+}
+
+void Being::internalTriggerEffect(int effectId, bool sfx, bool gfx)
+{
+ logger->log("Special effect #%d on %s", effectId,
+ getId() == player_node->getId() ? "self" : "other");
+
+ EffectDescription *ed = getEffectDescription(effectId);
+
+ if (!ed) {
+ logger->log("Unknown special effect and no default recorded");
+ return;
+ }
+
+ if (gfx && !ed->mGFXEffect.empty()) {
+ Particle *selfFX;
+
+ selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
+ controlParticle(selfFX);
+ }
+
+ if (sfx && !ed->mSFXEffect.empty()) {
+ sound.playSfx(ed->mSFXEffect);
+ }
+}
+
+int Being::getHairStyleCount()
+{
+ return mNumberOfHairstyles;
+}
+
+int Being::getHairColorCount()
+{
+ return mNumberOfHairColors;
+}
+
+std::string Being::getHairColor(int index)
+{
+ if (index < 0 || index >= mNumberOfHairColors)
+ return "#000000";
+
+ return hairColors[index];
+}
+
void Being::load()
{
// Hairstyles are encoded as negative numbers. Count how far negative
@@ -579,5 +771,32 @@ void Being::load()
hairstyles++;
}
mNumberOfHairstyles = hairstyles;
-}
+ XML::Document doc(HAIR_FILE);
+ xmlNodePtr root = doc.rootNode();
+
+ // Add an initial hair color
+ hairColors.resize(1, "#000000");
+
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ {
+ logger->log("Error loading being hair configuration file");
+ } else {
+ for_each_xml_child_node(node, root)
+ {
+ if (xmlStrEqual(node->name, BAD_CAST "color"))
+ {
+ int index = atoi(XML::getProperty(node, "id", "-1").c_str());
+ std::string value = XML::getProperty(node, "value", "");
+
+ if (index >= 0 && !value.empty()) {
+ if (index >= mNumberOfHairColors) {
+ mNumberOfHairColors = index + 1;
+ hairColors.resize(mNumberOfHairColors, "#000000");
+ }
+ hairColors[index] = value;
+ }
+ }
+ }
+ }
+}
diff --git a/src/being.h b/src/being.h
index 689eda02..715a7192 100644
--- a/src/being.h
+++ b/src/being.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,9 +26,9 @@
#include <SDL_types.h>
+#include <set>
#include <string>
#include <vector>
-#include <bitset>
#include "particlecontainer.h"
#include "position.h"
@@ -55,6 +54,8 @@ class SimpleAnimation;
class SpeechBubble;
class Text;
+class StatusEffect;
+
typedef std::list<Sprite*> Sprites;
typedef Sprites::iterator SpriteIterator;
@@ -198,14 +199,16 @@ class Being : public Sprite
/**
* Returns the name of the being.
*/
- const std::string& getName() const { return mName; }
+ const std::string &getName() const
+ { return mName; }
/**
* Sets the name for the being.
*
* @param name The name that should appear.
*/
- virtual void setName(const std::string &name) { mName = name; }
+ virtual void setName(const std::string &name)
+ { mName = name; }
/**
* Gets the hair color for this being.
@@ -347,12 +350,14 @@ class Being : public Sprite
/**
* Get the current X pixel offset.
*/
- int getXOffset() const { return getOffset(LEFT, RIGHT); }
+ int getXOffset() const
+ { return getOffset(LEFT, RIGHT); }
/**
* Get the current Y pixel offset.
*/
- int getYOffset() const { return getOffset(UP, DOWN); }
+ int getYOffset() const
+ { return getOffset(UP, DOWN); }
/**
* Returns the horizontal size of the current base sprite of the being
@@ -391,6 +396,48 @@ class Being : public Sprite
mEmotionTime = emote_time;
}
+ /**
+ * Sets the being's stun mode. If zero, the being is `normal',
+ * otherwise it is `stunned' in some fashion.
+ */
+ void setStunMode(int stunMode)
+ {
+ if (mStunMode != stunMode)
+ updateStunMode(mStunMode, stunMode);
+ mStunMode = stunMode;
+ };
+
+ void setStatusEffect(int index, bool active);
+
+ /**
+ * A status effect block is a 16 bit mask of status effects.
+ * We assign each such flag a block ID of offset + bitnr.
+ *
+ * These are NOT the same as the status effect indices.
+ */
+ void setStatusEffectBlock(int offset, Uint16 flags);
+
+ /**
+ * Triggers a visual effect, such as `level up'
+ *
+ * Only draws the visual effect, does not play sound effects
+ *
+ * \param effectId ID of the effect to trigger
+ */
+ virtual void triggerEffect(int effectId)
+ {
+ internalTriggerEffect(effectId, false, true);
+ }
+
+ // Target cursor being used by the being
+ Image *mTargetCursor;
+
+ static int getHairColorCount();
+
+ static int getHairStyleCount();
+
+ static std::string getHairColor(int index);
+
virtual AnimatedSprite* getSprite(int index) const
{ return mSprites[index]; }
@@ -407,6 +454,35 @@ class Being : public Sprite
*/
virtual void updateCoords() {}
+ /**
+ * Trigger visual effect, with components
+ *
+ * \param effectId ID of the effect to trigger
+ * \param sfx Whether to trigger sound effects
+ * \param gfx Whether to trigger graphical effects
+ */
+ void internalTriggerEffect(int effectId, bool sfx, bool gfx);
+
+ /**
+ * Notify self that the stun mode has been updated. Invoked by
+ * setStunMode if something changed.
+ */
+ virtual void updateStunMode(int oldMode, int newMode);
+
+ /**
+ * Notify self that a status effect has flipped.
+ * The new flag is passed.
+ */
+ virtual void updateStatusEffect(int index, bool newStatus);
+
+ /**
+ * Handle an update to a status or stun effect
+ *
+ * \param The StatusEffect to effect
+ * \param effectId -1 for stun, otherwise the effect index
+ */
+ virtual void handleStatusEffect(StatusEffect *effect, int effectId);
+
int mId; /**< Unique sprite id */
Uint16 mWalkSpeed; /**< Walking speed */
Uint8 mDirection; /**< Facing direction */
@@ -419,7 +495,9 @@ class Being : public Sprite
/** Engine-related infos about weapon. */
const ItemInfo* mEquippedWeapon;
- static int mNumberOfHairstyles; /** Number of hair styles in use */
+ static std::vector<std::string> hairColors;
+ static int mNumberOfHairColors; /** Number of hair colors in use */
+ static int mNumberOfHairstyles; /** Number of hair styles in use */
Path mPath;
std::string mSpeech;
@@ -427,12 +505,16 @@ class Being : public Sprite
Uint16 mHairStyle, mHairColor;
Gender mGender;
int mPx, mPy; /**< Pixel coordinates */
+ Uint16 mStunMode; /**< Stun mode; zero if not stunned */
+ std::set<int> mStatusEffects; /**< set of active status effects */
const gcn::Color* mNameColor;
std::vector<AnimatedSprite*> mSprites;
std::vector<int> mSpriteIDs;
std::vector<std::string> mSpriteColors;
+ ParticleList mStunParticleEffects;
+ ParticleVector mStatusParticleEffects;
ParticleList mChildParticleEffects;
private:
@@ -442,6 +524,9 @@ class Being : public Sprite
*/
int getOffset(char pos, char neg) const;
+ /** Reset particle status effects on next redraw? */
+ bool mMustResetParticles;
+
// Speech Bubble components
SpeechBubble *mSpeechBubble;
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index e5836aa7..23d91526 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +20,7 @@
*/
#include "beingmanager.h"
+
#include "localplayer.h"
#include "monster.h"
#include "npc.h"
@@ -31,6 +31,8 @@
#include "utils/dtor.h"
+#include <cassert>
+
class FindBeingFunctor
{
public:
diff --git a/src/beingmanager.h b/src/beingmanager.h
index 3284ce16..d0690798 100644
--- a/src/beingmanager.h
+++ b/src/beingmanager.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/configlistener.h b/src/configlistener.h
index edd9e90a..ec7d6a2c 100644
--- a/src/configlistener.h
+++ b/src/configlistener.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 0df666ab..3c3ae1d5 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,7 +56,8 @@ void Configuration::setValue(const std::string &key, std::string value)
}
}
-std::string ConfigurationObject::getValue(const std::string &key, std::string deflt)
+std::string ConfigurationObject::getValue(const std::string &key,
+ std::string deflt)
{
OptionIterator iter = mOptions.find(key);
return ((iter != mOptions.end()) ? iter->second : deflt);
@@ -78,7 +78,7 @@ void ConfigurationObject::deleteList(const std::string &name)
mContainerOptions[name].clear();
}
-void ConfigurationObject::clear(void)
+void ConfigurationObject::clear()
{
for (std::map<std::string, ConfigurationList>::const_iterator
it = mContainerOptions.begin(); it != mContainerOptions.end(); it++)
@@ -86,7 +86,7 @@ void ConfigurationObject::clear(void)
mOptions.clear();
}
-ConfigurationObject::~ConfigurationObject(void)
+ConfigurationObject::~ConfigurationObject()
{
clear();
}
@@ -106,7 +106,7 @@ void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
{
if (xmlStrEqual(subnode->name, BAD_CAST name.c_str())
&& subnode->type == XML_ELEMENT_NODE) {
- ConfigurationObject *cobj = new ConfigurationObject();
+ ConfigurationObject *cobj = new ConfigurationObject;
cobj->initFromXML(subnode); // recurse
diff --git a/src/configuration.h b/src/configuration.h
index 3e201dcb..0b2dc446 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -73,7 +72,7 @@ class ConfigurationObject
friend class Configuration;
public:
- virtual ~ConfigurationObject(void);
+ virtual ~ConfigurationObject();
/**
* Sets an option using a string value.
@@ -110,7 +109,7 @@ class ConfigurationObject
/**
* Re-sets all data in the configuration
*/
- virtual void clear(void);
+ virtual void clear();
/**
* Serialises a container into a list of configuration options
@@ -127,7 +126,7 @@ class ConfigurationObject
template <class IT, class T, class CONT>
void setList(const std::string &name, IT begin, IT end, ConfigurationListManager<T, CONT> *manager)
{
- ConfigurationObject *nextobj = new ConfigurationObject();
+ ConfigurationObject *nextobj = new ConfigurationObject;
deleteList(name);
ConfigurationList *list = &(mContainerOptions[name]);
@@ -135,7 +134,7 @@ class ConfigurationObject
ConfigurationObject *wrobj = manager->writeConfigItem(*it, nextobj);
if (wrobj) { // wrote something
assert (wrobj == nextobj);
- nextobj = new ConfigurationObject();
+ nextobj = new ConfigurationObject;
list->push_back(wrobj);
} else
nextobj->clear(); // you never know...
@@ -160,7 +159,7 @@ class ConfigurationObject
{
ConfigurationList *list = &(mContainerOptions[name]);
CONT container = empty;
-
+
for (ConfigurationList::const_iterator it = list->begin(); it != list->end(); it++)
container = manager->readConfigItem(*it, container);
@@ -189,7 +188,7 @@ class ConfigurationObject
class Configuration : public ConfigurationObject
{
public:
- virtual ~Configuration(void) {}
+ virtual ~Configuration() {}
/**
* Reads config file and parse all options into memory.
@@ -216,6 +215,7 @@ class Configuration : public ConfigurationObject
virtual void setValue(const std::string &key, std::string value);
virtual void setValue(const std::string &key, float value);
+
private:
typedef std::list<ConfigListener*> Listeners;
typedef Listeners::iterator ListenerIterator;
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 567e692b..f004a450 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -3,8 +3,7 @@
* Copyright (C) 2008 Fate <fate.tmw@googlemail.com>
* Copyright (C) 2008 Chuck Miller <shadowmil@gmail.com>
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/effectmanager.h b/src/effectmanager.h
index c69ade09..01c5a6b8 100644
--- a/src/effectmanager.h
+++ b/src/effectmanager.h
@@ -3,8 +3,7 @@
* Copyright (C) 2008 Fate <fate.tmw@googlemail.com>
* Copyright (C) 2008 Chuck Miller <shadowmil@gmail.com>
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/emoteshortcut.cpp b/src/emoteshortcut.cpp
index b229ec70..46e13782 100644
--- a/src/emoteshortcut.cpp
+++ b/src/emoteshortcut.cpp
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/emoteshortcut.h b/src/emoteshortcut.h
index 3fe911dd..ceb51a9b 100644
--- a/src/emoteshortcut.h
+++ b/src/emoteshortcut.h
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/engine.cpp b/src/engine.cpp
index cc19bd72..84a734d1 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/engine.h b/src/engine.h
index e2fec2f6..7ad6d894 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -2,8 +2,7 @@
* The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/equipment.cpp b/src/equipment.cpp
index 558df216..cb7acd44 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/equipment.h b/src/equipment.h
index d75069dc..ace76e63 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/floor_item.cpp b/src/floor_item.cpp
index 82506f8f..000835ad 100644
--- a/src/floor_item.cpp
+++ b/src/floor_item.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,7 +26,11 @@
#include "resources/image.h"
-FloorItem::FloorItem(int id, int itemId, int x, int y, Map *map):
+FloorItem::FloorItem(int id,
+ int itemId,
+ int x,
+ int y,
+ Map *map):
mId(id),
mX(x),
mY(y),
diff --git a/src/floor_item.h b/src/floor_item.h
index 0972a983..7ca0f5a3 100644
--- a/src/floor_item.h
+++ b/src/floor_item.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +42,11 @@ class FloorItem : public Sprite
/**
* Constructor.
*/
- FloorItem(int id, int itemId, int x, int y, Map *map);
+ FloorItem(int id,
+ int itemId,
+ int x,
+ int y,
+ Map *map);
/**
* Destructor.
diff --git a/src/flooritemmanager.cpp b/src/flooritemmanager.cpp
index 97b3ca5b..65fb2146 100644
--- a/src/flooritemmanager.cpp
+++ b/src/flooritemmanager.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +29,8 @@ FloorItemManager::~FloorItemManager()
clear();
}
-FloorItem* FloorItemManager::create(int id, int itemId, int x, int y, Map *map)
+FloorItem* FloorItemManager::create(int id, int itemId,
+ int x, int y, Map *map)
{
FloorItem *floorItem = new FloorItem(id, itemId, x, y, map);
mFloorItems.push_back(floorItem);
diff --git a/src/flooritemmanager.h b/src/flooritemmanager.h
index 1a6e8e0a..704b39fd 100644
--- a/src/flooritemmanager.h
+++ b/src/flooritemmanager.h
@@ -2,8 +2,7 @@
* The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/game.cpp b/src/game.cpp
index 7f0186d1..3ca8f5ae 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -191,24 +190,24 @@ void createGuiWindows(Network *network)
{
// Create dialogs
chatWindow = new ChatWindow(network);
- menuWindow = new MenuWindow();
+ menuWindow = new MenuWindow;
statusWindow = new StatusWindow(player_node);
- miniStatusWindow = new MiniStatusWindow();
+ miniStatusWindow = new MiniStatusWindow;
buyDialog = new BuyDialog(network);
sellDialog = new SellDialog(network);
buySellDialog = new BuySellDialog(network);
- inventoryWindow = new InventoryWindow();
- emoteWindow = new EmoteWindow();
+ inventoryWindow = new InventoryWindow;
+ emoteWindow = new EmoteWindow;
npcTextDialog = new NpcTextDialog(network);
npcIntegerDialog = new NpcIntegerDialog(network);
npcListDialog = new NpcListDialog(network);
npcStringDialog = new NpcStringDialog(network);
- skillDialog = new SkillDialog();
- minimap = new Minimap();
- equipmentWindow = new EquipmentWindow();
+ skillDialog = new SkillDialog;
+ minimap = new Minimap;
+ equipmentWindow = new EquipmentWindow;
tradeWindow = new TradeWindow(network);
- helpWindow = new HelpWindow();
- debugWindow = new DebugWindow();
+ helpWindow = new HelpWindow;
+ debugWindow = new DebugWindow;
itemShortcutWindow = new ShortcutWindow("ItemShortcut",
new ItemShortcutContainer);
emoteShortcutWindow = new ShortcutWindow("emoteShortcut",
@@ -222,6 +221,8 @@ void createGuiWindows(Network *network)
miniStatusWindow->getPopupName() + "Visible", true));
buyDialog->setVisible(false);
sellDialog->setVisible(false);
+ minimap->setVisible((bool) config.getValue(
+ minimap->getWindowName() + "Visible", true));
tradeWindow->setVisible(false);
menuWindow->setVisible((bool) config.getValue(
menuWindow->getPopupName() + "Visible", true));
@@ -272,22 +273,23 @@ void destroyGuiWindows()
Game::Game(Network *network):
mNetwork(network),
mBeingHandler(new BeingHandler(config.getValue("EnableSync", 0) == 1)),
- mBuySellHandler(new BuySellHandler()),
- mChatHandler(new ChatHandler()),
- mEquipmentHandler(new EquipmentHandler()),
- mInventoryHandler(new InventoryHandler()),
- mItemHandler(new ItemHandler()),
- mNpcHandler(new NPCHandler()),
- mPlayerHandler(new PlayerHandler()),
- mSkillHandler(new SkillHandler()),
- mTradeHandler(new TradeHandler())
+ mBuySellHandler(new BuySellHandler),
+ mChatHandler(new ChatHandler),
+ mEquipmentHandler(new EquipmentHandler),
+ mInventoryHandler(new InventoryHandler),
+ mItemHandler(new ItemHandler),
+ mNpcHandler(new NPCHandler),
+ mPlayerHandler(new PlayerHandler),
+ mSkillHandler(new SkillHandler),
+ mTradeHandler(new TradeHandler),
+ mLastTarget(Being::UNKNOWN)
{
createGuiWindows(network);
engine = new Engine(network);
beingManager = new BeingManager(network);
- floorItemManager = new FloorItemManager();
- effectManager = new EffectManager();
+ floorItemManager = new FloorItemManager;
+ effectManager = new EffectManager;
particleEngine = new Particle(NULL);
particleEngine->setupEngine();
@@ -342,10 +344,10 @@ Game::Game(Network *network):
Game::~Game()
{
- delete player_node;
destroyGuiWindows();
delete beingManager;
+ delete player_node;
delete floorItemManager;
delete joystick;
delete particleEngine;
@@ -374,11 +376,11 @@ static bool saveScreenshot()
filenameSuffix.str("");
filename << PHYSFS_getUserDir();
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filenameSuffix << ".aethyra/";
+ filenameSuffix << ".tmw/";
#elif defined __APPLE__
filenameSuffix << "Desktop/";
#endif
- filenameSuffix << "Ae_Screenshot_" << screenshotCount << ".png";
+ filenameSuffix << "TMW_Screenshot_" << screenshotCount << ".png";
filename << filenameSuffix.str();
testExists.open(filename.str().c_str(), std::ios::in);
found = !testExists.is_open();
@@ -523,58 +525,42 @@ void Game::handleInput()
}
}
- if (keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT) ||
- keyboard.isKeyActive(keyboard.KEY_OK))
- {
- // Input chat window
- if (!(chatWindow->isInputFocused() ||
- deathNotice ||
- weightNotice))
+ if (!(chatWindow->isInputFocused() || deathNotice || weightNotice))
+ if (keyboard.isKeyActive(keyboard.KEY_OK))
{
- // Quit by pressing Enter if the exit confirm is there
if (exitConfirm &&
keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT))
done = true;
// Close the Browser if opened
else if (helpWindow->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
helpWindow->setVisible(false);
// Close the config window, cancelling changes if opened
else if (setupWindow->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
// Submits the text and proceeds to the next dialog
else if (npcStringDialog->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
npcStringDialog->action(gcn::ActionEvent(NULL, "ok"));
// Proceed to the next dialog option, or close the window
else if (npcTextDialog->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
npcTextDialog->action(gcn::ActionEvent(NULL, "ok"));
// Choose the currently highlighted dialogue option
else if (npcListDialog->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
npcListDialog->action(gcn::ActionEvent(NULL, "ok"));
// Submits the text and proceeds to the next dialog
else if (npcIntegerDialog->isVisible() &&
- keyboard.isKeyActive(keyboard.KEY_OK))
+ keyboard.isKeyActive(keyboard.KEY_OK))
npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok"));
- else if (!(keyboard.getKeyValue(
- KeyboardConfig::KEY_TOGGLE_CHAT) ==
- keyboard.getKeyValue(
- KeyboardConfig::KEY_OK) &&
- (helpWindow->isVisible() ||
- setupWindow->isVisible() ||
- npcStringDialog->isVisible() ||
- npcTextDialog->isVisible() ||
- npcListDialog->isVisible() ||
- npcIntegerDialog->isVisible())))
- {
- chatWindow->requestChatFocus();
+ }
+ if (keyboard.isKeyActive(keyboard.KEY_TOGGLE_CHAT))
+ {
+ if (chatWindow->requestChatFocus())
used = true;
- }
}
- }
const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
switch (tKey)
@@ -649,9 +635,9 @@ void Game::handleInput()
{
case KeyboardConfig::KEY_PICKUP:
{
- FloorItem *item = floorItemManager->findByCoordinates(
- player_node->mX,
- player_node->mY);
+ FloorItem *item =
+ floorItemManager->findByCoordinates(
+ player_node->mX, player_node->mY);
// If none below the player, try the tile in front
// of the player
@@ -667,7 +653,9 @@ void Game::handleInput()
x--;
if (player_node->getDirection() & Being::RIGHT)
x++;
- item = floorItemManager->findByCoordinates(x, y);
+
+ item = floorItemManager->findByCoordinates(
+ x, y);
}
if (item)
@@ -846,8 +834,7 @@ void Game::handleInput()
if (keyboard.isKeyActive(keyboard.KEY_ATTACK) ||
(joystick && joystick->buttonPressed(0)))
{
- Being *target = beingManager->findNearestLivingBeing(x, y, 20,
- Being::MONSTER);
+ Being *target = NULL;
bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET);
// A set target has highest priority
@@ -864,47 +851,40 @@ void Game::handleInput()
default: break;
}
- // Attack priorioty is: Monster, Player, auto target
- target = beingManager->findBeing(targetX, targetY,
- Being::MONSTER);
- if (!target)
- target = beingManager->findBeing(targetX, targetY,
- Being::PLAYER);
+ // Only auto target Monsters
+ target = beingManager->findNearestLivingBeing(targetX, targetY,
+ 20, Being::MONSTER);
}
player_node->attack(target, newTarget);
}
- // Target the nearest player if 'q' is pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) &&
- !keyboard.isKeyActive(keyboard.KEY_TARGET) )
- {
- Being *target = beingManager->findNearestLivingBeing(player_node,
- 20, Being::PLAYER);
-
- player_node->setTarget(target);
- }
-
- // Target the nearest monster if 'a' pressed
- if ((keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
- (joystick && joystick->buttonPressed(3))) &&
- !keyboard.isKeyActive(keyboard.KEY_TARGET))
+ // Target the nearest player/monster/npc
+ if ((keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) ||
+ keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
+ keyboard.isKeyActive(keyboard.KEY_TARGET_NPC) ||
+ (joystick && joystick->buttonPressed(3))) &&
+ !keyboard.isKeyActive(keyboard.KEY_TARGET))
{
- Being *target = beingManager->findNearestLivingBeing(
- x, y, 20, Being::MONSTER);
+ Being::Type currentTarget = Being::UNKNOWN;
+ if (keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ||
+ (joystick && joystick->buttonPressed(3)))
+ currentTarget = Being::MONSTER;
+ else if (keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER))
+ currentTarget = Being::PLAYER;
+ else if (keyboard.isKeyActive(keyboard.KEY_TARGET_NPC))
+ currentTarget = Being::NPC;
- player_node->setTarget(target);
- }
-
- // Target the nearest npc if 'n' pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_NPC) &&
- !keyboard.isKeyActive(keyboard.KEY_TARGET) )
- {
- Being *target = beingManager->findNearestLivingBeing(
- x, y, 20, Being::NPC);
+ Being *target = beingManager->findNearestLivingBeing(player_node,
+ 20, currentTarget);
- player_node->setTarget(target);
- }
+ if (target && (target != player_node->getTarget() ||
+ currentTarget != mLastTarget))
+ {
+ player_node->setTarget(target);
+ mLastTarget = currentTarget;
+ }
+ } else mLastTarget = Being::UNKNOWN; // Reset last target
// Talk to the nearest NPC if 't' pressed
if ( keyboard.isKeyActive(keyboard.KEY_TALK) )
@@ -914,12 +894,6 @@ void Game::handleInput()
{
Being *target = player_node->getTarget();
- if (!target)
- {
- target = beingManager->findNearestLivingBeing(
- x, y, 20, Being::NPC);
- }
-
if (target)
{
if (target->getType() == Being::NPC)
diff --git a/src/game.h b/src/game.h
index 85bb9c07..4e864ad6 100644
--- a/src/game.h
+++ b/src/game.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -66,6 +65,8 @@ class Game : public ConfigListener
MessageHandlerPtr mPlayerHandler;
MessageHandlerPtr mSkillHandler;
MessageHandlerPtr mTradeHandler;
+
+ int mLastTarget;
};
/**
diff --git a/src/graphics.cpp b/src/graphics.cpp
index ca86f536..b9bd9fa6 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/graphics.h b/src/graphics.h
index ec0b5e9c..c4004ffc 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 46c8bdf1..596174cc 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h
index 500c9fba..5dde402e 100644
--- a/src/gui/browserbox.h
+++ b/src/gui/browserbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 16a2853c..f9e5e9dc 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/button.h b/src/gui/button.h
index f21d2661..abaf5c43 100644
--- a/src/gui/button.h
+++ b/src/gui/button.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 43c423f1..c5c37601 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +30,7 @@
#include "widgets/layout.h"
#include "../npc.h"
+#include "../units.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -42,7 +42,7 @@ BuyDialog::BuyDialog(Network *network):
Window("Buy"), mNetwork(network),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
- setWindowName(_("Buy"));
+ setWindowName("Buy");
setResizable(true);
setCloseButton(true);
setMinWidth(260);
@@ -56,10 +56,10 @@ BuyDialog::BuyDialog(Network *network):
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mSlider = new Slider(1.0);
-
mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
+ mMoneyLabel = new gcn::Label(strprintf(_("Price: %s / Total: %s"),
+ "", ""));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
@@ -99,6 +99,7 @@ BuyDialog::BuyDialog(Network *network):
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ center();
loadWindowState();
}
@@ -250,7 +251,16 @@ void BuyDialog::updateButtonsAndLabels()
// Update quantity and money labels
mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
mMoneyLabel->setCaption
- (strprintf(_("Price: %d GP / Total: %d GP"), price, mMoney - price));
+ (strprintf(_("Price: %s / Total: %s"),
+ Units::formatCurrency(price).c_str(),
+ Units::formatCurrency(mMoney - price).c_str()));
+}
+
+void BuyDialog::logic()
+{
+ Window::logic();
+
+ if (!current_npc) setVisible(false);
}
void BuyDialog::setVisible(bool visible)
diff --git a/src/gui/buy.h b/src/gui/buy.h
index ffd3f5c9..2e6b5377 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -97,6 +96,11 @@ class BuyDialog : public Window, public gcn::ActionListener,
void updateButtonsAndLabels();
/**
+ * Check for current NPC
+ */
+ void logic();
+
+ /**
* Sets the visibility of this window.
*/
void setVisible(bool visible);
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index df222797..04a27b8c 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,9 +49,10 @@ BuySellDialog::BuySellDialog(Network *network):
}
buyButton->requestFocus();
- setDefaultSize(x + getPadding(), (2 * y + buyButton->getHeight() +
- getTitleBarHeight()), ImageRect::CENTER);
+ setContentSize(x, 2 * y + buyButton->getHeight());
+ center();
+ setDefaultSize();
loadWindowState();
}
@@ -77,7 +77,7 @@ void BuySellDialog::action(const gcn::ActionEvent &event)
setVisible(false);
int action = 0;
- NPC::mTalking = false;
+ NPC::isTalking = false;
if (event.getId() == "Buy")
{
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index c6989709..4b137554 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,8 +45,6 @@ class BuySellDialog : public Window, public gcn::ActionListener
BuySellDialog(Network *network);
/**
-<<<<<<< HEAD:src/gui/buysell.h
-=======
* Check for current NPC
*/
void logic();
@@ -55,7 +52,6 @@ class BuySellDialog : public Window, public gcn::ActionListener
void setVisible(bool visible);
/**
->>>>>>> f64903f... Fix up the NPC interraction widnows a bit:src/gui/buysell.h
* Called when receiving actions from the widgets.
*/
void action(const gcn::ActionEvent &event);
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index f88736c1..aaf4e8c4 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,6 +36,7 @@
#include "../game.h"
#include "../localplayer.h"
#include "../main.h"
+#include "../units.h"
#include "../net/charserverhandler.h"
#include "../net/messageout.h"
@@ -85,6 +85,10 @@ CharSelectDialog::CharSelectDialog(Network *network,
Window(_("Select Character")), mNetwork(network),
mCharInfo(charInfo), mGender(gender), mCharSelected(false)
{
+ mCharInfo->select(0);
+ LocalPlayer *pi = mCharInfo->getEntry();
+ if (pi)
+ mMoney = Units::formatCurrency(pi->mGp);
// Control that shows the Player
mPlayerBox = new PlayerBox;
mPlayerBox->setWidth(74);
@@ -92,7 +96,7 @@ CharSelectDialog::CharSelectDialog(Network *network,
mNameLabel = new Label(strprintf(_("Name: %s"), ""));
mLevelLabel = new Label(strprintf(_("Level: %d"), 0));
mJobLevelLabel = new Label(strprintf(_("Job Level: %d"), 0));
- mMoneyLabel = new Label(strprintf(_("Money: %d"), 0));
+ mMoneyLabel = new Label(strprintf(_("Money: %s"), mMoney.c_str()));
const std::string tempString = getFont()->getWidth(_("New")) <
getFont()->getWidth(_("Delete")) ?
@@ -122,7 +126,7 @@ CharSelectDialog::CharSelectDialog(Network *network,
reflowLayout(250, 0);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
mSelectButton->requestFocus();
updatePlayerInfo();
@@ -163,10 +167,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "previous")
{
mCharInfo->prev();
+ LocalPlayer *pi = mCharInfo->getEntry();
+ if (pi)
+ mMoney = Units::formatCurrency(pi->mGp);
}
else if (event.getId() == "next")
{
mCharInfo->next();
+ LocalPlayer *pi = mCharInfo->getEntry();
+ if (pi)
+ mMoney = Units::formatCurrency(pi->mGp);
}
}
@@ -176,10 +186,12 @@ void CharSelectDialog::updatePlayerInfo()
if (pi)
{
- mNameLabel->setCaption(strprintf(_("Name: %s"), pi->getName().c_str()));
+ mNameLabel->setCaption(strprintf(_("Name: %s"),
+ pi->getName().c_str()));
mLevelLabel->setCaption(strprintf(_("Level: %d"), pi->mLevel));
- mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), pi->mJobLevel));
- mMoneyLabel->setCaption(strprintf(_("Gold: %d"), pi->mGp));
+ mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"),
+ pi->mJobLevel));
+ mMoneyLabel->setCaption(strprintf(_("Money: %s"), mMoney.c_str()));
if (!mCharSelected)
{
mNewDelCharButton->setCaption(_("Delete"));
@@ -293,7 +305,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network,
reflowLayout(225, 0);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
mNameField->requestFocus();
}
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 037b809f..28091a18 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,7 +71,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener
gcn::Label *mNameLabel;
gcn::Label *mLevelLabel;
gcn::Label *mJobLevelLabel;
- gcn::Label *mMoneyLabel;
+ gcn::Label *mMoneyLabel; std::string mMoney;
PlayerBox *mPlayerBox;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 6977a104..22b0e7aa 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +50,7 @@ ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState):
mLoginData(loginData),
mNextState(nextState)
{
- mServerListModel = new ServerListModel();
+ mServerListModel = new ServerListModel;
mServerList = new ListBox(mServerListModel);
ScrollArea *mScrollArea = new ScrollArea(mServerList);
mOkButton = new Button(_("OK"), "ok", this);
@@ -86,7 +85,7 @@ ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState):
// Select first server
mServerList->setSelected(1);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
mOkButton->requestFocus();
}
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index 207fb86e..49a5b47b 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 5ff9ed46..94a554e8 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,14 +51,14 @@
ChatWindow::ChatWindow(Network * network):
Window(""), mNetwork(network), mTmpVisible(false)
{
- setWindowName(_("Chat"));
+ setWindowName("Chat");
setResizable(true);
setDefaultSize(600, 123, ImageRect::LOWER_LEFT);
setMinWidth(150);
setMinHeight(90);
- mItemLinkHandler = new ItemLinkHandler();
+ mItemLinkHandler = new ItemLinkHandler;
mChatInput = new ChatInput;
mChatInput->setActionEventId("chatinput");
@@ -163,13 +162,15 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
case BY_GM:
if (tmp.nick.empty())
{
- tmp.nick = std::string(_("Global announcement: "));
+ tmp.nick = std::string(_("Global announcement:"));
+ tmp.nick += " ";
lineColor = "##G";
}
else
{
- tmp.nick = strprintf(_("Global announcement from %s: "),
+ tmp.nick = strprintf(_("Global announcement from %s:"),
tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##1"; // Equiv. to BrowserBox::RED
}
break;
@@ -192,7 +193,8 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
lineColor = "##P";
break;
case ACT_WHISPER:
- tmp.nick += CAT_WHISPER;
+ tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str());
+ tmp.nick += " ";
lineColor = "##W";
break;
case ACT_IS:
@@ -290,7 +292,7 @@ void ChatWindow::chatLog(CHATSKILL act)
chatLog(const_msg(act), BY_SERVER);
}
-void ChatWindow::action(const gcn::ActionEvent & event)
+void ChatWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "chatinput")
{
@@ -326,7 +328,7 @@ void ChatWindow::action(const gcn::ActionEvent & event)
}
}
-void ChatWindow::requestChatFocus()
+bool ChatWindow::requestChatFocus()
{
// Make sure chatWindow is visible
if (!isVisible())
@@ -341,9 +343,14 @@ void ChatWindow::requestChatFocus()
mTmpVisible = true;
}
+ // Don't do anything else if the input is already visible and has focus
+ if (mChatInput->isVisible() && mChatInput->isFocused())
+ return false;
+
// Give focus to the chat input
mChatInput->setVisible(true);
mChatInput->requestFocus();
+ return true;
}
bool ChatWindow::isInputFocused()
@@ -685,7 +692,7 @@ std::string ChatWindow::const_msg(CHATSKILL act)
msg += _("You cannot do that right now!");
break;
case RFAIL_ZENY:
- msg += _("Seems you need more GP... ;-)");
+ msg += _("Seems you need more money... ;-)");
break;
case RFAIL_WEAPON:
msg += _("You cannot use this skill with that kind of weapon!");
@@ -735,9 +742,8 @@ void ChatWindow::scroll(int amount)
mTextOutput->showPart(scr);
}
-void ChatWindow::keyPressed(gcn::KeyEvent & event)
+void ChatWindow::keyPressed(gcn::KeyEvent &event)
{
-
if (event.getKey().getValue() == Key::DOWN &&
mCurHist != mHistory.end())
{
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 8b710dc8..09f3260b 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -145,8 +144,11 @@ class ChatWindow : public Window, public gcn::ActionListener,
/**
* Request focus for typing chat message.
+ *
+ * \returns true if the input was shown
+ * false otherwise
*/
- void requestChatFocus();
+ bool requestChatFocus();
/**
* Checks whether ChatWindow is Focused or not.
diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp
index 42c6d4de..43f3cde4 100644
--- a/src/gui/chatinput.cpp
+++ b/src/gui/chatinput.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h
index 96c30b3f..a4a50502 100644
--- a/src/gui/chatinput.h
+++ b/src/gui/chatinput.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index f6cce581..5695a23f 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h
index 93b62b9d..dd59493c 100644
--- a/src/gui/checkbox.h
+++ b/src/gui/checkbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index f4b49251..a40593e3 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +33,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
{
- mTextBox = new TextBox();
+ mTextBox = new TextBox;
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
@@ -86,7 +85,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
if (getParent())
{
- setLocationRelativeTo(getParent());
+ center();
getParent()->moveToTop(this);
}
setVisible(true);
diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h
index 493e9dda..8d8c0436 100644
--- a/src/gui/confirm_dialog.h
+++ b/src/gui/confirm_dialog.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,7 +55,6 @@ class ConfirmDialog : public Window, public gcn::ActionListener
private:
TextBox *mTextBox;
ScrollArea *mTextArea;
- gcn::Button *okButton;
};
#endif
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index d4a2b18a..658eade7 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,7 +55,7 @@ ConnectionDialog::ConnectionDialog():
add(cancelButton);
add(mProgressBar);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
}
diff --git a/src/gui/connection.h b/src/gui/connection.h
index f91a0ad1..3caa611f 100644
--- a/src/gui/connection.h
+++ b/src/gui/connection.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 9b8ea6bd..a98c9af4 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index c82521f9..8097132c 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/emotecontainer.cpp b/src/gui/emotecontainer.cpp
index 22b4cf50..ececd9aa 100644
--- a/src/gui/emotecontainer.cpp
+++ b/src/gui/emotecontainer.cpp
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h
index 7e88cb71..88df29fc 100644
--- a/src/gui/emotecontainer.h
+++ b/src/gui/emotecontainer.h
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp
index 47fb9b06..661f42a7 100644
--- a/src/gui/emoteshortcutcontainer.cpp
+++ b/src/gui/emoteshortcutcontainer.cpp
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/emoteshortcutcontainer.h b/src/gui/emoteshortcutcontainer.h
index ff9f929c..2997cb09 100644
--- a/src/gui/emoteshortcutcontainer.h
+++ b/src/gui/emoteshortcutcontainer.h
@@ -2,8 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp
index 77168993..d4b3cf2e 100644
--- a/src/gui/emotewindow.cpp
+++ b/src/gui/emotewindow.cpp
@@ -2,7 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,7 +35,7 @@
EmoteWindow::EmoteWindow():
Window(_("Emote"))
{
- setWindowName(_("Emote"));
+ setWindowName("Emote");
setResizable(true);
setCloseButton(true);
setMinWidth(80);
@@ -44,7 +44,7 @@ EmoteWindow::EmoteWindow():
mUseButton = new Button(_("Use"), "use", this);
- mEmotes = new EmoteContainer();
+ mEmotes = new EmoteContainer;
mEmotes->addSelectionListener(this);
mEmoteScroll = new ScrollArea(mEmotes);
diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h
index 81ee4f05..8af24a7b 100644
--- a/src/gui/emotewindow.h
+++ b/src/gui/emotewindow.h
@@ -2,7 +2,7 @@
* Extended support for activating emotes
* Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 31fe3b8b..856d7d03 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,7 +62,7 @@ EquipmentWindow::EquipmentWindow():
Window(_("Equipment")),
mSelected(-1)
{
- mItemPopup = new ItemPopup();
+ mItemPopup = new ItemPopup;
mItemPopup->setOpaque(false);
// Control that shows the Player
@@ -163,7 +162,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
}
}
-Item* EquipmentWindow::getItem(const int &x, const int &y)
+Item* EquipmentWindow::getItem(int x, int y) const
{
for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++)
{
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 7fdbaac8..24438477 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -1,27 +1,26 @@
/*
- * Aethyra
- * Copyright 2004 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra derived from original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef EQUIPMENT_WINDOW_H
-#define EQUIPMENT_WINDOW_H
+#ifndef EQUIPMENTWINDOW_H
+#define EQUIPMENTWINDOW_H
#include <guichan/actionlistener.hpp>
@@ -90,7 +89,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener
void mouseExited(gcn::MouseEvent &event);
void mouseMoved(gcn::MouseEvent &event);
- Item* getItem(const int &x, const int &y);
+ Item* getItem(int x, int y) const;
Equipment *mEquipment;
Inventory *mInventory;
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index c642127d..b9cfd789 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index fc5dd240..b0639bd8 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp
index 7aebed15..8325ccd4 100644
--- a/src/gui/gccontainer.cpp
+++ b/src/gui/gccontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h
index 2071955d..da584a42 100644
--- a/src/gui/gccontainer.h
+++ b/src/gui/gccontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 5bdab453..83441e1b 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,7 +94,7 @@ Gui::Gui(Graphics *graphics):
mFocusHandler = new FocusHandler;
// Initialize top GUI widget
- WindowContainer *guiTop = new WindowContainer();
+ WindowContainer *guiTop = new WindowContainer;
guiTop->setDimension(gcn::Rectangle(0, 0,
graphics->getWidth(), graphics->getHeight()));
guiTop->setOpaque(false);
@@ -139,7 +138,7 @@ Gui::Gui(Graphics *graphics):
config.addListener("customcursor", mConfigListener);
// Create the viewport
- viewport = new Viewport();
+ viewport = new Viewport;
viewport->setDimension(gcn::Rectangle(0, 0,
graphics->getWidth(), graphics->getHeight()));
guiTop->add(viewport);
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 609648fd..2ce153db 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index 0974abf7..03dfd08d 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,12 +36,12 @@ HelpWindow::HelpWindow():
setMinWidth(300);
setMinHeight(250);
setContentSize(455, 350);
- setWindowName(_("Help"));
+ setWindowName("Help");
setResizable(true);
setDefaultSize(500, 400, ImageRect::CENTER);
- mBrowserBox = new BrowserBox();
+ mBrowserBox = new BrowserBox;
mBrowserBox->setOpaque(false);
mScrollArea = new ScrollArea(mBrowserBox);
Button *okButton = new Button(_("Close"), "close", this);
diff --git a/src/gui/help.h b/src/gui/help.h
index 93d32c18..98e3aa67 100644
--- a/src/gui/help.h
+++ b/src/gui/help.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/inttextfield.cpp b/src/gui/inttextfield.cpp
index 40bbd887..d3fe448b 100644
--- a/src/gui/inttextfield.cpp
+++ b/src/gui/inttextfield.cpp
@@ -1,8 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,6 +57,16 @@ void IntTextField::setRange(int min, int max)
{
mMin = min;
mMax = max;
+
+ if (mValue < mMin)
+ mValue = mMin;
+ else if (mValue > mMax)
+ mValue = mMax;
+
+ if (mDefault < mMin)
+ mDefault = mMin;
+ else if (mDefault > mMax)
+ mDefault = mMax;
}
int IntTextField::getValue()
@@ -66,18 +76,28 @@ int IntTextField::getValue()
void IntTextField::setValue(int i)
{
- if (i >= mMin && i <= mMax)
- mValue = i;
- else if (i < mMin)
+ if (i < mMin)
mValue = mMin;
else if (i > mMax)
mValue = mMax;
+ else
+ mValue = i;
const std::string valStr = toString(mValue);
setText(valStr);
setCaretPosition(valStr.length() + 1);
}
+void IntTextField::setDefaultValue(int value)
+{
+ if (value < mMin)
+ mDefault = mMin;
+ else if (value > mMax)
+ mDefault = mMax;
+ else
+ mDefault = value;
+}
+
void IntTextField::reset()
{
setValue(mDefault);
diff --git a/src/gui/inttextfield.h b/src/gui/inttextfield.h
index f2e294ca..ec768bea 100644
--- a/src/gui/inttextfield.h
+++ b/src/gui/inttextfield.h
@@ -1,8 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -56,6 +56,11 @@ class IntTextField : public TextField
void setValue(int value);
/**
+ * Set the default value of the text box to the specified value.
+ */
+ void setDefaultValue(int value);
+
+ /**
* Responds to key presses.
*/
void keyPressed(gcn::KeyEvent &event);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index f6e81fc5..50fae483 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +38,7 @@
#include "../inventory.h"
#include "../item.h"
#include "../localplayer.h"
+#include "../units.h"
#include "../resources/iteminfo.h"
@@ -51,7 +51,7 @@ InventoryWindow::InventoryWindow(int invSize):
mMaxSlots(invSize),
mItemDesc(false)
{
- setWindowName(_("Inventory"));
+ setWindowName("Inventory");
setResizable(true);
setCloseButton(true);
@@ -77,8 +77,8 @@ InventoryWindow::InventoryWindow(int invSize):
mInvenScroll = new ScrollArea(mItems);
mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mTotalWeight = toString(player_node->mTotalWeight);
- mMaxWeight = toString(player_node->mMaxWeight);
+ mTotalWeight = -1;
+ mMaxWeight = -1;
mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed());
mSlotsLabel = new Label(_("Slots: "));
@@ -120,12 +120,12 @@ void InventoryWindow::logic()
// redesign of InventoryWindow and ItemContainer probably.
updateButtons();
- if ((mMaxWeight != toString(player_node->mMaxWeight)) ||
- mTotalWeight != toString(player_node->mTotalWeight) ||
+ if (mMaxWeight != player_node->mMaxWeight ||
+ mTotalWeight != player_node->mTotalWeight ||
mUsedSlots != toString(player_node->getInventory()->getNumberOfSlotsUsed()))
{
- mTotalWeight = toString(player_node->mTotalWeight);
- mMaxWeight = toString(player_node->mMaxWeight);
+ mTotalWeight = player_node->mTotalWeight;
+ mMaxWeight = player_node->mMaxWeight;
mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed());
// Weight Bar coloration
@@ -150,8 +150,9 @@ void InventoryWindow::logic()
player_node->mMaxWeight);
mSlotsBar->setText(strprintf("%s/%d", mUsedSlots.c_str(), mMaxSlots));
- mWeightBar->setText(strprintf("%sg/%sg", mTotalWeight.c_str(),
- mMaxWeight.c_str()));
+ mWeightBar->setText(strprintf("%s/%s",
+ Units::formatWeight(mTotalWeight).c_str(),
+ Units::formatWeight(mMaxWeight).c_str()));
}
}
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 83e98687..e1196f78 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,13 +22,13 @@
#ifndef INVENTORYWINDOW_H
#define INVENTORYWINDOW_H
-#include <guichan/actionlistener.hpp>
-#include <guichan/selectionlistener.hpp>
-
#include "window.h"
#include "../inventory.h"
+#include <guichan/actionlistener.hpp>
+#include <guichan/selectionlistener.hpp>
+
class Item;
class ItemContainer;
class ProgressBar;
@@ -79,8 +78,7 @@ class InventoryWindow : public Window, gcn::ActionListener,
std::string mWeight;
std::string mSlots;
std::string mUsedSlots;
- std::string mTotalWeight;
- std::string mMaxWeight;
+ Uint32 mTotalWeight, mMaxWeight;
gcn::Button *mUseButton, *mDropButton;
gcn::ScrollArea *mInvenScroll;
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index 5b3380c2..a8242aae 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h
index 34b33b37..d8253e3c 100644
--- a/src/gui/item_amount.h
+++ b/src/gui/item_amount.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 8139e85e..8a780eb4 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +50,7 @@ ItemContainer::ItemContainer(Inventory *inventory, int offset):
mLastSelectedItemId(NO_ITEM),
mOffset(offset)
{
- mItemPopup = new ItemPopup();
+ mItemPopup = new ItemPopup;
mItemPopup->setOpaque(false);
ResourceManager *resman = ResourceManager::getInstance();
@@ -171,7 +170,6 @@ void ItemContainer::refindSelectedItem()
{
if (mSelectedItemIndex != NO_ITEM)
{
-
if (mInventory->getItem(mSelectedItemIndex) &&
mInventory->getItem(mSelectedItemIndex)->getId() == mLastSelectedItemId)
return; // we're already fine
@@ -204,6 +202,7 @@ void ItemContainer::setSelectedItemIndex(int index)
newSelectedItemIndex = NO_ITEM;
else
newSelectedItemIndex = index;
+
if (mSelectedItemIndex != newSelectedItemIndex)
{
mSelectedItemIndex = newSelectedItemIndex;
@@ -274,7 +273,7 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event)
mItemPopup->setVisible(false);
}
-int ItemContainer::getSlotIndex(const int posX, const int posY) const
+int ItemContainer::getSlotIndex(int posX, int posY) const
{
int columns = getWidth() / gridWidth;
int index = posX / gridWidth + ((posY / gridHeight) * columns) + mOffset;
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index fba4656f..5ad140be 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -119,17 +118,17 @@ class ItemContainer : public gcn::Widget,
/**
* Find the current item index by the most recently used item ID
*/
- void refindSelectedItem(void);
+ void refindSelectedItem();
/**
* Determine and set the height of the container.
*/
- void recalculateHeight(void);
+ void recalculateHeight();
/**
* Sends out selection events to the list of selection listeners.
*/
- void distributeValueChangedEvent(void);
+ void distributeValueChangedEvent();
/**
* Gets the slot index based on the cursor position.
@@ -138,7 +137,7 @@ class ItemContainer : public gcn::Widget,
* @param posY The Y Coordinate position.
* @return The slot index on success, -1 on failure.
*/
- int getSlotIndex(const int posX, const int posY) const;
+ int getSlotIndex(int posX, int posY) const;
Inventory *mInventory;
Image *mSelImg;
diff --git a/src/gui/itemlinkhandler.cpp b/src/gui/itemlinkhandler.cpp
index e9993c2d..29fa310d 100644
--- a/src/gui/itemlinkhandler.cpp
+++ b/src/gui/itemlinkhandler.cpp
@@ -1,22 +1,21 @@
/*
- * Aethyra
- * Copyright 2009 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/gui/itemlinkhandler.h b/src/gui/itemlinkhandler.h
index e4c3ea4a..c04afa9e 100644
--- a/src/gui/itemlinkhandler.h
+++ b/src/gui/itemlinkhandler.h
@@ -1,27 +1,26 @@
/*
- * Aethyra
- * Copyright 2009 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef ITEM_LINK_HANDLER_H_
-#define ITEM_LINK_HANDLER_H_
+#ifndef ITEM_LINK_HANDLER_H
+#define ITEM_LINK_HANDLER_H
#include "linkhandler.h"
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index a4042ae2..61cb18fb 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -1,10 +1,9 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,6 +32,8 @@
#include "../graphics.h"
+#include "../units.h"
+
#include "../resources/iteminfo.h"
#include "../utils/gettext.h"
@@ -49,7 +50,7 @@ ItemPopup::ItemPopup():
mItemName->setPosition(2, 2);
// Item Description
- mItemDesc = new TextBox();
+ mItemDesc = new TextBox;
mItemDesc->setEditable(false);
mItemDescScroll = new ScrollArea(mItemDesc);
@@ -60,7 +61,7 @@ ItemPopup::ItemPopup():
mItemDescScroll->setPosition(2, getFont()->getHeight());
// Item Effect
- mItemEffect = new TextBox();
+ mItemEffect = new TextBox;
mItemEffect->setEditable(false);
mItemEffectScroll = new ScrollArea(mItemEffect);
@@ -71,7 +72,7 @@ ItemPopup::ItemPopup():
mItemEffectScroll->setPosition(2, (2 * getFont()->getHeight()) + 5);
// Item Weight
- mItemWeight = new TextBox();
+ mItemWeight = new TextBox;
mItemWeight->setEditable(false);
mItemWeightScroll = new ScrollArea(mItemWeight);
@@ -107,8 +108,8 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemName->setWidth(boldFont->getWidth(item.getName()));
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
- mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
- _(" grams"), 196);
+ mItemWeight->setTextWrapped(_("Weight: ") +
+ Units::formatWeight(item.getWeight()), 196);
mItemType = item.getType();
int minWidth = mItemName->getWidth();
@@ -216,9 +217,9 @@ unsigned int ItemPopup::getNumRows()
void ItemPopup::view(int x, int y)
{
if (graphics->getWidth() < (x + getWidth() + 5))
- x = graphics->getWidth() - getWidth();
+ x = graphics->getWidth() - getWidth();
if ((y - getHeight() - 10) < 0)
- y = 0;
+ y = 0;
else
y = y - getHeight() - 10;
setPosition(x, y);
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index 29fd127a..03e79886 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -1,10 +1,9 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index a0697c5d..9f77fd65 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,7 +46,7 @@ ItemShortcutContainer::ItemShortcutContainer():
addMouseListener(this);
addWidgetListener(this);
- mItemPopup = new ItemPopup();
+ mItemPopup = new ItemPopup;
mItemPopup->setOpaque(false);
ResourceManager *resman = ResourceManager::getInstance();
@@ -233,7 +232,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event)
Item *item = player_node->getInventory()->findItem(itemId);
- if (item)
+ if (item && inventoryWindow->isVisible())
{
if (item->getInfo().getName() != mItemPopup->getItemName())
mItemPopup->setItem(item->getInfo());
diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h
index 0149754e..9d188bf0 100644
--- a/src/gui/itemshortcutcontainer.h
+++ b/src/gui/itemshortcutcontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/linkhandler.h b/src/gui/linkhandler.h
index ea1b25c8..ecc05b13 100644
--- a/src/gui/linkhandler.h
+++ b/src/gui/linkhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 71e92eaf..7ba84ee7 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/listbox.h b/src/gui/listbox.h
index 09f00cdf..cfb58f15 100644
--- a/src/gui/listbox.h
+++ b/src/gui/listbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 7b9829fb..5eaf6626 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -54,17 +53,13 @@ LoginDialog::LoginDialog(LoginData *loginData):
gcn::Label *portLabel = new Label(_("Port:"));
gcn::Label *dropdownLabel = new Label(_("Recent:"));
std::vector<std::string> dfltServer;
- dfltServer.push_back("www.aethyra.org");
- dfltServer.push_back("www.aethyra.org");
- dfltServer.push_back("209.168.213.109");
+ dfltServer.push_back("server.themanaworld.org");
std::vector<std::string> dfltPort;
- dfltPort.push_back("21001");
- dfltPort.push_back("22001");
- dfltPort.push_back("21001");
+ dfltPort.push_back("6901");
mServerList = new DropDownList("MostRecent00", dfltServer, dfltPort,
MAX_SERVER_LIST_SIZE);
mServerListBox = new ListBox(mServerList);
- mServerScrollArea = new ScrollArea();
+ mServerScrollArea = new ScrollArea;
mUserField = new TextField(mLoginData->username);
mPassField = new PasswordField(mLoginData->password);
@@ -75,7 +70,7 @@ LoginDialog::LoginDialog(LoginData *loginData):
mServerListBox);
mServerDropDown->setOpaque(false);
- mKeepCheck = new CheckBox(_("Keep"), mLoginData->remember);
+ mKeepCheck = new CheckBox(_("Remember Username"), mLoginData->remember);
mOkButton = new Button(_("OK"), "ok", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
mRegisterButton = new Button(_("Register"), "register", this);
@@ -83,6 +78,7 @@ LoginDialog::LoginDialog(LoginData *loginData):
mUserField->setActionEventId("ok");
mPassField->setActionEventId("ok");
mServerField->setActionEventId("ok");
+ mPortField->setActionEventId("ok");
mServerDropDown->setActionEventId("changeSelection");
mUserField->addKeyListener(this);
@@ -113,7 +109,7 @@ LoginDialog::LoginDialog(LoginData *loginData):
place(3, 6, mOkButton);
reflowLayout(250, 0);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
if (mUserField->getText().empty())
diff --git a/src/gui/login.h b/src/gui/login.h
index 4d63ec63..1f0f2ddb 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index e1be908b..62f3766f 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h
index e8dc0b2e..c3d5673e 100644
--- a/src/gui/menuwindow.h
+++ b/src/gui/menuwindow.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index f3da52c6..d8c5d742 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004-2005 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +40,7 @@ Minimap::Minimap():
mMapImage(NULL),
mProportion(0.5)
{
- setWindowName(_("MiniMap"));
+ setWindowName("MiniMap");
mShow = config.getValue(getWindowName() + "Show", true);
setDefaultSize(5, 25, 100, 100);
setResizable(true);
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
index 6e88f821..3ce0aacd 100644
--- a/src/gui/minimap.h
+++ b/src/gui/minimap.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004-2005 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 18b9d714..9f789a9d 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +22,9 @@
#include "gui.h"
#include "ministatus.h"
#include "progressbar.h"
+#include "status.h"
+#include "../animatedsprite.h"
#include "../configuration.h"
#include "../graphics.h"
#include "../localplayer.h"
@@ -49,32 +50,29 @@ MiniStatusWindow::MiniStatusWindow():
mXpBar->getY() + mXpBar->getHeight());
}
-void MiniStatusWindow::update()
+void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
{
- // HP Bar coloration
- if (player_node->mHp < int(player_node->mMaxHp / 3))
- mHpBar->setColor(223, 32, 32); // Red
- else if (player_node->mHp < int((player_node->mMaxHp / 3) * 2))
- mHpBar->setColor(230, 171, 34); // Orange
- else
- mHpBar->setColor(0, 171, 34); // Green
+ if (index >= (int) mIcons.size())
+ mIcons.resize(index + 1, NULL);
- float xp = (float) player_node->getXp() / player_node->mXpForNextLevel;
+ if (mIcons[index])
+ delete mIcons[index];
- if (xp != xp) xp = 0.0f; // check for NaN
- if (xp < 0.0f) xp = 0.0f; // make sure the experience isn't negative (uninitialized pointer most likely)
- if (xp > 1.0f) xp = 1.0f;
+ mIcons[index] = sprite;
+}
- mHpBar->setProgress((float) player_node->mHp / player_node->mMaxHp);
- mMpBar->setProgress((float) player_node->mMp / player_node->mMaxMp);
- mXpBar->setProgress(xp);
+void MiniStatusWindow::eraseIcon(int index)
+{
+ mIcons.erase(mIcons.begin() + index);
+}
- // Update labels
- mHpBar->setText(toString(player_node->mHp));
- mMpBar->setText(toString(player_node->mMp));
+extern volatile int tick_time;
- std::stringstream updatedText;
- updatedText << (float) ((int) (xp * 10000.0f)) / 100.0f << "%";
+void MiniStatusWindow::update()
+{
+ StatusWindow::updateHPBar(mHpBar);
+ StatusWindow::updateMPBar(mMpBar);
+ StatusWindow::updateXPBar(mXpBar);
// Displays the number of monsters to next lvl
// (disabled for now but interesting idea)
@@ -89,7 +87,10 @@ void MiniStatusWindow::update()
}
*/
- mXpBar->setText(updatedText.str());
+ for (unsigned int i = 0; i < mIcons.size(); i++)
+ if (mIcons[i])
+ mIcons[i]->update(tick_time * 10);
+
}
void MiniStatusWindow::draw(gcn::Graphics *graphics)
@@ -97,3 +98,15 @@ void MiniStatusWindow::draw(gcn::Graphics *graphics)
update();
drawChildren(graphics);
}
+
+void MiniStatusWindow::drawIcons(Graphics *graphics)
+{
+ // Draw icons
+ int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4;
+ for (unsigned int i = 0; i < mIcons.size(); i++) {
+ if (mIcons[i]) {
+ mIcons[i]->draw(graphics, icon_x, 3);
+ icon_x += 2 + mIcons[i]->getWidth();
+ }
+ }
+}
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index b3fc58fc..6e47f490 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +24,9 @@
#include "popup.h"
+#include <vector>
+
+class AnimatedSprite;
class ProgressBar;
/**
@@ -45,6 +47,15 @@ class MiniStatusWindow : public Popup
*/
void draw(gcn::Graphics *graphics);
+ /**
+ * Sets one of the icons.
+ */
+ void setIcon(int index, AnimatedSprite *sprite);
+
+ void eraseIcon(int index);
+
+ void drawIcons(Graphics *graphics);
+
private:
/**
* Updates this dialog with values from player_node.
@@ -57,6 +68,8 @@ class MiniStatusWindow : public Popup
ProgressBar *mHpBar;
ProgressBar *mMpBar;
ProgressBar *mXpBar;
+
+ std::vector<AnimatedSprite *> mIcons;
};
#endif
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index f524f8ea..5bde7f36 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,9 +34,10 @@
#include "../utils/gettext.h"
NpcTextDialog::NpcTextDialog(Network *network):
- Window("NPC"), mNetwork(network)
+ Window(_("NPC")), mNetwork(network),
+ mState(NPC_TEXT_STATE_WAITING)
{
- setWindowName(_("NPC"));
+ setWindowName("NPCText");
setResizable(true);
setMinWidth(200);
@@ -50,8 +50,7 @@ NpcTextDialog::NpcTextDialog(Network *network):
mTextBox->setOpaque(false);
mScrollArea = new ScrollArea(mTextBox);
- mButton = new Button(_("OK"), "", this);
- mButton->setActionEventId("ok");
+ mButton = new Button(_("Waiting for server"), "ok", this);
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
@@ -62,9 +61,16 @@ NpcTextDialog::NpcTextDialog(Network *network):
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ center();
loadWindowState();
}
+void NpcTextDialog::clearText()
+{
+ NPC::isTalking = false;
+ setText("");
+}
+
void NpcTextDialog::setText(const std::string &text)
{
mText = text;
@@ -74,27 +80,44 @@ void NpcTextDialog::setText(const std::string &text)
void NpcTextDialog::addText(const std::string &text)
{
setText(mText + text + "\n");
+ mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
}
-void NpcTextDialog::clearText()
+void NpcTextDialog::showNextButton()
{
- NPC::mTalking = false;
- setText("");
+ mButton->setCaption(_("Next"));
+ mState = NPC_TEXT_STATE_NEXT;
+ mButton->setEnabled(true);
+}
+
+void NpcTextDialog::showCloseButton()
+{
+ mButton->setCaption(_("Close"));
+ mState = NPC_TEXT_STATE_CLOSE;
+ mButton->setEnabled(true);
}
void NpcTextDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok")
{
- clearText();
- setVisible(false);
- saveWindowState();
-
- if (current_npc)
+ if (mState == NPC_TEXT_STATE_NEXT && current_npc) {
nextDialog();
-
- current_npc = 0;
+ addText("\n> Next\n");
+ } else if (mState == NPC_TEXT_STATE_CLOSE ||
+ (mState == NPC_TEXT_STATE_NEXT && !current_npc)) {
+ setText("");
+ if (current_npc) nextDialog();
+ setVisible(false);
+ current_npc = 0;
+ NPC::isTalking = false;
+ } else return;
}
+ else return;
+
+ mButton->setEnabled(false);
+ mButton->setCaption(_("Waiting for server"));
+ mState = NPC_TEXT_STATE_WAITING;
}
void NpcTextDialog::nextDialog(int npcID)
@@ -123,4 +146,3 @@ void NpcTextDialog::requestFocus()
loadWindowState();
setVisible(true);
}
-
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index f01e3602..011c7bcf 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -74,6 +73,10 @@ class NpcTextDialog : public Window, public gcn::ActionListener
*/
void addText(const std::string &string);
+ void showNextButton();
+
+ void showCloseButton();
+
/**
* Notifies the server that the client has performed a next action.
*/
@@ -105,6 +108,13 @@ class NpcTextDialog : public Window, public gcn::ActionListener
gcn::Button *mButton;
std::string mText;
+
+ enum NPCTextState {
+ NPC_TEXT_STATE_WAITING,
+ NPC_TEXT_STATE_NEXT,
+ NPC_TEXT_STATE_CLOSE
+ };
+ NPCTextState mState;
};
extern NpcTextDialog *npcTextDialog;
diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp
index 27721f0c..896f3380 100644
--- a/src/gui/npcintegerdialog.cpp
+++ b/src/gui/npcintegerdialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,6 +21,7 @@
#include "button.h"
#include "inttextfield.h"
+#include "npc_text.h"
#include "npcintegerdialog.h"
#include "widgets/layout.h"
@@ -32,20 +32,21 @@
#include "../net/protocol.h"
#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
NpcIntegerDialog::NpcIntegerDialog(Network *network):
Window(_("NPC Number Request")), mNetwork(network)
{
- mValueField = new IntTextField();
- setWindowName("NPCInput");
+ setWindowName("NPCInteger");
+ mValueField = new IntTextField;
setDefaultSize(175, 75, ImageRect::CENTER);
mDecButton = new Button("-", "decvalue", this);
mIncButton = new Button("+", "incvalue", this);
- okButton = new Button(_("OK"), "ok", this);
- cancelButton = new Button(_("Cancel"), "cancel", this);
- resetButton = new Button(_("Reset"), "reset", this);
+ gcn::Button *okButton = new Button(_("OK"), "ok", this);
+ gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this);
+ gcn::Button *resetButton = new Button(_("Reset"), "reset", this);
mDecButton->adjustSize();
mDecButton->setWidth(mIncButton->getWidth());
@@ -61,12 +62,14 @@ NpcIntegerDialog::NpcIntegerDialog(Network *network):
place(0, 0, resetButton);
place(2, 0, cancelButton);
place(3, 0, okButton);
- //reflowLayout(175, 0);
+ reflowLayout(175, 0);
+ center();
+ setDefaultSize();
loadWindowState();
}
-void NpcIntegerDialog::setRange(const int min, const int max)
+void NpcIntegerDialog::setRange(int min, int max)
{
mValueField->setRange(min, max);
}
@@ -88,11 +91,13 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "ok")
{
finish = true;
+ npcTextDialog->addText(strprintf("\n> %d\n", mValueField->getValue()));
}
else if (event.getId() == "cancel")
{
finish = true;
mValueField->reset();
+ npcTextDialog->addText(_("\n> Cancel\n"));
}
else if (event.getId() == "decvalue")
{
@@ -110,18 +115,22 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
if (finish)
{
setVisible(false);
- NPC::mTalking = false;
+ NPC::isTalking = false;
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_INT_RESPONSE);
outMsg.writeInt32(current_npc);
outMsg.writeInt32(mValueField->getValue());
- current_npc = 0;
mValueField->reset();
}
}
+void NpcIntegerDialog::setDefaultValue(int value)
+{
+ mValueField->setDefaultValue(value);
+}
+
bool NpcIntegerDialog::isInputFocused()
{
return mValueField->isFocused();
@@ -131,3 +140,13 @@ void NpcIntegerDialog::requestFocus()
{
mValueField->requestFocus();
}
+
+void NpcIntegerDialog::setVisible(bool visible)
+{
+ if (visible) {
+ npcTextDialog->setVisible(true);
+ requestFocus();
+ }
+
+ Window::setVisible(visible);
+}
diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h
index 15bdee48..58f6970b 100644
--- a/src/gui/npcintegerdialog.h
+++ b/src/gui/npcintegerdialog.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -66,7 +65,14 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener
* @param min The minimum value to allow
* @param max The maximum value to allow
*/
- void setRange(const int min, const int max);
+ void setRange(int min, int max);
+
+ /**
+ * Sets the default value.
+ *
+ * @param value The new default value
+ */
+ void setDefaultValue(int value);
/**
* Checks whether NpcStringDialog is Focused or not.
@@ -78,14 +84,13 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener
*/
void requestFocus();
+ void setVisible(bool visible);
+
private:
Network *mNetwork;
gcn::Button *mDecButton;
gcn::Button *mIncButton;
IntTextField *mValueField;
- gcn::Button *okButton;
- gcn::Button *cancelButton;
- gcn::Button *resetButton;
};
extern NpcIntegerDialog *npcIntegerDialog;
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 505912ac..ef8b0627 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +23,7 @@
#include "button.h"
#include "listbox.h"
+#include "npc_text.h"
#include "npclistdialog.h"
#include "scrollarea.h"
@@ -35,11 +35,12 @@
#include "../net/protocol.h"
#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
NpcListDialog::NpcListDialog(Network *network):
Window("NPC"), mNetwork(network)
{
- setWindowName(_("NPC"));
+ setWindowName("NPCList");
setResizable(true);
setMinWidth(200);
@@ -50,10 +51,10 @@ NpcListDialog::NpcListDialog(Network *network):
mItemList = new ListBox(this);
mItemList->setWrappingEnabled(true);
- scrollArea = new ScrollArea(mItemList);
+ gcn::ScrollArea *scrollArea = new ScrollArea(mItemList);
- okButton = new Button(_("OK"), "ok", this);
- cancelButton = new Button(_("Cancel"), "cancel", this);
+ gcn::Button *okButton = new Button(_("OK"), "ok", this);
+ gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(260, 175);
scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -65,6 +66,7 @@ NpcListDialog::NpcListDialog(Network *network):
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ center();
loadWindowState();
}
@@ -89,7 +91,7 @@ void NpcListDialog::parseItems(const std::string &itemString)
void NpcListDialog::reset()
{
- NPC::mTalking = false;
+ NPC::isTalking = false;
mItemList->setSelected(-1);
mItems.clear();
}
@@ -97,18 +99,23 @@ void NpcListDialog::reset()
void NpcListDialog::action(const gcn::ActionEvent &event)
{
int choice = 0;
-
if (event.getId() == "ok")
{
// Send the selected index back to the server
int selectedIndex = mItemList->getSelected();
if (selectedIndex > -1)
+ {
choice = selectedIndex + 1;
+ npcTextDialog->addText(strprintf("\n> \"%s\"\n",
+ mItems[selectedIndex].c_str()));
+ }
}
else if (event.getId() == "cancel")
{
choice = 0xff; // 0xff means cancel
+ npcTextDialog->addText(_("\n> Cancel\n"));
+ npcTextDialog->showCloseButton();
}
if (choice)
@@ -121,9 +128,17 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(current_npc);
outMsg.writeInt8(choice);
+ }
+}
- current_npc = 0;
+void NpcListDialog::setVisible(bool visible)
+{
+ if (visible) {
+ npcTextDialog->setVisible(true);
+ requestFocus();
}
+
+ Window::setVisible(visible);
}
void NpcListDialog::requestFocus()
diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h
index e3cf375b..f5f2147b 100644
--- a/src/gui/npclistdialog.h
+++ b/src/gui/npclistdialog.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,12 +22,12 @@
#ifndef GUI_NPCLISTDIALOG_H
#define GUI_NPCLISTDIALOG_H
-#include <vector>
+#include "window.h"
#include <guichan/actionlistener.hpp>
#include <guichan/listmodel.hpp>
-#include "window.h"
+#include <vector>
class Network;
@@ -75,6 +74,8 @@ class NpcListDialog : public Window, public gcn::ActionListener,
*/
void reset();
+ void setVisible(bool visible);
+
/**
* Requests the listbox to take focus for input and sets window width
* to the last known setting.
@@ -84,9 +85,6 @@ class NpcListDialog : public Window, public gcn::ActionListener,
private:
Network *mNetwork;
gcn::ListBox *mItemList;
- gcn::ScrollArea *scrollArea;
- gcn::Button *okButton;
- gcn::Button *cancelButton;
std::vector<std::string> mItems;
};
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index 43d0722f..c2379e7a 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +20,7 @@
*/
#include "button.h"
+#include "npc_text.h"
#include "npcstringdialog.h"
#include "textfield.h"
@@ -32,22 +32,26 @@
#include "../net/protocol.h"
#include "../utils/gettext.h"
+#include "../utils/strprintf.h"
NpcStringDialog::NpcStringDialog(Network *network):
Window(_("NPC Text Request")), mNetwork(network)
{
- setWindowName("NPCInput");
+ setWindowName("NPCString");
mValueField = new TextField("");
setDefaultSize(175, 75, ImageRect::CENTER);
- okButton = new Button(_("OK"), "ok", this);
- cancelButton = new Button(_("Cancel"), "cancel", this);
+ gcn::Button *okButton = new Button(_("OK"), "ok", this);
+ gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this);
place(0, 0, mValueField, 3);
place(1, 1, cancelButton);
place(2, 1, okButton);
+ reflowLayout(175, 0);
+ center();
+ setDefaultSize();
loadWindowState();
}
@@ -59,15 +63,24 @@ std::string NpcStringDialog::getValue()
void NpcStringDialog::setValue(const std::string &value)
{
mValueField->setText(value);
+ mDefault = value;
}
void NpcStringDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "cancel")
- mValueField->setText("");
+ {
+ mValueField->setText(mDefault);
+ npcTextDialog->addText(_("\n> Cancel\n"));
+ }
+ else
+ {
+ npcTextDialog->addText(strprintf("\n> \"%s\"\n",
+ mValueField->getText().c_str()));
+ }
setVisible(false);
- NPC::mTalking = false;
+ NPC::isTalking = false;
std::string text = mValueField->getText();
mValueField->setText("");
@@ -78,8 +91,6 @@ void NpcStringDialog::action(const gcn::ActionEvent &event)
outMsg.writeInt32(current_npc);
outMsg.writeString(text, text.length());
outMsg.writeInt8(0);
-
- current_npc = 0;
}
bool NpcStringDialog::isInputFocused()
@@ -91,3 +102,13 @@ void NpcStringDialog::requestFocus()
{
mValueField->requestFocus();
}
+
+void NpcStringDialog::setVisible(bool visible)
+{
+ if (visible) {
+ npcTextDialog->setVisible(true);
+ requestFocus();
+ }
+
+ Window::setVisible(visible);
+}
diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h
index ee620daf..0c552baa 100644
--- a/src/gui/npcstringdialog.h
+++ b/src/gui/npcstringdialog.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,9 +22,11 @@
#ifndef GUI_NPCSTRINGDIALOG_H
#define GUI_NPCSTRINGDIALOG_H
+#include "window.h"
+
#include <guichan/actionlistener.hpp>
-#include "window.h"
+class Network;
class Network;
@@ -71,11 +72,12 @@ class NpcStringDialog : public Window, public gcn::ActionListener
*/
void requestFocus();
+ void setVisible(bool visible);
+
private:
Network *mNetwork;
gcn::TextField *mValueField;
- gcn::Button *okButton;
- gcn::Button *cancelButton;
+ std::string mDefault;
};
extern NpcStringDialog *npcStringDialog;
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index d3e7bec6..f1a97b49 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,12 +33,12 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
Window *parent):
Window(title, true, parent)
{
- mTextBox = new TextBox();
+ mTextBox = new TextBox;
mTextBox->setEditable(false);
mTextBox->setOpaque(false);
mTextArea = new ScrollArea(mTextBox);
- okButton = new Button(_("Ok"), "ok", this);
+ gcn::Button *okButton = new Button(_("Ok"), "ok", this);
mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -75,7 +74,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
add(mTextArea);
add(okButton);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
okButton->requestFocus();
}
diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h
index c84cf4c4..24325c2f 100644
--- a/src/gui/ok_dialog.h
+++ b/src/gui/ok_dialog.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,13 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _OK_DIALOG_H
-#define _OK_DIALOG_H
-
-#include <guichan/actionlistener.hpp>
+#ifndef OK_DIALOG_H
+#define OK_DIALOG_H
#include "window.h"
+#include <guichan/actionlistener.hpp>
+
class ScrollArea;
class TextBox;
@@ -55,7 +54,6 @@ class OkDialog : public Window, public gcn::ActionListener {
private:
TextBox *mTextBox;
ScrollArea *mTextArea;
- gcn::Button *okButton;
};
#endif
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index d3e06902..b1e165aa 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,12 +45,12 @@ const gcn::Color Palette::RAINBOW_COLORS[7] = {
/** Number of Elemets of RAINBOW_COLORS */
const int Palette::RAINBOW_COLOR_COUNT = 7;
-std::string Palette::getConfigName(const std::string& typeName)
+std::string Palette::getConfigName(const std::string &typeName)
{
std::string res = "Color" + typeName;
int pos = 5;
- for (unsigned int i = 0; i < typeName.length(); i++)
+ for (size_t i = 0; i < typeName.length(); i++)
{
if (i == 0 || typeName[i] == '_')
{
@@ -70,14 +70,13 @@ std::string Palette::getConfigName(const std::string& typeName)
return res;
}
-DEFENUMNAMES(ColorType, COLOR_TYPE);
+DEFENUMNAMES(ColorType, COLOR_TYPE)
const int Palette::GRADIENT_DELAY = 40;
Palette::Palette() :
mRainbowTime(tick_time),
- mColVector(ColVector(TYPE_COUNT)),
- mGradVector()
+ mColVector(ColVector(TYPE_COUNT))
{
std::string indent = " ";
addColor(TEXT, 0x000000, STATIC, _("Text"));
@@ -177,7 +176,7 @@ void Palette::setGradient(ColorType type, GradientType grad)
ColorElem *elem = &mColVector[type];
if (elem->grad != STATIC && grad == STATIC)
{
- for (unsigned int i = 0; i < mGradVector.size(); i++)
+ for (size_t i = 0; i < mGradVector.size(); i++)
{
if (mGradVector[i] == elem)
{
@@ -278,7 +277,7 @@ void Palette::advanceGradient ()
int advance = get_elapsed_time(mRainbowTime) / 5;
double startColVal, destColVal;
- for (unsigned int i = 0; i < mGradVector.size(); i++)
+ for (size_t i = 0; i < mGradVector.size(); i++)
{
mGradVector[i]->gradientIndex =
(mGradVector[i]->gradientIndex + advance) %
@@ -346,4 +345,3 @@ void Palette::advanceGradient ()
mRainbowTime = tick_time;
}
}
-
diff --git a/src/gui/palette.h b/src/gui/palette.h
index ccef231e..1a466ed4 100644
--- a/src/gui/palette.h
+++ b/src/gui/palette.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ class Palette : public gcn::ListModel
ENTRY(MISS)\
ENTRY(TYPE_COUNT)\
- TEXTENUM(ColorType, COLOR_TYPE);
+ TEXTENUM(ColorType, COLOR_TYPE)
/** Colors can be static or can alter over time. */
enum GradientType {
@@ -148,7 +148,9 @@ class Palette : public gcn::ListModel
* @return the requested committed color
*/
inline const gcn::Color& getCommittedColor(ColorType type)
- { return mColVector[type].committedColor; }
+ {
+ return mColVector[type].committedColor;
+ }
/**
* Gets the test color associated with the specified type.
@@ -158,7 +160,9 @@ class Palette : public gcn::ListModel
* @return the requested test color
*/
inline const gcn::Color& getTestColor(ColorType type)
- { return mColVector[type].testColor; }
+ {
+ return mColVector[type].testColor;
+ }
/**
* Sets the test color associated with the specified type.
@@ -167,7 +171,9 @@ class Palette : public gcn::ListModel
* @param color the color that should be tested
*/
inline void setTestColor(ColorType type, gcn::Color color)
- { mColVector[type].testColor = color; }
+ {
+ mColVector[type].testColor = color;
+ }
/**
* Gets the GradientType associated with the specified type.
@@ -177,7 +183,9 @@ class Palette : public gcn::ListModel
* @return the gradient type of the color with the given index
*/
inline GradientType getGradientType(ColorType type)
- { return mColVector[type].grad; }
+ {
+ return mColVector[type].grad;
+ }
/**
* Get the character used by the specified color.
@@ -186,7 +194,10 @@ class Palette : public gcn::ListModel
*
* @return the color char of the color with the given index
*/
- inline char getColorChar(ColorType type) { return mColVector[type].ch; }
+ inline char getColorChar(ColorType type)
+ {
+ return mColVector[type].ch;
+ }
/**
* Sets the color for the specified type.
@@ -234,7 +245,10 @@ class Palette : public gcn::ListModel
/**
* Commit the colors
*/
- inline void commit() { commit(false); }
+ inline void commit()
+ {
+ commit(false);
+ }
/**
* Rollback the colors
diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp
index 073f5e36..345ee1c3 100644
--- a/src/gui/passwordfield.cpp
+++ b/src/gui/passwordfield.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h
index adad54fe..42f8d187 100644
--- a/src/gui/passwordfield.h
+++ b/src/gui/passwordfield.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 2a6cdb20..7223c453 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index ee25520a..7c08defd 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 02be3055..7627c1ad 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -57,7 +56,7 @@ PopupMenu::PopupMenu():
setTitleBarHeight(0);
setShowTitle(false);
- mBrowserBox = new BrowserBox();
+ mBrowserBox = new BrowserBox;
mBrowserBox->setPosition(4, 4);
mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND);
mBrowserBox->setOpaque(false);
@@ -83,22 +82,22 @@ void PopupMenu::showPopup(int x, int y, Being *being)
mBrowserBox->addRow("##3---");
switch (player_relations.getRelation(name)) {
- case PlayerRelation::NEUTRAL:
- mBrowserBox->addRow(strprintf(_("@@friend|Befriend %s@@"), name.c_str()));
-
- case PlayerRelation::FRIEND:
- mBrowserBox->addRow(strprintf(_("@@disregard|Disregard %s@@"), name.c_str()));
- mBrowserBox->addRow(strprintf(_("@@ignore|Ignore %s@@"), name.c_str()));
- break;
-
- case PlayerRelation::DISREGARDED:
- mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
- mBrowserBox->addRow(strprintf(_("@@ignore|Completely ignore %s@@"), name.c_str()));
- break;
-
- case PlayerRelation::IGNORED:
- mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
- break;
+ case PlayerRelation::NEUTRAL:
+ mBrowserBox->addRow(strprintf(_("@@friend|Befriend %s@@"), name.c_str()));
+
+ case PlayerRelation::FRIEND:
+ mBrowserBox->addRow(strprintf(_("@@disregard|Disregard %s@@"), name.c_str()));
+ mBrowserBox->addRow(strprintf(_("@@ignore|Ignore %s@@"), name.c_str()));
+ break;
+
+ case PlayerRelation::DISREGARDED:
+ mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
+ mBrowserBox->addRow(strprintf(_("@@ignore|Completely ignore %s@@"), name.c_str()));
+ break;
+
+ case PlayerRelation::IGNORED:
+ mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
+ break;
}
//mBrowserBox->addRow(_("@@follow|Follow ") + name + "@@");
@@ -148,42 +147,55 @@ void PopupMenu::handleLink(const std::string& link)
Being *being = beingManager->findBeing(mBeingId);
// Talk To action
- if (link == "talk" && being && being->getType() == Being::NPC &&
+ if (link == "talk" &&
+ being &&
+ being->getType() == Being::NPC &&
current_npc == 0)
{
dynamic_cast<NPC*>(being)->talk();
}
// Trade action
- else if (link == "trade" && being && being->getType() == Being::PLAYER)
+ else if (link == "trade" &&
+ being &&
+ being->getType() == Being::PLAYER)
{
player_node->trade(being);
tradePartnerName = being->getName();
}
// Attack action
- else if (link == "attack" && being && being->getType() == Being::PLAYER)
+ else if (link == "attack" &&
+ being &&
+ being->getType() == Being::PLAYER)
{
player_node->attack(being, true);
}
- else if (link == "unignore" && being && being->getType() == Being::PLAYER)
+ else if (link == "unignore" &&
+ being &&
+ being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL);
}
- else if (link == "ignore" && being && being->getType() == Being::PLAYER)
+ else if (link == "ignore" &&
+ being &&
+ being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::IGNORED);
}
- else if (link == "disregard" && being &&
+ else if (link == "disregard" &&
+ being &&
being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED);
}
- else if (link == "friend" && being && being->getType() == Being::PLAYER)
+ else if (link == "friend" &&
+ being &&
+ being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::FRIEND);
}
@@ -244,7 +256,8 @@ void PopupMenu::handleLink(const std::string& link)
{
new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
}
- else if (link == "party-invite" && being &&
+ else if (link == "party-invite" &&
+ being &&
being->getType() == Being::PLAYER)
{
MessageOut outMsg(player_node->getNetwork());
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 89152751..0a6877d9 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 1f21df79..58d7d815 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index 3c88f3a3..aa36e02b 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -113,6 +112,8 @@ class ProgressBar : public gcn::Widget
static ImageRect mBorder;
static int mInstances;
static float mAlpha;
+
+ static const gcn::Color TEXT_COLOR;
};
#endif
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index c839238b..52ceb837 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h
index cd501126..3d952b3f 100644
--- a/src/gui/radiobutton.h
+++ b/src/gui/radiobutton.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index 9320e020..479ab76b 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -2,7 +2,7 @@
* A chat recorder
* Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title,
const std::string &buttonTxt) :
Window(title)
{
- setWindowName(_("Recorder"));
+ setWindowName("Recorder");
const int offsetX = 2 * getPadding() + 10;
const int offsetY = getTitleBarHeight() + getPadding() + 10;
@@ -100,7 +100,8 @@ void Recorder::changeRecordingStatus(const std::string &msg)
* recorded.
*/
mChat->chatLog(_("Starting to record..."), BY_SERVER);
- std::string file = std::string(PHYSFS_getUserDir()) + "/.aethyra/" + msgCopy;
+ const std::string file =
+ std::string(PHYSFS_getUserDir()) + "/.tmw/" + msgCopy;
mStream.open(file.c_str(), std::ios_base::trunc);
diff --git a/src/gui/recorder.h b/src/gui/recorder.h
index 4f41ff42..0bbab012 100644
--- a/src/gui/recorder.h
+++ b/src/gui/recorder.h
@@ -2,7 +2,7 @@
* A chat recorder
* Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 63a0d29c..0e8a99ca 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -128,7 +127,7 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mServerField->addActionListener(this);
mPortField->addActionListener(this);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
mUserField->requestFocus();
mUserField->setCaretPosition(mUserField->getText().length());
diff --git a/src/gui/register.h b/src/gui/register.h
index 922320db..9588e07e 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index 43b27f23..44ef929b 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,18 +35,16 @@ ImageRect ScrollArea::background;
ImageRect ScrollArea::vMarker;
Image *ScrollArea::buttons[4][2];
-ScrollArea::ScrollArea(bool gc, bool opaque):
+ScrollArea::ScrollArea():
gcn::ScrollArea(),
- mOpaque(opaque),
- mGC(gc)
+ mOpaque(true)
{
init();
}
-ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque):
+ScrollArea::ScrollArea(gcn::Widget *widget):
gcn::ScrollArea(widget),
- mOpaque(opaque),
- mGC(gc)
+ mOpaque(true)
{
init();
}
@@ -55,8 +52,7 @@ ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque):
ScrollArea::~ScrollArea()
{
// Garbage collection
- if (mGC)
- delete getContent();
+ delete getContent();
instances--;
diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h
index 080b851c..e9aa5ed2 100644
--- a/src/gui/scrollarea.h
+++ b/src/gui/scrollarea.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +30,10 @@ class ImageRect;
/**
* A scroll area.
*
+ * Contrary to Guichan's scroll area, this scroll area takes ownership over its
+ * content. However, it won't delete a previously set content widget when
+ * setContent is called!
+ *
* \ingroup GUI
*/
class ScrollArea : public gcn::ScrollArea
@@ -39,12 +42,12 @@ class ScrollArea : public gcn::ScrollArea
/**
* Constructor.
*/
- ScrollArea(bool gc = true, bool opaque = true);
+ ScrollArea();
/**
* Constructor.
*/
- ScrollArea(gcn::Widget *content, bool gc = true, bool opaque = true);
+ ScrollArea(gcn::Widget *content);
/**
* Destructor.
@@ -107,7 +110,6 @@ class ScrollArea : public gcn::ScrollArea
static Image *buttons[4][2];
bool mOpaque;
- bool mGC;
};
#endif
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 591cf97b..fe391636 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +30,7 @@
#include "widgets/layout.h"
#include "../npc.h"
+#include "../units.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -39,11 +39,11 @@
#include "../utils/strprintf.h"
SellDialog::SellDialog(Network *network):
- Window("Sell"),
+ Window(_("Sell")),
mNetwork(network),
mMaxItems(0), mAmountItems(0)
{
- setWindowName(_("Sell"));
+ setWindowName("Sell");
setResizable(true);
setCloseButton(true);
setMinWidth(260);
@@ -61,8 +61,8 @@ SellDialog::SellDialog(Network *network):
mQuantityLabel = new Label(strprintf("%d / %d", mAmountItems, mMaxItems));
mQuantityLabel->setAlignment(gcn::Graphics::CENTER);
- mMoneyLabel = new Label(
- strprintf(_("Price: %d GP / Total: %d GP"), 0, 0));
+ mMoneyLabel = new Label(strprintf(_("Price: %s / Total: %s"),
+ "", ""));
mIncreaseButton = new Button("+", "+", this);
mDecreaseButton = new Button("-", "-", this);
@@ -103,6 +103,7 @@ SellDialog::SellDialog(Network *network):
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ center();
loadWindowState();
}
@@ -275,9 +276,16 @@ void SellDialog::updateButtonsAndLabels()
// Update the quantity and money labels
mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems));
- mMoneyLabel->setCaption
- (strprintf(_("Price: %d GP / Total: %d GP"),
- income, mPlayerMoney + income));
+ mMoneyLabel->setCaption(strprintf(_("Price: %s / Total: %s"),
+ Units::formatCurrency(income).c_str(),
+ Units::formatCurrency(mPlayerMoney + income).c_str()));
+}
+
+void SellDialog::logic()
+{
+ Window::logic();
+
+ if (!current_npc) setVisible(false);
}
void SellDialog::setVisible(bool visible)
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 930f8bc1..45b6a704 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -83,6 +82,11 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener
void setMoney(int amount);
/**
+ * Check for current NPC
+ */
+ void logic();
+
+ /**
* Sets the visibility of this window.
*/
void setVisible(bool visible);
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index ca6b4010..849a30c2 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -108,7 +107,7 @@ Setup::Setup():
add(panel);
- setLocationRelativeTo(getParent());
+ center();
setInGame(false);
}
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 663bdfcb..4c387d34 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,7 +62,7 @@ class Setup : public Window, public gcn::ActionListener
private:
std::list<SetupTab*> mTabs;
- gcn::Button* mResetWindows;
+ gcn::Button *mResetWindows;
};
extern Setup* setupWindow;
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 08eda848..2ca39282 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h
index aad16617..9e951895 100644
--- a/src/gui/setup_audio.h
+++ b/src/gui/setup_audio.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 108067f5..033ba372 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -2,7 +2,7 @@
* Configurable text colors
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -83,7 +83,7 @@ Setup_Colors::Setup_Colors() :
mRedLabel = new Label(_("Red: "));
- mRedText = new TextField();
+ mRedText = new TextField;
mRedText->setWidth(40);
mRedText->setRange(0, 255);
mRedText->setNumeric(true);
@@ -99,7 +99,7 @@ Setup_Colors::Setup_Colors() :
mGreenLabel = new Label(_("Green: "));
- mGreenText = new TextField();
+ mGreenText = new TextField;
mGreenText->setWidth(40);
mGreenText->setRange(0, 255);
mGreenText->setNumeric(true);
@@ -115,7 +115,7 @@ Setup_Colors::Setup_Colors() :
mBlueLabel = new Label(_("Blue: "));
- mBlueText = new TextField();
+ mBlueText = new TextField;
mBlueText->setWidth(40);
mBlueText->setRange(0, 255);
mBlueText->setNumeric(true);
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 00f77d57..52d3f727 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -2,7 +2,7 @@
* Configurable text colors
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 4d80e0dd..59a882c7 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index ae888206..eba8a2cc 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index 0f79e3c6..aba8cf35 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -1,9 +1,9 @@
/*
- * Aethyra
- * Copyright (C) 2007 The Mana World Development Team
+ * Custom keyboard shortcuts configuration
+ * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au>
+ * Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,7 +69,7 @@ class KeyListModel : public gcn::ListModel
};
Setup_Keyboard::Setup_Keyboard():
- mKeyListModel(new KeyListModel()),
+ mKeyListModel(new KeyListModel),
mKeyList(new ListBox(mKeyListModel)),
mKeySetting(false)
{
diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h
index 5fa961ae..dee12135 100644
--- a/src/gui/setup_keyboard.h
+++ b/src/gui/setup_keyboard.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2007 The Mana World Development Team
+ * Custom keyboard shortcuts configuration
+ * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au>
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 05748000..1451e71e 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -69,9 +68,9 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] =
class PlayerRelationListModel : public gcn::ListModel
{
public:
- virtual ~PlayerRelationListModel(void) { }
+ virtual ~PlayerRelationListModel() { }
- virtual int getNumberOfElements(void)
+ virtual int getNumberOfElements()
{
return PlayerRelation::RELATIONS_NR;
}
@@ -87,30 +86,30 @@ public:
class PlayerTableModel : public TableModel
{
public:
- PlayerTableModel(void) :
+ PlayerTableModel() :
mPlayers(NULL)
{
playerRelationsUpdated();
}
- virtual ~PlayerTableModel(void)
+ virtual ~PlayerTableModel()
{
freeWidgets();
if (mPlayers)
delete mPlayers;
}
- virtual int getRows(void)
+ virtual int getRows()
{
return mPlayers->size();
}
- virtual int getColumns(void)
+ virtual int getColumns()
{
return COLUMNS_NR;
}
- virtual int getRowHeight(void)
+ virtual int getRowHeight()
{
return ROW_HEIGHT;
}
@@ -123,7 +122,7 @@ public:
return RELATION_CHOICE_COLUMN_WIDTH;
}
- virtual void playerRelationsUpdated(void)
+ virtual void playerRelationsUpdated()
{
signalBeforeUpdate();
@@ -139,10 +138,10 @@ public:
std::string name = (*player_names)[r];
gcn::Widget *widget = new Label(name);
mWidgets.push_back(widget);
- gcn::ListModel *playerRelation = new PlayerRelationListModel();
+ gcn::ListModel *playerRelation = new PlayerRelationListModel;
gcn::DropDown *choicebox = new DropDown(playerRelation,
- new ScrollArea(),
+ new ScrollArea,
new ListBox(playerRelation),
false);
choicebox->setSelected(player_relations.getRelation(name));
@@ -167,7 +166,7 @@ public:
return mWidgets[WIDGET_AT(row, column)];
}
- virtual void freeWidgets(void)
+ virtual void freeWidgets()
{
if (mPlayers)
delete mPlayers;
@@ -198,9 +197,9 @@ protected:
class IgnoreChoicesListModel : public gcn::ListModel
{
public:
- virtual ~IgnoreChoicesListModel(void) { }
+ virtual ~IgnoreChoicesListModel() { }
- virtual int getNumberOfElements(void)
+ virtual int getNumberOfElements()
{
return player_relations.getPlayerIgnoreStrategies()->size();
}
@@ -220,7 +219,7 @@ public:
Setup_Players::Setup_Players():
mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)),
- mPlayerTableModel(new PlayerTableModel()),
+ mPlayerTableModel(new PlayerTableModel),
mPlayerTable(new GuiTable(mPlayerTableModel)),
mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)),
mPlayerScrollArea(new ScrollArea(mPlayerTable)),
@@ -240,8 +239,8 @@ Setup_Players::Setup_Players():
RELATION_CHOICE_COLUMN_WIDTH);
mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf));
- gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel();
- mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea(),
+ gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel;
+ mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea,
new ListBox(ignoreChoices), false);
for (int i = 0; i < COLUMNS_NR; i++)
@@ -294,7 +293,7 @@ Setup_Players::Setup_Players():
setDimension(gcn::Rectangle(0, 0, 325, 280));
}
-Setup_Players::~Setup_Players(void)
+Setup_Players::~Setup_Players()
{
player_relations.removeListener(this);
}
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 23a994a0..72d81f71 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index e181f744..74574ec7 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -123,6 +122,10 @@ Setup_Video::Setup_Video():
mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)),
mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)),
mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)),
+ mPickupNotifyLabel(new Label(_("Show pickup notification"))),
+ mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)),
+ mPickupParticleCheckBox(new CheckBox(_("as particle"),
+ mPickupParticleEnabled)),
mSpeechSlider(new Slider(0, 3)),
mSpeechLabel(new Label("")),
mAlphaSlider(new Slider(0.2, 1.0)),
@@ -140,11 +143,7 @@ Setup_Video::Setup_Video():
mOverlayDetailField(new Label("")),
mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)),
mParticleDetailSlider(new Slider(0, 3)),
- mParticleDetailField(new Label("")),
- mPickupNotifyLabel(new Label(_("Show pickup notification"))),
- mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)),
- mPickupParticleCheckBox(new CheckBox(_("as particle"),
- mPickupParticleEnabled))
+ mParticleDetailField(new Label(""))
{
setOpaque(false);
@@ -320,7 +319,7 @@ void Setup_Video::apply()
* See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode
*/
-#ifdef WIN32
+#if defined(WIN32) || defined(__APPLE__)
// checks for opengl usage
if (!(config.getValue("opengl", false) == 1))
{
@@ -338,7 +337,7 @@ void Setup_Video::apply()
logger->error(error.str());
}
}
-#ifdef WIN32
+#if defined(WIN32) || defined(__APPLE__)
}
else
{
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index b491cf23..7d9732a1 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -75,6 +74,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
gcn::CheckBox *mParticleEffectsCheckBox;
gcn::CheckBox *mNameCheckBox;
+ gcn::Label *mPickupNotifyLabel;
+ gcn::CheckBox *mPickupChatCheckBox;
+ gcn::CheckBox *mPickupParticleCheckBox;
+
gcn::Slider *mSpeechSlider;
gcn::Label *mSpeechLabel;
gcn::Slider *mAlphaSlider;
@@ -97,10 +100,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
int mParticleDetail;
gcn::Slider *mParticleDetailSlider;
gcn::Label *mParticleDetailField;
-
- gcn::Label *mPickupNotifyLabel;
- gcn::CheckBox *mPickupChatCheckBox;
- gcn::CheckBox *mPickupParticleCheckBox;
};
#endif
diff --git a/src/gui/setuptab.h b/src/gui/setuptab.h
index 7e1bc36f..3e0c51e2 100644
--- a/src/gui/setuptab.h
+++ b/src/gui/setuptab.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index bd676bc0..85f238c0 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shop.h b/src/gui/shop.h
index 118847f9..0c900d9d 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 5c55069f..aa42c294 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h
index bed9902b..5d3378b1 100644
--- a/src/gui/shoplistbox.h
+++ b/src/gui/shoplistbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp
index fcb33279..901095e5 100644
--- a/src/gui/shortcutcontainer.cpp
+++ b/src/gui/shortcutcontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright 2007 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shortcutcontainer.h b/src/gui/shortcutcontainer.h
index 3f2e1c60..7b09fb96 100644
--- a/src/gui/shortcutcontainer.h
+++ b/src/gui/shortcutcontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright 2007 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef SHORTCUTCONTAINER_H__
-#define SHORTCUTCONTAINER_H__
+#ifndef SHORTCUTCONTAINER_H
+#define SHORTCUTCONTAINER_H
#include <guichan/mouselistener.hpp>
#include <guichan/widget.hpp>
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 8342465a..dcc7f72e 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright 2007 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h
index d79fffd2..eae881ba 100644
--- a/src/gui/shortcutwindow.h
+++ b/src/gui/shortcutwindow.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright 2007 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 9fbae7a6..39ccbb06 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,11 +45,14 @@ struct SkillInfo
bool modifiable;
};
-static const SkillInfo fakeSkillInfo = { _("???"), false };
+static const SkillInfo fakeSkillInfo = {
+ _("Mystery Skill"),
+ false
+};
std::vector<SkillInfo> skill_db;
-static void initSkillinfo(void);
+static void initSkillinfo();
class SkillGuiTableModel : public StaticTableModel
{
@@ -76,12 +78,12 @@ public:
return 35;
}
- virtual int getRowHeight(void)
+ virtual int getRowHeight()
{
return 12;
}
- virtual void update(void)
+ virtual void update()
{
mEntriesNr = mDialog->getSkills().size();
resize();
@@ -113,7 +115,6 @@ public:
}
}
-
private:
SkillDialog *mDialog;
int mEntriesNr;
@@ -132,7 +133,7 @@ SkillDialog::SkillDialog():
mTable->setActionEventId("skill");
mTable->addActionListener(this);
- setWindowName(_("Skills"));
+ setWindowName("Skills");
setCloseButton(true);
setDefaultSize(255, 260, ImageRect::CENTER);
@@ -155,7 +156,7 @@ SkillDialog::SkillDialog():
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
- setLocationRelativeTo(getParent());
+ center();
loadWindowState();
}
@@ -234,7 +235,7 @@ bool SkillDialog::hasSkill(int id)
void SkillDialog::addSkill(int id, int lvl, int mp)
{
- SKILL *tmp = new SKILL();
+ SKILL *tmp = new SKILL;
tmp->id = id;
tmp->lv = lvl;
tmp->sp = mp;
@@ -255,11 +256,11 @@ void SkillDialog::setSkill(int id, int lvl, int mp)
void SkillDialog::cleanList()
{
- for_each(mSkillList.begin(), mSkillList.end(), make_dtor(mSkillList));
+ delete_all(mSkillList);
mSkillList.clear();
}
-static void initSkillinfo(void)
+static void initSkillinfo()
{
SkillInfo emptySkillInfo = { "", false };
diff --git a/src/gui/skill.h b/src/gui/skill.h
index bcdd515c..0600d106 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -66,7 +65,7 @@ class SkillDialog : public Window, public gcn::ActionListener
void setSkill(int id, int lv, int sp);
void cleanList();
- const std::vector<SKILL*>& getSkills(void) const { return mSkillList; }
+ const std::vector<SKILL*>& getSkills() const { return mSkillList; }
private:
GuiTable *mTable;
diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp
index a2df59a4..cc381c32 100644
--- a/src/gui/slider.cpp
+++ b/src/gui/slider.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/slider.h b/src/gui/slider.h
index 35d875db..56ea334a 100644
--- a/src/gui/slider.h
+++ b/src/gui/slider.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 9e4c9234..de0c8406 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008, The Legend of Mazzeroth Development Team
+ * Speech bubbles
+ * Copyright (C) 2008 The Legend of Mazzeroth Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,7 +44,7 @@ SpeechBubble::SpeechBubble():
mCaption->setFont(boldFont);
mCaption->setPosition(5, 3);
- mSpeechBox = new TextBox();
+ mSpeechBox = new TextBox;
mSpeechBox->setEditable(false);
mSpeechBox->setOpaque(false);
mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT));
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 9eb400fb..8bb0e5ea 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008, The Legend of Mazzeroth Development Team
+ * Speech bubbles
+ * Copyright (C) 2008 The Legend of Mazzeroth Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 8dd32039..a9af2ab4 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +28,7 @@
#include "widgets/layout.h"
#include "../localplayer.h"
+#include "../units.h"
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
@@ -36,9 +36,10 @@
StatusWindow::StatusWindow(LocalPlayer *player):
Window(player->getName()),
- mPlayer(player)
+ mPlayer(player),
+ mCurrency(0)
{
- setWindowName(_("Status"));
+ setWindowName("Status");
setCloseButton(true);
setDefaultSize(400, 345, ImageRect::CENTER);
@@ -48,7 +49,8 @@ StatusWindow::StatusWindow(LocalPlayer *player):
mLvlLabel = new Label(strprintf(_("Level: %d"), 0));
mJobLvlLabel = new Label(strprintf(_("Job: %d"), 0));
- mGpLabel = new Label(strprintf(_("Money: %d GP"), 0));
+ mGpLabel = new Label(strprintf(_("Money: %s"),
+ Units::formatCurrency(mCurrency).c_str()));
mHpLabel = new Label(_("HP:"));
mHpBar = new ProgressBar(1.0f, 80, 15, 0, 171, 34);
@@ -77,8 +79,11 @@ StatusWindow::StatusWindow(LocalPlayer *player):
mStatsDefenseLabel= new Label(_("Defense:"));
mStatsMagicAttackLabel = new Label(_("M.Attack:"));
mStatsMagicDefenseLabel = new Label(_("M.Defense:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsAccuracyLabel = new Label(_("% Accuracy:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsEvadeLabel = new Label(_("% Evade:"));
+ // Gettext flag for next line: xgettext:no-c-format
mStatsReflexLabel = new Label(_("% Reflex:"));
mStatsAttackPoints = new Label;
@@ -167,36 +172,20 @@ void StatusWindow::update()
mJobLvlLabel->setCaption(strprintf(_("Job: %d"), mPlayer->mJobLevel));
mJobLvlLabel->adjustSize();
- mGpLabel->setCaption(strprintf(_("Money: %d GP"), mPlayer->mGp));
- mGpLabel->adjustSize();
-
- mHpBar->setText(toString(mPlayer->mHp) +
- "/" + toString(mPlayer->mMaxHp));
-
- mMpBar->setText(toString(mPlayer->mMp) +
- "/" + toString(mPlayer->mMaxMp));
+ if (mCurrency != mPlayer->mGp) {
+ mCurrency = mPlayer->mGp;
+ mGpLabel->setCaption(strprintf(_("Money: %s"),
+ Units::formatCurrency(mCurrency).c_str()));
+ mGpLabel->adjustSize();
+ }
- mXpBar->setText(toString(mPlayer->getXp()) +
- "/" + toString(mPlayer->mXpForNextLevel));
+ updateHPBar(mHpBar, true);
- mJobBar->setText(toString(mPlayer->mJobXp) +
- "/" + toString(mPlayer->mJobXpForNextLevel));
+ updateMPBar(mMpBar, true);
- // HP Bar coloration
- if (mPlayer->mHp < int(mPlayer->mMaxHp / 3))
- mHpBar->setColor(223, 32, 32); // Red
- else if (mPlayer->mHp < int((mPlayer->mMaxHp / 3) * 2))
- mHpBar->setColor(230, 171, 34); // Orange
- else
- mHpBar->setColor(0, 171, 34); // Green
+ updateXPBar(mXpBar, false);
- mHpBar->setProgress((float) mPlayer->mHp / (float) mPlayer->mMaxHp);
- mMpBar->setProgress((float) mPlayer->mMp / (float) mPlayer->mMaxMp);
-
- mXpBar->setProgress(
- (float) mPlayer->getXp() / (float) mPlayer->mXpForNextLevel);
- mJobBar->setProgress(
- (float) mPlayer->mJobXp / (float) mPlayer->mJobXpForNextLevel);
+ updateJobBar(mJobBar, false);
// Stats Part
// ----------
@@ -291,3 +280,84 @@ void StatusWindow::action(const gcn::ActionEvent &event)
player_node->raiseAttribute(LocalPlayer::LUK);
}
}
+
+void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax)
+{
+ if (showMax)
+ bar->setText(toString(player_node->mHp) +
+ "/" + toString(player_node->mMaxHp));
+ else
+ bar->setText(toString(player_node->mHp));
+
+ // HP Bar coloration
+ if (player_node->mHp < player_node->mMaxHp / 3)
+ {
+ bar->setColor(223, 32, 32); // Red
+ }
+ else if (player_node->mHp < (player_node->mMaxHp / 3) * 2)
+ {
+ bar->setColor(230, 171, 34); // Orange
+ }
+ else
+ {
+ bar->setColor(0, 171, 34); // Green
+ }
+
+ bar->setProgress((float) player_node->mHp / (float) player_node->mMaxHp);
+}
+
+void StatusWindow::updateMPBar(ProgressBar *bar, bool showMax)
+{
+ if (showMax)
+ bar->setText(toString(player_node->mMp) +
+ "/" + toString(player_node->mMaxMp));
+ else
+ bar->setText(toString(player_node->mMp));
+
+
+ bar->setProgress((float) player_node->mMp / (float) player_node->mMaxMp);
+}
+
+void StatusWindow::updateXPBar(ProgressBar *bar, bool percent)
+{
+ if (player_node->mXpForNextLevel == 0) {
+ bar->setText(_("Max level"));
+ bar->setProgress(1.0);
+ } else {
+ if (percent)
+ {
+ float xp = (float) player_node->getXp() /
+ player_node->mXpForNextLevel;
+ bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) +
+ "%");
+ }
+ else
+ bar->setText(toString(player_node->getXp()) +
+ "/" + toString(player_node->mXpForNextLevel));
+
+ bar->setProgress((float) player_node->getXp() /
+ (float) player_node->mXpForNextLevel);
+ }
+}
+
+void StatusWindow::updateJobBar(ProgressBar *bar, bool percent)
+{
+ if (player_node->mJobXpForNextLevel == 0) {
+ bar->setText(_("Max level"));
+ bar->setProgress(1.0);
+ } else {
+ if (percent)
+ {
+ float xp = (float) player_node->mJobXp /
+ player_node->mJobXpForNextLevel;
+ bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) +
+ "%");
+ }
+ else
+ bar->setText(toString(player_node->mJobXp) +
+ "/" + toString(player_node->mJobXpForNextLevel));
+
+ bar->setProgress((float) player_node->mJobXp /
+ (float) player_node->mJobXpForNextLevel);
+ }
+}
diff --git a/src/gui/status.h b/src/gui/status.h
index 5056f631..f3f54f4e 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,6 +57,11 @@ class StatusWindow : public Window, public gcn::ActionListener
*/
void update();
+ static void updateHPBar(ProgressBar *bar, bool showMax = false);
+ static void updateMPBar(ProgressBar *bar, bool showMax = false);
+ static void updateXPBar(ProgressBar *bar, bool percent = true);
+ static void updateJobBar(ProgressBar *bar, bool percent = true);
+
private:
LocalPlayer *mPlayer;
@@ -66,6 +70,7 @@ class StatusWindow : public Window, public gcn::ActionListener
*/
gcn::Label *mLvlLabel, *mJobLvlLabel;
gcn::Label *mGpLabel;
+ Uint32 mCurrency;
gcn::Label *mHpLabel, *mMpLabel, *mXpLabel, *mJobLabel;
ProgressBar *mHpBar, *mMpBar;
ProgressBar *mXpBar, *mJobBar;
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index 5036fc15..8484093a 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -39,9 +39,9 @@
#include "../inventory.h"
#include "../item.h"
#include "../localplayer.h"
+#include "../units.h"
#include "../net/messageout.h"
-#include "../net/network.h"
#include "../net/protocol.h"
#include "../resources/iteminfo.h"
diff --git a/src/gui/storagewindow.h b/src/gui/storagewindow.h
index 8f02a618..c78d33a7 100644
--- a/src/gui/storagewindow.h
+++ b/src/gui/storagewindow.h
@@ -40,7 +40,8 @@ class TextBox;
*
* \ingroup Interface
*/
-class StorageWindow : public Window, gcn::ActionListener, gcn::SelectionListener
+class StorageWindow : public Window, gcn::ActionListener,
+ gcn::SelectionListener
{
public:
/**
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 17d8bfbf..ec5b0480 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra derived from original code
- * from Guichan.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,7 +37,7 @@ class GuiTableActionListener : public gcn::ActionListener
public:
GuiTableActionListener(GuiTable *_table, gcn::Widget *_widget, int _row, int _column);
- virtual ~GuiTableActionListener(void);
+ virtual ~GuiTableActionListener();
virtual void action(const gcn::ActionEvent& actionEvent);
@@ -63,7 +62,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *wid
}
}
-GuiTableActionListener::~GuiTableActionListener(void)
+GuiTableActionListener::~GuiTableActionListener()
{
if (mWidget)
{
@@ -97,13 +96,13 @@ GuiTable::GuiTable(TableModel *initial_model, gcn::Color background,
addKeyListener(this);
}
-GuiTable::~GuiTable(void)
+GuiTable::~GuiTable()
{
uninstallActionListeners();
delete mModel;
}
-TableModel* GuiTable::getModel(void) const
+TableModel *GuiTable::getModel() const
{
return mModel;
}
@@ -126,7 +125,7 @@ void GuiTable::setModel(TableModel *new_model)
}
}
-void GuiTable::recomputeDimensions(void)
+void GuiTable::recomputeDimensions()
{
int rows_nr = mModel->getRows();
int columns_nr = mModel->getColumns();
@@ -154,12 +153,12 @@ void GuiTable::setSelected(int row, int column)
mSelectedRow = row;
}
-int GuiTable::getSelectedRow(void)
+int GuiTable::getSelectedRow()
{
return mSelectedRow;
}
-int GuiTable::getSelectedColumn(void)
+int GuiTable::getSelectedColumn()
{
return mSelectedColumn;
}
@@ -169,7 +168,7 @@ void GuiTable::setLinewiseSelection(bool linewise)
mLinewiseMode = linewise;
}
-int GuiTable::getRowHeight(void)
+int GuiTable::getRowHeight()
{
if (mModel)
return mModel->getRowHeight() + 1; // border
@@ -201,7 +200,7 @@ void GuiTable::setSelectedRow(int selected)
{
mSelectedRow = 0;
}
- else if ((selected >= mModel->getRows() && !mWrappingEnabled) ||
+ else if ((selected >= mModel->getRows() && !mWrappingEnabled) ||
(selected < 0 && mWrappingEnabled))
{
mSelectedRow = mModel->getRows() - 1;
@@ -226,7 +225,7 @@ void GuiTable::setSelectedColumn(int selected)
{
mSelectedColumn = 0;
}
- else if ((selected >= mModel->getColumns() && !mWrappingEnabled) ||
+ else if ((selected >= mModel->getColumns() && !mWrappingEnabled) ||
(selected < 0 && mWrappingEnabled))
{
mSelectedColumn = mModel->getColumns() - 1;
@@ -240,11 +239,11 @@ void GuiTable::setSelectedColumn(int selected)
void GuiTable::uninstallActionListeners(void)
{
- delete_all(action_listeners);
- action_listeners.clear();
+ delete_all(mActionListeners);
+ mActionListeners.clear();
}
-void GuiTable::installActionListeners(void)
+void GuiTable::installActionListeners()
{
if (!mModel)
return;
@@ -256,7 +255,7 @@ void GuiTable::installActionListeners(void)
for (int column = 0; column < columns; ++column)
{
gcn::Widget *widget = mModel->getElementAt(row, column);
- action_listeners.push_back(new GuiTableActionListener(this, widget,
+ mActionListeners.push_back(new GuiTableActionListener(this, widget,
row, column));
}
@@ -290,7 +289,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
if (max_rows_nr < rows_nr)
rows_nr = max_rows_nr;
-
+
// Now determine the first and last column
// Take the easy way out; these are usually bounded and all visible.
int first_column = 0;
@@ -338,7 +337,6 @@ void GuiTable::draw(gcn::Graphics* graphics)
graphics->pushClipArea(bounds);
widget->draw(graphics);
graphics->popClipArea();
-
}
x_offset += width;
@@ -369,7 +367,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
mTopWidget = NULL;
}
-gcn::Rectangle GuiTable::getChildrenArea(void)
+gcn::Rectangle GuiTable::getChildrenArea()
{
return gcn::Rectangle(0, 0, getWidth(), getHeight());
}
@@ -459,7 +457,7 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
mouseEvent.consume();
}
}
-
+
void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
{
}
@@ -479,7 +477,7 @@ void GuiTable::modelUpdated(bool completed)
}
}
-gcn::Widget* GuiTable::getWidgetAt(int x, int y)
+gcn::Widget *GuiTable::getWidgetAt(int x, int y)
{
int row = getRowForY(y);
int column = getColumnForX(x);
@@ -531,12 +529,13 @@ void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler)
{
gcn::Widget::_setFocusHandler(focusHandler);
- if (mModel)
- for (int r = 0; r < mModel->getRows(); ++r)
- for (int c = 0; c < mModel->getColumns(); ++c)
- {
+ if (mModel) {
+ for (int r = 0; r < mModel->getRows(); ++r) {
+ for (int c = 0; c < mModel->getColumns(); ++c) {
gcn::Widget *w = mModel->getElementAt(r, c);
if (w)
w->_setFocusHandler(focusHandler);
}
+ }
+ }
}
diff --git a/src/gui/table.h b/src/gui/table.h
index a508d0e4..d73cf340 100644
--- a/src/gui/table.h
+++ b/src/gui/table.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra derived from original code
- * from Guichan.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,17 +46,19 @@ class GuiTable : public gcn::Widget,
public gcn::KeyListener,
public TableModelListener
{
- friend class GuiTableActionListener; // so that the action listener can call distributeActionEvent
+ // so that the action listener can call distributeActionEvent
+ friend class GuiTableActionListener;
+
public:
GuiTable(TableModel * initial_model = NULL, gcn::Color background = 0xffffff,
bool opacity = true);
- virtual ~GuiTable(void);
+ virtual ~GuiTable();
/**
* Retrieves the active table model
*/
- TableModel *getModel(void) const;
+ TableModel *getModel() const;
/**
* Sets the table model
@@ -73,9 +74,9 @@ public:
void setSelected(int row, int column);
- int getSelectedRow(void);
+ int getSelectedRow();
- int getSelectedColumn(void);
+ int getSelectedColumn();
void setSelectedRow(int selected);
@@ -137,25 +138,25 @@ public:
virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
-
+
virtual void mouseDragged(gcn::MouseEvent& mouseEvent);
// Constraints inherited from TableModelListener
virtual void modelUpdated(bool);
protected:
+ /** Frees all action listeners on inner widgets. */
+ virtual void uninstallActionListeners();
+ /** Installs all action listeners on inner widgets. */
+ virtual void installActionListeners();
- virtual void uninstallActionListeners(void); // frees all action listeners on inner widgets
- virtual void installActionListeners(void); // installs all action listeners on inner widgets
-
- virtual int getRowHeight(void);
+ virtual int getRowHeight();
virtual int getColumnWidth(int i);
-
-private:
+private:
int getRowForY(int y); // -1 on error
int getColumnForX(int x); // -1 on error
- void recomputeDimensions(void);
+ void recomputeDimensions();
bool mLinewiseMode;
bool mWrappingEnabled;
bool mOpaque;
@@ -172,11 +173,14 @@ private:
int mSelectedRow;
int mSelectedColumn;
- int mPopFramesNr; // Number of frames to skip upwards when drawing the selected widget
+ /** Number of frames to skip upwards when drawing the selected widget. */
+ int mPopFramesNr;
- gcn::Widget *mTopWidget; // If someone moves a fresh widget to the top, we must display it
+ /** If someone moves a fresh widget to the top, we must display it. */
+ gcn::Widget *mTopWidget;
- std::vector<GuiTableActionListener *> action_listeners; // Vector for compactness; used as a list in practice.
+ /** Vector for compactness; used as a list in practice. */
+ std::vector<GuiTableActionListener *> mActionListeners;
};
diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp
index 8998961e..4fa13bae 100644
--- a/src/gui/table_model.cpp
+++ b/src/gui/table_model.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,13 +35,13 @@ void TableModel::removeListener(TableModelListener *listener)
listeners.erase(listener);
}
-void TableModel::signalBeforeUpdate(void)
+void TableModel::signalBeforeUpdate()
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(false);
}
-void TableModel::signalAfterUpdate(void)
+void TableModel::signalAfterUpdate()
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(true);
@@ -61,12 +60,12 @@ StaticTableModel::StaticTableModel(int row, int column) :
mWidths.resize(column, 1);
}
-StaticTableModel::~StaticTableModel(void)
+StaticTableModel::~StaticTableModel()
{
delete_all(mTableModel);
}
-void StaticTableModel::resize(void)
+void StaticTableModel::resize()
{
mRows = getRows();
mColumns = getColumns();
@@ -98,7 +97,7 @@ void StaticTableModel::set(int row, int column, gcn::Widget *widget)
signalAfterUpdate();
}
-gcn::Widget* StaticTableModel::getElementAt(int row, int column)
+gcn::Widget *StaticTableModel::getElementAt(int row, int column)
{
return mTableModel[WIDGET_AT(row, column)];
}
@@ -120,7 +119,7 @@ void StaticTableModel::fixRowHeight(int height)
mHeight = -height;
}
-int StaticTableModel::getRowHeight(void)
+int StaticTableModel::getRowHeight()
{
return abs(mHeight);
}
@@ -133,12 +132,12 @@ int StaticTableModel::getColumnWidth(int column)
return abs(mWidths[column]);
}
-int StaticTableModel::getRows(void)
+int StaticTableModel::getRows()
{
return mRows;
}
-int StaticTableModel::getColumns(void)
+int StaticTableModel::getColumns()
{
return mColumns;
}
diff --git a/src/gui/table_model.h b/src/gui/table_model.h
index 6edd7d65..9ca36120 100644
--- a/src/gui/table_model.h
+++ b/src/gui/table_model.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,8 +29,9 @@ class TableModelListener
{
public:
/**
- * Must be invoked by the TableModel whenever a global change is about to occur or
- * has occurred (e.g., when a row or column is being removed or added).
+ * Must be invoked by the TableModel whenever a global change is about to
+ * occur or has occurred (e.g., when a row or column is being removed or
+ * added).
*
* This method is triggered twice, once before and once after the update.
*
@@ -46,22 +46,22 @@ public:
class TableModel
{
public:
- virtual ~TableModel(void) { }
+ virtual ~TableModel() { }
/**
* Determines the number of rows (lines) in the table
*/
- virtual int getRows(void) = 0;
+ virtual int getRows() = 0;
/**
* Determines the number of columns in each row
*/
- virtual int getColumns(void) = 0;
+ virtual int getColumns() = 0;
/**
* Determines the height for each row
*/
- virtual int getRowHeight(void) = 0;
+ virtual int getRowHeight() = 0;
/**
* Determines the width of each individual column
@@ -81,12 +81,12 @@ protected:
/**
* Tells all listeners that the table is about to see an update
*/
- virtual void signalBeforeUpdate(void);
+ virtual void signalBeforeUpdate();
/**
* Tells all listeners that the table has seen an update
*/
- virtual void signalAfterUpdate(void);
+ virtual void signalAfterUpdate();
private:
std::set<TableModelListener *> listeners;
@@ -97,7 +97,7 @@ class StaticTableModel : public TableModel
{
public:
StaticTableModel(int width, int height);
- virtual ~StaticTableModel(void);
+ virtual ~StaticTableModel();
/**
* Inserts a widget into the table model.
@@ -107,7 +107,8 @@ public:
virtual void set(int row, int column, gcn::Widget *widget);
/**
- * Fixes the column width for a given column; this overrides dynamic width inference.
+ * Fixes the column width for a given column; this overrides dynamic width
+ * inference.
*
* Semantics are undefined for width 0.
*/
@@ -123,17 +124,16 @@ public:
/**
* Resizes the table model
*/
- virtual void resize(void);
+ virtual void resize();
- virtual int getRows(void);
- virtual int getColumns(void);
- virtual int getRowHeight(void);
- virtual int getWidth(void);
- virtual int getHeight(void);
+ virtual int getRows();
+ virtual int getColumns();
+ virtual int getRowHeight();
+ virtual int getWidth();
+ virtual int getHeight();
virtual int getColumnWidth(int index);
virtual gcn::Widget *getElementAt(int row, int column);
-
protected:
int mRows, mColumns;
int mHeight;
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index 51a8efc6..10f727e3 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/textbox.h b/src/gui/textbox.h
index 20f4ebe2..5884e11c 100644
--- a/src/gui/textbox.h
+++ b/src/gui/textbox.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index 257ddaa1..5c6e4f49 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/textfield.h b/src/gui/textfield.h
index b82912c0..73824615 100644
--- a/src/gui/textfield.h
+++ b/src/gui/textfield.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/textrenderer.h b/src/gui/textrenderer.h
index c0f5a0e9..b69e72a7 100644
--- a/src/gui/textrenderer.h
+++ b/src/gui/textrenderer.h
@@ -2,7 +2,7 @@
* Text Renderer
* Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on code from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,7 +45,8 @@ class TextRenderer
// Text shadow
if (shadow)
{
- graphics->setColor(guiPalette->getColor(Palette::SHADOW, alpha / 2));
+ graphics->setColor(guiPalette->getColor(Palette::SHADOW,
+ alpha / 2));
if (outline)
{
graphics->drawText(text, x + 2, y + 2, align);
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 82ac4647..d7554de8 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +38,7 @@
#include "../inventory.h"
#include "../item.h"
#include "../localplayer.h"
+#include "../units.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -80,7 +80,7 @@ TradeWindow::TradeWindow(Network *network):
mPartnerScroll = new ScrollArea(mPartnerItemContainer);
- mMoneyLabel = new Label(strprintf(_("You get %d GP."), 0));
+ mMoneyLabel = new Label(strprintf(_("You get %s."), ""));
mMoneyLabel2 = new Label(_("You give:"));
mMoneyField = new TextField;
mMoneyField->setWidth(50);
@@ -113,7 +113,8 @@ TradeWindow::~TradeWindow()
void TradeWindow::addMoney(int amount)
{
- mMoneyLabel->setCaption(strprintf(_("You get %d GP."), amount));
+ mMoneyLabel->setCaption(strprintf(_("You get %s."),
+ Units::formatCurrency(amount).c_str()));
mMoneyLabel->adjustSize();
}
@@ -164,7 +165,7 @@ void TradeWindow::reset()
mOkButton->setEnabled(true);
mOkOther = false;
mOkMe = false;
- mMoneyLabel->setCaption(strprintf(_("You get %d GP."), 0));
+ mMoneyLabel->setCaption(strprintf(_("You get %s."), ""));
mMoneyField->setEnabled(true);
mMoneyField->setText("");
}
diff --git a/src/gui/trade.h b/src/gui/trade.h
index 76ba5a4c..67138c24 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index e50fb457..b4b839e9 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,8 +43,7 @@ class TextChunk
bool operator==(const TextChunk &chunk) const
{
- return (
- chunk.text == text && chunk.color == color);
+ return (chunk.text == text && chunk.color == color);
}
void generate(TTF_Font *font)
@@ -134,12 +132,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics,
bool found = false;
- for (CacheIterator i = cache.begin(); i != cache.end(); i++)
+ for (CacheIterator i = mCache.begin(); i != mCache.end(); ++i)
{
if (chunk == (*i))
{
// Raise priority: move it to front
- cache.splice(cache.begin(), cache, i);
+ mCache.splice(mCache.begin(), mCache, i);
found = true;
break;
}
@@ -148,19 +146,19 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics,
// Surface not found
if (!found)
{
- if (cache.size() >= CACHE_SIZE)
+ if (mCache.size() >= CACHE_SIZE)
{
- cache.pop_back();
+ mCache.pop_back();
}
- cache.push_front(chunk);
- cache.front().generate(mFont);
+ mCache.push_front(chunk);
+ mCache.front().generate(mFont);
}
- cache.front().img->setAlpha(alpha);
- g->drawImage(cache.front().img, x, y);
+ mCache.front().img->setAlpha(alpha);
+ g->drawImage(mCache.front().img, x, y);
}
-int TrueTypeFont::getWidth(const std::string& text) const
+int TrueTypeFont::getWidth(const std::string &text) const
{
int w, h;
TTF_SizeUTF8(mFont, text.c_str(), &w, &h);
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index 085aa226..1cf6c2c8 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,8 +26,8 @@
#include <string>
#include <guichan/font.hpp>
-#ifndef __APPLE__
-#include <SDL/SDL_ttf.h>
+#ifdef __APPLE__
+#include <SDL_ttf/SDL_ttf.h>
#else
#include <SDL_ttf.h>
#endif
@@ -63,13 +62,15 @@ class TrueTypeFont : public gcn::Font
/**
* @see Font::drawString
*/
- void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y);
+ void drawString(gcn::Graphics *graphics,
+ const std::string &text,
+ int x, int y);
private:
TTF_Font *mFont;
// Word surfaces cache
- std::list<TextChunk> cache;
+ std::list<TextChunk> mCache;
};
#endif
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 927d6eaf..295b752e 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -106,7 +105,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
{
mCurlError[0] = 0;
- mBrowserBox = new BrowserBox();
+ mBrowserBox = new BrowserBox;
mScrollArea = new ScrollArea(mBrowserBox);
mLabel = new Label(_("Connecting..."));
mProgressBar = new ProgressBar(0.0, 310, 20, 168, 116, 31);
@@ -130,7 +129,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
- setLocationRelativeTo(getParent());
+ center();
setVisible(true);
mCancelButton->requestFocus();
@@ -359,7 +358,7 @@ int UpdaterWindow::downloadThread(void *ptr)
// Remove the corrupted file
::remove(outFilename.c_str());
logger->log(
- _("Checksum for file %s failed: (%lx/%lx)"),
+ "Checksum for file %s failed: (%lx/%lx)",
uw->mCurrentFile.c_str(),
adler, uw->mCurrentChecksum);
attempts++;
diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h
index 234a6f57..4ada3c3a 100644
--- a/src/gui/updatewindow.h
+++ b/src/gui/updatewindow.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 56274573..7f97d98c 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "ministatus.h"
#include "popupmenu.h"
#include "viewport.h"
@@ -64,7 +64,7 @@ Viewport::Viewport():
config.addListener("ScrollLaziness", this);
config.addListener("ScrollRadius", this);
- mPopupMenu = new PopupMenu();
+ mPopupMenu = new PopupMenu;
}
Viewport::~Viewport()
@@ -77,6 +77,8 @@ void Viewport::setMap(Map *map)
mMap = map;
}
+extern MiniStatusWindow *miniStatusWindow;
+
void Viewport::draw(gcn::Graphics *gcnGraphics)
{
static int lastTick = tick_time;
@@ -215,6 +217,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
(*i)->drawEmotion(graphics, (int) mPixelViewX, (int) mPixelViewY);
}
+ if (miniStatusWindow)
+ miniStatusWindow->drawIcons(graphics);
+
// Draw contained widgets
WindowContainer::draw(gcnGraphics);
}
@@ -335,7 +340,8 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
else if (event.getButton() == gcn::MouseEvent::MIDDLE)
{
// Find the being nearest to the clicked position
- Being *target = beingManager->findBeingByPixel(x, y);
+ Being *target = beingManager->findNearestLivingBeing(tilex, tiley, 20,
+ Being::MONSTER);
if (target)
player_node->setTarget(target);
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 12fdb187..6e7a2370 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 0015beed..b736591c 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +40,7 @@ Image *DropDown::buttons[2][2];
ImageRect DropDown::skin;
float DropDown::mAlpha = config.getValue("guialpha", 0.8);
-DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea,
+DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea,
gcn::ListBox *listBox, bool opacity):
gcn::DropDown::DropDown(listModel, scrollArea, listBox),
mOpaque(opacity)
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 191740d9..1e6dc821 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2008 The Mana World Development Team
+ * The Mana World
+ * Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 7fab91d7..4ffdda36 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 04b75ca5..20a4222d 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp
index ed002f99..410de98a 100644
--- a/src/gui/widgets/layouthelper.cpp
+++ b/src/gui/widgets/layouthelper.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h
index 1125d209..afa92a18 100644
--- a/src/gui/widgets/layouthelper.h
+++ b/src/gui/widgets/layouthelper.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2009 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index f3cc4f83..fa264e37 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h
index 7c96af45..620c133f 100644
--- a/src/gui/widgets/resizegrip.h
+++ b/src/gui/widgets/resizegrip.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 942ad3ef..7a2d9ee8 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 4b331d66..3af4e2bf 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 2c454b69..a8f2b6f0 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,7 +71,7 @@ gcn::Widget* TabbedArea::getWidget(const std::string &name)
void TabbedArea::addTab(const std::string &caption, gcn::Widget *widget)
{
- Tab* tab = new Tab();
+ Tab* tab = new Tab;
tab->setCaption(caption);
mTabsToDelete.push_back(tab);
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 863ff79e..01d70380 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 5408eebe..01790a67 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -2,7 +2,7 @@
* The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on code from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 8e116262..e7b7db80 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -2,7 +2,7 @@
* The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on code from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 13c8f4ce..4689c86a 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -77,7 +76,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent, const std
if (instances == 0)
{
skinLoader = new SkinLoader();
- windowConfigListener = new WindowConfigListener();
+ windowConfigListener = new WindowConfigListener;
// Send GUI alpha changed for initialization
windowConfigListener->optionChanged("guialpha");
config.addListener("guialpha", windowConfigListener);
@@ -283,7 +282,7 @@ void Window::setResizable(bool r)
if (r)
{
- mGrip = new ResizeGrip();
+ mGrip = new ResizeGrip;
mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x);
mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y);
add(mGrip);
@@ -577,6 +576,14 @@ void Window::setDefaultSize(int defaultX, int defaultY,
mDefaultHeight = defaultHeight;
}
+void Window::setDefaultSize()
+{
+ mDefaultX = getX();
+ mDefaultY = getY();
+ mDefaultWidth = getWidth();
+ mDefaultHeight = getHeight();
+}
+
void Window::setDefaultSize(int defaultWidth, int defaultHeight,
ImageRect::ImagePosition position,
int offsetX, int offsetY)
@@ -709,3 +716,7 @@ void Window::reflowLayout(int w, int h)
setContentSize(w, h);
}
+void Window::center()
+{
+ setLocationRelativeTo(getParent());
+}
diff --git a/src/gui/window.h b/src/gui/window.h
index 518e1ec2..7f15e262 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +30,6 @@
#include "../guichanfwd.h"
class ConfigListener;
-class GCContainer;
class ContainerPlacer;
class Layout;
class LayoutCell;
@@ -183,7 +181,7 @@ class Window : public gcn::Window, gcn::WidgetListener
*
* @return The parent window or <code>NULL</code> if there is none.
*/
- Window* getParentWindow() { return mParent; }
+ Window *getParentWindow() { return mParent; }
/**
* Schedule this window for deletion. It will be deleted at the start
@@ -228,7 +226,7 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Returns the name of the window. This is not the window title.
*/
- const std::string& getWindowName() { return mWindowName; }
+ const std::string &getWindowName() { return mWindowName; }
/**
* Reads the position (and the size for resizable windows) in the
@@ -253,6 +251,11 @@ class Window : public gcn::Window, gcn::WidgetListener
int defaultWidth, int defaultHeight);
/**
+ * Set the default win pos and size tot he current ones.
+ */
+ void setDefaultSize();
+
+ /**
* Set the default win pos and size.
* (which can be different of the actual ones.)
* This version of setDefaultSize sets the window's position based
@@ -294,6 +297,11 @@ class Window : public gcn::Window, gcn::WidgetListener
ContainerPlacer getPlacer(int x, int y);
/**
+ * Positions the window in the center of it's parent.
+ */
+ void center();
+
+ /**
* Overrideable functionality for when the window is to close. This
* allows for class implementations to clean up or do certain actions
* on window close they couldn't do otherwise.
@@ -325,7 +333,6 @@ class Window : public gcn::Window, gcn::WidgetListener
void setGuiAlpha();
- GCContainer *mChrome; /**< Contained container */
ResizeGrip *mGrip; /**< Resize grip */
Window *mParent; /**< The parent window */
Layout *mLayout; /**< Layout handler */
diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp
index ad86a253..eda739b9 100644
--- a/src/gui/windowcontainer.cpp
+++ b/src/gui/windowcontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h
index 23b221cf..bc918184 100644
--- a/src/gui/windowcontainer.h
+++ b/src/gui/windowcontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
index 8859780f..4863421c 100644
--- a/src/guichanfwd.h
+++ b/src/guichanfwd.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index d2c955ee..557b3553 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/imageparticle.h b/src/imageparticle.h
index 3465b3e0..317b17ea 100644
--- a/src/imageparticle.h
+++ b/src/imageparticle.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 3d1a4786..5092fe3c 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/inventory.h b/src/inventory.h
index e23f7657..ee8d072a 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/item.cpp b/src/item.cpp
index 2125756a..9165c6c8 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/item.h b/src/item.h
index d67b5be4..3ea4a905 100644
--- a/src/item.h
+++ b/src/item.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 0627ccda..b1dfb618 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index 4203f600..95e17f44 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 18a09207..7e9a2285 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/joystick.h b/src/joystick.h
index 67b5ab70..4c5390c2 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 8ed23c65..06ce4ac7 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2007 The Mana World Development Team
+ * Custom keyboard shortcuts configuration
+ * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au>
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 61d7887d..f7750b30 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
- * Copyright (C) 2007 The Mana World Development Team
+ * Custom keyboard shortcuts configuration
+ * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au>
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index f72aa59a..245bd891 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,9 +33,11 @@
#include "particle.h"
#include "simpleanimation.h"
#include "sound.h"
+#include "statuseffect.h"
#include "text.h"
#include "gui/gui.h"
+#include "gui/ministatus.h"
#include "gui/palette.h"
#include "gui/storagewindow.h"
@@ -69,7 +70,7 @@ LocalPlayer::LocalPlayer(Uint32 id, Uint16 job, Map *map):
ATK_BONUS(0), MATK_BONUS(0), DEF_BONUS(0), MDEF_BONUS(0), FLEE_BONUS(0),
mStatPoint(0), mSkillPoint(0),
mStatsPointsToAttribute(0),
- mEquipment(new Equipment()),
+ mEquipment(new Equipment),
mXp(0), mNetwork(0),
mTarget(NULL), mPickUpTarget(NULL),
mTrading(false), mGoingToTarget(false),
@@ -180,20 +181,30 @@ void LocalPlayer::logic()
if (mTarget)
{
- // Find whether target is in range
- const int rangeX = abs(mTarget->mX - mX);
- const int rangeY = abs(mTarget->mY - mY);
- const int attackRange = getAttackRange();
- const int inRange = rangeX > attackRange || rangeY > attackRange ? 1 : 0;
-
- mTarget->setTargetAnimation(
- mTargetCursor[inRange][mTarget->getTargetCursorSize()]);
-
- if (mTarget->mAction == DEAD)
- stopAttack();
-
- if (mKeepAttacking && mTarget)
- attack(mTarget, true);
+ if (mTarget->getType() == Being::NPC)
+ {
+ // NPCs are always in range
+ mTarget->setTargetAnimation(
+ mTargetCursor[0][mTarget->getTargetCursorSize()]);
+ }
+ else
+ {
+ // Find whether target is in range
+ const int rangeX = abs(mTarget->mX - mX);
+ const int rangeY = abs(mTarget->mY - mY);
+ const int attackRange = getAttackRange();
+ const int inRange = rangeX > attackRange || rangeY > attackRange
+ ? 1 : 0;
+
+ mTarget->setTargetAnimation(
+ mTargetCursor[inRange][mTarget->getTargetCursorSize()]);
+
+ if (mTarget->mAction == DEAD)
+ stopAttack();
+
+ if (mKeepAttacking && mTarget)
+ attack(mTarget, true);
+ }
}
Being::logic();
@@ -413,10 +424,7 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y)
void LocalPlayer::setWalkingDir(int dir)
{
- if (mWalkingDir != dir)
- {
- mWalkingDir = dir;
- }
+ mWalkingDir = dir;
// If we're not already walking, start walking.
if (mAction != WALK && dir)
@@ -526,7 +534,7 @@ void LocalPlayer::attack(Being *target, bool keep)
{
mKeepAttacking = keep;
- if (!target)
+ if (!target || target->getType() == Being::NPC)
return;
if ((mTarget != target) || !mTarget)
@@ -538,10 +546,8 @@ void LocalPlayer::attack(Being *target, bool keep)
int dist_x = target->mX - mX;
int dist_y = target->mY - mY;
- // Must be standing and be within attack range to continue
- if ((mAction != STAND) || (mAttackRange < abs(dist_x)) ||
- (mAttackRange < abs(dist_y)))
- return;
+ // Must be standing to attack
+ if (mAction != STAND) return;
if (abs(dist_y) >= abs(dist_x))
{
@@ -650,6 +656,48 @@ void LocalPlayer::setGotoTarget(Being *target)
setDestination(target->mX, target->mY);
}
+
+extern MiniStatusWindow *miniStatusWindow;
+
+void LocalPlayer::handleStatusEffect(StatusEffect *effect, int effectId)
+{
+ Being::handleStatusEffect(effect, effectId);
+
+
+
+ if (effect) {
+ effect->deliverMessage();
+ effect->playSFX();
+
+ AnimatedSprite *sprite = effect->getIcon();
+
+ if (!sprite) {
+ // delete sprite, if necessary
+ for (unsigned int i = 0; i < mStatusEffectIcons.size();)
+ if (mStatusEffectIcons[i] == effectId) {
+ mStatusEffectIcons.erase(mStatusEffectIcons.begin() + i);
+ miniStatusWindow->eraseIcon(i);
+ } else i++;
+ } else {
+ // replace sprite or append
+ bool found = false;
+
+ for (unsigned int i = 0; i < mStatusEffectIcons.size(); i++)
+ if (mStatusEffectIcons[i] == effectId) {
+ miniStatusWindow->setIcon(i, sprite);
+ found = true;
+ break;
+ }
+
+ if (!found) { // add new
+ int offset = mStatusEffectIcons.size();
+ miniStatusWindow->setIcon(offset, sprite);
+ mStatusEffectIcons.push_back(effectId);
+ }
+ }
+ }
+}
+
void LocalPlayer::initTargetCursor()
{
// Load target cursors
@@ -679,7 +727,7 @@ void LocalPlayer::loadTargetCursor(std::string filename, int width, int height,
ResourceManager *resman = ResourceManager::getInstance();
currentImageSet = resman->getImageSet(filename, width, height);
- Animation *anim = new Animation();
+ Animation *anim = new Animation;
for (unsigned int i = 0; i < currentImageSet->size(); ++i)
{
diff --git a/src/localplayer.h b/src/localplayer.h
index 16e7c124..c94dba74 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +23,7 @@
#define LOCALPLAYER_H
#include <memory>
+#include <vector>
#include "player.h"
@@ -240,6 +240,9 @@ class LocalPlayer : public Player
const std::auto_ptr<Equipment> mEquipment;
protected:
+ virtual void
+ handleStatusEffect(StatusEffect *effect, int effectId);
+
void walk(unsigned char dir);
int mXp; /**< Experience points. */
@@ -259,6 +262,8 @@ class LocalPlayer : public Player
int mDestX; /**< X coordinate of destination. */
int mDestY; /**< Y coordinate of destination. */
+ std::vector<int> mStatusEffectIcons;
+
Inventory *mInventory;
Inventory *mStorage;
diff --git a/src/lockedarray.h b/src/lockedarray.h
index 3ef2bb99..2b4b099d 100644
--- a/src/lockedarray.h
+++ b/src/lockedarray.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/log.cpp b/src/log.cpp
index 29eeb010..b0024f80 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/log.h b/src/log.h
index a50eab9d..b06bdc89 100644
--- a/src/log.h
+++ b/src/log.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/logindata.h b/src/logindata.h
index 3f686a22..410d2e73 100644
--- a/src/logindata.h
+++ b/src/logindata.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main.cpp b/src/main.cpp
index 2ecde05d..1c05dbb7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,6 +49,8 @@
#include "player_relations.h"
#include "serverinfo.h"
#include "sound.h"
+#include "statuseffect.h"
+#include "units.h"
#include "gui/button.h"
#include "gui/char_server.h"
@@ -187,7 +188,7 @@ void setUpdatesDir()
if (updateHost.empty())
{
updateHost =
- config.getValue("updatehost", "http://www.aethyra.org/updates");
+ config.getValue("updatehost", "http://updates.themanaworld.org/");
}
// Remove any trailing slash at the end of the update host
@@ -259,18 +260,23 @@ void setUpdatesDir()
*/
void init_engine(const Options &options)
{
- homeDir = std::string(PHYSFS_getUserDir()) + "/.aethyra";
+ if (homeDir.empty())
+#if defined __APPLE__
+ // Use Application Directory instead of .tmw
+ homeDir = std::string(PHYSFS_getUserDir()) +
+ "/Library/Application Support/The Mana World";
+#else
+ homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
+#endif
+
#if defined WIN32
if (!CreateDirectory(homeDir.c_str(), 0) &&
GetLastError() != ERROR_ALREADY_EXISTS)
#elif defined __APPLE__
- // Use Application Directory instead of .aethyra
- homeDir = std::string(PHYSFS_getUserDir()) +
- "/Library/Application Support/Aethyra";
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
#else
- // Checking if /home/user/.Aethyra folder exists.
+ // Checking if /home/user/.tmw folder exists.
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
#endif
@@ -282,12 +288,12 @@ void init_engine(const Options &options)
}
// Set log file
- logger->setLogFile(homeDir + std::string("/aethyra.log"));
+ logger->setLogFile(homeDir + std::string("/tmw.log"));
#ifdef PACKAGE_VERSION
- logger->log("Starting Aethyra Version %s", PACKAGE_VERSION);
+ logger->log("Starting The Mana World Version %s", PACKAGE_VERSION);
#else
- logger->log("Starting Aethyra - Version not defined"));
+ logger->log("Starting The Mana World - Version not defined");
#endif
// Initialize SDL
@@ -337,8 +343,8 @@ void init_engine(const Options &options)
// Fill configuration with defaults
logger->log("Initializing configuration...");
- config.setValue("host", "www.aethyra.org");
- config.setValue("port", 21001);
+ config.setValue("host", "www.themanaworld.org");
+ config.setValue("port", 6901);
config.setValue("hwaccel", 0);
#if (defined __APPLE__ || defined WIN32) && defined USE_OPENGL
config.setValue("opengl", 1);
@@ -352,7 +358,7 @@ void init_engine(const Options &options)
config.setValue("sfxVolume", 100);
config.setValue("musicVolume", 60);
config.setValue("fpslimit", 0);
- config.setValue("updatehost", "http://www.aethyra.org/updates");
+ config.setValue("updatehost", "http://updates.themanaworld.org");
config.setValue("customcursor", 1);
config.setValue("ChatLogLength", 128);
@@ -379,7 +385,7 @@ void init_engine(const Options &options)
config.init(configPath);
}
- SDL_WM_SetCaption("Aethyra", NULL);
+ SDL_WM_SetCaption("The Mana World", NULL);
#ifdef WIN32
static SDL_SysWMinfo pInfo;
SDL_GetWMInfo(&pInfo);
@@ -389,7 +395,7 @@ void init_engine(const Options &options)
SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
}
#else
- icon = IMG_Load(PKG_DATADIR "data/icons/aethyra.png");
+ icon = IMG_Load(PKG_DATADIR "data/icons/tmw.png");
if (icon)
{
SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
@@ -404,10 +410,10 @@ void init_engine(const Options &options)
Image::setLoadAsOpenGL(useOpenGL);
// Create the graphics context
- graphics = useOpenGL ? new OpenGLGraphics() : new Graphics();
+ graphics = useOpenGL ? new OpenGLGraphics : new Graphics;
#else
// Create the graphics context
- graphics = new Graphics();
+ graphics = new Graphics;
#endif
const int width = (int) config.getValue("screenwidth", defaultScreenWidth);
@@ -429,10 +435,10 @@ void init_engine(const Options &options)
graphics->_beginDraw();
// Initialize the item shortcuts.
- itemShortcut = new ItemShortcut();
+ itemShortcut = new ItemShortcut;
// Initialize the emote shortcuts.
- emoteShortcut = new EmoteShortcut();
+ emoteShortcut = new EmoteShortcut;
gui = new Gui(graphics);
state = LOGIN_STATE; /**< Initial game state */
@@ -486,6 +492,7 @@ void exit_engine()
ItemDB::unload();
MonsterDB::unload();
NPCDB::unload();
+ StatusEffect::unload();
ResourceManager::deleteInstance();
delete logger;
@@ -496,13 +503,14 @@ void exit_engine()
void printHelp()
{
std::cout
- << _("aethyra") << std::endl << std::endl
+ << _("tmw") << std::endl << std::endl
<< _("Options: ") << std::endl
<< _(" -C --configfile : Configuration file to use") << std::endl
<< _(" -d --data : Directory to load game data from") << std::endl
<< _(" -D --default : Bypass the login process with default settings")
<< std::endl
<< _(" -h --help : Display this help") << std::endl
+ << _(" -S --homedir : Directory to use as home directory") << std::endl
<< _(" -H --updatehost : Use this update host") << std::endl
<< _(" -p --playername : Login with this player") << std::endl
<< _(" -P --password : Login with this password") << std::endl
@@ -514,17 +522,16 @@ void printHelp()
void printVersion()
{
#ifdef PACKAGE_VERSION
- std::cout << _("Aethyra version ") << PACKAGE_VERSION <<
- std::endl;
+ std::cout << _("The Mana World version ") << PACKAGE_VERSION << std::endl;
#else
- std::cout << _("Aethyra version ") <<
+ std::cout << _("The Mana World version ") <<
_("(local build?, PACKAGE_VERSION is not defined)") << std::endl;
#endif
}
void parseOptions(int argc, char *argv[], Options &options)
{
- const char *optstring = "hvud:U:P:Dp:C:H:";
+ const char *optstring = "hvud:U:P:Dp:C:H:S:";
const struct option long_options[] = {
{ "configfile", required_argument, 0, 'C' },
@@ -533,6 +540,7 @@ void parseOptions(int argc, char *argv[], Options &options)
{ "playername", required_argument, 0, 'p' },
{ "password", required_argument, 0, 'P' },
{ "help", no_argument, 0, 'h' },
+ { "homedir", required_argument, 0, 'S' },
{ "updatehost", required_argument, 0, 'H' },
{ "skipupdate", no_argument, 0, 'u' },
{ "username", required_argument, 0, 'U' },
@@ -579,6 +587,9 @@ void parseOptions(int argc, char *argv[], Options &options)
case 'v':
options.printVersion = true;
break;
+ case 'S':
+ homeDir = optarg;
+ break;
}
}
}
@@ -656,16 +667,11 @@ void accountLogin(Network *network, LoginData *loginData)
config.setValue("remember", loginData->remember);
}
-inline int MIN(int x, int y)
-{
- return x < y ? x : y;
-}
-
-void positionDialog(Window *dialog, int screenWidth, int screenHeight)
+static void positionDialog(Window *dialog, int screenWidth, int screenHeight)
{
dialog->setPosition(
- MIN(screenWidth * 5 / 8, screenWidth - dialog->getWidth()),
- MIN(screenHeight * 5 / 8, screenHeight - dialog->getHeight()));
+ (screenWidth - dialog->getWidth()) / 2,
+ (screenHeight - dialog->getHeight()) / 2);
}
void charLogin(Network *network, LoginData *loginData)
@@ -724,7 +730,7 @@ extern "C" char const *_nl_locale_name_default(void);
/** Main */
int main(int argc, char *argv[])
{
- logger = new Logger();
+ logger = new Logger;
Options options;
@@ -744,11 +750,14 @@ int main(int argc, char *argv[])
#if ENABLE_NLS
#ifdef WIN32
putenv(("LANG=" + std::string(_nl_locale_name_default())).c_str());
+ // mingw doesn't like LOCALEDIR to be defined for some reason
+ bindtextdomain("tmw", "translations/");
+#else
+ bindtextdomain("tmw", LOCALEDIR);
#endif
setlocale(LC_MESSAGES, "");
- bindtextdomain("aethyra", LOCALEDIR);
- bind_textdomain_codeset("aethyra", "UTF-8");
- textdomain("aethyra");
+ bind_textdomain_codeset("tmw", "UTF-8");
+ textdomain("tmw");
#endif
// Initialize libxml2 and check for potential ABI mismatches between
@@ -775,7 +784,7 @@ int main(int argc, char *argv[])
Game *game = NULL;
Window *currentDialog = NULL;
Image *login_wallpaper = NULL;
- setupWindow = new Setup();
+ setupWindow = new Setup;
gcn::Container *top = static_cast<gcn::Container*>(gui->getTop());
#ifdef PACKAGE_VERSION
@@ -803,13 +812,13 @@ int main(int argc, char *argv[])
if (!options.password.empty()) {
loginData.password = options.password;
}
- loginData.hostname = config.getValue("host", "www.aethyra.org");
- loginData.port = (short)config.getValue("port", 21001);
+ loginData.hostname = config.getValue("host", "server.themanaworld.org");
+ loginData.port = (short)config.getValue("port", 6901);
loginData.remember = config.getValue("remember", 0);
loginData.registerLogin = false;
SDLNet_Init();
- Network *network = new Network();
+ Network *network = new Network;
// Set the most appropriate wallpaper, based on screen width
int screenWidth = (int) config.getValue("screenwidth", defaultScreenWidth);
@@ -827,7 +836,10 @@ int main(int argc, char *argv[])
else if (screenWidth >= 1600)
wallpaperName = "graphics/images/login_wallpaper_1600x1200.png";
- login_wallpaper = ResourceManager::getInstance()-> getImage(wallpaperName);
+ if (!ResourceManager::getInstance()->exists(wallpaperName))
+ wallpaperName = "graphics/images/login_wallpaper.png";
+
+ login_wallpaper = ResourceManager::getInstance()->getImage(wallpaperName);
if (!login_wallpaper)
logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str());
@@ -877,7 +889,7 @@ int main(int argc, char *argv[])
if (graphics->getWidth() > login_wallpaper->getWidth() ||
graphics->getHeight() > login_wallpaper->getHeight())
{
- graphics->setColor(gcn::Color(255, 255, 255));
+ graphics->setColor(gcn::Color(64, 64, 64));
graphics->fillRectangle(gcn::Rectangle(
0, 0, graphics->getWidth(), graphics->getHeight()));
}
@@ -897,6 +909,8 @@ int main(int argc, char *argv[])
login_wallpaper->decRef();
login_wallpaper = ResourceManager::getInstance()->
getImage(wallpaperName);
+ // Load units
+ Units::loadUnits();
break;
// Those states don't cause a network disconnect
@@ -942,6 +956,7 @@ int main(int argc, char *argv[])
MonsterDB::load();
NPCDB::load();
EmoteDB::load();
+ StatusEffect::load();
Being::load(); // Hairstyles
state = CHAR_CONNECT_STATE;
@@ -998,8 +1013,8 @@ int main(int argc, char *argv[])
case CHAR_SELECT_STATE:
logger->log("State: CHAR_SELECT");
currentDialog = new CharSelectDialog(network, &charInfo,
- (loginData.sex == 0) ?
- GENDER_FEMALE : GENDER_MALE);
+ (loginData.sex == 0) ?
+ GENDER_FEMALE : GENDER_MALE);
positionDialog(currentDialog, screenWidth, screenHeight);
if (((CharSelectDialog*) currentDialog)->
diff --git a/src/main.h b/src/main.h
index 5f33cab2..1d984661 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/map.cpp b/src/map.cpp
index 877a8ba9..962ea499 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -334,7 +333,7 @@ Tileset* Map::getTilesetWithGid(int gid) const
containsGid.gid = gid;
Tilesets::const_iterator i = find_if(mTilesets.begin(), mTilesets.end(),
- containsGid);
+ containsGid);
return (i == mTilesets.end()) ? NULL : *i;
}
@@ -343,7 +342,7 @@ void Map::setWalk(int x, int y, bool walkable)
{
mMetaTiles[x + y * mWidth].walkable = walkable;
}
-
+
bool Map::occupied(int x, int y) const
{
Beings &beings = beingManager->getAll();
@@ -361,7 +360,7 @@ bool Map::occupied(int x, int y) const
bool Map::tileCollides(int x, int y) const
{
- return !(contains(x, y) && mMetaTiles[x + y * mWidth].walkable);
+ return !(contains(x, y) && mMetaTiles[x + y * mWidth].walkable);
}
bool Map::contains(int x, int y) const
@@ -463,6 +462,13 @@ Path Map::findPath(int startX, int startY, int destX, int destY)
// 14 for moving diagonal (sqrt(200) = 14.1421...)
int Gcost = curr.tile->Gcost + ((dx == 0 || dy == 0) ? 10 : 14);
+ // It costs extra to walk through a being (needs to be enough
+ // to make it more attractive to walk around).
+ if (occupied(x, y))
+ {
+ Gcost += 30;
+ }
+
// Skip if Gcost becomes too much
// Warning: probably not entirely accurate
if (Gcost > 200)
diff --git a/src/map.h b/src/map.h
index eebdade1..9703c5b3 100644
--- a/src/map.h
+++ b/src/map.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/monster.cpp b/src/monster.cpp
index f71457df..7dc08238 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/monster.h b/src/monster.h
index afb55769..7c16d178 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index d1810537..b92e0e31 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +35,10 @@
#include "../npc.h"
#include "../player_relations.h"
+#include "../gui/npc_text.h"
+
+extern NpcTextDialog *npcTextDialog;
+
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
BeingHandler::BeingHandler(bool enableSync):
@@ -58,6 +61,7 @@ BeingHandler::BeingHandler(bool enableSync):
SMSG_PLAYER_STOP,
SMSG_PLAYER_MOVE_TO_ATTACK,
0x0119,
+ 0x0196,
0
};
handledMessages = _messages;
@@ -68,13 +72,16 @@ void BeingHandler::handleMessage(MessageIn *msg)
int id;
Uint16 job, speed;
Uint16 headTop, headMid, headBottom;
- Uint16 shoes, gloves, cape, misc1, misc2;
+ Uint16 shoes, gloves;
Uint16 weapon, shield;
Uint16 gmstatus;
int param1;
+ int stunMode;
+ Uint32 statusEffects;
int type;
+ Uint16 status;
Being *srcBeing, *dstBeing;
- int hairStyle, hairColor;
+ int hairStyle, hairColor, flag;
switch (msg->getId())
{
@@ -83,9 +90,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
// Information about a being in range
id = msg->readInt32();
speed = msg->readInt16();
- msg->readInt16(); // opt1
- msg->readInt16(); // opt2
- msg->readInt16(); // option
+ stunMode = msg->readInt16(); // opt1
+ statusEffects = msg->readInt16(); // opt2
+ statusEffects |= ((Uint32)msg->readInt16()) << 16; // option
job = msg->readInt16(); // class
dstBeing = beingManager->findBeing(id);
@@ -109,6 +116,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setAction(Being::STAND);
}
+
// Prevent division by 0 when calculating frame
if (speed == 0) { speed = 150; }
@@ -127,14 +135,14 @@ void BeingHandler::handleMessage(MessageIn *msg)
headTop = msg->readInt16();
headMid = msg->readInt16();
hairColor = msg->readInt16();
- shoes = msg->readInt16();
- gloves = msg->readInt16();
+ shoes = msg->readInt16(); // clothes color - "abused" as shoes
+ gloves = msg->readInt16(); // head dir - "abused" as gloves
msg->readInt16(); // guild
msg->readInt16(); // unknown
msg->readInt16(); // unknown
msg->readInt16(); // manner
- msg->readInt16(); // karma
- msg->readInt8(); // unknown
+ dstBeing->setStatusEffectBlock(32, msg->readInt16()); // opt3
+ msg->readInt8(); // karma
dstBeing->setGender(
(msg->readInt8() == 0) ? GENDER_FEMALE : GENDER_MALE);
@@ -165,6 +173,10 @@ void BeingHandler::handleMessage(MessageIn *msg)
msg->readInt8(); // unknown
msg->readInt8(); // unknown
msg->readInt8(); // unknown / sit
+
+ dstBeing->setStunMode(stunMode);
+ dstBeing->setStatusEffectBlock(0, (statusEffects >> 16) & 0xffff);
+ dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
break;
case SMSG_BEING_MOVE2:
@@ -197,10 +209,11 @@ void BeingHandler::handleMessage(MessageIn *msg)
case SMSG_BEING_REMOVE:
// A being should be removed or has died
id = msg->readInt32();
- dstBeing = beingManager->findBeing(id);
if (id == current_npc)
- current_npc = 0;
+ npcTextDialog->showCloseButton();
+
+ dstBeing = beingManager->findBeing(id);
if (!dstBeing)
break;
@@ -374,9 +387,10 @@ void BeingHandler::handleMessage(MessageIn *msg)
// An update about a player, potentially including movement.
id = msg->readInt32();
speed = msg->readInt16();
- cape = msg->readInt16();
- misc1 = msg->readInt16();
- misc2 = msg->readInt16();
+ stunMode = msg->readInt16(); // opt1; Aethyra use this as cape
+ statusEffects = msg->readInt16(); // opt2; Aethyra use this as misc1
+ statusEffects |= ((Uint32) msg->readInt16())
+ << 16; // status.options; Aethyra uses this as misc2
job = msg->readInt16();
dstBeing = beingManager->findBeing(id);
@@ -401,11 +415,12 @@ void BeingHandler::handleMessage(MessageIn *msg)
headTop = msg->readInt16();
headMid = msg->readInt16();
hairColor = msg->readInt16();
- shoes = msg->readInt16();
- gloves = msg->readInt16();
+ msg->readInt16(); // clothes color - Aethyra-"abused" as shoes, we ignore it
+ msg->readInt16(); // head dir - Aethyra-"abused" as gloves, we ignore it
msg->readInt32(); // guild
- msg->readInt32(); // emblem
+ msg->readInt16(); // emblem
msg->readInt16(); // manner
+ dstBeing->setStatusEffectBlock(32, msg->readInt16()); // opt3
msg->readInt8(); // karma
dstBeing->setGender(
(msg->readInt8() == 0) ? GENDER_FEMALE : GENDER_MALE);
@@ -416,13 +431,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
dstBeing->setSprite(Being::HAT_SPRITE, headTop);
- dstBeing->setSprite(Being::SHOE_SPRITE, shoes);
- // Compensation for the unpatched TMW server
- if (gloves > 10)
- dstBeing->setSprite(Being::GLOVES_SPRITE, gloves);
- dstBeing->setSprite(Being::CAPE_SPRITE, cape);
- dstBeing->setSprite(Being::MISC1_SPRITE, misc1);
- dstBeing->setSprite(Being::MISC2_SPRITE, misc2);
+ //dstBeing->setSprite(Being::CAPE_SPRITE, cape);
+ //dstBeing->setSprite(Being::MISC1_SPRITE, misc1);
+ //dstBeing->setSprite(Being::MISC2_SPRITE, misc2);
dstBeing->setHairStyle(hairStyle, hairColor);
if (msg->getId() == SMSG_PLAYER_MOVE)
@@ -463,6 +474,10 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->mWalkTime = tick_time;
dstBeing->mFrame = 0;
+
+ dstBeing->setStunMode(stunMode);
+ dstBeing->setStatusEffectBlock(0, (statusEffects >> 16) & 0xffff);
+ dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
break;
case SMSG_PLAYER_STOP:
@@ -502,10 +517,30 @@ void BeingHandler::handleMessage(MessageIn *msg)
break;
case 0x0119:
- // Change in players look
- logger->log("0x0119 %i %i %i %x %i", msg->readInt32(),
- msg->readInt16(), msg->readInt16(), msg->readInt16(),
- msg->readInt8());
+ // Change in players' flags
+ id = msg->readInt32();
+ dstBeing = beingManager->findBeing(id);
+ stunMode = msg->readInt16();
+ statusEffects = msg->readInt16();
+ statusEffects |= ((Uint32) msg->readInt16()) << 16;
+ msg->readInt8();
+
+ if (dstBeing) {
+ dstBeing->setStunMode(stunMode);
+ dstBeing->setStatusEffectBlock(0, (statusEffects >> 16) & 0xffff);
+ dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
+ }
+ break;
+
+ case 0x0196:
+ // Status change
+ status = msg->readInt16();
+ id = msg->readInt32();
+ flag = msg->readInt8(); // 0: stop, 1: start
+
+ dstBeing = beingManager->findBeing(id);
+ if (dstBeing)
+ dstBeing->setStatusEffect(status, flag);
break;
}
}
diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h
index 5fbb57ce..54b82075 100644
--- a/src/net/beinghandler.h
+++ b/src/net/beinghandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index 287e5400..dcefe905 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h
index 2b4aaf4f..0ede7b48 100644
--- a/src/net/buysellhandler.h
+++ b/src/net/buysellhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 95555300..8e743bf0 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index 2a5331b5..37b378f2 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index 185ce7d8..8e108142 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index 9a47c633..ff649205 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 9a6f424e..a31da38e 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/equipmenthandler.h b/src/net/equipmenthandler.h
index 08de3b36..c66d7932 100644
--- a/src/net/equipmenthandler.h
+++ b/src/net/equipmenthandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp
index 9fcfedf1..fa66821d 100644
--- a/src/net/inventoryhandler.cpp
+++ b/src/net/inventoryhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -218,7 +217,7 @@ void InventoryHandler::handleMessage(MessageIn *msg)
/*
* This is the closest we get to an "Open Storage" packet from the
* server. It always comes after the two SMSG_PLAYER_STORAGE_...
- * packets that update storage contents..
+ * packets that update storage contents.
*/
player_node->setInStorage(true);
msg->readInt16(); // Storage capacity
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index f87e1214..336b2e98 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/itemhandler.cpp b/src/net/itemhandler.cpp
index d9d84248..b7ac23a8 100644
--- a/src/net/itemhandler.cpp
+++ b/src/net/itemhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/itemhandler.h b/src/net/itemhandler.h
index 0f292d46..0cb3b42a 100644
--- a/src/net/itemhandler.h
+++ b/src/net/itemhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp
index cf45dbd4..2695fc7b 100644
--- a/src/net/loginhandler.cpp
+++ b/src/net/loginhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index 6b938627..df86b634 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/maploginhandler.cpp b/src/net/maploginhandler.cpp
index bcd3dd62..b5192bd7 100644
--- a/src/net/maploginhandler.cpp
+++ b/src/net/maploginhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/maploginhandler.h b/src/net/maploginhandler.h
index fb083b51..c7fee70c 100644
--- a/src/net/maploginhandler.h
+++ b/src/net/maploginhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messagehandler.cpp b/src/net/messagehandler.cpp
index f45000be..f1561a31 100644
--- a/src/net/messagehandler.cpp
+++ b/src/net/messagehandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index 7ff5194b..45cdf8cd 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index f1ff4013..a288d936 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messagein.h b/src/net/messagein.h
index 94f2bee7..0ff6e78a 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index ab17f537..bf4957be 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/messageout.h b/src/net/messageout.h
index 93f1c2e8..b3a4ef68 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/network.cpp b/src/net/network.cpp
index 0126ad6d..3fa046c4 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/network.h b/src/net/network.h
index e264f8a5..02fe7538 100644
--- a/src/net/network.h
+++ b/src/net/network.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index 60a77af1..69346b65 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -73,13 +72,22 @@ void NPCHandler::handleMessage(MessageIn *msg)
case SMSG_NPC_CLOSE:
id = msg->readInt32();
- if (current_npc == id)
- current_npc = 0;
- npcTextDialog->closeDialog(id);
+ // If we're talking to that NPC, show the close button
+ if (id == current_npc)
+ npcTextDialog->showCloseButton();
+ // Otherwise, move on as an empty dialog doesn't help
+ else
+ npcTextDialog->closeDialog(id);
break;
case SMSG_NPC_NEXT:
- // Next button in NPC dialog, currently unused
+ id = msg->readInt32();
+ // If we're talking to that NPC, show the next button
+ if (id == current_npc)
+ npcTextDialog->showNextButton();
+ // Otherwise, move on as an empty dialog doesn't help
+ else
+ npcTextDialog->nextDialog(id);
break;
case SMSG_NPC_INT_INPUT:
@@ -87,6 +95,7 @@ void NPCHandler::handleMessage(MessageIn *msg)
current_npc = msg->readInt32();
player_node->setAction(LocalPlayer::STAND);
npcIntegerDialog->setRange(0, 2147483647);
+ npcIntegerDialog->setDefaultValue(0);
npcIntegerDialog->setVisible(true);
npcIntegerDialog->requestFocus();
break;
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 35db2956..7ac962eb 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index b65ff2c9..96200add 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -1,8 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 158e89e6..fc02bf0a 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -1,8 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 60d58a37..aa0ef16c 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -28,6 +27,7 @@
#include "../localplayer.h"
#include "../log.h"
#include "../npc.h"
+#include "../units.h"
#include "../gui/buy.h"
#include "../gui/buysell.h"
@@ -90,8 +90,8 @@ namespace {
buyDialog->setVisible(false);
sellDialog->setVisible(false);
buySellDialog->setVisible(false);
+
if (storageWindow->isVisible()) storageWindow->close();
- current_npc = 0;
}
} deathListener;
}
@@ -145,8 +145,6 @@ void PlayerHandler::handleMessage(MessageIn *msg)
// Switch the actual map, deleting the previous one if necessary
engine->changeMap(mapPath);
- current_npc = 0;
-
float scrollOffsetX = 0.0f;
float scrollOffsetY = 0.0f;
@@ -287,8 +285,8 @@ void PlayerHandler::handleMessage(MessageIn *msg)
player_node->mGp = msg->readInt32();
if (player_node->mGp > curGp)
chatWindow->chatLog(_("You picked up ") +
- toString(player_node->mGp - curGp) + " GP",
- BY_SERVER);
+ Units::formatCurrency(player_node->mGp
+ - curGp), BY_SERVER);
}
break;
case 0x0016:
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 0500ae44..1a7c8da3 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index 563c1cc4..69d69901 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 645d667f..4b470d12 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/skillhandler.cpp b/src/net/skillhandler.cpp
index be757d7c..526698f4 100644
--- a/src/net/skillhandler.cpp
+++ b/src/net/skillhandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h
index 689e42dc..2b55605d 100644
--- a/src/net/skillhandler.h
+++ b/src/net/skillhandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp
index fd772d01..ab2eba31 100644
--- a/src/net/tradehandler.cpp
+++ b/src/net/tradehandler.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h
index 8f108248..d479e43f 100644
--- a/src/net/tradehandler.h
+++ b/src/net/tradehandler.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/npc.cpp b/src/npc.cpp
index a6d60dbb..630316e0 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,7 +33,7 @@
#include "resources/npcdb.h"
-bool NPC::mTalking = false;
+bool NPC::isTalking = false;
int current_npc = 0;
static const int NAME_X_OFFSET = 15;
@@ -110,10 +109,9 @@ Being::Type NPC::getType() const
void NPC::talk()
{
- if (mTalking || !mNetwork)
- return;
+ if (isTalking || !mNetwork) return;
- mTalking = true;
+ isTalking = true;
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_TALK);
outMsg.writeInt32(mId);
diff --git a/src/npc.h b/src/npc.h
index 137cd5f5..b6dddab0 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,10 +41,9 @@ class NPC : public Player
virtual Type getType() const;
- void talk();;
-
- static bool mTalking;
+ void talk();
+ static bool isTalking;
protected:
Network *mNetwork;
void updateCoords();
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index df8d264f..7a1d259e 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,12 +26,12 @@
#include "resources/image.h"
+#ifdef USE_OPENGL
+
#ifdef __APPLE__
#include <OpenGL/OpenGL.h>
#endif
-#ifdef USE_OPENGL
-
#ifndef GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
diff --git a/src/openglgraphics.h b/src/openglgraphics.h
index a7181420..469e1f53 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/particle.cpp b/src/particle.cpp
index 0e412ada..21844f01 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -250,7 +249,7 @@ void Particle::moveTo(float x, float y)
moveTo(Vector(x, y, mPos.z));
}
-Particle* Particle::addEffect(const std::string &particleEffectFile,
+Particle *Particle::addEffect(const std::string &particleEffectFile,
int pixelX, int pixelY, int rotation)
{
Particle *newParticle = NULL;
diff --git a/src/particle.h b/src/particle.h
index 76beb8d1..3584c4fc 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _PARTICLE_H
-#define _PARTICLE_H
+#ifndef PARTICLE_H
+#define PARTICLE_H
#include <list>
#include <string>
@@ -285,7 +284,7 @@ class Particle : public Sprite
// follow-point particles
Particle *mTarget; /**< The particle that attracts this particle*/
- float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/
+ float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/
float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/
float mMomentum; /**< How much speed the particle retains after each game tick*/
};
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 0ebf4bc3..63f89079 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,15 +24,17 @@
#include "particle.h"
#include "particlecontainer.h"
-ParticleContainer::ParticleContainer(ParticleContainer *parent, bool delParent) :
+
+ParticleContainer::ParticleContainer(ParticleContainer *parent,
+ bool delParent):
mDelParent(delParent),
mNext(parent)
-{};
+{}
ParticleContainer::~ParticleContainer()
{
clearLocally();
- if (mNext && mDelParent)
+ if (mDelParent)
delete mNext;
}
@@ -52,10 +53,12 @@ void ParticleContainer::moveTo(float x, float y)
// -- particle list ----------------------------------------
-ParticleList::ParticleList(ParticleContainer *parent, bool delParent) :
- ParticleContainer(parent, delParent) {};
+ParticleList::ParticleList(ParticleContainer *parent, bool delParent):
+ ParticleContainer(parent, delParent)
+{}
-ParticleList::~ParticleList() {}
+ParticleList::~ParticleList()
+{}
void ParticleList::addLocally(Particle *particle)
{
@@ -71,10 +74,12 @@ void ParticleList::removeLocally(Particle *particle)
{
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
+ {
if (*it == particle) {
(*it)->kill();
mElements.erase(it);
}
+ }
}
void ParticleList::clearLocally()
@@ -82,7 +87,7 @@ void ParticleList::clearLocally()
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
(*it)->kill();
-
+
mElements.clear();
}
@@ -106,10 +111,12 @@ void ParticleList::moveTo(float x, float y)
// -- particle vector ----------------------------------------
-ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent) :
- ParticleContainer(parent, delParent) {};
+ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent):
+ ParticleContainer(parent, delParent)
+{}
-ParticleVector::~ParticleVector() {};
+ParticleVector::~ParticleVector()
+{}
void ParticleVector::setLocally(int index, Particle *particle)
{
@@ -120,6 +127,8 @@ void ParticleVector::setLocally(int index, Particle *particle)
if (mIndexedElements.size() <= (unsigned) index)
mIndexedElements.resize(index + 1, NULL);
+ if (particle)
+ particle->disableAutoDelete();
mIndexedElements[index] = particle;
}
@@ -149,7 +158,7 @@ void ParticleVector::moveTo(float x, float y)
ParticleContainer::moveTo(x, y);
for (std::vector<Particle *>::iterator it = mIndexedElements.begin();
- it != mIndexedElements.end(); it++)
+ it != mIndexedElements.end(); it++) {
if (*it)
{
(*it)->moveTo(x, y);
@@ -160,5 +169,6 @@ void ParticleVector::moveTo(float x, float y)
*it = NULL;
}
}
+ }
}
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index 1e2f8ff7..26539dd7 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,8 +60,8 @@ public:
virtual void moveTo(float x, float y);
protected:
- bool mDelParent; /**< Delete mNext in destructor */
- ParticleContainer *mNext; /**< Contained container, if any */
+ bool mDelParent; /**< Delete mNext in destructor */
+ ParticleContainer *mNext; /**< Contained container, if any */
};
/**
@@ -89,7 +88,7 @@ public:
virtual void moveTo(float x, float y);
protected:
- std::list<Particle *> mElements; /**< Contained particle effects */
+ std::list<Particle *> mElements; /**< Contained particle effects */
};
/**
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 84c4c1ec..25e6ade5 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 835f39c5..67b35ae2 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index e3817763..e68ac222 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/party.cpp b/src/party.cpp
index a4f1b940..ae8df175 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -1,8 +1,8 @@
/*
- * Aethyra
- * Copyright 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
+ * The Mana World
+ * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/party.h b/src/party.h
index 0a19ae1d..0f58b14b 100644
--- a/src/party.h
+++ b/src/party.h
@@ -1,8 +1,8 @@
/*
- * Aethyra
- * Copyright 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
+ * The Mana World
+ * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/player.cpp b/src/player.cpp
index ba4ed1ff..90d1aa8e 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/player.h b/src/player.h
index b815b829..f9911bb8 100644
--- a/src/player.h
+++ b/src/player.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index eec4153c..ef2ef1bc 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -352,8 +351,6 @@ private:
-static std::vector<PlayerIgnoreStrategy *> player_ignore_strategies;
-
std::vector<PlayerIgnoreStrategy *> *
PlayerRelationsManager::getPlayerIgnoreStrategies()
{
diff --git a/src/player_relations.h b/src/player_relations.h
index f4860e08..a6c6a115 100644
--- a/src/player_relations.h
+++ b/src/player_relations.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,7 +94,6 @@ class PlayerRelationsManager
{
public:
PlayerRelationsManager();
-
~PlayerRelationsManager();
/**
diff --git a/src/position.cpp b/src/position.cpp
index f370f27b..69d50476 100644
--- a/src/position.cpp
+++ b/src/position.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/position.h b/src/position.h
index 1c961c46..cbcf8c99 100644
--- a/src/position.h
+++ b/src/position.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/properties.h b/src/properties.h
index ad5af1d6..a2ce5b88 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,7 +45,8 @@ class Properties
* @return the value of the given property or the given default when it
* doesn't exist.
*/
- const std::string& getProperty(const std::string &name, const std::string &def = "") const
+ const std::string &getProperty(const std::string &name,
+ const std::string &def = "") const
{
PropertyMap::const_iterator i = mProperties.find(name);
return (i != mProperties.end()) ? i->second : def;
@@ -60,7 +60,7 @@ class Properties
* @return the value of the given property, or 0.0f when it doesn't
* exist.
*/
- float getFloatProperty(std::string const &name, float def = 0.0f) const
+ float getFloatProperty(const std::string &name, float def = 0.0f) const
{
PropertyMap::const_iterator i = mProperties.find(name);
float ret = def;
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index 67acf1b1..e2cb11f2 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/action.h b/src/resources/action.h
index 8dde068c..649d3828 100644
--- a/src/resources/action.h
+++ b/src/resources/action.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/ambientoverlay.cpp b/src/resources/ambientoverlay.cpp
index 9585f4f7..32ed47d1 100644
--- a/src/resources/ambientoverlay.cpp
+++ b/src/resources/ambientoverlay.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/ambientoverlay.h b/src/resources/ambientoverlay.h
index bb61f826..65f9891d 100644
--- a/src/resources/ambientoverlay.h
+++ b/src/resources/ambientoverlay.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 901f4f25..54c319de 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/animation.h b/src/resources/animation.h
index bc8431c7..0c461ebe 100644
--- a/src/resources/animation.h
+++ b/src/resources/animation.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index b53798bb..3a8754ea 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -1,8 +1,8 @@
/*
- * Color Database
- * Copyright 2008 Aethyra Development Team
+ * Color database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <libxml/tree.h>
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
index d4568d54..c581f653 100644
--- a/src/resources/colordb.h
+++ b/src/resources/colordb.h
@@ -1,8 +1,8 @@
/*
- * Color Database
- * Copyright 2008 Aethyra Development Team
+ * Color database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COLOR_MANAGER_H
@@ -47,6 +47,6 @@ namespace ColorDB
// Color DB
typedef std::map<int, std::string> Colors;
typedef Colors::iterator ColorIterator;
-};
+}
#endif
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 38249ddb..1e4fd2fd 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/dye.h b/src/resources/dye.h
index f39ba043..d0d010bc 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index ec87c5cd..5bc8407a 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -1,8 +1,8 @@
/*
* Emote database
- * Copyright 2009 Aethyra Development Team
+ * Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "emotedb.h"
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index 48e1d53c..691881c8 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -1,8 +1,8 @@
/*
* Emote database
- * Copyright 2009 Aethyra Development Team
+ * Copyright (C) 2009 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EMOTE_DB_H
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index cff40197..b696389f 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/image.h b/src/resources/image.h
index f6b77f26..eeaa574e 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index fe420e89..40d62797 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -88,7 +87,7 @@ void ProxyImage::convertToDisplayFormat()
mSDLImage = NULL;
}
-gcn::Image *ImageLoader::load(std::string const &filename, bool convert)
+gcn::Image *ImageLoader::load(const std::string &filename, bool convert)
{
ResourceManager *resman = ResourceManager::getInstance();
ProxyImage *i = new ProxyImage(resman->loadSDLSurface(filename));
diff --git a/src/resources/imageloader.h b/src/resources/imageloader.h
index 2695b99c..1d6c9ae4 100644
--- a/src/resources/imageloader.h
+++ b/src/resources/imageloader.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +61,8 @@ class ProxyImage : public gcn::Image
class ImageLoader : public gcn::ImageLoader
{
public:
- gcn::Image *load(std::string const &filename, bool convertToDisplayFormat);
+ gcn::Image *load(const std::string &filename,
+ bool convertToDisplayFormat);
};
#endif
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 33be1573..92bb3242 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/imageset.h b/src/resources/imageset.h
index ad209aaf..f59c76bb 100644
--- a/src/resources/imageset.h
+++ b/src/resources/imageset.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 5ddd24e3..c350ac07 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h
index c69eb2d3..039d3afb 100644
--- a/src/resources/imagewriter.h
+++ b/src/resources/imagewriter.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 2b94bd61..dbd12eee 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +51,7 @@ void ItemDB::load()
logger->log("Initializing item database...");
- mUnknown = new ItemInfo();
+ mUnknown = new ItemInfo;
mUnknown->setName(_("Unknown item"));
mUnknown->setImageName("");
mUnknown->setSprite("error.xml", GENDER_MALE);
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 1e55f146..08a7acd0 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 8dcb1c32..2f118284 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 0ea59050..2aff68a9 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 901a2561..5fa47261 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -360,12 +359,12 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
xmlNodePtr dataChild = childNode->xmlChildrenNode;
if (!dataChild)
continue;
-
+
int len = strlen((const char*)dataChild->content) + 1;
unsigned char *charData = new unsigned char[len + 1];
const char *charStart = (const char*)dataChild->content;
unsigned char *charIndex = charData;
-
+
while (*charStart) {
if (*charStart != ' ' && *charStart != '\t' &&
*charStart != '\n')
@@ -427,10 +426,10 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
else {
- // Read plain XML map file
- for_each_xml_child_node(childNode2, childNode)
- {
- if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
+ // Read plain XML map file
+ for_each_xml_child_node(childNode2, childNode)
+ {
+ if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
continue;
const int gid = XML::getProperty(childNode2, "gid", -1);
@@ -444,12 +443,12 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
}
-
+
if (y < h)
std::cerr << "TOO SMALL!\n";
if (x)
std::cerr << "TOO SMALL!\n";
-
+
// There can be only one data element
break;
}
@@ -523,7 +522,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node,
// create animation
if (!set) continue;
- Animation *ani = new Animation();
+ Animation *ani = new Animation;
for (int i = 0; ;i++)
{
std::map<std::string, int>::iterator iFrame, iDelay;
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index 2f64aa8c..0ed553c3 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index b1965989..e0259b29 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +61,7 @@ void MonsterDB::load()
continue;
}
- MonsterInfo *currentInfo = new MonsterInfo();
+ MonsterInfo *currentInfo = new MonsterInfo;
currentInfo->setName(XML::getProperty(monsterNode, "name", _("unnamed")));
diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h
index e49901d5..0a218661 100644
--- a/src/resources/monsterdb.h
+++ b/src/resources/monsterdb.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp
index 725e9cf5..734d1e01 100644
--- a/src/resources/monsterinfo.cpp
+++ b/src/resources/monsterinfo.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h
index 4a3208f4..359791fd 100644
--- a/src/resources/monsterinfo.h
+++ b/src/resources/monsterinfo.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index 72094025..ed78a541 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/music.h b/src/resources/music.h
index f89c0fb2..34907cf1 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 3e9decf1..ee65136a 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h
index 394154fa..af6764bf 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index ca9a69c3..d1c3ada4 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/resource.h b/src/resources/resource.h
index f8822d72..7c5f989e 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index d6ab39a0..50eda0ce 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -214,7 +213,7 @@ std::string ResourceManager::getPath(const std::string &file)
return path;
}
-Resource *ResourceManager::get(std::string const &idPath, generator fun,
+Resource *ResourceManager::get(const std::string &idPath, generator fun,
void *data)
{
// Check if the id exists, and return the value if it does.
@@ -266,7 +265,7 @@ struct ResourceLoader
}
};
-Resource *ResourceManager::load(std::string const &path, loader fun)
+Resource *ResourceManager::load(const std::string &path, loader fun)
{
ResourceLoader l = { this, path, fun };
return get(path, ResourceLoader::load, &l);
@@ -308,7 +307,7 @@ struct DyedImageLoader
}
};
-Image *ResourceManager::getImage(std::string const &idPath)
+Image *ResourceManager::getImage(const std::string &idPath)
{
DyedImageLoader l = { this, idPath };
return static_cast<Image*>(get(idPath, DyedImageLoader::load, &l));
@@ -350,8 +349,7 @@ struct SpriteDefLoader
}
};
-SpriteDef *ResourceManager::getSprite
- (std::string const &path, int variant)
+SpriteDef *ResourceManager::getSprite(const std::string &path, int variant)
{
SpriteDefLoader l = { path, variant };
std::stringstream ss;
@@ -380,7 +378,8 @@ void ResourceManager::release(Resource *res)
ResourceManager *ResourceManager::getInstance()
{
// Create a new instance if necessary.
- if (instance == NULL) instance = new ResourceManager();
+ if (!instance)
+ instance = new ResourceManager;
return instance;
}
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 10f6fffe..c3c68d88 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -116,7 +115,7 @@ class ResourceManager
* @return A valid resource or <code>NULL</code> if the resource could
* not be generated.
*/
- Resource *get(std::string const &idPath, generator fun, void *data);
+ Resource *get(const std::string &idPath, generator fun, void *data);
/**
* Loads a resource from a file and adds it to the resource map.
@@ -126,7 +125,7 @@ class ResourceManager
* @return A valid resource or <code>NULL</code> if the resource could
* not be loaded.
*/
- Resource *load(std::string const &path, loader fun);
+ Resource *load(const std::string &path, loader fun);
/**
* Convenience wrapper around ResourceManager::get for loading
@@ -156,7 +155,7 @@ class ResourceManager
* Creates a sprite definition based on a given path and the supplied
* variant.
*/
- SpriteDef *getSprite(std::string const &path, int variant = 0);
+ SpriteDef *getSprite(const std::string &path, int variant = 0);
/**
* Releases a resource, placing it in the set of orphaned resources.
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index d1d24afb..3a285730 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index fe14df02..fc2d4a69 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index d6cc8960..0a87db16 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,7 +32,7 @@
#include "../log.h"
#include "../utils/xml.h"
-Action* SpriteDef::getAction(SpriteAction action) const
+Action *SpriteDef::getAction(SpriteAction action) const
{
Actions::const_iterator i = mActions.find(action);
@@ -46,7 +45,7 @@ Action* SpriteDef::getAction(SpriteAction action) const
return i->second;
}
-SpriteDef *SpriteDef::load(std::string const &animationFile, int variant)
+SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
{
std::string::size_type pos = animationFile.find('|');
std::string palettes;
@@ -121,7 +120,7 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant,
}
}
-void SpriteDef::loadImageSet(xmlNodePtr node, std::string const &palettes)
+void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes)
{
const std::string name = XML::getProperty(node, "name", "");
@@ -167,7 +166,7 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
actionName.c_str(), getIdPath().c_str());
return;
}
- Action *action = new Action();
+ Action *action = new Action;
mActions[actionType] = action;
// When first action set it as default direction
@@ -201,7 +200,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
return;
}
- Animation *animation = new Animation();
+ Animation *animation = new Animation;
action->setAnimation(directionType, animation);
// Get animation frames
@@ -320,7 +319,7 @@ SpriteDef::~SpriteDef()
}
}
-SpriteAction SpriteDef::makeSpriteAction(const std::string& action)
+SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
{
if (action.empty() || action == "default") {
return ACTION_DEFAULT;
@@ -391,5 +390,5 @@ SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction)
}
else {
return DIRECTION_INVALID;
- };
+ }
}
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 040d96e2..b9d7b85d 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,13 +71,24 @@ class SpriteDef : public Resource
/**
* Loads a sprite definition file.
*/
- static SpriteDef *load(std::string const &file, int variant);
+ static SpriteDef *load(const std::string &file, int variant);
/**
* Returns the specified action.
*/
Action *getAction(SpriteAction action) const;
+ /**
+ * Converts a string into a SpriteAction enum.
+ */
+ static SpriteAction makeSpriteAction(const std::string &action);
+
+ /**
+ * Converts a string into a SpriteDirection enum.
+ */
+ static SpriteDirection
+ makeSpriteDirection(const std::string &direction);
+
private:
/**
* Constructor.
@@ -99,7 +109,7 @@ class SpriteDef : public Resource
/**
* Loads an imageset element.
*/
- void loadImageSet(xmlNodePtr node, std::string const &palettes);
+ void loadImageSet(xmlNodePtr node, const std::string &palettes);
/**
* Loads an action element.
@@ -129,16 +139,6 @@ class SpriteDef : public Resource
*/
void substituteAction(SpriteAction complete, SpriteAction with);
- /**
- * Converts a string into a SpriteAction enum.
- */
- static SpriteAction makeSpriteAction(const std::string &action);
-
- /**
- * Converts a string into a SpriteDirection enum.
- */
- static SpriteDirection makeSpriteDirection(const std::string &direction);
-
typedef std::map<std::string, ImageSet*> ImageSets;
typedef ImageSets::iterator ImageSetIterator;
diff --git a/src/serverinfo.h b/src/serverinfo.h
index fc3ef032..c38d13c7 100644
--- a/src/serverinfo.h
+++ b/src/serverinfo.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index 00875a2d..ee55799f 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,19 +21,22 @@
#include "shopitem.h"
-#include "utils/stringutils.h"
+#include "units.h"
-ShopItem::ShopItem (int inventoryIndex, int id, int quantity, int price) :
+ShopItem::ShopItem (int inventoryIndex, int id,
+ int quantity, int price) :
Item (id, 0), mPrice(price)
{
- mDisplayName = getInfo().getName() + " (" + toString(mPrice) + " GP)";
+ mDisplayName = getInfo().getName() +
+ " (" + Units::formatCurrency(mPrice).c_str() + ")";
setInvIndex(inventoryIndex);
addDuplicate(inventoryIndex, quantity);
}
ShopItem::ShopItem (int id, int price) : Item (id, 0), mPrice(price)
{
- mDisplayName = getInfo().getName() + " (" + toString(mPrice) + " GP)";
+ mDisplayName = getInfo().getName() +
+ " (" + Units::formatCurrency(mPrice).c_str() + ")";
setInvIndex(-1);
addDuplicate(-1, 0);
}
@@ -80,4 +82,3 @@ int ShopItem::sellCurrentDuplicate(int quantity)
}
return sellCount;
}
-
diff --git a/src/shopitem.h b/src/shopitem.h
index afc48bf5..cbe0a06f 100644
--- a/src/shopitem.h
+++ b/src/shopitem.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index c3584ede..65d8e8e2 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,13 +34,13 @@ SimpleAnimation::SimpleAnimation(Animation *animation):
mAnimationPhase(0),
mCurrentFrame(mAnimation->getFrame(0))
{
-};
+}
SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
mAnimationTime(0),
mAnimationPhase(0)
{
- mAnimation = new Animation();
+ mAnimation = new Animation;
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(animationNode, "imageset", ""),
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index 5583e449..e48644d4 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/sound.cpp b/src/sound.cpp
index 5b8dedef..6e0b0da0 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/sound.h b/src/sound.h
index 5c0c7ef8..4dd68870 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/sprite.h b/src/sprite.h
index c2b0fc7c..a6384e94 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
new file mode 100644
index 00000000..70e8d59f
--- /dev/null
+++ b/src/statuseffect.cpp
@@ -0,0 +1,174 @@
+/*
+ * The Mana World
+ * Copyright (C) 2008 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <map>
+
+#include "gui/chat.h"
+#include "statuseffect.h"
+
+#include "log.h"
+#include "utils/xml.h"
+
+
+#define STATUS_EFFECTS_FILE "status-effects.xml"
+
+StatusEffect::StatusEffect() :
+ mPersistentParticleEffect(false)
+{}
+
+StatusEffect::~StatusEffect()
+{}
+
+void StatusEffect::playSFX()
+{
+ if (!mSFXEffect.empty())
+ sound.playSfx(mSFXEffect);
+}
+
+void StatusEffect::deliverMessage()
+{
+ if (!mMessage.empty())
+ chatWindow->chatLog(mMessage, BY_SERVER);
+}
+
+Particle *StatusEffect::getParticle()
+{
+ if (mParticleEffect.empty())
+ return NULL;
+ else
+ return particleEngine->addEffect(mParticleEffect, 0, 0);
+}
+
+AnimatedSprite *StatusEffect::getIcon()
+{
+ if (mIcon.empty())
+ return NULL;
+ else {
+ AnimatedSprite *sprite = AnimatedSprite::load(
+ "graphics/sprites/" + mIcon);
+ if (false && sprite) {
+ sprite->play(ACTION_DEFAULT);
+ sprite->reset();
+ }
+ return sprite;
+ }
+}
+
+SpriteAction StatusEffect::getAction()
+{
+ if (mAction.empty())
+ return ACTION_INVALID;
+ else
+ return SpriteDef::makeSpriteAction(mAction);
+}
+
+
+// -- initialisation and static parts --
+
+
+typedef std::map<int, StatusEffect *> status_effect_map[2];
+
+static status_effect_map statusEffects;
+static status_effect_map stunEffects;
+static std::map<int, int> blockEffectIndexMap;
+
+int StatusEffect::blockEffectIndexToEffectIndex(int blockIndex)
+{
+ if (blockEffectIndexMap.find(blockIndex) == blockEffectIndexMap.end())
+ return -1;
+ return blockEffectIndexMap[blockIndex];
+}
+
+StatusEffect *StatusEffect::getStatusEffect(int index, bool enabling)
+{
+ return statusEffects[enabling][index];
+}
+
+StatusEffect *StatusEffect::getStunEffect(int index, bool enabling)
+{
+ return stunEffects[enabling][index];
+}
+
+void StatusEffect::load()
+{
+ XML::Document doc(STATUS_EFFECTS_FILE);
+ xmlNodePtr rootNode = doc.rootNode();
+
+ if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "status-effects"))
+ {
+ logger->log("Error loading status effects file: "
+ STATUS_EFFECTS_FILE);
+ return;
+ }
+
+ for_each_xml_child_node(node, rootNode)
+ {
+ status_effect_map *the_map = NULL;
+
+ int index = atoi(XML::getProperty(node, "id", "-1").c_str());
+
+ if (xmlStrEqual(node->name, BAD_CAST "status-effect"))
+ {
+ the_map = &statusEffects;
+ int block_index = atoi(XML::getProperty(node, "block-id", "-1").c_str());
+
+ if (index >= 0 && block_index >= 0)
+ blockEffectIndexMap[block_index] = index;
+
+ } else if (xmlStrEqual(node->name, BAD_CAST "stun-effect"))
+ the_map = &stunEffects;
+
+ if (the_map) {
+ StatusEffect *startEffect = new StatusEffect;
+ StatusEffect *endEffect = new StatusEffect;
+
+ startEffect->mMessage = XML::getProperty(node, "start-message", "");
+ startEffect->mSFXEffect = XML::getProperty(node, "start-audio", "");
+ startEffect->mParticleEffect = XML::getProperty(node, "start-particle", "");
+ startEffect->mIcon = XML::getProperty(node, "icon", "");
+ startEffect->mAction = XML::getProperty(node, "action", "");
+ startEffect->mPersistentParticleEffect = (XML::getProperty(node, "persistent-particle-effect", "no")) != "no";
+
+ endEffect->mMessage = XML::getProperty(node, "end-message", "");
+ endEffect->mSFXEffect = XML::getProperty(node, "end-audio", "");
+ endEffect->mParticleEffect = XML::getProperty(node, "end-particle", "");
+
+ (*the_map)[1][index] = startEffect;
+ (*the_map)[0][index] = endEffect;
+ }
+ }
+}
+
+void unloadMap(std::map<int, StatusEffect *> map)
+{
+ std::map<int, StatusEffect *>::iterator it;
+
+ for (it = map.begin(); it != map.end(); it++)
+ delete (*it).second;
+}
+
+void StatusEffect::unload()
+{
+ unloadMap(statusEffects[0]);
+ unloadMap(statusEffects[1]);
+ unloadMap(stunEffects[0]);
+ unloadMap(stunEffects[1]);
+} \ No newline at end of file
diff --git a/src/statuseffect.h b/src/statuseffect.h
new file mode 100644
index 00000000..f1af93d2
--- /dev/null
+++ b/src/statuseffect.h
@@ -0,0 +1,110 @@
+/*
+ * The Mana World
+ * Copyright (C) 2008 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef STATUS_EFFECT_H
+#define STATUS_EFFECT_H
+
+#include "resources/animation.h"
+#include "particle.h"
+#include "animatedsprite.h"
+#include "sound.h"
+
+class StatusEffect
+{
+public:
+ StatusEffect();
+ ~StatusEffect();
+
+ /**
+ * Plays the sound effect associated with this status effect, if possible.
+ */
+ void playSFX();
+
+ /**
+ * Delivers the chat message associated with this status effect, if
+ * possible.
+ */
+ void deliverMessage();
+
+ /**
+ * Creates the particle effect associated with this status effect, if
+ * possible.
+ */
+ Particle *getParticle();
+
+ /**
+ * Retrieves the status icon for this effect, if applicable
+ */
+ AnimatedSprite *getIcon();
+
+ /**
+ * Retrieves an action to perform, or ACTION_INVALID
+ */
+ SpriteAction getAction();
+
+ /**
+ * Determines whether the particle effect should be restarted when the
+ * being changes maps
+ */
+ bool particleEffectIsPersistent() const { return mPersistentParticleEffect; }
+
+
+ /**
+ * Retrieves a status effect.
+ *
+ * \param index Index of the status effect.
+ * \param enabling Whether to retrieve the activating effect (true) or
+ * the deactivating effect (false).
+ */
+ static StatusEffect *getStatusEffect(int index, bool enabling);
+
+ /**
+ * Retrieves a stun effect.
+ *
+ * \param index Index of the stun effect.
+ * \param enabling Whether to retrieve the activating effect (true) or
+ * the deactivating effect (false).
+ */
+ static StatusEffect *getStunEffect(int index, bool enabling);
+
+ /**
+ * Maps a block effect index to its corresponding effect index. Block
+ * effect indices are used for opt2/opt3/status.option blocks; their
+ * mapping to regular effect indices is handled in the config file.
+ *
+ * Returns -1 on failure.
+ */
+ static int blockEffectIndexToEffectIndex(int blocKIndex);
+
+ static void load();
+
+ static void unload();
+private:
+
+ std::string mMessage;
+ std::string mSFXEffect;
+ std::string mParticleEffect;
+ std::string mIcon;
+ std::string mAction;
+ bool mPersistentParticleEffect;
+};
+
+#endif // !defined(STATUS_EFFECT_H)
diff --git a/src/text.cpp b/src/text.cpp
index 4e697f15..83bd6c24 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,29 +20,58 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "text.h"
+
#include <guichan/font.hpp>
-#include "text.h"
+#include "configuration.h"
#include "textmanager.h"
+#include "resources/resourcemanager.h"
+#include "resources/image.h"
#include "gui/gui.h"
#include "gui/palette.h"
#include "gui/textrenderer.h"
int Text::mInstances = 0;
+ImageRect Text::mBubble;
+Image *Text::mBubbleArrow;
Text::Text(const std::string &text, int x, int y,
- gcn::Graphics::Alignment alignment, const gcn::Color* color) :
+ gcn::Graphics::Alignment alignment,
+ const gcn::Color* color, bool isSpeech) :
mText(text),
- mColor(color)
+ mColor(color),
+ mIsSpeech(isSpeech)
{
if (textManager == 0)
{
- textManager = new TextManager();
+ textManager = new TextManager;
+ ResourceManager *resman = ResourceManager::getInstance();
+ Image *sbImage = resman->getImage("graphics/gui/bubble.png|W:#"
+ + config.getValue("speechBubblecolor", "000000"));
+ mBubble.grid[0] = sbImage->getSubImage(0, 0, 5, 5);
+ mBubble.grid[1] = sbImage->getSubImage(5, 0, 5, 5);
+ mBubble.grid[2] = sbImage->getSubImage(10, 0, 5, 5);
+ mBubble.grid[3] = sbImage->getSubImage(0, 5, 5, 5);
+ mBubble.grid[4] = sbImage->getSubImage(5, 5, 5, 5);
+ mBubble.grid[5] = sbImage->getSubImage(10, 5, 5, 5);
+ mBubble.grid[6] = sbImage->getSubImage(0, 10, 5, 5);
+ mBubble.grid[7] = sbImage->getSubImage(5, 10, 5, 5);
+ mBubble.grid[8] = sbImage->getSubImage(10, 10, 5, 5);
+ mBubbleArrow = sbImage->getSubImage(0, 15, 15, 10);
+ const float bubbleAlpha = config.getValue("speechBubbleAlpha", 1.0);
+ for (int i = 0; i < 9; i++)
+ {
+ mBubble.grid[i]->setAlpha(bubbleAlpha);
+ }
+ mBubbleArrow->setAlpha(bubbleAlpha);
+ sbImage->decRef();
}
++mInstances;
mHeight = boldFont->getHeight();
mWidth = boldFont->getWidth(text);
+
switch (alignment)
{
case gcn::Graphics::LEFT:
@@ -60,11 +89,6 @@ Text::Text(const std::string &text, int x, int y,
textManager->addText(this);
}
-void Text::adviseXY(int x, int y)
-{
- textManager->moveText(this, x - mXOffset, y);
-}
-
Text::~Text()
{
textManager->removeText(this);
@@ -72,16 +96,44 @@ Text::~Text()
{
delete textManager;
textManager = 0;
+ delete mBubble.grid[0];
+ delete mBubble.grid[1];
+ delete mBubble.grid[2];
+ delete mBubble.grid[3];
+ delete mBubble.grid[4];
+ delete mBubble.grid[5];
+ delete mBubble.grid[6];
+ delete mBubble.grid[7];
+ delete mBubble.grid[8];
+ delete mBubbleArrow;
}
}
+void Text::adviseXY(int x, int y)
+{
+ textManager->moveText(this, x - mXOffset, y);
+}
+
void Text::draw(gcn::Graphics *graphics, int xOff, int yOff)
{
graphics->setFont(boldFont);
+ if (mIsSpeech) {
+ static_cast<Graphics*>(graphics)->drawImageRect(
+ mX - xOff - 5, mY - yOff - 5, mWidth + 10, mHeight + 10,
+ mBubble);
+ /*
+ if (mWidth >= 15) {
+ static_cast<Graphics*>(graphics)->drawImage(
+ mBubbleArrow, mX - xOff - 7 + mWidth / 2,
+ mY - yOff + mHeight + 4);
+ }
+ */
+ }
+
TextRenderer::renderText(graphics, mText,
mX - xOff, mY - yOff, gcn::Graphics::LEFT,
- *mColor, boldFont, true);
+ *mColor, boldFont, !mIsSpeech, true);
}
FlashText::FlashText(const std::string &text, int x, int y,
diff --git a/src/text.h b/src/text.h
index cf0aac48..a96096cc 100644
--- a/src/text.h
+++ b/src/text.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,8 +24,8 @@
#define TEXT_H
#include <guichan/color.hpp>
-#include <guichan/graphics.hpp>
+#include "graphics.h"
#include "guichanfwd.h"
class TextManager;
@@ -40,7 +40,7 @@ class Text
*/
Text(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
- const gcn::Color *color);
+ const gcn::Color *color, bool isSpeech = false);
/**
* Destructor. The text is removed from the screen.
@@ -66,6 +66,11 @@ class Text
static int mInstances; /**< Instances of text. */
std::string mText; /**< The text to display. */
const gcn::Color *mColor; /**< The color of the text. */
+ bool mIsSpeech; /**< Is this text a speech bubble? */
+
+ protected:
+ static ImageRect mBubble; /**< Speech bubble graphic */
+ static Image *mBubbleArrow; /**< Speech bubble arrow graphic */
};
class FlashText : public Text
@@ -81,12 +86,12 @@ class FlashText : public Text
virtual ~FlashText() {}
/**
- * Flash the text for so many refreshes
+ * Flash the text for so many refreshes.
*/
void flash(int time) {mTime = time; }
/**
- * Draws the text
+ * Draws the text.
*/
virtual void draw(gcn::Graphics *graphics, int xOff, int yOff);
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 0cf09478..6bc8f8b6 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -2,7 +2,7 @@
* Support for non-overlapping floating text
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,10 +19,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "textmanager.h"
+
#include <cstring>
#include "text.h"
-#include "textmanager.h"
TextManager *textManager = 0;
diff --git a/src/textmanager.h b/src/textmanager.h
index d6485e34..ee8e1209 100644
--- a/src/textmanager.h
+++ b/src/textmanager.h
@@ -2,7 +2,7 @@
* Support for non-overlapping floating text
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 957d67c0..04b7abe1 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/textparticle.h b/src/textparticle.h
index 1a49b5ef..8b7d3e01 100644
--- a/src/textparticle.h
+++ b/src/textparticle.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2006 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,8 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _TEXTPARTICLE_H
-#define _TEXTPARTICLE_H
+#ifndef TEXTPARTICLE_H
+#define TEXTPARTICLE_H
#include "guichanfwd.h"
#include "particle.h"
diff --git a/src/tileset.h b/src/tileset.h
index 28f7d9d5..d4de7ba5 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/aethyra.rc b/src/tmw.rc
index e9d32be9..d9689f28 100644
--- a/src/aethyra.rc
+++ b/src/tmw.rc
@@ -1,22 +1,23 @@
-#include <windows.h> // include for version info constants
-
-#include "winver.h"
-
-A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "data/icons/aethyra.ico"
-
-1 VERSIONINFO
-FILEVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
-PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
-FILETYPE VFT_APP {
- BLOCK "StringFileInfo" {
- BLOCK "040904E4" {
- VALUE "CompanyName", "Aethyra Development Team"
- VALUE "FileVersion", PACKAGE_VERSION
- VALUE "FileDescription", "Aethyra Experiment"
- VALUE "LegalCopyright", "2009 (C)"
- VALUE "OriginalFilename", "aethyra.exe"
- VALUE "ProductName", "Aethyra MMORPG"
- VALUE "ProductVersion", PACKAGE_VERSION
- }
- }
+#include <windows.h> // include for version info constants
+
+#include "winver.h"
+
+A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "data/icons/tmw.ico"
+
+1 VERSIONINFO
+FILEVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
+PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
+FILETYPE VFT_APP {
+ BLOCK "StringFileInfo" {
+ BLOCK "040904E4" {
+ VALUE "CompanyName", "The Mana World Development Team"
+ VALUE "FileVersion", PACKAGE_VERSION
+ VALUE "FileDescription", "The Mana World"
+ VALUE "LegalCopyright", "2004-2009 (C)"
+ VALUE "OriginalFilename", "tmw.exe"
+ VALUE "ProductName", "The Mana World MMORPG"
+ VALUE "ProductVersion", PACKAGE_VERSION
+ }
+ }
}
+
diff --git a/src/units.cpp b/src/units.cpp
new file mode 100644
index 00000000..7e8d8e6a
--- /dev/null
+++ b/src/units.cpp
@@ -0,0 +1,232 @@
+/*
+ * Support for custom units
+ * Copyright (C) 2009 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "units.h"
+
+#include <cmath>
+#include <climits>
+#include <vector>
+
+#include "log.h"
+
+#include "utils/strprintf.h"
+#include "utils/stringutils.h"
+#include "utils/xml.h"
+
+struct UnitLevel {
+ std::string symbol;
+ int count;
+ int round;
+};
+
+struct UnitDescription {
+ std::vector<struct UnitLevel> levels;
+ double conversion;
+ bool mix;
+};
+
+enum UnitType {
+ UNIT_WEIGHT = 0,
+ UNIT_CURRENCY = 1,
+ UNIT_END
+};
+
+struct UnitDescription units[UNIT_END];
+
+void Units::loadUnits()
+{
+ int level;
+ std::string type;
+ XML::Document doc("units.xml");
+ xmlNodePtr root = doc.rootNode();
+
+ { // Setup default weight
+ struct UnitDescription ud;
+
+ ud.conversion = 1.0;
+ ud.mix = false;
+
+ struct UnitLevel bu;
+ bu.symbol = "g";
+ bu.count = 1;
+ bu.round = 0;
+
+ ud.levels.push_back(bu);
+
+ struct UnitLevel ul;
+ ul.symbol = "kg";
+ ul.count = 1000;
+ ul.round = 2;
+
+ ud.levels.push_back(ul);
+
+ units[UNIT_WEIGHT] = ud;
+ }
+
+ { // Setup default currency
+ struct UnitDescription ud;
+
+ ud.conversion = 1.0;
+ ud.mix = false;
+
+ struct UnitLevel bu;
+ bu.symbol = "¤";
+ bu.count = 1;
+ bu.round = 0;
+
+ ud.levels.push_back(bu);
+
+ units[UNIT_CURRENCY] = ud;
+ }
+
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "units"))
+ {
+ logger->log("Error loading unit definition file: units.xml");
+ return;
+ }
+
+ for_each_xml_child_node(node, root)
+ {
+ if (xmlStrEqual(node->name, BAD_CAST "unit"))
+ {
+ struct UnitDescription ud;
+ level = 1;
+ type = XML::getProperty(node, "type", "");
+ ud.conversion = XML::getProperty(node, "conversion", 1.0);
+ ud.mix = XML::getProperty(node, "mix", "no") == "yes";
+
+ struct UnitLevel bu;
+ bu.symbol = XML::getProperty(node, "base", "¤");
+ bu.count = 1;
+ bu.round = XML::getProperty(node, "round", 2);
+
+ ud.levels.push_back(bu);
+
+ for_each_xml_child_node(uLevel, node)
+ {
+ if (xmlStrEqual(uLevel->name, BAD_CAST "level"))
+ {
+ struct UnitLevel ul;
+ ul.symbol = XML::getProperty(uLevel, "symbol",
+ strprintf("¤%d",level));
+ ul.count = XML::getProperty(uLevel, "count", -1);
+ ul.round = XML::getProperty(uLevel, "round", bu.round);
+
+ if (ul.count > 0)
+ {
+ ud.levels.push_back(ul);
+ level++;
+ }
+ else
+ {
+ logger->log("Error bad unit count: %d for %s in %s",
+ ul.count, ul.symbol.c_str(), bu.symbol.c_str());
+ }
+ }
+ }
+
+ // Add one more level for saftey
+ struct UnitLevel ll;
+ ll.symbol = "";
+ ll.count = INT_MAX;
+ ll.round = 0;
+
+ ud.levels.push_back(ll);
+
+ if (type == "weight") units[UNIT_WEIGHT] = ud;
+ else if (type =="currency") units[UNIT_CURRENCY] = ud;
+ else logger->log("Error unknown unit type: %s", type.c_str());
+ }
+ }
+}
+
+std::string formatUnit(int value, int type)
+{
+ struct UnitDescription ud = units[type];
+ struct UnitLevel ul;
+ double amount = ud.conversion * value;
+
+ // Shortcut for 0; do the same for values less than 0 (for now)
+ if (value <= 0) {
+ ul = ud.levels[0];
+ return strprintf("0%s", ul.symbol.c_str());
+ } else {
+ // If only the first level is needed, act like mix if false
+ if (ud.mix && ud.levels.size() > 0 && ud.levels[1].count < amount)
+ {
+ std::string output;
+ struct UnitLevel pl = ud.levels[0];
+ ul = ud.levels[1];
+ int levelAmount = (int) amount;
+ int nextAmount;
+
+ levelAmount /= ul.count;
+
+ amount -= levelAmount * ul.count;
+
+ if (amount > 0) {
+ output = strprintf("%.*f%s", pl.round, amount,
+ pl.symbol.c_str());
+ }
+
+ for (unsigned int i = 2; i < ud.levels.size(); i++)
+ {
+ pl = ul;
+ ul = ud.levels[i];
+
+ nextAmount = levelAmount / ul.count;
+ levelAmount %= ul.count;
+
+ if (levelAmount > 0) output = strprintf("%d%s",
+ levelAmount, pl.symbol.c_str()) + output;
+
+ if (!nextAmount) break;
+ levelAmount = nextAmount;
+ }
+
+ return output;
+ }
+ else
+ {
+ for (unsigned int i = 0; i < ud.levels.size(); i++)
+ {
+ ul = ud.levels[i];
+ if (amount < ul.count && ul.count > 0) {
+ ul = ud.levels[i - 1];
+ break;
+ }
+ amount /= ul.count;
+ }
+
+ return strprintf("%.*f%s", ul.round, amount, ul.symbol.c_str());
+ }
+ }
+}
+
+std::string Units::formatCurrency(int value)
+{
+ return formatUnit(value, UNIT_CURRENCY);
+}
+
+std::string Units::formatWeight(int value)
+{
+ return formatUnit(value, UNIT_WEIGHT);
+}
diff --git a/src/units.h b/src/units.h
new file mode 100644
index 00000000..6aa07b70
--- /dev/null
+++ b/src/units.h
@@ -0,0 +1,46 @@
+/*
+ * Support for custom units
+ * Copyright (C) 2009 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef UNITS_H
+#define UNITS_H
+
+#include <string>
+
+class Units
+{
+ public:
+ /**
+ * Loads and parses the units.xml file (if found).
+ */
+ static void loadUnits();
+
+ /**
+ * Formats the given number in the correct currency format.
+ */
+ static std::string formatCurrency(int value);
+
+ /**
+ * Formats the given number in the correct weight/mass format.
+ */
+ static std::string formatWeight(int value);
+};
+
+#endif // UNITS_H
diff --git a/src/utils/dtor.h b/src/utils/dtor.h
index 96ce63d4..8dbc441f 100644
--- a/src/utils/dtor.h
+++ b/src/utils/dtor.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,5 +51,4 @@ inline void delete_all(Container &c)
std::for_each(c.begin(), c.end(), make_dtor(c));
}
-
#endif
diff --git a/src/utils/gettext.h b/src/utils/gettext.h
index f7286187..5281d491 100644
--- a/src/utils/gettext.h
+++ b/src/utils/gettext.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/mutex.h b/src/utils/mutex.h
index 569b6808..5e5df8f8 100644
--- a/src/utils/mutex.h
+++ b/src/utils/mutex.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index d414d665..04a54149 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 7d8df748..8b8b7bc2 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/strprintf.cpp b/src/utils/strprintf.cpp
index f90e6258..07fb3508 100644
--- a/src/utils/strprintf.cpp
+++ b/src/utils/strprintf.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/strprintf.h b/src/utils/strprintf.h
index 1d33c3f7..78e7a04c 100644
--- a/src/utils/strprintf.h
+++ b/src/utils/strprintf.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 562f69e3..d5dd54be 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +28,7 @@
namespace XML
{
Document::Document(const std::string &filename):
- mDoc(NULL)
+ mDoc(0)
{
int size;
ResourceManager *resman = ResourceManager::getInstance();
@@ -88,7 +87,8 @@ namespace XML
return ret;
}
- std::string getProperty(xmlNodePtr node, const char *name, const std::string &def)
+ std::string getProperty(xmlNodePtr node, const char *name,
+ const std::string &def)
{
xmlChar *prop = xmlGetProp(node, BAD_CAST name);
if (prop) {
@@ -108,4 +108,5 @@ namespace XML
return NULL;
}
-}
+
+} // namespace XML
diff --git a/src/utils/xml.h b/src/utils/xml.h
index b7d67924..76a63ff4 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,10 +22,10 @@
#ifndef XML_H
#define XML_H
-#include <string>
-
#include <libxml/tree.h>
+#include <string>
+
/**
* XML helper functions.
*/
@@ -82,7 +81,8 @@ namespace XML
/**
* Gets a string property from an xmlNodePtr.
*/
- std::string getProperty(xmlNodePtr node, const char *name, const std::string &def);
+ std::string getProperty(xmlNodePtr node, const char *name,
+ const std::string &def);
/**
* Finds the first child node with the given name
diff --git a/src/vector.cpp b/src/vector.cpp
index bbfb1a70..9b573e88 100644
--- a/src/vector.cpp
+++ b/src/vector.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/vector.h b/src/vector.h
index 48933155..6dd461ac 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2007 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/winver.h b/src/winver.h
index a10e2e76..4996bdfb 100644
--- a/src/winver.h
+++ b/src/winver.h
@@ -1,6 +1,6 @@
-/* VERSION DEFINITIONS */
-#define VER_MAJOR 0
-#define VER_MINOR 0
-#define VER_RELEASE 29
-#define VER_BUILD 0
+/* VERSION DEFINITIONS */
+#define VER_MAJOR 0
+#define VER_MINOR 0
+#define VER_RELEASE 29
+#define VER_BUILD 0
#define PACKAGE_VERSION "0.0.29"