summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLloyd Bryant <lloyd_bryant@netzero.net>2008-07-18 00:48:14 +0000
committerLloyd Bryant <lloyd_bryant@netzero.net>2008-07-18 00:48:14 +0000
commit159285c5aa24611ceee7e3847a87bf9ea5f7fb7a (patch)
treefa48eb8bb8ed1e62ede1e7a2f95632c2243facab /src
parent4dbc9b7af344d3ff006a40e3e0c06ce160f365f9 (diff)
downloadmana-159285c5aa24611ceee7e3847a87bf9ea5f7fb7a.tar.gz
mana-159285c5aa24611ceee7e3847a87bf9ea5f7fb7a.tar.bz2
mana-159285c5aa24611ceee7e3847a87bf9ea5f7fb7a.tar.xz
mana-159285c5aa24611ceee7e3847a87bf9ea5f7fb7a.zip
Import of client tree
Diffstat (limited to 'src')
-rw-r--r--src/.deps/tmw-action.Po1
-rw-r--r--src/.deps/tmw-ambientoverlay.Po1
-rw-r--r--src/.deps/tmw-animatedsprite.Po1
-rw-r--r--src/.deps/tmw-animation.Po1
-rw-r--r--src/.deps/tmw-animationparticle.Po1
-rw-r--r--src/.deps/tmw-base64.Po1
-rw-r--r--src/.deps/tmw-being.Po1
-rw-r--r--src/.deps/tmw-beinghandler.Po1
-rw-r--r--src/.deps/tmw-beingmanager.Po1
-rw-r--r--src/.deps/tmw-box.Po1
-rw-r--r--src/.deps/tmw-browserbox.Po1
-rw-r--r--src/.deps/tmw-buddylist.Po1
-rw-r--r--src/.deps/tmw-buddywindow.Po1
-rw-r--r--src/.deps/tmw-button.Po1
-rw-r--r--src/.deps/tmw-buy.Po1
-rw-r--r--src/.deps/tmw-buysell.Po1
-rw-r--r--src/.deps/tmw-buysellhandler.Po1
-rw-r--r--src/.deps/tmw-char_select.Po1
-rw-r--r--src/.deps/tmw-char_server.Po1
-rw-r--r--src/.deps/tmw-chargedialog.Po1
-rw-r--r--src/.deps/tmw-charserverhandler.Po1
-rw-r--r--src/.deps/tmw-chat.Po1
-rw-r--r--src/.deps/tmw-chathandler.Po1
-rw-r--r--src/.deps/tmw-chatinput.Po1
-rw-r--r--src/.deps/tmw-checkbox.Po1
-rw-r--r--src/.deps/tmw-configuration.Po1
-rw-r--r--src/.deps/tmw-confirm_dialog.Po1
-rw-r--r--src/.deps/tmw-connection.Po1
-rw-r--r--src/.deps/tmw-debugwindow.Po1
-rw-r--r--src/.deps/tmw-dropdown.Po1
-rw-r--r--src/.deps/tmw-dye.Po1
-rw-r--r--src/.deps/tmw-engine.Po1
-rw-r--r--src/.deps/tmw-equipment.Po1
-rw-r--r--src/.deps/tmw-equipmenthandler.Po1
-rw-r--r--src/.deps/tmw-equipmentwindow.Po1
-rw-r--r--src/.deps/tmw-floor_item.Po1
-rw-r--r--src/.deps/tmw-flooritemmanager.Po1
-rw-r--r--src/.deps/tmw-focushandler.Po1
-rw-r--r--src/.deps/tmw-game.Po1
-rw-r--r--src/.deps/tmw-gccontainer.Po1
-rw-r--r--src/.deps/tmw-graphics.Po1
-rw-r--r--src/.deps/tmw-gui.Po1
-rw-r--r--src/.deps/tmw-hbox.Po1
-rw-r--r--src/.deps/tmw-help.Po1
-rw-r--r--src/.deps/tmw-image.Po1
-rw-r--r--src/.deps/tmw-imageloader.Po1
-rw-r--r--src/.deps/tmw-imageparticle.Po1
-rw-r--r--src/.deps/tmw-imageset.Po1
-rw-r--r--src/.deps/tmw-imagewriter.Po1
-rw-r--r--src/.deps/tmw-inttextbox.Po1
-rw-r--r--src/.deps/tmw-inventory.Po1
-rw-r--r--src/.deps/tmw-inventoryhandler.Po1
-rw-r--r--src/.deps/tmw-inventorywindow.Po1
-rw-r--r--src/.deps/tmw-item.Po1
-rw-r--r--src/.deps/tmw-item_amount.Po1
-rw-r--r--src/.deps/tmw-itemcontainer.Po1
-rw-r--r--src/.deps/tmw-itemdb.Po1
-rw-r--r--src/.deps/tmw-itemhandler.Po1
-rw-r--r--src/.deps/tmw-iteminfo.Po1
-rw-r--r--src/.deps/tmw-itemshortcut.Po1
-rw-r--r--src/.deps/tmw-itemshortcutcontainer.Po1
-rw-r--r--src/.deps/tmw-itemshortcutwindow.Po1
-rw-r--r--src/.deps/tmw-joystick.Po1
-rw-r--r--src/.deps/tmw-keyboardconfig.Po1
-rw-r--r--src/.deps/tmw-listbox.Po1
-rw-r--r--src/.deps/tmw-localplayer.Po1
-rw-r--r--src/.deps/tmw-log.Po1
-rw-r--r--src/.deps/tmw-login.Po1
-rw-r--r--src/.deps/tmw-loginhandler.Po1
-rw-r--r--src/.deps/tmw-main.Po1
-rw-r--r--src/.deps/tmw-map.Po1
-rw-r--r--src/.deps/tmw-maploginhandler.Po1
-rw-r--r--src/.deps/tmw-mapreader.Po1
-rw-r--r--src/.deps/tmw-menuwindow.Po1
-rw-r--r--src/.deps/tmw-messagehandler.Po1
-rw-r--r--src/.deps/tmw-messagein.Po1
-rw-r--r--src/.deps/tmw-messageout.Po1
-rw-r--r--src/.deps/tmw-minimap.Po1
-rw-r--r--src/.deps/tmw-ministatus.Po1
-rw-r--r--src/.deps/tmw-monster.Po1
-rw-r--r--src/.deps/tmw-monsterdb.Po1
-rw-r--r--src/.deps/tmw-monsterinfo.Po1
-rw-r--r--src/.deps/tmw-music.Po1
-rw-r--r--src/.deps/tmw-network.Po1
-rw-r--r--src/.deps/tmw-newskill.Po1
-rw-r--r--src/.deps/tmw-npc.Po1
-rw-r--r--src/.deps/tmw-npc_text.Po1
-rw-r--r--src/.deps/tmw-npcdb.Po1
-rw-r--r--src/.deps/tmw-npchandler.Po1
-rw-r--r--src/.deps/tmw-npclistdialog.Po1
-rw-r--r--src/.deps/tmw-ok_dialog.Po1
-rw-r--r--src/.deps/tmw-openglgraphics.Po1
-rw-r--r--src/.deps/tmw-particle.Po1
-rw-r--r--src/.deps/tmw-particleemitter.Po1
-rw-r--r--src/.deps/tmw-passwordfield.Po1
-rw-r--r--src/.deps/tmw-player.Po1
-rw-r--r--src/.deps/tmw-player_relations.Po1
-rw-r--r--src/.deps/tmw-playerbox.Po1
-rw-r--r--src/.deps/tmw-playerhandler.Po1
-rw-r--r--src/.deps/tmw-popupmenu.Po1
-rw-r--r--src/.deps/tmw-progressbar.Po1
-rw-r--r--src/.deps/tmw-protocol.Po1
-rw-r--r--src/.deps/tmw-radiobutton.Po1
-rw-r--r--src/.deps/tmw-register.Po1
-rw-r--r--src/.deps/tmw-resizegrip.Po1
-rw-r--r--src/.deps/tmw-resource.Po1
-rw-r--r--src/.deps/tmw-resourcemanager.Po1
-rw-r--r--src/.deps/tmw-scrollarea.Po1
-rw-r--r--src/.deps/tmw-sell.Po1
-rw-r--r--src/.deps/tmw-setup.Po1
-rw-r--r--src/.deps/tmw-setup_audio.Po1
-rw-r--r--src/.deps/tmw-setup_joystick.Po1
-rw-r--r--src/.deps/tmw-setup_keyboard.Po1
-rw-r--r--src/.deps/tmw-setup_players.Po1
-rw-r--r--src/.deps/tmw-setup_video.Po1
-rw-r--r--src/.deps/tmw-shop.Po1
-rw-r--r--src/.deps/tmw-shoplistbox.Po1
-rw-r--r--src/.deps/tmw-simpleanimation.Po1
-rw-r--r--src/.deps/tmw-skill.Po1
-rw-r--r--src/.deps/tmw-skillhandler.Po1
-rw-r--r--src/.deps/tmw-slider.Po1
-rw-r--r--src/.deps/tmw-sound.Po1
-rw-r--r--src/.deps/tmw-soundeffect.Po1
-rw-r--r--src/.deps/tmw-spritedef.Po1
-rw-r--r--src/.deps/tmw-status.Po1
-rw-r--r--src/.deps/tmw-strprintf.Po1
-rw-r--r--src/.deps/tmw-tabbedcontainer.Po1
-rw-r--r--src/.deps/tmw-table.Po1
-rw-r--r--src/.deps/tmw-table_model.Po1
-rw-r--r--src/.deps/tmw-textbox.Po1
-rw-r--r--src/.deps/tmw-textfield.Po1
-rw-r--r--src/.deps/tmw-textparticle.Po1
-rw-r--r--src/.deps/tmw-trade.Po1
-rw-r--r--src/.deps/tmw-tradehandler.Po1
-rw-r--r--src/.deps/tmw-updatewindow.Po1
-rw-r--r--src/.deps/tmw-vbox.Po1
-rw-r--r--src/.deps/tmw-viewport.Po1
-rw-r--r--src/.deps/tmw-window.Po1
-rw-r--r--src/.deps/tmw-windowcontainer.Po1
-rw-r--r--src/.deps/tmw-xml.Po1
-rw-r--r--src/Makefile.am28
-rw-r--r--src/animatedsprite.cpp2
-rw-r--r--src/animatedsprite.h2
-rw-r--r--src/being.cpp55
-rw-r--r--src/being.h30
-rw-r--r--src/beingmanager.cpp2
-rw-r--r--src/beingmanager.h2
-rw-r--r--src/configlistener.h2
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/configuration.h2
-rw-r--r--src/engine.cpp2
-rw-r--r--src/engine.h2
-rw-r--r--src/equipment.cpp2
-rw-r--r--src/equipment.h2
-rw-r--r--src/floor_item.cpp2
-rw-r--r--src/floor_item.h2
-rw-r--r--src/flooritemmanager.cpp2
-rw-r--r--src/flooritemmanager.h2
-rw-r--r--src/game.cpp936
-rw-r--r--src/game.h50
-rw-r--r--src/graphics.cpp2
-rw-r--r--src/graphics.h2
-rw-r--r--src/gui/box.cpp2
-rw-r--r--src/gui/box.h2
-rw-r--r--src/gui/browserbox.cpp2
-rw-r--r--src/gui/browserbox.h2
-rw-r--r--src/gui/buddywindow.cpp85
-rw-r--r--src/gui/button.cpp2
-rw-r--r--src/gui/button.h2
-rw-r--r--src/gui/buttonbox.cpp47
-rw-r--r--src/gui/buttonbox.h70
-rw-r--r--src/gui/buy.cpp2
-rw-r--r--src/gui/buy.h2
-rw-r--r--src/gui/buysell.cpp2
-rw-r--r--src/gui/buysell.h2
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/char_select.h2
-rw-r--r--src/gui/char_server.cpp7
-rw-r--r--src/gui/char_server.h2
-rw-r--r--src/gui/chat.cpp758
-rw-r--r--src/gui/chat.h270
-rw-r--r--src/gui/chatinput.cpp2
-rw-r--r--src/gui/chatinput.h2
-rw-r--r--src/gui/checkbox.cpp2
-rw-r--r--src/gui/checkbox.h2
-rw-r--r--src/gui/confirm_dialog.cpp2
-rw-r--r--src/gui/confirm_dialog.h2
-rw-r--r--src/gui/connection.cpp2
-rw-r--r--src/gui/connection.h2
-rw-r--r--src/gui/debugwindow.cpp2
-rw-r--r--src/gui/debugwindow.h2
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/equipmentwindow.h2
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/focushandler.h2
-rw-r--r--src/gui/gccontainer.cpp2
-rw-r--r--src/gui/gccontainer.h2
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/gui/hbox.cpp2
-rw-r--r--src/gui/hbox.h2
-rw-r--r--src/gui/help.cpp2
-rw-r--r--src/gui/help.h2
-rw-r--r--src/gui/inttextbox.cpp2
-rw-r--r--src/gui/inttextbox.h2
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/inventorywindow.h2
-rw-r--r--src/gui/item_amount.cpp2
-rw-r--r--src/gui/item_amount.h2
-rw-r--r--src/gui/itemcontainer.cpp2
-rw-r--r--src/gui/itemcontainer.h2
-rw-r--r--src/gui/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/itemshortcutcontainer.h2
-rw-r--r--src/gui/itemshortcutwindow.cpp2
-rw-r--r--src/gui/itemshortcutwindow.h2
-rw-r--r--src/gui/linkhandler.h2
-rw-r--r--src/gui/listbox.cpp2
-rw-r--r--src/gui/listbox.h2
-rw-r--r--src/gui/login.cpp250
-rw-r--r--src/gui/login.h58
-rw-r--r--src/gui/menuwindow.cpp2
-rw-r--r--src/gui/menuwindow.h2
-rw-r--r--src/gui/minimap.cpp2
-rw-r--r--src/gui/minimap.h2
-rw-r--r--src/gui/ministatus.cpp2
-rw-r--r--src/gui/ministatus.h2
-rw-r--r--src/gui/newskill.cpp2
-rw-r--r--src/gui/newskill.h2
-rw-r--r--src/gui/npc_text.cpp2
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/npclistdialog.cpp2
-rw-r--r--src/gui/npclistdialog.h2
-rw-r--r--src/gui/ok_dialog.cpp2
-rw-r--r--src/gui/ok_dialog.h2
-rw-r--r--src/gui/passwordfield.cpp2
-rw-r--r--src/gui/passwordfield.h2
-rw-r--r--src/gui/playerbox.cpp2
-rw-r--r--src/gui/playerbox.h2
-rw-r--r--src/gui/popupmenu.cpp211
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/progressbar.cpp2
-rw-r--r--src/gui/progressbar.h2
-rw-r--r--src/gui/radiobutton.cpp2
-rw-r--r--src/gui/radiobutton.h2
-rw-r--r--src/gui/register.cpp122
-rw-r--r--src/gui/register.h23
-rw-r--r--src/gui/scrollarea.cpp2
-rw-r--r--src/gui/scrollarea.h2
-rw-r--r--src/gui/sell.cpp2
-rw-r--r--src/gui/sell.h2
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/setup.h2
-rw-r--r--src/gui/setup_audio.cpp2
-rw-r--r--src/gui/setup_audio.h2
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/gui/setup_joystick.h2
-rw-r--r--src/gui/setup_keyboard.cpp2
-rw-r--r--src/gui/setup_keyboard.h2
-rw-r--r--src/gui/setup_players.cpp2
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/gui/setup_video.h2
-rw-r--r--src/gui/setuptab.h2
-rw-r--r--src/gui/shop.cpp2
-rw-r--r--src/gui/shop.h2
-rw-r--r--src/gui/skill.cpp2
-rw-r--r--src/gui/skill.h2
-rw-r--r--src/gui/slider.cpp2
-rw-r--r--src/gui/slider.h2
-rw-r--r--src/gui/status.cpp2
-rw-r--r--src/gui/status.h2
-rw-r--r--src/gui/tabbedcontainer.cpp2
-rw-r--r--src/gui/tabbedcontainer.h2
-rw-r--r--src/gui/textbox.cpp2
-rw-r--r--src/gui/textbox.h2
-rw-r--r--src/gui/textfield.cpp2
-rw-r--r--src/gui/textfield.h2
-rw-r--r--src/gui/updatewindow.cpp2
-rw-r--r--src/gui/updatewindow.h2
-rw-r--r--src/gui/vbox.cpp2
-rw-r--r--src/gui/vbox.h2
-rw-r--r--src/gui/viewport.cpp30
-rw-r--r--src/gui/viewport.h2
-rw-r--r--src/gui/widgets/dropdown.cpp169
-rw-r--r--src/gui/widgets/dropdown.h85
-rw-r--r--src/gui/widgets/resizegrip.cpp2
-rw-r--r--src/gui/widgets/resizegrip.h2
-rw-r--r--src/gui/window.cpp2
-rw-r--r--src/gui/window.h2
-rw-r--r--src/gui/windowcontainer.cpp2
-rw-r--r--src/gui/windowcontainer.h2
-rw-r--r--src/guichanfwd.h2
-rw-r--r--src/imageparticle.cpp2
-rw-r--r--src/imageparticle.h2
-rw-r--r--src/inventory.cpp2
-rw-r--r--src/inventory.h2
-rw-r--r--src/item.cpp2
-rw-r--r--src/item.h2
-rw-r--r--src/itemshortcut.cpp2
-rw-r--r--src/itemshortcut.h2
-rw-r--r--src/joystick.cpp2
-rw-r--r--src/joystick.h2
-rw-r--r--src/keyboardconfig.cpp2
-rw-r--r--src/keyboardconfig.h2
-rw-r--r--src/localplayer.cpp30
-rw-r--r--src/localplayer.h13
-rw-r--r--src/lockedarray.h2
-rw-r--r--src/logindata.h3
-rw-r--r--src/main.cpp159
-rw-r--r--src/main.h2
-rw-r--r--src/map.cpp2
-rw-r--r--src/map.h2
-rw-r--r--src/monster.cpp47
-rw-r--r--src/monster.h18
-rw-r--r--src/net/beinghandler.cpp51
-rw-r--r--src/net/beinghandler.h2
-rw-r--r--src/net/buysellhandler.cpp2
-rw-r--r--src/net/buysellhandler.h2
-rw-r--r--src/net/charserverhandler.cpp2
-rw-r--r--src/net/charserverhandler.h2
-rw-r--r--src/net/chathandler.cpp2
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/equipmenthandler.cpp2
-rw-r--r--src/net/equipmenthandler.h2
-rw-r--r--src/net/inventoryhandler.cpp2
-rw-r--r--src/net/inventoryhandler.h2
-rw-r--r--src/net/itemhandler.cpp2
-rw-r--r--src/net/itemhandler.h2
-rw-r--r--src/net/loginhandler.cpp16
-rw-r--r--src/net/loginhandler.h6
-rw-r--r--src/net/maploginhandler.cpp2
-rw-r--r--src/net/maploginhandler.h2
-rw-r--r--src/net/messagehandler.cpp2
-rw-r--r--src/net/messagehandler.h2
-rw-r--r--src/net/messagein.cpp2
-rw-r--r--src/net/messagein.h2
-rw-r--r--src/net/messageout.cpp2
-rw-r--r--src/net/messageout.h2
-rw-r--r--src/net/network.cpp4
-rw-r--r--src/net/network.h2
-rw-r--r--src/net/npchandler.cpp2
-rw-r--r--src/net/npchandler.h2
-rw-r--r--src/net/partyhandler.cpp127
-rw-r--r--src/net/partyhandler.h (renamed from src/gui/buddywindow.h)37
-rw-r--r--src/net/playerhandler.cpp29
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/protocol.cpp2
-rw-r--r--src/net/protocol.h27
-rw-r--r--src/net/skillhandler.cpp2
-rw-r--r--src/net/skillhandler.h2
-rw-r--r--src/net/tradehandler.cpp2
-rw-r--r--src/net/tradehandler.h2
-rw-r--r--src/npc.cpp43
-rw-r--r--src/npc.h13
-rw-r--r--src/openglgraphics.cpp2
-rw-r--r--src/openglgraphics.h2
-rw-r--r--src/particle.cpp2
-rw-r--r--src/particle.h2
-rw-r--r--src/particleemitter.cpp2
-rw-r--r--src/particleemitter.h2
-rw-r--r--src/party.cpp219
-rw-r--r--src/party.h75
-rw-r--r--src/player.cpp67
-rw-r--r--src/player.h43
-rw-r--r--src/player_relations.cpp28
-rw-r--r--src/properties.h2
-rw-r--r--src/recorder.cpp112
-rw-r--r--src/recorder.h50
-rw-r--r--src/resources/action.cpp2
-rw-r--r--src/resources/action.h2
-rw-r--r--src/resources/ambientoverlay.cpp2
-rw-r--r--src/resources/ambientoverlay.h2
-rw-r--r--src/resources/animation.cpp2
-rw-r--r--src/resources/animation.h2
-rw-r--r--src/resources/buddylist.cpp2
-rw-r--r--src/resources/buddylist.h2
-rw-r--r--src/resources/image.cpp2
-rw-r--r--src/resources/image.h2
-rw-r--r--src/resources/imageset.cpp2
-rw-r--r--src/resources/imageset.h2
-rw-r--r--src/resources/imagewriter.cpp2
-rw-r--r--src/resources/imagewriter.h2
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/itemdb.h2
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/iteminfo.h2
-rw-r--r--src/resources/mapreader.cpp2
-rw-r--r--src/resources/mapreader.h2
-rw-r--r--src/resources/monsterdb.cpp2
-rw-r--r--src/resources/monsterdb.h2
-rw-r--r--src/resources/music.cpp2
-rw-r--r--src/resources/music.h2
-rw-r--r--src/resources/npcdb.cpp2
-rw-r--r--src/resources/npcdb.h2
-rw-r--r--src/resources/resource.cpp2
-rw-r--r--src/resources/resource.h2
-rw-r--r--src/resources/resourcemanager.cpp2
-rw-r--r--src/resources/resourcemanager.h2
-rw-r--r--src/resources/soundeffect.cpp2
-rw-r--r--src/resources/soundeffect.h2
-rw-r--r--src/resources/spritedef.cpp2
-rw-r--r--src/resources/spritedef.h2
-rw-r--r--src/serverinfo.h3
-rw-r--r--src/shopitem.cpp2
-rw-r--r--src/shopitem.h2
-rw-r--r--src/simpleanimation.cpp2
-rw-r--r--src/simpleanimation.h2
-rw-r--r--src/sound.cpp2
-rw-r--r--src/sound.h2
-rw-r--r--src/sprite.h2
-rw-r--r--src/text.cpp102
-rw-r--r--src/text.h93
-rw-r--r--src/textmanager.cpp177
-rw-r--r--src/textmanager.h75
-rw-r--r--src/textparticle.cpp2
-rw-r--r--src/textparticle.h2
-rw-r--r--src/tileset.h2
-rw-r--r--src/utils/base64.cpp2
-rw-r--r--src/utils/base64.h2
-rw-r--r--src/utils/dtor.h2
-rw-r--r--src/utils/fastsqrt.h2
-rw-r--r--src/utils/minmax.h2
-rw-r--r--src/utils/tostring.h2
-rw-r--r--src/utils/trim.h2
-rw-r--r--src/utils/xml.cpp2
-rw-r--r--src/utils/xml.h2
-rw-r--r--src/vector.h2
426 files changed, 3931 insertions, 1638 deletions
diff --git a/src/.deps/tmw-action.Po b/src/.deps/tmw-action.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-action.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-ambientoverlay.Po b/src/.deps/tmw-ambientoverlay.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-ambientoverlay.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-animatedsprite.Po b/src/.deps/tmw-animatedsprite.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-animatedsprite.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-animation.Po b/src/.deps/tmw-animation.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-animation.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-animationparticle.Po b/src/.deps/tmw-animationparticle.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-animationparticle.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-base64.Po b/src/.deps/tmw-base64.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-base64.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-being.Po b/src/.deps/tmw-being.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-being.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-beinghandler.Po b/src/.deps/tmw-beinghandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-beinghandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-beingmanager.Po b/src/.deps/tmw-beingmanager.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-beingmanager.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-box.Po b/src/.deps/tmw-box.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-box.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-browserbox.Po b/src/.deps/tmw-browserbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-browserbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-buddylist.Po b/src/.deps/tmw-buddylist.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-buddylist.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-buddywindow.Po b/src/.deps/tmw-buddywindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-buddywindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-button.Po b/src/.deps/tmw-button.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-button.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-buy.Po b/src/.deps/tmw-buy.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-buy.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-buysell.Po b/src/.deps/tmw-buysell.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-buysell.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-buysellhandler.Po b/src/.deps/tmw-buysellhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-buysellhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-char_select.Po b/src/.deps/tmw-char_select.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-char_select.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-char_server.Po b/src/.deps/tmw-char_server.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-char_server.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-chargedialog.Po b/src/.deps/tmw-chargedialog.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-chargedialog.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-charserverhandler.Po b/src/.deps/tmw-charserverhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-charserverhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-chat.Po b/src/.deps/tmw-chat.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-chat.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-chathandler.Po b/src/.deps/tmw-chathandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-chathandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-chatinput.Po b/src/.deps/tmw-chatinput.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-chatinput.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-checkbox.Po b/src/.deps/tmw-checkbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-checkbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-configuration.Po b/src/.deps/tmw-configuration.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-configuration.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-confirm_dialog.Po b/src/.deps/tmw-confirm_dialog.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-confirm_dialog.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-connection.Po b/src/.deps/tmw-connection.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-connection.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-debugwindow.Po b/src/.deps/tmw-debugwindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-debugwindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-dropdown.Po b/src/.deps/tmw-dropdown.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-dropdown.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-dye.Po b/src/.deps/tmw-dye.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-dye.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-engine.Po b/src/.deps/tmw-engine.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-engine.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-equipment.Po b/src/.deps/tmw-equipment.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-equipment.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-equipmenthandler.Po b/src/.deps/tmw-equipmenthandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-equipmenthandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-equipmentwindow.Po b/src/.deps/tmw-equipmentwindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-equipmentwindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-floor_item.Po b/src/.deps/tmw-floor_item.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-floor_item.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-flooritemmanager.Po b/src/.deps/tmw-flooritemmanager.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-flooritemmanager.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-focushandler.Po b/src/.deps/tmw-focushandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-focushandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-game.Po b/src/.deps/tmw-game.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-game.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-gccontainer.Po b/src/.deps/tmw-gccontainer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-gccontainer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-graphics.Po b/src/.deps/tmw-graphics.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-graphics.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-gui.Po b/src/.deps/tmw-gui.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-gui.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-hbox.Po b/src/.deps/tmw-hbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-hbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-help.Po b/src/.deps/tmw-help.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-help.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-image.Po b/src/.deps/tmw-image.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-image.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-imageloader.Po b/src/.deps/tmw-imageloader.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-imageloader.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-imageparticle.Po b/src/.deps/tmw-imageparticle.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-imageparticle.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-imageset.Po b/src/.deps/tmw-imageset.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-imageset.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-imagewriter.Po b/src/.deps/tmw-imagewriter.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-imagewriter.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-inttextbox.Po b/src/.deps/tmw-inttextbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-inttextbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-inventory.Po b/src/.deps/tmw-inventory.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-inventory.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-inventoryhandler.Po b/src/.deps/tmw-inventoryhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-inventoryhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-inventorywindow.Po b/src/.deps/tmw-inventorywindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-inventorywindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-item.Po b/src/.deps/tmw-item.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-item.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-item_amount.Po b/src/.deps/tmw-item_amount.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-item_amount.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemcontainer.Po b/src/.deps/tmw-itemcontainer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemcontainer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemdb.Po b/src/.deps/tmw-itemdb.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemdb.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemhandler.Po b/src/.deps/tmw-itemhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-iteminfo.Po b/src/.deps/tmw-iteminfo.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-iteminfo.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemshortcut.Po b/src/.deps/tmw-itemshortcut.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemshortcut.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemshortcutcontainer.Po b/src/.deps/tmw-itemshortcutcontainer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemshortcutcontainer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-itemshortcutwindow.Po b/src/.deps/tmw-itemshortcutwindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-itemshortcutwindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-joystick.Po b/src/.deps/tmw-joystick.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-joystick.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-keyboardconfig.Po b/src/.deps/tmw-keyboardconfig.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-keyboardconfig.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-listbox.Po b/src/.deps/tmw-listbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-listbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-localplayer.Po b/src/.deps/tmw-localplayer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-localplayer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-log.Po b/src/.deps/tmw-log.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-log.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-login.Po b/src/.deps/tmw-login.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-login.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-loginhandler.Po b/src/.deps/tmw-loginhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-loginhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-main.Po b/src/.deps/tmw-main.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-main.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-map.Po b/src/.deps/tmw-map.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-map.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-maploginhandler.Po b/src/.deps/tmw-maploginhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-maploginhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-mapreader.Po b/src/.deps/tmw-mapreader.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-mapreader.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-menuwindow.Po b/src/.deps/tmw-menuwindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-menuwindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-messagehandler.Po b/src/.deps/tmw-messagehandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-messagehandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-messagein.Po b/src/.deps/tmw-messagein.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-messagein.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-messageout.Po b/src/.deps/tmw-messageout.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-messageout.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-minimap.Po b/src/.deps/tmw-minimap.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-minimap.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-ministatus.Po b/src/.deps/tmw-ministatus.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-ministatus.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-monster.Po b/src/.deps/tmw-monster.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-monster.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-monsterdb.Po b/src/.deps/tmw-monsterdb.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-monsterdb.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-monsterinfo.Po b/src/.deps/tmw-monsterinfo.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-monsterinfo.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-music.Po b/src/.deps/tmw-music.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-music.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-network.Po b/src/.deps/tmw-network.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-network.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-newskill.Po b/src/.deps/tmw-newskill.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-newskill.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-npc.Po b/src/.deps/tmw-npc.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-npc.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-npc_text.Po b/src/.deps/tmw-npc_text.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-npc_text.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-npcdb.Po b/src/.deps/tmw-npcdb.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-npcdb.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-npchandler.Po b/src/.deps/tmw-npchandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-npchandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-npclistdialog.Po b/src/.deps/tmw-npclistdialog.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-npclistdialog.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-ok_dialog.Po b/src/.deps/tmw-ok_dialog.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-ok_dialog.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-openglgraphics.Po b/src/.deps/tmw-openglgraphics.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-openglgraphics.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-particle.Po b/src/.deps/tmw-particle.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-particle.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-particleemitter.Po b/src/.deps/tmw-particleemitter.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-particleemitter.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-passwordfield.Po b/src/.deps/tmw-passwordfield.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-passwordfield.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-player.Po b/src/.deps/tmw-player.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-player.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-player_relations.Po b/src/.deps/tmw-player_relations.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-player_relations.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-playerbox.Po b/src/.deps/tmw-playerbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-playerbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-playerhandler.Po b/src/.deps/tmw-playerhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-playerhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-popupmenu.Po b/src/.deps/tmw-popupmenu.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-popupmenu.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-progressbar.Po b/src/.deps/tmw-progressbar.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-progressbar.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-protocol.Po b/src/.deps/tmw-protocol.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-protocol.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-radiobutton.Po b/src/.deps/tmw-radiobutton.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-radiobutton.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-register.Po b/src/.deps/tmw-register.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-register.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-resizegrip.Po b/src/.deps/tmw-resizegrip.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-resizegrip.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-resource.Po b/src/.deps/tmw-resource.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-resource.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-resourcemanager.Po b/src/.deps/tmw-resourcemanager.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-resourcemanager.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-scrollarea.Po b/src/.deps/tmw-scrollarea.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-scrollarea.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-sell.Po b/src/.deps/tmw-sell.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-sell.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup.Po b/src/.deps/tmw-setup.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup_audio.Po b/src/.deps/tmw-setup_audio.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup_audio.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup_joystick.Po b/src/.deps/tmw-setup_joystick.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup_joystick.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup_keyboard.Po b/src/.deps/tmw-setup_keyboard.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup_keyboard.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup_players.Po b/src/.deps/tmw-setup_players.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup_players.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-setup_video.Po b/src/.deps/tmw-setup_video.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-setup_video.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-shop.Po b/src/.deps/tmw-shop.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-shop.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-shoplistbox.Po b/src/.deps/tmw-shoplistbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-shoplistbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-simpleanimation.Po b/src/.deps/tmw-simpleanimation.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-simpleanimation.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-skill.Po b/src/.deps/tmw-skill.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-skill.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-skillhandler.Po b/src/.deps/tmw-skillhandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-skillhandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-slider.Po b/src/.deps/tmw-slider.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-slider.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-sound.Po b/src/.deps/tmw-sound.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-sound.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-soundeffect.Po b/src/.deps/tmw-soundeffect.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-soundeffect.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-spritedef.Po b/src/.deps/tmw-spritedef.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-spritedef.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-status.Po b/src/.deps/tmw-status.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-status.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-strprintf.Po b/src/.deps/tmw-strprintf.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-strprintf.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-tabbedcontainer.Po b/src/.deps/tmw-tabbedcontainer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-tabbedcontainer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-table.Po b/src/.deps/tmw-table.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-table.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-table_model.Po b/src/.deps/tmw-table_model.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-table_model.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-textbox.Po b/src/.deps/tmw-textbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-textbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-textfield.Po b/src/.deps/tmw-textfield.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-textfield.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-textparticle.Po b/src/.deps/tmw-textparticle.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-textparticle.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-trade.Po b/src/.deps/tmw-trade.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-trade.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-tradehandler.Po b/src/.deps/tmw-tradehandler.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-tradehandler.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-updatewindow.Po b/src/.deps/tmw-updatewindow.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-updatewindow.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-vbox.Po b/src/.deps/tmw-vbox.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-vbox.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-viewport.Po b/src/.deps/tmw-viewport.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-viewport.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-window.Po b/src/.deps/tmw-window.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-window.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-windowcontainer.Po b/src/.deps/tmw-windowcontainer.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-windowcontainer.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/.deps/tmw-xml.Po b/src/.deps/tmw-xml.Po
new file mode 100644
index 00000000..9ce06a81
--- /dev/null
+++ b/src/.deps/tmw-xml.Po
@@ -0,0 +1 @@
+# dummy
diff --git a/src/Makefile.am b/src/Makefile.am
index 3156a800..f1352f9e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,14 +1,16 @@
-bin_PROGRAMS = tmw
-tmw_SOURCES = gui/widgets/resizegrip.cpp \
+bin_PROGRAMS = tme
+tme_SOURCES = gui/widgets/dropdown.cpp \
+ gui/widgets/dropdown.h \
+ gui/widgets/resizegrip.cpp \
gui/widgets/resizegrip.h \
gui/box.h \
gui/box.cpp \
gui/browserbox.cpp \
gui/browserbox.h \
- gui/buddywindow.cpp \
- gui/buddywindow.h \
gui/button.cpp \
gui/button.h \
+ gui/buttonbox.cpp \
+ gui/buttonbox.h \
gui/buy.cpp \
gui/buy.h \
gui/buysell.cpp \
@@ -163,6 +165,8 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \
net/network.h \
net/npchandler.cpp \
net/npchandler.h \
+ net/partyhandler.cpp \
+ net/partyhandler.h \
net/playerhandler.cpp \
net/playerhandler.h \
net/protocol.cpp \
@@ -278,11 +282,15 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \
particle.h \
particleemitter.cpp \
particleemitter.h \
+ party.cpp \
+ party.h \
player.cpp \
player.h \
player_relations.cpp \
player_relations.h \
properties.h \
+ recorder.cpp \
+ recorder.h \
serverinfo.h \
shopitem.cpp \
shopitem.h \
@@ -291,6 +299,10 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \
sound.cpp \
sound.h \
sprite.h \
+ text.cpp \
+ text.h \
+ textmanager.cpp \
+ textmanager.h \
textparticle.cpp \
textparticle.h \
tileset.h \
@@ -302,7 +314,7 @@ INCLUDES = \
-DTMW_DATADIR=\""$(pkgdatadir)/"\"
# the library search path.
-tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0`
-tmw_CXXFLAGS = -Wall $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` $(CURL_CFLAGS)
-tmw_LDADD = $(LIBSDL_LIBS) -lguichan_sdl $(CURL_LIBS)
-tmw_TARGET = tmw
+tme_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0`
+tme_CXXFLAGS = -Wall $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` $(CURL_CFLAGS)
+tme_LDADD = $(LIBSDL_LIBS) -lguichan_sdl $(CURL_LIBS)
+tme_TARGET = tme
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 466779fd..dd43e0f1 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: animatedsprite.cpp 3752 2007-11-20 10:50:00Z b_lindeijer $
*/
#include "animatedsprite.h"
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index a1fbe7a0..1fac5220 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: animatedsprite.h 3752 2007-11-20 10:50:00Z b_lindeijer $
*/
#ifndef _TMW_ANIMATEDSPRITE_H
diff --git a/src/being.cpp b/src/being.cpp
index 625b0eef..14f7ce20 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: being.cpp 4301 2008-05-28 16:06:48Z peaveydk $
*/
#include "being.h"
@@ -32,6 +32,7 @@
#include "log.h"
#include "map.h"
#include "particle.h"
+#include "text.h"
#include "resources/resourcemanager.h"
#include "resources/imageset.h"
@@ -45,6 +46,9 @@
int Being::instances = 0;
ImageSet *Being::emotionSet = NULL;
+static const int X_SPEECH_OFFSET = 18;
+static const int Y_SPEECH_OFFSET = 60;
+
Being::Being(int id, int job, Map *map):
mJob(job),
mX(0), mY(0),
@@ -77,6 +81,7 @@ Being::Being(int id, int job, Map *map):
}
instances++;
+ mSpeech = 0;
}
Being::~Being()
@@ -100,6 +105,10 @@ Being::~Being()
emotionSet->decRef();
emotionSet = NULL;
}
+ if (mSpeech)
+ {
+ delete mSpeech;
+ }
}
void
@@ -147,7 +156,13 @@ Being::setSprite(int slot, int id, std::string color)
void
Being::setSpeech(const std::string &text, Uint32 time)
{
- mSpeech = text;
+ if (mSpeech) // don't introduce a memory leak
+ {
+ delete mSpeech;
+ }
+ mSpeech = new Text(text, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
+ gcn::Graphics::CENTER, speechFont,
+ gcn::Color(255, 255, 255));
mSpeechTime = 500;
}
@@ -355,13 +370,28 @@ void
Being::logic()
{
// Reduce the time that speech is still displayed
- if (mSpeechTime > 0)
- mSpeechTime--;
+ if (mSpeechTime > 0 && mSpeech)
+ {
+ if (--mSpeechTime == 0)
+ {
+ delete mSpeech;
+ mSpeech = 0;
+ }
+ }
+ int oldPx = mPx;
+ int oldPy = mPy;
// Update pixel coordinates
mPx = mX * 32 + getXOffset();
mPy = mY * 32 + getYOffset();
-
+ if (mPx != oldPx || mPy != oldPy)
+ {
+ if (mSpeech)
+ {
+ mSpeech->adviseXY(mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET);
+ }
+ updateCoords();
+ }
if (mEmotion != 0)
{
mEmotionTime--;
@@ -426,21 +456,6 @@ Being::drawEmotion(Graphics *graphics, int offsetX, int offsetY)
graphics->drawImage(emotionSet->get(emotionIndex), px, py);
}
-void
-Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY)
-{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
-
- // Draw speech above this being
- if (mSpeechTime > 0)
- {
- graphics->setFont(speechFont);
- graphics->setColor(gcn::Color(255, 255, 255));
- graphics->drawText(mSpeech, px + 18, py - 60, gcn::Graphics::CENTER);
- }
-}
-
Being::Type
Being::getType() const
{
diff --git a/src/being.h b/src/being.h
index 5ea8c0be..2f711fb8 100644
--- a/src/being.h
+++ b/src/being.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: being.h 4321 2008-06-02 11:42:26Z b_lindeijer $
*/
#ifndef _TMW_BEING_H
@@ -47,6 +47,7 @@ class Map;
class Graphics;
class ImageSet;
class Particle;
+class Text;
/**
* A position along a being's path.
@@ -183,7 +184,7 @@ class Being : public Sprite
*
* @param name The name that should appear.
*/
- void
+ virtual void
setName(const std::string &name) { mName = name; }
/**
@@ -235,24 +236,12 @@ class Being : public Sprite
logic();
/**
- * Draws the speech text above the being.
- */
- void
- drawSpeech(Graphics *graphics, int offsetX, int offsetY);
-
- /**
* Draws the emotion picture above the being.
*/
void
drawEmotion(Graphics *graphics, int offsetX, int offsetY);
/**
- * Draws the name text below the being.
- */
- virtual void
- drawName(Graphics *, int, int) {};
-
- /**
* Returns the type of the being.
*/
virtual Type getType() const;
@@ -359,7 +348,11 @@ class Being : public Sprite
*/
void controlParticle(Particle *particle);
- void setEmote(Uint8 emotion, Uint8 emote_time) { mEmotion = emotion; mEmotionTime = emote_time; }
+ void setEmote(Uint8 emotion, Uint8 emote_time)
+ {
+ mEmotion = emotion;
+ mEmotionTime = emote_time;
+ }
const std::auto_ptr<Equipment> mEquipment;
@@ -370,6 +363,11 @@ class Being : public Sprite
void setPath(const Path &path);
/**
+ * Let the sub-classes react to a replacement
+ */
+ virtual void updateCoords() {}
+
+ /**
* Returns the sprite direction of this being.
*/
SpriteDirection getSpriteDirection() const;
@@ -385,7 +383,7 @@ class Being : public Sprite
const ItemInfo* mEquippedWeapon;
Path mPath;
- std::string mSpeech;
+ Text *mSpeech;
Uint16 mHairStyle, mHairColor;
Uint8 mGender;
Uint32 mSpeechTime;
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp
index b683b1bd..d1a333d0 100644
--- a/src/beingmanager.cpp
+++ b/src/beingmanager.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: beingmanager.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/beingmanager.h b/src/beingmanager.h
index 243486e4..ff2d1980 100644
--- a/src/beingmanager.h
+++ b/src/beingmanager.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: beingmanager.h 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#ifndef _TMW_BEINGMANAGER_H
diff --git a/src/configlistener.h b/src/configlistener.h
index 7ce5d949..bf00f3ef 100644
--- a/src/configlistener.h
+++ b/src/configlistener.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: configlistener.h 1673 2005-08-29 22:00:35Z der_doener $
*/
#ifndef _TMW_CONFIGLISTENER_H
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 7e8cb542..e9c8db7a 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: configuration.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
diff --git a/src/configuration.h b/src/configuration.h
index 36d9e150..7dadb083 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: configuration.h 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#ifndef _TMW_CONFIGURATION_H
diff --git a/src/engine.cpp b/src/engine.cpp
index d4033193..d1912b0d 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: engine.cpp 4000 2008-03-23 11:47:52Z b_lindeijer $
*/
#include "engine.h"
diff --git a/src/engine.h b/src/engine.h
index 4575051e..ed76a595 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: engine.h 4000 2008-03-23 11:47:52Z b_lindeijer $
*/
#ifndef _ENGINE_H
diff --git a/src/equipment.cpp b/src/equipment.cpp
index d1f9a6cf..0a285447 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipment.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "equipment.h"
diff --git a/src/equipment.h b/src/equipment.h
index 80a2ae49..04017549 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipment.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_EQUIPMENT_H_
diff --git a/src/floor_item.cpp b/src/floor_item.cpp
index 9727093f..399a4149 100644
--- a/src/floor_item.cpp
+++ b/src/floor_item.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: floor_item.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "floor_item.h"
diff --git a/src/floor_item.h b/src/floor_item.h
index a87e3f79..7771d935 100644
--- a/src/floor_item.h
+++ b/src/floor_item.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: floor_item.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_FLOORITEM_H_
diff --git a/src/flooritemmanager.cpp b/src/flooritemmanager.cpp
index 8a00cc51..f6ad3442 100644
--- a/src/flooritemmanager.cpp
+++ b/src/flooritemmanager.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: flooritemmanager.cpp 3754 2007-11-20 15:19:50Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/flooritemmanager.h b/src/flooritemmanager.h
index c12883a4..a6bfbdc3 100644
--- a/src/flooritemmanager.h
+++ b/src/flooritemmanager.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: flooritemmanager.h 2150 2006-02-06 02:56:48Z der_doener $
*/
#ifndef _TMW_FLOORITEMMANAGER_H
diff --git a/src/game.cpp b/src/game.cpp
index 58c28640..d018852b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: game.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#include "game.h"
@@ -68,7 +68,6 @@
#include "gui/status.h"
#include "gui/trade.h"
#include "gui/viewport.h"
-
#include "net/beinghandler.h"
#include "net/buysellhandler.h"
#include "net/chathandler.h"
@@ -135,14 +134,14 @@ const int MAX_TIME = 10000;
namespace {
struct ExitListener : public gcn::ActionListener
{
- void action(const gcn::ActionEvent &event)
- {
- if (event.getId() == "yes" || event.getId() == "ok") {
- done = true;
- }
- exitConfirm = NULL;
- disconnectedDialog = NULL;
- }
+ void action(const gcn::ActionEvent &event)
+ {
+ if (event.getId() == "yes" || event.getId() == "ok") {
+ done = true;
+ }
+ exitConfirm = NULL;
+ disconnectedDialog = NULL;
+ }
} exitListener;
}
@@ -169,10 +168,10 @@ Uint32 nextSecond(Uint32 interval, void *param)
int get_elapsed_time(int start_time)
{
if (start_time <= tick_time) {
- return (tick_time - start_time) * 10;
+ return (tick_time - start_time) * 10;
}
else {
- return (tick_time + (MAX_TIME - start_time)) * 10;
+ return (tick_time + (MAX_TIME - start_time)) * 10;
}
}
@@ -219,7 +218,7 @@ void createGuiWindows(Network *network)
if (config.getValue("logToChat", 0))
{
- logger->setChatWindow(chatWindow);
+ logger->setChatWindow(chatWindow);
}
}
@@ -291,7 +290,7 @@ Game::Game(Network *network):
// Open the first device
if (Joystick::getNumberOfJoysticks() > 0)
{
- joystick = new Joystick(0);
+ joystick = new Joystick(0);
}
network->registerHandler(mBeingHandler.get());
@@ -332,30 +331,30 @@ bool saveScreenshot(SDL_Surface *screenshot)
bool found = false;
do {
- screenshotCount++;
- filename.str("");
+ screenshotCount++;
+ filename.str("");
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filename << PHYSFS_getUserDir() << ".tmw/";
+ filename << PHYSFS_getUserDir() << ".tme/";
#elif defined __APPLE__
- filename << PHYSFS_getUserDir() << "Desktop/";
+ filename << PHYSFS_getUserDir() << "Desktop/";
#endif
- filename << "TMW_Screenshot_" << screenshotCount << ".png";
- testExists.open(filename.str().c_str(), std::ios::in);
- found = !testExists.is_open();
- testExists.close();
+ filename << "TMW_Screenshot_" << screenshotCount << ".png";
+ testExists.open(filename.str().c_str(), std::ios::in);
+ found = !testExists.is_open();
+ testExists.close();
} while (!found);
if (ImageWriter::writePNG(screenshot, filename.str()))
{
- std::stringstream chatlogentry;
- chatlogentry << "Screenshot saved to " << filename.str().c_str();
- chatWindow->chatLog(chatlogentry.str(), BY_SERVER);
- return true;
+ std::stringstream chatlogentry;
+ chatlogentry << "Screenshot saved to " << filename.str().c_str();
+ chatWindow->chatLog(chatlogentry.str(), BY_SERVER);
+ return true;
}
else
{
- chatWindow->chatLog("Saving screenshot failed!", BY_SERVER);
- return false;
+ chatWindow->chatLog("Saving screenshot failed!", BY_SERVER);
+ return false;
}
}
@@ -379,60 +378,61 @@ void Game::logic()
while (!done)
{
- // Handle all necessary game logic
- while (get_elapsed_time(gameTime) > 0)
- {
- handleInput();
- engine->logic();
- gameTime++;
- }
-
- // This is done because at some point tick_time will wrap.
- gameTime = tick_time;
-
- // Update the screen when application is active, delay otherwise.
- if (SDL_GetAppState() & SDL_APPACTIVE)
- {
- // Draw a frame if either frames are not limited or enough time has
- // passed since the last frame.
- if (!mMinFrameTime ||
- get_elapsed_time(mDrawTime / 10) > mMinFrameTime)
- {
- frame++;
- gui->draw();
- graphics->updateScreen();
- mDrawTime += mMinFrameTime;
-
- // Make sure to wrap mDrawTime, since tick_time will wrap.
- if (mDrawTime > MAX_TIME * 10)
- mDrawTime -= MAX_TIME * 10;
- }
- else
- {
- SDL_Delay(10);
- }
- }
- else
- {
- SDL_Delay(10);
- mDrawTime = tick_time * 10;
- }
-
- // Handle network stuff
- mNetwork->flush();
- mNetwork->dispatchMessages();
-
- if (!mNetwork->isConnected())
- {
- if (!disconnectedDialog)
- {
- disconnectedDialog = new
- OkDialog("Network Error",
- "The connection to the server was lost, the program will now quit");
- disconnectedDialog->addActionListener(&exitListener);
- disconnectedDialog->requestMoveToTop();
- }
- }
+ // Handle all necessary game logic
+ while (get_elapsed_time(gameTime) > 0)
+ {
+ handleInput();
+ engine->logic();
+ gameTime++;
+ }
+
+ // This is done because at some point tick_time will wrap.
+ gameTime = tick_time;
+
+ // Update the screen when application is active, delay otherwise.
+ if (SDL_GetAppState() & SDL_APPACTIVE)
+ {
+ // Draw a frame if either frames are not limited or enough time has
+ // passed since the last frame.
+ if (!mMinFrameTime ||
+ get_elapsed_time(mDrawTime / 10) > mMinFrameTime)
+ {
+ frame++;
+ gui->draw();
+ graphics->updateScreen();
+ mDrawTime += mMinFrameTime;
+
+ // Make sure to wrap mDrawTime, since tick_time will wrap.
+ if (mDrawTime > MAX_TIME * 10)
+ mDrawTime -= MAX_TIME * 10;
+ }
+ else
+ {
+ SDL_Delay(10);
+ }
+ }
+ else
+ {
+ SDL_Delay(10);
+ mDrawTime = tick_time * 10;
+ }
+
+ // Handle network stuff
+ mNetwork->flush();
+ mNetwork->dispatchMessages();
+
+ if (!mNetwork->isConnected())
+ {
+ if (!disconnectedDialog)
+ {
+ disconnectedDialog = new
+ OkDialog("Network Error",
+ "The connection to the server was lost, the "
+ "program will now quit");
+ disconnectedDialog->addActionListener(&exitListener);
+ disconnectedDialog->requestMoveToTop();
+ }
+ }
}
}
@@ -440,289 +440,296 @@ void Game::handleInput()
{
if (joystick != NULL)
{
- joystick->update();
+ joystick->update();
}
// Events
SDL_Event event;
while (SDL_PollEvent(&event))
{
- bool used = false;
-
- // Keyboard events (for discontinuous keys)
- if (event.type == SDL_KEYDOWN)
- {
- gcn::Window *requestedWindow = NULL;
-
- if (setupWindow->isVisible() &&
- keyboard.getNewKeyIndex() > keyboard.KEY_NO_VALUE)
- {
- keyboard.setNewKey((int) event.key.keysym.sym);
- keyboard.callbackNewKey();
- keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE);
- return;
- }
- // Keys pressed together with Alt/Meta
- // Emotions and some internal gui windows
- #ifndef __APPLE__
- if (event.key.keysym.mod & KMOD_ALT)
- #else
- if (event.key.keysym.mod & KMOD_LMETA)
- #endif
- {
- switch (event.key.keysym.sym)
- {
- case SDLK_p:
- // Screenshot (picture, hence the p)
- {
- SDL_Surface *screenshot = graphics->getScreenshot();
- if (!saveScreenshot(screenshot))
- {
- logger->log("Error: could not save Screenshot.");
- }
- SDL_FreeSurface(screenshot);
- }
- used = true;
- break;
-
- default:
- break;
-
- case SDLK_f:
- // Find path to mouse (debug purpose)
- viewport->toggleDebugPath();
- used = true;
- break;
-
- case SDLK_t:
- // Toggle accepting of incoming trade requests
- {
- unsigned int deflt = player_relations.getDefault();
- if (deflt & PlayerRelation::TRADE) {
- chatWindow->chatLog("Ignoring incoming trade requests", BY_SERVER);
- deflt &= ~PlayerRelation::TRADE;
- } else {
- chatWindow->chatLog("Accepting incoming trade requests", BY_SERVER);
- deflt |= PlayerRelation::TRADE;
- }
-
- player_relations.setDefault(deflt);
- }
- used = true;
- break;
- }
-
- // Emotions
- Uint8 emotion;
- switch (event.key.keysym.sym)
- {
- case SDLK_1: emotion = 1; break;
- case SDLK_2: emotion = 2; break;
- case SDLK_3: emotion = 3; break;
- case SDLK_4: emotion = 4; break;
- case SDLK_5: emotion = 5; break;
- case SDLK_6: emotion = 6; break;
- case SDLK_7: emotion = 7; break;
- case SDLK_8: emotion = 8; break;
- case SDLK_9: emotion = 9; break;
- case SDLK_0: emotion = 10; break;
- case SDLK_MINUS: emotion = 11; break;
- case SDLK_EQUALS: emotion = 12; break;
- default: emotion = 0; break;
- }
-
- if (emotion)
- {
- player_node->emote(emotion);
- used = true;
- }
- }
- switch (event.key.keysym.sym)
- {
- case SDLK_PAGEUP:
- if (chatWindow->isVisible())
- {
- chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
- used = true;
- }
- break;
-
- case SDLK_PAGEDOWN:
- if (chatWindow->isVisible())
- {
- chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
- used = true;
- }
- break;
-
- case SDLK_F1:
- // In-game Help
- if (helpWindow->isVisible())
- {
- helpWindow->setVisible(false);
- }
- else
- {
- helpWindow->loadHelp("index");
- helpWindow->requestMoveToTop();
- }
- used = true;
- break;
-
- case SDLK_F2: requestedWindow = statusWindow; break;
- case SDLK_F3: requestedWindow = inventoryWindow; break;
- case SDLK_F4: requestedWindow = equipmentWindow; break;
- case SDLK_F5: requestedWindow = skillDialog; break;
- case SDLK_F6: requestedWindow = minimap; break;
- case SDLK_F7: requestedWindow = chatWindow; break;
- case SDLK_F8: requestedWindow = itemShortcutWindow; break;
- case SDLK_F9: requestedWindow = setupWindow; break;
- case SDLK_F10: requestedWindow = debugWindow; break;
- //case SDLK_F11: requestedWindow = newSkillWindow; break;
-
- case SDLK_RETURN:
- // Input chat window
- if (chatWindow->isInputFocused() ||
- deathNotice != NULL ||
- weightNotice != NULL)
- {
- break;
- }
-
- // Quit by pressing Enter if the exit confirm is there
- if (exitConfirm)
- {
- done = true;
- }
- // Close the Browser if opened
- else if (helpWindow->isVisible())
- {
- helpWindow->setVisible(false);
- }
- // Close the config window, cancelling changes if opened
- else if (setupWindow->isVisible())
- {
- setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
- }
- // Else, open the chat edit box
- else
- {
- chatWindow->requestChatFocus();
- used = true;
- }
- break;
- // Quitting confirmation dialog
- case SDLK_ESCAPE:
- if (!exitConfirm) {
- exitConfirm = new ConfirmDialog(
- "Quit", "Are you sure you want to quit?");
- exitConfirm->addActionListener(&exitListener);
- exitConfirm->requestMoveToTop();
- }
- else
- {
- exitConfirm->action(gcn::ActionEvent(NULL, "no"));
- }
- break;
-
- default:
- break;
- }
- if (keyboard.isEnabled() && !chatWindow->isInputFocused())
- {
- const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
- // Checks if any item shortcut is pressed.
- for (int i = KeyboardConfig::KEY_SHORTCUT_0;
- i <= KeyboardConfig::KEY_SHORTCUT_9;
- i++)
- {
- if (tKey == i && !used) {
- itemShortcut->useItem(
- i - KeyboardConfig::KEY_SHORTCUT_0);
- break;
- }
- }
- switch (tKey) {
- case KeyboardConfig::KEY_PICKUP:
- {
- FloorItem *item = floorItemManager->findByCoordinates(
- player_node->mX, player_node->mY);
-
- // If none below the player, try the tile in front of
- // the player
- if (!item) {
- Uint16 x = player_node->mX;
- Uint16 y = player_node->mY;
- if (player_node->getDirection() & Being::UP)
- y--;
- if (player_node->getDirection() & Being::DOWN)
- y++;
- if (player_node->getDirection() & Being::LEFT)
- x--;
- if (player_node->getDirection() & Being::RIGHT)
- x++;
-
- item = floorItemManager->findByCoordinates(x, y);
- }
-
- if (item)
- player_node->pickUp(item);
-
- used = true;
- }
- break;
- case KeyboardConfig::KEY_SIT:
- // Player sit action
- player_node->toggleSit();
- used = true;
- break;
- case KeyboardConfig::KEY_HIDE_WINDOWS:
- // Hide certain windows
- if (!chatWindow->isInputFocused())
- {
- statusWindow->setVisible(false);
- inventoryWindow->setVisible(false);
- skillDialog->setVisible(false);
- setupWindow->setVisible(false);
- equipmentWindow->setVisible(false);
- helpWindow->setVisible(false);
- debugWindow->setVisible(false);
- }
- break;
- }
- }
-
- if (requestedWindow)
- {
- requestedWindow->setVisible(!requestedWindow->isVisible());
- if (requestedWindow->isVisible())
- {
- requestedWindow->requestMoveToTop();
- }
- used = true;
- }
-
- }
-
- // Quit event
- else if (event.type == SDL_QUIT)
- {
- done = true;
- }
-
- // Push input to GUI when not used
- if (!used)
- {
- try
- {
- guiInput->pushInput(event);
- }
- catch (gcn::Exception e)
- {
- const char* err = e.getMessage().c_str();
- logger->log("Warning: guichan input exception: %s", err);
- }
- }
+ bool used = false;
+
+ // Keyboard events (for discontinuous keys)
+ if (event.type == SDL_KEYDOWN)
+ {
+ gcn::Window *requestedWindow = NULL;
+
+ if (setupWindow->isVisible() &&
+ keyboard.getNewKeyIndex() > keyboard.KEY_NO_VALUE)
+ {
+ keyboard.setNewKey((int) event.key.keysym.sym);
+ keyboard.callbackNewKey();
+ keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE);
+ return;
+ }
+ // Keys pressed together with Alt/Meta
+ // Emotions and some internal gui windows
+ #ifndef __APPLE__
+ if (event.key.keysym.mod & KMOD_ALT)
+ #else
+ if (event.key.keysym.mod & KMOD_LMETA)
+ #endif
+ {
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_p:
+ // Screenshot (picture, hence the p)
+ {
+ SDL_Surface *screenshot =
+ graphics->getScreenshot();
+ if (!saveScreenshot(screenshot))
+ {
+ logger->
+ log("Error: could not save Screenshot.");
+ }
+ SDL_FreeSurface(screenshot);
+ }
+ used = true;
+ break;
+
+ default:
+ break;
+
+ case SDLK_f:
+ // Find path to mouse (debug purpose)
+ viewport->toggleDebugPath();
+ used = true;
+ break;
+
+ case SDLK_t:
+ // Toggle accepting of incoming trade requests
+ {
+ unsigned int deflt = player_relations.getDefault();
+ if (deflt & PlayerRelation::TRADE) {
+ chatWindow->
+ chatLog("Ignoring incoming trade requests",
+ BY_SERVER);
+ deflt &= ~PlayerRelation::TRADE;
+ } else {
+ chatWindow->chatLog("Accepting incoming trade "
+ "requests", BY_SERVER);
+ deflt |= PlayerRelation::TRADE;
+ }
+
+ player_relations.setDefault(deflt);
+ }
+ used = true;
+ break;
+ }
+
+ // Emotions
+ Uint8 emotion;
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_1: emotion = 1; break;
+ case SDLK_2: emotion = 2; break;
+ case SDLK_3: emotion = 3; break;
+ case SDLK_4: emotion = 4; break;
+ case SDLK_5: emotion = 5; break;
+ case SDLK_6: emotion = 6; break;
+ case SDLK_7: emotion = 7; break;
+ case SDLK_8: emotion = 8; break;
+ case SDLK_9: emotion = 9; break;
+ case SDLK_0: emotion = 10; break;
+ case SDLK_MINUS: emotion = 11; break;
+ case SDLK_EQUALS: emotion = 12; break;
+ default: emotion = 0; break;
+ }
+
+ if (emotion)
+ {
+ player_node->emote(emotion);
+ used = true;
+ }
+ }
+ switch (event.key.keysym.sym)
+ {
+ case SDLK_PAGEUP:
+ if (chatWindow->isVisible())
+ {
+ chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
+ used = true;
+ }
+ break;
+
+ case SDLK_PAGEDOWN:
+ if (chatWindow->isVisible())
+ {
+ chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
+ used = true;
+ }
+ break;
+
+ case SDLK_F1:
+ // In-game Help
+ if (helpWindow->isVisible())
+ {
+ helpWindow->setVisible(false);
+ }
+ else
+ {
+ helpWindow->loadHelp("index");
+ helpWindow->requestMoveToTop();
+ }
+ used = true;
+ break;
+
+ case SDLK_F2: requestedWindow = statusWindow; break;
+ case SDLK_F3: requestedWindow = inventoryWindow; break;
+ case SDLK_F4: requestedWindow = equipmentWindow; break;
+ case SDLK_F5: requestedWindow = skillDialog; break;
+ case SDLK_F6: requestedWindow = minimap; break;
+ case SDLK_F7: requestedWindow = chatWindow; break;
+ case SDLK_F8: requestedWindow = itemShortcutWindow; break;
+ case SDLK_F9: requestedWindow = setupWindow; break;
+ case SDLK_F10: requestedWindow = debugWindow; break;
+ //case SDLK_F11: requestedWindow = newSkillWindow; break;
+
+ case SDLK_RETURN:
+ // Input chat window
+ if (chatWindow->isInputFocused() ||
+ deathNotice != NULL ||
+ weightNotice != NULL)
+ {
+ break;
+ }
+
+ // Quit by pressing Enter if the exit confirm is there
+ if (exitConfirm)
+ {
+ done = true;
+ }
+ // Close the Browser if opened
+ else if (helpWindow->isVisible())
+ {
+ helpWindow->setVisible(false);
+ }
+ // Close the config window, cancelling changes if opened
+ else if (setupWindow->isVisible())
+ {
+ setupWindow->action(gcn::ActionEvent(NULL, "cancel"));
+ }
+ // Else, open the chat edit box
+ else
+ {
+ chatWindow->requestChatFocus();
+ used = true;
+ }
+ break;
+ // Quitting confirmation dialog
+ case SDLK_ESCAPE:
+ if (!exitConfirm) {
+ exitConfirm = new ConfirmDialog(
+ "Quit", "Are you sure you want to quit?");
+ exitConfirm->addActionListener(&exitListener);
+ exitConfirm->requestMoveToTop();
+ }
+ else
+ {
+ exitConfirm->action(gcn::ActionEvent(NULL, "no"));
+ }
+ break;
+
+ default:
+ break;
+ }
+ if (keyboard.isEnabled() && !chatWindow->isInputFocused())
+ {
+ const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
+ // Checks if any item shortcut is pressed.
+ for (int i = KeyboardConfig::KEY_SHORTCUT_0;
+ i <= KeyboardConfig::KEY_SHORTCUT_9;
+ i++)
+ {
+ if (tKey == i && !used) {
+ itemShortcut->useItem(
+ i - KeyboardConfig::KEY_SHORTCUT_0);
+ break;
+ }
+ }
+ switch (tKey) {
+ case KeyboardConfig::KEY_PICKUP:
+ {
+ FloorItem *item =
+ floorItemManager->findByCoordinates(
+ player_node->mX, player_node->mY);
+
+ // If none below the player, try the tile in front
+ // of the player
+ if (!item) {
+ Uint16 x = player_node->mX;
+ Uint16 y = player_node->mY;
+ if (player_node->getDirection() & Being::UP)
+ y--;
+ if (player_node->getDirection() & Being::DOWN)
+ y++;
+ if (player_node->getDirection() & Being::LEFT)
+ x--;
+ if (player_node->getDirection() & Being::RIGHT)
+ x++;
+
+ item = floorItemManager->
+ findByCoordinates(x, y);
+ }
+
+ if (item)
+ player_node->pickUp(item);
+
+ used = true;
+ }
+ break;
+ case KeyboardConfig::KEY_SIT:
+ // Player sit action
+ player_node->toggleSit();
+ used = true;
+ break;
+ case KeyboardConfig::KEY_HIDE_WINDOWS:
+ // Hide certain windows
+ if (!chatWindow->isInputFocused())
+ {
+ statusWindow->setVisible(false);
+ inventoryWindow->setVisible(false);
+ skillDialog->setVisible(false);
+ setupWindow->setVisible(false);
+ equipmentWindow->setVisible(false);
+ helpWindow->setVisible(false);
+ debugWindow->setVisible(false);
+ }
+ break;
+ }
+ }
+
+ if (requestedWindow)
+ {
+ requestedWindow->setVisible(!requestedWindow->isVisible());
+ if (requestedWindow->isVisible())
+ {
+ requestedWindow->requestMoveToTop();
+ }
+ used = true;
+ }
+
+ }
+
+ // Quit event
+ else if (event.type == SDL_QUIT)
+ {
+ done = true;
+ }
+
+ // Push input to GUI when not used
+ if (!used)
+ {
+ try
+ {
+ guiInput->pushInput(event);
+ }
+ catch (gcn::Exception e)
+ {
+ const char* err = e.getMessage().c_str();
+ logger->log("Warning: guichan input exception: %s", err);
+ }
+ }
} // End while
// If the user is configuring the keys then don't respond.
@@ -732,111 +739,112 @@ void Game::handleInput()
}
// Moving player around
if (player_node->mAction != Being::DEAD &&
- current_npc == 0 &&
- !chatWindow->isInputFocused())
+ current_npc == 0 &&
+ !chatWindow->isInputFocused())
{
- // Get the state of the keyboard keys
- keyboard.refreshActiveKeys();
-
- const Uint16 x = player_node->mX;
- const Uint16 y = player_node->mY;
- unsigned char direction = 0;
-
- // Translate pressed keys to movement and direction
- if (keyboard.isKeyActive(keyboard.KEY_MOVE_UP) ||
- (joystick && joystick->isUp()))
- {
- direction |= Being::UP;
- }
- else if (keyboard.isKeyActive(keyboard.KEY_MOVE_DOWN) ||
- (joystick && joystick->isDown()))
- {
- direction |= Being::DOWN;
- }
-
- if (keyboard.isKeyActive(keyboard.KEY_MOVE_LEFT) ||
- (joystick && joystick->isLeft()))
- {
- direction |= Being::LEFT;
- }
- else if (keyboard.isKeyActive(keyboard.KEY_MOVE_RIGHT) ||
- (joystick && joystick->isRight()))
- {
- direction |= Being::RIGHT;
- }
-
- player_node->setWalkingDir(direction);
-
- // Attacking monsters
- if (keyboard.isKeyActive(keyboard.KEY_ATTACK) ||
- (joystick && joystick->buttonPressed(0)))
- {
- Being *target = NULL;
- bool newTarget = keyboard.isKeyActive(keyboard.KEY_TARGET);
- // A set target has highest priority
- if (newTarget || !player_node->getTarget())
- {
- Uint16 targetX = x, targetY = y;
-
- if (player_node->getDirection() & Being::UP)
- targetY--;
- if (player_node->getDirection() & Being::DOWN)
- targetY++;
- if (player_node->getDirection() & Being::LEFT)
- targetX--;
- if (player_node->getDirection() & Being::RIGHT)
- targetX++;
-
- // Attack priorioty is: Monster, Player, auto target
- target = beingManager->findBeing(
- targetX, targetY, Being::MONSTER);
- if (!target)
- target = beingManager->findBeing(
- targetX, targetY, Being::PLAYER);
- }
-
- player_node->attack(target, newTarget);
- }
-
- // Target the nearest player if 'q' is pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) )
- //if (keys[SDLK_q])
- {
- Being *target =
- beingManager->findNearestLivingBeing(player_node, 20, Being::PLAYER);
-
- if (target)
- {
- player_node->setTarget(target);
- }
- }
-
- // Target the nearest monster if 'a' pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) )
- //if (keys[SDLK_a])
- {
- Being *target =
- beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER);
-
- if (target)
- {
- player_node->setTarget(target);
- }
- }
-
- if (joystick)
- {
- if (joystick->buttonPressed(1))
- {
- FloorItem *item = floorItemManager->findByCoordinates(x, y);
-
- if (item)
- player_node->pickUp(item);
- }
- else if (joystick->buttonPressed(2))
- {
- player_node->toggleSit();
- }
- }
+ // Get the state of the keyboard keys
+ keyboard.refreshActiveKeys();
+
+ const Uint16 x = player_node->mX;
+ const Uint16 y = player_node->mY;
+ unsigned char direction = 0;
+
+ // Translate pressed keys to movement and direction
+ if (keyboard.isKeyActive(keyboard.KEY_MOVE_UP) ||
+ (joystick && joystick->isUp()))
+ {
+ direction |= Being::UP;
+ }
+ else if (keyboard.isKeyActive(keyboard.KEY_MOVE_DOWN) ||
+ (joystick && joystick->isDown()))
+ {
+ direction |= Being::DOWN;
+ }
+
+ if (keyboard.isKeyActive(keyboard.KEY_MOVE_LEFT) ||
+ (joystick && joystick->isLeft()))
+ {
+ direction |= Being::LEFT;
+ }
+ else if (keyboard.isKeyActive(keyboard.KEY_MOVE_RIGHT) ||
+ (joystick && joystick->isRight()))
+ {
+ direction |= Being::RIGHT;
+ }
+
+ player_node->setWalkingDir(direction);
+
+ // Attacking monsters
+ if (keyboard.isKeyActive(keyboard.KEY_ATTACK) ||
+ (joystick && joystick->buttonPressed(0)))
+ {
+ Being *target = NULL;
+ bool newTarget = keyboard.isKeyActive(keyboard.KEY_TARGET);
+ // A set target has highest priority
+ if (newTarget || !player_node->getTarget())
+ {
+ Uint16 targetX = x, targetY = y;
+
+ if (player_node->getDirection() & Being::UP)
+ targetY--;
+ if (player_node->getDirection() & Being::DOWN)
+ targetY++;
+ if (player_node->getDirection() & Being::LEFT)
+ targetX--;
+ if (player_node->getDirection() & Being::RIGHT)
+ targetX++;
+
+ // Attack priorioty is: Monster, Player, auto target
+ target = beingManager->findBeing(
+ targetX, targetY, Being::MONSTER);
+ if (!target)
+ target = beingManager->findBeing(
+ targetX, targetY, Being::PLAYER);
+ }
+
+ player_node->attack(target, newTarget);
+ }
+
+ // Target the nearest player if 'q' is pressed
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) )
+ //if (keys[SDLK_q])
+ {
+ Being *target =
+ beingManager->
+ findNearestLivingBeing(player_node, 20, Being::PLAYER);
+
+ if (target)
+ {
+ player_node->setTarget(target);
+ }
+ }
+
+ // Target the nearest monster if 'a' pressed
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) )
+ //if (keys[SDLK_a])
+ {
+ Being *target =
+ beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER);
+
+ if (target)
+ {
+ player_node->setTarget(target);
+ }
+ }
+
+ if (joystick)
+ {
+ if (joystick->buttonPressed(1))
+ {
+ FloorItem *item = floorItemManager->findByCoordinates(x, y);
+
+ if (item)
+ player_node->pickUp(item);
+ }
+ else if (joystick->buttonPressed(2))
+ {
+ player_node->toggleSit();
+ }
+ }
}
}
diff --git a/src/game.h b/src/game.h
index 5b73832e..583aea70 100644
--- a/src/game.h
+++ b/src/game.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: game.h 3859 2008-01-26 19:38:43Z b_lindeijer $
*/
#ifndef _TMW_GAME_
@@ -42,35 +42,35 @@ extern volatile int tick_time;
class Game : public ConfigListener
{
public:
- Game(Network *network);
- ~Game();
+ Game(Network *network);
+ ~Game();
- void logic();
+ void logic();
- void handleInput();
+ void handleInput();
- void optionChanged(const std::string &name);
+ void optionChanged(const std::string &name);
private:
- Network *mNetwork;
-
- /** Used to determine whether to draw the next frame. */
- int mDrawTime;
-
- /** The minimum frame time (used for frame limiting). */
- int mMinFrameTime;
-
- typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
- MessageHandlerPtr mBeingHandler;
- MessageHandlerPtr mBuySellHandler;
- MessageHandlerPtr mChatHandler;
- MessageHandlerPtr mEquipmentHandler;
- MessageHandlerPtr mInventoryHandler;
- MessageHandlerPtr mItemHandler;
- MessageHandlerPtr mNpcHandler;
- MessageHandlerPtr mPlayerHandler;
- MessageHandlerPtr mSkillHandler;
- MessageHandlerPtr mTradeHandler;
+ Network *mNetwork;
+
+ /** Used to determine whether to draw the next frame. */
+ int mDrawTime;
+
+ /** The minimum frame time (used for frame limiting). */
+ int mMinFrameTime;
+
+ typedef const std::auto_ptr<MessageHandler> MessageHandlerPtr;
+ MessageHandlerPtr mBeingHandler;
+ MessageHandlerPtr mBuySellHandler;
+ MessageHandlerPtr mChatHandler;
+ MessageHandlerPtr mEquipmentHandler;
+ MessageHandlerPtr mInventoryHandler;
+ MessageHandlerPtr mItemHandler;
+ MessageHandlerPtr mNpcHandler;
+ MessageHandlerPtr mPlayerHandler;
+ MessageHandlerPtr mSkillHandler;
+ MessageHandlerPtr mTradeHandler;
};
/**
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 586f9f49..0433678f 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: graphics.cpp 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#include <cassert>
diff --git a/src/graphics.h b/src/graphics.h
index 564826a2..0cf58141 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: graphics.h 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#ifndef _GRAPHICS_H
diff --git a/src/gui/box.cpp b/src/gui/box.cpp
index 6af3ae3e..f53bc18e 100644
--- a/src/gui/box.cpp
+++ b/src/gui/box.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: box.cpp 1456 2005-07-15 23:17:00Z b_lindeijer $
*/
#include "box.h"
diff --git a/src/gui/box.h b/src/gui/box.h
index ed1a7163..280fd3e2 100644
--- a/src/gui/box.h
+++ b/src/gui/box.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: box.h 2529 2006-08-13 10:20:19Z b_lindeijer $
*/
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index bc76335f..4f771a7e 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: browserbox.cpp 4348 2008-06-14 12:42:49Z the_enemy $
*/
#include <algorithm>
diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h
index 9c0e8ef1..636fe5a0 100644
--- a/src/gui/browserbox.h
+++ b/src/gui/browserbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: browserbox.h 3687 2007-10-26 00:22:12Z crush_tmw $
*/
#ifndef __TMW_BROWSERBOX_H__
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp
deleted file mode 100644
index 0ed383ce..00000000
--- a/src/gui/buddywindow.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * The Mana World
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World 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,
- * 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
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#include "buddywindow.h"
-
-#include <guichan/widgets/listbox.hpp>
-
-#include "button.h"
-#include "chat.h"
-#include "scrollarea.h"
-
-#include "../resources/buddylist.h"
-
-extern ChatWindow *chatWindow;
-
-BuddyWindow::BuddyWindow():
- Window("Buddy")
-{
- setContentSize(124, 202);
-
- mBuddyList = new BuddyList();
-
- mListbox = new gcn::ListBox();
- mListbox->setListModel(mBuddyList);
-
- ScrollArea *scrollArea = new ScrollArea(mListbox);
- scrollArea->setDimension(gcn::Rectangle(
- 7, 5, 110, 170));
- add(scrollArea);
-
- Button *talk = new Button("Talk", "Talk", this);
- Button *remove = new Button("Remove", "Remove", this);
- Button *cancel = new Button("Cancel", "Cancel", this);
-
- talk->setPosition(2,180);
- remove->setPosition(talk->getWidth()+2,180);
- cancel->setPosition(talk->getWidth()+remove->getWidth()+2,180);
-
- add(talk);
- add(remove);
- add(cancel);
-}
-
-void BuddyWindow::action(const gcn::ActionEvent &event)
-{
- if (event.getId() == "Talk") {
- int selected = mListbox->getSelected();
- if ( selected > -1 )
- {
- std::string who = mBuddyList->getElementAt(selected);
- chatWindow->setInputText(who +": ");
- }
- }
- else if (event.getId() == "Remove") {
- int selected = mListbox->getSelected();
- if ( selected > -1 )
- {
- std::string who = mBuddyList->getElementAt(selected);
- mBuddyList->removeBuddy(who);
- }
- }
- else if (event.getId() == "Cancel") {
- setVisible(false);
- }
-}
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index c6bc4ccb..1243d798 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: button.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/button.h b/src/gui/button.h
index d12173b2..8e045a74 100644
--- a/src/gui/button.h
+++ b/src/gui/button.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: button.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_BUTTON_H
diff --git a/src/gui/buttonbox.cpp b/src/gui/buttonbox.cpp
new file mode 100644
index 00000000..592cb92a
--- /dev/null
+++ b/src/gui/buttonbox.cpp
@@ -0,0 +1,47 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: buttonbox.cpp
+ */
+
+#include "buttonbox.h"
+
+#include "button.h"
+
+ButtonBox::ButtonBox(const std::string &title, const std::string &buttonTxt,
+ ButtonBoxListener *listener) :
+ Window(title),
+ mListener(listener)
+{
+ Button *button = new Button(buttonTxt, "activate", this);
+ setContentSize(button->getWidth() + 10,
+ button->getHeight() + 10);
+ button->setPosition(5, 5);
+ add(button);
+}
+
+void
+ButtonBox::action(const gcn::ActionEvent &event)
+{
+ if (event.getId() == "activate")
+ {
+ mListener->buttonBoxRespond();
+ }
+}
diff --git a/src/gui/buttonbox.h b/src/gui/buttonbox.h
new file mode 100644
index 00000000..1b76e619
--- /dev/null
+++ b/src/gui/buttonbox.h
@@ -0,0 +1,70 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: buttonbox.h
+ */
+
+#ifndef _TMW_BUTTONBOX_H
+#define _TMW_BUTTONBOX_H
+
+#include <string>
+
+#include <guichan/actionlistener.hpp>
+
+#include "window.h"
+
+class ButtonBoxListener
+{
+ public:
+
+ /*
+ * function that ButtonBox calls when the button has been pressed
+ */
+ virtual void buttonBoxRespond() = 0;
+};
+
+class ButtonBox : public Window, public gcn::ActionListener
+{
+ public:
+
+ /*
+ * Constructor
+ *
+ * @param title is the text that appears at the top of the box
+ * @param buttonTxt is the text that appears on the button
+ * @param listener points to the class that should respond to the
+ * button press
+ */
+ ButtonBox(const std::string &title, const std::string &buttonTxt,
+ ButtonBoxListener *listener);
+
+ /*
+ * called when the button is pressed
+ *
+ * @param event is the event that is generated
+ */
+ void
+ action(const gcn::ActionEvent &event);
+
+ private:
+
+ ButtonBoxListener *mListener;
+};
+#endif
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 259fcfd9..24acf2d1 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buy.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "buy.h"
diff --git a/src/gui/buy.h b/src/gui/buy.h
index 3a9ea3c5..6f75cab5 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buy.h 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#ifndef _TMW_BUY_H
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index ae5c7358..9cc3b297 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buysell.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "buysell.h"
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index 97caf34b..64c37e39 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buysell.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_BUYSELL_H
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 8ab3b879..c4b1d89e 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: char_select.cpp 3760 2007-11-21 19:43:11Z b_lindeijer $
*/
#include "char_select.h"
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 283ecf42..182600d1 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: char_select.h 3752 2007-11-20 10:50:00Z b_lindeijer $
*/
#ifndef _CHAR_SELECT_H
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 638c05a6..3465fb69 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: char_server.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "char_server.h"
@@ -105,10 +105,11 @@ ServerSelectDialog::action(const gcn::ActionEvent &event)
const SERVER_INFO *si = server_info[mServerList->getSelected()];
mLoginData->hostname = iptostring(si->address);
mLoginData->port = si->port;
- state = CHAR_CONNECT_STATE;
+ mLoginData->updateHost = si->updateHost;
+ state = UPDATE_STATE;
}
else if (event.getId() == "cancel") {
- state = LOADDATA_STATE;
+ state = LOGIN_STATE;
}
}
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index 26e723f9..32a0645f 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: char_server.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _CHAR_SEL_SERVER_H
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 5e3aaf60..7b69ec1c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -18,12 +18,11 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chat.cpp 4227 2008-05-08 00:39:29Z peaveydk $
*/
#include <algorithm>
-#include <sstream>
-
+#include <fstream>
#include <guichan/focushandler.hpp>
#include <guichan/key.hpp>
@@ -37,6 +36,9 @@
#include "../configuration.h"
#include "../game.h"
#include "../localplayer.h"
+#include "../beingmanager.h"
+#include "../recorder.h"
+#include "../party.h"
#include "../net/messageout.h"
#include "../net/protocol.h"
@@ -64,9 +66,9 @@ ChatWindow::ChatWindow(Network *network):
mTextOutput->setMaxRow((int) config.getValue("ChatLogLength", 0));
mScrollArea = new ScrollArea(mTextOutput);
mScrollArea->setPosition(
- mScrollArea->getFrameSize(), mScrollArea->getFrameSize());
+ mScrollArea->getFrameSize(), mScrollArea->getFrameSize());
mScrollArea->setScrollPolicy(
- gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
+ gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
mScrollArea->setOpaque(false);
add(mScrollArea);
@@ -75,6 +77,22 @@ ChatWindow::ChatWindow(Network *network):
// Add key listener to chat input to be able to respond to up/down
mChatInput->addKeyListener(this);
mCurHist = mHistory.end();
+
+ // Read the party prefix
+ std::string partyPrefix = config.getValue("PartyPrefix", "$");
+ mPartyPrefix = (partyPrefix == "" ? '$' : partyPrefix.at(0));
+ mReturnToggles = config.getValue("ReturnToggles", "0") == "1";
+ mRecorder = new Recorder(this);
+ mParty = new Party(this, mNetwork);
+}
+
+ChatWindow::~ChatWindow()
+{
+ char partyPrefix[2] = ".";
+ *partyPrefix = mPartyPrefix;
+ config.setValue("PartyPrefix", partyPrefix);
+ config.setValue("ReturnToggles", mReturnToggles ? "1" : "0");
+ delete mRecorder;
}
void
@@ -85,17 +103,17 @@ ChatWindow::logic()
const gcn::Rectangle area = getChildrenArea();
mChatInput->setPosition(mChatInput->getFrameSize(),
- area.height - mChatInput->getHeight() -
- mChatInput->getFrameSize());
+ area.height - mChatInput->getHeight() -
+ mChatInput->getFrameSize());
mChatInput->setWidth(area.width - 2 * mChatInput->getFrameSize());
mScrollArea->setWidth(area.width - 2 * mScrollArea->getFrameSize());
mScrollArea->setHeight(area.height - 2 * mScrollArea->getFrameSize() -
- mChatInput->getHeight() - 5);
+ mChatInput->getHeight() - 5);
mScrollArea->logic();
}
void
-ChatWindow::chatLog(std::string line, int own)
+ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
{
// Trim whitespace
trim(line);
@@ -108,47 +126,51 @@ ChatWindow::chatLog(std::string line, int own)
// Fix the owner of welcome message.
if (line.substr(0, 7) == "Welcome")
{
- own = BY_SERVER;
+ own = BY_SERVER;
}
std::string::size_type pos = line.find(" : ");
if (pos != std::string::npos) {
- tmp.nick = line.substr(0, pos);
- tmp.text = line.substr(pos + 3);
+ tmp.nick = line.substr(0, pos);
+ tmp.text = line.substr(pos + 3);
}
std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK
switch (own) {
- case BY_GM:
- tmp.nick += std::string("Global announcement: ");
- lineColor = "##1"; // Equiv. to BrowserBox::RED
- break;
- case BY_PLAYER:
- tmp.nick += CAT_NORMAL;
- lineColor = "##2"; // Equiv. to BrowserBox::GREEN
- break;
- case BY_OTHER:
- tmp.nick += CAT_NORMAL;
- lineColor = "##0"; // Equiv. to BrowserBox::BLACK
- break;
- case BY_SERVER:
- tmp.nick = "Server: ";
- tmp.text = line;
- lineColor = "##7"; // Equiv. to BrowserBox::PINK
- break;
- case ACT_WHISPER:
- tmp.nick += CAT_WHISPER;
- lineColor = "##3"; // Equiv. to BrowserBox::BLUE
- break;
- case ACT_IS:
- tmp.nick += CAT_IS;
- lineColor = "##5"; // Equiv. to BrowserBox::YELLOW
- break;
- case BY_LOGGER:
- tmp.nick = "";
- tmp.text = line;
- lineColor = "##8"; // Equiv. to BrowserBox::GREY
- break;
+ case BY_GM:
+ tmp.nick += std::string("Global announcement: ");
+ lineColor = "##1"; // Equiv. to BrowserBox::RED
+ break;
+ case BY_PLAYER:
+ tmp.nick += CAT_NORMAL;
+ lineColor = "##2"; // Equiv. to BrowserBox::GREEN
+ break;
+ case BY_OTHER:
+ tmp.nick += CAT_NORMAL;
+ lineColor = "##0"; // Equiv. to BrowserBox::BLACK
+ break;
+ case BY_SERVER:
+ tmp.nick = "Server: ";
+ tmp.text = line;
+ lineColor = "##7"; // Equiv. to BrowserBox::PURPLE
+ break;
+ case BY_PARTY:
+ tmp.nick += CAT_NORMAL;
+ lineColor = "##6"; // Equiv. to BrowserBox::PINK
+ break;
+ case ACT_WHISPER:
+ tmp.nick += CAT_WHISPER;
+ lineColor = "##3"; // Equiv. to BrowserBox::BLUE
+ break;
+ case ACT_IS:
+ tmp.nick += CAT_IS;
+ lineColor = "##5"; // Equiv. to BrowserBox::YELLOW
+ break;
+ case BY_LOGGER:
+ tmp.nick = "";
+ tmp.text = line;
+ lineColor = "##8"; // Equiv. to BrowserBox::GRAY
+ break;
}
// Get the current system time
@@ -158,12 +180,12 @@ ChatWindow::chatLog(std::string line, int own)
// Format the time string properly
std::stringstream timeStr;
timeStr << "["
- << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
- << (int)(((t / 60) / 60) % 24)
- << ":"
- << (((t / 60) % 60 < 10) ? "0" : "")
- << (int)((t / 60) % 60)
- << "] ";
+ << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
+ << (int)(((t / 60) / 60) % 24)
+ << ":"
+ << (((t / 60) % 60 < 10) ? "0" : "")
+ << (int)((t / 60) % 60)
+ << "] ";
line = lineColor + timeStr.str() + tmp.nick + tmp.text;
@@ -172,13 +194,15 @@ ChatWindow::chatLog(std::string line, int own)
// at comparison.
if (mScrollArea->getVerticalScrollAmount() == mScrollArea->getVerticalMaxScroll())
{
- mTextOutput->addRow(line);
- mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
+ mTextOutput->addRow(line);
+ mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
}
else
{
- mTextOutput->addRow(line);
+ mTextOutput->addRow(line);
}
+
+ mRecorder->record(line.substr(3));
}
void
@@ -192,32 +216,35 @@ ChatWindow::action(const gcn::ActionEvent &event)
{
if (event.getId() == "chatinput")
{
- std::string message = mChatInput->getText();
-
- if (!message.empty()) {
- // If message different from previous, put it in the history
- if (mHistory.empty() || message != mHistory.back()) {
- mHistory.push_back(message);
- }
-
- // Reset history iterator
- mCurHist = mHistory.end();
-
- // Send the message to the server
- chatSend(player_node->getName(), message);
-
- // Clear the text from the chat input
- mChatInput->setText("");
- }
-
- // Remove focus and hide input
- mFocusHandler->focusNone();
-
- // If the chatWindow is shown up because you want to send a message
- // It should hide now
- if (mTmpVisible) {
- setVisible(false);
- }
+ std::string message = mChatInput->getText();
+
+ if (!message.empty()) {
+ // If message different from previous, put it in the history
+ if (mHistory.empty() || message != mHistory.back()) {
+ mHistory.push_back(message);
+ }
+
+ // Reset history iterator
+ mCurHist = mHistory.end();
+
+ // Send the message to the server
+ chatSend(player_node->getName(), message);
+
+ // Clear the text from the chat input
+ mChatInput->setText("");
+ }
+ if (message.empty() || !mReturnToggles)
+ {
+ // Remove focus and hide input
+ mFocusHandler->focusNone();
+
+ // If the chatWindow is shown up because you want to send a message
+ // It should hide now
+ if (mTmpVisible)
+ {
+ setVisible(false);
+ }
+ }
}
}
@@ -227,14 +254,14 @@ ChatWindow::requestChatFocus()
// Make sure chatWindow is visible
if (!isVisible())
{
- setVisible(true);
-
- /*
- * This is used to hide chatWindow after sending the message. There is
- * a trick here, because setVisible will set mTmpVisible to false, you
- * have to put this sentence *after* setVisible, not before it
- */
- mTmpVisible = true;
+ setVisible(true);
+
+ /*
+ * This is used to hide chatWindow after sending the message. There is
+ * a trick here, because setVisible will set mTmpVisible to false, you
+ * have to put this sentence *after* setVisible, not before it
+ */
+ mTmpVisible = true;
}
// Give focus to the chat input
@@ -255,81 +282,224 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
* require server handling by proper packet. Probably
* those if elses should be replaced by protocol calls */
+ // Send party message
+ if (msg.at(0) == mPartyPrefix)
+ {
+ msg.erase(0, 1);
+ std::size_t length = msg.length() + 1;
+
+ if (length == 0)
+ {
+ chatLog("Trying to send a blank party message.", BY_SERVER);
+ return;
+ }
+ MessageOut outMsg(mNetwork);
+
+ outMsg.writeInt16(CMSG_PARTY_MESSAGE);
+ outMsg.writeInt16(length + 4);
+ outMsg.writeString(msg, length);
+ return;
+ }
// Prepare ordinary message
if (msg.substr(0, 1) != "/") {
- msg = nick + " : " + msg;
+ msg = nick + " : " + msg;
+
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_CHAT_MESSAGE);
+ // Added + 1 in order to let eAthena parse admin commands correctly
+ outMsg.writeInt16(msg.length() + 4 + 1);
+ outMsg.writeString(msg, msg.length() + 1);
+ return;
+ }
+ msg.erase(0, 1);
+ trim(msg);
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_CHAT_MESSAGE);
- // Added + 1 in order to let eAthena parse admin commands correctly
- outMsg.writeInt16(msg.length() + 4 + 1);
- outMsg.writeString(msg, msg.length() + 1);
+ std::size_t space = msg.find(" ");
+ std::string command = msg.substr(0, space);
+ if (space == std::string::npos)
+ {
+ msg = "";
}
- else if (msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE)
+ else
{
- msg.erase(0, IS_ANNOUNCE_LENGTH);
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(0x0099);
- outMsg.writeInt16(msg.length() + 4);
- outMsg.writeString(msg, msg.length());
+ msg = msg.substr(space);
+ trim(msg);
}
- else if (msg.substr(0, IS_HELP_LENGTH) == IS_HELP)
+
+ if (command == "announce")
{
- chatLog("-- Help --", BY_SERVER);
- chatLog("/help: Display this help.", BY_SERVER);
- chatLog("/announce: Global announcement (GM only)", BY_SERVER);
- chatLog("/where: Display map name", BY_SERVER);
- chatLog("/who: Display number of online users", BY_SERVER);
- chatLog("/clear: Clears this window", BY_SERVER);
- chatLog("/whisper <nick> <message>: Sends a private <message> to <nick>", BY_SERVER);
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(0x0099);
+ outMsg.writeInt16(msg.length() + 4);
+ outMsg.writeString(msg, msg.length());
+ return;
}
- else if (msg.substr(0, IS_WHERE_LENGTH) == IS_WHERE)
+ if (command == "help")
{
- chatLog(map_path, BY_SERVER);
+ std::size_t space = msg.find(" ");
+ std::string msg1;
+ if (space == std::string::npos)
+ {
+ msg1 = "";
+ }
+ else
+ {
+ msg1 = msg.substr(space + 1, msg.length());
+ msg = msg.substr(0, space);
+ }
+ if (msg != "" && msg.at(0) == '/')
+ {
+ msg.erase(0, 1);
+ }
+ while (msg1 != "" && msg1.at(0) == ' ')
+ {
+ msg1.erase(0, 1);
+ }
+ help(msg, msg1);
+ return;
}
- else if (msg.substr(0, IS_WHO_LENGTH) == IS_WHO)
+ if (command == "where")
{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(0x00c1);
+ chatLog(map_path, BY_SERVER);
+ return;
}
- else if (msg.substr(0, IS_CLEAR_LENGTH) == IS_CLEAR)
+ if (command == "who")
{
- mTextOutput->clearRows();
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(0x00c1);
+ return;
}
- else if (msg.substr(0, IS_WHISPER_LENGTH) == IS_WHISPER)
+ if (command == "clear")
{
- std::string recvnick = "";
- msg.erase(0, IS_WHISPER_LENGTH + 1);
-
- if (msg.substr(0,1) == "\"")
- {
- const std::string::size_type pos = msg.find('"', 1);
- if (pos != std::string::npos) {
- recvnick = msg.substr(1, pos - 1);
- msg.erase(0, pos + 2);
- }
- }
- else
- {
- const std::string::size_type pos = msg.find(" ");
- if (pos != std::string::npos) {
- recvnick = msg.substr(0, pos);
- msg.erase(0, pos + 1);
- }
- }
-
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_CHAT_WHISPER);
- outMsg.writeInt16(msg.length() + 28);
- outMsg.writeString(recvnick, 24);
- outMsg.writeString(msg, msg.length());
-
- chatLog("Whispering to " + recvnick + " : " + msg, BY_PLAYER);
+ mTextOutput->clearRows();
+ return;
}
- else
+ if (command == "whisper")
+ {
+ std::string recvnick = "";
+
+ if (msg.substr(0,1) == "\"")
+ {
+ const std::string::size_type pos = msg.find('"', 1);
+ if (pos != std::string::npos) {
+ recvnick = msg.substr(1, pos - 1);
+ msg.erase(0, pos + 2);
+ }
+ }
+ else
+ {
+ const std::string::size_type pos = msg.find(" ");
+ if (pos != std::string::npos) {
+ recvnick = msg.substr(0, pos);
+ msg.erase(0, pos + 1);
+ }
+ }
+
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_CHAT_WHISPER);
+ outMsg.writeInt16(msg.length() + 28);
+ outMsg.writeString(recvnick, 24);
+ outMsg.writeString(msg, msg.length());
+
+ chatLog("Whispering to " + recvnick + " : " + msg, BY_PLAYER);
+ return;
+ }
+ if (command == "record")
{
- chatLog("Unknown command", BY_SERVER);
+ mRecorder->respond(msg);
+ return;
}
+ if (command == "toggle")
+ {
+ if (msg == "")
+ {
+ chatLog(mReturnToggles ? "Return toggles chat."
+ : "Message closes chat.", BY_SERVER);
+ return;
+ }
+ msg = msg.substr(0, 1);
+ if (msg == "1" || msg == "y" || msg == "t" || msg == "Y" || msg == "T")
+ {
+ chatLog("Return now toggles chat.", BY_SERVER);
+ mReturnToggles = true;
+ return;
+ }
+ if (msg == "0" || msg == "n" || msg == "f" || msg == "N" || msg == "F")
+ {
+ chatLog("Message now closes chat.", BY_SERVER);
+ mReturnToggles = false;
+ return;
+ }
+ chatLog("Options to /toggle are \"yes\", \"no\", \"true\", \"false\", "
+ "\"1\", \"0\".", BY_SERVER);
+ return;
+ }
+ if (command == "party")
+ {
+ if (msg == "")
+ {
+ chatLog("Unknown party command... Type \"/help\" party for more "
+ "information.", BY_SERVER);
+ return;
+ }
+ const std::string::size_type space = msg.find(" ");
+ std::string rest = (space == std::string::npos ? ""
+ : msg.substr(space + 1, msg.length()));
+ if (rest != "")
+ {
+ msg = msg.substr(0, space);
+ while (msg != "" && msg[0] == ' ')
+ {
+ msg = msg.substr(1, msg.length());
+ }
+ }
+ party(msg, rest);
+ return;
+ }
+ if (command == "present")
+ {
+ Beings &beings = beingManager->getAll();
+ std::string response = "";
+ for (BeingIterator bi = beings.begin(), be = beings.end();
+ bi != be;
+ ++bi)
+ {
+ if ((*bi)->getType() == Being::PLAYER)
+ {
+ if (response != "")
+ {
+ response += ", ";
+ }
+ response += (*bi)->getName();
+ }
+ }
+ if (mRecorder->isRecording())
+ {
+ // Get the current system time
+ time_t t;
+ time(&t);
+
+ // Format the time string properly
+ std::stringstream timeStr;
+ timeStr << "["
+ << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
+ << (int)(((t / 60) / 60) % 24)
+ << ":"
+ << (((t / 60) % 60 < 10) ? "0" : "")
+ << (int)((t / 60) % 60)
+ << "] ";
+
+
+ mRecorder->record(timeStr.str() + "Present: " + response + ".");
+ chatLog("Attendance written to record log.", BY_SERVER, true);
+ }
+ else
+ {
+ chatLog("Present: " + response, BY_SERVER);
+ }
+ return;
+ }
+ chatLog("Unknown command", BY_SERVER);
}
std::string
@@ -337,76 +507,75 @@ ChatWindow::const_msg(CHATSKILL act)
{
std::string msg;
if (act.success == SKILL_FAILED && act.skill == SKILL_BASIC) {
- switch (act.bskill) {
- case BSKILL_TRADE :
- msg = "Trade failed!";
- break;
- case BSKILL_EMOTE :
- msg = "Emote failed!";
- break;
- case BSKILL_SIT :
- msg = "Sit failed!";
- break;
- case BSKILL_CREATECHAT :
- msg = "Chat creating failed!";
- break;
- case BSKILL_JOINPARTY :
- msg = "Could not join party!";
- break;
- case BSKILL_SHOUT :
- msg = "Cannot shout!";
- break;
- }
-
- switch (act.reason) {
- case RFAIL_SKILLDEP :
- msg += " You have not yet reached a high enough lvl!";
- break;
- case RFAIL_INSUFHP :
- msg += " Insufficient HP!";
- break;
- case RFAIL_INSUFSP :
- msg += " Insufficient SP!";
- break;
- case RFAIL_NOMEMO :
- msg += " You have no memos!";
- break;
- case RFAIL_SKILLDELAY :
- msg += " You cannot do that right now!";
- break;
- case RFAIL_ZENY :
- msg += " Seems you need more Zeny... ;-)";
- break;
- case RFAIL_WEAPON :
- msg += " You cannot use this skill with that kind of weapon!";
- break;
- case RFAIL_REDGEM :
- msg += " You need another red gem!";
- break;
- case RFAIL_BLUEGEM :
- msg += " You need another blue gem!";
- break;
- case RFAIL_OVERWEIGHT :
- msg += " You're carrying to much to do this!";
- break;
- default :
- msg += " Huh? What's that?";
- break;
- }
+ switch (act.bskill) {
+ case BSKILL_TRADE :
+ msg = "Trade failed!";
+ break;
+ case BSKILL_EMOTE :
+ msg = "Emote failed!";
+ break;
+ case BSKILL_SIT :
+ msg = "Sit failed!";
+ break;
+ case BSKILL_CREATECHAT :
+ msg = "Chat creating failed!";
+ break;
+ case BSKILL_JOINPARTY :
+ msg = "Could not join party!";
+ break;
+ case BSKILL_SHOUT :
+ msg = "Cannot shout!";
+ break;
+ }
+
+ switch (act.reason) {
+ case RFAIL_SKILLDEP :
+ msg += " You have not yet reached a high enough level!";
+ break;
+ case RFAIL_INSUFHP :
+ msg += " Insufficient HP!";
+ break;
+ case RFAIL_INSUFSP :
+ msg += " Insufficient SP!";
+ break;
+ case RFAIL_NOMEMO :
+ msg += " You have no memos!";
+ break;
+ case RFAIL_SKILLDELAY :
+ msg += " You cannot do that right now!";
+ break;
+ case RFAIL_ZENY :
+ msg += " Seems you need more Zeny... ;-)";
+ break;
+ case RFAIL_WEAPON :
+ msg += " You cannot use this skill with that kind of weapon!";
+ break;
+ case RFAIL_REDGEM :
+ msg += " You need another red gem!";
+ break;
+ case RFAIL_BLUEGEM :
+ msg += " You need another blue gem!";
+ break;
+ case RFAIL_OVERWEIGHT :
+ msg += " You're carrying to much to do this!";
+ break;
+ default :
+ msg += " Huh? What's that?";
+ break;
+ }
} else {
- switch(act.skill) {
- case SKILL_WARP :
- msg = "Warp failed...";
- break;
- case SKILL_STEAL :
- msg = "Could not steal anything...";
- break;
- case SKILL_ENVENOM :
- msg = "Poison had no effect...";
- break;
- }
+ switch(act.skill) {
+ case SKILL_WARP :
+ msg = "Warp failed...";
+ break;
+ case SKILL_STEAL :
+ msg = "Could not steal anything...";
+ break;
+ case SKILL_ENVENOM :
+ msg = "Poison had no effect...";
+ break;
+ }
}
-
return msg;
}
@@ -414,7 +583,7 @@ void
ChatWindow::scroll(int amount)
{
if (!isVisible())
- return;
+ return;
int range = mScrollArea->getHeight() / 8 * amount;
gcn::Rectangle scr;
@@ -427,25 +596,25 @@ void
ChatWindow::keyPressed(gcn::KeyEvent &event)
{
if (event.getKey().getValue() == gcn::Key::DOWN &&
- mCurHist != mHistory.end())
- {
- // Move forward through the history
- HistoryIterator prevHist = mCurHist++;
- if (mCurHist != mHistory.end()) {
- mChatInput->setText(*mCurHist);
- mChatInput->setCaretPosition(mChatInput->getText().length());
- }
- else {
- mCurHist = prevHist;
- }
+ mCurHist != mHistory.end())
+ {
+ // Move forward through the history
+ HistoryIterator prevHist = mCurHist++;
+ if (mCurHist != mHistory.end()) {
+ mChatInput->setText(*mCurHist);
+ mChatInput->setCaretPosition(mChatInput->getText().length());
+ }
+ else {
+ mCurHist = prevHist;
+ }
}
else if (event.getKey().getValue() == gcn::Key::UP &&
- mCurHist != mHistory.begin() && mHistory.size() > 0)
+ mCurHist != mHistory.begin() && mHistory.size() > 0)
{
- // Move backward through the history
- mCurHist--;
- mChatInput->setText(*mCurHist);
- mChatInput->setCaretPosition(mChatInput->getText().length());
+ // Move backward through the history
+ mCurHist--;
+ mChatInput->setText(*mCurHist);
+ mChatInput->setCaretPosition(mChatInput->getText().length());
}
}
@@ -469,3 +638,138 @@ ChatWindow::setVisible(bool isVisible)
mTmpVisible = false;
}
+void
+ChatWindow::party(const std::string &command, const std::string &rest)
+{
+ if (command == "prefix")
+ {
+ if (rest == "")
+ {
+ char temp[2] = ".";
+ *temp = mPartyPrefix;
+ chatLog("The current party prefix is " + std::string(temp),
+ BY_SERVER);
+ return;
+ }
+ if (rest.length() != 1)
+ {
+ chatLog("Party prefix must be one character long.", BY_SERVER);
+ }
+ else
+ {
+ if (rest == "/")
+ {
+ chatLog("Cannot use a '/' as the prefix.", BY_SERVER);
+ }
+ else
+ {
+ mPartyPrefix = rest.at(0);
+ chatLog("Changing prefix to " + rest, BY_SERVER);
+ }
+ }
+ return;
+ }
+ mParty->respond(command, rest);
+}
+
+void
+ChatWindow::help(const std::string &msg1, const std::string &msg2)
+{
+ chatLog("-- Help --", BY_SERVER);
+ if (msg1 == "")
+ {
+ chatLog("/announce: Global announcement (GM only)", BY_SERVER);
+ chatLog("/clear: Clears this window", BY_SERVER);
+ chatLog("/help: Display this help.", BY_SERVER);
+ mParty->help();
+ chatLog("/present: Get list of players present", BY_SERVER);
+ mRecorder->help();
+ chatLog("/toggle: Determine whether <return> toggles the chat log.",
+ BY_SERVER);
+ chatLog("/where: Display map name", BY_SERVER);
+ chatLog("/whisper <nick> <message>: Sends a private <message>"
+ " to <nick>", BY_SERVER);
+ chatLog("/who: Display number of online users", BY_SERVER);
+ chatLog("For more information, type /help <command>", BY_SERVER);
+ return;
+ }
+ if (msg1 == "announce")
+ {
+ chatLog("Command: /announce <msg>", BY_SERVER);
+ chatLog("*** only available to a GM ***", BY_SERVER);
+ chatLog("This command sends the message <msg> to "
+ "all players currently online.", BY_SERVER);
+ return;
+ }
+ if (msg1 == "clear")
+ {
+ chatLog("Command: /clear", BY_SERVER);
+ chatLog("This command clears the chat log of previous chat.",
+ BY_SERVER);
+ return;
+ }
+ if (msg1 == "help")
+ {
+ chatLog("Command: /help", BY_SERVER);
+ chatLog("This command displays a list of all commands available.",
+ BY_SERVER);
+ chatLog("Command: /help <command>", BY_SERVER);
+ chatLog("This command displays help on <command>.", BY_SERVER);
+ return;
+ }
+ if (msg1 == "party")
+ {
+ mParty->help(msg2);
+ return;
+ }
+ if (msg1 == "present")
+ {
+ chatLog("Command: /present", BY_SERVER);
+ chatLog("This command gets a list of players within hearing "
+ "and sends it to either the record log if recording, or the "
+ "chat log otherwise.", BY_SERVER);
+ return;
+ }
+ if (msg1 == "record")
+ {
+ mRecorder->help(msg2);
+ return;
+ }
+ if (msg1 == "toggle")
+ {
+ chatLog("Command: /toggle <state>", BY_SERVER);
+ chatLog("This command sets whether the return key should toggle the "
+ "chat log, or whether the chat log turns off automatically.",
+ BY_SERVER);
+ chatLog("<state> can be one of \"1\", \"yes\", \"true\" to turn "
+ "the toggle on, or \"0\", \"no\", \"false\" to turn the "
+ "toggle off.", BY_SERVER);
+ chatLog("Command: /toggle", BY_SERVER);
+ chatLog("This command displays the return toggle status.", BY_SERVER);
+ return;
+ }
+ if (msg1 == "where")
+ {
+ chatLog("Command: /where", BY_SERVER);
+ chatLog("This command displays the name of the current map.",
+ BY_SERVER);
+ return;
+ }
+ if (msg1 == "whisper")
+ {
+ chatLog("Command: /whisper <nick> <msg>", BY_SERVER);
+ chatLog("This command sends the message <msg> to <nick.", BY_SERVER);
+ chatLog("If the <nick> has spaces in it, enclose it in "
+ "double quotes (\").", BY_SERVER);
+ return;
+ }
+ if (msg1 == "who")
+ {
+ chatLog("Command: /who", BY_SERVER);
+ chatLog("This command displays the number of players currently "
+ "online.", BY_SERVER);
+ return;
+ }
+ chatLog("Unknown command.", BY_SERVER);
+ chatLog("Type /help for a list of commands.", BY_SERVER);
+}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 0bdc76f1..5e5ca110 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chat.h 4227 2008-05-08 00:39:29Z peaveydk $
*/
#ifndef _TMW_CHAT_H
@@ -26,6 +26,7 @@
#include <list>
#include <string>
+#include <fstream>
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
@@ -37,29 +38,19 @@
class BrowserBox;
class Network;
class ScrollArea;
+class Recorder;
+class Party;
#define BY_GM 0 // those should be self-explanatory =)
#define BY_PLAYER 1
#define BY_OTHER 2
#define BY_SERVER 3
+#define BY_PARTY 4
-#define ACT_WHISPER 4 // getting whispered at
-#define ACT_IS 5 // equivalent to "/me" on IRC
+#define ACT_WHISPER 5 // getting whispered at
+#define ACT_IS 6 // equivalent to "/me" on IRC
-#define BY_LOGGER 6
-
-#define IS_ANNOUNCE "/announce "
-#define IS_ANNOUNCE_LENGTH 10
-#define IS_HELP "/help"
-#define IS_HELP_LENGTH 5
-#define IS_WHERE "/where"
-#define IS_WHERE_LENGTH 6
-#define IS_WHO "/who"
-#define IS_WHO_LENGTH 4
-#define IS_CLEAR "/clear"
-#define IS_CLEAR_LENGTH 6
-#define IS_WHISPER "/whisper"
-#define IS_WHISPER_LENGTH 8
+#define BY_LOGGER 7
/**
* gets in between usernick and message text depending on
@@ -118,121 +109,150 @@ struct CHATSKILL
* \ingroup Interface
*/
class ChatWindow : public Window, public gcn::ActionListener,
- public gcn::KeyListener
+ public gcn::KeyListener
{
public:
- /**
- * Constructor.
- */
- ChatWindow(Network *network);
-
- /**
- * Logic (updates components' size)
- */
- void logic();
-
- /*
- * Adds a line of text to our message list. Parameters:
- *
- * @param line Text message.
- * @parem own Type of message (usually the owner-type).
- */
- void chatLog(std::string line, int own);
-
- /*
- * Calls original chat_log() after processing the packet.
- */
- void chatLog(CHATSKILL);
-
- /**
- * Performs action.
- */
- void action(const gcn::ActionEvent &event);
-
- /**
- * Request focus for typing chat message.
- */
- void requestChatFocus();
-
- /**
- * Checks whether ChatWindow is Focused or not.
- */
- bool isInputFocused();
-
- /**
- * Determines whether to send a command or an ordinary message, then
- * contructs packets & sends them.
- *
- * @param nick The character's name to display in front.
- * @param msg The message text which is to be send.
- *
- * NOTE:
- * The nickname is required by the server, if not specified
- * the message may not be sent unless a command was intended
- * which requires another packet to be constructed! you can
- * achieve this by putting a slash ("/") infront of the
- * message followed by the command name and the message.
- * of course all slash-commands need implemented handler-
- * routines. ;-)
- * remember, a line starting with "@" is not a command that needs
- * to be parsed rather is sent using the normal chat-packet.
- *
- * EXAMPLE:
- * // for an global announcement /- command
- * chatlog.chat_send("", "/announce Hello to all logged in users!");
- * // for simple message by a user /- message
- * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!");
- */
- void
- chatSend(const std::string &nick, std::string msg);
-
- /** Called when key is pressed */
- void
- keyPressed(gcn::KeyEvent &event);
-
- /** Called to set current text */
- void
- setInputText(std::string input_str);
-
- /** Override to reset mTmpVisible */
- void
- setVisible(bool visible);
+ /**
+ * Constructor.
+ */
+ ChatWindow(Network *network);
+
+ /**
+ * Destructor: used to write back values to the config file
+ */
+ ~ChatWindow();
+
+ /**
+ * Logic (updates components' size)
+ */
+ void logic();
+
+ /**
+ * Adds a line of text to our message list. Parameters:
+ *
+ * @param line Text message.
+ * @parem own Type of message (usually the owner-type).
+ */
+ void chatLog(std::string line, int own, bool ignoreRecord = false);
+
+ /**
+ * Calls original chat_log() after processing the packet.
+ */
+ void chatLog(CHATSKILL);
+
+ /**
+ * Performs action.
+ */
+ void action(const gcn::ActionEvent &event);
+
+ /**
+ * Request focus for typing chat message.
+ */
+ void requestChatFocus();
+
+ /**
+ * Checks whether ChatWindow is Focused or not.
+ */
+ bool isInputFocused();
+
+ /**
+ * Determines whether to send a command or an ordinary message, then
+ * contructs packets & sends them.
+ *
+ * @param nick The character's name to display in front.
+ * @param msg The message text which is to be send.
+ *
+ * NOTE:
+ * The nickname is required by the server, if not specified
+ * the message may not be sent unless a command was intended
+ * which requires another packet to be constructed! you can
+ * achieve this by putting a slash ("/") infront of the
+ * message followed by the command name and the message.
+ * of course all slash-commands need implemented handler-
+ * routines. ;-)
+ * remember, a line starting with "@" is not a command that needs
+ * to be parsed rather is sent using the normal chat-packet.
+ *
+ * EXAMPLE:
+ * // for an global announcement /- command
+ * chatlog.chat_send("", "/announce Hello to all logged in users!");
+ * // for simple message by a user /- message
+ * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!");
+ */
+ void
+ chatSend(const std::string &nick, std::string msg);
+
+ /** Called when key is pressed */
+ void
+ keyPressed(gcn::KeyEvent &event);
+
+ /** Called to set current text */
+ void
+ setInputText(std::string input_str);
+
+ /** Override to reset mTmpVisible */
+ void
+ setVisible(bool visible);
/**
- * Scrolls the chat window
- *
- * @param amount direction and amount to scroll. Negative numbers scroll
- * up, positive numbers scroll down. The absolute amount indicates the
- * amount of 1/8ths of chat window real estate that should be scrolled.
- */
- void
- scroll(int amount);
+ * Scrolls the chat window
+ *
+ * @param amount direction and amount to scroll. Negative numbers scroll
+ * up, positive numbers scroll down. The absolute amount indicates the
+ * amount of 1/8ths of chat window real estate that should be scrolled.
+ */
+ void
+ scroll(int amount);
+
+ /**
+ * party implements the partying chat commands
+ *
+ * @param command is the party command to perform
+ * @param msg is the remainder of the message
+ */
+ void
+ party(const std::string &command, const std::string &msg);
+
+ /**
+ * help implements the /help command
+ *
+ * @param msg1 is the command that the player needs help on
+ * @param msg2 is the sub-command relating to the command
+ */
+ void
+ help(const std::string &msg1, const std::string &msg2);
private:
- Network *mNetwork;
- bool mTmpVisible;
-
- /** One item in the chat log */
- struct CHATLOG
- {
- std::string nick;
- std::string text;
- int own;
- };
-
- /** Constructs failed messages for actions */
- std::string const_msg(CHATSKILL);
-
- gcn::TextField *mChatInput; /**< Input box for typing chat messages */
- BrowserBox *mTextOutput; /**< Text box for displaying chat history */
- ScrollArea *mScrollArea; /**< Scroll area around text output */
-
- typedef std::list<std::string> History;
- typedef History::iterator HistoryIterator;
- History mHistory; /**< Command history */
- HistoryIterator mCurHist; /**< History iterator */
-};
+ Network *mNetwork;
+ bool mTmpVisible;
+
+ /** One item in the chat log */
+ struct CHATLOG
+ {
+ std::string nick;
+ std::string text;
+ int own;
+ };
+
+ /** Constructs failed messages for actions */
+ std::string const_msg(CHATSKILL);
+
+ gcn::TextField *mChatInput; /**< Input box for typing chat messages */
+ BrowserBox *mTextOutput; /**< Text box for displaying chat history */
+ ScrollArea *mScrollArea; /**< Scroll area around text output */
+
+ typedef std::list<std::string> History;
+ typedef History::iterator HistoryIterator;
+ History mHistory; /**< Command history */
+ HistoryIterator mCurHist; /**< History iterator */
+ Recorder *mRecorder; /**< Recording class */
+ char mPartyPrefix; /**< Messages beginning with the prefix are sent to
+ the party */
+ bool mReturnToggles; /**< Marks whether <Return> toggles the chat log
+ or not */
+ Party *mParty;
+};
extern ChatWindow *chatWindow;
#endif
diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp
index fc5d6aab..b403a03e 100644
--- a/src/gui/chatinput.cpp
+++ b/src/gui/chatinput.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chatinput.cpp 3361 2007-07-07 20:12:58Z b_lindeijer $
*/
#include "chatinput.h"
diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h
index da2342ae..6ac8c1a5 100644
--- a/src/gui/chatinput.h
+++ b/src/gui/chatinput.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chatinput.h 3361 2007-07-07 20:12:58Z b_lindeijer $
*/
#ifndef _TMW_CHATINPUT_H
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 5b300d33..b530bbea 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: checkbox.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "checkbox.h"
diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h
index 262e63ae..36083390 100644
--- a/src/gui/checkbox.h
+++ b/src/gui/checkbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: checkbox.h 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#ifndef _TMW_CHECKBOX_H
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index 0ff8be17..5b700831 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: confirm_dialog.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "confirm_dialog.h"
diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h
index 8728f83f..3115485d 100644
--- a/src/gui/confirm_dialog.h
+++ b/src/gui/confirm_dialog.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: confirm_dialog.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_OPTION_DIALOG_H
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index baa1ea34..0b62ca3c 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: connection.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "connection.h"
diff --git a/src/gui/connection.h b/src/gui/connection.h
index 7a072d2e..86b688a3 100644
--- a/src/gui/connection.h
+++ b/src/gui/connection.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: connection.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_CONNECTION_H
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index d6d99307..1e7d5b35 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: debugwindow.cpp 3509 2007-08-23 13:43:17Z b_lindeijer $
*/
#include "debugwindow.h"
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 9b6f2017..59ae765c 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: debugwindow.h 3509 2007-08-23 13:43:17Z b_lindeijer $
*/
#ifndef _TMW_DEBUGWINDOW_H
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 93b9ea37..564486aa 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipmentwindow.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "equipmentwindow.h"
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 99a3cc60..0cb5cb24 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipmentwindow.h 2545 2006-08-17 19:11:28Z crush_tmw $
*/
#ifndef _TMW_EQUIPMENT_H
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index ffdb7896..966d2013 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: focushandler.cpp 2239 2006-03-09 05:16:27Z der_doener $
*/
#include "focushandler.h"
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index 252fdd9d..5fde09f1 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: focushandler.h 2239 2006-03-09 05:16:27Z der_doener $
*/
#ifndef _TMW_FOCUSHANDLER_H
diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp
index 1edb4daf..8095be61 100644
--- a/src/gui/gccontainer.cpp
+++ b/src/gui/gccontainer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: gccontainer.cpp 4208 2008-04-29 11:25:26Z b_lindeijer $
*/
#include "gccontainer.h"
diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h
index 8b8a7ffe..6c6bee80 100644
--- a/src/gui/gccontainer.h
+++ b/src/gui/gccontainer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: gccontainer.h 4208 2008-04-29 11:25:26Z b_lindeijer $
*/
#ifndef _TMW_GUI_GCCONTAINER_H
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index db0b9f80..e56afc76 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: gui.cpp 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#include "gui.h"
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 1e4b9348..d2a832c7 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: gui.h 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#ifndef _TMW_GUI
diff --git a/src/gui/hbox.cpp b/src/gui/hbox.cpp
index 69564fbb..dc909195 100644
--- a/src/gui/hbox.cpp
+++ b/src/gui/hbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: hbox.cpp 1881 2005-10-18 21:40:25Z der_doener $
*/
#include "hbox.h"
diff --git a/src/gui/hbox.h b/src/gui/hbox.h
index 560b1a29..99364866 100644
--- a/src/gui/hbox.h
+++ b/src/gui/hbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: hbox.h 1881 2005-10-18 21:40:25Z der_doener $
*/
#ifndef HBOX_H
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index 0b010253..56a5e70e 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: help.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "help.h"
diff --git a/src/gui/help.h b/src/gui/help.h
index 3c3715a0..3b45283c 100644
--- a/src/gui/help.h
+++ b/src/gui/help.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: help.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_HELP_H
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp
index 2a09f255..7a39c2df 100644
--- a/src/gui/inttextbox.cpp
+++ b/src/gui/inttextbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inttextbox.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "inttextbox.h"
diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h
index b5d339ac..64351f48 100644
--- a/src/gui/inttextbox.h
+++ b/src/gui/inttextbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inttextbox.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef INTTEXTBOX_H
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index fcc602f9..b53fa43b 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventorywindow.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "inventorywindow.h"
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index d45602d2..4793069c 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventorywindow.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_INVENTORYWINDOW_H
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index f72462f9..40e2e121 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: item_amount.cpp 3718 2007-11-11 14:46:33Z b_lindeijer $
*/
#include "item_amount.h"
diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h
index 67002703..668dfe3b 100644
--- a/src/gui/item_amount.h
+++ b/src/gui/item_amount.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: item_amount.h 3718 2007-11-11 14:46:33Z b_lindeijer $
*/
#ifndef _TMW_ITEM_AMOUNT_WINDOW_H
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index cf5dcb92..ce7337d2 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemcontainer.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "itemcontainer.h"
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index db8c6f3d..353ac51d 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemcontainer.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_ITEMCONTAINER_H__
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index 0ce4f6b7..5899abd1 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcutcontainer.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "itemshortcutcontainer.h"
diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h
index 58f0aea7..7698755b 100644
--- a/src/gui/itemshortcutcontainer.h
+++ b/src/gui/itemshortcutcontainer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcutcontainer.h 4076 2008-04-12 18:36:15Z b_lindeijer $
*/
#ifndef _TMW_ITEMSHORTCUTCONTAINER_H__
diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp
index 3724516a..31f3bf4e 100644
--- a/src/gui/itemshortcutwindow.cpp
+++ b/src/gui/itemshortcutwindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcutwindow.cpp 4076 2008-04-12 18:36:15Z b_lindeijer $
*/
#include "itemshortcutwindow.h"
diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h
index 9742abdc..5f7ba3d7 100644
--- a/src/gui/itemshortcutwindow.h
+++ b/src/gui/itemshortcutwindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcutwindow.h 4076 2008-04-12 18:36:15Z b_lindeijer $
*/
#ifndef _TMW_ITEMSHORTCUTWINDOW_H
diff --git a/src/gui/linkhandler.h b/src/gui/linkhandler.h
index 3a32f825..93a8c000 100644
--- a/src/gui/linkhandler.h
+++ b/src/gui/linkhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: linkhandler.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_LINK_HANDLER_H_
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 634afa07..cf941be1 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: listbox.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "listbox.h"
diff --git a/src/gui/listbox.h b/src/gui/listbox.h
index b226a11e..ec95734d 100644
--- a/src/gui/listbox.h
+++ b/src/gui/listbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: listbox.h 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#ifndef _TMW_LISTBOX_H
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index d85f4e83..526a8e8f 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: login.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "login.h"
@@ -29,12 +29,19 @@
#include "../main.h"
#include "../logindata.h"
+#include "../configuration.h"
#include "button.h"
#include "checkbox.h"
#include "ok_dialog.h"
#include "passwordfield.h"
#include "textfield.h"
+#include "../utils/tostring.h"
+
+static const int MAX_SERVER_LIST_SIZE = 5;
+static const int LOGIN_DIALOG_WIDTH = 220;
+static const int LOGIN_DIALOG_HEIGHT = 140;
+static const int FIELD_WIDTH = LOGIN_DIALOG_WIDTH - 70;
LoginDialog::LoginDialog(LoginData *loginData):
Window("Login"), mLoginData(loginData)
@@ -42,59 +49,89 @@ LoginDialog::LoginDialog(LoginData *loginData):
gcn::Label *userLabel = new gcn::Label("Name:");
gcn::Label *passLabel = new gcn::Label("Password:");
gcn::Label *serverLabel = new gcn::Label("Server:");
+ gcn::Label *portLabel = new gcn::Label("Port:");
+ mServerList = new DropDownList("MostRecent00",
+ "216.139.126.36",
+ "6901",
+ MAX_SERVER_LIST_SIZE);
+ mServerListBox = new gcn::ListBox(mServerList);
+ mServerScrollArea = new ScrollArea();
+
mUserField = new TextField(mLoginData->username);
mPassField = new PasswordField(mLoginData->password);
- mServerField = new TextField(mLoginData->hostname);
+ mServerField = new TextField(mServerList->getServerAt(0));
+ mPortField = new TextField(mServerList->getPortAt(0));
+ mServerDropDown = new DropDown(mServerList,
+ mServerScrollArea,
+ mServerListBox);
+
mKeepCheck = new CheckBox("Keep", mLoginData->remember);
mOkButton = new Button("OK", "ok", this);
mCancelButton = new Button("Cancel", "cancel", this);
mRegisterButton = new Button("Register", "register", this);
- const int width = 220;
- const int height = 100;
-
- setContentSize(width, height);
-
- userLabel->setPosition(5, 5);
- passLabel->setPosition(5, 14 + userLabel->getHeight());
- serverLabel->setPosition(
- 5, 23 + userLabel->getHeight() + passLabel->getHeight());
- mUserField->setPosition(65, 5);
- mPassField->setPosition(65, 14 + userLabel->getHeight());
- mServerField->setPosition(
- 65, 23 + userLabel->getHeight() + passLabel->getHeight());
- mUserField->setWidth(width - 70);
- mPassField->setWidth(width - 70);
- mServerField->setWidth(width - 70);
- mKeepCheck->setPosition(4, 77);
+ setContentSize(LOGIN_DIALOG_WIDTH, LOGIN_DIALOG_HEIGHT);
+
+ const int USER_TOP = 5;
+ userLabel->setPosition(5, USER_TOP);
+ mUserField->setPosition(65, USER_TOP);
+ mUserField->setWidth(FIELD_WIDTH);
+
+ const int PASS_TOP = 9 + USER_TOP + userLabel->getHeight();
+ passLabel->setPosition(5, PASS_TOP);
+ mPassField->setPosition(65, PASS_TOP);
+ mPassField->setWidth(FIELD_WIDTH);
+
+ const int SERVER_TOP = 9 + PASS_TOP + passLabel->getHeight();
+ serverLabel->setPosition(5, SERVER_TOP);
+ mServerField->setPosition(65, SERVER_TOP);
+ mServerField->setWidth(FIELD_WIDTH);
+
+ const int PORT_TOP = 9 + SERVER_TOP + serverLabel->getHeight();
+ portLabel->setPosition(5, PORT_TOP);
+ mPortField->setPosition(65, PORT_TOP);
+ mPortField->setWidth(FIELD_WIDTH);
+
+ const int DROP_DOWN_TOP = 9 + PORT_TOP + serverLabel->getHeight();
+ mServerDropDown->setPosition(5, DROP_DOWN_TOP);
+ mServerDropDown->setWidth(FIELD_WIDTH);
+
+ const int REST_TOP = LOGIN_DIALOG_HEIGHT - mCancelButton->getHeight() - 5;
+
+ mKeepCheck->setPosition(4, REST_TOP);
mCancelButton->setPosition(
- width - mCancelButton->getWidth() - 5,
- height - mCancelButton->getHeight() - 5);
+ LOGIN_DIALOG_WIDTH - mCancelButton->getWidth() - 5, REST_TOP);
mOkButton->setPosition(
- mCancelButton->getX() - mOkButton->getWidth() - 5,
- height - mOkButton->getHeight() - 5);
+ mCancelButton->getX() - mOkButton->getWidth() - 5, REST_TOP);
mRegisterButton->setPosition(
- mKeepCheck->getX() + mKeepCheck->getWidth() + 10,
- height - mRegisterButton->getHeight() - 5);
+ mKeepCheck->getX() + mKeepCheck->getWidth() + 10, REST_TOP);
mUserField->setActionEventId("ok");
mPassField->setActionEventId("ok");
mServerField->setActionEventId("ok");
+ mServerDropDown->setActionEventId("changeSelection");
mUserField->addKeyListener(this);
mPassField->addKeyListener(this);
mServerField->addKeyListener(this);
+ mPortField->addKeyListener(this);
+ mServerDropDown->addKeyListener(this);
mUserField->addActionListener(this);
mPassField->addActionListener(this);
mServerField->addActionListener(this);
+ mPortField->addActionListener(this);
+ mServerDropDown->addActionListener(this);
mKeepCheck->addActionListener(this);
add(userLabel);
add(passLabel);
add(serverLabel);
+ add(portLabel);
add(mUserField);
add(mPassField);
add(mServerField);
+ add(mPortField);
+ add(mServerDropDown);
add(mKeepCheck);
add(mOkButton);
add(mCancelButton);
@@ -114,6 +151,9 @@ LoginDialog::LoginDialog(LoginData *loginData):
LoginDialog::~LoginDialog()
{
+ delete mServerList;
+ delete mServerListBox;
+ delete mServerScrollArea;
}
void
@@ -122,6 +162,7 @@ LoginDialog::action(const gcn::ActionEvent &event)
if (event.getId() == "ok" && canSubmit())
{
mLoginData->hostname = mServerField->getText();
+ mLoginData->port = getUShort(mPortField->getText());
mLoginData->username = mUserField->getText();
mLoginData->password = mPassField->getText();
mLoginData->remember = mKeepCheck->isSelected();
@@ -129,9 +170,15 @@ LoginDialog::action(const gcn::ActionEvent &event)
mOkButton->setEnabled(false);
mRegisterButton->setEnabled(false);
-
+ mServerList->save(mServerField->getText(), mPortField->getText());
state = ACCOUNT_STATE;
}
+ else if (event.getId() == "changeSelection")
+ {
+ int selected = mServerListBox->getSelected();
+ mServerField->setText(mServerList->getServerAt(selected));
+ mPortField->setText(mServerList->getPortAt(selected));
+ }
else if (event.getId() == "cancel")
{
state = EXIT_STATE;
@@ -140,6 +187,14 @@ LoginDialog::action(const gcn::ActionEvent &event)
{
// Transfer these fields on to the register dialog
mLoginData->hostname = mServerField->getText();
+ if (isUShort(mPortField->getText()))
+ {
+ mLoginData->port = getUShort(mPortField->getText());
+ }
+ else
+ {
+ mLoginData->port = 6901;
+ }
mLoginData->username = mUserField->getText();
mLoginData->password = mPassField->getText();
@@ -159,5 +214,148 @@ LoginDialog::canSubmit()
return !mUserField->getText().empty() &&
!mPassField->getText().empty() &&
!mServerField->getText().empty() &&
+ isUShort(mPortField->getText()) &&
state == LOGIN_STATE;
}
+
+bool
+LoginDialog::isUShort(const std::string &str)
+{
+ if (str == "")
+ {
+ return false;
+ }
+ unsigned long l = 0;
+ for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
+ strPtr != strEnd; ++strPtr)
+ {
+ if (*strPtr < '0' || *strPtr > '9')
+ {
+ return false;
+ }
+ l = l * 10 + (*strPtr - '0'); // *strPtr - '0' will never be negative
+ if (l > 65535)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+unsigned short
+LoginDialog::getUShort(const std::string &str)
+{
+ unsigned long l = 0;
+ for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
+ strPtr != strEnd; ++strPtr)
+ {
+ l = l * 10 + (*strPtr - '0');
+ }
+ return static_cast<unsigned short>(l);
+}
+
+/**
+ * LoginDialog::DropDownList
+ */
+
+void
+LoginDialog::DropDownList::saveEntry(const std::string &server,
+ const std::string &port, int &saved)
+{
+ if (saved < MAX_SERVER_LIST_SIZE && server != "")
+ {
+ config.setValue(mConfigPrefix + "Server" + toString(saved), server);
+ config.setValue(mConfigPrefix + "Port" + toString(saved), port);
+ ++saved;
+ }
+}
+
+LoginDialog::DropDownList::DropDownList(std::string prefix,
+ std::string dflt,
+ std::string dfltPort,
+ int maxEntries) :
+ mConfigPrefix(prefix),
+ mMaxEntries(maxEntries)
+{
+ for (int i = 0; i < maxEntries; ++i)
+ {
+ std::string server = config.getValue(mConfigPrefix + "Server" +
+ toString(i), "");
+ if (server == "") // Just in case had original config entries
+ {
+ server = config.getValue(mConfigPrefix + "ServerList" +
+ toString(i), "");
+ }
+ std::string port = config.getValue(mConfigPrefix + "Port" +
+ toString(i), dfltPort);
+
+ if (server != "")
+ {
+ mServers.push_back(server);
+ mPorts.push_back(port);
+ }
+ }
+ if (mServers.size() == 0)
+ {
+ mServers.push_back(dflt);
+ mPorts.push_back(dfltPort);
+ }
+
+}
+
+void
+LoginDialog::DropDownList::save(const std::string &server,
+ const std::string &port)
+{
+ int position = 0;
+ saveEntry(server, port, position);
+ for (std::vector<std::string>::const_iterator sPtr = mServers.begin(),
+ sEnd = mServers.end(),
+ pPtr = mPorts.begin(),
+ pEnd = mPorts.end();
+ sPtr != sEnd && pPtr != pEnd;
+ ++sPtr, ++pPtr)
+ {
+ if (*sPtr != server || *pPtr != port)
+ {
+ saveEntry(*sPtr, *pPtr, position);
+ }
+ }
+}
+
+int
+LoginDialog::DropDownList::getNumberOfElements()
+{
+ return mServers.size();
+}
+
+std::string
+LoginDialog::DropDownList::getElementAt(int i)
+{
+ if (i < 0 || i >= getNumberOfElements())
+ {
+ return "";
+ }
+ return getServerAt(i) + ":" + getPortAt(i);
+}
+
+std::string
+LoginDialog::DropDownList::getServerAt(int i)
+{
+ if (i < 0 || i >= getNumberOfElements())
+ {
+ return "";
+ }
+ return mServers.at(i);
+}
+
+
+std::string
+LoginDialog::DropDownList::getPortAt(int i)
+{
+ if (i < 0 || i >= getNumberOfElements())
+ {
+ return "";
+ }
+ return mPorts.at(i);
+}
diff --git a/src/gui/login.h b/src/gui/login.h
index e08120cb..8a228b5f 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -18,18 +18,23 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: login.h 3234 2007-03-24 13:05:27Z b_lindeijer $
*/
#ifndef _TMW_LOGIN_H
#define _TMW_LOGIN_H
#include <iosfwd>
+#include <vector>
+#include <string>
+
#include <guichan/actionlistener.hpp>
#include <guichan/keylistener.hpp>
#include "window.h"
#include "../guichanfwd.h"
+#include "widgets/dropdown.h"
+#include "scrollarea.h"
class LoginData;
@@ -72,15 +77,66 @@ class LoginDialog : public Window, public gcn::ActionListener,
bool
canSubmit();
+ /**
+ * Function to decide whether string is an unsigned short or not
+ *
+ * @param str the string to parse
+ *
+ * @return true is str is an unsigned short, false otherwise
+ */
+ static bool
+ isUShort(const std::string &str);
+
+ /**
+ * Converts string to an unsigned short (undefined if invalid)
+ *
+ * @param str the string to parse
+ *
+ * @return the value str represents
+ */
+ static unsigned short
+ getUShort(const std::string &str);
+
+ DropDown *mServerDropDown;
gcn::TextField *mUserField;
gcn::TextField *mPassField;
gcn::TextField *mServerField;
+ gcn::TextField *mPortField;
gcn::CheckBox *mKeepCheck;
gcn::Button *mOkButton;
gcn::Button *mCancelButton;
gcn::Button *mRegisterButton;
LoginData *mLoginData;
+
+ /**
+ * Helper class to keep a list of all the recent entries for the
+ * dropdown
+ */
+ class DropDownList : public gcn::ListModel
+ {
+ private:
+ std::vector<std::string> mServers;
+ std::vector<std::string> mPorts;
+ std::string mConfigPrefix;
+ int mMaxEntries;
+ void saveEntry(const std::string &server,
+ const std::string &port, int &saved);
+ public:
+ DropDownList(std::string prefix,
+ std::string dfltServer,
+ std::string dfltPort,
+ int maxEntries);
+ void save(const std::string &server, const std::string &port);
+ int getNumberOfElements();
+ std::string getElementAt(int i);
+ std::string getServerAt(int i);
+ std::string getPortAt(int i);
+ };
+ DropDownList *mServerList;
+ gcn::ListBox *mServerListBox;
+ ScrollArea *mServerScrollArea;
+
};
#endif
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index 2043b7d1..c3af6896 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: menuwindow.cpp 4060 2008-04-09 14:49:07Z b_lindeijer $
*/
#include "menuwindow.h"
diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h
index f43b9921..add04095 100644
--- a/src/gui/menuwindow.h
+++ b/src/gui/menuwindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: menuwindow.h 2417 2006-07-19 15:12:06Z umperio $
*/
#ifndef _TMW_MENU_H
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index c17fa06b..dc7df9b9 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: minimap.cpp 4116 2008-04-17 12:48:43Z peaveydk $
*/
#include "minimap.h"
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
index 5e9458bf..d2640caa 100644
--- a/src/gui/minimap.h
+++ b/src/gui/minimap.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: minimap.h 2417 2006-07-19 15:12:06Z umperio $
*/
#ifndef _TMW_MINIMAP_H
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 8f121368..3a7e7bf0 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ministatus.cpp 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#include "ministatus.h"
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 718fe140..d4002d93 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ministatus.h 2581 2006-08-25 22:04:17Z b_lindeijer $
*/
#ifndef _TMW_MINISTATUS_H
diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp
index 6783a546..c2088e75 100644
--- a/src/gui/newskill.cpp
+++ b/src/gui/newskill.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: newskill.cpp 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
/* This file implements the new skill dialog for use under the latest
diff --git a/src/gui/newskill.h b/src/gui/newskill.h
index 6e12169f..c553ab1d 100644
--- a/src/gui/newskill.h
+++ b/src/gui/newskill.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: newskill.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_NSKILL_H
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 7b4fc634..52f35a88 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npc_text.cpp 4096 2008-04-16 08:39:59Z b_lindeijer $
*/
#include "npc_text.h"
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index 0ef1b938..9e2b4ecd 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npc_text.h 4096 2008-04-16 08:39:59Z b_lindeijer $
*/
#ifndef _TMW_NPC_TEXT_H
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index 1bcdc8ff..e6523583 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npclistdialog.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "npclistdialog.h"
diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h
index c09b0a8c..a96fd766 100644
--- a/src/gui/npclistdialog.h
+++ b/src/gui/npclistdialog.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npclistdialog.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_GUI_NPCLISTDIALOG_H
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index ca9d2a7b..c49bb6bb 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ok_dialog.cpp 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#include "ok_dialog.h"
diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h
index a7b24a90..1c8e0c18 100644
--- a/src/gui/ok_dialog.h
+++ b/src/gui/ok_dialog.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ok_dialog.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _OK_DIALOG_H
diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp
index 533f54fb..710eb767 100644
--- a/src/gui/passwordfield.cpp
+++ b/src/gui/passwordfield.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: passwordfield.cpp 2132 2006-02-01 14:53:10Z der_doener $
*/
#include "passwordfield.h"
diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h
index cae1f92e..725bfbcf 100644
--- a/src/gui/passwordfield.h
+++ b/src/gui/passwordfield.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: passwordfield.h 2895 2006-12-09 01:44:18Z b_lindeijer $
*/
#ifndef _TMW_PASSWORDFIELD_H_
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 2c633b72..6d39ce05 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: playerbox.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index c226e750..0aa48a2c 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: playerbox.h 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#ifndef __TMW_PLAYERBOX_H__
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index cdc998e0..7e40abed 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: popupmenu.cpp 4243 2008-05-16 15:48:52Z the_enemy $
*/
#include "popupmenu.h"
@@ -40,6 +40,9 @@
#include "../npc.h"
#include "../player_relations.h"
+#include "../net/messageout.h"
+#include "../net/protocol.h"
+
#include "../resources/iteminfo.h"
#include "../resources/itemdb.h"
@@ -70,49 +73,53 @@ void PopupMenu::showPopup(int x, int y, Being *being)
switch (mBeing->getType())
{
- case Being::PLAYER:
- {
- // Players can be traded with. Later also attack, follow and
- // add as buddy will be options in this menu.
- const std::string &name = mBeing->getName();
- mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
- mBrowserBox->addRow("@@attack|Attack " + name + "@@");
-
- mBrowserBox->addRow("##3---");
-
- switch (player_relations.getRelation(name)) {
- case PlayerRelation::NEUTRAL:
- mBrowserBox->addRow("@@friend|Befriend " + name + "@@");
-
- case PlayerRelation::FRIEND:
- mBrowserBox->addRow("@@disregard|Disregard " + name + "@@");
- mBrowserBox->addRow("@@ignore|Ignore " + name + "@@");
- break;
-
- case PlayerRelation::DISREGARDED:
- mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
- mBrowserBox->addRow("@@ignore|Completely ignore " + name + "@@");
- break;
-
- case PlayerRelation::IGNORED:
- mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
- break;
- }
-
- //mBrowserBox->addRow("@@follow|Follow " + name + "@@");
- //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
- }
- break;
-
- case Being::NPC:
- // NPCs can be talked to (single option, candidate for removal
- // unless more options would be added)
- mBrowserBox->addRow("@@talk|Talk To NPC@@");
- break;
-
- default:
- /* Other beings aren't interesting... */
- break;
+ case Being::PLAYER:
+ {
+ // Players can be traded with. Later also attack, follow and
+ // add as buddy will be options in this menu.
+ const std::string &name = mBeing->getName();
+ mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
+ mBrowserBox->addRow("@@attack|Attack " + name + "@@");
+
+ mBrowserBox->addRow("##3---");
+
+ switch (player_relations.getRelation(name)) {
+ case PlayerRelation::NEUTRAL:
+ mBrowserBox->addRow("@@friend|Befriend " + name + "@@");
+
+ case PlayerRelation::FRIEND:
+ mBrowserBox->addRow("@@disregard|Disregard " + name + "@@");
+ mBrowserBox->addRow("@@ignore|Ignore " + name + "@@");
+ break;
+
+ case PlayerRelation::DISREGARDED:
+ mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
+ mBrowserBox->addRow("@@ignore|Completely ignore " + name + "@@");
+ break;
+
+ case PlayerRelation::IGNORED:
+ mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
+ break;
+ }
+
+ //mBrowserBox->addRow("@@follow|Follow " + name + "@@");
+ //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
+
+ mBrowserBox->addRow("##3---");
+ mBrowserBox->addRow("@@party-invite|Invite " + name +
+ " to party@@");
+ }
+ break;
+
+ case Being::NPC:
+ // NPCs can be talked to (single option, candidate for removal
+ // unless more options would be added)
+ mBrowserBox->addRow("@@talk|Talk To NPC@@");
+ break;
+
+ default:
+ /* Other beings aren't interesting... */
+ break;
}
//browserBox->addRow("@@look|Look To@@");
@@ -142,56 +149,56 @@ void PopupMenu::handleLink(const std::string& link)
{
// Talk To action
if (link == "talk" &&
- mBeing != NULL &&
- mBeing->getType() == Being::NPC &&
- current_npc == 0)
+ mBeing != NULL &&
+ mBeing->getType() == Being::NPC &&
+ current_npc == 0)
{
- dynamic_cast<NPC*>(mBeing)->talk();
+ dynamic_cast<NPC*>(mBeing)->talk();
}
// Trade action
else if (link == "trade" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_node->trade(mBeing);
- tradePartnerName = mBeing->getName();
+ player_node->trade(mBeing);
+ tradePartnerName = mBeing->getName();
}
// Attack action
else if (link == "attack" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_node->attack(mBeing, true);
+ player_node->attack(mBeing, true);
}
else if (link == "unignore" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL);
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL);
}
else if (link == "ignore" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED);
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED);
}
else if (link == "disregard" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED);
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED);
}
else if (link == "friend" &&
- mBeing != NULL &&
- mBeing->getType() == Being::PLAYER)
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
{
- player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND);
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND);
}
/*
@@ -204,16 +211,16 @@ void PopupMenu::handleLink(const std::string& link)
// Add Buddy action
else if ((link == "buddy") && mBeing != NULL && mBeing->isPlayer())
{
- if (!buddyWindow->isVisible())
- buddyWindow->setVisible(true);
+ if (!buddyWindow->isVisible())
+ buddyWindow->setVisible(true);
- buddyWindow->addBuddy(mBeing->getName());
+ buddyWindow->addBuddy(mBeing->getName());
}*/
// Pick Up Floor Item action
else if ((link == "pickup") && mFloorItem != NULL)
{
- player_node->pickUp(mFloorItem);
+ player_node->pickUp(mFloorItem);
}
// Look To action
@@ -223,39 +230,47 @@ void PopupMenu::handleLink(const std::string& link)
else if (link == "use")
{
- assert(mItem);
- if (mItem->isEquipment())
- {
- if (mItem->isEquipped())
- {
- player_node->unequipItem(mItem);
- }
- else
- {
- player_node->equipItem(mItem);
- }
- }
- else
- {
- player_node->useItem(mItem);
- }
+ assert(mItem);
+ if (mItem->isEquipment())
+ {
+ if (mItem->isEquipped())
+ {
+ player_node->unequipItem(mItem);
+ }
+ else
+ {
+ player_node->equipItem(mItem);
+ }
+ }
+ else
+ {
+ player_node->useItem(mItem);
+ }
}
else if (link == "drop")
{
- new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
+ new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
}
else if (link == "description")
{
- // do nothing for now, I need to write
- // a window for the description first
+ // do nothing for now, I need to write
+ // a window for the description first
+ }
+ else if (link == "party-invite" &&
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
+ {
+ MessageOut outMsg(player_node->getNetwork());
+ outMsg.writeInt16(CMSG_PARTY_INVITE);
+ outMsg.writeInt32(mBeing->getId());
}
// Unknown actions
else
{
- std::cout << link << std::endl;
+ std::cout << link << std::endl;
}
setVisible(false);
@@ -273,13 +288,13 @@ void PopupMenu::showPopup(int x, int y, Item *item)
if (item->isEquipment())
{
- if (item->isEquipped())
- mBrowserBox->addRow("@@use|Unequip@@");
- else
- mBrowserBox->addRow("@@use|Equip@@");
+ if (item->isEquipped())
+ mBrowserBox->addRow("@@use|Unequip@@");
+ else
+ mBrowserBox->addRow("@@use|Equip@@");
}
else
- mBrowserBox->addRow("@@use|Use@@");
+ mBrowserBox->addRow("@@use|Use@@");
mBrowserBox->addRow("@@drop|Drop@@");
mBrowserBox->addRow("@@description|Description@@");
@@ -293,9 +308,9 @@ void PopupMenu::showPopup(int x, int y)
{
setContentSize(mBrowserBox->getWidth() + 8, mBrowserBox->getHeight() + 8);
if (windowContainer->getWidth() < (x + getWidth() + 5))
- x = windowContainer->getWidth() - getWidth();
+ x = windowContainer->getWidth() - getWidth();
if (windowContainer->getHeight() < (y + getHeight() + 5))
- y = windowContainer->getHeight() - getHeight();
+ y = windowContainer->getHeight() - getHeight();
setPosition(x, y);
setVisible(true);
requestMoveToTop();
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 9fe9f866..601fa2ae 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: popupmenu.h 2239 2006-03-09 05:16:27Z der_doener $
*/
#ifndef _TMW_POPUP_MENU_H
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 6d18b2f7..6dbc3b85 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: progressbar.cpp 4008 2008-03-27 14:51:10Z b_lindeijer $
*/
#include "progressbar.h"
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index 3e58f14e..ed8eace4 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: progressbar.h 2240 2006-03-09 12:24:36Z der_doener $
*/
#ifndef _TMW_PROGRESSBAR_H
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index 0ac4dea8..cbab4d2d 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: radiobutton.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "radiobutton.h"
diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h
index 4f868fdb..bab4a9dc 100644
--- a/src/gui/radiobutton.h
+++ b/src/gui/radiobutton.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: radiobutton.h 1584 2005-08-13 12:49:52Z der_doener $
*/
#ifndef _TMW_RADIOBUTTON_H
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 9496da93..e0b663b8 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: register.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "register.h"
@@ -41,6 +41,8 @@
#include "textfield.h"
#include "ok_dialog.h"
+#include "../utils/tostring.h"
+
void
WrongDataNoticeListener::setTarget(gcn::TextField *textField)
{
@@ -65,53 +67,65 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
gcn::Label *passwordLabel = new gcn::Label("Password:");
gcn::Label *confirmLabel = new gcn::Label("Confirm:");
gcn::Label *serverLabel = new gcn::Label("Server:");
+ gcn::Label *portLabel = new gcn::Label("Port:");
+
mUserField = new TextField(loginData->username);
mPasswordField = new PasswordField(loginData->password);
mConfirmField = new PasswordField();
mServerField = new TextField(loginData->hostname);
+ mPortField = new TextField(toString(loginData->port));
mMaleButton = new RadioButton("Male", "sex", true);
mFemaleButton = new RadioButton("Female", "sex", false);
mRegisterButton = new Button("Register", "register", this);
mCancelButton = new Button("Cancel", "cancel", this);
- const int width = 220;
- const int height = 150;
- setContentSize(width, height);
-
- mUserField->setPosition(65, 5);
- mUserField->setWidth(width - 70);
- mPasswordField->setPosition(
- 65, mUserField->getY() + mUserField->getHeight() + 7);
- mPasswordField->setWidth(mUserField->getWidth());
- mConfirmField->setPosition(
- 65, mPasswordField->getY() + mPasswordField->getHeight() + 7);
- mConfirmField->setWidth(mUserField->getWidth());
- mServerField->setPosition(
- 65, 23 + mConfirmField->getY() + mConfirmField->getHeight() + 7);
- mServerField->setWidth(mUserField->getWidth());
-
- userLabel->setPosition(5, mUserField->getY() + 1);
- passwordLabel->setPosition(5, mPasswordField->getY() + 1);
- confirmLabel->setPosition(5, mConfirmField->getY() + 1);
- serverLabel->setPosition(5, mServerField->getY() + 1);
-
- mMaleButton->setPosition(
- 70, mConfirmField->getY() + mConfirmField->getHeight() + 7);
- mFemaleButton->setPosition(
- 70 + 10 + mMaleButton->getWidth(),
- mMaleButton->getY());
+ const int WIDTH = 220;
+ const int HEIGHT = 170;
+ const int FIELD_WIDTH = WIDTH - 70;
+
+ setContentSize(WIDTH, HEIGHT);
+
+ const int USER_TOP = 5;
+ userLabel->setPosition(5, USER_TOP);
+ mUserField->setPosition(65, USER_TOP);
+ mUserField->setWidth(FIELD_WIDTH);
+
+ const int PASS_TOP = 9 + USER_TOP + userLabel->getHeight();
+ passwordLabel->setPosition(5, PASS_TOP);
+ mPasswordField->setPosition(65, PASS_TOP);
+ mPasswordField->setWidth(FIELD_WIDTH);
+
+ const int CONFIRM_TOP = 9 + PASS_TOP + passwordLabel->getHeight();
+ confirmLabel->setPosition(5, CONFIRM_TOP);
+ mConfirmField->setPosition(65, CONFIRM_TOP);
+ mConfirmField->setWidth(FIELD_WIDTH);
+
+ const int SEX_TOP = 9 + CONFIRM_TOP + confirmLabel->getHeight();
+ mMaleButton->setPosition(70, SEX_TOP);
+ mFemaleButton->setPosition(80 + mMaleButton->getWidth(), SEX_TOP);
+
+ const int SERVER_TOP = 9 + SEX_TOP + mMaleButton->getHeight() + 5;
+ serverLabel->setPosition(5, SERVER_TOP);
+ mServerField->setPosition(65, SERVER_TOP);
+ mServerField->setWidth(FIELD_WIDTH);
+
+ const int PORT_TOP = 9 + SERVER_TOP + serverLabel->getHeight();
+ portLabel->setPosition(5, PORT_TOP);
+ mPortField->setPosition(65, PORT_TOP);
+ mPortField->setWidth(FIELD_WIDTH);
mCancelButton->setPosition(
- width - mCancelButton->getWidth() - 5,
- height - mCancelButton->getHeight() - 5);
+ WIDTH - mCancelButton->getWidth() - 5,
+ HEIGHT - mCancelButton->getHeight() - 5);
mRegisterButton->setPosition(
mCancelButton->getX() - mRegisterButton->getWidth() - 5,
- height - mRegisterButton->getHeight() - 5);
+ HEIGHT - mRegisterButton->getHeight() - 5);
mUserField->addKeyListener(this);
mPasswordField->addKeyListener(this);
mConfirmField->addKeyListener(this);
mServerField->addKeyListener(this);
+ mPortField->addKeyListener(this);
/* TODO:
* This is a quick and dirty way to respond to the ENTER key, regardless of
@@ -122,19 +136,26 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mPasswordField->setActionEventId("register");
mConfirmField->setActionEventId("register");
mServerField->setActionEventId("register");
+ mPortField->setActionEventId("register");
+
mUserField->addActionListener(this);
mPasswordField->addActionListener(this);
mConfirmField->addActionListener(this);
mServerField->addActionListener(this);
+ mPortField->addActionListener(this);
add(userLabel);
add(passwordLabel);
- add(serverLabel);
add(confirmLabel);
+ add(serverLabel);
+ add(portLabel);
+
add(mUserField);
add(mPasswordField);
add(mConfirmField);
add(mServerField);
+ add(mPortField);
+
add(mMaleButton);
add(mFemaleButton);
add(mRegisterButton);
@@ -232,7 +253,7 @@ RegisterDialog::action(const gcn::ActionEvent &event)
mRegisterButton->setEnabled(false);
mLoginData->hostname = mServerField->getText();
- mLoginData->port = (short) config.getValue("port", 0);
+ mLoginData->port = getUShort(mPortField->getText());
mLoginData->username = mUserField->getText();
mLoginData->password = mPasswordField->getText();
mLoginData->username += mFemaleButton->isSelected() ? "_F" : "_M";
@@ -256,5 +277,42 @@ RegisterDialog::canSubmit()
!mPasswordField->getText().empty() &&
!mConfirmField->getText().empty() &&
!mServerField->getText().empty() &&
+ isUShort(mPortField->getText()) &&
state == REGISTER_STATE;
}
+
+bool
+RegisterDialog::isUShort(const std::string &str)
+{
+ if (str == "")
+ {
+ return false;
+ }
+ unsigned long l = 0;
+ for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
+ strPtr != strEnd; ++strPtr)
+ {
+ if (*strPtr < '0' || *strPtr > '9')
+ {
+ return false;
+ }
+ l = l * 10 + (*strPtr - '0'); // *strPtr - '0' will never be negative
+ if (l > 65535)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+unsigned short
+RegisterDialog::getUShort(const std::string &str)
+{
+ unsigned long l = 0;
+ for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
+ strPtr != strEnd; ++strPtr)
+ {
+ l = l * 10 + (*strPtr - '0');
+ }
+ return static_cast<unsigned short>(l);
+}
diff --git a/src/gui/register.h b/src/gui/register.h
index a80594af..6f997b75 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: register.h 3234 2007-03-24 13:05:27Z b_lindeijer $
*/
#ifndef _TMW_REGISTER_H
@@ -87,10 +87,31 @@ class RegisterDialog : public Window, public gcn::ActionListener,
bool
canSubmit();
+ /**
+ * Function to decide whether string is an unsigned short or not
+ *
+ * @param str the string to parse
+ *
+ * @return true if str is an unsigned short, false otherwise
+ */
+ static bool
+ isUShort(const std::string &str);
+
+ /**
+ * Converts string to an unsigned short (undefined if invalid)
+ *
+ * @param str the string to parse
+ *
+ * @return the value str represents
+ */
+ static unsigned short
+ getUShort(const std::string &str);
+
gcn::TextField *mUserField;
gcn::TextField *mPasswordField;
gcn::TextField *mConfirmField;
gcn::TextField *mServerField;
+ gcn::TextField *mPortField;
gcn::Button *mRegisterButton;
gcn::Button *mCancelButton;
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index 255aa2d8..a3aef702 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: scrollarea.cpp 4204 2008-04-28 18:29:04Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h
index be361f68..b3fa17f3 100644
--- a/src/gui/scrollarea.h
+++ b/src/gui/scrollarea.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: scrollarea.h 4204 2008-04-28 18:29:04Z b_lindeijer $
*/
#ifndef __TMW_SCROLLAREA_H__
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 82d340fb..5f64fcea 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: sell.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "sell.h"
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 0c1a2007..11528f89 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: sell.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_SELL_H
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index c895d166..ce843452 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup.cpp 4306 2008-05-28 20:22:37Z crush_tmw $
*/
#include <algorithm>
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 543cab2c..d4f0857b 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup.h 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#ifndef _TMW_SETUP_H
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 4227b5ca..09357cce 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_audio.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "setup_audio.h"
diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h
index 6e722f74..76420101 100644
--- a/src/gui/setup_audio.h
+++ b/src/gui/setup_audio.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_audio.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_GUI_SETUP_AUDIO_H
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index a501298e..41e91595 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_joystick.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "setup_joystick.h"
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index 6d3ad129..399156d8 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_joystick.h 3035 2007-01-14 14:54:39Z b_lindeijer $
*/
#ifndef _TMW_GUI_SETUP_JOYSTICK_H
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index e88080b5..704fc691 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_keyboard.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "setup_keyboard.h"
diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h
index b72e8746..7f945181 100644
--- a/src/gui/setup_keyboard.h
+++ b/src/gui/setup_keyboard.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_keyboard.h 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#ifndef _TMW_GUI_SETUP_KEYBOARD_H
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 24b559da..809364ea 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_players.cpp 4353 2008-06-16 07:04:46Z b_lindeijer $
*/
#include "setup_players.h"
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 97e4cdd6..bc38f1f9 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_video.cpp 4338 2008-06-05 18:41:39Z crush_tmw $
*/
#include "setup_video.h"
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index a0701a3c..0d7ea700 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setup_video.h 4306 2008-05-28 20:22:37Z crush_tmw $
*/
#ifndef _TMW_GUI_SETUP_VIDEO_H
diff --git a/src/gui/setuptab.h b/src/gui/setuptab.h
index a7d45b9a..bbfe4fac 100644
--- a/src/gui/setuptab.h
+++ b/src/gui/setuptab.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: setuptab.h 2273 2006-03-19 00:48:10Z der_doener $
*/
#ifndef _TMW_GUI_SETUPTAB_H
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 62d18769..015e70d5 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: shop.cpp 4348 2008-06-14 12:42:49Z the_enemy $
*/
#include "shop.h"
diff --git a/src/gui/shop.h b/src/gui/shop.h
index 22e715c9..78276610 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: shop.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _SHOP_H
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 3ab40c9a..e70fb3ef 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: skill.cpp 3754 2007-11-20 15:19:50Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 6879640c..6bd6c51b 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: skill.h 3494 2007-08-20 05:29:12Z joshlangley $
*/
#ifndef _TMW_SKILL_H
diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp
index c94c7bfb..a1ae6acc 100644
--- a/src/gui/slider.cpp
+++ b/src/gui/slider.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: slider.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include "slider.h"
diff --git a/src/gui/slider.h b/src/gui/slider.h
index dc38b738..524d8799 100644
--- a/src/gui/slider.h
+++ b/src/gui/slider.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: slider.h 1584 2005-08-13 12:49:52Z der_doener $
*/
#ifndef _TMW_SLIDER_H
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 927b3554..cba815b5 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: status.cpp 3510 2007-08-23 14:14:51Z b_lindeijer $
*/
#include "status.h"
diff --git a/src/gui/status.h b/src/gui/status.h
index 10773e10..4d082148 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: status.h 3538 2007-08-28 00:01:38Z b_lindeijer $
*/
#ifndef _TMW_STATUS_H
diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp
index d6267e65..71e0f3c4 100644
--- a/src/gui/tabbedcontainer.cpp
+++ b/src/gui/tabbedcontainer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tabbedcontainer.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/tabbedcontainer.h b/src/gui/tabbedcontainer.h
index 7f8deef9..14f27aba 100644
--- a/src/gui/tabbedcontainer.h
+++ b/src/gui/tabbedcontainer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tabbedcontainer.h 3152 2007-02-27 16:31:34Z crush_tmw $
*/
#ifndef _TMW_TABPANE_H
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index 8d16dc46..743d88b6 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textbox.cpp 4096 2008-04-16 08:39:59Z b_lindeijer $
*/
#include "textbox.h"
diff --git a/src/gui/textbox.h b/src/gui/textbox.h
index f06f98ec..7df30fd9 100644
--- a/src/gui/textbox.h
+++ b/src/gui/textbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textbox.h 4096 2008-04-16 08:39:59Z b_lindeijer $
*/
#ifndef __TMW_TEXTBOX_H__
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index 8db720cf..95291267 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textfield.cpp 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/textfield.h b/src/gui/textfield.h
index bc47d501..39bcbf85 100644
--- a/src/gui/textfield.h
+++ b/src/gui/textfield.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textfield.h 4045 2008-04-07 15:23:07Z b_lindeijer $
*/
#ifndef __TMW_TEXTFIELD_H__
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 42b6e9bc..d8f23171 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: updatewindow.cpp 4332 2008-06-05 07:33:12Z b_lindeijer $
*/
#include "updatewindow.h"
diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h
index 61ea4a27..b669f829 100644
--- a/src/gui/updatewindow.h
+++ b/src/gui/updatewindow.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: updatewindow.h 4332 2008-06-05 07:33:12Z b_lindeijer $
*/
#ifndef _UPDATERWINDOW_H
diff --git a/src/gui/vbox.cpp b/src/gui/vbox.cpp
index b503508e..6f36dc9c 100644
--- a/src/gui/vbox.cpp
+++ b/src/gui/vbox.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: vbox.cpp 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#include "vbox.h"
diff --git a/src/gui/vbox.h b/src/gui/vbox.h
index 06a270ef..ff52717b 100644
--- a/src/gui/vbox.h
+++ b/src/gui/vbox.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: vbox.h 1881 2005-10-18 21:40:25Z der_doener $
*/
#ifndef VBOX_H
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 01324a47..e7fdb522 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: viewport.cpp 4098 2008-04-16 11:36:41Z b_lindeijer $
*/
#include "viewport.h"
@@ -37,6 +37,7 @@
#include "../map.h"
#include "../monster.h"
#include "../npc.h"
+#include "../textmanager.h"
#include "../resources/animation.h"
#include "../resources/monsterinfo.h"
@@ -228,7 +229,6 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
mMap->draw(graphics, (int) mPixelViewX, (int) mPixelViewY, 2);
mMap->drawOverlay(graphics, mPixelViewX, mPixelViewY,
(int) config.getValue("OverlayDetail", 2));
- drawTargetName(graphics);
}
// Find a path from the player to the mouse, and draw it. This is for debug
@@ -259,12 +259,16 @@ Viewport::draw(gcn::Graphics *gcnGraphics)
}
}
+ // Draw text
+ if (textManager)
+ {
+ textManager->draw(graphics, mPixelViewX, mPixelViewY);
+ }
+
// Draw player nickname, speech, and emotion sprite as needed
Beings &beings = beingManager->getAll();
for (BeingIterator i = beings.begin(); i != beings.end(); i++)
{
- (*i)->drawSpeech(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
- (*i)->drawName(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
(*i)->drawEmotion(graphics, -(int) mPixelViewX, -(int) mPixelViewY);
}
@@ -332,24 +336,6 @@ Viewport::drawTargetCursor(Graphics *graphics)
}
void
-Viewport::drawTargetName(Graphics *graphics)
-{
- // Draw target marker if needed
- Being *target = player_node->getTarget();
- if (target && target->getType() == Being::MONSTER)
- {
- graphics->setFont(speechFont);
- graphics->setColor(gcn::Color(255, 32, 32));
-
- const MonsterInfo &mi = static_cast<Monster*>(target)->getInfo();
- int posX = target->getPixelX() + 16 - (int)mPixelViewX;
- int posY = target->getPixelY() + 16 - target->getHeight() - (int)mPixelViewY;
-
- graphics->drawText(mi.getName(), posX, posY, gcn::Graphics::CENTER);
- }
-}
-
-void
Viewport::mousePressed(gcn::MouseEvent &event)
{
// Check if we are alive and kickin'
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 8d3fbd3c..44a877a6 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: viewport.h 4247 2008-05-19 10:48:18Z b_lindeijer $
*/
#ifndef _TMW_VIEWPORT_H_
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
new file mode 100644
index 00000000..b33a55cf
--- /dev/null
+++ b/src/gui/widgets/dropdown.cpp
@@ -0,0 +1,169 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#include <algorithm>
+
+#include "dropdown.h"
+
+#include "../../graphics.h"
+
+#include "../../resources/image.h"
+#include "../../resources/resourcemanager.h"
+
+#include "../../utils/dtor.h"
+
+int DropDown::instances = 0;
+Image *DropDown::buttons[2][2];
+ImageRect DropDown::skin;
+
+DropDown::DropDown(gcn::ListModel *listModel,
+ gcn::ScrollArea *scrollArea,
+ gcn::ListBox *listBox):
+ gcn::DropDown::DropDown(listModel,
+ scrollArea, listBox)
+{
+ setFrameSize(2);
+
+ // Initialize graphics
+ if (instances == 0)
+ {
+ // Load the background skin
+ ResourceManager *resman = ResourceManager::getInstance();
+
+ // Get the button skin
+ buttons[1][0] =
+ resman->getImage("graphics/gui/vscroll_up_default.png");
+ buttons[0][0] =
+ resman->getImage("graphics/gui/vscroll_down_default.png");
+ buttons[1][1] =
+ resman->getImage("graphics/gui/vscroll_up_pressed.png");
+ buttons[0][1] =
+ resman->getImage("graphics/gui/vscroll_down_pressed.png");
+
+ // get the border skin
+ Image *boxBorder = resman->getImage("graphics/gui/deepbox.png");
+ int gridx[4] = {0, 3, 28, 31};
+ int gridy[4] = {0, 3, 28, 31};
+ int a = 0, x, y;
+
+ for (y = 0; y < 3; y++) {
+ for (x = 0; x < 3; x++) {
+ skin.grid[a] = boxBorder->getSubImage(
+ gridx[x], gridy[y],
+ gridx[x + 1] - gridx[x] + 1,
+ gridy[y + 1] - gridy[y] + 1);
+ a++;
+ }
+ }
+
+ boxBorder->decRef();
+ }
+
+ instances++;
+}
+
+DropDown::~DropDown()
+{
+ instances--;
+ // Free images memory
+ if (instances == 0)
+ {
+ buttons[0][0]->decRef();
+ buttons[0][1]->decRef();
+ buttons[1][0]->decRef();
+ buttons[1][1]->decRef();
+
+ for_each(skin.grid, skin.grid + 9, dtor<Image*>());
+ }
+}
+
+void DropDown::draw(gcn::Graphics* graphics)
+{
+ int h;
+
+ if (mDroppedDown)
+ {
+ h = mFoldedUpHeight;
+ }
+ else
+ {
+ h = getHeight();
+ }
+
+ int alpha = getBaseColor().a;
+ gcn::Color faceColor = getBaseColor();
+ faceColor.a = alpha;
+ gcn::Color highlightColor = faceColor + 0x303030;
+ highlightColor.a = alpha;
+ gcn::Color shadowColor = faceColor - 0x303030;
+ shadowColor.a = alpha;
+
+
+ graphics->setColor(getBackgroundColor());
+ graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), h));
+
+ graphics->setColor(getForegroundColor());
+ graphics->setFont(getFont());
+
+ if (mListBox->getListModel() && mListBox->getSelected() >= 0)
+ {
+ graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0);
+ }
+
+ if (isFocused())
+ {
+ graphics->setColor(highlightColor);
+ graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h));
+ }
+
+ drawButton(graphics);
+
+ if (mDroppedDown)
+ {
+ drawChildren(graphics);
+
+ // Draw two lines separating the ListBox with se selected
+ // element view.
+ graphics->setColor(highlightColor);
+ graphics->drawLine(0, h, getWidth(), h);
+ graphics->setColor(shadowColor);
+ graphics->drawLine(0, h + 1, getWidth(), h + 1);
+ }
+}
+
+void DropDown::drawFrame(gcn::Graphics *graphics)
+{
+ const int bs = getFrameSize();
+ const int w = getWidth() + bs * 2;
+ const int h = getHeight() + bs * 2;
+
+ static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin);
+}
+
+void DropDown::drawButton(gcn::Graphics *graphics)
+{
+ int height = mDroppedDown ? mFoldedUpHeight : getHeight();
+
+ static_cast<Graphics*>(graphics)->
+ drawImage(buttons[mDroppedDown][mPushed], getWidth() - height, 1);
+}
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
new file mode 100644
index 00000000..d0dab7d2
--- /dev/null
+++ b/src/gui/widgets/dropdown.h
@@ -0,0 +1,85 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef DROPDOWN_H
+#define DROPDOWN_H
+
+#include <iosfwd>
+
+#include <guichan/widgets/dropdown.hpp>
+#include "../scrollarea.h"
+#include "../listbox.h"
+
+class Image;
+class ImageRect;
+
+ /**
+ * A drop down box from which you can select different values. It is one of
+ * the most complicated Widgets you will find in Guichan. For drawing the
+ * DroppedDown box it uses one ScrollArea and one ListBox. It also uses an
+ * internal FocusHandler to handle the focus of the internal ScollArea and
+ * ListBox. DropDown uses a ListModel to handle the list. To be able to use
+ * DropDown you must give DropDown an implemented ListModel which represents
+ * your list.
+ */
+class DropDown : public gcn::DropDown
+{
+ public:
+ /**
+ * Contructor.
+ *
+ * @param listModel the ListModel to use.
+ * @param scrollArea the ScrollArea to use.
+ * @param listBox the listBox to use.
+ * @see ListModel, ScrollArea, ListBox.
+ */
+ DropDown(gcn::ListModel *listModel = NULL,
+ gcn::ScrollArea *scrollArea = NULL,
+ gcn::ListBox *listBox = NULL);
+
+ /**
+ * Destructor.
+ */
+ ~DropDown();
+
+ void draw(gcn::Graphics* graphics);
+
+ void drawFrame(gcn::Graphics* graphics);
+
+
+ protected:
+ /**
+ * Draws the button with the little down arrow.
+ *
+ * @param graphics a Graphics object to draw with.
+ */
+ void drawButton(gcn::Graphics *graphics);
+
+ // Add own Images.
+ static int instances;
+ static Image *buttons[2][2];
+ static ImageRect skin;
+};
+
+#endif // end DROPDOWN_H
+
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index 6be50f2c..e13493bb 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resizegrip.cpp 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#include "resizegrip.h"
diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h
index 04be3db3..dab720dd 100644
--- a/src/gui/widgets/resizegrip.h
+++ b/src/gui/widgets/resizegrip.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resizegrip.h 3270 2007-04-15 01:22:17Z b_lindeijer $
*/
#ifndef _TMW_RESIZEGRIP_H
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 4ce167cd..4f94b3fb 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: window.cpp 4207 2008-04-29 09:10:43Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/window.h b/src/gui/window.h
index f88e5c01..8f288991 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: window.h 4207 2008-04-29 09:10:43Z b_lindeijer $
*/
#ifndef _TMW_WINDOW_H__
diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp
index d10c519c..0a0a0a55 100644
--- a/src/gui/windowcontainer.cpp
+++ b/src/gui/windowcontainer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: windowcontainer.cpp 3754 2007-11-20 15:19:50Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h
index df255f84..294c855b 100644
--- a/src/gui/windowcontainer.h
+++ b/src/gui/windowcontainer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: windowcontainer.h 2884 2006-12-04 11:20:54Z b_lindeijer $
*/
#ifndef _TMW_WINDOWCONTAINER_H_
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
index 812f3f7a..0a2560bf 100644
--- a/src/guichanfwd.h
+++ b/src/guichanfwd.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: guichanfwd.h 2907 2006-12-12 15:33:46Z b_lindeijer $
*/
#ifndef _TMW_GUICHANFWD_H
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index 965434b0..d4ff8f02 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imageparticle.cpp 4360 2008-06-23 14:44:20Z crush_tmw $
*/
#include "imageparticle.h"
diff --git a/src/imageparticle.h b/src/imageparticle.h
index 0ad515cc..ef663473 100644
--- a/src/imageparticle.h
+++ b/src/imageparticle.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imageparticle.h 3567 2007-09-07 09:13:17Z b_lindeijer $
*/
#ifndef _IMAGEPARTICLE_H
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 470b6c85..e6f006de 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventory.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "inventory.h"
diff --git a/src/inventory.h b/src/inventory.h
index 0d2bbc5a..2e0dd792 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventory.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _INVENTORY_H
diff --git a/src/item.cpp b/src/item.cpp
index e84a06df..2e33a9de 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: item.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "item.h"
diff --git a/src/item.h b/src/item.h
index 9e1c5ec8..449b388c 100644
--- a/src/item.h
+++ b/src/item.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: item.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _ITEM_H_
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index a32e50e0..5379f0eb 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcut.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "itemshortcut.h"
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index d75db2e8..bbf21332 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemshortcut.h 4180 2008-04-24 20:49:30Z peaveydk $
*/
#ifndef _TMW_ITEMSHORTCUT_H__
diff --git a/src/joystick.cpp b/src/joystick.cpp
index a5dab4f4..ebae5c3a 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: joystick.cpp 2595 2006-08-26 20:19:39Z b_lindeijer $
*/
#include "joystick.h"
diff --git a/src/joystick.h b/src/joystick.h
index 321e3e7d..5c6f7c86 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: joystick.h 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#ifndef _TMW_JOYSTICK_H
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index a959e244..5534b96e 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: keyboardconfig.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "keyboardconfig.h"
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 53a5c96d..b98fcb7a 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: keyboardconfig.h 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#ifndef _TMW_KEYBOARDCONFIG_H
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 3929da8b..5f392a52 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: localplayer.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "localplayer.h"
@@ -31,6 +31,7 @@
#include "main.h"
#include "particle.h"
#include "sound.h"
+#include "monster.h"
#include "gui/gui.h"
@@ -226,6 +227,23 @@ void LocalPlayer::walk(unsigned char dir)
}
}
+void LocalPlayer::setTarget(Being *target)
+{
+ if (target == mTarget)
+ {
+ return;
+ }
+ if (mTarget && mTarget->getType() == Being::MONSTER)
+ {
+ static_cast<Monster *>(mTarget)->showName(false);
+ }
+ mTarget = target;
+ if (target && target->getType() == Being::MONSTER)
+ {
+ static_cast<Monster *>(target)->showName(true);
+ }
+}
+
void LocalPlayer::setDestination(Uint16 x, Uint16 y)
{
// Only send a new message to the server when destination changes
@@ -363,9 +381,13 @@ void LocalPlayer::attack(Being *target, bool keep)
return;
if (keep && target)
- mTarget = target;
+ {
+ setTarget(target);
+ }
else if (mTarget)
+ {
target = mTarget;
+ }
if (!target)
return;
@@ -411,7 +433,7 @@ void LocalPlayer::attack(Being *target, bool keep)
void LocalPlayer::stopAttack()
{
- mTarget = NULL;
+ setTarget(NULL);
}
Being* LocalPlayer::getTarget() const
@@ -454,7 +476,7 @@ bool LocalPlayer::withinAttackRange(Being *target)
void LocalPlayer::setGotoTarget(Being *target)
{
- mTarget = target;
+ setTarget(target);
mGoingToTarget = true;
setDestination(target->mX, target->mY);
}
diff --git a/src/localplayer.h b/src/localplayer.h
index 5ce94081..64e6c5ad 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: localplayer.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_LOCALPLAYER_H
@@ -54,8 +54,9 @@ class LocalPlayer : public Player
*/
~LocalPlayer();
+ void setName(const std::string &name) {Being::setName(name); }
void setNetwork(Network *network) { mNetwork = network; }
-
+ Network *getNetwork() {return mNetwork; }
virtual void logic();
/**
@@ -65,12 +66,6 @@ class LocalPlayer : public Player
virtual void nextStep();
/**
- * Draws the name text below the being.
- */
- virtual void
- drawName(Graphics *graphics, Sint32 offsetX, Sint32 offsetY) {};
-
- /**
* Returns the player's inventory.
*/
Inventory* getInventory() const { return mInventory; }
@@ -140,7 +135,7 @@ class LocalPlayer : public Player
/**
* Sets the target being of the player.
*/
- void setTarget(Being* target) { mTarget = target; }
+ void setTarget(Being* target);
/**
* Sets a new destination for this being to walk to.
diff --git a/src/lockedarray.h b/src/lockedarray.h
index 7ec2f9da..bbb72520 100644
--- a/src/lockedarray.h
+++ b/src/lockedarray.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: lockedarray.h 2277 2006-03-19 21:40:21Z der_doener $
*/
#ifndef _TMW_LOCKEDARRAY_H
diff --git a/src/logindata.h b/src/logindata.h
index 8513428f..d2fe3043 100644
--- a/src/logindata.h
+++ b/src/logindata.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: logindata.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_LOGINDATA_H
@@ -31,6 +31,7 @@ struct LoginData
std::string username;
std::string password;
std::string hostname;
+ std::string updateHost;
short port;
int account_ID;
diff --git a/src/main.cpp b/src/main.cpp
index 7a854123..2b8a3882 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: main.cpp 4332 2008-06-05 07:33:12Z b_lindeijer $
*/
#include "main.h"
@@ -57,6 +57,7 @@
#ifdef USE_OPENGL
#include "openglgraphics.h"
#endif
+#include "serverinfo.h"
#include "sound.h"
#include "gui/char_server.h"
@@ -151,22 +152,64 @@ struct Options
};
/**
+ * Parse the update host and determine the updates directory
+ * Then verify that the directory exists (creating if needed).
+ */
+void setUpdatesDir()
+{
+ // If updatesHost is currently empty, fill it from config file
+ if (updateHost.empty()) {
+ updateHost =
+ config.getValue("updatehost", "http://updates.thanaworld.org");
+ }
+
+ // Parse out any "http://" or "ftp://", and set the updates directory
+ size_t pos;
+ pos = updateHost.find("://");
+ if (pos != updateHost.npos) {
+ if (pos + 3 < updateHost.length()) {
+ updatesDir =
+ "updates/" + updateHost.substr(pos + 3);
+ } else {
+ logger->log("Error: Invalid update host: %s", updateHost.c_str());
+ errorMessage = "Invalid update host: " + updateHost;
+ state = ERROR_STATE;
+ }
+ } else {
+ logger->log("Warning: no protocol was specified for the update host");
+ updatesDir = "updates/" + updateHost;
+ }
+
+ ResourceManager *resman = ResourceManager::getInstance();
+
+ // Verify that the updates directory exists. Create if necessary.
+ if (!resman->isDirectory("/" + updatesDir)) {
+ if (resman->mkdir("/" + updatesDir)) {
+ logger->log("Error: %s/%s can't be made, but doesn't exist!",
+ homeDir.c_str(), updatesDir.c_str());
+ errorMessage = "Error creating updates directory!";
+ state = ERROR_STATE;
+ }
+ }
+}
+
+/**
* Do all initialization stuff
*/
void init_engine(const Options &options)
{
- homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw";
+ homeDir = std::string(PHYSFS_getUserDir()) + "/.tme";
#if defined WIN32
if (!CreateDirectory(homeDir.c_str(), 0) &&
GetLastError() != ERROR_ALREADY_EXISTS)
#elif defined __APPLE__
- // Use Application Directory instead of .tmw
- homeDir = std::string(PHYSFS_getUserDir()) +
+ // Use Application Directory instead of .tme
+ homeDir = std::string(PHYSFS_getUserDir()) +
"/Library/Application Support/The Mana World";
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
#else
- // Checking if /home/user/.tmw folder exists.
+ // Checking if /home/user/.tme folder exists.
if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) &&
(errno != EEXIST))
#endif
@@ -230,7 +273,7 @@ void init_engine(const Options &options)
// Fill configuration with defaults
logger->log("Initializing configuration...");
- config.setValue("host", "server.themanaworld.org");
+ config.setValue("host", "216.139.126.36");
config.setValue("port", 6901);
config.setValue("hwaccel", 0);
#if (defined __APPLE__ || defined WIN32) && defined USE_OPENGL
@@ -245,7 +288,7 @@ void init_engine(const Options &options)
config.setValue("sfxVolume", 100);
config.setValue("musicVolume", 60);
config.setValue("fpslimit", 60);
- config.setValue("updatehost", "http://updates.themanaworld.org");
+ config.setValue("updatehost", "http://216.139.126.36/updates");
config.setValue("customcursor", 1);
config.setValue("ChatLogLength", 128);
@@ -272,45 +315,7 @@ void init_engine(const Options &options)
config.init(configPath);
}
-
- // Take host for updates from config if it wasn't set on the command line
- if (options.updateHost.empty()) {
- updateHost =
- config.getValue("updatehost", "http://updates.thanaworld.org");
- } else {
- updateHost = options.updateHost;
- }
-
- // Parse out any "http://" or "ftp://", and set the updates directory
- size_t pos;
- pos = updateHost.find("//");
- if (pos != updateHost.npos) {
- if (pos + 2 < updateHost.length()) {
- updatesDir =
- "updates/" + updateHost.substr(pos + 2);
- } else {
- std::cout << "The updates host - " << updateHost
- << " does not appear to be valid!" << std::endl
- << "Please fix the \"updatehost\" in your configuration"
- << " file. Exiting." << std::endl;
- exit(1);
- }
- } else {
- logger->log("Warning: no protocol was specified for the update host");
- updatesDir = "updates/" + updateHost;
- }
-
- // Verify that the updates directory exists. Create if necessary.
- if (!resman->isDirectory("/" + updatesDir)) {
- if (!resman->mkdir("/" + updatesDir)) {
- std::cout << homeDir << "/" << updatesDir
- << " can't be made, but it doesn't exist! Exiting."
- << std::endl;
- exit(1);
- }
- }
-
- SDL_WM_SetCaption("The Mana World", NULL);
+ SDL_WM_SetCaption("The Mana Experiment", NULL);
#ifdef WIN32
static SDL_SysWMinfo pInfo;
SDL_GetWMInfo(&pInfo);
@@ -363,7 +368,7 @@ void init_engine(const Options &options)
itemShortcut = new ItemShortcut();
gui = new Gui(graphics);
- state = UPDATE_STATE; /**< Initial game state */
+ state = LOGIN_STATE; /**< Initial game state */
// Initialize sound engine
try {
@@ -424,7 +429,8 @@ void printHelp()
<< " -u --skipupdate : Skip the update process" << std::endl
<< " -U --username : Login with this username" << std::endl
<< " -P --password : Login with this password" << std::endl
- << " -D --default : Bypass the login process with default settings" << std::endl
+ << " -D --default : Bypass the login process with default "
+ "settings" << std::endl
<< " -p --playername : Login with this player" << std::endl
<< " -C --configfile : Configuration file to use" << std::endl
<< " -H --updatehost : Use this update host" << std::endl;
@@ -541,7 +547,13 @@ void accountLogin(Network *network, LoginData *loginData)
outMsg.writeInt32(0); // client version
outMsg.writeString(loginData->username, 24);
outMsg.writeString(loginData->password, 24);
- outMsg.writeInt8(0); // unknown
+
+ /*
+ * eAthena calls the last byte "client version 2", but it isn't
+ * used at all. We're retasking it, with bit 0 to indicate whether
+ * the client can handle the 0x63 "update host" packet
+ */
+ outMsg.writeInt8(0x01);
// Clear the password, avoids auto login when returning to login
loginData->password = "";
@@ -648,13 +660,6 @@ int main(int argc, char *argv[])
SDL_Event event;
- if (options.skipUpdate && state != ERROR_STATE) {
- state = LOADDATA_STATE;
- }
- else {
- state = UPDATE_STATE;
- }
-
unsigned int oldstate = !state; // We start with a status change.
Game *game = NULL;
@@ -684,7 +689,7 @@ int main(int argc, char *argv[])
if (!options.password.empty()) {
loginData.password = options.password;
}
- loginData.hostname = config.getValue("host", "server.themanaworld.org");
+ loginData.hostname = config.getValue("host", "216.139.126.36");
loginData.port = (short)config.getValue("port", 0);
loginData.remember = config.getValue("remember", 0);
loginData.registerLogin = false;
@@ -751,11 +756,15 @@ int main(int argc, char *argv[])
switch (oldstate)
{
case UPDATE_STATE:
- loadUpdates();
- // Reload the wallpaper in case that it was updated
- login_wallpaper->decRef();
- login_wallpaper = ResourceManager::getInstance()->
- getImage("graphics/images/login_wallpaper.png");
+ if (options.skipUpdate) {
+ state = LOADDATA_STATE;
+ } else {
+ loadUpdates();
+ // Reload the wallpaper in case that it was updated
+ login_wallpaper->decRef();
+ login_wallpaper = ResourceManager::getInstance()->
+ getImage("graphics/images/login_wallpaper.png");
+ }
break;
// Those states don't cause a network disconnect
@@ -797,7 +806,7 @@ int main(int argc, char *argv[])
ItemDB::load();
MonsterDB::load();
NPCDB::load();
- state = LOGIN_STATE;
+ state = CHAR_CONNECT_STATE;
break;
case LOGIN_STATE:
@@ -818,13 +827,20 @@ int main(int argc, char *argv[])
case CHAR_SERVER_STATE:
logger->log("State: CHAR_SERVER");
- currentDialog = new ServerSelectDialog(&loginData);
- if (options.chooseDefault || options.playername != "") {
- ((ServerSelectDialog*) currentDialog)->action(
- gcn::ActionEvent(NULL, "ok"));
+ if (n_server == 1) {
+ SERVER_INFO *si = *server_info;
+ loginData.hostname = iptostring(si->address);
+ loginData.port = si->port;
+ loginData.updateHost = si->updateHost;
+ state = UPDATE_STATE;
+ } else {
+ currentDialog = new ServerSelectDialog(&loginData);
+ if (options.chooseDefault || options.playername != "") {
+ ((ServerSelectDialog*) currentDialog)->action(
+ gcn::ActionEvent(NULL, "ok"));
+ }
}
break;
-
case CHAR_SELECT_STATE:
logger->log("State: CHAR_SELECT");
currentDialog = new CharSelectDialog(network, &charInfo,
@@ -865,6 +881,13 @@ int main(int argc, char *argv[])
break;
case UPDATE_STATE:
+ // Determine which source to use for the update host
+ if(!options.updateHost.empty())
+ updateHost = options.updateHost;
+ else
+ updateHost = loginData.updateHost;
+
+ setUpdatesDir();
logger->log("State: UPDATE");
currentDialog = new UpdaterWindow(updateHost,
homeDir + "/" + updatesDir);
diff --git a/src/main.h b/src/main.h
index c18a2ddd..af59ea26 100644
--- a/src/main.h
+++ b/src/main.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: main.h 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#ifndef _TMW_MAIN_H
diff --git a/src/map.cpp b/src/map.cpp
index c65b0cd6..d9d3a319 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: map.cpp 4171 2008-04-22 18:42:21Z b_lindeijer $
*/
#include "map.h"
diff --git a/src/map.h b/src/map.h
index fab7bfb7..7695ba31 100644
--- a/src/map.h
+++ b/src/map.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: map.h 3887 2008-02-12 19:49:37Z umperio $
*/
#ifndef _TMW_MAP_H_
diff --git a/src/monster.cpp b/src/monster.cpp
index e2a07e86..1a7f6c4e 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: monster.cpp 3823 2007-12-28 18:36:58Z crush_tmw $
*/
#include "monster.h"
@@ -27,14 +27,21 @@
#include "game.h"
#include "sound.h"
#include "particle.h"
+#include "text.h"
+#include "localplayer.h"
+
+#include "gui/gui.h"
#include "resources/monsterdb.h"
#include "utils/tostring.h"
+static const int NAME_X_OFFSET = 16;
+static const int NAME_Y_OFFSET = 16;
Monster::Monster(Uint32 id, Uint16 job, Map *map):
- Being(id, job, map)
+ Being(id, job, map),
+ mText(0)
{
const MonsterInfo& info = MonsterDB::get(job - 1002);
@@ -59,6 +66,14 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
}
}
+Monster::~Monster()
+{
+ if (mText)
+ {
+ player_node->setTarget(0);
+ }
+}
+
void
Monster::logic()
{
@@ -141,3 +156,31 @@ Monster::getInfo() const
{
return MonsterDB::get(mJob - 1002);
}
+
+void Monster::showName(bool show)
+{
+ if (mText)
+ {
+ delete mText;
+ }
+ if (show)
+ {
+ mText = new Text(getInfo().getName(), mPx + NAME_X_OFFSET,
+ mPy + NAME_Y_OFFSET - getHeight(),
+ gcn::Graphics::CENTER,
+ speechFont, gcn::Color(255, 32, 32));
+ }
+ else
+ {
+ mText = 0;
+ }
+}
+
+void Monster::updateCoords()
+{
+ if (mText)
+ {
+ mText->adviseXY(mPx + NAME_X_OFFSET,
+ mPy + NAME_Y_OFFSET - getHeight());
+ }
+}
diff --git a/src/monster.h b/src/monster.h
index 39556b44..b613e96d 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: monster.h 3690 2007-10-26 12:50:49Z crush_tmw $
*/
#ifndef _TMW_MONSTER_H
@@ -27,12 +27,15 @@
#include "being.h"
class MonsterInfo;
+class Text;
class Monster : public Being
{
public:
Monster(Uint32 id, Uint16 job, Map *map);
+ ~Monster();
+
virtual void logic();
virtual void setAction(Uint8 action);
@@ -63,6 +66,19 @@ class Monster : public Being
*/
const MonsterInfo&
getInfo() const;
+
+ /**
+ * Determine whether the mob should show it's name
+ */
+ void showName(bool show);
+
+ protected:
+ /**
+ * Update the text when the monster moves
+ */
+ void updateCoords();
+ private:
+ Text *mText; /**< holds a text object when the mod displays it's name, 0 otherwise */
};
#endif
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index be8412d9..e077ab14 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: beinghandler.cpp 4321 2008-06-02 11:42:26Z b_lindeijer $
*/
#include "beinghandler.h"
@@ -55,6 +55,8 @@ BeingHandler::BeingHandler()
SMSG_PLAYER_UPDATE_1,
SMSG_PLAYER_UPDATE_2,
SMSG_PLAYER_MOVE,
+ SMSG_PLAYER_STOP,
+ SMSG_PLAYER_MOVE_TO_ATTACK,
0x0119,
0
};
@@ -122,7 +124,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
headTop = msg->readInt16();
headMid = msg->readInt16();
hairColor = msg->readInt16();
- msg->readInt16(); // clothes color -not used
+ msg->readInt16(); // clothes color -not used
msg->readInt16(); // head dir
msg->readInt16(); // guild
msg->readInt16(); // unknown
@@ -133,9 +135,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setGender(1 - msg->readInt8()); // gender
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
- dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
- dstBeing->setSprite(Being::HAT_SPRITE, headTop);
+ dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
+ dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
+ dstBeing->setSprite(Being::HAT_SPRITE, headTop);
dstBeing->setHairStyle(hairStyle, hairColor);
if (msg->getId() == SMSG_BEING_MOVE)
@@ -257,7 +259,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
case SMSG_BEING_CHANGE_LOOKS2:
{
/*
- * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
+ * SMSG_BEING_CHANGE_LOOKS (0x00c3) and
* SMSG_BEING_CHANGE_LOOKS2 (0x01d7) do basically the same
* thing. The difference is that ...LOOKS carries a single
* 8 bit value, where ...LOOKS2 carries two 16 bit values.
@@ -288,7 +290,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
case 1: // eAthena LOOK_HAIR
dstBeing->setHairStyle(id, -1);
break;
- case 2: // Weapon ID in id, Shield ID in id2
+ case 2: // Weapon ID in id, Shield ID in id2
dstBeing->setSprite(Being::WEAPON_SPRITE, id);
dstBeing->setSprite(Being::SHIELD_SPRITE, id2);
break;
@@ -304,6 +306,9 @@ void BeingHandler::handleMessage(MessageIn *msg)
case 6: // eAthena LOOK_HAIR_COLOR
dstBeing->setHairStyle(-1, id);
break;
+ case 8: // eAthena LOOK_SHIELD
+ dstBeing->setSprite(Being::SHIELD_SPRITE, id);
+ break;
case 9: // eAthena LOOK_SHOES
dstBeing->setSprite(Being::SHOE_SPRITE, id);
break;
@@ -345,7 +350,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
hairStyle = msg->readInt16();
dstBeing->setSprite(Being::WEAPON_SPRITE, msg->readInt16());
dstBeing->setSprite(Being::SHIELD_SPRITE, msg->readInt16());
- headBottom = msg->readInt16();
+ headBottom = msg->readInt16();
if (msg->getId() == SMSG_PLAYER_MOVE)
{
@@ -355,7 +360,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
headTop = msg->readInt16();
headMid = msg->readInt16();
hairColor = msg->readInt16();
- msg->readInt16(); // clothes color - not used
+ msg->readInt16(); // clothes color - not used
msg->readInt16(); // head dir
msg->readInt32(); // guild
msg->readInt32(); // emblem
@@ -364,7 +369,7 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->setGender(1 - msg->readInt8()); // gender
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
+ dstBeing->setSprite(Being::BOTTOMCLOTHES_SPRITE, headBottom);
dstBeing->setSprite(Being::TOPCLOTHES_SPRITE, headMid);
dstBeing->setSprite(Being::HAT_SPRITE, headTop);
dstBeing->setHairStyle(hairStyle, hairColor);
@@ -406,6 +411,32 @@ void BeingHandler::handleMessage(MessageIn *msg)
dstBeing->mFrame = 0;
break;
+ case SMSG_PLAYER_STOP:
+ // Instruction from server to stop walking at x, y.
+ id = msg->readInt32();
+ dstBeing = beingManager->findBeing(id);
+
+ if (dstBeing) {
+ dstBeing->mX = msg->readInt16();
+ dstBeing->mY = msg->readInt16();
+ if (dstBeing->mAction == Being::WALK) {
+ dstBeing->mFrame = 0;
+ dstBeing->setAction(Being::STAND);
+ }
+ } else {
+ logger->log("0x0088: Non-existent being %d", id);
+ }
+ break;
+
+ case SMSG_PLAYER_MOVE_TO_ATTACK:
+ /*
+ * This is an *advisory* message, telling the client that
+ * it needs to move the character before attacking
+ * a target (out of range, obstruction in line of fire).
+ * We can safely ignore this...
+ */
+ break;
+
case 0x0119:
// Change in players look
logger->log("0x0119 %i %i %i %x %i", msg->readInt32(),
diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h
index 03012f39..5429d962 100644
--- a/src/net/beinghandler.h
+++ b/src/net/beinghandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: beinghandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_BEINGHANDLER_H
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index 26261664..b4e2cf30 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buysellhandler.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "buysellhandler.h"
diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h
index 673aaac1..4da52c95 100644
--- a/src/net/buysellhandler.h
+++ b/src/net/buysellhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buysellhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_BUYSELLHANDLER_H
diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp
index 5cc53f7d..91f098ba 100644
--- a/src/net/charserverhandler.cpp
+++ b/src/net/charserverhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: charserverhandler.cpp 4330 2008-06-04 08:53:01Z b_lindeijer $
*/
#include "charserverhandler.h"
diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h
index ab4ca1c7..663de94d 100644
--- a/src/net/charserverhandler.h
+++ b/src/net/charserverhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: charserverhandler.h 3228 2007-03-22 23:53:13Z b_lindeijer $
*/
#ifndef _TMW_NET_CHARSERVERHANDLER_H
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp
index 524911d3..bee19112 100644
--- a/src/net/chathandler.cpp
+++ b/src/net/chathandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chathandler.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#include "chathandler.h"
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index eed19206..08a560f3 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: chathandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_CHATHANDLER_H
diff --git a/src/net/equipmenthandler.cpp b/src/net/equipmenthandler.cpp
index 85790b42..7b15ee8b 100644
--- a/src/net/equipmenthandler.cpp
+++ b/src/net/equipmenthandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipmenthandler.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "equipmenthandler.h"
diff --git a/src/net/equipmenthandler.h b/src/net/equipmenthandler.h
index 656f7a73..0121e6ad 100644
--- a/src/net/equipmenthandler.h
+++ b/src/net/equipmenthandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: equipmenthandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_EQUIPMENTHANDLER_H
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp
index 48cf18ff..c0661710 100644
--- a/src/net/inventoryhandler.cpp
+++ b/src/net/inventoryhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventoryhandler.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "inventoryhandler.h"
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index aedbc3a1..64ef8464 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: inventoryhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_INVENTORYHANDLER_H
diff --git a/src/net/itemhandler.cpp b/src/net/itemhandler.cpp
index 567a5382..9af2be10 100644
--- a/src/net/itemhandler.cpp
+++ b/src/net/itemhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemhandler.cpp 2150 2006-02-06 02:56:48Z der_doener $
*/
#include "itemhandler.h"
diff --git a/src/net/itemhandler.h b/src/net/itemhandler.h
index b2104722..702e193a 100644
--- a/src/net/itemhandler.h
+++ b/src/net/itemhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_ITEMHANDLER_H
diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp
index ab788e41..6505e39f 100644
--- a/src/net/loginhandler.cpp
+++ b/src/net/loginhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: loginhandler.cpp 3233 2007-03-24 01:57:39Z b_lindeijer $
*/
#include "loginhandler.h"
@@ -37,6 +37,7 @@ extern SERVER_INFO **server_info;
LoginHandler::LoginHandler()
{
static const Uint16 _messages[] = {
+ 0x0063,
0x0069,
0x006a,
0
@@ -48,6 +49,16 @@ void LoginHandler::handleMessage(MessageIn *msg)
{
switch (msg->getId())
{
+ case 0x0063:
+ int len;
+
+ len = msg->readInt16() - 4;
+ mUpdateHost = msg->readString(len);
+
+ logger->log("Received update host \"%s\" from login server",
+ mUpdateHost.c_str());
+ break;
+
case 0x0069:
// Skip the length word
msg->skip(2);
@@ -70,6 +81,7 @@ void LoginHandler::handleMessage(MessageIn *msg)
server_info[i]->port = msg->readInt16();
server_info[i]->name = msg->readString(20);
server_info[i]->online_users = msg->readInt32();
+ server_info[i]->updateHost = mUpdateHost;
msg->skip(2); // unknown
logger->log("Network: Server: %s (%s:%d)",
@@ -77,7 +89,7 @@ void LoginHandler::handleMessage(MessageIn *msg)
iptostring(server_info[i]->address),
server_info[i]->port);
}
- state = CHAR_SERVER_STATE;
+ state = CHAR_SERVER_STATE;
break;
case 0x006a:
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index 52014559..797655c3 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -18,13 +18,14 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: loginhandler.h 2137 2006-02-04 16:54:35Z der_doener $
*/
#ifndef _TMW_NET_LOGINHANDLER_H
#define _TMW_NET_LOGINHANDLER_H
#include "messagehandler.h"
+#include <string>
struct LoginData;
@@ -39,6 +40,9 @@ class LoginHandler : public MessageHandler
protected:
LoginData *mLoginData;
+
+ private:
+ std::string mUpdateHost;
};
#endif
diff --git a/src/net/maploginhandler.cpp b/src/net/maploginhandler.cpp
index 0afc8357..15f70baf 100644
--- a/src/net/maploginhandler.cpp
+++ b/src/net/maploginhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: maploginhandler.cpp 2239 2006-03-09 05:16:27Z der_doener $
*/
#include "maploginhandler.h"
diff --git a/src/net/maploginhandler.h b/src/net/maploginhandler.h
index fe597549..6ff6bc00 100644
--- a/src/net/maploginhandler.h
+++ b/src/net/maploginhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: maploginhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_MAPLOGINHANDLER_H
diff --git a/src/net/messagehandler.cpp b/src/net/messagehandler.cpp
index 849b6716..370a01ab 100644
--- a/src/net/messagehandler.cpp
+++ b/src/net/messagehandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messagehandler.cpp 2112 2006-01-22 13:31:13Z der_doener $
*/
#include "messagehandler.h"
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index c09037f6..90ffa489 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messagehandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_MESSAGEHANDLER_H
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index bbc0a44c..bec47a5a 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messagein.cpp 2369 2006-06-26 21:32:52Z b_lindeijer $
*/
#include "messagein.h"
diff --git a/src/net/messagein.h b/src/net/messagein.h
index d97cd8b6..0a6b8b8b 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messagein.h 1879 2005-10-16 21:18:11Z der_doener $
*/
#ifndef _TMW_MESSAGEIN_
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 9c87e69e..f5f3dad9 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messageout.cpp 3754 2007-11-20 15:19:50Z b_lindeijer $
*/
#include <cstring>
diff --git a/src/net/messageout.h b/src/net/messageout.h
index f6468adb..33deb1bb 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: messageout.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_MESSAGEOUT_
diff --git a/src/net/network.cpp b/src/net/network.cpp
index fa5964d6..4db0df54 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: network.cpp 3550 2007-08-30 16:46:21Z b_lindeijer $
*/
#include "network.h"
@@ -41,7 +41,7 @@ short packet_lengths[] = {
// #0x0040
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
+ 0, 0, 0, -1, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2,
3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6,
// #0x0080
7, 3, 2, 2, 2, 5, 16, 12, 10, 7, 29, 23, -1, -1, -1, 0,
diff --git a/src/net/network.h b/src/net/network.h
index d6fec761..53800b1e 100644
--- a/src/net/network.h
+++ b/src/net/network.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: network.h 3234 2007-03-24 13:05:27Z b_lindeijer $
*/
#ifndef _TMW_NETWORK_
diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp
index da21b2a5..29855fc0 100644
--- a/src/net/npchandler.cpp
+++ b/src/net/npchandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npchandler.cpp 2883 2006-12-03 17:00:07Z b_lindeijer $
*/
#include "npchandler.h"
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 903ecd10..7abd7495 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npchandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_NPCHANDLER_H
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
new file mode 100644
index 00000000..c1f2ba2e
--- /dev/null
+++ b/src/net/partyhandler.cpp
@@ -0,0 +1,127 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: partyhandler.cpp
+ */
+
+#include "partyhandler.h"
+
+#include "protocol.h"
+#include "messagein.h"
+
+#include "../gui/chat.h"
+#include "../gui/confirm_dialog.h"
+
+#include "../game.h"
+#include "../party.h"
+#include "../beingmanager.h"
+
+#include <guichan/actionlistener.hpp>
+
+PartyHandler::PartyHandler(Party *party) : mParty(party)
+{
+ static const Uint16 _messages[] = {
+ SMSG_PARTY_CREATE,
+ SMSG_PARTY_INFO,
+ SMSG_PARTY_INVITE,
+ SMSG_PARTY_INVITED,
+ SMSG_PARTY_SETTINGS,
+ SMSG_PARTY_MEMBER_INFO,
+ SMSG_PARTY_LEAVE,
+ SMSG_PARTY_UPDATE_HP,
+ SMSG_PARTY_UPDATE_COORDS,
+ SMSG_PARTY_MESSAGE,
+ 0
+ };
+ handledMessages = _messages;
+}
+
+void
+PartyHandler::handleMessage(MessageIn *msg)
+{
+ switch (msg->getId())
+ {
+ case SMSG_PARTY_CREATE:
+ mParty->createResponse(msg->readInt8());
+ break;
+ case SMSG_PARTY_INFO:
+ break;
+ case SMSG_PARTY_INVITE:
+ {
+ std::string nick = msg->readString(24);
+ int status = msg->readInt8();
+ mParty->inviteResponse(nick, status);
+ break;
+ }
+ case SMSG_PARTY_INVITED:
+ {
+ int id = msg->readInt32();
+ Being *being = beingManager->findBeing(id);
+ if (being == NULL)
+ {
+ break;
+ }
+ std::string nick;
+ int gender = 0;
+ std::string partyName = "";
+ if (being->getType() != Being::PLAYER)
+ {
+ nick = "";
+ }
+ else
+ {
+ nick = being->getName();
+ gender = being->getGender();
+ partyName = msg->readString(24);
+ }
+ mParty->invitedAsk(nick, gender, partyName);
+ break;
+ }
+ case SMSG_PARTY_SETTINGS:
+ break;
+ case SMSG_PARTY_MEMBER_INFO:
+ break;
+ case SMSG_PARTY_LEAVE:
+ {
+ /*int id = */msg->readInt32();
+ std::string nick = msg->readString(24);
+ /*int fail = */msg->readInt8();
+ mParty->leftResponse(nick);
+ break;
+ }
+ case SMSG_PARTY_UPDATE_HP:
+ break;
+ case SMSG_PARTY_UPDATE_COORDS:
+ break;
+ case SMSG_PARTY_MESSAGE:
+ { // new block to enable local variables
+ int msgLength = msg->readInt16() - 8;
+ if (msgLength <= 0)
+ {
+ return;
+ }
+ int id = msg->readInt32();
+ Being *being = beingManager->findBeing(id);
+ std::string chatMsg = msg->readString(msgLength);
+ mParty->receiveChat(being, chatMsg);
+ }
+ break;
+ }
+}
diff --git a/src/gui/buddywindow.h b/src/net/partyhandler.h
index a3ca4de2..de97d084 100644
--- a/src/gui/buddywindow.h
+++ b/src/net/partyhandler.h
@@ -18,41 +18,24 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: partyhandler.h
*/
-#ifndef _TMW_BUDDYWINDOW_H
-#define _TMW_BUDDYWINDOW_H
+#ifndef _TMW_NET_PARTYHANDLER_H
+#define _TMW_NET_PARTYHANDLER_H
-#include <guichan/actionlistener.hpp>
+#include "messagehandler.h"
-#include "window.h"
+class Party;
-#include "../guichanfwd.h"
-
-class BuddyList;
-
-/**
- * Window showing buddy list.
- *
- * \ingroup Interface
- */
-class BuddyWindow : public Window, public gcn::ActionListener
+class PartyHandler : public MessageHandler
{
public:
- /**
- * Constructor.
- */
- BuddyWindow();
-
- /**
- * Performs action.
- */
- void action(const gcn::ActionEvent &event);
+ PartyHandler(Party *party);
+ void handleMessage(MessageIn *msg);
private:
- BuddyList *mBuddyList;
- gcn::ListBox *mListbox;
+ Party *mParty;
};
-#endif /* _TMW_BUDDYWINDOW_H */
+#endif
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 2502c144..7f9e455a 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: playerhandler.cpp 4190 2008-04-26 17:37:03Z peaveydk $
*/
#include "playerhandler.h"
@@ -109,10 +109,16 @@ void PlayerHandler::handleMessage(MessageIn *msg)
switch (msg->getId())
{
case SMSG_WALK_RESPONSE:
- // It is assumed by the client any request to walk actually
- // succeeds on the server. The plan is to have a correction
- // message when the server senses the client has the wrong
- // idea.
+ /*
+ * This client assumes that all walk messages succeed,
+ * and that the server will send a correction notice
+ * otherwise.
+ *
+ * Note that this packet is also used by eAthena to notify
+ * the client of a server-generated auto-move. A patch has
+ * been submitted to Mantis to eliminate these auto moves,
+ * since they're inconsistent with the client design.
+ */
break;
case SMSG_PLAYER_WARP:
@@ -345,18 +351,5 @@ void PlayerHandler::handleMessage(MessageIn *msg)
}
}
break;
-
- //Stop walking
- //case 0x0088: // Disabled because giving some problems
- //if (being = beingManager->findBeing(readInt32(2))) {
- // if (being->getId() != player_node->getId()) {
- // being->action = STAND;
- // being->mFrame = 0;
- // set_coordinates(being->coordinates,
- // readWord(6), readWord(8),
- // get_direction(being->coordinates));
- // }
- //}
- //break;
}
}
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index b28a23f5..f7c0672d 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: playerhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_PLAYERHANDLER_H
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index d3db50bf..791b7fe5 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: protocol.cpp 2158 2006-02-07 10:37:54Z der_doener $
*/
#include "protocol.h"
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 811d5481..f90fcba3 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: protocol.h 4321 2008-06-02 11:42:26Z b_lindeijer $
*/
#ifndef _TMW_PROTOCOL_
@@ -29,6 +29,8 @@
#define SMSG_PLAYER_UPDATE_1 0x01d8
#define SMSG_PLAYER_UPDATE_2 0x01d9
#define SMSG_PLAYER_MOVE 0x01da /**< A nearby player moves */
+#define SMSG_PLAYER_STOP 0x0088 /**< Stop walking, set position */
+#define SMSG_PLAYER_MOVE_TO_ATTACK 0x0139 /**< Move to within attack range */
#define SMSG_PLAYER_STAT_UPDATE_1 0x00b0
#define SMSG_PLAYER_STAT_UPDATE_2 0x00b1
#define SMSG_PLAYER_STAT_UPDATE_3 0x0141
@@ -63,6 +65,7 @@
#define SMSG_BEING_ACTION 0x008a /**< Attack, sit, stand up, ... */
#define SMSG_BEING_CHAT 0x008d /**< A being talks */
#define SMSG_BEING_NAME_RESPONSE 0x0095 /**< Has to be requested */
+
#define SMSG_NPC_MESSAGE 0x00b4
#define SMSG_NPC_NEXT 0x00b5
#define SMSG_NPC_CLOSE 0x00b6
@@ -72,11 +75,13 @@
#define SMSG_NPC_SELL 0x00c7
#define SMSG_NPC_BUY_RESPONSE 0x00ca
#define SMSG_NPC_SELL_RESPONSE 0x00cb
+
#define SMSG_PLAYER_CHAT 0x008e /**< Player talks */
#define SMSG_WHISPER 0x0097 /**< Whisper Recieved */
#define SMSG_WHISPER_RESPONSE 0x0098
#define SMSG_GM_CHAT 0x009a /**< GM announce */
#define SMSG_WALK_RESPONSE 0x0087
+
#define SMSG_TRADE_REQUEST 0x00e5 /**< Receiving a request to trade */
#define SMSG_TRADE_RESPONSE 0x00e7
#define SMSG_TRADE_ITEM_ADD 0x00e9
@@ -85,6 +90,17 @@
#define SMSG_TRADE_CANCEL 0x00ee
#define SMSG_TRADE_COMPLETE 0x00f0
+#define SMSG_PARTY_CREATE 0x00fa
+#define SMSG_PARTY_INFO 0x00fb
+#define SMSG_PARTY_INVITE 0x00fd
+#define SMSG_PARTY_INVITED 0x00fe
+#define SMSG_PARTY_SETTINGS 0x0102
+#define SMSG_PARTY_MEMBER_INFO 0x0104
+#define SMSG_PARTY_LEAVE 0x0105
+#define SMSG_PARTY_UPDATE_HP 0x0106
+#define SMSG_PARTY_UPDATE_COORDS 0x0107
+#define SMSG_PARTY_MESSAGE 0x0109
+
// Packets from client to server
#define CMSG_TRADE_RESPONSE 0x00e6
#define CMSG_ITEM_PICKUP 0x009f
@@ -93,6 +109,8 @@
#define CMSG_NPC_BUY_SELL_REQUEST 0x00c5
#define CMSG_CHAT_MESSAGE 0x008c
#define CMSG_CHAT_WHISPER 0x0096
+#define CMSG_CHAT_ANNOUNCE 0x0099
+#define CMSG_CHAT_WHO 0x00c1
#define CMSG_NPC_LIST_CHOICE 0x00b8
#define CMSG_NPC_NEXT_REQUEST 0x00b9
#define CMSG_NPC_SELL_REQUEST 0x00c9
@@ -109,6 +127,13 @@
#define CMSG_PLAYER_EQUIP 0x00a9
#define CMSG_PLAYER_UNEQUIP 0x00ab
+#define CMSG_PARTY_CREATE 0x00f9
+#define CMSG_PARTY_INVITE 0x00fc
+#define CMSG_PARTY_INVITED 0x00ff
+#define CMSG_PARTY_LEAVE 0x0100 /** Undocumented */
+#define CMSG_PARTY_SETTINGS 0x0101
+#define CMSG_PARTY_MESSAGE 0x0108
+
/** Encodes coords and direction in 3 bytes data */
void set_coordinates(char *data, unsigned short x, unsigned short y, unsigned char direction);
diff --git a/src/net/skillhandler.cpp b/src/net/skillhandler.cpp
index 828c2378..1f9403f4 100644
--- a/src/net/skillhandler.cpp
+++ b/src/net/skillhandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: skillhandler.cpp 2832 2006-11-05 20:57:59Z b_lindeijer $
*/
#include "skillhandler.h"
diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h
index 820a7b6a..734772b4 100644
--- a/src/net/skillhandler.h
+++ b/src/net/skillhandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: skillhandler.h 2112 2006-01-22 13:31:13Z der_doener $
*/
#ifndef _TMW_NET_SKILLHANDLER_H
diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp
index 9599fa9d..cfd24977 100644
--- a/src/net/tradehandler.cpp
+++ b/src/net/tradehandler.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tradehandler.cpp 4354 2008-06-17 16:52:44Z the_enemy $
*/
#include "tradehandler.h"
diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h
index a1971004..22e01f48 100644
--- a/src/net/tradehandler.h
+++ b/src/net/tradehandler.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tradehandler.h 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#ifndef _TMW_NET_TRADEHANDLER_H
diff --git a/src/npc.cpp b/src/npc.cpp
index 2177aedc..ec7088ab 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npc.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "npc.h"
@@ -26,6 +26,7 @@
#include "animatedsprite.h"
#include "graphics.h"
#include "particle.h"
+#include "text.h"
#include "net/messageout.h"
#include "net/protocol.h"
@@ -35,6 +36,9 @@
NPC *current_npc = 0;
+static const int NAME_X_OFFSET = 15;
+static const int NAME_Y_OFFSET = 30;
+
NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network):
Being(id, job, map), mNetwork(network)
{
@@ -62,23 +66,32 @@ NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network):
Particle *p = particleEngine->addEffect(*i, 0, 0);
this->controlParticle(p);
}
+ mName = 0;
}
-Being::Type
-NPC::getType() const
+NPC::~NPC()
{
- return Being::NPC;
+ if (mName)
+ {
+ delete mName;
+ }
}
-void
-NPC::drawName(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
+void NPC::setName(const std::string &name)
{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
+ if (mName)
+ {
+ delete mName;
+ }
+ mName = new Text(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER, speechFont,
+ gcn::Color(200, 200, 255));
+ }
- graphics->setFont(speechFont);
- graphics->setColor(gcn::Color(200, 200, 255));
- graphics->drawText(mName, px + 15, py + 30, gcn::Graphics::CENTER);
+Being::Type
+NPC::getType() const
+{
+ return Being::NPC;
}
void
@@ -129,3 +142,11 @@ NPC::sell()
outMsg.writeInt32(mId);
outMsg.writeInt8(1);
}
+
+void NPC::updateCoords()
+{
+ if (mName)
+ {
+ mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET);
+ }
+}
diff --git a/src/npc.h b/src/npc.h
index 0d9966bd..432d26d1 100644
--- a/src/npc.h
+++ b/src/npc.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npc.h 2883 2006-12-03 17:00:07Z b_lindeijer $
*/
#ifndef _TMW_NPC_H
@@ -28,18 +28,20 @@
class Network;
class Graphics;
+class Text;
class NPC : public Being
{
public:
NPC(Uint32 id, Uint16 job, Map *map, Network *network);
+ ~NPC();
+
+ void setName(const std::string &name);
+
virtual Type
getType() const;
- virtual void
- drawName(Graphics *graphics, Sint32 offsetX, Sint32 offsetY);
-
void talk();
void nextDialog();
void dialogChoice(char choice);
@@ -49,6 +51,9 @@ class NPC : public Being
protected:
Network *mNetwork;
+ void updateCoords();
+ private:
+ Text *mName;
};
extern NPC *current_npc;
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 5b34de18..6ffc5668 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: openglgraphics.cpp 4130 2008-04-18 20:39:29Z the_enemy $
*/
#include "main.h"
diff --git a/src/openglgraphics.h b/src/openglgraphics.h
index ee5bc1e1..c3dc794c 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: openglgraphics.h 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#ifndef _TMW_OPENGLGRAPHICS_H
diff --git a/src/particle.cpp b/src/particle.cpp
index 3b3f5116..651fae41 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: particle.cpp 4362 2008-06-24 12:29:33Z crush_tmw $
*/
#include <algorithm>
diff --git a/src/particle.h b/src/particle.h
index 88a38417..d4a671c7 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: particle.h 4362 2008-06-24 12:29:33Z crush_tmw $
*/
#ifndef _PARTICLE_H
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 631ca228..996e3396 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: particleemitter.cpp 4362 2008-06-24 12:29:33Z crush_tmw $
*/
#include "particleemitter.h"
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 2f45608d..481d4b44 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: particleemitter.h 4362 2008-06-24 12:29:33Z crush_tmw $
*/
#ifndef _PARTICLEEMITTER_H
diff --git a/src/party.cpp b/src/party.cpp
new file mode 100644
index 00000000..39c39352
--- /dev/null
+++ b/src/party.cpp
@@ -0,0 +1,219 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: party.cpp
+ */
+
+#include "party.h"
+
+#include "beingmanager.h"
+#include "localplayer.h"
+#include "game.h"
+
+#include "gui/chat.h"
+#include "gui/confirm_dialog.h"
+
+#include "net/messageout.h"
+#include "net/protocol.h"
+
+Party::Party(ChatWindow *chat, Network *network) :
+ mChat(chat), mNetwork(network), mInviteListener(network, &mInParty)
+{
+}
+
+void Party::respond(const std::string &command, const std::string &args)
+{
+ if (command == "new" || command == "create")
+ {
+ create(args);
+ return;
+ }
+ if (command == "leave")
+ {
+ leave(args);
+ return;
+ }
+ if (command == "settings")
+ {
+ mChat->chatLog("Not yet implemented!", BY_SERVER);
+ return;
+ /*
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_PARTY_SETTINGS);
+ outMsg.writeInt16(0); // Experience
+ outMsg.writeInt16(0); // Item
+ */
+ }
+ mChat->chatLog("Party command not known.", BY_SERVER);
+}
+
+void Party::create(const std::string &party)
+{
+ if (party == "")
+ {
+ mChat->chatLog("Party name is missing.", BY_SERVER);
+ return;
+ }
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_PARTY_CREATE);
+ outMsg.writeString(party.substr(0, 23), 24);
+ mCreating = true;
+}
+
+void Party::leave(const std::string &args)
+{
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_PARTY_LEAVE);
+ mChat->chatLog("Left party.", BY_SERVER);
+ mInParty = false;
+}
+
+void Party::createResponse(bool ok)
+{
+ if (ok)
+ {
+ mChat->chatLog("Party successfully created.", BY_SERVER);
+ mInParty = true;
+ }
+ else
+ {
+ mChat->chatLog("Could not create party.", BY_SERVER);
+ }
+}
+
+void Party::inviteResponse(const std::string &nick, int status)
+{
+ switch (status)
+ {
+ case 0:
+ mChat->chatLog(nick + " is already a member of a party.",
+ BY_SERVER);
+ break;
+ case 1:
+ mChat->chatLog(nick + " refused your invitation.", BY_SERVER);
+ break;
+ case 2:
+ mChat->chatLog(nick + " is now a member of your party.",
+ BY_SERVER);
+ break;
+ }
+}
+
+void Party::invitedAsk(const std::string &nick, int gender,
+ const std::string &partyName)
+{
+ mPartyName = partyName; /* Quick and nasty - needs redoing */
+ if (nick == "")
+ {
+ mChat->chatLog("Something\'s wrong!", BY_SERVER);
+ return;
+ }
+ mCreating = false;
+ ConfirmDialog *dlg = new ConfirmDialog("Invite to party",
+ nick + " invites you to join " +
+ (gender == 0 ? "his" : "her") +
+ " party, " + partyName +
+ ", do you accept?");
+ dlg->addActionListener(&mInviteListener);
+}
+
+void Party::InviteListener::action(const gcn::ActionEvent &event)
+{
+ MessageOut outMsg(mNetwork);
+ outMsg.writeInt16(CMSG_PARTY_INVITED);
+ outMsg.writeInt32(player_node->getId());
+ bool accept = event.getId() == "yes";
+ outMsg.writeInt32(accept ? 1 : 0);
+ *mInParty = *mInParty || accept;
+}
+
+void Party::leftResponse(const std::string &nick)
+{
+ mChat->chatLog(nick + " has left your party.", BY_SERVER);
+}
+
+void Party::receiveChat(Being *being, const std::string &msg)
+{
+ if (being == NULL)
+ {
+ return;
+ }
+ if (being->getType() != Being::PLAYER)
+ {
+ mChat->chatLog("Something\'s wrong!", BY_SERVER);
+ return;
+ }
+ being->setSpeech(msg, SPEECH_TIME);
+ mChat->chatLog(being->getName() + " : " + msg, BY_PARTY);
+}
+
+void Party::help()
+{
+ mChat->chatLog("/party <command> <params>: Party commands.", BY_SERVER);
+}
+
+void Party::help(const std::string &msg)
+{
+ if (msg == "")
+ {
+ mChat->chatLog("Command: /party <command> <args>", BY_SERVER);
+ mChat->chatLog("where <command> can be one of:", BY_SERVER);
+ mChat->chatLog(" /new", BY_SERVER);
+ mChat->chatLog(" /create", BY_SERVER);
+ mChat->chatLog(" /prefix", BY_SERVER);
+ mChat->chatLog(" /leave", BY_SERVER);
+ mChat->chatLog("This command implements the partying function.",
+ BY_SERVER);
+ mChat->chatLog("Type /help party <command> for further help.",
+ BY_SERVER);
+ return;
+ }
+ if (msg == "new" || msg == "create")
+ {
+ mChat->chatLog("Command: /party new <party-name>", BY_SERVER);
+ mChat->chatLog("Command: /party create <party-name>", BY_SERVER);
+ mChat->chatLog("These commands create a new party <party-name.",
+ BY_SERVER);
+ return;
+ }
+ if (msg == "prefix")
+ {
+ mChat->chatLog("Command: /party prefix <prefix-char>", BY_SERVER);
+ mChat->chatLog("This command sets the party prefix character.",
+ BY_SERVER);
+ mChat->chatLog("Any message preceded by <prefix-char> is sent to "
+ "the party instead of everyone.", BY_SERVER);
+ mChat->chatLog("Command: /party prefix", BY_SERVER);
+ mChat->chatLog("This command reports the current party prefix "
+ "character.", BY_SERVER);
+ return;
+ }
+ //if (msg == "settings")
+ //if (msg == "info")
+ if (msg == "leave")
+ {
+ mChat->chatLog("Command: /party leave", BY_SERVER);
+ mChat->chatLog("This command causes the player to leave the party.",
+ BY_SERVER);
+ return;
+ }
+ mChat->chatLog("Unknown /party command.", BY_SERVER);
+ mChat->chatLog("Type /help party for a list of options.", BY_SERVER);
+}
diff --git a/src/party.h b/src/party.h
new file mode 100644
index 00000000..d4f51b5a
--- /dev/null
+++ b/src/party.h
@@ -0,0 +1,75 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: party.h
+ */
+
+#ifndef _TMW_PARTY_H
+#define _TMW_PARTY_H
+
+#include <string>
+
+#include <guichan/actionlistener.hpp>
+
+class PartyHandler;
+class Being;
+class ChatWindow;
+class Network;
+
+class Party
+{
+ public:
+ Party(ChatWindow *chat, Network *network);
+ void respond(const std::string &command, const std::string &args);
+
+ void create(const std::string &party);
+ void leave(const std::string &args);
+
+ void createResponse(bool ok);
+ void inviteResponse(const std::string &nick, int status);
+ void invitedAsk(const std::string &nick, int gender,
+ const std::string &partyName);
+ void leftResponse(const std::string &nick);
+ void receiveChat(Being *being, const std::string &msg);
+
+ void help();
+ void help(const std::string &msg);
+ private:
+ ChatWindow *mChat;
+ std::string mPartyName;
+ Network *mNetwork;
+ bool mInParty;
+ bool mCreating; /**< Used to give an appropriate response to
+ failure */
+ PartyHandler *handler;
+
+ class InviteListener : public gcn::ActionListener
+ {
+ public:
+ InviteListener(Network *network, bool *inParty) :
+ mNetwork(network), mInParty(inParty) {};
+ void action(const gcn::ActionEvent &event);
+ Network *mNetwork;
+ private:
+ bool *mInParty;
+ };
+ InviteListener mInviteListener;
+};
+#endif
diff --git a/src/player.cpp b/src/player.cpp
index d0c6bdc6..5db009ba 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: player.cpp 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#include "player.h"
@@ -34,11 +34,34 @@
#include "utils/strprintf.h"
#include "gui/gui.h"
+#include <iostream>
+
+static const int NAME_X_OFFSET = 15;
+static const int NAME_Y_OFFSET = 30;
Player::Player(int id, int job, Map *map):
- Being(id, job, map),
- mDrawStrategy(NULL)
+ Being(id, job, map)
{
+ mName = 0;
+}
+
+Player::~Player()
+{
+ if (mName)
+ {
+ delete mName;
+ }
+}
+
+void Player::setName(const std::string &name)
+{
+ if (mName == 0)
+ {
+ mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER,
+ speechFont, gcn::Color(255, 255, 255));
+ Being::setName(name);
+ }
}
void
@@ -75,37 +98,13 @@ Player::getType() const
return PLAYER;
}
-
void
-Player::setNameDrawStrategy(PlayerNameDrawStrategy *draw_strategy)
+Player::flash(int time)
{
- if (mDrawStrategy)
- delete mDrawStrategy;
- mDrawStrategy = draw_strategy;
-}
-
-class
-DefaultPlayerNameDrawStrategy : public PlayerNameDrawStrategy
-{
-public:
- virtual void draw(Player *player, Graphics *graphics, int px, int py)
+ if (mName)
{
- graphics->setFont(speechFont);
- graphics->setColor(gcn::Color(255, 255, 255));
- graphics->drawText(player->getName(), px + 15, py + 30, gcn::Graphics::CENTER);
+ mName->flash(time);
}
-};
-
-void
-Player::drawName(Graphics *graphics, int offsetX, int offsetY)
-{
- int px = mPx + offsetX;
- int py = mPy + offsetY;
-
- if (mDrawStrategy)
- mDrawStrategy->draw(this, graphics, px, py);
- else
- DefaultPlayerNameDrawStrategy().draw(this, graphics, px, py);
}
void Player::setGender(int gender)
@@ -202,3 +201,11 @@ void Player::setSprite(int slot, int id, std::string color)
Being::setSprite(slot, id, color);
}
+
+void Player::updateCoords()
+{
+ if (mName)
+ {
+ mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET);
+ }
+}
diff --git a/src/player.h b/src/player.h
index f43a6039..fdca64e8 100644
--- a/src/player.h
+++ b/src/player.h
@@ -18,30 +18,18 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: player.h 4237 2008-05-14 18:57:32Z b_lindeijer $
*/
#ifndef _TMW_PLAYER_H
#define _TMW_PLAYER_H
#include "being.h"
+#include "text.h"
class Graphics;
class Map;
-class Player;
-
-class PlayerNameDrawStrategy
-{
-public:
- virtual ~PlayerNameDrawStrategy(void) {}
-
- /**
- * Draw the player's name
- */
- virtual void draw(Player *p, Graphics *graphics, int px, int py) = 0;
-};
-
/**
* A player being. Players have their name drawn beneath them. This class also
* implements player-specific loading of base sprite, hair sprite and equipment
@@ -52,6 +40,14 @@ class Player : public Being
public:
Player(int id, int job, Map *map);
+ ~Player();
+
+ /**
+ * Set up mName to be the character's name
+ */
+ virtual void
+ setName(const std::string &name);
+
virtual void
logic();
@@ -59,9 +55,6 @@ class Player : public Being
getType() const;
virtual void
- drawName(Graphics *graphics, int offsetX, int offsetY);
-
- virtual void
setGender(int gender);
/**
@@ -83,19 +76,13 @@ class Player : public Being
setSprite(int slot, int id, std::string color = "");
/**
- * Sets the strategy responsible for drawing the player's name
- *
- * \param draw_strategy A strategy describing how the player's name
- * should be drawn, or NULL for default
+ * Flash the player's name
*/
- virtual void
- setNameDrawStrategy(PlayerNameDrawStrategy *draw_strategy);
-
- virtual PlayerNameDrawStrategy *
- getNameDrawStrategy(void) const { return mDrawStrategy; }
-
+ void flash(int time);
+ protected:
+ void updateCoords();
private:
- PlayerNameDrawStrategy *mDrawStrategy;
+ FlashText *mName;
};
#endif
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index 610f5d04..8abc9848 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -88,7 +88,7 @@ PlayerRelationsManager::PlayerRelationsManager() :
mDefaultPermissions(PlayerRelation::DEFAULT),
mIgnoreStrategy(NULL)
{
-}
+}
void
PlayerRelationsManager::clear()
@@ -325,29 +325,6 @@ public:
};
-class
-BlinkPlayerNameDrawStrategy : public PlayerNameDrawStrategy
-{
-public:
- BlinkPlayerNameDrawStrategy(int count) :
- mCount(count)
- {
- }
-
- virtual void draw(Player *player, Graphics *graphics, int px, int py)
- {
- graphics->setFont(speechFont);
- if (mCount & 4)
- graphics->drawText(player->getName(), px + 15, py + 30, gcn::Graphics::CENTER);
-
- if (mCount-- <= 0)
- player->setNameDrawStrategy(NULL);
- }
-private:
- int mCount; // Number of steps to blink
-};
-
-
class PIS_blinkname : public PlayerIgnoreStrategy
{
public:
@@ -360,7 +337,7 @@ public:
virtual void
ignore(Player *player, unsigned int flags)
{
- player->setNameDrawStrategy(new BlinkPlayerNameDrawStrategy(200));
+ player->flash(200);
}
};
@@ -407,4 +384,3 @@ PlayerRelationsManager::getPlayerIgnoreStrategies()
PlayerRelationsManager player_relations;
-
diff --git a/src/properties.h b/src/properties.h
index 93148bdf..9ebead66 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: properties.h 3754 2007-11-20 15:19:50Z b_lindeijer $
*/
#ifndef _TMW_PROPERTIES_H_
diff --git a/src/recorder.cpp b/src/recorder.cpp
new file mode 100644
index 00000000..48ecb837
--- /dev/null
+++ b/src/recorder.cpp
@@ -0,0 +1,112 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: record.cpp
+ */
+
+#include "recorder.h"
+
+#include "gui/chat.h"
+#include "gui/buttonbox.h"
+
+#include "utils/trim.h"
+
+Recorder::Recorder(ChatWindow *chat) : mChat(chat)
+{
+ mButtonBox = new ButtonBox("Recording...", "Stop recording", this);
+ mButtonBox->setY(20);
+}
+
+void Recorder::record(const std::string &msg)
+{
+ if (mStream.is_open())
+ {
+ mStream << msg << std::endl;
+ }
+}
+
+void Recorder::respond(const std::string &msg)
+{
+ std::string msgCopy = msg;
+ trim(msgCopy);
+ if (msgCopy == "")
+ {
+ if (mStream.is_open())
+ {
+ mStream.close();
+ mButtonBox->setVisible(false);
+ /*
+ * Message should go after mStream is closed so that it isn't
+ * recorded.
+ */
+ mChat->chatLog("Finishing recording.", BY_SERVER);
+ }
+ else
+ {
+ mChat->chatLog("Not currently recording.", BY_SERVER);
+ }
+ return;
+ }
+ if (mStream.is_open())
+ {
+ mChat->chatLog("Already recording.", BY_SERVER);
+ }
+ else
+ {
+ /*
+ * Message should go before mStream is opened so that it isn't
+ * recorded.
+ */
+ mChat->chatLog("Starting to record...", BY_SERVER);
+ mStream.open(msg.c_str(), std::ios_base::trunc);
+ if (mStream.is_open())
+ {
+ mButtonBox->setVisible(true);
+ }
+ else
+ {
+ mChat->chatLog("Failed to start recording.", BY_SERVER);
+ }
+ }
+}
+
+void Recorder::help() const
+{
+ mChat->chatLog("/record <filename>: Start recording the chat.", BY_SERVER);
+}
+
+void Recorder::help(const std::string &args) const
+{
+ mChat->chatLog("Command: /record <filename>", BY_SERVER);
+ mChat->chatLog("This command starts recording the chat log to the file "
+ "<filename>.", BY_SERVER);
+ mChat->chatLog("Command: /record", BY_SERVER);
+ mChat->chatLog("This command finishes a recording session.", BY_SERVER);
+}
+
+void Recorder::buttonBoxRespond()
+{
+ respond("");
+}
+
+Recorder::~Recorder()
+{
+ delete mButtonBox;
+}
diff --git a/src/recorder.h b/src/recorder.h
new file mode 100644
index 00000000..2795cd53
--- /dev/null
+++ b/src/recorder.h
@@ -0,0 +1,50 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World 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,
+ * 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
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: record.h
+ */
+
+#ifndef _TMW_RECORD_H
+#define _TMW_RECORD_H
+
+#include <string>
+#include <fstream>
+
+#include "gui/buttonbox.h"
+
+class ChatWindow;
+
+class Recorder : public ButtonBoxListener
+{
+ public:
+ Recorder(ChatWindow *chat);
+ void record(const std::string &msg);
+ void respond(const std::string &msg);
+ void help() const;
+ void help(const std::string &args) const;
+ void buttonBoxRespond();
+ bool isRecording() const {return mStream.is_open();}
+ ~Recorder();
+ private:
+ ChatWindow *mChat;
+ std::ofstream mStream;
+ ButtonBox *mButtonBox;
+};
+#endif
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index 6b3c2f52..facd23fb 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: action.cpp 3676 2007-10-23 08:02:22Z b_lindeijer $
*/
#include "action.h"
diff --git a/src/resources/action.h b/src/resources/action.h
index 8d5e8d11..61307652 100644
--- a/src/resources/action.h
+++ b/src/resources/action.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: action.h 2905 2006-12-12 15:06:06Z b_lindeijer $
*/
#ifndef _TMW_ACTION_H
diff --git a/src/resources/ambientoverlay.cpp b/src/resources/ambientoverlay.cpp
index 058b6083..654cbb32 100644
--- a/src/resources/ambientoverlay.cpp
+++ b/src/resources/ambientoverlay.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ambientoverlay.cpp 2727 2006-10-07 20:01:34Z b_lindeijer $
*/
#include "ambientoverlay.h"
diff --git a/src/resources/ambientoverlay.h b/src/resources/ambientoverlay.h
index a939cbb4..c0b18600 100644
--- a/src/resources/ambientoverlay.h
+++ b/src/resources/ambientoverlay.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: ambientoverlay.h 2727 2006-10-07 20:01:34Z b_lindeijer $
*/
#ifndef _TMW_RESOURCES_AMBIENTOVERLAY_H_
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index de96525c..b740b9b5 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: animation.cpp 2905 2006-12-12 15:06:06Z b_lindeijer $
*/
#include "animation.h"
diff --git a/src/resources/animation.h b/src/resources/animation.h
index aad93cda..53420ecd 100644
--- a/src/resources/animation.h
+++ b/src/resources/animation.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: animation.h 3301 2007-05-23 21:35:01Z b_lindeijer $
*/
#ifndef _TMW_ANIMATION_H
diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp
index 32d8d9f4..c917a45e 100644
--- a/src/resources/buddylist.cpp
+++ b/src/resources/buddylist.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buddylist.cpp 4332 2008-06-05 07:33:12Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h
index 3791a03a..5a8f2324 100644
--- a/src/resources/buddylist.h
+++ b/src/resources/buddylist.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: buddylist.h 2239 2006-03-09 05:16:27Z der_doener $
*/
#ifndef _TMW_BUDDYLIST_H
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index d0dae462..dc22a69b 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: image.cpp 3760 2007-11-21 19:43:11Z b_lindeijer $
*/
#include <SDL_image.h>
diff --git a/src/resources/image.h b/src/resources/image.h
index 52f286f8..6f10f858 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: image.h 3760 2007-11-21 19:43:11Z b_lindeijer $
*/
#ifndef _TMW_IMAGE_H
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 4b6dd592..6228f4e4 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imageset.cpp 4209 2008-04-29 12:58:21Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/resources/imageset.h b/src/resources/imageset.h
index 15c21d90..719e9769 100644
--- a/src/resources/imageset.h
+++ b/src/resources/imageset.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imageset.h 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#ifndef _TMW_IMAGESET_H
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 7cfa16b4..f11cad24 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imagewriter.cpp 2417 2006-07-19 15:12:06Z umperio $
*/
#include "imagewriter.h"
diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h
index 205e4584..c7968d30 100644
--- a/src/resources/imagewriter.h
+++ b/src/resources/imagewriter.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: imagewriter.h 1766 2005-09-18 01:31:33Z bertram25 $
*/
#include <iosfwd>
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 71bd898a..52d19161 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemdb.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include <algorithm>
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 0029129c..1ee1b5f0 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: itemdb.h 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#ifndef _TMW_ITEM_MANAGER_H
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index f1ebd0a9..64f5c37e 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: iteminfo.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "iteminfo.h"
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 680c8d61..85f79263 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: iteminfo.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _TMW_ITEMINFO_H_
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 2a080fb0..3dbaefde 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: mapreader.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "mapreader.h"
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index d16ff1d5..0d59fc9f 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: mapreader.h 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#ifndef _TMW_MAPREADER_H_
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 0a98762f..04de0e7c 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: monsterdb.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include <algorithm>
diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h
index 46a33b06..43865bb3 100644
--- a/src/resources/monsterdb.h
+++ b/src/resources/monsterdb.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: monsterdb.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_MONSTER_DB_H
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index 161d8b01..0e327218 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: music.cpp 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#include "music.h"
diff --git a/src/resources/music.h b/src/resources/music.h
index 72e76295..a15d22c1 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: music.h 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#ifndef _TMW_MUSIC_H
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 5869e295..c310d6e3 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npcdb.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "npcdb.h"
diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h
index 2abf959b..e1240c5e 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: npcdb.h 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#ifndef _TMW_NPC_DB_H
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 8f21f5d2..2bb60e56 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resource.cpp 3808 2007-12-22 21:33:47Z b_lindeijer $
*/
#include <cassert>
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 5b9a5eb8..9c70f6c0 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resource.h 3808 2007-12-22 21:33:47Z b_lindeijer $
*/
#ifndef _TMW_RESOURCE_H
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index ef8671a8..6b45c9d7 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resourcemanager.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include <cassert>
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index da85e2f9..3f0f1704 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: resourcemanager.h 3839 2008-01-13 16:28:50Z the_enemy $
*/
#ifndef _TMW_RESOURCE_MANAGER_H
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index ec9bc65c..03fa337e 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: soundeffect.cpp 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#include "soundeffect.h"
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 866c53ec..0a574e7d 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: soundeffect.h 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#ifndef _TMW_SOUND_EFFECT_H
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 334474d7..550b2d1c 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: spritedef.cpp 4332 2008-06-05 07:33:12Z b_lindeijer $
*/
#include <set>
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 531dfb3d..2872af06 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: spritedef.h 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#ifndef _TMW_SPRITEDEF_H
diff --git a/src/serverinfo.h b/src/serverinfo.h
index b317b87b..9a9eef1d 100644
--- a/src/serverinfo.h
+++ b/src/serverinfo.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: serverinfo.h 1735 2005-09-13 22:56:29Z der_doener $
*/
#ifndef _TMW_SERVERINFO_
@@ -32,6 +32,7 @@ struct SERVER_INFO
short port;
std::string name;
short online_users;
+ std::string updateHost;
};
#endif
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index ed5d30a9..8bd79cc1 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: shopitem.cpp 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#include "shopitem.h"
diff --git a/src/shopitem.h b/src/shopitem.h
index ffafbebe..4e6fd3a3 100644
--- a/src/shopitem.h
+++ b/src/shopitem.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: shopitem.h 4347 2008-06-12 09:06:01Z b_lindeijer $
*/
#ifndef _SHOPITEM_H_
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 18e732ef..db1c0c91 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: simpleanimation.cpp 3587 2007-09-20 13:24:20Z b_lindeijer $
*/
#include "simpleanimation.h"
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index 561c540d..dfca33e2 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: simpleanimation.h 3301 2007-05-23 21:35:01Z b_lindeijer $
*/
#ifndef _TMW_SIMPLEANIMAION_H
diff --git a/src/sound.cpp b/src/sound.cpp
index 0a20d3f2..f0101442 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: sound.cpp 3892 2008-02-18 10:00:45Z umperio $
*/
#include "sound.h"
diff --git a/src/sound.h b/src/sound.h
index ebcd6442..038f299e 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: sound.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_SOUND_H
diff --git a/src/sprite.h b/src/sprite.h
index 89780519..cbe32186 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: sprite.h 3292 2007-05-07 16:22:54Z crush_tmw $
*/
#ifndef _TMW_SPRITE_H_
diff --git a/src/text.cpp b/src/text.cpp
new file mode 100644
index 00000000..545c1c0e
--- /dev/null
+++ b/src/text.cpp
@@ -0,0 +1,102 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Douglas Boffey *
+ * *
+ * DougABoffey@netscape.net *
+ * This 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 *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed with The Mana Experiment *
+ * 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 "text.h"
+
+#include <cstring>
+
+#include <guichan/font.hpp>
+
+#include "textmanager.h"
+
+int Text::mInstances = 0;
+
+
+Text::Text(const std::string &text, int x, int y,
+ gcn::Graphics::Alignment alignment, gcn::Font *font,
+ gcn::Color colour) :
+ mText(text), mColour(colour)
+{
+ if (textManager == 0)
+ {
+ textManager = new TextManager();
+ }
+ ++mInstances;
+ mHeight = font->getHeight();
+ mWidth = font->getWidth(text);
+ switch (alignment)
+ {
+ case gcn::Graphics::LEFT:
+ mXOffset = 0;
+ break;
+ case gcn::Graphics::CENTER:
+ mXOffset = mWidth / 2;
+ break;
+ case gcn::Graphics::RIGHT:
+ mXOffset = mWidth;
+ break;
+ }
+ mX = x - mXOffset;
+ mY = y;
+ textManager->addText(this);
+ mFont = font;
+}
+
+void Text::adviseXY(int x, int y)
+{
+ textManager->moveText(this, x - mXOffset, y);
+}
+
+Text::~Text()
+{
+ textManager->removeText(this);
+ if (--mInstances == 0)
+ {
+ delete textManager;
+ textManager = 0;
+ }
+}
+
+void Text::draw(Graphics *graphics, int xOff, int yOff)
+{
+ graphics->setFont(mFont);
+ graphics->setColor(mColour);
+ graphics->drawText(mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT);
+}
+
+FlashText::FlashText(const std::string &text, int x, int y,
+ gcn::Graphics::Alignment alignment, gcn::Font *font,
+ gcn::Color colour) :
+ Text(text, x, y, alignment, font, colour), mTime(0)
+{
+}
+
+void FlashText::draw(Graphics *graphics, int xOff, int yOff)
+{
+ if (mTime)
+ {
+ if ((--mTime & 4) == 0)
+ {
+ return;
+ }
+ }
+ Text::draw(graphics, xOff, yOff);
+}
diff --git a/src/text.h b/src/text.h
new file mode 100644
index 00000000..04b213b3
--- /dev/null
+++ b/src/text.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Douglas Boffey *
+ * *
+ * DougABoffey@netscape.net *
+ * This 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 *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed with The Mana Experiment *
+ * 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 _TME_TEXT_H
+#define _TME_TEXT_H
+
+#include "graphics.h"
+
+#include <list>
+
+class TextManager;
+
+class Text
+{
+ friend class TextManager;
+ public:
+ /**
+ * Constructor creates a text object to display on the screen
+ */
+ Text(const std::string &text, int x, int y,
+ gcn::Graphics::Alignment alignment, gcn::Font *font,
+ gcn::Color colour);
+
+ /**
+ * Allows the originator of the text to specify the ideal coordinates
+ */
+ void
+ adviseXY(int x, int y);
+
+ /**
+ * Remove the text from the screen
+ */
+ ~Text();
+
+ /**
+ * Draws the text
+ */
+ virtual void
+ draw(Graphics *graphics, int xOff, int yOff);
+
+ private:
+
+ int mX; /**< Actual x-value of left of text written */
+ int mY; /**< Actual y-value of top of text written */
+ int mWidth; /**< The width of the text */
+ int mHeight; /**< The height of the text */
+ int mXOffset; /**< The offset of mX from the desired x */
+ static int mInstances; /**< Instances of text */
+ gcn::Font *mFont; /**< The font used */
+ std::string mText; /**< The text to display */
+ gcn::Color mColour; /**< The colour of the text */
+};
+
+class FlashText : public Text
+{
+ public:
+ FlashText(const std::string &text, int x, int y,
+ gcn::Graphics::Alignment alignment, gcn::Font *font,
+ gcn::Color colour);
+
+ /**
+ * Flash the text for so many refreshes
+ */
+ void flash(int time) {mTime = time; }
+
+ /**
+ * Draws the text
+ */
+ virtual void
+ draw(Graphics *graphics, int xOff, int yOff);
+
+ private:
+ int mTime; /**< Time left for flashing */
+};
+#endif
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
new file mode 100644
index 00000000..54d44c2a
--- /dev/null
+++ b/src/textmanager.cpp
@@ -0,0 +1,177 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Douglas Boffey *
+ * *
+ * DougABoffey@netscape.net *
+ * This 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 *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed with The Mana Experiment *
+ * 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 "textmanager.h"
+
+#include <cstring>
+
+#include "text.h"
+
+TextManager *textManager = 0;
+
+TextManager::TextManager()
+{
+}
+
+void TextManager::addText(Text *text)
+{
+ place(text, 0, text->mX, text->mY, text->mHeight);
+ mTextList.push_back(text);
+}
+
+void TextManager::moveText(Text *text, int x, int y)
+{
+ text->mX = x;
+ text->mY = y;
+ place(text, text, text->mX, text->mY, text->mHeight);
+}
+
+void TextManager::removeText(const Text *text)
+{
+ for (TextList::iterator ptr = mTextList.begin(),
+ pEnd = mTextList.end(); ptr != pEnd; ++ptr)
+ {
+ if (*ptr == text)
+ {
+ mTextList.erase(ptr);
+ return;
+ }
+ }
+}
+
+TextManager::~TextManager()
+{
+}
+
+void TextManager::draw(Graphics *graphics, int xOff, int yOff)
+{
+ for (TextList::iterator bPtr = mTextList.begin(), ePtr = mTextList.end();
+ bPtr != ePtr; ++bPtr)
+ {
+ (*bPtr)->draw(graphics, xOff, yOff);
+ }
+}
+
+void TextManager::place(const Text *textObj, const Text *omit,
+ int &x, int &y, int h)
+{
+ int xLeft = textObj->mX;
+ int xRight = xLeft + textObj->mWidth - 1;
+ const int TEST = 100; // Number of lines to test for text
+ bool occupied[TEST]; // is some other text obscuring this line?
+ std::memset(&occupied, 0, sizeof(occupied)); // set all to false
+ int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text
+ int occupiedTop = y - wantedTop; // Line in map representing to of occupied
+
+ for (TextList::const_iterator ptr = mTextList.begin(),
+ pEnd = mTextList.end(); ptr != pEnd; ++ptr)
+ {
+ if (*ptr != omit &&
+ (*ptr)->mX <= xRight &&
+ (*ptr)->mX + (*ptr)->mWidth > xLeft)
+ {
+ int from = (*ptr)->mY - occupiedTop;
+ int to = from + (*ptr)->mHeight - 1;
+ if (to < 0 || from >= TEST) // out of range considered
+ {
+ continue;
+ }
+ if (from < 0)
+ {
+ from = 0;
+ }
+ if (to >= TEST)
+ {
+ to = TEST - 1;
+ }
+ for (int i = from; i <= to; ++i)
+ {
+ occupied[i] = true;
+ }
+ }
+ }
+ bool ok = true;
+ for (int i = wantedTop; i < wantedTop + h; ++i)
+ {
+ ok = ok && !occupied[i];
+ }
+ if (ok)
+ {
+ return;
+ }
+ // Have to move it up or down, so find nearest spaces either side
+ int consec = 0;
+ int upSlot = -1; // means not found
+ for (int seek = wantedTop + h - 2; seek >= 0; --seek)
+ {
+ if (occupied[seek])
+ {
+ consec = 0;
+ }
+ else
+ {
+ if (++consec == h)
+ {
+ upSlot = seek;
+ break;
+ }
+ }
+ }
+ int downSlot = -1;
+ consec = 0;
+ for (int seek = wantedTop + 1; seek < TEST; ++seek)
+ {
+ if (occupied[seek])
+ {
+ consec = 0;
+ }
+ else
+ {
+ if (++consec == h)
+ {
+ downSlot = seek - h + 1;
+ break;
+ }
+ }
+ }
+ if (upSlot == -1 && downSlot == -1) // no good solution, so leave as is
+ {
+ return;
+ }
+ if (upSlot == -1) // must go down
+ {
+ y += downSlot - wantedTop;
+ return;
+ }
+ if (downSlot == -1) // must go up
+ {
+ y -= wantedTop - upSlot;
+ return;
+ }
+ if (wantedTop - upSlot > downSlot - wantedTop) // down is better
+ {
+ y += downSlot - wantedTop;
+ }
+ else
+ {
+ y -= wantedTop - upSlot;
+ }
+}
diff --git a/src/textmanager.h b/src/textmanager.h
new file mode 100644
index 00000000..53419240
--- /dev/null
+++ b/src/textmanager.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Douglas Boffey *
+ * *
+ * DougABoffey@netscape.net *
+ * This 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 *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed with The Mana Experiment *
+ * 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 _TME_TEXTMANAGER_H
+#define _TME_TEXTMANAGER_H
+
+#include <list>
+
+class Text;
+class Graphics;
+
+class TextManager
+{
+ public:
+ /**
+ * Constructor
+ */
+ TextManager();
+
+ /**
+ * Add text to the manager
+ */
+ void addText(Text *text);
+
+ /**
+ * Move the text around the screen
+ */
+ void moveText(Text *text, int x, int y);
+
+ /**
+ * Remove the text from the manager
+ */
+ void removeText(const Text *text);
+
+ /**
+ * Destroy the manager
+ */
+ ~TextManager();
+
+ /**
+ * Draw the text
+ */
+ void draw(Graphics *graphics, int xOff, int yOff);
+
+ private:
+ /**
+ * Position the text so as to avoid conflict
+ */
+ void place(const Text *textObj, const Text *omit,
+ int &x, int &y, int h);
+
+ typedef std::list<Text *> TextList; /**< The container type */
+ TextList mTextList; /**< The container */
+};
+
+extern TextManager *textManager;
+#endif
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 89466006..c4b432f3 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textparticle.cpp 4360 2008-06-23 14:44:20Z crush_tmw $
*/
#include "textparticle.h"
diff --git a/src/textparticle.h b/src/textparticle.h
index 34badb57..5f81abff 100644
--- a/src/textparticle.h
+++ b/src/textparticle.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: textparticle.h 3539 2007-08-28 16:42:47Z b_lindeijer $
*/
#ifndef _TEXTPARTICLE_H
diff --git a/src/tileset.h b/src/tileset.h
index 6af69235..6272d64a 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tileset.h 3753 2007-11-20 12:27:56Z b_lindeijer $
*/
#ifndef _TMW_TILESET_H_
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index 9a8f6356..e98216d4 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -26,7 +26,7 @@
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* $Id: base64.cpp 2906 2006-12-12 15:18:30Z b_lindeijer $ */
#include <string.h>
#include <stdlib.h>
diff --git a/src/utils/base64.h b/src/utils/base64.h
index ff20ac53..3356debf 100644
--- a/src/utils/base64.h
+++ b/src/utils/base64.h
@@ -26,7 +26,7 @@
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id$ */
+/* $Id: base64.h 2906 2006-12-12 15:18:30Z b_lindeijer $ */
#ifndef _TMW_BASE64_H
#define _TMW_BASE64_H
diff --git a/src/utils/dtor.h b/src/utils/dtor.h
index f2c6c1b8..3b8aeb0e 100644
--- a/src/utils/dtor.h
+++ b/src/utils/dtor.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: dtor.h 2271 2006-03-18 15:15:33Z der_doener $
*/
#ifndef _TMW_UTILS_DTOR_H
diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h
index afadb901..4513a79d 100644
--- a/src/utils/fastsqrt.h
+++ b/src/utils/fastsqrt.h
@@ -6,7 +6,7 @@
*
* Unfortunately the original creator of this function seems to be unknown.
*
- * $Id$
+ * $Id: fastsqrt.h 3508 2007-08-22 16:32:52Z b_lindeijer $
*/
float fastInvSqrt(float x)
diff --git a/src/utils/minmax.h b/src/utils/minmax.h
index 427c5da7..daf18c68 100644
--- a/src/utils/minmax.h
+++ b/src/utils/minmax.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: minmax.h 3628 2007-10-18 18:39:48Z b_lindeijer $
*/
#include <cstdlib>
diff --git a/src/utils/tostring.h b/src/utils/tostring.h
index 95b8985f..3cbeef27 100644
--- a/src/utils/tostring.h
+++ b/src/utils/tostring.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: tostring.h 3500 2007-08-21 15:11:19Z joshlangley $
*/
#ifndef _TMW_UTILS_TOSTRING_H
diff --git a/src/utils/trim.h b/src/utils/trim.h
index fec99100..7b236730 100644
--- a/src/utils/trim.h
+++ b/src/utils/trim.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: trim.h 3606 2007-09-27 14:54:09Z b_lindeijer $
*/
#ifndef _TMW_UTILS_TRIM_H_
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 98b474cb..c0b921b8 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: xml.cpp 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#include "xml.h"
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 5473b2ca..c64c1204 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: xml.h 4255 2008-05-21 21:44:27Z crush_tmw $
*/
#ifndef _TMW_XML_H
diff --git a/src/vector.h b/src/vector.h
index 7a5da241..379c50e1 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id$
+ * $Id: vector.h 3541 2007-08-29 00:31:59Z b_lindeijer $
*/
#ifndef _TMW_VECTOR_H_