summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt14
-rw-r--r--src/Makefile.am14
-rw-r--r--src/actor.cpp2
-rw-r--r--src/actor.h2
-rw-r--r--src/actorsprite.cpp34
-rw-r--r--src/actorsprite.h2
-rw-r--r--src/actorspritelistener.h2
-rw-r--r--src/actorspritemanager.cpp2
-rw-r--r--src/actorspritemanager.h8
-rw-r--r--src/animatedsprite.cpp2
-rw-r--r--src/animatedsprite.h2
-rw-r--r--src/animationparticle.cpp4
-rw-r--r--src/animationparticle.h6
-rw-r--r--src/auctionmanager.cpp2
-rw-r--r--src/auctionmanager.h2
-rw-r--r--src/avatar.h2
-rw-r--r--src/being.cpp54
-rw-r--r--src/being.h2
-rw-r--r--src/channel.cpp2
-rw-r--r--src/channel.h2
-rw-r--r--src/channelmanager.cpp2
-rw-r--r--src/channelmanager.h2
-rw-r--r--src/chatlogger.cpp10
-rw-r--r--src/chatlogger.h2
-rw-r--r--src/client.cpp141
-rw-r--r--src/client.h29
-rw-r--r--src/commandhandler.cpp62
-rw-r--r--src/commandhandler.h7
-rw-r--r--src/compoundsprite.cpp2
-rw-r--r--src/compoundsprite.h2
-rw-r--r--src/configlistener.h2
-rw-r--r--src/configuration.cpp21
-rw-r--r--src/configuration.h13
-rw-r--r--src/debug.h15
-rw-r--r--src/defaults.cpp9
-rw-r--r--src/defaults.h2
-rw-r--r--src/effectmanager.cpp6
-rw-r--r--src/equipment.h2
-rw-r--r--src/event.cpp2
-rw-r--r--src/event.h2
-rw-r--r--src/flooritem.cpp2
-rw-r--r--src/flooritem.h2
-rw-r--r--src/game.cpp38
-rw-r--r--src/game.h2
-rw-r--r--src/graphics.cpp2
-rw-r--r--src/graphics.h2
-rw-r--r--src/graphicsvertexes.cpp2
-rw-r--r--src/graphicsvertexes.h2
-rw-r--r--src/gui/beingpopup.cpp2
-rw-r--r--src/gui/beingpopup.h2
-rw-r--r--src/gui/buydialog.cpp2
-rw-r--r--src/gui/buydialog.h2
-rw-r--r--src/gui/buyselldialog.cpp2
-rw-r--r--src/gui/buyselldialog.h2
-rw-r--r--src/gui/changeemaildialog.cpp2
-rw-r--r--src/gui/changeemaildialog.h2
-rw-r--r--src/gui/changepassworddialog.cpp2
-rw-r--r--src/gui/changepassworddialog.h2
-rw-r--r--src/gui/charcreatedialog.cpp25
-rw-r--r--src/gui/charcreatedialog.h2
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/charselectdialog.h2
-rw-r--r--src/gui/chatwindow.cpp14
-rw-r--r--src/gui/chatwindow.h2
-rw-r--r--src/gui/confirmdialog.cpp2
-rw-r--r--src/gui/confirmdialog.h2
-rw-r--r--src/gui/connectiondialog.cpp2
-rw-r--r--src/gui/connectiondialog.h2
-rw-r--r--src/gui/debugwindow.cpp2
-rw-r--r--src/gui/debugwindow.h2
-rw-r--r--src/gui/didyouknowwindow.cpp2
-rw-r--r--src/gui/didyouknowwindow.h2
-rw-r--r--src/gui/emotepopup.cpp2
-rw-r--r--src/gui/emotepopup.h2
-rw-r--r--src/gui/equipmentwindow.cpp18
-rw-r--r--src/gui/equipmentwindow.h10
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/focushandler.h2
-rw-r--r--src/gui/gui.cpp21
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/gui/helpwindow.cpp2
-rw-r--r--src/gui/helpwindow.h2
-rw-r--r--src/gui/inventorywindow.cpp4
-rw-r--r--src/gui/inventorywindow.h4
-rw-r--r--src/gui/itemamountwindow.cpp2
-rw-r--r--src/gui/itemamountwindow.h2
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/itempopup.h2
-rw-r--r--src/gui/killstats.cpp10
-rw-r--r--src/gui/logindialog.cpp14
-rw-r--r--src/gui/logindialog.h2
-rw-r--r--src/gui/minimap.cpp2
-rw-r--r--src/gui/minimap.h2
-rw-r--r--src/gui/ministatuswindow.cpp4
-rw-r--r--src/gui/ministatuswindow.h2
-rw-r--r--src/gui/npcdialog.cpp49
-rw-r--r--src/gui/npcdialog.h9
-rw-r--r--src/gui/npcpostdialog.cpp2
-rw-r--r--src/gui/npcpostdialog.h2
-rw-r--r--src/gui/okdialog.cpp2
-rw-r--r--src/gui/okdialog.h2
-rw-r--r--src/gui/outfitwindow.cpp11
-rw-r--r--src/gui/outfitwindow.h4
-rw-r--r--src/gui/palette.cpp2
-rw-r--r--src/gui/palette.h2
-rw-r--r--src/gui/popupmenu.cpp62
-rw-r--r--src/gui/popupmenu.h4
-rw-r--r--src/gui/quitdialog.cpp2
-rw-r--r--src/gui/quitdialog.h2
-rw-r--r--src/gui/register.cpp2
-rw-r--r--src/gui/register.h2
-rw-r--r--src/gui/sdlfont.cpp2
-rw-r--r--src/gui/sdlfont.h2
-rw-r--r--src/gui/sdlinput.cpp2
-rw-r--r--src/gui/selldialog.cpp2
-rw-r--r--src/gui/selldialog.h2
-rw-r--r--src/gui/serverdialog.cpp23
-rw-r--r--src/gui/serverdialog.h2
-rw-r--r--src/gui/setup.cpp6
-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_chat.cpp2
-rw-r--r--src/gui/setup_chat.h2
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_colors.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_other.cpp2
-rw-r--r--src/gui/setup_other.h2
-rw-r--r--src/gui/setup_perfomance.cpp2
-rw-r--r--src/gui/setup_perfomance.h2
-rw-r--r--src/gui/setup_players.cpp2
-rw-r--r--src/gui/setup_players.h2
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/setup_relations.h2
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/gui/setup_video.h2
-rw-r--r--src/gui/shopwindow.cpp2
-rw-r--r--src/gui/shopwindow.h2
-rw-r--r--src/gui/shortcutwindow.cpp44
-rw-r--r--src/gui/shortcutwindow.h6
-rw-r--r--src/gui/skilldialog.cpp10
-rw-r--r--src/gui/skilldialog.h2
-rw-r--r--src/gui/socialwindow.cpp147
-rw-r--r--src/gui/socialwindow.h3
-rw-r--r--src/gui/specialswindow.cpp2
-rw-r--r--src/gui/specialswindow.h2
-rw-r--r--src/gui/speechbubble.cpp2
-rw-r--r--src/gui/speechbubble.h2
-rw-r--r--src/gui/statuswindow.cpp21
-rw-r--r--src/gui/statuswindow.h4
-rw-r--r--src/gui/textdialog.cpp2
-rw-r--r--src/gui/textdialog.h4
-rw-r--r--src/gui/textpopup.cpp2
-rw-r--r--src/gui/textpopup.h2
-rw-r--r--src/gui/theme.cpp20
-rw-r--r--src/gui/theme.h2
-rw-r--r--src/gui/tradewindow.cpp2
-rw-r--r--src/gui/tradewindow.h2
-rw-r--r--src/gui/unregisterdialog.cpp2
-rw-r--r--src/gui/unregisterdialog.h2
-rw-r--r--src/gui/updaterwindow.cpp23
-rw-r--r--src/gui/updaterwindow.h2
-rw-r--r--src/gui/userpalette.cpp2
-rw-r--r--src/gui/userpalette.h2
-rw-r--r--src/gui/viewport.cpp57
-rw-r--r--src/gui/viewport.h16
-rw-r--r--src/gui/whoisonline.cpp20
-rw-r--r--src/gui/whoisonline.h1
-rw-r--r--src/gui/widgets/avatarlistbox.cpp2
-rw-r--r--src/gui/widgets/avatarlistbox.h2
-rw-r--r--src/gui/widgets/battletab.cpp2
-rw-r--r--src/gui/widgets/battletab.h2
-rw-r--r--src/gui/widgets/browserbox.cpp5
-rw-r--r--src/gui/widgets/browserbox.h2
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/button.h2
-rw-r--r--src/gui/widgets/channeltab.cpp2
-rw-r--r--src/gui/widgets/channeltab.h2
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/checkbox.h2
-rw-r--r--src/gui/widgets/container.cpp2
-rw-r--r--src/gui/widgets/container.h2
-rw-r--r--src/gui/widgets/desktop.cpp8
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropdown.h4
-rw-r--r--src/gui/widgets/flowcontainer.cpp2
-rw-r--r--src/gui/widgets/flowcontainer.h2
-rw-r--r--src/gui/widgets/guildchattab.cpp2
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/guitable.h2
-rw-r--r--src/gui/widgets/horizontcontainer.cpp2
-rw-r--r--src/gui/widgets/horizontcontainer.h2
-rw-r--r--src/gui/widgets/icon.cpp2
-rw-r--r--src/gui/widgets/icon.h2
-rw-r--r--src/gui/widgets/inttextfield.cpp2
-rw-r--r--src/gui/widgets/inttextfield.h2
-rw-r--r--src/gui/widgets/inventoryfilter.cpp2
-rw-r--r--src/gui/widgets/inventoryfilter.h2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.h2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/itemlinkhandler.h2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h2
-rw-r--r--src/gui/widgets/layout.cpp2
-rw-r--r--src/gui/widgets/layout.h2
-rw-r--r--src/gui/widgets/layouthelper.cpp2
-rw-r--r--src/gui/widgets/layouthelper.h2
-rw-r--r--src/gui/widgets/linkhandler.h2
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/listbox.h2
-rw-r--r--src/gui/widgets/mouseevent.h2
-rw-r--r--src/gui/widgets/passwordfield.cpp2
-rw-r--r--src/gui/widgets/passwordfield.h2
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/playerbox.h6
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h2
-rw-r--r--src/gui/widgets/progressbar.cpp2
-rw-r--r--src/gui/widgets/progressbar.h2
-rw-r--r--src/gui/widgets/progressindicator.cpp6
-rw-r--r--src/gui/widgets/progressindicator.h2
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/radiobutton.h2
-rw-r--r--src/gui/widgets/resizegrip.cpp2
-rw-r--r--src/gui/widgets/resizegrip.h2
-rw-r--r--src/gui/widgets/scrollarea.cpp2
-rw-r--r--src/gui/widgets/scrollarea.h2
-rw-r--r--src/gui/widgets/setupitem.cpp2
-rw-r--r--src/gui/widgets/setupitem.h2
-rw-r--r--src/gui/widgets/setuptab.cpp2
-rw-r--r--src/gui/widgets/setuptab.h2
-rw-r--r--src/gui/widgets/setuptabscroll.cpp2
-rw-r--r--src/gui/widgets/setuptabscroll.h2
-rw-r--r--src/gui/widgets/shopitems.cpp2
-rw-r--r--src/gui/widgets/shopitems.h2
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/shoplistbox.h2
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/shortcutcontainer.h2
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/slider.h2
-rw-r--r--src/gui/widgets/tab.cpp2
-rw-r--r--src/gui/widgets/tab.h2
-rw-r--r--src/gui/widgets/tabbedarea.cpp14
-rw-r--r--src/gui/widgets/tabbedarea.h10
-rw-r--r--src/gui/widgets/tablemodel.cpp2
-rw-r--r--src/gui/widgets/tablemodel.h2
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/textfield.h2
-rw-r--r--src/gui/widgets/textpreview.cpp2
-rw-r--r--src/gui/widgets/textpreview.h2
-rw-r--r--src/gui/widgets/tradetab.cpp2
-rw-r--r--src/gui/widgets/tradetab.h2
-rw-r--r--src/gui/widgets/vertcontainer.cpp4
-rw-r--r--src/gui/widgets/vertcontainer.h2
-rw-r--r--src/gui/widgets/whispertab.cpp2
-rw-r--r--src/gui/widgets/whispertab.h2
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/gui/widgets/window.h2
-rw-r--r--src/gui/widgets/windowcontainer.cpp2
-rw-r--r--src/gui/widgets/windowcontainer.h2
-rw-r--r--src/gui/windowmenu.cpp4
-rw-r--r--src/gui/windowmenu.h2
-rw-r--r--src/gui/worldselectdialog.cpp2
-rw-r--r--src/gui/worldselectdialog.h2
-rw-r--r--src/guichanfwd.h2
-rw-r--r--src/guild.cpp2
-rw-r--r--src/guild.h2
-rw-r--r--src/guildmanager.cpp2
-rw-r--r--src/guildmanager.h2
-rw-r--r--src/imageparticle.cpp2
-rw-r--r--src/imageparticle.h2
-rw-r--r--src/imagesprite.cpp2
-rw-r--r--src/imagesprite.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/listener.cpp2
-rw-r--r--src/listener.h2
-rw-r--r--src/localconsts.h5
-rw-r--r--src/localplayer.cpp40
-rw-r--r--src/localplayer.h5
-rw-r--r--src/logger.cpp2
-rw-r--r--src/logger.h2
-rw-r--r--src/main.cpp100
-rw-r--r--src/main.h6
-rw-r--r--src/map.cpp11
-rw-r--r--src/map.h5
-rw-r--r--src/net/adminhandler.h2
-rw-r--r--src/net/buysellhandler.h2
-rw-r--r--src/net/charhandler.cpp2
-rw-r--r--src/net/charhandler.h12
-rw-r--r--src/net/chathandler.h2
-rw-r--r--src/net/download.cpp3
-rw-r--r--src/net/download.h2
-rw-r--r--src/net/ea/adminhandler.cpp2
-rw-r--r--src/net/ea/adminhandler.h2
-rw-r--r--src/net/ea/beinghandler.cpp2
-rw-r--r--src/net/ea/beinghandler.h2
-rw-r--r--src/net/ea/buysellhandler.cpp2
-rw-r--r--src/net/ea/buysellhandler.h2
-rw-r--r--src/net/ea/charserverhandler.cpp5
-rw-r--r--src/net/ea/charserverhandler.h2
-rw-r--r--src/net/ea/chathandler.cpp2
-rw-r--r--src/net/ea/chathandler.h2
-rw-r--r--src/net/ea/eaprotocol.h2
-rw-r--r--src/net/ea/gamehandler.cpp11
-rw-r--r--src/net/ea/gamehandler.h2
-rw-r--r--src/net/ea/gui/guildtab.cpp2
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp2
-rw-r--r--src/net/ea/gui/partytab.h2
-rw-r--r--src/net/ea/guildhandler.cpp17
-rw-r--r--src/net/ea/guildhandler.h2
-rw-r--r--src/net/ea/inventoryhandler.cpp2
-rw-r--r--src/net/ea/inventoryhandler.h2
-rw-r--r--src/net/ea/itemhandler.cpp2
-rw-r--r--src/net/ea/itemhandler.h2
-rw-r--r--src/net/ea/loginhandler.cpp16
-rw-r--r--src/net/ea/loginhandler.h2
-rw-r--r--src/net/ea/npchandler.cpp2
-rw-r--r--src/net/ea/npchandler.h2
-rw-r--r--src/net/ea/partyhandler.cpp4
-rw-r--r--src/net/ea/playerhandler.cpp2
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/ea/specialhandler.cpp6
-rw-r--r--src/net/ea/specialhandler.h2
-rw-r--r--src/net/ea/token.h2
-rw-r--r--src/net/ea/tradehandler.cpp2
-rw-r--r--src/net/ea/tradehandler.h2
-rw-r--r--src/net/gamehandler.h2
-rw-r--r--src/net/generalhandler.h2
-rw-r--r--src/net/guildhandler.h2
-rw-r--r--src/net/inventoryhandler.h2
-rw-r--r--src/net/logindata.h2
-rw-r--r--src/net/loginhandler.h2
-rw-r--r--src/net/manaserv/adminhandler.cpp2
-rw-r--r--src/net/manaserv/adminhandler.h2
-rw-r--r--src/net/manaserv/attributes.cpp12
-rw-r--r--src/net/manaserv/attributes.h2
-rw-r--r--src/net/manaserv/beinghandler.cpp2
-rw-r--r--src/net/manaserv/beinghandler.h2
-rw-r--r--src/net/manaserv/buysellhandler.cpp2
-rw-r--r--src/net/manaserv/buysellhandler.h2
-rw-r--r--src/net/manaserv/charhandler.cpp2
-rw-r--r--src/net/manaserv/charhandler.h2
-rw-r--r--src/net/manaserv/chathandler.cpp2
-rw-r--r--src/net/manaserv/chathandler.h2
-rw-r--r--src/net/manaserv/connection.cpp2
-rw-r--r--src/net/manaserv/connection.h2
-rw-r--r--src/net/manaserv/defines.h2
-rw-r--r--src/net/manaserv/effecthandler.cpp2
-rw-r--r--src/net/manaserv/effecthandler.h2
-rw-r--r--src/net/manaserv/gamehandler.cpp2
-rw-r--r--src/net/manaserv/gamehandler.h2
-rw-r--r--src/net/manaserv/generalhandler.cpp2
-rw-r--r--src/net/manaserv/generalhandler.h2
-rw-r--r--src/net/manaserv/guildhandler.cpp2
-rw-r--r--src/net/manaserv/guildhandler.h2
-rw-r--r--src/net/manaserv/internal.cpp2
-rw-r--r--src/net/manaserv/internal.h2
-rw-r--r--src/net/manaserv/inventoryhandler.cpp2
-rw-r--r--src/net/manaserv/inventoryhandler.h2
-rw-r--r--src/net/manaserv/itemhandler.cpp2
-rw-r--r--src/net/manaserv/itemhandler.h2
-rw-r--r--src/net/manaserv/loginhandler.cpp13
-rw-r--r--src/net/manaserv/loginhandler.h2
-rw-r--r--src/net/manaserv/messagehandler.cpp2
-rw-r--r--src/net/manaserv/messagehandler.h2
-rw-r--r--src/net/manaserv/messagein.cpp2
-rw-r--r--src/net/manaserv/messagein.h2
-rw-r--r--src/net/manaserv/messageout.cpp2
-rw-r--r--src/net/manaserv/messageout.h2
-rw-r--r--src/net/manaserv/network.cpp2
-rw-r--r--src/net/manaserv/network.h2
-rw-r--r--src/net/manaserv/npchandler.cpp2
-rw-r--r--src/net/manaserv/npchandler.h2
-rw-r--r--src/net/manaserv/partyhandler.cpp2
-rw-r--r--src/net/manaserv/partyhandler.h2
-rw-r--r--src/net/manaserv/playerhandler.cpp2
-rw-r--r--src/net/manaserv/playerhandler.h2
-rw-r--r--src/net/manaserv/protocol.h2
-rw-r--r--src/net/manaserv/specialhandler.cpp2
-rw-r--r--src/net/manaserv/specialhandler.h2
-rw-r--r--src/net/manaserv/tradehandler.cpp2
-rw-r--r--src/net/manaserv/tradehandler.h2
-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/net.cpp2
-rw-r--r--src/net/net.h2
-rw-r--r--src/net/npchandler.h2
-rw-r--r--src/net/packetcounters.cpp2
-rw-r--r--src/net/packetcounters.h2
-rw-r--r--src/net/partyhandler.h2
-rw-r--r--src/net/playerhandler.h2
-rw-r--r--src/net/serverinfo.h2
-rw-r--r--src/net/specialhandler.h2
-rw-r--r--src/net/tmwa/adminhandler.cpp2
-rw-r--r--src/net/tmwa/adminhandler.h2
-rw-r--r--src/net/tmwa/beinghandler.cpp2
-rw-r--r--src/net/tmwa/beinghandler.h2
-rw-r--r--src/net/tmwa/buysellhandler.cpp4
-rw-r--r--src/net/tmwa/buysellhandler.h2
-rw-r--r--src/net/tmwa/charserverhandler.cpp6
-rw-r--r--src/net/tmwa/charserverhandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.h2
-rw-r--r--src/net/tmwa/gamehandler.cpp2
-rw-r--r--src/net/tmwa/gamehandler.h2
-rw-r--r--src/net/tmwa/generalhandler.cpp9
-rw-r--r--src/net/tmwa/generalhandler.h2
-rw-r--r--src/net/tmwa/gui/guildtab.cpp2
-rw-r--r--src/net/tmwa/gui/guildtab.h2
-rw-r--r--src/net/tmwa/gui/partytab.cpp2
-rw-r--r--src/net/tmwa/gui/partytab.h2
-rw-r--r--src/net/tmwa/guildhandler.cpp2
-rw-r--r--src/net/tmwa/guildhandler.h2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.h2
-rw-r--r--src/net/tmwa/itemhandler.cpp2
-rw-r--r--src/net/tmwa/itemhandler.h2
-rw-r--r--src/net/tmwa/loginhandler.cpp4
-rw-r--r--src/net/tmwa/loginhandler.h2
-rw-r--r--src/net/tmwa/messagehandler.cpp2
-rw-r--r--src/net/tmwa/messagehandler.h2
-rw-r--r--src/net/tmwa/messagein.cpp2
-rw-r--r--src/net/tmwa/messagein.h2
-rw-r--r--src/net/tmwa/messageout.cpp2
-rw-r--r--src/net/tmwa/messageout.h2
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/network.h4
-rw-r--r--src/net/tmwa/npchandler.cpp85
-rw-r--r--src/net/tmwa/npchandler.h9
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.h2
-rw-r--r--src/net/tmwa/protocol.h3
-rw-r--r--src/net/tmwa/specialhandler.cpp2
-rw-r--r--src/net/tmwa/specialhandler.h2
-rw-r--r--src/net/tmwa/tradehandler.cpp2
-rw-r--r--src/net/tmwa/tradehandler.h2
-rw-r--r--src/net/tradehandler.h2
-rw-r--r--src/net/worldinfo.h2
-rw-r--r--src/opengl1graphics.cpp12
-rw-r--r--src/opengl1graphics.h2
-rw-r--r--src/openglgraphics.cpp21
-rw-r--r--src/openglgraphics.h2
-rw-r--r--src/particle.cpp14
-rw-r--r--src/particle.h2
-rw-r--r--src/particlecontainer.cpp2
-rw-r--r--src/particlecontainer.h2
-rw-r--r--src/particleemitter.cpp32
-rw-r--r--src/particleemitter.h6
-rw-r--r--src/particleemitterprop.h2
-rw-r--r--src/party.cpp2
-rw-r--r--src/party.h2
-rw-r--r--src/playerinfo.cpp2
-rw-r--r--src/playerinfo.h2
-rw-r--r--src/playerrelations.cpp32
-rw-r--r--src/playerrelations.h5
-rw-r--r--src/position.cpp2
-rw-r--r--src/position.h2
-rw-r--r--src/properties.h2
-rw-r--r--src/resources/action.cpp2
-rw-r--r--src/resources/action.h4
-rw-r--r--src/resources/ambientlayer.cpp2
-rw-r--r--src/resources/ambientlayer.h2
-rw-r--r--src/resources/animation.cpp2
-rw-r--r--src/resources/animation.h4
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h2
-rw-r--r--src/resources/chardb.cpp18
-rw-r--r--src/resources/chardb.h6
-rw-r--r--src/resources/colordb.cpp18
-rw-r--r--src/resources/colordb.h2
-rw-r--r--src/resources/dye.cpp2
-rw-r--r--src/resources/dye.h2
-rw-r--r--src/resources/emotedb.cpp18
-rw-r--r--src/resources/image.cpp13
-rw-r--r--src/resources/image.h17
-rw-r--r--src/resources/imageloader.cpp2
-rw-r--r--src/resources/imageloader.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.cpp56
-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/mapdb.cpp8
-rw-r--r--src/resources/mapdb.h2
-rw-r--r--src/resources/mapreader.cpp43
-rw-r--r--src/resources/mapreader.h12
-rw-r--r--src/resources/monsterdb.cpp16
-rw-r--r--src/resources/monsterdb.h2
-rw-r--r--src/resources/music.cpp53
-rw-r--r--src/resources/music.h24
-rw-r--r--src/resources/npcdb.cpp12
-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.cpp43
-rw-r--r--src/resources/resourcemanager.h6
-rw-r--r--src/resources/soundeffect.cpp10
-rw-r--r--src/resources/soundeffect.h7
-rw-r--r--src/resources/specialdb.cpp10
-rw-r--r--src/resources/specialdb.h2
-rw-r--r--src/resources/spritedef.cpp42
-rw-r--r--src/resources/spritedef.h14
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/resources/wallpaper.h2
-rw-r--r--src/rotationalparticle.cpp10
-rw-r--r--src/rotationalparticle.h6
-rw-r--r--src/shopitem.cpp2
-rw-r--r--src/shopitem.h2
-rw-r--r--src/simpleanimation.cpp14
-rw-r--r--src/simpleanimation.h6
-rw-r--r--src/sound.cpp103
-rw-r--r--src/sound.h25
-rw-r--r--src/sprite.h2
-rw-r--r--src/statuseffect.cpp16
-rw-r--r--src/statuseffect.h2
-rw-r--r--src/test/testlauncher.cpp172
-rw-r--r--src/test/testlauncher.h54
-rw-r--r--src/test/testmain.cpp287
-rw-r--r--src/test/testmain.h64
-rw-r--r--src/text.cpp2
-rw-r--r--src/text.h7
-rw-r--r--src/textparticle.cpp2
-rw-r--r--src/textparticle.h2
-rw-r--r--src/textrenderer.h2
-rw-r--r--src/tileset.h2
-rw-r--r--src/units.cpp10
-rw-r--r--src/units.h2
-rw-r--r--src/utils/checkutils.cpp39
-rw-r--r--src/utils/checkutils.h30
-rw-r--r--src/utils/dtor.h2
-rw-r--r--src/utils/gettext.h2
-rw-r--r--src/utils/mathutils.h2
-rw-r--r--src/utils/mkdir.cpp2
-rw-r--r--src/utils/mkdir.h2
-rw-r--r--src/utils/mutex.h2
-rw-r--r--src/utils/paths.cpp4
-rw-r--r--src/utils/paths.h2
-rw-r--r--src/utils/physfsrwops.cpp186
-rw-r--r--src/utils/physfsrwops.h82
-rw-r--r--src/utils/process.cpp172
-rw-r--r--src/utils/process.h29
-rw-r--r--src/utils/sha256.cpp2
-rw-r--r--src/utils/sha256.h2
-rw-r--r--src/utils/specialfolder.cpp2
-rw-r--r--src/utils/specialfolder.h2
-rw-r--r--src/utils/stringutils.cpp25
-rw-r--r--src/utils/stringutils.h6
-rw-r--r--src/utils/xml.cpp38
-rw-r--r--src/utils/xml.h34
-rw-r--r--src/variabledata.h2
-rw-r--r--src/vector.cpp2
-rw-r--r--src/vector.h2
576 files changed, 3184 insertions, 1298 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d281151e2..d2c003559 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -443,6 +443,8 @@ SET(SRCS
resources/wallpaper.h
utils/base64.cpp
utils/base64.h
+ utils/checkutils.cpp
+ utils/checkutils.h
utils/copynpaste.cpp
utils/copynpaste.h
utils/dtor.h
@@ -450,8 +452,10 @@ SET(SRCS
utils/mathutils.h
utils/paths.cpp
utils/paths.h
- utils/sha256.cpp
- utils/sha256.h
+ utils/physfsrwops.cpp
+ utils/physfsrwops.h
+ utils/process.cpp
+ utils/process.h
utils/stringutils.cpp
utils/stringutils.h
utils/mutex.h
@@ -459,6 +463,10 @@ SET(SRCS
utils/mkdir.h
utils/xml.cpp
utils/xml.h
+ test/testlauncher.cpp
+ test/testlauncher.h
+ test/testmain.cpp
+ test/testmain.h
actor.cpp
actor.h
actorsprite.cpp
@@ -794,6 +802,8 @@ SET(SRCS_MANASERV
enet/utility.h
enet/win32.c
enet/win32.h
+ utils/sha256.cpp
+ utils/sha256.h
net/manaserv/attributes.cpp
net/manaserv/attributes.h
net/manaserv/adminhandler.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index fce320166..b39145c63 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -448,6 +448,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
resources/wallpaper.h \
utils/base64.cpp \
utils/base64.h \
+ utils/checkutils.cpp \
+ utils/checkutils.h \
utils/copynpaste.cpp \
utils/copynpaste.h \
utils/dtor.h \
@@ -457,8 +459,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
utils/mkdir.h \
utils/paths.cpp \
utils/paths.h \
- utils/sha256.cpp \
- utils/sha256.h \
+ utils/physfsrwops.cpp \
+ utils/physfsrwops.h \
+ utils/process.cpp \
+ utils/process.h \
utils/specialfolder.cpp \
utils/specialfolder.h \
utils/stringutils.cpp \
@@ -466,6 +470,10 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
utils/mutex.h \
utils/xml.cpp \
utils/xml.h \
+ test/testlauncher.cpp \
+ test/testlauncher.h \
+ test/testmain.cpp \
+ test/testmain.h \
actor.cpp \
actor.h \
actorsprite.cpp \
@@ -620,6 +628,8 @@ manaplus_SOURCES += enet/callbacks.c \
enet/unix.h \
enet/utility.h \
enet/win32.h \
+ utils/sha256.cpp \
+ utils/sha256.h \
net/manaserv/attributes.cpp \
net/manaserv/attributes.h \
net/manaserv/adminhandler.cpp \
diff --git a/src/actor.cpp b/src/actor.cpp
index 150f6042b..6a11c6e91 100644
--- a/src/actor.cpp
+++ b/src/actor.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/actor.h b/src/actor.h
index 9afaff93d..51cba0c60 100644
--- a/src/actor.h
+++ b/src/actor.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 2a92cf506..c718c31f2 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -39,6 +39,8 @@
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
+#include "utils/checkutils.h"
+
#include "debug.h"
#define EFFECTS_FILE "effects.xml"
@@ -70,7 +72,7 @@ ActorSprite::~ActorSprite()
for (ActorSpriteListenerIterator iter = mActorSpriteListeners.begin(),
e = mActorSpriteListeners.end(); iter != e; ++iter)
{
- if (*iter)
+ if (reportFalse(*iter))
(*iter)->actorSpriteDestroyed(*this);
}
}
@@ -164,7 +166,7 @@ static EffectDescription *default_effect = nullptr;
static std::map<int, EffectDescription *> effects;
static bool effects_initialized = false;
-static EffectDescription *getEffectDescription(xmlNodePtr node, int *id)
+static EffectDescription *getEffectDescription(XmlNodePtr node, int *id)
{
EffectDescription *ed = new EffectDescription;
@@ -180,9 +182,9 @@ static EffectDescription *getEffectDescription(int effectId)
if (!effects_initialized)
{
XML::Document doc(EFFECTS_FILE);
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
+ if (!root || !xmlNameEqual(root, "being-effects"))
{
logger->log1("Error loading being effects file: "
EFFECTS_FILE);
@@ -193,13 +195,13 @@ static EffectDescription *getEffectDescription(int effectId)
{
int id;
- if (xmlStrEqual(node->name, BAD_CAST "effect"))
+ if (xmlNameEqual(node, "effect"))
{
EffectDescription *EffectDescription =
getEffectDescription(node, &id);
effects[id] = EffectDescription;
}
- else if (xmlStrEqual(node->name, BAD_CAST "default"))
+ else if (xmlNameEqual(node, "default"))
{
EffectDescription *effectDescription =
getEffectDescription(node, &id);
@@ -245,7 +247,7 @@ void ActorSprite::setStatusEffectBlock(int offset, Uint16 newEffects)
void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx)
{
- if (!particleEngine)
+ if (reportTrue(!particleEngine))
return;
if (player_node)
@@ -256,13 +258,13 @@ void ActorSprite::internalTriggerEffect(int effectId, bool sfx, bool gfx)
EffectDescription *ed = getEffectDescription(effectId);
- if (!ed)
+ if (reportTrue(!ed))
{
logger->log1("Unknown special effect and no default recorded");
return;
}
- if (gfx && !ed->mGFXEffect.empty() && particleEngine)
+ if (gfx && !ed->mGFXEffect.empty())
{
Particle *selfFX;
@@ -287,7 +289,7 @@ void ActorSprite::updateStatusEffect(int index, bool newStatus)
void ActorSprite::handleStatusEffect(StatusEffect *effect, int effectId)
{
- if (!effect)
+ if (reportTrue(!effect))
return;
// TODO: Find out how this is meant to be used
@@ -392,7 +394,7 @@ void ActorSprite::load()
void ActorSprite::unload()
{
- if (!loaded)
+ if (reportTrue(!loaded))
return;
cleanupTargetCursors();
@@ -437,7 +439,7 @@ static const char *cursorSize(int size)
void ActorSprite::initTargetCursor()
{
- static std::string targetCursorFile = "graphics/target-cursor-%s-%s.png";
+ static std::string targetCursorFile = "target-cursor-%s-%s.png";
static int targetWidths[NUM_TC] = {44, 62, 82};
static int targetHeights[NUM_TC] = {35, 44, 60};
@@ -476,11 +478,11 @@ void ActorSprite::cleanupTargetCursors()
void ActorSprite::loadTargetCursor(const std::string &filename,
int width, int height, int type, int size)
{
- if (size < TC_SMALL || size >= NUM_TC)
+ if (reportTrue(size < TC_SMALL || size >= NUM_TC))
return;
- ResourceManager *resman = ResourceManager::getInstance();
- ImageSet *currentImageSet = resman->getImageSet(filename, width, height);
+ ImageSet *currentImageSet = Theme::getImageSetFromTheme(
+ filename, width, height);
if (!currentImageSet)
{
diff --git a/src/actorsprite.h b/src/actorsprite.h
index e130269bf..29df6954c 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/actorspritelistener.h b/src/actorspritelistener.h
index 88082af20..314825fc7 100644
--- a/src/actorspritelistener.h
+++ b/src/actorspritelistener.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index e0a59b349..fa6d49d38 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index 08a255621..7960c6301 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -123,7 +123,7 @@ class ActorSpriteManager: public ConfigListener
*/
Being *findNearestLivingBeing(int x, int y, int maxTileDist,
ActorSprite::Type type = Being::UNKNOWN,
- Being *excluded = 0) const;
+ Being *excluded = nullptr) const;
/**
* Returns a being nearest to another being.
@@ -292,12 +292,12 @@ class ActorSpriteManager: public ConfigListener
protected:
bool validateBeing(Being *aroundBeing, Being* being,
- Being::Type type, Being* excluded = 0,
+ Being::Type type, Being* excluded = nullptr,
int maxCost = 20) const;
Being *findNearestLivingBeing(Being *aroundBeing, int maxdist,
Being::Type type, int x, int y,
- Being *excluded = 0) const;
+ Being *excluded = nullptr) const;
void loadAttackList();
void storeAttackList();
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 5277ddf33..f4f3451cb 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 16bcdf2da..4a41eac52 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp
index ef2e0a680..c1bf251af 100644
--- a/src/animationparticle.cpp
+++ b/src/animationparticle.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -33,7 +33,7 @@ AnimationParticle::AnimationParticle(Map *map, Animation *animation):
{
}
-AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode,
+AnimationParticle::AnimationParticle(Map *map, XmlNodePtr animationNode,
const std::string& dyePalettes):
ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
diff --git a/src/animationparticle.h b/src/animationparticle.h
index 984d3dc14..933f2d164 100644
--- a/src/animationparticle.h
+++ b/src/animationparticle.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,7 +25,7 @@
#include "imageparticle.h"
-#include <libxml/tree.h>
+#include "utils/xml.h"
class Animation;
class Map;
@@ -36,7 +36,7 @@ class AnimationParticle : public ImageParticle
public:
AnimationParticle(Map *map, Animation *animation);
- AnimationParticle(Map *map, xmlNodePtr animationNode,
+ AnimationParticle(Map *map, XmlNodePtr animationNode,
const std::string& dyePalettes = std::string());
~AnimationParticle();
diff --git a/src/auctionmanager.cpp b/src/auctionmanager.cpp
index 900d47e29..9e4752e9b 100644
--- a/src/auctionmanager.cpp
+++ b/src/auctionmanager.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/auctionmanager.h b/src/auctionmanager.h
index bdc0497ae..35b233abf 100644
--- a/src/auctionmanager.h
+++ b/src/auctionmanager.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/avatar.h b/src/avatar.h
index 6c79dd96a..5ff0a8f75 100644
--- a/src/avatar.h
+++ b/src/avatar.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/being.cpp b/src/being.cpp
index 9e5ae3ad1..39d0bd450 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -2071,20 +2071,40 @@ void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage,
int dx = static_cast<int>(static_cast<float>(width) / p);
- if ((!damage && (this != player_node || hp == maxHP) && serverVersion < 1)
- || (!hp && maxHP == damage))
- {
- graphics->setColor(userPalette->getColorWithAlpha(color1));
- graphics->fillRectangle(gcn::Rectangle(
- x, y, dx, height));
- return;
+ if (serverVersion < 1)
+ { // old servers
+ if ((!damage && (this != player_node || hp == maxHP))
+ || (!hp && maxHP == damage))
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color1));
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, dx, height));
+ return;
+ }
+ else if (width - dx <= 0)
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color2));
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, width, height));
+ return;
+ }
}
- else if (width - dx <= 0)
- {
- graphics->setColor(userPalette->getColorWithAlpha(color2));
- graphics->fillRectangle(gcn::Rectangle(
- x, y, width, height));
- return;
+ else
+ { // evol servers
+ if (hp == maxHP)
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color1));
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, dx, height));
+ return;
+ }
+ else if (width - dx <= 0)
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color2));
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, width, height));
+ return;
+ }
}
graphics->setColor(userPalette->getColorWithAlpha(color1));
@@ -2183,6 +2203,12 @@ void Being::recalcSpritesOrder()
{
std::map<int, int>::const_iterator repIt
= itemReplacer.find(mSpriteIDs[remSprite]);
+ if (repIt == itemReplacer.end())
+ {
+ repIt = itemReplacer.find(0);
+ if (repIt->second == 0)
+ repIt = itemReplacer.end();
+ }
if (repIt != itemReplacer.end())
{
mSpriteHide[remSprite] = repIt->second;
diff --git a/src/being.h b/src/being.h
index f1cae8df7..6052644c9 100644
--- a/src/being.h
+++ b/src/being.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/channel.cpp b/src/channel.cpp
index 19859f4ef..dd52fe75d 100644
--- a/src/channel.cpp
+++ b/src/channel.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/channel.h b/src/channel.h
index 078ea3a5e..559002296 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp
index 4ae1ebe2a..83229b454 100644
--- a/src/channelmanager.cpp
+++ b/src/channelmanager.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/channelmanager.h b/src/channelmanager.h
index e90408032..6798bdfa8 100644
--- a/src/channelmanager.h
+++ b/src/channelmanager.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp
index 0299a6fe3..ad86de8e9 100644
--- a/src/chatlogger.cpp
+++ b/src/chatlogger.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -142,11 +142,13 @@ std::string ChatLogger::secureName(std::string &name) const
{
for (unsigned int f = 0; f < name.length(); f ++)
{
- if (name[f] < '0' && name[f] > '9' && name[f] < 'a' && name[f] > 'z'
- && name[f] < 'A' && name[f] > 'Z'
+ if ((name[f] < '0' || name[f] > '9')
+ && (name[f] < 'a' || name[f] > 'z')
+ && (name[f] < 'A' || name[f] > 'Z')
&& name[f] != '-' && name[f] != '+' && name[f] != '='
&& name[f] != '.' && name[f] != ',' && name[f] != ')'
- && name[f] != '(' && name[f] != '[' && name[f] != ']')
+ && name[f] != '(' && name[f] != '[' && name[f] != ']'
+ && name[f] != '#')
{
name[f] = '_';
}
diff --git a/src/chatlogger.h b/src/chatlogger.h
index 23d5d4a86..91805a8bc 100644
--- a/src/chatlogger.h
+++ b/src/chatlogger.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009-2010 Andrei Karas
*
* This file is part of The ManaPlus Client.
diff --git a/src/client.cpp b/src/client.cpp
index d2b26f662..c51dffa9e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -101,6 +101,9 @@
#include "utils/paths.h"
#include "utils/stringutils.h"
+#include "test/testlauncher.h"
+#include "test/testmain.h"
+
#ifdef __APPLE__
#include <CoreFoundation/CFBundle.h>
#endif
@@ -259,8 +262,8 @@ Client::Client(const Options &options):
mState(STATE_CHOOSE_SERVER),
mOldState(STATE_START),
mIcon(nullptr),
- mLogicCounterId(0),
- mSecondsCounterId(0),
+ mLogicCounterId(nullptr),
+ mSecondsCounterId(nullptr),
mLimitFps(false),
mConfigAutoSaved(false),
mIsMinimized(false),
@@ -269,7 +272,25 @@ Client::Client(const Options &options):
mGuiAlpha(1.0f)
{
mInstance = this;
+}
+void Client::testsInit()
+{
+ printf ("testInit\n");
+ if (!mOptions.test.empty())
+ {
+ gameInit();
+ }
+ else
+ {
+ logger = new Logger;
+ initLocalDataDir();
+ initConfigDir();
+ }
+}
+
+void Client::gameInit()
+{
logger = new Logger;
// Load branding information
@@ -591,6 +612,7 @@ Client::Client(const Options &options):
{
mCurrentServer.hostname =
branding.getValue("defaultServer", "").c_str();
+ mOptions.serverName = mCurrentServer.hostname;
}
if (mCurrentServer.port == 0)
@@ -644,7 +666,31 @@ Client::Client(const Options &options):
Client::~Client()
{
- logger->log1("Quitting1");
+ if (!mOptions.testMode)
+ gameClear();
+ else
+ testsClear();
+}
+
+void Client::testsClear()
+{
+ if (!mOptions.test.empty())
+ {
+ gameClear();
+ }
+ else
+ {
+ BeingInfo::clear();
+
+ //delete logger;
+ //logger = nullptr;
+ }
+}
+
+void Client::gameClear()
+{
+ if (logger)
+ logger->log1("Quitting1");
config.removeListener("fpslimit", this);
config.removeListener("guialpha", this);
@@ -681,39 +727,45 @@ Client::~Client()
player_relations.store();
- logger->log1("Quitting2");
+ if (logger)
+ logger->log1("Quitting2");
delete gui;
gui = nullptr;
- logger->log1("Quitting3");
+ if (logger)
+ logger->log1("Quitting3");
delete mainGraphics;
mainGraphics = nullptr;
- logger->log1("Quitting4");
+ if (logger)
+ logger->log1("Quitting4");
- // Shutdown libxml
- xmlCleanupParser();
+ XML::cleanupXML();
- logger->log1("Quitting5");
+ if (logger)
+ logger->log1("Quitting5");
BeingInfo::clear();
// Shutdown sound
sound.close();
- logger->log1("Quitting6");
+ if (logger)
+ logger->log1("Quitting6");
ActorSprite::unload();
ResourceManager::deleteInstance();
- logger->log1("Quitting8");
+ if (logger)
+ logger->log1("Quitting8");
SDL_FreeSurface(mIcon);
- logger->log1("Quitting9");
+ if (logger)
+ logger->log1("Quitting9");
delete userPalette;
userPalette = nullptr;
@@ -721,7 +773,8 @@ Client::~Client()
delete joystick;
joystick = nullptr;
- logger->log1("Quitting10");
+ if (logger)
+ logger->log1("Quitting10");
config.write();
serverConfig.write();
@@ -729,18 +782,34 @@ Client::~Client()
config.clear();
serverConfig.clear();
- logger->log1("Quitting11");
+ if (logger)
+ logger->log1("Quitting11");
delete chatLogger;
chatLogger = nullptr;
- delete logger;
- logger = nullptr;
+ //delete logger;
+ //logger = nullptr;
mInstance = nullptr;
}
-int Client::exec()
+int Client::testsExec()
+{
+ if (mOptions.test.empty())
+ {
+ TestMain test;
+ return test.exec();
+ }
+ else
+ {
+ TestLauncher launcher(mOptions.test);
+ return launcher.exec();
+ }
+ return 0;
+}
+
+int Client::gameExec()
{
int lastTickTime = tick_time;
@@ -1481,6 +1550,12 @@ void Client::initRootDir()
*/
void Client::initHomeDir()
{
+ initLocalDataDir();
+ initConfigDir();
+}
+
+void Client::initLocalDataDir()
+{
mLocalDataDir = mOptions.localDataDir;
if (mLocalDataDir.empty())
@@ -1489,7 +1564,7 @@ void Client::initHomeDir()
// Use Application Directory instead of .mana
mLocalDataDir = std::string(PHYSFS_getUserDir()) +
"/Library/Application Support/" +
- branding.getValue("appName", "Mana");
+ branding.getValue("appName", "ManaPlus");
#elif defined __HAIKU__
mLocalDataDir = std::string(PHYSFS_getUserDir()) +
"/config/data/Mana";
@@ -1509,7 +1584,10 @@ void Client::initHomeDir()
logger->error(strprintf(_("%s doesn't exist and can't be created! "
"Exiting."), mLocalDataDir.c_str()));
}
+}
+void Client::initConfigDir()
+{
mConfigDir = mOptions.configDir;
if (mConfigDir.empty())
@@ -1520,13 +1598,13 @@ void Client::initHomeDir()
#elif defined __HAIKU__
mConfigDir = std::string(PHYSFS_getUserDir()) +
"/config/settings/Mana" +
- branding.getValue("appName", "Mana");
+ branding.getValue("appName", "ManaPlus");
#elif defined WIN32
mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA);
if (mConfigDir.empty())
mConfigDir = mLocalDataDir;
else
- mConfigDir += "/mana/" + branding.getValue("appShort", "Mana");
+ mConfigDir += "/mana/" + branding.getValue("appShort", "mana");
#else
mConfigDir = std::string(PHYSFS_getUserDir()) +
"/.config/mana/" + branding.getValue("appShort", "mana");
@@ -1611,6 +1689,8 @@ void Client::initConfiguration()
config.setValue("musicVolume", 60);
config.setValue("fpslimit", 60);
std::string defaultUpdateHost = branding.getValue("defaultUpdateHost", "");
+ if (!checkPath(defaultUpdateHost))
+ defaultUpdateHost = "";
config.setValue("updatehost", defaultUpdateHost);
config.setValue("customcursor", true);
config.setValue("useScreenshotDirectorySuffix", true);
@@ -1623,7 +1703,10 @@ void Client::initConfiguration()
// bool oldConfig = false;
// int emptySize = config.getSize();
- configPath = mConfigDir + "/config.xml";
+ if (mOptions.test.empty())
+ configPath = mConfigDir + "/config.xml";
+ else
+ configPath = mConfigDir + "/test.xml";
configFile = fopen(configPath.c_str(), "r");
@@ -1660,6 +1743,8 @@ void Client::initUpdatesDir()
// If updatesHost is currently empty, fill it from config file
if (mUpdateHost.empty())
mUpdateHost = config.getStringValue("updatehost");
+ if (!checkPath(mUpdateHost))
+ return;
// Don't go out of range int he next check
if (mUpdateHost.length() < 2)
@@ -1771,7 +1856,7 @@ void Client::initScreenshotDir()
if (config.getBoolValue("useScreenshotDirectorySuffix"))
{
std::string configScreenshotSuffix =
- branding.getValue("appShort", "Mana");
+ branding.getValue("appShort", "mana");
if (!configScreenshotSuffix.empty())
{
@@ -1833,7 +1918,7 @@ bool Client::createConfig(std::string &configPath)
// Use Application Directory instead of .mana
oldHomeDir = std::string(PHYSFS_getUserDir()) +
"/Library/Application Support/" +
- branding.getValue("appName", "Mana");
+ branding.getValue("appName", "ManaPlus");
#else
oldHomeDir = std::string(PHYSFS_getUserDir()) +
"/." + branding.getValue("appShort", "mana");
@@ -2238,6 +2323,14 @@ void Client::setFramerate(int fpsLimit)
SDL_setFramerate(&instance()->mFpsManager, fpsLimit);
}
+int Client::getFramerate()
+{
+ if (!instance()->mLimitFps)
+ return 0;
+
+ return SDL_getFramerate(&instance()->mFpsManager);
+}
+
void Client::closeDialogs()
{
Net::getNpcHandler()->clearDialogs();
diff --git a/src/client.h b/src/client.h
index 3bcc5f597..27e6249bd 100644
--- a/src/client.h
+++ b/src/client.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -163,6 +163,7 @@ public:
chooseDefault(false),
noOpenGL(false),
safeMode(false),
+ testMode(false),
serverPort(0)
{}
@@ -184,6 +185,8 @@ public:
std::string localDataDir;
std::string screenshotDir;
bool safeMode;
+ bool testMode;
+ std::string test;
std::string serverName;
short serverPort;
@@ -198,7 +201,13 @@ public:
static Client *instance()
{ return mInstance; }
- int exec();
+ void gameInit();
+
+ void testsInit();
+
+ int gameExec();
+
+ int testsExec();
static void setState(State state)
{ instance()->mState = state; }
@@ -256,6 +265,8 @@ public:
static void setFramerate(int fpsLimit);
+ static int getFramerate();
+
static bool isTmw();
void optionChanged(const std::string &name);
@@ -278,19 +289,33 @@ public:
private:
void initRootDir();
+
void initHomeDir();
+
void initConfiguration();
+
+ void initLocalDataDir();
+
+ void initConfigDir();
+
void initUpdatesDir();
+
void initScreenshotDir();
+
void initServerConfig(std::string serverName);
bool copyFile(std::string &configPath, std::string &oldConfigPath);
+
bool createConfig(std::string &configPath);
void accountLogin(LoginData *data);
void storeSafeParameters();
+ void gameClear();
+
+ void testsClear();
+
static Client *mInstance;
Options mOptions;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 862ac56b4..0f1e60a25 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -202,6 +202,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
handleServerUnIgnoreAll(args, tab);
else if (type == "dumpg")
handleDumpGraphics(args, tab);
+ else if (type == "dumpt")
+ handleDumpTests(args, tab);
else if (tab->handleCommand(type, args))
;
else if (type == "hack")
@@ -406,7 +408,6 @@ void CommandHandler::handleParty(const std::string &args, ChatTab *tab)
void CommandHandler::handleMe(const std::string &args, ChatTab *tab)
{
- const std::string str = strprintf("*%s*", args.c_str());
outString(tab, strprintf("*%s*", args.c_str()), args);
}
@@ -1111,7 +1112,7 @@ void CommandHandler::handleDumpGraphics(const std::string &args A_UNUSED,
str += ",0";
#endif
- str += strprintf(",%f,", Client::getGuiAlpha());
+ str += strprintf(",%f,", static_cast<double>(Client::getGuiAlpha()));
str += config.getBoolValue("adjustPerfomance") ? "1" : "0";
str += config.getBoolValue("alphaCache") ? "1" : "0";
str += config.getBoolValue("enableMapReduce") ? "1" : "0";
@@ -1123,7 +1124,60 @@ void CommandHandler::handleDumpGraphics(const std::string &args A_UNUSED,
str += config.getBoolValue("particleeffects") ? "1" : "0";
str += strprintf(",%d-%d", fps, config.getIntValue("fpslimit"));
- outString(tab, str, str);
+ outStringNormal(tab, str, str);
+}
+
+void CommandHandler::handleDumpTests(const std::string &args A_UNUSED,
+ ChatTab *tab)
+{
+ std::string str = config.getStringValue("testInfo");
+ outStringNormal(tab, str, str);
+}
+
+void CommandHandler::outStringNormal(ChatTab *tab, const std::string &str,
+ const std::string &def)
+{
+ if (!player_node)
+ return;
+
+ if (!tab)
+ {
+ Net::getChatHandler()->talk(str);
+ return;
+ }
+
+ switch (tab->getType())
+ {
+ case ChatTab::TAB_PARTY:
+ {
+ Net::getPartyHandler()->chat(str);
+ break;
+ }
+ case ChatTab::TAB_GUILD:
+ {
+ if (!player_node)
+ return;
+ const Guild *guild = player_node->getGuild();
+ if (guild)
+ {
+ if (guild->getServerGuild())
+ Net::getGuildHandler()->chat(guild->getId(), str);
+ else if (guildManager)
+ guildManager->chat(str);
+ }
+ break;
+ }
+ case ChatTab::TAB_WHISPER:
+ {
+ WhisperTab *whisper = static_cast<WhisperTab*>(tab);
+ tab->chatLog(player_node->getName(), str);
+ Net::getChatHandler()->privateMessage(whisper->getNick(), str);
+ break;
+ }
+ default:
+ Net::getChatHandler()->talk(def);
+ break;
+ }
}
#ifdef DEBUG_DUMP_LEAKS
diff --git a/src/commandhandler.h b/src/commandhandler.h
index b97b191ff..16e5e94ce 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -299,9 +299,14 @@ class CommandHandler
void handleDumpGraphics(const std::string &args, ChatTab *tab);
+ void handleDumpTests(const std::string &args, ChatTab *tab);
+
void outString(ChatTab *tab, const std::string &str,
const std::string &def);
+ void outStringNormal(ChatTab *tab, const std::string &str,
+ const std::string &def);
+
void handleCacheInfo(const std::string &args, ChatTab *tab);
bool parse2Int(const std::string &args, int *x, int *y);
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index 912c51404..e76a55dcf 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/compoundsprite.h b/src/compoundsprite.h
index f29bece7f..1c04e44d2 100644
--- a/src/compoundsprite.h
+++ b/src/compoundsprite.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/configlistener.h b/src/configlistener.h
index bf94b1df5..e4bbbee53 100644
--- a/src/configlistener.h
+++ b/src/configlistener.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/configuration.cpp b/src/configuration.cpp
index b8b742f53..39e0c75d4 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -27,9 +27,6 @@
#include "utils/paths.h"
#include "utils/stringutils.h"
-#include "utils/xml.h"
-
-#include <libxml/encoding.h>
#include <stdlib.h>
@@ -429,13 +426,13 @@ bool Configuration::resetBoolValue(const std::string &key)
return defaultValue;
}
-void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
+void ConfigurationObject::initFromXML(XmlNodePtr parent_node)
{
clear();
for_each_xml_child_node(node, parent_node)
{
- if (xmlStrEqual(node->name, BAD_CAST "list"))
+ if (xmlNameEqual(node, "list"))
{
// list option handling
@@ -443,7 +440,7 @@ void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
for_each_xml_child_node(subnode, node)
{
- if (xmlStrEqual(subnode->name, BAD_CAST name.c_str())
+ if (xmlNameEqual(subnode, name.c_str())
&& subnode->type == XML_ELEMENT_NODE)
{
ConfigurationObject *cobj = new ConfigurationObject;
@@ -455,7 +452,7 @@ void ConfigurationObject::initFromXML(xmlNodePtr parent_node)
}
}
- else if (xmlStrEqual(node->name, BAD_CAST "option"))
+ else if (xmlNameEqual(node, "option"))
{
// single option handling
@@ -492,9 +489,9 @@ void Configuration::init(const std::string &filename, bool useResManager)
return;
}
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration"))
+ if (!rootNode || !xmlNameEqual(rootNode, "configuration"))
{
logger->log("Warning: No configuration file (%s)", filename.c_str());
return;
@@ -503,7 +500,7 @@ void Configuration::init(const std::string &filename, bool useResManager)
initFromXML(rootNode);
}
-void ConfigurationObject::writeToXML(xmlTextWriterPtr writer)
+void ConfigurationObject::writeToXML(XmlTextWriterPtr writer)
{
for (Options::const_iterator i = mOptions.begin(), i_end = mOptions.end();
i != i_end; ++i)
@@ -554,7 +551,7 @@ void Configuration::write()
fclose(testFile);
}
- xmlTextWriterPtr writer = xmlNewTextWriterFilename(mConfigPath.c_str(), 0);
+ XmlTextWriterPtr writer = xmlNewTextWriterFilename(mConfigPath.c_str(), 0);
if (!writer)
{
diff --git a/src/configuration.h b/src/configuration.h
index 1f03b7387..00479933e 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -24,9 +24,10 @@
#define CONFIGURATION_H
#include "utils/stringutils.h"
-#include "defaults.h"
+#include "utils/xml.h"
-#include <libxml/xmlwriter.h>
+#include "defaults.h"
+#include "localconsts.h"
#include <cassert>
#include <list>
@@ -158,7 +159,7 @@ class ConfigurationObject
}
delete nextobj;
- nextobj = 0;
+ nextobj = nullptr;
}
/**
@@ -192,8 +193,8 @@ class ConfigurationObject
}
protected:
- virtual void initFromXML(xmlNodePtr node);
- virtual void writeToXML(xmlTextWriterPtr writer);
+ virtual void initFromXML(XmlNodePtr node);
+ virtual void writeToXML(XmlTextWriterPtr writer);
void deleteList(const std::string &name);
diff --git a/src/debug.h b/src/debug.h
index 00a0ec3d0..64a83e51c 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,6 +23,19 @@
//#define DEBUG_JOYSTICK 1
#ifdef ENABLE_MEM_DEBUG
+
//define _DEBUG_NEW_EMULATE_MALLOC 1
#include "debug/debug_new.h"
+
+#define reportFalse(val) reportFalse1(val, __FILE__, __LINE__)
+#define reportFalse1(val, file, line) reportFalseReal(val, file, line)
+
+#define reportTrue(val) reportTrue1(val, __FILE__, __LINE__)
+#define reportTrue1(val, file, line) reportTrueReal(val, file, line)
+
+#else
+
+#define reportFalse(val) (val)
+#define reportTrue(val) (val)
+
#endif
diff --git a/src/defaults.cpp b/src/defaults.cpp
index f18e0f432..8444fafff 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -224,6 +224,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "lang", "");
AddDEF(configData, "selectedJoystick", 0);
AddDEF(configData, "useInactiveJoystick", false);
+ AddDEF(configData, "testInfo", "");
return configData;
}
@@ -233,14 +234,14 @@ DefaultsData* getBrandingDefaults()
// Init config defaults
AddDEF(brandingData, "wallpapersPath", "");
AddDEF(brandingData, "wallpapersFile", "");
- AddDEF(brandingData, "appName", "Mana");
- AddDEF(brandingData, "appIcon", "icons/mana.png");
+ AddDEF(brandingData, "appName", "ManaPlus");
+ AddDEF(brandingData, "appIcon", "icons/manaplus.png");
AddDEF(brandingData, "loginMusic", "Magick - Real.ogg");
AddDEF(brandingData, "defaultServer", "");
AddDEF(brandingData, "defaultPort", DEFAULT_PORT);
AddDEF(brandingData, "defaultServerType", "tmwathena");
AddDEF(brandingData, "onlineServerList",
- "http://manasource.org/serverlist.xml");
+ "http://manaplus.evolonline.org/serverlist.xml");
AddDEF(brandingData, "appShort", "mana");
AddDEF(brandingData, "defaultUpdateHost", "");
AddDEF(brandingData, "helpPath", "");
diff --git a/src/defaults.h b/src/defaults.h
index 8a6ec7f60..1d979e928 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 55bf692cd..de12ecaa5 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -32,9 +32,9 @@
EffectManager::EffectManager()
{
XML::Document doc("effects.xml");
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "being-effects"))
+ if (!root || !xmlNameEqual(root, "being-effects"))
{
logger->log1("Error loading being effects file: effects.xml");
return;
@@ -46,7 +46,7 @@ EffectManager::EffectManager()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "effect"))
+ if (xmlNameEqual(node, "effect"))
{
EffectDescription ed;
ed.id = XML::getProperty(node, "id", -1);
diff --git a/src/equipment.h b/src/equipment.h
index 2b6dae3ce..6e4d04c21 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/event.cpp b/src/event.cpp
index 9d27a081a..4f77967bc 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/event.h b/src/event.h
index 9ff02f3d0..61bf31e14 100644
--- a/src/event.h
+++ b/src/event.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index cf1ee16dc..6e4926f2e 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/flooritem.h b/src/flooritem.h
index fb929268a..7e7da33a0 100644
--- a/src/flooritem.h
+++ b/src/flooritem.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/game.cpp b/src/game.cpp
index 9245e213d..aa9ba1536 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -216,7 +216,9 @@ static void createGuiWindows()
minimap = new Minimap;
helpWindow = new HelpWindow;
debugWindow = new DebugWindow;
- itemShortcutWindow = new ShortcutWindow("ItemShortcut", "items.xml");
+ itemShortcutWindow = new ShortcutWindow(
+ "ItemShortcut", "items.xml", 83, 460);
+
for (int f = 0; f < SHORTCUT_TABS; f ++)
{
itemShortcutWindow->addTab(toString(f + 1),
@@ -488,7 +490,7 @@ static bool saveScreenshot()
filenameSuffix.str("");
filename.str("");
filename << screenshotDirectory << "/";
- filenameSuffix << branding.getValue("appShort", "ManaPlus")
+ filenameSuffix << branding.getValue("appName", "ManaPlus")
<< "_Screenshot_" << screenshotCount << ".png";
filename << filenameSuffix.str();
testExists.open(filename.str().c_str(), std::ios::in);
@@ -572,6 +574,7 @@ void Game::logic()
}
closeDialogs();
Client::setFramerate(config.getIntValue("fpslimit"));
+ mNextAdjustTime = cur_time + adjustDelay;
if (Client::getState() != STATE_ERROR)
errorMessage = "";
}
@@ -603,7 +606,10 @@ void Game::adjustPerfomance()
return;
}
- int maxFps = config.getIntValue("fpslimit");
+ int maxFps = Client::getFramerate();
+ if (maxFps != config.getIntValue("fpslimit"))
+ return;
+
if (!maxFps)
maxFps = 30;
else if (maxFps < 10)
@@ -1579,7 +1585,6 @@ void Game::handleActive(SDL_Event &event)
player_node->setHalfAway(true);
}
}
- Client::setFramerate(fpsLimit);
}
if (player_node)
player_node->updateName();
@@ -1589,19 +1594,22 @@ void Game::handleActive(SDL_Event &event)
if (event.active.state & SDL_APPMOUSEFOCUS)
Client::setMouseFocused(event.active.gain);
- if (player_node && player_node->getAway())
+ if (!fpsLimit)
{
- if (Client::getInputFocused() || Client::getMouseFocused())
- fpsLimit = config.getIntValue("fpslimit");
+ if (player_node && player_node->getAway())
+ {
+ if (Client::getInputFocused() || Client::getMouseFocused())
+ fpsLimit = config.getIntValue("fpslimit");
+ else
+ fpsLimit = config.getIntValue("altfpslimit");
+ }
else
- fpsLimit = config.getIntValue("altfpslimit");
- Client::setFramerate(fpsLimit);
- }
- else
- {
- fpsLimit = config.getIntValue("fpslimit");
- Client::setFramerate(fpsLimit);
+ {
+ fpsLimit = config.getIntValue("fpslimit");
+ }
}
+ Client::setFramerate(fpsLimit);
+ mNextAdjustTime = cur_time + adjustDelay;
}
/**
diff --git a/src/game.h b/src/game.h
index 4e5337d29..c6d942fe1 100644
--- a/src/game.h
+++ b/src/game.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 47b0cae3d..bbd398aa5 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/graphics.h b/src/graphics.h
index 2502c0418..4c47e690d 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index 0e28c2b76..4a299620d 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h
index 13b7bf0c8..046bf90ce 100644
--- a/src/graphicsvertexes.h
+++ b/src/graphicsvertexes.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index 759d4c245..eff4652ce 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/beingpopup.h b/src/gui/beingpopup.h
index 2aeb6c20c..a029f739a 100644
--- a/src/gui/beingpopup.h
+++ b/src/gui/beingpopup.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index f5e556848..c41f22de7 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/buydialog.h b/src/gui/buydialog.h
index 6bc10a103..57f66c922 100644
--- a/src/gui/buydialog.h
+++ b/src/gui/buydialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index 2a614ed74..5aa421bad 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/buyselldialog.h b/src/gui/buyselldialog.h
index 2c7e5c101..d8e4444d8 100644
--- a/src/gui/buyselldialog.h
+++ b/src/gui/buyselldialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 3c412b424..518ed3da1 100644
--- a/src/gui/changeemaildialog.cpp
+++ b/src/gui/changeemaildialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/changeemaildialog.h b/src/gui/changeemaildialog.h
index fccb5cb1c..acbd6b55a 100644
--- a/src/gui/changeemaildialog.h
+++ b/src/gui/changeemaildialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index a7ebaebca..8082b8d58 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/changepassworddialog.h b/src/gui/changepassworddialog.h
index fca8b4946..525384a09 100644
--- a/src/gui/changepassworddialog.h
+++ b/src/gui/changepassworddialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index d621caa96..a1233fdcc 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -124,24 +124,24 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
mAttributesLeft = new Label(
strprintf(_("Please distribute %d points"), 99));
- int w = 200;
+ int w = 280;
int h = 330;
setContentSize(w, h);
- mPlayerBox->setDimension(gcn::Rectangle(80, 30, 110, 85));
+ mPlayerBox->setDimension(gcn::Rectangle(145, 35, 110, 87));
mNameLabel->setPosition(5, 5);
mNameField->setDimension(
- gcn::Rectangle(45, 5, w - 45 - 7, mNameField->getHeight()));
- mPrevHairColorButton->setPosition(90, 35);
- mNextHairColorButton->setPosition(165, 35);
+ gcn::Rectangle(60, 5, w - 60 - 7, mNameField->getHeight()));
+ mPrevHairColorButton->setPosition(155, 35);
+ mNextHairColorButton->setPosition(230, 35);
mHairColorLabel->setPosition(5, 40);
- mPrevHairStyleButton->setPosition(90, 64);
- mNextHairStyleButton->setPosition(165, 64);
+ mPrevHairStyleButton->setPosition(155, 64);
+ mNextHairStyleButton->setPosition(230, 64);
mHairStyleLabel->setPosition(5, 70);
if (serverVersion >= 2)
{
- mPrevRaceButton->setPosition(90, 93);
- mNextRaceButton->setPosition(165, 93);
+ mPrevRaceButton->setPosition(155, 93);
+ mNextRaceButton->setPosition(230, 93);
mRaceLabel->setPosition(5, 100);
}
@@ -365,17 +365,18 @@ void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
mAttributeLabel[i] = new Label(labels[i]);
mAttributeLabel[i]->setWidth(70);
mAttributeLabel[i]->setPosition(5, 140 + i*20);
+ mAttributeLabel[i]->adjustSize();
add(mAttributeLabel[i]);
mAttributeSlider[i] = new Slider(min, max);
- mAttributeSlider[i]->setDimension(gcn::Rectangle(75, 140 + i * 20,
+ mAttributeSlider[i]->setDimension(gcn::Rectangle(140, 140 + i * 20,
100, 10));
mAttributeSlider[i]->setActionEventId("statslider");
mAttributeSlider[i]->addActionListener(this);
add(mAttributeSlider[i]);
mAttributeValue[i] = new Label(toString(min));
- mAttributeValue[i]->setPosition(180, 140 + i*20);
+ mAttributeValue[i]->setPosition(245, 140 + i*20);
add(mAttributeValue[i]);
}
diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h
index c7010d6b1..e369f1777 100644
--- a/src/gui/charcreatedialog.h
+++ b/src/gui/charcreatedialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 401c9ae33..638691bab 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h
index 9ebab0126..1e32fb311 100644
--- a/src/gui/charselectdialog.h
+++ b/src/gui/charselectdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 84d61cf65..899bbdc36 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -305,6 +305,7 @@ void ChatWindow::fillCommands()
mCommands.push_back("/serverignoreall");
mCommands.push_back("/serverunignoreall");
mCommands.push_back("/dumpg");
+ mCommands.push_back("/dumpt");
mCommands.push_back("/pseudoaway ");
mCommands.push_back("<PLAYER>");
mCommands.push_back("<MONSTER>");
@@ -419,11 +420,11 @@ void ChatWindow::prevTab()
int tab = mChatTabs->getSelectedTabIndex();
- if (tab == 0)
+ if (tab <= 0)
tab = mChatTabs->getNumberOfTabs();
tab--;
- mChatTabs->setSelectedTab(tab);
+ mChatTabs->setSelectedTabByPos(tab);
}
void ChatWindow::nextTab()
@@ -437,7 +438,7 @@ void ChatWindow::nextTab()
if (tab == mChatTabs->getNumberOfTabs())
tab = 0;
- mChatTabs->setSelectedTab(tab);
+ mChatTabs->setSelectedTabByPos(tab);
}
void ChatWindow::closeTab()
@@ -459,7 +460,7 @@ void ChatWindow::closeTab()
void ChatWindow::defaultTab()
{
if (mChatTabs)
- mChatTabs->setSelectedTab(static_cast<unsigned>(0));
+ mChatTabs->setSelectedTabByPos(static_cast<unsigned>(0));
}
void ChatWindow::action(const gcn::ActionEvent &event)
@@ -1179,7 +1180,8 @@ void ChatWindow::autoComplete()
ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab());
std::vector<std::string> nameList;
- cTab->getAutoCompleteList(nameList);
+ if (cTab)
+ cTab->getAutoCompleteList(nameList);
newName = autoComplete(nameList, name);
if (newName == "" && actorSpriteManager)
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 3c1195e8f..82e3d31f2 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp
index 298855563..cf9d541ad 100644
--- a/src/gui/confirmdialog.cpp
+++ b/src/gui/confirmdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/confirmdialog.h b/src/gui/confirmdialog.h
index 2b5febed0..421be7f96 100644
--- a/src/gui/confirmdialog.h
+++ b/src/gui/confirmdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp
index da98ea5ac..ba1330881 100644
--- a/src/gui/connectiondialog.cpp
+++ b/src/gui/connectiondialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/connectiondialog.h b/src/gui/connectiondialog.h
index 7c0b59faf..76d8a952b 100644
--- a/src/gui/connectiondialog.h
+++ b/src/gui/connectiondialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 56a63c72d..d13545bea 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index b955209a5..ff86eaf74 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index b5a7da634..db0878360 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/didyouknowwindow.h b/src/gui/didyouknowwindow.h
index d9734e8fe..f3fb61c70 100644
--- a/src/gui/didyouknowwindow.h
+++ b/src/gui/didyouknowwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp
index a8c92ed47..a286f78e8 100644
--- a/src/gui/emotepopup.cpp
+++ b/src/gui/emotepopup.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2009 Aethyra Development Team
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/emotepopup.h b/src/gui/emotepopup.h
index a80562fea..453c4e669 100644
--- a/src/gui/emotepopup.h
+++ b/src/gui/emotepopup.h
@@ -3,7 +3,7 @@
* Copyright (C) 2009 Aethyra Development Team
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index cb3ace0c7..275bf19bb 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -65,7 +65,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
mEquipment(equipment),
mSelected(-1),
mForing(foring),
- mImageSet(0)
+ mImageSet(nullptr)
{
mBeing = being;
mItemPopup = new ItemPopup;
@@ -355,7 +355,7 @@ void EquipmentWindow::resetBeing(Being *being)
void EquipmentWindow::fillBoxes()
{
XML::Document *doc = new XML::Document("equipmentwindow.xml");
- xmlNodePtr root = doc->rootNode();
+ XmlNodePtr root = doc->rootNode();
if (!root)
{
delete doc;
@@ -371,23 +371,23 @@ void EquipmentWindow::fillBoxes()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "window"))
+ if (xmlNameEqual(node, "window"))
loadWindow(node);
- else if (xmlStrEqual(node->name, BAD_CAST "playerbox"))
+ else if (xmlNameEqual(node, "playerbox"))
loadPlayerBox(node);
- else if (xmlStrEqual(node->name, BAD_CAST "slot"))
+ else if (xmlNameEqual(node, "slot"))
loadSlot(node, mImageSet);
}
delete doc;
}
-void EquipmentWindow::loadWindow(xmlNodePtr windowNode)
+void EquipmentWindow::loadWindow(XmlNodePtr windowNode)
{
setDefaultSize(XML::getProperty(windowNode, "width", 180),
XML::getProperty(windowNode, "height", 345), ImageRect::CENTER);
}
-void EquipmentWindow::loadPlayerBox(xmlNodePtr playerBoxNode)
+void EquipmentWindow::loadPlayerBox(XmlNodePtr playerBoxNode)
{
mPlayerBox->setDimension(gcn::Rectangle(
XML::getProperty(playerBoxNode, "x", 50),
@@ -396,7 +396,7 @@ void EquipmentWindow::loadPlayerBox(xmlNodePtr playerBoxNode)
XML::getProperty(playerBoxNode, "height", 168)));
}
-void EquipmentWindow::loadSlot(xmlNodePtr slotNode, ImageSet *imageset)
+void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset)
{
int slot = parseSlotName(XML::getProperty(slotNode, "name", ""));
if (slot < 0)
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 0a3c2da20..daeaeb3d7 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -85,7 +85,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener
void mousePressed(gcn::MouseEvent& mouseEvent);
Item* getEquipment(int i)
- { return mEquipment ? mEquipment->getEquipment(i) : 0; }
+ { return mEquipment ? mEquipment->getEquipment(i) : nullptr; }
void setBeing(Being *being);
@@ -108,11 +108,11 @@ class EquipmentWindow : public Window, public gcn::ActionListener
void addBox(int idx, int x, int y, int imageIndex);
- void loadWindow(xmlNodePtr windowNode);
+ void loadWindow(XmlNodePtr windowNode);
- void loadPlayerBox(xmlNodePtr playerBoxNode);
+ void loadPlayerBox(XmlNodePtr playerBoxNode);
- void loadSlot(xmlNodePtr slotNode, ImageSet *imageset);
+ void loadSlot(XmlNodePtr slotNode, ImageSet *imageset);
int parseSlotName(std::string name);
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index 40fa2f4ed..0e98c3473 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index 9d814bb69..064f04697 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b3154fb25..3d79f0cdf 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -105,14 +105,14 @@ Gui::Gui(Graphics *graphics):
Window::setWindowContainer(guiTop);
setTop(guiTop);
+ const std::vector<std::string> langs = getLang();
+ const bool isJapan = (!langs.empty() && langs[0].size() > 3
+ && langs[0].substr(0, 3) == "ja_");
+
// Set global font
const int fontSize = config.getIntValue("fontSize");
-
std::string fontFile = config.getValue("font", "");
-
- std::vector<std::string> langs = getLang();
- if (!langs.empty() && langs[0].size() > 3
- && langs[0].substr(0, 3) == "ja_")
+ if (isJapan)
{
fontFile = config.getValue("japanFont", "");
if (fontFile.empty())
@@ -134,6 +134,15 @@ Gui::Gui(Graphics *graphics):
// Set particle font
fontFile = config.getValue("particleFont", "");
+
+ if (isJapan)
+ {
+ fontFile = config.getValue("japanFont", "");
+ if (fontFile.empty())
+ fontFile = branding.getStringValue("japanFont");
+ }
+
+
if (fontFile.empty())
fontFile = branding.getStringValue("particleFont");
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 578202b17..cadcc89ac 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index b1175d709..a099c7a7a 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/helpwindow.h b/src/gui/helpwindow.h
index 178ae1e16..a6d83e91d 100644
--- a/src/gui/helpwindow.h
+++ b/src/gui/helpwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 8ffebebff..01e2bdd17 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -98,7 +98,7 @@ InventoryWindow::WindowList InventoryWindow::instances;
InventoryWindow::InventoryWindow(Inventory *inventory):
Window("Inventory", false, nullptr, "inventory.xml"),
mInventory(inventory),
- mDropButton(0),
+ mDropButton(nullptr),
mSplit(false),
mCompactMode(false)
{
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index aa78705b8..2b35ec9c4 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -128,7 +128,7 @@ class InventoryWindow : public Window,
void processEvent(Mana::Channels channel, const Mana::Event &event);
- void updateButtons(Item *item = 0);
+ void updateButtons(Item *item = nullptr);
bool isInputFocused() const;
diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp
index a80434ac0..9e2a97681 100644
--- a/src/gui/itemamountwindow.cpp
+++ b/src/gui/itemamountwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/itemamountwindow.h b/src/gui/itemamountwindow.h
index bacd4cfd0..076101c0f 100644
--- a/src/gui/itemamountwindow.h
+++ b/src/gui/itemamountwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 2e87cd544..9a9e5f50d 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
index 66d7e91a2..89f6355fe 100644
--- a/src/gui/itempopup.h
+++ b/src/gui/itempopup.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index fa6241ef6..972c660ec 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -70,8 +70,8 @@ KillStats::KillStats():
xpNextLevel = 1;
mLine1 = new Label(strprintf(_("Level: %d at %f%%"),
- player_node->getLevel(), static_cast<float>(xp)
- / static_cast<float>(xpNextLevel) * 100.0f));
+ player_node->getLevel(), static_cast<double>(xp)
+ / static_cast<double>(xpNextLevel) * 100.0));
mLine2 = new Label(strprintf(_("Exp: %d/%d Left: %d"),
xp, xpNextLevel, xpNextLevel - xp));
@@ -206,9 +206,9 @@ void KillStats::gainXp(int xp)
timeDiff = 1;
mLine1->setCaption(strprintf(_("Level: %d at %f%%"),
- player_node->getLevel(), static_cast<float>(
- PlayerInfo::getAttribute(EXP)) / static_cast<float>(
- xpNextLevel) * 100.0f));
+ player_node->getLevel(), static_cast<double>(
+ PlayerInfo::getAttribute(EXP)) / static_cast<double>(
+ xpNextLevel) * 100.0));
mLine2->setCaption(strprintf(_("Exp: %d/%d Left: %d"),
PlayerInfo::getAttribute(EXP), xpNextLevel,
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index 86b3dc28b..b1c80b102 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -184,8 +184,16 @@ void LoginDialog::action(const gcn::ActionEvent &event)
serverConfig.setValue("customUpdateHost",
mUpdateHostText->getText());
- mLoginData->updateHost = mUpdateHostText->getText();
- *mUpdateHost = mUpdateHostText->getText();
+ if (checkPath(mUpdateHostText->getText()))
+ {
+ mLoginData->updateHost = mUpdateHostText->getText();
+ *mUpdateHost = mUpdateHostText->getText();
+ }
+ else
+ {
+ mLoginData->updateHost = "";
+ *mUpdateHost = "";
+ }
}
mLoginData->updateType = updateType;
serverConfig.setValue("updateType", updateType);
diff --git a/src/gui/logindialog.h b/src/gui/logindialog.h
index 0696bc680..08799b1c2 100644
--- a/src/gui/logindialog.h
+++ b/src/gui/logindialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index d890a462f..74da37341 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
index 86996f51c..8b7da5849 100644
--- a/src/gui/minimap.h
+++ b/src/gui/minimap.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 665d2b61b..00df97813 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -188,7 +188,7 @@ void MiniStatusWindow::updateBars()
void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite)
{
if (index >= static_cast<int>(mIcons.size()))
- mIcons.resize(index + 1, 0);
+ mIcons.resize(index + 1, nullptr);
delete mIcons[index];
diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h
index 6fb8f7652..ca18e1b92 100644
--- a/src/gui/ministatuswindow.h
+++ b/src/gui/ministatuswindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 66a30c8a7..eadd99c21 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -26,6 +26,7 @@
#include "client.h"
#include "gui/setup.h"
+#include "gui/viewport.h"
#include "gui/widgets/browserbox.h"
#include "gui/widgets/button.h"
@@ -48,7 +49,7 @@
#include "debug.h"
-#define CAPTION_WAITING _("Waiting for server")
+#define CAPTION_WAITING _("Stop waiting")
#define CAPTION_NEXT _("Next")
#define CAPTION_CLOSE _("Close")
#define CAPTION_SUBMIT _("Submit")
@@ -62,7 +63,10 @@ NpcDialog::NpcDialog(int npcId) :
mDefaultInt(0),
mInputState(NPC_INPUT_NONE),
mActionState(NPC_ACTION_WAIT),
- mLastNextTime(0)
+ mLastNextTime(0),
+ mCameraMode(-1),
+ mCameraX(0),
+ mCameraY(0)
{
// Basic Window Setup
setWindowName("NpcText");
@@ -220,9 +224,9 @@ void NpcDialog::action(const gcn::ActionEvent &event)
return;
nextDialog();
- addText(_("> Next"), false);
}
- else if (mActionState == NPC_ACTION_CLOSE)
+ else if (mActionState == NPC_ACTION_CLOSE
+ || mActionState == NPC_ACTION_WAIT)
{
closeDialog();
}
@@ -301,6 +305,7 @@ void NpcDialog::nextDialog()
void NpcDialog::closeDialog()
{
+ restoreCamera();
Net::getNpcHandler()->closeDialog(mNpcId);
}
@@ -501,9 +506,37 @@ void NpcDialog::buildLayout()
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
- mButton->setEnabled(mActionState != NPC_ACTION_WAIT);
-
redraw();
mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
-} \ No newline at end of file
+}
+
+void NpcDialog::saveCamera()
+{
+ if (!viewport || mCameraMode >= 0)
+ return;
+
+ mCameraMode = viewport->getCameraMode();
+ mCameraX = viewport->getCameraRelativeX();
+ mCameraY = viewport->getCameraRelativeY();
+}
+
+void NpcDialog::restoreCamera()
+{
+ if (!viewport || mCameraMode == -1)
+ return;
+
+ if (!mCameraMode)
+ {
+ if (viewport->getCameraMode() != mCameraMode)
+ viewport->toggleCameraMode();
+ }
+ else
+ {
+ if (viewport->getCameraMode() != mCameraMode)
+ viewport->toggleCameraMode();
+ viewport->setCameraRelativeX(mCameraX);
+ viewport->setCameraRelativeY(mCameraY);
+ }
+ mCameraMode = -1;
+}
diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h
index 7e9ea7e10..4d919a3f2 100644
--- a/src/gui/npcdialog.h
+++ b/src/gui/npcdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -172,6 +172,10 @@ class NpcDialog : public Window, public gcn::ActionListener,
*/
static void destroyAll();
+ void saveCamera();
+
+ void restoreCamera();
+
private:
typedef std::list<NpcDialog*> DialogList;
static DialogList instances;
@@ -230,6 +234,9 @@ class NpcDialog : public Window, public gcn::ActionListener,
NpcInputState mInputState;
NpcActionState mActionState;
int mLastNextTime;
+ int mCameraMode;
+ int mCameraX;
+ int mCameraY;
};
#endif // NPCDIALOG_H
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index ada48e832..6bcb62baf 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/npcpostdialog.h b/src/gui/npcpostdialog.h
index bc329096b..b00f7bda0 100644
--- a/src/gui/npcpostdialog.h
+++ b/src/gui/npcpostdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp
index 5a6ee4846..4a3bdf731 100644
--- a/src/gui/okdialog.cpp
+++ b/src/gui/okdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/okdialog.h b/src/gui/okdialog.h
index 2f32d0d65..5705be568 100644
--- a/src/gui/okdialog.h
+++ b/src/gui/okdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index c33c753bc..74e8dbe46 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -985,3 +985,12 @@ void OutfitWindow::setItemSelected(Item *item)
mItemColorSelected = 1;
}
}
+
+void OutfitWindow::clearCurrentOutfit()
+{
+ for (unsigned f = 0; f < OUTFIT_ITEM_COUNT; f++)
+ {
+ mItems[mCurrentOutfit][f] = -1;
+ mItemColors[mCurrentOutfit][f] = 1;
+ }
+}
diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h
index 8dd5fd6a3..b2b46c7e7 100644
--- a/src/gui/outfitwindow.h
+++ b/src/gui/outfitwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -108,6 +108,8 @@ class OutfitWindow : public Window, gcn::ActionListener
std::string keyName(int number) A_PURE;
+ void clearCurrentOutfit();
+
private:
Button *mPreviousButton;
Button *mNextButton;
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index 348f97de8..fe14cd2d4 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/palette.h b/src/gui/palette.h
index d46a3c57c..36d87e305 100644
--- a/src/gui/palette.h
+++ b/src/gui/palette.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 15afc7600..cd3a4c5ad 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -85,7 +85,7 @@ std::string tradePartnerName("");
PopupMenu::PopupMenu():
Popup("PopupMenu", "popupmenu.xml"),
mBeingId(0),
- mFloorItem(nullptr),
+ mFloorItemId(0),
mItem(nullptr),
mItemId(0),
mItemColor(1),
@@ -367,7 +367,7 @@ void PopupMenu::showPopup(int x, int y, std::vector<ActorSprite*> &beings)
being->getId(), (being->getName()
+ being->getGenderSignWithSpace()).c_str()));
}
- else if(actor->getType() == ActorSprite::FLOOR_ITEM)
+ else if (actor->getType() == ActorSprite::FLOOR_ITEM)
{
FloorItem *floorItem = static_cast<FloorItem*>(actor);
const ItemInfo &info = floorItem->getInfo();
@@ -529,7 +529,7 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
if (!floorItem)
return;
- mFloorItem = floorItem;
+ mFloorItemId = floorItem->getId();
mX = x;
mY = y;
const ItemInfo &info = floorItem->getInfo();
@@ -586,7 +586,7 @@ void PopupMenu::showOutfitsPopup(int x, int y)
mBrowserBox->clearRows();
mBrowserBox->addRow(_("Outfits"));
- mBrowserBox->addRow("load old outfits", _("Load old outfits"));
+ mBrowserBox->addRow("clear outfit", _("Clear outfit"));
mBrowserBox->addRow("##3---");
mBrowserBox->addRow("cancel", _("Cancel"));
@@ -871,7 +871,7 @@ void PopupMenu::showChangePos(int x, int y)
else
{
mBeingId = 0;
- mFloorItem = nullptr;
+ mFloorItemId = 0;
mItem = nullptr;
mMapItem = nullptr;
mNick = "";
@@ -1038,10 +1038,14 @@ void PopupMenu::handleLink(const std::string &link,
player_node->setImitate(mNick);
}
// Pick Up Floor Item action
- else if ((link == "pickup") && mFloorItem)
+ else if ((link == "pickup") && mFloorItemId)
{
- if (player_node)
- player_node->pickUp(mFloorItem);
+ if (player_node && actorSpriteManager)
+ {
+ FloorItem *item = actorSpriteManager->findItem(mFloorItemId);
+ if (item)
+ player_node->pickUp(item);
+ }
}
// Look To action
else if (link == "look")
@@ -1106,16 +1110,21 @@ void PopupMenu::handleLink(const std::string &link,
chatWindow->addItemText(mItem->getInfo().getName());
}
}
- else if (mFloorItem)
+ else if (mFloorItemId && actorSpriteManager)
{
- if (serverVersion > 0)
- {
- chatWindow->addItemText(mFloorItem->getInfo().getName(
- mFloorItem->getColor()));
- }
- else
+ FloorItem *item = actorSpriteManager->findItem(mFloorItemId);
+
+ if (item)
{
- chatWindow->addItemText(mFloorItem->getInfo().getName());
+ if (serverVersion > 0)
+ {
+ chatWindow->addItemText(item->getInfo().getName(
+ item->getColor()));
+ }
+ else
+ {
+ chatWindow->addItemText(item->getInfo().getName());
+ }
}
}
}
@@ -1331,11 +1340,6 @@ void PopupMenu::handleLink(const std::string &link,
mDialog->setActionEventId("ok");
mDialog->addActionListener(&mRenameListener);
}
- else if (link == "load old outfits")
- {
- if (outfitWindow)
- outfitWindow->load(true);
- }
else if (link == "load old spells")
{
if (spellManager)
@@ -1673,6 +1677,11 @@ void PopupMenu::handleLink(const std::string &link,
showChangePos(getX(), getY());
return;
}
+ else if (link == "clear outfit")
+ {
+ if (outfitWindow)
+ outfitWindow->clearCurrentOutfit();
+ }
else if (!link.compare(0, 10, "guild-pos-"))
{
if (player_node)
@@ -1706,10 +1715,11 @@ void PopupMenu::handleLink(const std::string &link,
int id = atoi(link.substr(10).c_str());
if (id)
{
- mFloorItem = actorSpriteManager->findItem(id);
- if (mFloorItem)
+ FloorItem *item = actorSpriteManager->findItem(id);
+ if (item)
{
- showPopup(getX(), getY(), mFloorItem);
+ mFloorItemId = item->getId();
+ showPopup(getX(), getY(), item);
return;
}
}
@@ -1744,7 +1754,7 @@ void PopupMenu::handleLink(const std::string &link,
setVisible(false);
mBeingId = 0;
- mFloorItem = nullptr;
+ mFloorItemId = 0;
mItem = nullptr;
mItemId = 0;
mItemColor = 1;
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 2db565ab7..8b9107300 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -160,7 +160,7 @@ class PopupMenu : public Popup, public LinkHandler
BrowserBox* mBrowserBox;
int mBeingId;
- FloorItem* mFloorItem;
+ int mFloorItemId;
Item *mItem;
int mItemId;
unsigned char mItemColor;
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index 450cfd86e..dff5a570c 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/quitdialog.h b/src/gui/quitdialog.h
index 5456be26b..dd881d283 100644
--- a/src/gui/quitdialog.h
+++ b/src/gui/quitdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 29030aa72..2122e0d6b 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/register.h b/src/gui/register.h
index b0137f141..ecda27d28 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index 001a8671a..0e69db026 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2009 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h
index e0aac7785..6fcad34d4 100644
--- a/src/gui/sdlfont.h
+++ b/src/gui/sdlfont.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The ManaPlus Client.
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 7c5ddb055..e8660f861 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -8,7 +8,7 @@
*
* Copyright (c) 2004, 2005, 2006, 2007 Olof Naessén and Per Larsson
* Copyright (C) 2007-2010 The Mana World Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* Js_./
* Per Larsson a.k.a finalman _RqZ{a<^_aa
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index e1a77f6c9..0e1b16de7 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/selldialog.h b/src/gui/selldialog.h
index a775cf0e0..877b74cd8 100644
--- a/src/gui/selldialog.h
+++ b/src/gui/selldialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 3fd298159..39ff19a89 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -365,7 +365,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir):
mConnectButton->requestFocus();
}
- loadServers(false);
+ loadServers(true);
if (mServers.empty())
downloadServerList();
@@ -558,7 +558,7 @@ void ServerDialog::logic()
else if (mDownloadStatus == DOWNLOADING_IN_PROGRESS)
{
mDescription->setCaption(strprintf(_("Downloading server list..."
- "%2.2f%%"), mDownloadProgress * 100));
+ "%2.2f%%"), static_cast<double>(mDownloadProgress * 100)));
}
else if (mDownloadStatus == DOWNLOADING_IDLE)
{
@@ -609,9 +609,12 @@ void ServerDialog::downloadServerList()
if (listFile.empty())
listFile = config.getStringValue("onlineServerList");
- // Fall back to manasource.org when neither branding nor config set it
+ // Fall back to manaplus.evolonline.org when neither branding nor config set it
if (listFile.empty())
- listFile = "http://manasource.org/serverlist.xml";
+ {
+ listFile = "http://manaplus.evolonline.org/"
+ "serverlist.xml/serverlist.xml";
+ }
if (mDownload)
{
@@ -628,9 +631,9 @@ void ServerDialog::downloadServerList()
void ServerDialog::loadServers(bool addNew)
{
XML::Document doc(mDir + "/serverlist.xml", false);
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "serverlist"))
+ if (!rootNode || !xmlNameEqual(rootNode, "serverlist"))
{
logger->log1("Error loading server list!");
return;
@@ -646,7 +649,7 @@ void ServerDialog::loadServers(bool addNew)
for_each_xml_child_node(serverNode, rootNode)
{
- if (!xmlStrEqual(serverNode->name, BAD_CAST "server"))
+ if (!xmlNameEqual(serverNode, "server"))
continue;
ServerInfo server;
@@ -681,7 +684,7 @@ void ServerDialog::loadServers(bool addNew)
for_each_xml_child_node(subNode, serverNode)
{
- if (xmlStrEqual(subNode->name, BAD_CAST "connection"))
+ if (xmlNameEqual(subNode, "connection"))
{
server.hostname = XML::getProperty(subNode, "hostname", "");
server.port = static_cast<short unsigned>(
@@ -693,7 +696,7 @@ void ServerDialog::loadServers(bool addNew)
server.port = defaultPortForServerType(server.type);
}
}
- else if (xmlStrEqual(subNode->name, BAD_CAST "description"))
+ else if (xmlNameEqual(subNode, "description"))
{
server.description = reinterpret_cast<const char*>(
subNode->xmlChildrenNode->content);
diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h
index 39c6f94f7..d2fe0d25b 100644
--- a/src/gui/serverdialog.h
+++ b/src/gui/serverdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index d305824d5..bac474950 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -201,7 +201,7 @@ void Setup::doCancel()
void Setup::activateTab(const std::string &name)
{
std::string tmp = gettext(name.c_str());
- mPanel->setSelectedTab(tmp);
+ mPanel->setSelectedTabByName(tmp);
/*
for (std::list<SetupTab*>::const_iterator it = mTabs.begin();
it != mTabs.end(); ++it)
@@ -212,7 +212,7 @@ void Setup::activateTab(const std::string &name)
logger->log("check tab: " + tab->getName());
if (tab->getName() == tmp)
{
- mPanel->setSelectedTab(name);
+ mPanel->setSelectedTabByName(name);
return;
}
}
diff --git a/src/gui/setup.h b/src/gui/setup.h
index b499da4ee..3a6f66297 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index 1737e9004..bc058faf9 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h
index 53aa017b6..88869d730 100644
--- a/src/gui/setup_audio.h
+++ b/src/gui/setup_audio.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_chat.cpp b/src/gui/setup_chat.cpp
index 1b8209c8f..7e81acaa9 100644
--- a/src/gui/setup_chat.cpp
+++ b/src/gui/setup_chat.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_chat.h b/src/gui/setup_chat.h
index 402235d99..238021cca 100644
--- a/src/gui/setup_chat.h
+++ b/src/gui/setup_chat.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 6f1a4afce..d5885143c 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -1,7 +1,7 @@
/*
* Configurable text colors
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index b6d5209e2..cbcca6dfa 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -1,7 +1,7 @@
/*
* Configurable text colors
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 7899247e3..290607be4 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h
index 5bd72cdad..d93d7e821 100644
--- a/src/gui/setup_joystick.h
+++ b/src/gui/setup_joystick.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp
index fa7a63b8c..bdd7c2083 100644
--- a/src/gui/setup_keyboard.cpp
+++ b/src/gui/setup_keyboard.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au>
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index bd445cfa0..d6f5e9972 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index a13bf4ba3..4144a02ab 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp
index dd634d1f3..95703fa4c 100644
--- a/src/gui/setup_perfomance.cpp
+++ b/src/gui/setup_perfomance.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_perfomance.h b/src/gui/setup_perfomance.h
index f355c9691..097c1e28c 100644
--- a/src/gui/setup_perfomance.h
+++ b/src/gui/setup_perfomance.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index a6bf5b81c..f0bf4c0ea 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index c9ce7b3b3..ebfc78db6 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 Andrei Karas
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 8ac61f90c..9ddef9e1a 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_relations.h b/src/gui/setup_relations.h
index 2c23d4dba..76ea26875 100644
--- a/src/gui/setup_relations.h
+++ b/src/gui/setup_relations.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 794fd3324..259388fd0 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 509deb2fd..0c82ab272 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index a50a485ec..b6b87edb7 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h
index e1fd8a2a0..53ed7690c 100644
--- a/src/gui/shopwindow.h
+++ b/src/gui/shopwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index eff28def7..0e968efef 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,6 +23,7 @@
#include "gui/shortcutwindow.h"
#include "configuration.h"
+#include "logger.h"
#include "gui/setup.h"
@@ -58,12 +59,15 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
- gcn::Window::setTitleBarHeight(gcn::Window::getPadding());
+ gcn::Window::setTitleBarHeight(gcn::Window::getPadding() + 1);
setShowTitle(false);
setResizable(true);
setDefaultVisible(false);
setSaveVisible(true);
+ mDragOffsetX = 0;
+ mDragOffsetY = 0;
+
setupWindow->registerWindowForReset(this);
mTabs = nullptr;
@@ -104,12 +108,15 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
{
setWindowName(title);
// no title presented, title bar is padding so window can be moved.
- gcn::Window::setTitleBarHeight(gcn::Window::getPadding());
+ gcn::Window::setTitleBarHeight(gcn::Window::getPadding() + 1);
setShowTitle(false);
setResizable(true);
setDefaultVisible(false);
setSaveVisible(true);
+ mDragOffsetX = 0;
+ mDragOffsetY = 0;
+
setupWindow->registerWindowForReset(this);
mTabs = new TabbedArea;
@@ -178,3 +185,34 @@ void ShortcutWindow::widgetHidden(const gcn::Event &event)
}
}
}
+
+void ShortcutWindow::mousePressed(gcn::MouseEvent &event)
+{
+ Window::mousePressed(event);
+
+ if (event.isConsumed())
+ return;
+
+ if (event.getButton() == gcn::MouseEvent::LEFT)
+ {
+ mDragOffsetX = event.getX();
+ mDragOffsetY = event.getY();
+ }
+}
+
+void ShortcutWindow::mouseDragged(gcn::MouseEvent &event)
+{
+ Window::mouseDragged(event);
+
+ if (event.isConsumed())
+ return;
+
+ if (canMove() && isMovable() && mMoved)
+ {
+ int newX = std::max(0, getX() + event.getX() - mDragOffsetX);
+ int newY = std::max(0, getY() + event.getY() - mDragOffsetY);
+ newX = std::min(mainGraphics->mWidth - getWidth(), newX);
+ newY = std::min(mainGraphics->mHeight - getHeight(), newY);
+ setPosition(newX, newY);
+ }
+}
diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h
index 8627a5dce..bdff5ab0d 100644
--- a/src/gui/shortcutwindow.h
+++ b/src/gui/shortcutwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -58,6 +58,10 @@ class ShortcutWindow : public Window
void widgetHidden(const gcn::Event &event);
+ void mousePressed(gcn::MouseEvent &event);
+
+ void mouseDragged(gcn::MouseEvent &event);
+
private:
ShortcutWindow();
ShortcutContainer *mItems;
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 072a9cb85..4ee674325 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -362,7 +362,7 @@ void SkillDialog::loadSkills(const std::string &file)
return;
XML::Document doc(file);
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
int setCount = 0;
std::string setName;
@@ -370,7 +370,7 @@ void SkillDialog::loadSkills(const std::string &file)
SkillListBox *listbox;
SkillTab *tab;
- if (!root || !xmlStrEqual(root->name, BAD_CAST "skills"))
+ if (!root || !xmlNameEqual(root, "skills"))
{
logger->log("Error loading skills file: %s", file.c_str());
@@ -413,7 +413,7 @@ void SkillDialog::loadSkills(const std::string &file)
for_each_xml_child_node(set, root)
{
- if (xmlStrEqual(set->name, BAD_CAST "set"))
+ if (xmlNameEqual(set, "set"))
{
setCount++;
setName = XML::getProperty(set, "name",
@@ -425,7 +425,7 @@ void SkillDialog::loadSkills(const std::string &file)
for_each_xml_child_node(node, set)
{
- if (xmlStrEqual(node->name, BAD_CAST "skill"))
+ if (xmlNameEqual(node, "skill"))
{
int id = atoi(XML::getProperty(node, "id", "-1").c_str());
std::string name = XML::getProperty(node, "name",
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 63f7d1790..dcb40927a 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 2bc8aba9b..a1a6c1cee 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -29,6 +29,8 @@
#include "logger.h"
#include "map.h"
#include "party.h"
+#include "playerrelations.h"
+#include "gui/whoisonline.h"
#include "gui/confirmdialog.h"
#include "gui/okdialog.h"
@@ -60,6 +62,30 @@
#include "debug.h"
+class SortFriendsFunctor
+{
+ public:
+ bool operator() (Avatar* m1, Avatar* m2)
+ {
+ if (!m1 || !m2)
+ return false;
+
+ if (m1->getOnline() != m2->getOnline())
+ return m1->getOnline() > m2->getOnline();
+
+ if (m1->getName() != m2->getName())
+ {
+ std::string s1 = m1->getName();
+ std::string s2 = m2->getName();
+ toLower(s1);
+ toLower(s2);
+ return s1 < s2;
+ }
+ return false;
+ }
+} friendSorter;
+
+
class SocialTab : public Tab
{
protected:
@@ -457,7 +483,6 @@ public:
mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
-// mBeings->getMembers().push_back(new Avatar("test"));
updateList();
setCaption(name);
}
@@ -550,7 +575,6 @@ public:
if (actorSpriteManager)
{
-// std::list<Being*> beings = actorSpriteManager->getAll();
std::vector<std::string> names;
actorSpriteManager->getPlayerNames(names, false);
@@ -650,7 +674,7 @@ public:
return;
Map* map = socialWindow->getMap();
- if (!map)
+ if (!map || map->empty())
return;
if (socialWindow->getProcessedPortals())
@@ -848,11 +872,11 @@ public:
std::vector<Avatar*> *avatars = mBeings->getMembers();
- std::vector<Avatar*>::iterator i = avatars->begin();
-
if (!avatars)
return;
+ std::vector<Avatar*>::iterator i = avatars->begin();
+
while (i != avatars->end())
{
Avatar *ava = (*i);
@@ -1058,6 +1082,103 @@ private:
};
+
+class SocialFriendsTab : public SocialTab
+{
+public:
+ SocialFriendsTab(std::string name)
+ {
+ mBeings = new BeingsListModal();
+
+ mList = new AvatarListBox(mBeings);
+ mScroll = new ScrollArea(mList);
+
+ mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_AUTO);
+ mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS);
+
+ updateList();
+ setCaption(name);
+ }
+
+ ~SocialFriendsTab()
+ {
+ delete mList;
+ mList = nullptr;
+ delete mScroll;
+ mScroll = nullptr;
+ delete mBeings;
+ mBeings = nullptr;
+ }
+
+ void updateList()
+ {
+ getPlayersAvatars();
+ }
+
+ void updateAvatar(std::string name A_UNUSED)
+ {
+ }
+
+ void resetDamage(std::string name A_UNUSED)
+ {
+ }
+
+ void getPlayersAvatars()
+ {
+ if (!actorSpriteManager)
+ return;
+
+ std::vector<Avatar*> *avatars = mBeings->getMembers();
+ if (!avatars)
+ return;
+
+ std::vector<Avatar*>::iterator ia = avatars->begin();
+ while (ia != avatars->end())
+ {
+ delete *ia;
+ ++ ia;
+ }
+ avatars->clear();
+
+ std::vector<std::string> *players
+ = player_relations.getPlayersByRelation(PlayerRelation::FRIEND);
+
+ std::set<std::string> players2 = whoIsOnline->getOnlinePlayers();
+
+ if (!players)
+ return;
+
+ std::vector<std::string>::iterator it = players->begin();
+ std::vector<std::string>::iterator it_end = players->end();
+ for (; it != it_end; ++ it)
+ {
+ Avatar *ava = nullptr;
+ ava = new Avatar(*it);
+ if (actorSpriteManager->findBeingByName(*it, Being::PLAYER)
+ || players2.find(*it) != players2.end())
+ {
+ ava->setOnline(true);
+ }
+ avatars->push_back(ava);
+ }
+ std::sort(avatars->begin(), avatars->end(), friendSorter);
+ delete players;
+ }
+
+protected:
+ void invite()
+ {
+ }
+
+ void leave()
+ {
+ }
+
+private:
+ BeingsListModal *mBeings;
+};
+
+
class CreatePopup : public Popup, public LinkHandler
{
public:
@@ -1152,9 +1273,14 @@ SocialWindow::SocialWindow() :
loadWindowState();
- mPlayers = new SocialPlayersTab("P");
+ // TRANSLATORS: here P is title for visible players tab in social window
+ mPlayers = new SocialPlayersTab(_("P"));
mTabs->addTab(mPlayers, mPlayers->mScroll);
+ // TRANSLATORS: here F is title for friends tab in social window
+ mFriends = new SocialFriendsTab(_("F"));
+ mTabs->addTab(mFriends, mFriends->mScroll);
+
mNavigation = new SocialNavigationTab();
mTabs->addTab(mNavigation, mNavigation->mScroll);
@@ -1205,6 +1331,8 @@ SocialWindow::~SocialWindow()
mNavigation = nullptr;
delete mAttackFilter;
mAttackFilter = nullptr;
+ delete mFriends;
+ mFriends = nullptr;
}
bool SocialWindow::addTab(Guild *guild)
@@ -1523,6 +1651,7 @@ void SocialWindow::logic()
if (mNeedUpdate && nowTime - mLastUpdateTime > 1)
{
mPlayers->updateList();
+ mFriends->updateList();
mNeedUpdate = false;
mLastUpdateTime = nowTime;
}
@@ -1610,7 +1739,7 @@ void SocialWindow::nextTab()
if (tab == mTabs->getNumberOfTabs())
tab = 0;
- mTabs->setSelectedTab(tab);
+ mTabs->setSelectedTabByPos(tab);
}
void SocialWindow::prevTab()
@@ -1624,7 +1753,7 @@ void SocialWindow::prevTab()
tab = mTabs->getNumberOfTabs();
tab--;
- mTabs->setSelectedTab(tab);
+ mTabs->setSelectedTabByPos(tab);
}
void SocialWindow::updateAttackFilter()
diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h
index dec8a6c26..1429866ee 100644
--- a/src/gui/socialwindow.h
+++ b/src/gui/socialwindow.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -141,6 +141,7 @@ protected:
SocialTab *mAttackFilter;
SocialTab *mPlayers;
SocialTab *mNavigation;
+ SocialTab *mFriends;
CreatePopup *mCreatePopup;
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index 6abff3796..4dd53cee1 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/specialswindow.h b/src/gui/specialswindow.h
index 4350a656b..a7eeeb5d5 100644
--- a/src/gui/specialswindow.h
+++ b/src/gui/specialswindow.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 7356cc633..877715137 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 170f619e8..5342bd49e 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 5ac14d132..a5fd12d40 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -431,10 +431,20 @@ void StatusWindow::addAttribute(int id, const std::string &name,
disp = new DerDisplay(id, name);
mDAttrCont->add(disp);
}
-
mAttrs[id] = disp;
}
+void StatusWindow::clearAttributes()
+{
+ mAttrCont->clear();
+ mDAttrCont->clear();
+ Attrs::iterator it = mAttrs.begin();
+ Attrs::iterator it_end = mAttrs.end();
+ for (; it != it_end; ++ it)
+ delete (*it).second;
+ mAttrs.clear();
+}
+
void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax)
{
if (!bar)
@@ -512,9 +522,14 @@ void StatusWindow::updateProgressBar(ProgressBar *bar, int value, int max,
/ static_cast<float>(max);
if (percent)
- bar->setText(strprintf("%2.5f", 100 * progress) + "%");
+ {
+ bar->setText(strprintf("%2.5f%%",
+ static_cast<double>(100 * progress)));
+ }
else
+ {
bar->setText(toString(value) + "/" + toString(max));
+ }
bar->setProgress(progress);
}
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index d3a619bcb..8e110a354 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -75,6 +75,8 @@ class StatusWindow : public Window,
void action(const gcn::ActionEvent &event);
+ void clearAttributes();
+
private:
static std::string translateLetter(const char* letters);
diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp
index a32b13aa4..b30c9eb82 100644
--- a/src/gui/textdialog.cpp
+++ b/src/gui/textdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h
index aed26c1e9..03deae8f6 100644
--- a/src/gui/textdialog.h
+++ b/src/gui/textdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -44,7 +44,7 @@ public:
* @see Window::Window
*/
TextDialog(const std::string &title, const std::string &msg,
- Window *parent = 0, bool isPassword = false);
+ Window *parent = nullptr, bool isPassword = false);
~TextDialog();
diff --git a/src/gui/textpopup.cpp b/src/gui/textpopup.cpp
index 15b2618da..8cdbfa430 100644
--- a/src/gui/textpopup.cpp
+++ b/src/gui/textpopup.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/textpopup.h b/src/gui/textpopup.h
index 9ac041389..6f418152c 100644
--- a/src/gui/textpopup.h
+++ b/src/gui/textpopup.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index b3b28bffa..85fd215ac 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -4,7 +4,7 @@
* Copyright (C) 2009 Aethyra Development Team
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -315,9 +315,9 @@ Skin *Theme::readSkin(const std::string &filename)
// filename = resman->mapPathToSkin(filename0);
XML::Document doc(resolveThemePath(filename));
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
+ if (!rootNode || !xmlNameEqual(rootNode, "skinset"))
return nullptr;
const std::string skinSetImage = XML::getProperty(rootNode, "image", "");
@@ -339,7 +339,7 @@ Skin *Theme::readSkin(const std::string &filename)
// iterate <widget>'s
for_each_xml_child_node(widgetNode, rootNode)
{
- if (!xmlStrEqual(widgetNode->name, BAD_CAST "widget"))
+ if (!xmlNameEqual(widgetNode, "widget"))
continue;
const std::string widgetType =
@@ -348,7 +348,7 @@ Skin *Theme::readSkin(const std::string &filename)
{
for_each_xml_child_node(partNode, widgetNode)
{
- if (xmlStrEqual(partNode->name, BAD_CAST "part"))
+ if (xmlNameEqual(partNode, "part"))
{
const std::string partType =
XML::getProperty(partNode, "type", "unknown");
@@ -477,7 +477,7 @@ Skin *Theme::readSkin(const std::string &filename)
"'%s'", partType.c_str());
}
}
- else if (xmlStrEqual(partNode->name, BAD_CAST "option"))
+ else if (xmlNameEqual(partNode, "option"))
{
const std::string name = XML::getProperty(
partNode, "name", "");
@@ -818,9 +818,9 @@ void Theme::loadColors(std::string file)
file += "/colors.xml";
XML::Document doc(resolveThemePath(file));
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log("Error loading colors file: %s", file.c_str());
return;
@@ -835,7 +835,7 @@ void Theme::loadColors(std::string file)
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "color"))
+ if (xmlNameEqual(node, "color"))
{
type = readColorType(XML::getProperty(node, "id", ""));
if (type < 0) // invalid or no type given
@@ -850,7 +850,7 @@ void Theme::loadColors(std::string file)
mColors[type].set(type, color, grad, 10);
}
- else if (xmlStrEqual(node->name, BAD_CAST "progressbar"))
+ else if (xmlNameEqual(node, "progressbar"))
{
type = readProgressType(XML::getProperty(node, "id", ""));
if (type < 0) // invalid or no type given
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 92b2c8878..3be6882a3 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -4,7 +4,7 @@
* Copyright (C) 2009 Aethyra Development Team
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 506bf65c9..43393fc09 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h
index 16b3d9d6f..b055c90ce 100644
--- a/src/gui/tradewindow.h
+++ b/src/gui/tradewindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index c43f28400..ca21263f1 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/unregisterdialog.h b/src/gui/unregisterdialog.h
index e68741e22..a89b3231b 100644
--- a/src/gui/unregisterdialog.h
+++ b/src/gui/unregisterdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index ac51cc76f..28bd8467c 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -67,9 +67,9 @@ std::vector<updateFile> loadXMLFile(const std::string &fileName)
{
std::vector<updateFile> files;
XML::Document doc(fileName, false);
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "updates"))
+ if (!rootNode || !xmlNameEqual(rootNode, "updates"))
{
logger->log("Error loading update file: %s", fileName.c_str());
return files;
@@ -78,7 +78,7 @@ std::vector<updateFile> loadXMLFile(const std::string &fileName)
for_each_xml_child_node(fileNode, rootNode)
{
// Ignore all tags except for the "update" tags
- if (!xmlStrEqual(fileNode->name, BAD_CAST "update"))
+ if (!xmlNameEqual(fileNode, "update"))
continue;
updateFile file;
@@ -91,7 +91,8 @@ std::vector<updateFile> loadXMLFile(const std::string &fileName)
else
file.required = false;
- files.push_back(file);
+ if (checkPath(file.name))
+ files.push_back(file);
}
return files;
@@ -118,7 +119,7 @@ std::vector<updateFile> loadTxtFile(const std::string &fileName)
thisFile.required = true;
thisFile.desc = "";
- if (!thisFile.name.empty())
+ if (!thisFile.name.empty() && checkPath(thisFile.name))
files.push_back(thisFile);
}
}
@@ -154,6 +155,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
mLoadUpdates(applyUpdates),
mUpdateType(updateType)
{
+ setWindowName("UpdaterWindow");
+ setResizable(true);
+ setDefaultSize(450, 400, ImageRect::CENTER);
+ setMinWidth(320);
+ setMinHeight(240);
+
mBrowserBox = new BrowserBox;
mScrollArea = new ScrollArea(mBrowserBox);
mLabel = new Label(_("Connecting..."));
@@ -174,14 +181,12 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
placer(3, 5, mCancelButton);
placer(4, 5, mPlayButton);
- reflowLayout(450, 400);
-
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
addKeyListener(this);
- center();
+ loadWindowState();
setVisible(true);
mCancelButton->requestFocus();
diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h
index e9a45241f..f8ee4e29c 100644
--- a/src/gui/updaterwindow.h
+++ b/src/gui/updaterwindow.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 62fd03c70..a3299fb7b 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index 3bf9c782a..cb0593fa7 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net>
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index b6c55f2c4..f4c6c315f 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -481,6 +481,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
if (mHoverBeing->canTalk())
{
mHoverBeing->talkTo();
+ return;
}
else
{
@@ -490,6 +491,9 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
{
if (player_node != mHoverBeing || mSelfMouseHeal)
actorSpriteManager->heal(mHoverBeing);
+ if (player_node == mHoverBeing && mHoverItem)
+ player_node->pickUp(mHoverItem);
+ return;
}
}
else if (player_node->withinAttackRange(mHoverBeing) ||
@@ -499,17 +503,21 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
{
player_node->attack(mHoverBeing,
!keyboard.isKeyActive(keyboard.KEY_TARGET));
+ return;
}
}
else if (!keyboard.isKeyActive(keyboard.KEY_ATTACK))
{
if (player_node != mHoverBeing)
+ {
player_node->setGotoTarget(mHoverBeing);
+ return;
+ }
}
}
- // Picks up a item if we clicked on one
}
- else if (mHoverItem)
+ // Picks up a item if we clicked on one
+ if (mHoverItem)
{
player_node->pickUp(mHoverItem);
}
@@ -739,7 +747,7 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED)
}
mHoverItem = nullptr;
- if (!mHoverBeing && actorSpriteManager)
+ if (actorSpriteManager)
{
mHoverItem = actorSpriteManager->findItem(x / mMap->getTileWidth(),
y / mMap->getTileHeight());
@@ -867,3 +875,44 @@ bool Viewport::isPopupMenuVisible()
{
return mPopupMenu ? mPopupMenu->isVisible() : false;
}
+
+void Viewport::moveCameraToActor(int actorId, int x, int y)
+{
+ if (!player_node)
+ return;
+
+ Actor *actor = actorSpriteManager->findBeing(actorId);
+ if (!actor)
+ return;
+ Vector actorPos = actor->getPosition();
+ Vector playerPos = player_node->getPosition();
+ mCameraMode = 1;
+ mCameraRelativeX = actorPos.x - playerPos.x + x;
+ mCameraRelativeY = actorPos.y - playerPos.y + y;
+}
+
+void Viewport::moveCameraToPosition(int x, int y)
+{
+ if (!player_node)
+ return;
+
+ Vector playerPos = player_node->getPosition();
+ mCameraMode = 1;
+
+ mCameraRelativeX = x - playerPos.x;
+ mCameraRelativeY = y - playerPos.y;
+}
+
+void Viewport::moveCameraRelative(int x, int y)
+{
+ mCameraMode = 1;
+ mCameraRelativeX += x;
+ mCameraRelativeY += y;
+}
+
+void Viewport::returnCamera()
+{
+ mCameraMode = 0;
+ mCameraRelativeX = 0;
+ mCameraRelativeY = 0;
+}
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 938988198..4ed80ed32 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -248,8 +248,22 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
int getCameraRelativeY()
{ return mCameraRelativeY; }
+ void setCameraRelativeX(int n)
+ { mCameraRelativeX = n; }
+
+ void setCameraRelativeY(int n)
+ { mCameraRelativeY = n; }
+
bool isPopupMenuVisible();
+ void moveCameraToActor(int actorId, int x = 0, int y = 0);
+
+ void moveCameraToPosition(int x, int y);
+
+ void moveCameraRelative(int x, int y);
+
+ void returnCamera();
+
protected:
friend class ActorSpriteManager;
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 6004f706e..a80fb4c89 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -21,14 +21,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "whoisonline.h"
+#include "gui/whoisonline.h"
#include <SDL.h>
#include <SDL_thread.h>
#include <vector>
#include <algorithm>
+#include "gui/socialwindow.h"
#include "gui/viewport.h"
+
#include "gui/widgets/button.h"
#include "gui/widgets/browserbox.h"
#include "gui/widgets/scrollarea.h"
@@ -288,6 +290,13 @@ void WhoIsOnline::loadList(std::vector<std::string> &list)
}
updateWindow(friends, neutral, disregard, enemy, numOnline);
+ if (!mOnlinePlayers.empty())
+ {
+ if (chatWindow)
+ chatWindow->updateOnline(mOnlinePlayers);
+ if (socialWindow)
+ socialWindow->updateActiveList();
+ }
}
void WhoIsOnline::loadWebList()
@@ -587,8 +596,13 @@ void WhoIsOnline::logic()
mUpdateButton->setEnabled(true);
mUpdateTimer = 0;
updateSize();
- if (!mOnlinePlayers.empty() && chatWindow)
- chatWindow->updateOnline(mOnlinePlayers);
+ if (!mOnlinePlayers.empty())
+ {
+ if (chatWindow)
+ chatWindow->updateOnline(mOnlinePlayers);
+ if (socialWindow)
+ socialWindow->updateActiveList();
+ }
}
break;
case UPDATE_COMPLETE:
diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h
index 112ad35ba..ade391d5a 100644
--- a/src/gui/whoisonline.h
+++ b/src/gui/whoisonline.h
@@ -26,6 +26,7 @@
#include <string>
#include <set>
+#include <vector>
#include "configlistener.h"
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 8264f0fb9..1bf897301 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h
index afb4abdf5..526db6ef5 100644
--- a/src/gui/widgets/avatarlistbox.h
+++ b/src/gui/widgets/avatarlistbox.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp
index c5500e801..5ac13c78e 100644
--- a/src/gui/widgets/battletab.cpp
+++ b/src/gui/widgets/battletab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h
index 03c63da2c..8d85e739e 100644
--- a/src/gui/widgets/battletab.h
+++ b/src/gui/widgets/battletab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 7d30c10bf..5856a91b1 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The ManaPlus Client.
@@ -451,6 +451,7 @@ int BrowserBox::calcHeight()
}
gcn::Color prevColor = selColor;
+ bold = false;
// TODO: Check if we must take texture size limits into account here
// TODO: Check if some of the O(n) calls can be removed
@@ -466,8 +467,6 @@ int BrowserBox::calcHeight()
wrapped = false;
}
- bold = false;
-
// "Tokenize" the string at control sequences
if (mUseLinksAndUserColors)
end = row.find("##", start + 1);
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index e26ae32e0..ab3049c0b 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The ManaPlus Client.
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 85e4eca17..2867e3d39 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index 1b62179b3..aed46bb55 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/channeltab.cpp b/src/gui/widgets/channeltab.cpp
index 87d87f7d1..f362cc28c 100644
--- a/src/gui/widgets/channeltab.cpp
+++ b/src/gui/widgets/channeltab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h
index 5d3b78094..4b56d2e05 100644
--- a/src/gui/widgets/channeltab.h
+++ b/src/gui/widgets/channeltab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index c2db20574..aea367482 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 962c0b363..ddf10bf5e 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index dcedc8951..0689c5395 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index af38065f5..0c8e48553 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index 558257507..80028a62f 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index c011b8925..d927f5379 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index beb232fb2..b40558c78 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -48,10 +48,14 @@ Desktop::Desktop() :
std::string appName = branding.getValue("appName", std::string(""));
if (appName.empty())
+ {
mVersionLabel = new Label(FULL_VERSION);
+ }
else
- mVersionLabel = new Label(strprintf("%s (Mana %s)", appName.c_str(),
- FULL_VERSION));
+ {
+ mVersionLabel = new Label(strprintf("%s (%s)", FULL_VERSION,
+ appName.c_str()));
+ }
mVersionLabel->setBackgroundColor(
Theme::getThemeColor(Theme::BACKGROUND, 128));
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 2a17320de..91c983f26 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 3559b634a..a769678ca 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -48,7 +48,7 @@ class DropDown : public gcn::DropDown
* @param listBox the listBox to use.
* @see ListModel, ScrollArea, ListBox.
*/
- DropDown(gcn::ListModel *listModel = 0,
+ DropDown(gcn::ListModel *listModel = nullptr,
gcn::ActionListener* listener = nullptr,
std::string eventId = "");
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index 7d3ddc0b4..acda5ad88 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h
index d1f276b3c..677dd3661 100644
--- a/src/gui/widgets/flowcontainer.h
+++ b/src/gui/widgets/flowcontainer.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp
index 0353ac23f..a95fca3cf 100644
--- a/src/gui/widgets/guildchattab.cpp
+++ b/src/gui/widgets/guildchattab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h
index 4f5ee3a8e..bebdaa1f3 100644
--- a/src/gui/widgets/guildchattab.h
+++ b/src/gui/widgets/guildchattab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 78ce14e56..d620cbb8d 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index 17f517644..d5810fcbf 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp
index dbb02498a..c128ea550 100644
--- a/src/gui/widgets/horizontcontainer.cpp
+++ b/src/gui/widgets/horizontcontainer.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h
index 2a3f77d2b..7439672dc 100644
--- a/src/gui/widgets/horizontcontainer.h
+++ b/src/gui/widgets/horizontcontainer.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index b8cc2ac3a..b35eb1d95 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h
index 4b0d12342..6f05da3f7 100644
--- a/src/gui/widgets/icon.h
+++ b/src/gui/widgets/icon.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp
index 89544e108..8a075000b 100644
--- a/src/gui/widgets/inttextfield.cpp
+++ b/src/gui/widgets/inttextfield.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/inttextfield.h b/src/gui/widgets/inttextfield.h
index b36b088a6..7284c9d03 100644
--- a/src/gui/widgets/inttextfield.h
+++ b/src/gui/widgets/inttextfield.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/inventoryfilter.cpp b/src/gui/widgets/inventoryfilter.cpp
index 795f0d31e..216c2bea0 100644
--- a/src/gui/widgets/inventoryfilter.cpp
+++ b/src/gui/widgets/inventoryfilter.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/inventoryfilter.h b/src/gui/widgets/inventoryfilter.h
index c3762189e..c4f2b6242 100644
--- a/src/gui/widgets/inventoryfilter.h
+++ b/src/gui/widgets/inventoryfilter.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 57c64093b..669d05a66 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index 2c465fdee..ae6e4a35d 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 549aa1616..61d929f0b 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h
index bc3bdc51c..9f66da991 100644
--- a/src/gui/widgets/itemlinkhandler.h
+++ b/src/gui/widgets/itemlinkhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 3682ec448..130d641fe 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index 587723279..59e52b5ae 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index f0359062e..453e62a50 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 754d13a0b..02fed43b5 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp
index 54c41635f..2b79609b9 100644
--- a/src/gui/widgets/layouthelper.cpp
+++ b/src/gui/widgets/layouthelper.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h
index a01051595..b0f4d435d 100644
--- a/src/gui/widgets/layouthelper.h
+++ b/src/gui/widgets/layouthelper.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/linkhandler.h b/src/gui/widgets/linkhandler.h
index f8f195f2d..366899ffc 100644
--- a/src/gui/widgets/linkhandler.h
+++ b/src/gui/widgets/linkhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 53299ca46..28fe9daa1 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index 8ac0bbc3b..e4b6dd54e 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/mouseevent.h b/src/gui/widgets/mouseevent.h
index 9484be0a5..e41ed46b8 100644
--- a/src/gui/widgets/mouseevent.h
+++ b/src/gui/widgets/mouseevent.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp
index 34639b063..6f339ddd7 100644
--- a/src/gui/widgets/passwordfield.cpp
+++ b/src/gui/widgets/passwordfield.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h
index 5ba08094d..eca95e6ad 100644
--- a/src/gui/widgets/passwordfield.h
+++ b/src/gui/widgets/passwordfield.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index fb72176bd..5e2412d3b 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 2bf010618..d2393ca08 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,6 +25,8 @@
#include <guichan/widgets/scrollarea.hpp>
+#include "localconsts.h"
+
class Being;
class ImageRect;
@@ -40,7 +42,7 @@ class PlayerBox : public gcn::ScrollArea
* Constructor. Takes the initial player character that this box should
* display, which defaults to <code>NULL</code>.
*/
- PlayerBox(const Being *being = 0);
+ PlayerBox(const Being *being = nullptr);
/**
* Destructor.
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 78557d481..e206a3246 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The ManaPlus Client.
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 64e4b52ac..8ff21149a 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
* Copyright (C) 2009 Aethyra Development Team
*
* This file is part of The ManaPlus Client.
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index f9b6da153..8b2beb8d5 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index 36ed96bd2..163310245 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index e885aa0ec..6adb5a2fa 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -51,7 +51,7 @@ ProgressIndicator::ProgressIndicator()
}
else
{
- mIndicator = 0;
+ mIndicator = nullptr;
}
setSize(32, 32);
@@ -60,7 +60,7 @@ ProgressIndicator::ProgressIndicator()
ProgressIndicator::~ProgressIndicator()
{
delete mIndicator;
- mIndicator = 0;
+ mIndicator = nullptr;
}
void ProgressIndicator::logic()
diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h
index e5fcaefda..6d55fd3ce 100644
--- a/src/gui/widgets/progressindicator.h
+++ b/src/gui/widgets/progressindicator.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 7d344b09d..94152a716 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index d1c347acb..7692d478a 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index c8822eea9..4a6adadb6 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h
index 873d74058..ce4eb0770 100644
--- a/src/gui/widgets/resizegrip.h
+++ b/src/gui/widgets/resizegrip.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 0ec4a2027..021bd3d15 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 105791080..86902b5c9 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 8081f5d7b..92ff625c2 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 5b8a9df87..eb2680ede 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp
index e98e9c3ac..b3863c134 100644
--- a/src/gui/widgets/setuptab.cpp
+++ b/src/gui/widgets/setuptab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h
index ddc0c8958..e47af8995 100644
--- a/src/gui/widgets/setuptab.h
+++ b/src/gui/widgets/setuptab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index 4fb092070..ab8f61a40 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h
index 2b0c6f65e..4ad1f464b 100644
--- a/src/gui/widgets/setuptabscroll.h
+++ b/src/gui/widgets/setuptabscroll.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index d3aac5c56..5f13e5f71 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h
index 29d24cb64..c013f1810 100644
--- a/src/gui/widgets/shopitems.h
+++ b/src/gui/widgets/shopitems.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index b649a81ef..71e373d70 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index c5acbbefc..9b416d3a3 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index 36f88da08..6c8397bbb 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index 8587950c6..72f8b9cac 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 3822d40c9..ed667e194 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index 9ac45d0a0..8eed984b1 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 8e4b1fe6f..c09fb423d 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index ba51e6c74..40b46ede5 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index fb9279343..fc6526a13 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -197,7 +197,7 @@ void TabbedArea::removeTab(gcn::Tab *tab)
}
else
{
- setSelectedTab(tabIndexToBeSelected);
+ setSelectedTabByPos(tabIndexToBeSelected);
}
adjustSize();
@@ -241,7 +241,7 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab)
widgetResized(nullptr);
}
-void TabbedArea::setSelectedTab(const std::string &name)
+void TabbedArea::setSelectedTabByName(const std::string &name)
{
for (TabContainer::const_iterator itr = mTabs.begin(),
itr_end = mTabs.end(); itr != itr_end; ++itr)
@@ -254,6 +254,11 @@ void TabbedArea::setSelectedTab(const std::string &name)
}
}
+void TabbedArea::setSelectedTabByPos(int tab)
+{
+ gcn::TabbedArea::setSelectedTab(tab);
+}
+
void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
{
int width = getWidth() - 2 * getFrameSize()
@@ -459,8 +464,7 @@ void TabbedArea::removeAll()
{
if (getSelectedTabIndex() != -1)
{
- setSelectedTab(static_cast<unsigned int>(0));
-
+ setSelectedTabByPos(static_cast<unsigned int>(0));
}
while (getNumberOfTabs() > 0)
{
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index d71109dd3..b202dfc9d 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -78,8 +78,6 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
*/
gcn::Widget *getCurrentWidget();
- using gcn::TabbedArea::addTab;
-
/**
* Add a tab. Overridden since it needs to size the widget.
*
@@ -112,11 +110,11 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
int getContainerHeight() const
{ return mWidgetContainer->getHeight(); }
- using gcn::TabbedArea::setSelectedTab;
-
void setSelectedTab(gcn::Tab *tab);
- void setSelectedTab(const std::string &name);
+ void setSelectedTabByPos(int tab);
+
+ void setSelectedTabByName(const std::string &name);
void widgetResized(const gcn::Event &event);
diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp
index f54b4281a..5216fb89c 100644
--- a/src/gui/widgets/tablemodel.cpp
+++ b/src/gui/widgets/tablemodel.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index 810b2f4ac..40a350163 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index f31c8d129..a4bc3bc09 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index 27525fc85..6d2467b38 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index b4584947a..03fdb5378 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index e530cfef2..bc1123f19 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 9be2d5b3f..f3ea962bc 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index a3f623177..81e27fd06 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp
index deec2aea6..5c893de1f 100644
--- a/src/gui/widgets/tradetab.cpp
+++ b/src/gui/widgets/tradetab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h
index f061778f3..06add3ee0 100644
--- a/src/gui/widgets/tradetab.h
+++ b/src/gui/widgets/tradetab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index 5e79b7c19..42ae97802 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -69,6 +69,8 @@ void VertContainer::clear()
Container::clear();
mCount = 0;
+ mNextY = 0;
+ mResizableWidgets.clear();
}
void VertContainer::widgetResized(const gcn::Event &event A_UNUSED)
diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h
index 08546aa47..6e1305a06 100644
--- a/src/gui/widgets/vertcontainer.h
+++ b/src/gui/widgets/vertcontainer.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 33859d8be..625c8a392 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 8678c932c..72d407ac2 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 273695a1a..3858b0d81 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 6249626d3..65dbf196b 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 34a6b68c7..43aaea8a4 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
index b27ba927f..00ef04c19 100644
--- a/src/gui/widgets/windowcontainer.h
+++ b/src/gui/widgets/windowcontainer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 3f41be466..138090075 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -299,7 +299,7 @@ void WindowMenu::mouseMoved(gcn::MouseEvent &event)
if (key != KeyboardConfig::KEY_NO_VALUE)
{
mTextPopup->show(x + getX(), y + getY(), btn->getDescription(),
- "Key: " + keyboard.getKeyValueString(key));
+ strprintf(_("Key: %s"), keyboard.getKeyValueString(key).c_str()));
}
else
{
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index 3f02ea851..8abc5e87a 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index ae5345031..917605281 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/gui/worldselectdialog.h b/src/gui/worldselectdialog.h
index 61bcc4b51..1a469757f 100644
--- a/src/gui/worldselectdialog.h
+++ b/src/gui/worldselectdialog.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
index be5708863..b3808d8ba 100644
--- a/src/guichanfwd.h
+++ b/src/guichanfwd.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/guild.cpp b/src/guild.cpp
index 0e629e2be..e569bed65 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/guild.h b/src/guild.h
index 915dda5e7..e95677ec6 100644
--- a/src/guild.h
+++ b/src/guild.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 16edb369a..9dc9d7b73 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/guildmanager.h b/src/guildmanager.h
index 5cd5e19cc..368b2456c 100644
--- a/src/guildmanager.h
+++ b/src/guildmanager.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp
index 8634702ce..5e0b93d7a 100644
--- a/src/imageparticle.cpp
+++ b/src/imageparticle.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/imageparticle.h b/src/imageparticle.h
index 73005a526..16b4b8cb7 100644
--- a/src/imageparticle.h
+++ b/src/imageparticle.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/imagesprite.cpp b/src/imagesprite.cpp
index 6ccaeb5fc..f969717f2 100644
--- a/src/imagesprite.cpp
+++ b/src/imagesprite.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/imagesprite.h b/src/imagesprite.h
index 9dad0f743..7537faef3 100644
--- a/src/imagesprite.h
+++ b/src/imagesprite.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 4521613ba..47a32bce1 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/inventory.h b/src/inventory.h
index f94568739..d210c65e2 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/item.cpp b/src/item.cpp
index d4b41b6cb..cc7d666b5 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/item.h b/src/item.h
index 29700f27a..ad051846d 100644
--- a/src/item.h
+++ b/src/item.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 625e8d90a..f267dd755 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index b735e899c..55c6d1165 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 29e16dff4..035232e41 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/joystick.h b/src/joystick.h
index be23599c9..87d1e81a9 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/listener.cpp b/src/listener.cpp
index cf7c209d6..ea125013f 100644
--- a/src/listener.cpp
+++ b/src/listener.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/listener.h b/src/listener.h
index cccc026c6..dc968672a 100644
--- a/src/listener.h
+++ b/src/listener.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/localconsts.h b/src/localconsts.h
index e135a4108..2d0eb5dea 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -21,6 +21,9 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#undef nullptr
#define nullptr 0
+#else
+#undef Z_NULL
+#define Z_NULL nullptr
#endif
#ifdef __GNUC__
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index c83082a44..3df4a3214 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -98,7 +98,7 @@ extern MiniStatusWindow *miniStatusWindow;
extern SkillDialog *skillDialog;
LocalPlayer::LocalPlayer(int id, int subtype):
- Being(id, PLAYER, subtype, 0),
+ Being(id, PLAYER, subtype, nullptr),
mTargetTime(-1),
mLastTarget(-1),
mTarget(nullptr),
@@ -112,7 +112,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mPathSetByMouse(false),
mLocalWalkTime(-1),
mMessageTime(0),
- mAwayDialog(0),
+ mAwayDialog(nullptr),
mAfkTime(0),
mAwayMode(false),
mPseudoAwayMode(false),
@@ -151,12 +151,12 @@ LocalPlayer::LocalPlayer(int id, int subtype):
if (userPalette)
mNameColor = &userPalette->getColor(UserPalette::SELF);
else
- mNameColor = 0;
+ mNameColor = nullptr;
mLastTargetX = 0;
mLastTargetY = 0;
- mInvertDirection = config.getIntValue("invertMoveDirection");
+ mInvertDirection = 0;
mCrazyMoveType = config.getIntValue("crazyMoveType");
mCrazyMoveState = 0;
mAttackWeaponType = config.getIntValue("attackWeaponType");
@@ -381,7 +381,8 @@ void LocalPlayer::setAction(Action action, int attackType)
mLastTarget = -1;
if (!mLastHitFrom.empty())
{
- debugMsg(_("You were killed by ") + mLastHitFrom);
+ debugMsg(strprintf(_("You were killed by %s"),
+ mLastHitFrom.c_str()));
mLastHitFrom = "";
}
setTarget(nullptr);
@@ -1437,13 +1438,17 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
case PICKUP_BAD_ITEM:
msg = N_("Tried to pick up nonexistent item.");
break;
- case PICKUP_TOO_HEAVY: msg = N_("Item is too heavy.");
+ case PICKUP_TOO_HEAVY:
+ msg = N_("Item is too heavy.");
break;
- case PICKUP_TOO_FAR: msg = N_("Item is too far away.");
+ case PICKUP_TOO_FAR:
+ msg = N_("Item is too far away.");
break;
- case PICKUP_INV_FULL: msg = N_("Inventory is full.");
+ case PICKUP_INV_FULL:
+ msg = N_("Inventory is full.");
break;
- case PICKUP_STACK_FULL: msg = N_("Stack is too big.");
+ case PICKUP_STACK_FULL:
+ msg = N_("Stack is too big.");
break;
case PICKUP_DROP_STEAL:
msg = N_("Item belongs to someone else.");
@@ -1777,7 +1782,7 @@ void LocalPlayer::moveToTarget(unsigned int dist)
case 6:
case 7:
dist = mAttackRange;
- if (dist == 1)
+ if (dist == 1 && serverVersion < 1)
dist = 2;
default:
break;
@@ -1866,12 +1871,14 @@ void LocalPlayer::moveToHome()
static const unsigned invertDirectionSize = 5;
void LocalPlayer::changeMode(unsigned *var, unsigned limit, const char *conf,
- std::string (LocalPlayer::*func)(), unsigned def)
+ std::string (LocalPlayer::*func)(), unsigned def,
+ bool save)
{
(*var) ++;
if (*var >= limit)
*var = def;
- config.setValue(conf, *var);
+ if (save)
+ config.setValue(conf, *var);
if (miniStatusWindow)
miniStatusWindow->updateStatus();
const std::string str = (this->*func)();
@@ -1883,7 +1890,7 @@ void LocalPlayer::invertDirection()
{
mMoveState = 0;
changeMode(&mInvertDirection, invertDirectionSize, "invertMoveDirection",
- &LocalPlayer::getInvertDirectionString);
+ &LocalPlayer::getInvertDirectionString, 0, false);
}
static const char *invertDirectionStrings[] =
@@ -3709,7 +3716,8 @@ void LocalPlayer::attack2(Being *target, bool keep, bool dontChangeEquipment)
changeEquipmentBeforeAttack(target);
if ((!target || getAttackType() == 0 || getAttackType() == 3)
- || (withinAttackRange(target, true, 1)
+ || (withinAttackRange(target, serverVersion < 1,
+ serverVersion < 1 ? 1 : 0)
&& getPathLength(target) <= getAttackRange2()))
{
attack(target, keep);
@@ -4122,7 +4130,7 @@ void LocalPlayer::checkNewName(Being *being)
void LocalPlayer::resetYellowBar()
{
- mInvertDirection = config.resetIntValue("invertMoveDirection");
+ mInvertDirection = 0;
mCrazyMoveType = config.resetIntValue("crazyMoveType");
mMoveToTargetType = config.resetIntValue("moveToTargetType");
mFollowMode = config.resetIntValue("followMode");
diff --git a/src/localplayer.h b/src/localplayer.h
index 5b755e4f6..ed181e3d0 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -523,7 +523,8 @@ class LocalPlayer : public Being, public ActorSpriteListener,
const char *getVarItem(const char **arr, unsigned index, unsigned sz);
void changeMode(unsigned *var, unsigned limit, const char *conf,
- std::string (LocalPlayer::*func)(), unsigned def = 0);
+ std::string (LocalPlayer::*func)(), unsigned def = 0,
+ bool save = true);
void crazyMove1();
void crazyMove2();
diff --git a/src/logger.cpp b/src/logger.cpp
index c2eb1cc46..a2df9a911 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/logger.h b/src/logger.h
index 4ce89f759..db618b275 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/main.cpp b/src/main.cpp
index b49b38300..5025d6d29 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -27,18 +27,21 @@
#include "client.h"
#include "logger.h"
-#include <libxml/parser.h>
-
#include <getopt.h>
#include <iostream>
#include <physfs.h>
+#include "utils/stringutils.h"
+#include "utils/xml.h"
+
#ifdef __MINGW32__
#include <windows.h>
#endif
#include "debug.h"
+char *selfName = nullptr;
+
static void printHelp()
{
using std::endl;
@@ -71,6 +74,8 @@ static void printHelp()
" directory") << endl
<< _(" --screenshot-dir : Directory to store screenshots") << endl
<< _(" --safemode : Start game in safe mode") << endl
+ << _(" -T --tests : Start testing drivers and "
+ "auto configuring") << endl
#ifdef USE_OPENGL
<< _(" --no-opengl : Disable OpenGL for this session") << endl
#endif
@@ -84,30 +89,32 @@ static void printVersion()
static void parseOptions(int argc, char *argv[], Client::Options &options)
{
- const char *optstring = "hvud:U:P:Dc:p:l:L:C:";
+ const char *optstring = "hvud:U:P:Dc:p:l:L:C:s:t:T";
const struct option long_options[] =
{
- { "config-dir", required_argument, 0, 'C' },
- { "data", required_argument, 0, 'd' },
- { "default", no_argument, 0, 'D' },
- { "password", required_argument, 0, 'P' },
- { "character", required_argument, 0, 'c' },
- { "help", no_argument, 0, 'h' },
- { "localdata-dir", required_argument, 0, 'L' },
- { "update-host", required_argument, 0, 'H' },
- { "port", required_argument, 0, 'p' },
- { "server", required_argument, 0, 's' },
- { "skip-update", no_argument, 0, 'u' },
- { "username", required_argument, 0, 'U' },
- { "no-opengl", no_argument, 0, 'O' },
- { "chat-log-dir", required_argument, 0, 'l' },
- { "version", no_argument, 0, 'v' },
- { "log-file", required_argument, 0, 'l' },
- { "chat-log-dir", required_argument, 0, 'L' },
- { "screenshot-dir", required_argument, 0, 'i' },
- { "safemode", no_argument, 0, 'm' },
- { nullptr, 0, 0, 0 }
+ { "config-dir", required_argument, nullptr, 'C' },
+ { "data", required_argument, nullptr, 'd' },
+ { "default", no_argument, nullptr, 'D' },
+ { "password", required_argument, nullptr, 'P' },
+ { "character", required_argument, nullptr, 'c' },
+ { "help", no_argument, nullptr, 'h' },
+ { "localdata-dir", required_argument, nullptr, 'L' },
+ { "update-host", required_argument, nullptr, 'H' },
+ { "port", required_argument, nullptr, 'p' },
+ { "server", required_argument, nullptr, 's' },
+ { "skip-update", no_argument, nullptr, 'u' },
+ { "username", required_argument, nullptr, 'U' },
+ { "no-opengl", no_argument, nullptr, 'O' },
+ { "chat-log-dir", required_argument, nullptr, 'l' },
+ { "version", no_argument, nullptr, 'v' },
+ { "log-file", required_argument, nullptr, 'l' },
+ { "chat-log-dir", required_argument, nullptr, 'L' },
+ { "screenshot-dir", required_argument, nullptr, 'i' },
+ { "safemode", no_argument, nullptr, 'm' },
+ { "tests", no_argument, nullptr, 'T' },
+ { "test", required_argument, nullptr, 't' },
+ { nullptr, 0, nullptr, 0 }
};
while (optind < argc)
@@ -134,7 +141,10 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
options.printHelp = true;
break;
case 'H':
- options.updateHost = optarg;
+ if (checkPath(optarg))
+ options.updateHost = optarg;
+ else
+ options.updateHost = "";
break;
case 'c':
options.character = optarg;
@@ -174,6 +184,14 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
case 'm':
options.safeMode = true;
break;
+ case 'T':
+ options.testMode = true;
+ options.test = "";
+ break;
+ case 't':
+ options.testMode = true;
+ options.test = std::string(optarg);
+ break;
default:
break;
}
@@ -191,23 +209,6 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
extern "C" char const *_nl_locale_name_default(void);
#endif
-static void xmlNullLogger(void *ctx A_UNUSED, const char *msg A_UNUSED, ...)
-{
- // Does nothing, that's the whole point of it
-}
-
-// Initialize libxml2 and check for potential ABI mismatches between
-// compiled version and the shared library actually used.
-static void initXML()
-{
- xmlInitParser();
- LIBXML_TEST_VERSION;
-
- // Suppress libxml2 error messages
- xmlSetGenericErrorFunc(nullptr, xmlNullLogger);
-}
-
-
int main(int argc, char *argv[])
{
#if defined(__MINGW32__)
@@ -216,6 +217,8 @@ int main(int argc, char *argv[])
LoadLibrary("exchndl.dll");
#endif
+ selfName = argv[0];
+
// Parse command line options
Client::Options options;
parseOptions(argc, argv, options);
@@ -241,11 +244,20 @@ int main(int argc, char *argv[])
atexit((void(*)()) PHYSFS_deinit);
- initXML();
+ XML::initXML();
#ifdef WIN32
SetCurrentDirectory(PHYSFS_getBaseDir());
#endif
Client client(options);
- return client.exec();
+ if (!options.testMode)
+ {
+ client.gameInit();
+ return client.gameExec();
+ }
+ else
+ {
+ client.testsInit();
+ return client.testsExec();
+ }
}
diff --git a/src/main.h b/src/main.h
index 8d6b531fd..541296d22 100644
--- a/src/main.h
+++ b/src/main.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -45,8 +45,8 @@
* different interfaces, which have different implementations for each server.
*/
-#define SMALL_VERSION "1.1.12.11"
-#define CHECK_VERSION "01.01.12.11"
+#define SMALL_VERSION "1.2.1.22"
+#define CHECK_VERSION "01.02.01.22"
#ifdef HAVE_CONFIG_H
#include "../config.h"
diff --git a/src/map.cpp b/src/map.cpp
index e706f120b..2209cf997 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -1383,17 +1383,20 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
if (startX >= mWidth || startY >= mHeight)
return path;
- // Declare open list, a list with open tiles sorted on F cost
- std::priority_queue<Location> openList;
-
// Return when destination not walkable
if (!getWalk(destX, destY, walkmask))
return path;
// Reset starting tile's G cost to 0
MetaTile *startTile = &mMetaTiles[startX + startY * mWidth];
+ if (!startTile)
+ return path;
+
startTile->Gcost = 0;
+ // Declare open list, a list with open tiles sorted on F cost
+ std::priority_queue<Location> openList;
+
// Add the start point to the open list
openList.push(Location(startX, startY, startTile));
diff --git a/src/map.h b/src/map.h
index 79dd01c41..db8b092de 100644
--- a/src/map.h
+++ b/src/map.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -498,6 +498,9 @@ class Map : public Properties, public ConfigListener
void redrawMap();
+ bool empty()
+ { return mLayers.empty(); }
+
protected:
friend class Actor;
friend class Minimap;
diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h
index 6899f85f4..f6d8606ce 100644
--- a/src/net/adminhandler.h
+++ b/src/net/adminhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h
index c41e918e1..8a49a68cd 100644
--- a/src/net/buysellhandler.h
+++ b/src/net/buysellhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/charhandler.cpp b/src/net/charhandler.cpp
index f3a02fc3b..016b72cbf 100644
--- a/src/net/charhandler.cpp
+++ b/src/net/charhandler.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/charhandler.h b/src/net/charhandler.h
index 848354e96..492e27e55 100644
--- a/src/net/charhandler.h
+++ b/src/net/charhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -44,14 +44,14 @@ struct Character
{
Character() :
slot(0),
- dummy(0)
+ dummy(nullptr)
{
}
~Character()
{
delete dummy;
- dummy = 0;
+ dummy = nullptr;
}
int slot; /**< The index in the list of characters */
@@ -94,9 +94,9 @@ class CharHandler
protected:
CharHandler() :
- mSelectedCharacter(0),
- mCharSelectDialog(0),
- mCharCreateDialog(0)
+ mSelectedCharacter(nullptr),
+ mCharSelectDialog(nullptr),
+ mCharCreateDialog(nullptr)
{}
void updateCharSelectDialog();
diff --git a/src/net/chathandler.h b/src/net/chathandler.h
index fc6c10376..f8a9e4ccf 100644
--- a/src/net/chathandler.h
+++ b/src/net/chathandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 5141c022e..22af389f3 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -180,7 +180,6 @@ int Download::downloadProgress(void *clientp, double dltotal, double dlnow,
return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_CANCELLED,
static_cast<size_t>(dltotal),
static_cast<size_t>(dlnow));
- return -5;
}
return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_IDLE,
diff --git a/src/net/download.h b/src/net/download.h
index 8339dee30..b31350eff 100644
--- a/src/net/download.h
+++ b/src/net/download.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index bdd43b3f8..556629458 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h
index 5d1b7aa14..70c458514 100644
--- a/src/net/ea/adminhandler.h
+++ b/src/net/ea/adminhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 1c2983137..84bd03bb1 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h
index f47385a61..b4fd5f93f 100644
--- a/src/net/ea/beinghandler.h
+++ b/src/net/ea/beinghandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 28584d97f..73d4090b7 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/buysellhandler.h b/src/net/ea/buysellhandler.h
index 196626b0d..14d39ea02 100644
--- a/src/net/ea/buysellhandler.h
+++ b/src/net/ea/buysellhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 63e267584..2dc51acf3 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -163,6 +163,9 @@ void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
case 5:
errorMessage = _("Incorrect slot.");
break;
+ case 6:
+ errorMessage = _("Incorrect race.");
+ break;
}
new OkDialog(_("Error"), errorMessage);
if (mCharCreateDialog)
diff --git a/src/net/ea/charserverhandler.h b/src/net/ea/charserverhandler.h
index bacde67b6..bec8d2011 100644
--- a/src/net/ea/charserverhandler.h
+++ b/src/net/ea/charserverhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 35e8597f0..e31f68596 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h
index d39e6788a..baa9a01b5 100644
--- a/src/net/ea/chathandler.h
+++ b/src/net/ea/chathandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/eaprotocol.h b/src/net/ea/eaprotocol.h
index d34cba0ca..62b61a956 100644
--- a/src/net/ea/eaprotocol.h
+++ b/src/net/ea/eaprotocol.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index b74f2384d..b7566e271 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -52,9 +52,14 @@ void GameHandler::processEvent(Mana::Channels channel,
if (channel == Mana::CHANNEL_GAME)
{
if (event.getName() == Mana::EVENT_ENGINESINITALIZED)
- Game::instance()->changeMap(mMap);
+ {
+ if (mMap != "")
+ Game::instance()->changeMap(mMap);
+ }
else if (event.getName() == Mana::EVENT_MAPLOADED)
+ {
mapLoadedEvent();
+ }
}
}
@@ -73,7 +78,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg)
Uint16 x, y;
msg.readInt32(); // server tick
msg.readCoordinates(x, y, direction);
- msg.skip(2); // unknown
+ msg.skip(2); // 0x0505
logger->log("Protocol: Player start position: (%d, %d),"
" Direction: %d", x, y, direction);
// Switch now or we'll have problems
diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h
index 511efe357..248175617 100644
--- a/src/net/ea/gamehandler.h
+++ b/src/net/ea/gamehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index 9836f5fa9..87fc34d94 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 2aad4a564..81d971161 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 23eab361c..cf62af459 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index 3a544d8db..029d71ac7 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 907fa13db..96a361838 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -168,7 +168,7 @@ void GuildHandler::processGuildBasicInfo(Net::MessageIn &msg)
int avgLevel = msg.readInt32(); // Average level
int exp = msg.readInt32(); // Exp
int nextExp = msg.readInt32(); // Next exp
- msg.skip(16); // unused
+ msg.skip(16); // 0 unused
std::string name = msg.readString(24); // Name
std::string master = msg.readString(24); // Master's name
std::string castle = msg.readString(20); // Castles
@@ -242,7 +242,7 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg)
int exp = msg.readInt32(); // Exp
int online = msg.readInt32(); // Online
int pos = msg.readInt32(); // Position
- msg.skip(50); // unused
+ msg.skip(50); // 0 unused
std::string name = msg.readString(24); // Name
GuildMember *m = taGuild->addMember(id, charId, name);
@@ -371,11 +371,11 @@ void GuildHandler::processGuildSkillInfo(Net::MessageIn &msg)
{
msg.readInt16(); // ID
msg.readInt16(); // 'Info' (unknown atm)
- msg.readInt16(); // unused
+ msg.readInt16(); // 0 unused
msg.readInt16(); // Level
msg.readInt16(); // SP
msg.readInt16(); // 'Range'
- msg.skip(24); // unused
+ msg.skip(24); // 0 unused
msg.readInt8(); // Can be increased
}
}
@@ -479,9 +479,10 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
{
+ msg.skip(2); // size (can be many explusions in list)
std::string nick = msg.readString(24); // Name (of expulsed?)
- msg.readString(40); // Message
- msg.skip(24); // unused ("dummy")
+ msg.skip(24); // acc
+ msg.readString(44); // Message
if (taGuild)
taGuild->removeMember(nick);
@@ -495,7 +496,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- SERVER_NOTICE(_("You was kicked from guild."));
+ SERVER_NOTICE(_("You were kicked from guild."));
delete guildTab;
guildTab = nullptr;
diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h
index 5b090ec41..5b7442a40 100644
--- a/src/net/ea/guildhandler.h
+++ b/src/net/ea/guildhandler.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index d2a1fb4f0..4c4fb760c 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index 6db6b18ed..c2e076751 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index 38d6f7be9..e08fe2cd1 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h
index dabf61b5d..1d0747c61 100644
--- a/src/net/ea/itemhandler.h
+++ b/src/net/ea/itemhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 420236cfd..291a92906 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -150,6 +150,11 @@ void LoginHandler::processUpdateHost(Net::MessageIn &msg)
len = msg.readInt16() - 4;
mUpdateHost = msg.readString(len);
+ if (!checkPath(mUpdateHost))
+ {
+ mUpdateHost = "";
+ logger->log1("Warning: incorrect update server name");
+ }
loginData.updateHost = mUpdateHost;
logger->log("Received update host \"%s\" from login server.",
@@ -159,7 +164,7 @@ void LoginHandler::processUpdateHost(Net::MessageIn &msg)
void LoginHandler::processLoginData(Net::MessageIn &msg)
{
// Skip the length word
- msg.skip(2);
+ msg.skip(2); // size
clearWorlds();
@@ -170,7 +175,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
mToken.session_ID2 = msg.readInt32();
msg.skip(4); // old ip
loginData.lastLogin = msg.readString(24);
- msg.skip(2); // unused bytes
+ msg.skip(2); // 0 unused bytes
// msg.skip(30); // unknown
// reserve bits for future usage
@@ -183,10 +188,11 @@ void LoginHandler::processLoginData(Net::MessageIn &msg)
world->address = msg.readInt32();
world->port = msg.readInt16();
world->name = msg.readString(20);
- world->online_users = msg.readInt32();
+ world->online_users = msg.readInt16();
config.setValue("updatehost", mUpdateHost);
world->updateHost = mUpdateHost;
- msg.skip(2); // unknown
+ msg.skip(2); // maintenance
+ msg.skip(2); // new
logger->log("Network: Server: %s (%s:%d)", world->name.c_str(),
ipToString(world->address), world->port);
diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h
index 62ace31c8..555de6385 100644
--- a/src/net/ea/loginhandler.h
+++ b/src/net/ea/loginhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp
index e8e1014d4..18b0ca39a 100644
--- a/src/net/ea/npchandler.cpp
+++ b/src/net/ea/npchandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/npchandler.h b/src/net/ea/npchandler.h
index 3e68c2321..be0465375 100644
--- a/src/net/ea/npchandler.h
+++ b/src/net/ea/npchandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 8373cb1c4..556e72c8d 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -320,7 +320,7 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg)
m = Ea::taParty->getMember(id);
if (m)
{
- msg.skip(4);
+ msg.skip(4); // 0
m->setX(msg.readInt16()); // x
m->setY(msg.readInt16()); // y
m->setOnline(msg.readInt8()); // online (if 0)
@@ -330,7 +330,7 @@ void PartyHandler::processPartyMove(Net::MessageIn &msg)
}
else
{
- msg.skip(4);
+ msg.skip(4); // 0
msg.readInt16(); // x
msg.readInt16(); // y
msg.readInt8(); // online (if 0)
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 02af3dbb4..6a841415f 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index ceb4aba0b..d0402ecfc 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp
index fe56db52a..7b2ef601a 100644
--- a/src/net/ea/specialhandler.cpp
+++ b/src/net/ea/specialhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -87,11 +87,11 @@ void SpecialHandler::processPlayerSkills(Net::MessageIn &msg)
{
int skillId = msg.readInt16();
msg.readInt16(); // target type
- msg.skip(2); // unused
+ msg.skip(2); // skill pool flags
int level = msg.readInt16();
msg.readInt16(); // sp
msg.readInt16(); // range
- msg.skip(24); // unused
+ msg.skip(24); // 0 unused
int up = msg.readInt8();
PlayerInfo::setStatBase(skillId, level);
diff --git a/src/net/ea/specialhandler.h b/src/net/ea/specialhandler.h
index 47b412f3e..c2b05399e 100644
--- a/src/net/ea/specialhandler.h
+++ b/src/net/ea/specialhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/token.h b/src/net/ea/token.h
index 40a7058ff..86871647f 100644
--- a/src/net/ea/token.h
+++ b/src/net/ea/token.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 5aaa09f91..0ba3925a8 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h
index 6d623f60d..07e9cc23b 100644
--- a/src/net/ea/tradehandler.h
+++ b/src/net/ea/tradehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/gamehandler.h b/src/net/gamehandler.h
index 14203fb20..fd051234f 100644
--- a/src/net/gamehandler.h
+++ b/src/net/gamehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/generalhandler.h b/src/net/generalhandler.h
index 1a15e6929..9864ba654 100644
--- a/src/net/generalhandler.h
+++ b/src/net/generalhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h
index 4070abad5..b8af633de 100644
--- a/src/net/guildhandler.h
+++ b/src/net/guildhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h
index 360f141fa..ec2f3db47 100644
--- a/src/net/inventoryhandler.h
+++ b/src/net/inventoryhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 6433d2759..e5d3fc97a 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h
index 5607ca1e2..1366e30dd 100644
--- a/src/net/loginhandler.h
+++ b/src/net/loginhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp
index a7bcf6355..609c9e4f1 100644
--- a/src/net/manaserv/adminhandler.cpp
+++ b/src/net/manaserv/adminhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/adminhandler.h b/src/net/manaserv/adminhandler.h
index 5a71db35e..a4157b3b0 100644
--- a/src/net/manaserv/adminhandler.h
+++ b/src/net/manaserv/adminhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp
index 25c75f9d8..662032e29 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/net/manaserv/attributes.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -238,9 +238,9 @@ namespace Attributes
logger->log("Initializing attributes database...");
XML::Document doc(DEFAULT_ATTRIBUTESDB_FILE);
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "attributes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "attributes"))
{
logger->log("Attributes: Error while loading "
DEFAULT_ATTRIBUTESDB_FILE ". Using Built-ins.");
@@ -251,7 +251,7 @@ namespace Attributes
for_each_xml_child_node(node, rootNode)
{
- if (xmlStrEqual(node->name, BAD_CAST "attribute"))
+ if (xmlNameEqual(node, "attribute"))
{
int id = XML::getProperty(node, "id", 0);
@@ -290,7 +290,7 @@ namespace Attributes
unsigned int count = 0;
for_each_xml_child_node(effectNode, node)
{
- if (!xmlStrEqual(effectNode->name, BAD_CAST "modifier"))
+ if (!xmlNameEqual(effectNode, "modifier"))
continue;
++count;
std::string tag = XML::getProperty(effectNode, "tag", "");
@@ -334,7 +334,7 @@ namespace Attributes
logger->log("Found %d tags for attribute %d.", count, id);
}// End attribute
- else if (xmlStrEqual(node->name, BAD_CAST "points"))
+ else if (xmlNameEqual(node, "points"))
{
creationPoints = XML::getProperty(
node, "start", DEFAULT_POINTS);
diff --git a/src/net/manaserv/attributes.h b/src/net/manaserv/attributes.h
index 35eeaef88..ba5931b8c 100644
--- a/src/net/manaserv/attributes.h
+++ b/src/net/manaserv/attributes.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index d14cdcadf..cef4f497a 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/beinghandler.h b/src/net/manaserv/beinghandler.h
index 59797f8f5..70d61545c 100644
--- a/src/net/manaserv/beinghandler.h
+++ b/src/net/manaserv/beinghandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/buysellhandler.cpp b/src/net/manaserv/buysellhandler.cpp
index 7cc0e70f2..25db86cf0 100644
--- a/src/net/manaserv/buysellhandler.cpp
+++ b/src/net/manaserv/buysellhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/buysellhandler.h b/src/net/manaserv/buysellhandler.h
index e1a9c91e5..3c983ac08 100644
--- a/src/net/manaserv/buysellhandler.h
+++ b/src/net/manaserv/buysellhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index 42db6e621..300af5a2b 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/charhandler.h b/src/net/manaserv/charhandler.h
index ea44ae23e..134b8447b 100644
--- a/src/net/manaserv/charhandler.h
+++ b/src/net/manaserv/charhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 1757b565d..f0a23127c 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/chathandler.h b/src/net/manaserv/chathandler.h
index e93c2dd87..029d5fe83 100644
--- a/src/net/manaserv/chathandler.h
+++ b/src/net/manaserv/chathandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/connection.cpp b/src/net/manaserv/connection.cpp
index 33d6f28cf..2467eb198 100644
--- a/src/net/manaserv/connection.cpp
+++ b/src/net/manaserv/connection.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/connection.h b/src/net/manaserv/connection.h
index 933822a85..4263ae21f 100644
--- a/src/net/manaserv/connection.h
+++ b/src/net/manaserv/connection.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/defines.h b/src/net/manaserv/defines.h
index e2fe27839..aaf29bff2 100644
--- a/src/net/manaserv/defines.h
+++ b/src/net/manaserv/defines.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp
index 92cf66302..59fb1e4f5 100644
--- a/src/net/manaserv/effecthandler.cpp
+++ b/src/net/manaserv/effecthandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/effecthandler.h b/src/net/manaserv/effecthandler.h
index 774411041..ceb48fd22 100644
--- a/src/net/manaserv/effecthandler.h
+++ b/src/net/manaserv/effecthandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp
index 21bd526d8..4a03dff0f 100644
--- a/src/net/manaserv/gamehandler.cpp
+++ b/src/net/manaserv/gamehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/gamehandler.h b/src/net/manaserv/gamehandler.h
index 323b2566a..443533bba 100644
--- a/src/net/manaserv/gamehandler.h
+++ b/src/net/manaserv/gamehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index 2eea6cdf6..584faa368 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h
index c6614707f..fcb28c846 100644
--- a/src/net/manaserv/generalhandler.h
+++ b/src/net/manaserv/generalhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index 306a15be4..dfd2ed3cf 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/guildhandler.h b/src/net/manaserv/guildhandler.h
index 6a8db27c8..893a7157b 100644
--- a/src/net/manaserv/guildhandler.h
+++ b/src/net/manaserv/guildhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/internal.cpp b/src/net/manaserv/internal.cpp
index 6d2c99712..37148b101 100644
--- a/src/net/manaserv/internal.cpp
+++ b/src/net/manaserv/internal.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/internal.h b/src/net/manaserv/internal.h
index 14a728727..9c0529a79 100644
--- a/src/net/manaserv/internal.h
+++ b/src/net/manaserv/internal.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index ce837b5e1..47f149eca 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index ba4535d79..8471b1caf 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/itemhandler.cpp b/src/net/manaserv/itemhandler.cpp
index 89826a33f..021d57cf3 100644
--- a/src/net/manaserv/itemhandler.cpp
+++ b/src/net/manaserv/itemhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/itemhandler.h b/src/net/manaserv/itemhandler.h
index 0fdd8c333..cfdc30083 100644
--- a/src/net/manaserv/itemhandler.h
+++ b/src/net/manaserv/itemhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp
index bf823562f..f1c597c00 100644
--- a/src/net/manaserv/loginhandler.cpp
+++ b/src/net/manaserv/loginhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -339,11 +339,20 @@ void LoginHandler::readServerInfo(Net::MessageIn &msg)
return;
// Set the update host when included in the message
- const std::string updateHost = msg.readString();
+ std::string updateHost = msg.readString();
if (!updateHost.empty())
+ {
+ if (!checkPath(updateHost))
+ {
+ logger->log1("Warning: incorrect update server name");
+ updateHost = "";
+ }
mLoginData->updateHost = updateHost;
+ }
else
+ {
logger->log1("Warning: server does not have an update host set!");
+ }
// Read the client data folder for dynamic data loading.
// This is only used by the QT client.
diff --git a/src/net/manaserv/loginhandler.h b/src/net/manaserv/loginhandler.h
index 0e8f2a4e6..72c43aec0 100644
--- a/src/net/manaserv/loginhandler.h
+++ b/src/net/manaserv/loginhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messagehandler.cpp b/src/net/manaserv/messagehandler.cpp
index 2e9603f19..769f2a3b6 100644
--- a/src/net/manaserv/messagehandler.cpp
+++ b/src/net/manaserv/messagehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messagehandler.h b/src/net/manaserv/messagehandler.h
index c1011cef7..c09d59439 100644
--- a/src/net/manaserv/messagehandler.h
+++ b/src/net/manaserv/messagehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messagein.cpp b/src/net/manaserv/messagein.cpp
index 92bfa7d2c..bc97155a9 100644
--- a/src/net/manaserv/messagein.cpp
+++ b/src/net/manaserv/messagein.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messagein.h b/src/net/manaserv/messagein.h
index 6b0464a44..f22cdabca 100644
--- a/src/net/manaserv/messagein.h
+++ b/src/net/manaserv/messagein.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messageout.cpp b/src/net/manaserv/messageout.cpp
index c80ba6593..0bb1c0f77 100644
--- a/src/net/manaserv/messageout.cpp
+++ b/src/net/manaserv/messageout.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/messageout.h b/src/net/manaserv/messageout.h
index 772b108f3..dc583ab3d 100644
--- a/src/net/manaserv/messageout.h
+++ b/src/net/manaserv/messageout.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 44478fb4c..84e71eaf3 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/network.h b/src/net/manaserv/network.h
index 63ba7b11a..506d44b4f 100644
--- a/src/net/manaserv/network.h
+++ b/src/net/manaserv/network.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index 8ff2c5d21..24a58ebd8 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/npchandler.h b/src/net/manaserv/npchandler.h
index f91858614..d71cd4d18 100644
--- a/src/net/manaserv/npchandler.h
+++ b/src/net/manaserv/npchandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index 660657f44..60dcaaaff 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/partyhandler.h b/src/net/manaserv/partyhandler.h
index 087936d72..5497d5e34 100644
--- a/src/net/manaserv/partyhandler.h
+++ b/src/net/manaserv/partyhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 925938161..5ebf840bc 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/playerhandler.h b/src/net/manaserv/playerhandler.h
index c33eddc84..0255406a8 100644
--- a/src/net/manaserv/playerhandler.h
+++ b/src/net/manaserv/playerhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/protocol.h b/src/net/manaserv/protocol.h
index 7f5e03871..58103ffb1 100644
--- a/src/net/manaserv/protocol.h
+++ b/src/net/manaserv/protocol.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/specialhandler.cpp b/src/net/manaserv/specialhandler.cpp
index 85fe7271f..13c6f7613 100644
--- a/src/net/manaserv/specialhandler.cpp
+++ b/src/net/manaserv/specialhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/specialhandler.h b/src/net/manaserv/specialhandler.h
index ccbe59fd9..f6a20e4ac 100644
--- a/src/net/manaserv/specialhandler.h
+++ b/src/net/manaserv/specialhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index 383da9fe6..e827c2cec 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/manaserv/tradehandler.h b/src/net/manaserv/tradehandler.h
index 2ca542f78..39d691982 100644
--- a/src/net/manaserv/tradehandler.h
+++ b/src/net/manaserv/tradehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h
index 64483c8cd..9867ffd65 100644
--- a/src/net/messagehandler.h
+++ b/src/net/messagehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 19453b745..4fb61dc6a 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/messagein.h b/src/net/messagein.h
index ed143a213..8dd43a1a0 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index b1e0c2295..9ec45c7cc 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/messageout.h b/src/net/messageout.h
index a169bfe2d..6ac6f81e2 100644
--- a/src/net/messageout.h
+++ b/src/net/messageout.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 933f7686b..713b6aa7e 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/net.h b/src/net/net.h
index a6adef44e..ce320591f 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/npchandler.h b/src/net/npchandler.h
index 40b97deef..2e32e5986 100644
--- a/src/net/npchandler.h
+++ b/src/net/npchandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/packetcounters.cpp b/src/net/packetcounters.cpp
index 8cd2e4627..dc504768e 100644
--- a/src/net/packetcounters.cpp
+++ b/src/net/packetcounters.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/packetcounters.h b/src/net/packetcounters.h
index 35d5d64bc..936217c95 100644
--- a/src/net/packetcounters.h
+++ b/src/net/packetcounters.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index 14f06060d..dd92f78d1 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 4f1ed8f00..f62acc0c9 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index eb07f766e..fb6a99a33 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/specialhandler.h b/src/net/specialhandler.h
index 64b11fdda..7ed3673cf 100644
--- a/src/net/specialhandler.h
+++ b/src/net/specialhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 5d5034938..65f4d6f2c 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h
index d81e2421a..4063a7fba 100644
--- a/src/net/tmwa/adminhandler.h
+++ b/src/net/tmwa/adminhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 02267e20e..627db1402 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 5e741aaa8..a45e33d36 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp
index 552aa1d51..629aa54f6 100644
--- a/src/net/tmwa/buysellhandler.cpp
+++ b/src/net/tmwa/buysellhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -69,7 +69,7 @@ BuySellHandler::BuySellHandler()
};
handledMessages = _messages;
buySellHandler = this;
- mBuyDialog = 0;
+ mBuyDialog = nullptr;
}
void BuySellHandler::handleMessage(Net::MessageIn &msg)
diff --git a/src/net/tmwa/buysellhandler.h b/src/net/tmwa/buysellhandler.h
index 65067f7e0..e4d07511f 100644
--- a/src/net/tmwa/buysellhandler.h
+++ b/src/net/tmwa/buysellhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 69f7165ec..717df1284 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -190,7 +190,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt32(); // option
msg.readInt32(); // karma
msg.readInt32(); // manner
- msg.skip(2); // unknown
+ msg.readInt16(); // character points left
character->data.mAttributes[HP] = msg.readInt16();
character->data.mAttributes[MAX_HP] = msg.readInt16();
@@ -347,7 +347,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
loginData.characterSlots = static_cast<short unsigned int>(slots);
bool version = msg.readInt8() == 1 && serverVersion > 0;
- msg.skip(17); // Unused
+ msg.skip(17); // 0 Unused
delete_all(mCharacters);
mCharacters.clear();
diff --git a/src/net/tmwa/charserverhandler.h b/src/net/tmwa/charserverhandler.h
index f1256e409..915c6dba5 100644
--- a/src/net/tmwa/charserverhandler.h
+++ b/src/net/tmwa/charserverhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 5af248e5c..368421285 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 9a88b7478..8652d297d 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index adaaa067b..5acf9ae6c 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h
index ddb381058..d48fabdcc 100644
--- a/src/net/tmwa/gamehandler.h
+++ b/src/net/tmwa/gamehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 293986bde..a666fa5f4 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -201,9 +201,9 @@ void GeneralHandler::reload()
static_cast<LoginHandler*>(mLoginHandler.get())->clearWorlds();
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharCreateDialog(0);
+ mCharHandler.get())->setCharCreateDialog(nullptr);
static_cast<CharServerHandler*>(
- mCharHandler.get())->setCharSelectDialog(0);
+ mCharHandler.get())->setCharSelectDialog(nullptr);
static_cast<PartyHandler*>(mPartyHandler.get())->reload();
}
@@ -259,6 +259,9 @@ void GeneralHandler::processEvent(Mana::Channels channel,
if (!statusWindow)
return;
+ // protection against double addition attributes.
+ statusWindow->clearAttributes();
+
statusWindow->addAttribute(STR, _("Strength"), true, "");
statusWindow->addAttribute(AGI, _("Agility"), true, "");
statusWindow->addAttribute(VIT, _("Vitality"), true, "");
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index e0f29fd1d..b250ddfd4 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp
index 05a93bff8..af90f5c6b 100644
--- a/src/net/tmwa/gui/guildtab.cpp
+++ b/src/net/tmwa/gui/guildtab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/guildtab.h b/src/net/tmwa/gui/guildtab.h
index 21c56c4ed..351dadfd6 100644
--- a/src/net/tmwa/gui/guildtab.h
+++ b/src/net/tmwa/gui/guildtab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp
index 373fcca31..d0738e79c 100644
--- a/src/net/tmwa/gui/partytab.cpp
+++ b/src/net/tmwa/gui/partytab.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/gui/partytab.h b/src/net/tmwa/gui/partytab.h
index d865995f7..0bdc11372 100644
--- a/src/net/tmwa/gui/partytab.h
+++ b/src/net/tmwa/gui/partytab.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 7ea97eb49..5e2ac528f 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index d8d291bdd..e1d2d7c29 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 14a15e59f..7fa26f5ed 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index d924e8713..d2ecc4b6d 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index ee33cd230..ce03044c7 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/itemhandler.h b/src/net/tmwa/itemhandler.h
index 3e948547e..0f2459fbf 100644
--- a/src/net/tmwa/itemhandler.h
+++ b/src/net/tmwa/itemhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index bdc944d63..3b53bbf7c 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -154,7 +154,7 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
{
unsigned int options = msg.readInt8();
mRegistrationEnabled = options;
- msg.skip(2);
+ msg.skip(2); // 0 unused
serverVersion = msg.readInt8();
}
else
diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h
index c13c882a7..e2b8beec7 100644
--- a/src/net/tmwa/loginhandler.h
+++ b/src/net/tmwa/loginhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagehandler.cpp b/src/net/tmwa/messagehandler.cpp
index 830b3bc4f..d4b3c03a4 100644
--- a/src/net/tmwa/messagehandler.cpp
+++ b/src/net/tmwa/messagehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagehandler.h b/src/net/tmwa/messagehandler.h
index fef9e2004..7607e5c80 100644
--- a/src/net/tmwa/messagehandler.h
+++ b/src/net/tmwa/messagehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp
index 5a9d39211..b8bba342f 100644
--- a/src/net/tmwa/messagein.cpp
+++ b/src/net/tmwa/messagein.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messagein.h b/src/net/tmwa/messagein.h
index bf8debf54..29b17d8ba 100644
--- a/src/net/tmwa/messagein.h
+++ b/src/net/tmwa/messagein.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index d5d9d82f9..790611381 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/messageout.h b/src/net/tmwa/messageout.h
index d97851d4a..5d1e911b6 100644
--- a/src/net/tmwa/messageout.h
+++ b/src/net/tmwa/messageout.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index db006c5c0..31329eafb 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -83,7 +83,7 @@ short packet_lengths[] =
-1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10,
// #0x0200
26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, 10, 0, 0, 0,
- 2, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, -1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-1, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index 757358c25..c0ec6ef3c 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -39,7 +39,7 @@
* Protocol version, reported to the eAthena char and mapserver who can adjust
* the protocol accordingly.
*/
-#define CLIENT_PROTOCOL_VERSION 4
+#define CLIENT_PROTOCOL_VERSION 5
#define CLIENT_TMW_PROTOCOL_VERSION 1
namespace TmwAthena
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 6b6ffcbb6..d86c64a96 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,6 +25,7 @@
#include "localplayer.h"
#include "gui/npcdialog.h"
+#include "gui/viewport.h"
#include "net/messagein.h"
#include "net/net.h"
@@ -41,7 +42,8 @@ extern Net::NpcHandler *npcHandler;
namespace TmwAthena
{
-NpcHandler::NpcHandler()
+NpcHandler::NpcHandler() :
+ mRequestLang(false)
{
static const Uint16 _messages[] =
{
@@ -51,6 +53,7 @@ NpcHandler::NpcHandler()
SMSG_NPC_CLOSE,
SMSG_NPC_INT_INPUT,
SMSG_NPC_STR_INPUT,
+ SMSG_NPC_COMMAND,
0
};
handledMessages = _messages;
@@ -59,9 +62,12 @@ NpcHandler::NpcHandler()
void NpcHandler::handleMessage(Net::MessageIn &msg)
{
- getNpc(msg, msg.getId() == SMSG_NPC_CHOICE
+ int npcId = getNpc(msg, msg.getId() == SMSG_NPC_CHOICE
|| msg.getId() == SMSG_NPC_MESSAGE);
+ if (msg.getId() != SMSG_NPC_STR_INPUT)
+ mRequestLang = false;
+
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
@@ -85,7 +91,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_NPC_STR_INPUT:
- processNpcStrInput(msg);
+ if (mRequestLang)
+ processLangReuqest(msg, npcId);
+ else
+ processNpcStrInput(msg);
+ break;
+
+ case SMSG_NPC_COMMAND:
+ processNpcCommand(msg, npcId);
break;
default:
@@ -118,6 +131,8 @@ void NpcHandler::closeDialog(int npcId)
{
if ((*it).second.dialog)
(*it).second.dialog->close();
+ if ((*it).second.dialog == mDialog)
+ mDialog = nullptr;
mNpcDialogs.erase(it);
}
}
@@ -213,6 +228,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
else
{
mDialog = new NpcDialog(npcId);
+ mDialog->saveCamera();
if (player_node)
player_node->stopWalking(false);
Wrapper wrap;
@@ -222,9 +238,70 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
}
else
{
+ if (mDialog && mDialog != diag->second.dialog)
+ mDialog->restoreCamera();
mDialog = diag->second.dialog;
+ if (mDialog)
+ mDialog->saveCamera();
}
return npcId;
}
+void NpcHandler::processNpcCommand(Net::MessageIn &msg, int npcId)
+{
+ const int cmd = msg.readInt16();
+ switch (cmd)
+ {
+ case 0:
+ mRequestLang = true;
+ break;
+
+ case 1:
+ if (viewport)
+ viewport->moveCameraToActor(npcId);
+ break;
+
+ case 2:
+ if (viewport)
+ {
+ const int id = msg.readInt32();
+ const int x = msg.readInt16();
+ const int y = msg.readInt16();
+ if (!id)
+ viewport->moveCameraToPosition(x, y);
+ else
+ viewport->moveCameraToActor(id, x, y);
+ }
+ break;
+
+ case 3:
+ if (viewport)
+ viewport->returnCamera();
+ break;
+
+ case 4:
+ if (viewport)
+ {
+ msg.readInt32(); // id
+ const int x = msg.readInt16();
+ const int y = msg.readInt16();
+ viewport->moveCameraRelative(x, y);
+ }
+ break;
+ case 5:
+ closeDialog(npcId);
+ break;
+
+ default:
+ logger->log("unknown npc command: %d", cmd);
+ break;
+ }
+}
+
+void NpcHandler::processLangReuqest(Net::MessageIn &msg A_UNUSED, int npcId)
+{
+ mRequestLang = false;
+ stringInput(npcId, getLangSimple());
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/npchandler.h b/src/net/tmwa/npchandler.h
index 548346205..1cfcacb20 100644
--- a/src/net/tmwa/npchandler.h
+++ b/src/net/tmwa/npchandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -65,6 +65,13 @@ class NpcHandler : public MessageHandler, public Ea::NpcHandler
void sellItem(int beingId, int itemId, int amount);
int getNpc(Net::MessageIn &msg, bool haveLength);
+
+ void processNpcCommand(Net::MessageIn &msg, int npcId);
+
+ void processLangReuqest(Net::MessageIn &msg, int npcId);
+
+ private:
+ bool mRequestLang;
};
} // namespace TmwAthena
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 4534cca8b..d5f0641eb 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/playerhandler.h b/src/net/tmwa/playerhandler.h
index 898bdae3d..0fa524d51 100644
--- a/src/net/tmwa/playerhandler.h
+++ b/src/net/tmwa/playerhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/protocol.h b/src/net/tmwa/protocol.h
index 37f036ca8..ddc642101 100644
--- a/src/net/tmwa/protocol.h
+++ b/src/net/tmwa/protocol.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -335,5 +335,6 @@ enum
#define SMSG_IGNORE_ALL_RESPONSE 0x00d2
#define CMSG_ONLINE_LIST 0x0210
#define SMSG_ONLINE_LIST 0x0211
+#define SMSG_NPC_COMMAND 0x0212
#endif
diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp
index c75d954dc..9fa7b6dfa 100644
--- a/src/net/tmwa/specialhandler.cpp
+++ b/src/net/tmwa/specialhandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h
index 50bf31c0b..f17ef4c44 100644
--- a/src/net/tmwa/specialhandler.h
+++ b/src/net/tmwa/specialhandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 2280079ea..1a44e4956 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tmwa/tradehandler.h b/src/net/tmwa/tradehandler.h
index 3a4c8c1fc..b5a06ef6a 100644
--- a/src/net/tmwa/tradehandler.h
+++ b/src/net/tmwa/tradehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h
index 57219e675..06a431ec6 100644
--- a/src/net/tradehandler.h
+++ b/src/net/tradehandler.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/net/worldinfo.h b/src/net/worldinfo.h
index b02e9fa21..26733a0da 100644
--- a/src/net/worldinfo.h
+++ b/src/net/worldinfo.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp
index 1f1a0231d..6f712f698 100644
--- a/src/opengl1graphics.cpp
+++ b/src/opengl1graphics.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -377,6 +377,9 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y,
// Draw a set of textured rectangles
glBegin(GL_QUADS);
+ const float scaleFactorW = (float) scaledWidth / image->getWidth();
+ const float scaleFactorH = (float) scaledHeight / image->getHeight();
+
for (int py = 0; py < h; py += ih)
{
const int height = (py + ih >= h) ? h - py : ih;
@@ -387,7 +390,8 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y,
int dstX = x + px;
drawRescaledQuad(image, srcX, srcY, dstX, dstY,
- width, height, scaledWidth, scaledHeight);
+ width / scaleFactorW, height / scaleFactorH,
+ scaledWidth, scaledHeight);
}
}
@@ -474,6 +478,7 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
{
int h = mTarget->h;
int w = mTarget->w;
+ GLint pack = 1;
SDL_Surface *screenshot = SDL_CreateRGBSurface(
SDL_SWSURFACE,
@@ -484,6 +489,7 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
SDL_LockSurface(screenshot);
// Grap the pixel buffer and write it to the SDL surface
+ glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -505,6 +511,8 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
free(buf);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack);
+
if (SDL_MUSTLOCK(screenshot))
SDL_UnlockSurface(screenshot);
diff --git a/src/opengl1graphics.h b/src/opengl1graphics.h
index 11df607f8..87458d8b9 100644
--- a/src/opengl1graphics.h
+++ b/src/opengl1graphics.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index f5e9f8107..b744a3caf 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -588,22 +588,25 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image,
const int height = (py + scaledHeight >= h)
? h - py : scaledHeight;
const int dstY = y + py;
+ const int scaledY = srcY + height / scaleFactorH;
for (int px = 0; px < w; px += scaledWidth)
{
- int width = (px + scaledWidth >= w) ? w - px : scaledWidth;
- int dstX = x + px;
+ const int width = (px + scaledWidth >= w)
+ ? w - px : scaledWidth;
+ const int dstX = x + px;
+ const int scaledX = srcX + width / scaleFactorW;
mIntTexArray[vp + 0] = srcX;
mIntTexArray[vp + 1] = srcY;
- mIntTexArray[vp + 2] = srcX + width / scaleFactorW;
+ mIntTexArray[vp + 2] = scaledX;
mIntTexArray[vp + 3] = srcY;
- mIntTexArray[vp + 4] = srcX + width / scaleFactorW;
- mIntTexArray[vp + 5] = srcY + height / scaleFactorH;
+ mIntTexArray[vp + 4] = scaledX;
+ mIntTexArray[vp + 5] = scaledY;
mIntTexArray[vp + 6] = srcX;
- mIntTexArray[vp + 7] = srcY + height / scaleFactorH;
+ mIntTexArray[vp + 7] = scaledY;
mIntVertArray[vp + 0] = dstX;
mIntVertArray[vp + 1] = dstY;
@@ -1020,6 +1023,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
{
int h = mTarget->h;
int w = mTarget->w;
+ GLint pack = 1;
SDL_Surface *screenshot = SDL_CreateRGBSurface(
SDL_SWSURFACE,
@@ -1033,6 +1037,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
SDL_LockSurface(screenshot);
// Grap the pixel buffer and write it to the SDL surface
+ glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -1054,6 +1059,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
free(buf);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack);
+
if (SDL_MUSTLOCK(screenshot))
SDL_UnlockSurface(screenshot);
diff --git a/src/openglgraphics.h b/src/openglgraphics.h
index d12810203..1047223ad 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/particle.cpp b/src/particle.cpp
index e71791ce8..a0acb4f73 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -291,9 +291,9 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
dyePalettes = particleEffectFile.substr(pos + 1);
XML::Document doc(particleEffectFile.substr(0, pos));
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect"))
+ if (!rootNode || !xmlNameEqual(rootNode, "effect"))
{
logger->log("Error loading particle: %s", particleEffectFile.c_str());
return nullptr;
@@ -305,11 +305,11 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
for_each_xml_child_node(effectChildNode, rootNode)
{
// We're only interested in particles
- if (!xmlStrEqual(effectChildNode->name, BAD_CAST "particle"))
+ if (!xmlNameEqual(effectChildNode, "particle"))
continue;
// Determine the exact particle type
- xmlNodePtr node;
+ XmlNodePtr node;
// Animation
if ((node = XML::findFirstChildByName(effectChildNode, "animation")))
@@ -361,14 +361,14 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
// Look for additional emitters for this particle
for_each_xml_child_node(emitterNode, effectChildNode)
{
- if (xmlStrEqual(emitterNode->name, BAD_CAST "emitter"))
+ if (xmlNameEqual(emitterNode, "emitter"))
{
ParticleEmitter *newEmitter;
newEmitter = new ParticleEmitter(emitterNode, newParticle,
mMap, rotation, dyePalettes);
newParticle->addEmitter(newEmitter);
}
- else if (xmlStrEqual(emitterNode->name, BAD_CAST "deatheffect"))
+ else if (xmlNameEqual(emitterNode, "deatheffect"))
{
std::string deathEffect = reinterpret_cast<const char*>(
emitterNode->xmlChildrenNode->content);
diff --git a/src/particle.h b/src/particle.h
index ad448a054..a79181498 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 40ab68865..e39f4dd86 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index 2219bd67c..a8af163fd 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 1add452a0..c6c819e92 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -39,11 +39,11 @@
#define SIN45 0.707106781f
#define DEG_RAD_FACTOR 0.017453293f
-ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
+ParticleEmitter::ParticleEmitter(XmlNodePtr emitterNode, Particle *target,
Map *map, int rotation,
const std::string& dyePalettes):
mOutputPauseLeft(0),
- mParticleImage(0)
+ mParticleImage(nullptr)
{
mMap = map;
mParticleTarget = target;
@@ -71,7 +71,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
for_each_xml_child_node(propertyNode, emitterNode)
{
- if (xmlStrEqual(propertyNode->name, BAD_CAST "property"))
+ if (xmlNameEqual(propertyNode, "property"))
{
std::string name = XML::getProperty(propertyNode, "name", "");
@@ -197,13 +197,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
name.c_str());
}
}
- else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter"))
+ else if (xmlNameEqual(propertyNode, "emitter"))
{
ParticleEmitter newEmitter(propertyNode, mParticleTarget, map,
rotation, dyePalettes);
mParticleChildEmitters.push_back(newEmitter);
}
- else if (xmlStrEqual(propertyNode->name, BAD_CAST "rotation"))
+ else if (xmlNameEqual(propertyNode, "rotation"))
{
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(propertyNode, "imageset", ""),
@@ -229,7 +229,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
offsetY -= imageset->getHeight() - 32;
offsetX -= imageset->getWidth() / 2 - 16;
- if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
+ if (xmlNameEqual(frameNode, "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
@@ -250,7 +250,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
mParticleRotation.addFrame(img, delay,
offsetX, offsetY, rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
+ else if (xmlNameEqual(frameNode, "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
@@ -276,13 +276,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
start++;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
mParticleRotation.addTerminator(rand);
}
} // for frameNode
}
- else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation"))
+ else if (xmlNameEqual(propertyNode, "animation"))
{
ImageSet *imageset = ResourceManager::getInstance()->getImageSet(
XML::getProperty(propertyNode, "imageset", ""),
@@ -307,7 +307,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
offsetY -= imageset->getHeight() - 32;
offsetX -= imageset->getWidth() / 2 - 16;
- if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
+ if (xmlNameEqual(frameNode, "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
@@ -328,7 +328,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
mParticleAnimation.addFrame(img, delay,
offsetX, offsetY, rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
+ else if (xmlNameEqual(frameNode, "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
@@ -354,13 +354,13 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target,
start++;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
mParticleAnimation.addTerminator(rand);
}
} // for frameNode
}
- else if (xmlStrEqual(propertyNode->name, BAD_CAST "deatheffect"))
+ else if (xmlNameEqual(propertyNode, "deatheffect"))
{
mDeathEffect = reinterpret_cast<const char*>(
propertyNode->xmlChildrenNode->content);
@@ -460,13 +460,13 @@ ParticleEmitter::~ParticleEmitter()
if (mParticleImage)
{
mParticleImage->decRef();
- mParticleImage = 0;
+ mParticleImage = nullptr;
}
}
template <typename T> ParticleEmitterProp<T>
-ParticleEmitter::readParticleEmitterProp(xmlNodePtr propertyNode, T def)
+ParticleEmitter::readParticleEmitterProp(XmlNodePtr propertyNode, T def)
{
ParticleEmitterProp<T> retval;
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 49826d0f6..faa54dd12 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -43,7 +43,7 @@ class Particle;
class ParticleEmitter
{
public:
- ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map,
+ ParticleEmitter(XmlNodePtr emitterNode, Particle *target, Map *map,
int rotation = 0,
const std::string& dyePalettes = std::string());
@@ -82,7 +82,7 @@ class ParticleEmitter
private:
template <typename T> ParticleEmitterProp<T>
- readParticleEmitterProp(xmlNodePtr propertyNode, T def);
+ readParticleEmitterProp(XmlNodePtr propertyNode, T def);
/**
* initial position of particles:
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index 76c855e4f..cadfa0f3a 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/party.cpp b/src/party.cpp
index b462c94a7..1a693ddd6 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/party.h b/src/party.h
index 73c45214a..1f616319d 100644
--- a/src/party.h
+++ b/src/party.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 93e704302..0b9d16de2 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/playerinfo.h b/src/playerinfo.h
index b90e47ce9..cff145d2d 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 1bf63aa81..6b5cb0199 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -361,6 +361,24 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers()
return retval;
}
+std::vector<std::string> *PlayerRelationsManager::getPlayersByRelation(
+ PlayerRelation::Relation rel)
+{
+ std::vector<std::string> *retval = new std::vector<std::string>();
+
+ for (std::map<std::string,
+ PlayerRelation *>::const_iterator it = mRelations.begin();
+ it != mRelations.end(); ++it)
+ {
+ if (it->second && it->second->mRelation == rel)
+ retval->push_back(it->first);
+ }
+
+ sort(retval->begin(), retval->end(), playersSorter);
+
+ return retval;
+}
+
void PlayerRelationsManager::removePlayer(const std::string &name)
{
if (mRelations[name])
@@ -574,14 +592,24 @@ bool PlayerRelationsManager::checkName(const std::string &name) const
const int size = name.size();
std::string check = config.getStringValue("unsecureChars");
- if (name.substr(0, 1) == " " || name.substr(size - 1, 1) == " ")
+ std::string lastChar = name.substr(size - 1, 1);
+ if (name.substr(0, 1) == " " || lastChar == " " || lastChar == "."
+ || name.find(" ") != std::string::npos)
+ {
return false;
+ }
else if (check.empty())
+ {
return true;
+ }
else if (name.find_first_of(check) != std::string::npos)
+ {
return false;
+ }
else
+ {
return true;
+ }
}
PlayerRelationsManager player_relations;
diff --git a/src/playerrelations.h b/src/playerrelations.h
index 5eb1b3c64..143a82477 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -202,6 +202,9 @@ class PlayerRelationsManager
*/
std::vector<std::string> *getPlayers();
+ std::vector<std::string> *getPlayersByRelation(PlayerRelation::Relation
+ rel);
+
/**
* Removes all recorded player info.
*/
diff --git a/src/position.cpp b/src/position.cpp
index 8e9baf272..7bd6cfe50 100644
--- a/src/position.cpp
+++ b/src/position.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/position.h b/src/position.h
index 973a774f0..2e10aebe2 100644
--- a/src/position.h
+++ b/src/position.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/properties.h b/src/properties.h
index 19354b9ab..406477c73 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index f940bffcb..e1f88ecb7 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/action.h b/src/resources/action.h
index 9ab6f98d5..1e3965363 100644
--- a/src/resources/action.h
+++ b/src/resources/action.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,7 +23,7 @@
#ifndef ACTION_H
#define ACTION_H
-#include <libxml/tree.h>
+#include "utils/xml.h"
#include <map>
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index 2ad25dcd0..b5640904c 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/ambientlayer.h b/src/resources/ambientlayer.h
index c90ef7c79..54a764841 100644
--- a/src/resources/ambientlayer.h
+++ b/src/resources/ambientlayer.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 1f3336a8b..1c1da6ca5 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/animation.h b/src/resources/animation.h
index 19b17eb54..33bfd76e9 100644
--- a/src/resources/animation.h
+++ b/src/resources/animation.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,7 +23,7 @@
#ifndef ANIMATION_H
#define ANIMATION_H
-#include <libxml/tree.h>
+#include "utils/xml.h"
#include <vector>
#include <string>
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 0b2aaa8fa..0fa815181 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index b93c11ba6..0f62ba5ea 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp
index d944f280e..f38f13224 100644
--- a/src/resources/chardb.cpp
+++ b/src/resources/chardb.cpp
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -24,10 +24,6 @@
#include "client.h"
#include "logger.h"
-#include "utils/xml.h"
-
-#include <libxml/tree.h>
-
#include "debug.h"
namespace
@@ -48,9 +44,9 @@ void CharDB::load()
unload();
XML::Document *doc = new XML::Document("charcreation.xml");
- xmlNodePtr root = doc->rootNode();
+ XmlNodePtr root = doc->rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "chars"))
+ if (!root || !xmlNameEqual(root, "chars"))
{
logger->log1("CharDB: Failed to parse charcreation.xml.");
@@ -60,15 +56,15 @@ void CharDB::load()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "haircolor"))
+ if (xmlNameEqual(node, "haircolor"))
{
loadMinMax(node, &mMinHairColor, &mMaxHairColor);
}
- else if (xmlStrEqual(node->name, BAD_CAST "hairstyle"))
+ else if (xmlNameEqual(node, "hairstyle"))
{
loadMinMax(node, &mMinHairStyle, &mMaxHairStyle);
}
- else if (xmlStrEqual(node->name, BAD_CAST "stat"))
+ else if (xmlNameEqual(node, "stat"))
{
loadMinMax(node, &mMinStat, &mMaxStat);
mSumStat = XML::getProperty(node, "sum", 0);
@@ -80,7 +76,7 @@ void CharDB::load()
mLoaded = true;
}
-void CharDB::loadMinMax(xmlNodePtr node, unsigned *min, unsigned *max)
+void CharDB::loadMinMax(XmlNodePtr node, unsigned *min, unsigned *max)
{
*min = XML::getProperty(node, "min", 1);
*max = XML::getProperty(node, "max", 10);
diff --git a/src/resources/chardb.h b/src/resources/chardb.h
index 769dedb56..60ff31084 100644
--- a/src/resources/chardb.h
+++ b/src/resources/chardb.h
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,7 +25,7 @@
#include <map>
#include <string>
-#include <libxml/tree.h>
+#include "utils/xml.h"
/**
* Char information database.
@@ -42,7 +42,7 @@ namespace CharDB
*/
void unload();
- void loadMinMax(xmlNodePtr node, unsigned *min, unsigned *max);
+ void loadMinMax(XmlNodePtr node, unsigned *min, unsigned *max);
unsigned getMinHairColor();
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index 3b8c9d573..1ffe507b2 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -26,8 +26,6 @@
#include "utils/xml.h"
-#include <libxml/tree.h>
-
#include "debug.h"
namespace
@@ -51,10 +49,10 @@ void ColorDB::load()
void ColorDB::loadHair()
{
XML::Document *doc = new XML::Document("hair.xml");
- xmlNodePtr root = doc->rootNode();
+ XmlNodePtr root = doc->rootNode();
bool hairXml = true;
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log1("Trying to fall back on colors.xml");
@@ -64,7 +62,7 @@ void ColorDB::loadHair()
doc = new XML::Document("colors.xml");
root = doc->rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ if (!root || !xmlNameEqual(root, "colors"))
{
logger->log1("ColorDB: Failed to find any color files.");
mHairColors[0] = mFail;
@@ -78,7 +76,7 @@ void ColorDB::loadHair()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "color"))
+ if (xmlNameEqual(node, "color"))
{
int id = XML::getProperty(node, "id", 0);
@@ -99,7 +97,7 @@ void ColorDB::loadHair()
void ColorDB::loadColorLists()
{
XML::Document *doc = new XML::Document("itemcolors.xml");
- xmlNodePtr root = doc->rootNode();
+ XmlNodePtr root = doc->rootNode();
if (!root)
{
delete doc;
@@ -108,7 +106,7 @@ void ColorDB::loadColorLists()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "list"))
+ if (xmlNameEqual(node, "list"))
{
std::string name = XML::getProperty(node, "name", "");
if (name.empty())
@@ -122,7 +120,7 @@ void ColorDB::loadColorLists()
for_each_xml_child_node(colorNode, node)
{
- if (xmlStrEqual(colorNode->name, BAD_CAST "color"))
+ if (xmlNameEqual(colorNode, "color"))
{
ItemColor c(XML::getProperty(colorNode, "id", -1),
XML::getProperty(colorNode, "name", ""),
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
index f4cc88a59..36907095e 100644
--- a/src/resources/colordb.h
+++ b/src/resources/colordb.h
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp
index 29b1c864e..6800c5170 100644
--- a/src/resources/dye.cpp
+++ b/src/resources/dye.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/dye.h b/src/resources/dye.h
index 85192041a..94bee3b58 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index c456c49e4..c6126a57b 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -52,9 +52,9 @@ void EmoteDB::load()
logger->log1("Initializing emote database...");
XML::Document doc("emotes.xml");
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
{
logger->log1("Emote Database: Error while loading emotes.xml!");
return;
@@ -63,7 +63,7 @@ void EmoteDB::load()
//iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
- if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote"))
+ if (!xmlNameEqual(emoteNode, "emote"))
continue;
int id = XML::getProperty(emoteNode, "id", -1);
@@ -81,7 +81,7 @@ void EmoteDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
@@ -92,7 +92,7 @@ void EmoteDB::load()
currentSprite->name = XML::getProperty(spriteNode, "name", "");
currentInfo->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
@@ -108,7 +108,7 @@ void EmoteDB::load()
XML::Document doc2("graphics/sprites/manaplus_emotes.xml");
rootNode = doc2.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes"))
+ if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
{
logger->log1("Emote Database: Error while loading"
" manaplus_emotes.xml!");
@@ -118,7 +118,7 @@ void EmoteDB::load()
//iterate <emote>s
for_each_xml_child_node(emoteNode, rootNode)
{
- if (!xmlStrEqual(emoteNode->name, BAD_CAST "emote"))
+ if (!xmlNameEqual(emoteNode, "emote"))
continue;
int id = XML::getProperty(emoteNode, "id", -1);
@@ -136,7 +136,7 @@ void EmoteDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
EmoteSprite *currentSprite = new EmoteSprite;
std::string file = paths.getStringValue("sprites")
@@ -147,7 +147,7 @@ void EmoteDB::load()
currentSprite->name = XML::getProperty(spriteNode, "name", "");
currentInfo->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index df07c16a2..9e9124ab6 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -119,10 +119,8 @@ Image::~Image()
unload();
}
-Resource *Image::load(void *buffer, unsigned bufferSize)
+Resource *Image::load(SDL_RWops *rw)
{
- // Load the raw file data from the buffer in an RWops structure
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
if (!tmpImage)
@@ -137,9 +135,8 @@ Resource *Image::load(void *buffer, unsigned bufferSize)
return image;
}
-Resource *Image::load(void *buffer, unsigned bufferSize, Dye const &dye)
+Resource *Image::load(SDL_RWops *rw, Dye const &dye)
{
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
if (!tmpImage)
@@ -473,10 +470,10 @@ Image* Image::SDLmerge(Image *image, int x, int y)
static_cast<Uint16>(mBounds.h - y));
// for each pixel lines of a source image
- for (offset_x = (x > 0 ? 0 : -x); offset_x < maxX; offset_x++)
+ for (offset_x = ((x > 0) ? 0 : -x); offset_x < maxX; offset_x++)
{
const int x1 = x0 + offset_x;
- for (offset_y = (y > 0 ? 0 : -y); offset_y < maxY; offset_y++)
+ for (offset_y = ((y > 0) ? 0 : -y); offset_y < maxY; offset_y++)
{
// Computing offset on both images
current_offset = (offset_y * getWidth()) + x1;
diff --git a/src/resources/image.h b/src/resources/image.h
index 333dc63f9..d22ed4be2 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -66,28 +66,25 @@ class Image : public Resource
virtual ~Image();
/**
- * Loads an image from a buffer in memory.
+ * Loads an image from an SDL_RWops structure.
*
- * @param buffer The memory buffer containing the image data.
- * @param bufferSize The size of the memory buffer in bytes.
+ * @param rw The SDL_RWops to load the image from.
*
* @return <code>NULL</code> if an error occurred, a valid pointer
* otherwise.
*/
- static Resource *load(void *buffer, unsigned bufferSize);
+ static Resource *load(SDL_RWops *rw);
/**
- * Loads an image from a buffer in memory and recolors it.
+ * Loads an image from an SDL_RWops structure and recolors it.
*
- * @param buffer The memory buffer containing the image data.
- * @param bufferSize The size of the memory buffer in bytes.
+ * @param rw The SDL_RWops to load the image from.
* @param dye The dye used to recolor the image.
*
* @return <code>NULL</code> if an error occurred, a valid pointer
* otherwise.
*/
- static Resource *load(void *buffer, unsigned bufferSize,
- Dye const &dye);
+ static Resource *load(SDL_RWops *rw, Dye const &dye);
/**
* Loads an image from an SDL surface.
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index a8563c679..decf17189 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/imageloader.h b/src/resources/imageloader.h
index 5c3d29c74..1dcd046ca 100644
--- a/src/resources/imageloader.h
+++ b/src/resources/imageloader.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 09b57be28..9e3513e91 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/imageset.h b/src/resources/imageset.h
index fd320295a..69ebebdc0 100644
--- a/src/resources/imageset.h
+++ b/src/resources/imageset.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index a3a35cfd1..9501c98a5 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h
index ae94730f2..ca8150694 100644
--- a/src/resources/imagewriter.h
+++ b/src/resources/imagewriter.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 2911fa06f..5fa68a88f 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,6 +23,7 @@
#include "resources/itemdb.h"
#include "client.h"
+#include "configuration.h"
#include "logger.h"
#include "resources/iteminfo.h"
@@ -32,9 +33,6 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
#include "utils/xml.h"
-#include "configuration.h"
-
-#include <libxml/tree.h>
#include "debug.h"
@@ -49,11 +47,11 @@ namespace
}
// Forward declarations
-static void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node);
-static void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node);
-static void loadFloorSprite(SpriteDisplay *display, xmlNodePtr node);
-static void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode);
-static void loadOrderSprite(ItemInfo *itemInfo, xmlNodePtr node,
+static void loadSpriteRef(ItemInfo *itemInfo, XmlNodePtr node);
+static void loadSoundRef(ItemInfo *itemInfo, XmlNodePtr node);
+static void loadFloorSprite(SpriteDisplay *display, XmlNodePtr node);
+static void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode);
+static void loadOrderSprite(ItemInfo *itemInfo, XmlNodePtr node,
bool drawAfter);
static int parseSpriteName(std::string name);
static int parseDirectionName(std::string name);
@@ -174,9 +172,9 @@ void ItemDB::load()
mUnknown->addTag(mTags["All"]);
XML::Document doc("items.xml");
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items"))
+ if (!rootNode || !xmlNameEqual(rootNode, "items"))
{
logger->log("ItemDB: Error while loading items.xml!");
mLoaded = true;
@@ -185,7 +183,7 @@ void ItemDB::load()
for_each_xml_child_node(node, rootNode)
{
- if (!xmlStrEqual(node->name, BAD_CAST "item"))
+ if (!xmlNameEqual(node, "item"))
continue;
int id = XML::getProperty(node, "id", 0);
@@ -326,7 +324,7 @@ void ItemDB::load()
for_each_xml_child_node(itemChild, node)
{
- if (xmlStrEqual(itemChild->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(itemChild, "sprite"))
{
std::string attackParticle = XML::getProperty(
itemChild, "particle-effect", "");
@@ -334,23 +332,23 @@ void ItemDB::load()
loadSpriteRef(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "sound"))
+ else if (xmlNameEqual(itemChild, "sound"))
{
loadSoundRef(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "floor"))
+ else if (xmlNameEqual(itemChild, "floor"))
{
loadFloorSprite(&display, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "replace"))
+ else if (xmlNameEqual(itemChild, "replace"))
{
loadReplaceSprite(itemInfo, itemChild);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "drawAfter"))
+ else if (xmlNameEqual(itemChild, "drawAfter"))
{
loadOrderSprite(itemInfo, itemChild, true);
}
- else if (xmlStrEqual(itemChild->name, BAD_CAST "drawBefore"))
+ else if (xmlNameEqual(itemChild, "drawBefore"))
{
loadOrderSprite(itemInfo, itemChild, false);
}
@@ -595,7 +593,7 @@ int parseDirectionName(std::string name)
return id;
}
-void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node)
+void loadSpriteRef(ItemInfo *itemInfo, XmlNodePtr node)
{
std::string gender = XML::getProperty(node, "gender", "unisex");
std::string filename = reinterpret_cast<const char*>(
@@ -607,7 +605,7 @@ void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node)
itemInfo->setSprite(filename, GENDER_FEMALE);
}
-void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node)
+void loadSoundRef(ItemInfo *itemInfo, XmlNodePtr node)
{
std::string event = XML::getProperty(node, "event", "");
std::string filename = reinterpret_cast<const char*>(
@@ -628,11 +626,11 @@ void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node)
}
}
-void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode)
+void loadFloorSprite(SpriteDisplay *display, XmlNodePtr floorNode)
{
for_each_xml_child_node(spriteNode, floorNode)
{
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -641,7 +639,7 @@ void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode)
= XML::getProperty(spriteNode, "variant", 0);
display->sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
@@ -650,7 +648,7 @@ void loadFloorSprite(SpriteDisplay *display, xmlNodePtr floorNode)
}
}
-void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
+void loadReplaceSprite(ItemInfo *itemInfo, XmlNodePtr replaceNode)
{
std::string removeSprite = XML::getProperty(replaceNode, "sprite", "");
int direction = parseDirectionName(XML::getProperty(
@@ -671,7 +669,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
continue;
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -693,7 +691,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -726,7 +724,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -756,7 +754,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
return;
for_each_xml_child_node(itemNode, replaceNode)
{
- if (xmlStrEqual(itemNode->name, BAD_CAST "item"))
+ if (xmlNameEqual(itemNode, "item"))
{
int from = XML::getProperty(itemNode, "from", 0);
int to = XML::getProperty(itemNode, "to", 1);
@@ -768,7 +766,7 @@ void loadReplaceSprite(ItemInfo *itemInfo, xmlNodePtr replaceNode)
}
}
-void loadOrderSprite(ItemInfo *itemInfo, xmlNodePtr node, bool drawAfter)
+void loadOrderSprite(ItemInfo *itemInfo, XmlNodePtr node, bool drawAfter)
{
int sprite = parseSpriteName(XML::getProperty(node, "name", ""));
int priority = XML::getProperty(node, "priority", 0);
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 71f0a490e..e56840c16 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index dfcff3f76..f163fc590 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 1fe8f3bad..8c5e2dd8f 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp
index e7288e039..b186ad658 100644
--- a/src/resources/mapdb.cpp
+++ b/src/resources/mapdb.cpp
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -27,8 +27,6 @@
#include "utils/xml.h"
-#include <libxml/tree.h>
-
#include "debug.h"
namespace
@@ -45,7 +43,7 @@ void MapDB::load()
XML::Document *doc = new XML::Document(
paths.getStringValue("maps") + "remap.xml");
- xmlNodePtr root = doc->rootNode();
+ XmlNodePtr root = doc->rootNode();
if (!root)
{
delete doc;
@@ -54,7 +52,7 @@ void MapDB::load()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "map"))
+ if (xmlNameEqual(node, "map"))
{
std::string name = XML::getProperty(node, "name", "");
if (name.empty())
diff --git a/src/resources/mapdb.h b/src/resources/mapdb.h
index 2ba084297..d249a5cc6 100644
--- a/src/resources/mapdb.h
+++ b/src/resources/mapdb.h
@@ -1,7 +1,7 @@
/*
* Color database
* Copyright (C) 2008 Aethyra Development Team
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 68d39f0ae..8d71779f2 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -35,7 +35,6 @@
#include "utils/base64.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include "utils/xml.h"
#include <iostream>
#include <zlib.h>
@@ -223,12 +222,12 @@ Map *MapReader::readMap(const std::string &filename,
XML::Document doc(reinterpret_cast<char*>(inflated), inflatedSize);
free(inflated);
- xmlNodePtr node = doc.rootNode();
+ XmlNodePtr node = doc.rootNode();
// Parse the inflated map data
if (node)
{
- if (!xmlStrEqual(node->name, BAD_CAST "map"))
+ if (!xmlNameEqual(node, "map"))
logger->log("Error: Not a map file (%s)!", realFilename.c_str());
else
map = readMap(node, realFilename);
@@ -248,7 +247,7 @@ Map *MapReader::readMap(const std::string &filename,
return map;
}
-Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
+Map *MapReader::readMap(XmlNodePtr node, const std::string &path)
{
if (!node)
return nullptr;
@@ -277,23 +276,23 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
for_each_xml_child_node(childNode, node)
{
- if (xmlStrEqual(childNode->name, BAD_CAST "tileset"))
+ if (xmlNameEqual(childNode, "tileset"))
{
Tileset *tileset = readTileset(childNode, pathDir, map);
if (tileset)
map->addTileset(tileset);
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "layer"))
+ else if (xmlNameEqual(childNode, "layer"))
{
readLayer(childNode, map);
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "properties"))
+ else if (xmlNameEqual(childNode, "properties"))
{
readProperties(childNode, map);
map->setVersion(atoi(map->getProperty(
"manaplus version").c_str()));
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup"))
+ else if (xmlNameEqual(childNode, "objectgroup"))
{
// The object group offset is applied to each object individually
const int tileOffsetX = XML::getProperty(childNode, "x", 0);
@@ -303,7 +302,7 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
for_each_xml_child_node(objectNode, childNode)
{
- if (xmlStrEqual(objectNode->name, BAD_CAST "object"))
+ if (xmlNameEqual(objectNode, "object"))
{
std::string objType = XML::getProperty(
objectNode, "type", "");
@@ -380,14 +379,14 @@ Map *MapReader::readMap(xmlNodePtr node, const std::string &path)
return map;
}
-void MapReader::readProperties(xmlNodePtr node, Properties *props)
+void MapReader::readProperties(XmlNodePtr node, Properties *props)
{
if (!node || !props)
return;
for_each_xml_child_node(childNode, node)
{
- if (!xmlStrEqual(childNode->name, BAD_CAST "property"))
+ if (!xmlNameEqual(childNode, "property"))
continue;
// Example: <property name="name" value="value"/>
@@ -443,7 +442,7 @@ inline static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
}
}
-void MapReader::readLayer(xmlNodePtr node, Map *map)
+void MapReader::readLayer(XmlNodePtr node, Map *map)
{
// Layers are not necessarily the same size as the map
const int w = XML::getProperty(node, "width", map->getWidth());
@@ -473,7 +472,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
// Load the tile data
for_each_xml_child_node(childNode, node)
{
- if (!xmlStrEqual(childNode->name, BAD_CAST "data"))
+ if (!xmlNameEqual(childNode, "data"))
continue;
const std::string encoding =
@@ -492,7 +491,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
// Read base64 encoded map file
- xmlNodePtr dataChild = childNode->xmlChildrenNode;
+ XmlNodePtr dataChild = childNode->xmlChildrenNode;
if (!dataChild)
continue;
@@ -577,7 +576,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
else if (encoding == "csv")
{
- xmlNodePtr dataChild = childNode->xmlChildrenNode;
+ XmlNodePtr dataChild = childNode->xmlChildrenNode;
if (!dataChild)
continue;
@@ -620,7 +619,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
// Read plain XML map file
for_each_xml_child_node(childNode2, childNode)
{
- if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
+ if (!xmlNameEqual(childNode2, "tile"))
continue;
const int gid = XML::getProperty(childNode2, "gid", -1);
@@ -647,7 +646,7 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
-Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
+Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
Map *map)
{
if (!map)
@@ -679,7 +678,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
for_each_xml_child_node(childNode, node)
{
- if (xmlStrEqual(childNode->name, BAD_CAST "image"))
+ if (xmlNameEqual(childNode, "image"))
{
const std::string source = XML::getProperty(
childNode, "source", "");
@@ -704,11 +703,11 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
}
}
}
- else if (xmlStrEqual(childNode->name, BAD_CAST "tile"))
+ else if (xmlNameEqual(childNode, "tile"))
{
for_each_xml_child_node(tileNode, childNode)
{
- if (!xmlStrEqual(tileNode->name, BAD_CAST "properties"))
+ if (!xmlNameEqual(tileNode, "properties"))
continue;
int tileGID = firstGid + XML::getProperty(childNode, "id", 0);
@@ -717,7 +716,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path,
std::map<std::string, int> tileProperties;
for_each_xml_child_node(propertyNode, tileNode)
{
- if (!xmlStrEqual(propertyNode->name, BAD_CAST "property"))
+ if (!xmlNameEqual(propertyNode, "property"))
continue;
std::string name = XML::getProperty(
propertyNode, "name", "");
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index c15a83b6f..c9c742ecd 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,7 +23,7 @@
#ifndef MAPREADER_H
#define MAPREADER_H
-#include <libxml/tree.h>
+#include "utils/xml.h"
#include <string>
@@ -47,7 +47,7 @@ class MapReader
* Read an XML map from a parsed XML tree. The path is used to find the
* location of referenced tileset images.
*/
- static Map *readMap(xmlNodePtr node, const std::string &path);
+ static Map *readMap(XmlNodePtr node, const std::string &path);
private:
/**
@@ -57,17 +57,17 @@ class MapReader
* @param props The Properties instance to which the properties will
* be assigned.
*/
- static void readProperties(xmlNodePtr node, Properties* props);
+ static void readProperties(XmlNodePtr node, Properties* props);
/**
* Reads a map layer and adds it to the given map.
*/
- static void readLayer(xmlNodePtr node, Map *map);
+ static void readLayer(XmlNodePtr node, Map *map);
/**
* Reads a tile set.
*/
- static Tileset *readTileset(xmlNodePtr node, const std::string &path,
+ static Tileset *readTileset(XmlNodePtr node, const std::string &path,
Map *map);
};
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index dbf9d3e9a..9d295db35 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -52,9 +52,9 @@ void MonsterDB::load()
logger->log1("Initializing monster database...");
XML::Document doc("monsters.xml");
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters"))
+ if (!rootNode || !xmlNameEqual(rootNode, "monsters"))
{
logger->log("Monster Database: Error while loading monster.xml!");
mLoaded = true;
@@ -71,7 +71,7 @@ void MonsterDB::load()
//iterate <monster>s
for_each_xml_child_node(monsterNode, rootNode)
{
- if (!xmlStrEqual(monsterNode->name, BAD_CAST "monster"))
+ if (!xmlNameEqual(monsterNode, "monster"))
continue;
BeingInfo *currentInfo = new BeingInfo;
@@ -119,7 +119,7 @@ void MonsterDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -129,7 +129,7 @@ void MonsterDB::load()
spriteNode, "variant", 0);
display.sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "sound"))
+ else if (xmlNameEqual(spriteNode, "sound"))
{
std::string event = XML::getProperty(spriteNode, "event", "");
const char *filename;
@@ -172,7 +172,7 @@ void MonsterDB::load()
currentInfo->getName().c_str());
}
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "attack"))
+ else if (xmlNameEqual(spriteNode, "attack"))
{
const int id = XML::getProperty(spriteNode, "id", 0);
const std::string particleEffect = XML::getProperty(
@@ -185,7 +185,7 @@ void MonsterDB::load()
currentInfo->addAttack(id, spriteAction,
particleEffect, missileParticle);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
display.particles.push_back(reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content));
diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h
index 1a9d0e64f..3ddc68c08 100644
--- a/src/resources/monsterdb.h
+++ b/src/resources/monsterdb.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index 099d030b0..b13812f18 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -26,30 +26,21 @@
#include "debug.h"
-Music::Music(Mix_Chunk *music):
- mChunk(music),
- mChannel(-1)
+Music::Music(Mix_Music *music) :
+ mMusic(music)
{
}
Music::~Music()
{
- //Mix_FreeMusic(music);
- Mix_FreeChunk(mChunk);
+ Mix_FreeMusic(mMusic);
}
-Resource *Music::load(void *buffer, unsigned bufferSize)
+Resource *Music::load(SDL_RWops *rw)
{
- // Load the raw file data from the buffer in an RWops structure
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
-
- // Use Mix_LoadMUS to load the raw music data
- //Mix_Music* music = Mix_LoadMUS_RW(rw); Need to be implemeted
- Mix_Chunk *tmpMusic = Mix_LoadWAV_RW(rw, 1);
-
- if (tmpMusic)
+ if (Mix_Music *music = Mix_LoadMUS_RW(rw))
{
- return new Music(tmpMusic);
+ return new Music(music);
}
else
{
@@ -58,30 +49,10 @@ Resource *Music::load(void *buffer, unsigned bufferSize)
}
}
-bool Music::play(int loops)
-{
- /*
- * Warning: loops should be always set to -1 (infinite) with current
- * implementation to avoid halting the playback of other samples
- */
-
- /*if (Mix_PlayMusic(music, loops))
- return true;*/
- Mix_VolumeChunk(mChunk, 120);
- mChannel = Mix_PlayChannel(-1, mChunk, loops);
-
- return mChannel != -1;
-}
-
-void Music::stop()
+bool Music::play(int loops, int fadeIn)
{
- /*
- * Warning: very dungerous trick, it could try to stop channels occupied
- * by samples rather than the current music file
- */
-
- //Mix_HaltMusic();
-
- if (mChannel != -1)
- Mix_HaltChannel(mChannel);
+ if (fadeIn > 0)
+ return Mix_FadeInMusic(mMusic, loops, fadeIn);
+ else
+ return Mix_PlayMusic(mMusic, loops);
}
diff --git a/src/resources/music.h b/src/resources/music.h
index a4b5b4973..88cc752bc 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -41,38 +41,32 @@ class Music : public Resource
/**
* Loads a music from a buffer in memory.
*
- * @param buffer The memory buffer containing the music data.
- * @param bufferSize The size of the memory buffer in bytes.
+ * @param rw The SDL_RWops to load the music data from.
*
* @return <code>NULL</code> if the an error occurred, a valid pointer
* otherwise.
*/
- static Resource *load(void *buffer, unsigned bufferSize);
+ static Resource *load(SDL_RWops *rw);
/**
* Plays the music.
*
- * @param loops Number of times to repeat the playback.
+ * @param loops Number of times to repeat the playback (-1 means
+ * forever).
+ * @param fadeIn Duration in milliseconds to fade in the music.
*
* @return <code>true</code> if the playback started properly
* <code>false</code> otherwise.
*/
- virtual bool play(int loops);
-
- /**
- * Stops the music.
- */
- virtual void stop();
+ bool play(int loops = -1, int fadeIn = 0);
protected:
/**
* Constructor.
*/
- Music(Mix_Chunk *music);
+ Music(Mix_Music *music);
- //Mix_Music *music;
- Mix_Chunk *mChunk;
- int mChannel;
+ Mix_Music *mMusic;
};
#endif
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index d04a2518f..832fa26d6 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -46,9 +46,9 @@ void NPCDB::load()
logger->log1("Initializing NPC database...");
XML::Document doc("npcs.xml");
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs"))
+ if (!rootNode || !xmlNameEqual(rootNode, "npcs"))
{
logger->log("NPC Database: Error while loading npcs.xml!");
mLoaded = true;
@@ -58,7 +58,7 @@ void NPCDB::load()
//iterate <npc>s
for_each_xml_child_node(npcNode, rootNode)
{
- if (!xmlStrEqual(npcNode->name, BAD_CAST "npc"))
+ if (!xmlNameEqual(npcNode, "npc"))
continue;
int id = XML::getProperty(npcNode, "id", 0);
@@ -84,7 +84,7 @@ void NPCDB::load()
if (!spriteNode->xmlChildrenNode)
continue;
- if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlNameEqual(spriteNode, "sprite"))
{
SpriteReference *currentSprite = new SpriteReference;
currentSprite->sprite = reinterpret_cast<const char*>(
@@ -93,7 +93,7 @@ void NPCDB::load()
XML::getProperty(spriteNode, "variant", 0);
display.sprites.push_back(currentSprite);
}
- else if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
+ else if (xmlNameEqual(spriteNode, "particlefx"))
{
std::string particlefx = reinterpret_cast<const char*>(
spriteNode->xmlChildrenNode->content);
diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h
index 1d8a72aa6..9b686691a 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 552af06ec..e9449f0c9 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/resource.h b/src/resources/resource.h
index 7196fa916..b8e06aaa7 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index c7552b9b7..c26526b97 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -35,6 +35,7 @@
#include "resources/spritedef.h"
#include "utils/mkdir.h"
+#include "utils/physfsrwops.h"
#include <physfs.h>
#include <SDL_image.h>
@@ -42,6 +43,7 @@
#include <fstream>
#include <iostream>
#include <sstream>
+#include <zlib.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -397,19 +399,16 @@ struct ResourceLoader
ResourceManager *manager;
std::string path;
ResourceManager::loader fun;
+
static Resource *load(void *v)
{
if (!v)
return nullptr;
ResourceLoader *l = static_cast< ResourceLoader * >(v);
- int fileSize;
- if (!l->manager)
+ SDL_RWops *rw = PHYSFSRWOPS_openRead(l->path.c_str());
+ if (!rw)
return nullptr;
- void *buffer = l->manager->loadFile(l->path, fileSize);
- if (!buffer)
- return nullptr;
- Resource *res = l->fun(buffer, fileSize);
- free(buffer);
+ Resource *res = l->fun(rw);
return res;
}
};
@@ -451,16 +450,14 @@ struct DyedImageLoader
d = new Dye(path.substr(p + 1));
path = path.substr(0, p);
}
- int fileSize;
- void *buffer = l->manager->loadFile(path, fileSize);
- if (!buffer)
+ SDL_RWops *rw = PHYSFSRWOPS_openRead(path.c_str());
+ if (!rw)
{
delete d;
- return 0;
+ return nullptr;
}
- Resource *res = d ? Image::load(buffer, fileSize, *d)
- : Image::load(buffer, fileSize);
- free(buffer);
+ Resource *res = d ? Image::load(rw, *d)
+ : Image::load(rw);
delete d;
return res;
}
@@ -695,18 +692,10 @@ void ResourceManager::saveTextFile(std::string path, std::string name,
SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename)
{
- int fileSize;
- void *buffer = loadFile(filename, fileSize);
- SDL_Surface *tmp = nullptr;
-
- if (buffer)
- {
- SDL_RWops *rw = SDL_RWFromMem(buffer, fileSize);
- tmp = IMG_Load_RW(rw, 1);
- ::free(buffer);
- }
-
- return tmp;
+ SDL_Surface *surface = nullptr;
+ if (SDL_RWops *rw = PHYSFSRWOPS_openRead(filename.c_str()))
+ surface = IMG_Load_RW(rw, 1);
+ return surface;
}
void ResourceManager::scheduleDelete(SDL_Surface* surface)
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 8cc851cca..7b61e2eaa 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -37,7 +37,9 @@ class Music;
class Resource;
class SoundEffect;
class SpriteDef;
+
struct SDL_Surface;
+struct SDL_RWops;
/**
* A class for loading and managing resources.
@@ -48,7 +50,7 @@ class ResourceManager
public:
- typedef Resource *(*loader)(void *, unsigned);
+ typedef Resource *(*loader)(SDL_RWops *);
typedef Resource *(*generator)(void *);
ResourceManager();
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index a8da8dd80..6a3a980a7 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -31,14 +31,10 @@ SoundEffect::~SoundEffect()
Mix_FreeChunk(mChunk);
}
-Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
+Resource *SoundEffect::load(SDL_RWops *rw)
{
- if (!buffer)
+ if (!rw)
return nullptr;
-
- // Load the raw file data from the buffer in an RWops structure
- SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
-
// Load the music data and free the RWops structure
Mix_Chunk *tmpSoundEffect = Mix_LoadWAV_RW(rw, 1);
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index fdd4bd275..0df7f50d5 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -41,13 +41,12 @@ class SoundEffect : public Resource
/**
* Loads a sample from a buffer in memory.
*
- * @param buffer The memory buffer containing the sample data.
- * @param bufferSize The size of the memory buffer in bytes.
+ * @param rw The SDL_RWops to load the sample data from.
*
* @return <code>NULL</code> if the an error occurred, a valid pointer
* otherwise.
*/
- static Resource *load(void *buffer, unsigned bufferSize);
+ static Resource *load(SDL_RWops *rw);
/**
* Plays the sample.
diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp
index 51ba4bc74..b1a3a9c4d 100644
--- a/src/resources/specialdb.cpp
+++ b/src/resources/specialdb.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -55,9 +55,9 @@ void SpecialDB::load()
logger->log("Initializing special database...");
XML::Document doc("specials.xml");
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "specials"))
+ if (!root || !xmlNameEqual(root, "specials"))
{
logger->log("Error loading specials file specials.xml");
return;
@@ -67,13 +67,13 @@ void SpecialDB::load()
for_each_xml_child_node(set, root)
{
- if (xmlStrEqual(set->name, BAD_CAST "set"))
+ if (xmlNameEqual(set, "set"))
{
setName = XML::getProperty(set, "name", "Actions");
for_each_xml_child_node(special, set)
{
- if (xmlStrEqual(special->name, BAD_CAST "special"))
+ if (xmlNameEqual(special, "special"))
{
SpecialInfo *info = new SpecialInfo();
int id = XML::getProperty(special, "id", 0);
diff --git a/src/resources/specialdb.h b/src/resources/specialdb.h
index 8a9e6bb23..f6ef73862 100644
--- a/src/resources/specialdb.h
+++ b/src/resources/specialdb.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 32d18b6b8..0d9b95f6f 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -33,8 +33,6 @@
#include "configuration.h"
-#include "utils/xml.h"
-
#include "debug.h"
SpriteReference *SpriteReference::Empty = nullptr;
@@ -83,9 +81,9 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, int variant)
palettes = animationFile.substr(pos + 1);
XML::Document doc(animationFile.substr(0, pos));
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite"))
+ if (!rootNode || !xmlNameEqual(rootNode, "sprite"))
{
logger->log("Error, failed to parse %s", animationFile.c_str());
@@ -136,7 +134,7 @@ void SpriteDef::substituteActions()
substituteAction(SpriteAction::SPAWN, SpriteAction::STAND);
}
-void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant,
+void SpriteDef::loadSprite(XmlNodePtr spriteNode, int variant,
const std::string &palettes)
{
// Get the variant
@@ -151,16 +149,16 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant,
for_each_xml_child_node(node, spriteNode)
{
- if (xmlStrEqual(node->name, BAD_CAST "imageset"))
+ if (xmlNameEqual(node, "imageset"))
loadImageSet(node, palettes);
- else if (xmlStrEqual(node->name, BAD_CAST "action"))
+ else if (xmlNameEqual(node, "action"))
loadAction(node, variant_offset);
- else if (xmlStrEqual(node->name, BAD_CAST "include"))
+ else if (xmlNameEqual(node, "include"))
includeSprite(node);
}
}
-void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes)
+void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes)
{
const std::string name = XML::getProperty(node, "name", "");
@@ -188,7 +186,7 @@ void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes)
mImageSets[name] = imageSet;
}
-void SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
+void SpriteDef::loadAction(XmlNodePtr node, int variant_offset)
{
const std::string actionName = XML::getProperty(node, "name", "");
const std::string imageSetName = XML::getProperty(node, "imageset", "");
@@ -225,12 +223,12 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
// Load animations
for_each_xml_child_node(animationNode, node)
{
- if (xmlStrEqual(animationNode->name, BAD_CAST "animation"))
+ if (xmlNameEqual(animationNode, "animation"))
loadAnimation(animationNode, action, imageSet, variant_offset);
}
}
-void SpriteDef::loadAnimation(xmlNodePtr animationNode,
+void SpriteDef::loadAnimation(XmlNodePtr animationNode,
Action *action, ImageSet *imageSet,
int variant_offset)
{
@@ -264,7 +262,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
offsetY -= imageSet->getHeight() - 32;
offsetX -= imageSet->getWidth() / 2 - 16;
- if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
+ if (xmlNameEqual(frameNode, "frame"))
{
const int index = XML::getProperty(frameNode, "index", -1);
@@ -284,7 +282,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
animation->addFrame(img, delay, offsetX, offsetY, rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
+ else if (xmlNameEqual(frameNode, "sequence"))
{
const int start = XML::getProperty(frameNode, "start", -1);
const int end = XML::getProperty(frameNode, "end", -1);
@@ -324,22 +322,22 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
repeat --;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
animation->addTerminator(rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "jump"))
+ else if (xmlNameEqual(frameNode, "jump"))
{
animation->addJump(XML::getProperty(
frameNode, "action", ""), rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "label"))
+ else if (xmlNameEqual(frameNode, "label"))
{
std::string name = XML::getProperty(frameNode, "name", "");
if (!name.empty())
animation->addLabel(name);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "goto"))
+ else if (xmlNameEqual(frameNode, "goto"))
{
std::string name = XML::getProperty(frameNode, "label", "");
if (!name.empty())
@@ -348,7 +346,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
} // for frameNode
}
-void SpriteDef::includeSprite(xmlNodePtr includeNode)
+void SpriteDef::includeSprite(XmlNodePtr includeNode)
{
std::string filename = XML::getProperty(includeNode, "file", "");
@@ -365,9 +363,9 @@ void SpriteDef::includeSprite(xmlNodePtr includeNode)
mProcessedFiles.insert(filename);
XML::Document doc(filename);
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "sprite"))
+ if (!rootNode || !xmlNameEqual(rootNode, "sprite"))
{
logger->log("Error, no sprite root node in %s", filename.c_str());
return;
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 3aa6369dd..0490bdcb3 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,7 +25,7 @@
#include "resources/resource.h"
-#include <libxml/tree.h>
+#include "utils/xml.h"
#include <list>
#include <map>
@@ -145,30 +145,30 @@ class SpriteDef : public Resource
/**
* Loads a sprite element.
*/
- void loadSprite(xmlNodePtr spriteNode, int variant,
+ void loadSprite(XmlNodePtr spriteNode, int variant,
const std::string &palettes = "");
/**
* Loads an imageset element.
*/
- void loadImageSet(xmlNodePtr node, const std::string &palettes);
+ void loadImageSet(XmlNodePtr node, const std::string &palettes);
/**
* Loads an action element.
*/
- void loadAction(xmlNodePtr node, int variant_offset);
+ void loadAction(XmlNodePtr node, int variant_offset);
/**
* Loads an animation element.
*/
- void loadAnimation(xmlNodePtr animationNode,
+ void loadAnimation(XmlNodePtr animationNode,
Action *action, ImageSet *imageSet,
int variant_offset);
/**
* Include another sprite into this one.
*/
- void includeSprite(xmlNodePtr includeNode);
+ void includeSprite(XmlNodePtr includeNode);
/**
* Complete missing actions by copying existing ones.
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index c8cd5ad60..7ebc5a11a 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/resources/wallpaper.h b/src/resources/wallpaper.h
index 55f5eec93..7123cfd96 100644
--- a/src/resources/wallpaper.h
+++ b/src/resources/wallpaper.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/rotationalparticle.cpp b/src/rotationalparticle.cpp
index c7c0d10bf..f92b0f3eb 100644
--- a/src/rotationalparticle.cpp
+++ b/src/rotationalparticle.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -34,9 +34,9 @@ RotationalParticle::RotationalParticle(Map *map, Animation *animation):
{
}
-RotationalParticle::RotationalParticle(Map *map, xmlNodePtr animationNode,
+RotationalParticle::RotationalParticle(Map *map, XmlNodePtr animationNode,
const std::string& dyePalettes):
- ImageParticle(map, 0),
+ ImageParticle(map, nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
{
}
@@ -61,12 +61,12 @@ bool RotationalParticle::update()
float rad = static_cast<float>(atan2(mVelocity.x, mVelocity.y));
if (rad < 0)
- rad = static_cast<float>(PI + (PI + rad));
+ rad = static_cast<float>(PI) + static_cast<float>(PI) + rad;
float range = static_cast<float>(PI / size);
// Determines which frame the particle should play
- if (rad < range || rad > ((PI*2) - range))
+ if (rad < range || rad > ((static_cast<float>(PI)*2) - range))
{
mAnimation->setFrame(0);
}
diff --git a/src/rotationalparticle.h b/src/rotationalparticle.h
index d5b91bc63..251e3769c 100644
--- a/src/rotationalparticle.h
+++ b/src/rotationalparticle.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -25,7 +25,7 @@
#include "imageparticle.h"
-#include <libxml/tree.h>
+#include "utils/xml.h"
class Animation;
class Map;
@@ -36,7 +36,7 @@ class RotationalParticle : public ImageParticle
public:
RotationalParticle(Map *map, Animation *animation);
- RotationalParticle(Map *map, xmlNodePtr animationNode,
+ RotationalParticle(Map *map, XmlNodePtr animationNode,
const std::string& dyePalettes = std::string());
~RotationalParticle();
diff --git a/src/shopitem.cpp b/src/shopitem.cpp
index db84d30df..083c2836f 100644
--- a/src/shopitem.cpp
+++ b/src/shopitem.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/shopitem.h b/src/shopitem.h
index 188698438..61d23a4ab 100644
--- a/src/shopitem.h
+++ b/src/shopitem.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 31f0c7af0..2b7cc328d 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -44,7 +44,7 @@ SimpleAnimation::SimpleAnimation(Animation *animation):
{
}
-SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode,
+SimpleAnimation::SimpleAnimation(XmlNodePtr animationNode,
const std::string& dyePalettes):
mAnimation(new Animation),
mAnimationTime(0),
@@ -136,7 +136,7 @@ Image *SimpleAnimation::getCurrentImage() const
return nullptr;
}
-void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
+void SimpleAnimation::initializeAnimation(XmlNodePtr animationNode,
const std::string& dyePalettes)
{
mInitialized = false;
@@ -161,7 +161,7 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
return;
// Get animation frames
- for (xmlNodePtr frameNode = animationNode->xmlChildrenNode;
+ for (XmlNodePtr frameNode = animationNode->xmlChildrenNode;
frameNode; frameNode = frameNode->next)
{
int delay = XML::getProperty(frameNode, "delay", 0);
@@ -171,7 +171,7 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
offsetY -= imageset->getHeight() - 32;
offsetX -= imageset->getWidth() / 2 - 16;
- if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
+ if (xmlNameEqual(frameNode, "frame"))
{
int index = XML::getProperty(frameNode, "index", -1);
@@ -192,7 +192,7 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
if (mAnimation)
mAnimation->addFrame(img, delay, offsetX, offsetY, rand);
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
+ else if (xmlNameEqual(frameNode, "sequence"))
{
int start = XML::getProperty(frameNode, "start", -1);
int end = XML::getProperty(frameNode, "end", -1);
@@ -218,7 +218,7 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode,
start++;
}
}
- else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
+ else if (xmlNameEqual(frameNode, "end"))
{
if (mAnimation)
mAnimation->addTerminator(rand);
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index 44aab9a25..de1203662 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -47,7 +47,7 @@ class SimpleAnimation
/**
* Creates a simple animation that creates its animation from XML Data.
*/
- SimpleAnimation(xmlNodePtr animationNode,
+ SimpleAnimation(XmlNodePtr animationNode,
const std::string& dyePalettes = std::string());
~SimpleAnimation();
@@ -68,7 +68,7 @@ class SimpleAnimation
Image *getCurrentImage() const;
private:
- void initializeAnimation(xmlNodePtr animationNode, const std::string&
+ void initializeAnimation(XmlNodePtr animationNode, const std::string&
dyePalettes = std::string());
/** The hosted animation. */
diff --git a/src/sound.cpp b/src/sound.cpp
index a573458ef..fb6958e25 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -27,6 +27,7 @@
#include "logger.h"
#include "sound.h"
+#include "resources/music.h"
#include "resources/resourcemanager.h"
#include "resources/soundeffect.h"
@@ -184,84 +185,49 @@ void Sound::setSfxVolume(int volume)
Mix_Volume(-1, mSfxVolume);
}
-static Mix_Music *loadMusic(const std::string &filename)
+static Music *loadMusic(const std::string &fileName)
{
ResourceManager *resman = ResourceManager::getInstance();
- std::string path = resman->getPath(
- paths.getStringValue("music") + filename);
-
- if (path.find(".zip/") != std::string::npos ||
- path.find(".zip\\") != std::string::npos)
- {
- // Music file is a virtual file inside a zip archive - we have to copy
- // it to a temporary physical file so that SDL_mixer can stream it.
- logger->log("Loading music \"%s\" from temporary file tempMusic.ogg",
- path.c_str());
- bool success = resman->copyFile(paths.getStringValue("music")
- + filename, "tempMusic.ogg");
- if (success)
- path = resman->getPath("tempMusic.ogg");
- else
- return nullptr;
- }
- else
- {
- logger->log("Loading music \"%s\"", path.c_str());
- }
-
- if (path.empty())
- return nullptr;
-
- Mix_Music *music = Mix_LoadMUS(path.c_str());
-
- if (!music)
- {
- logger->log("Mix_LoadMUS() Error loading '%s': %s", path.c_str(),
- Mix_GetError());
- }
-
- return music;
+ return resman->getMusic(paths.getStringValue("music") + fileName);
}
-void Sound::playMusic(const std::string &filename)
+void Sound::playMusic(const std::string &fileName)
{
- mCurrentMusicFile = filename;
+ mCurrentMusicFile = fileName;
if (!mInstalled || !mPlayMusic)
return;
haltMusic();
- if (!filename.empty() && (mMusic = loadMusic(filename)))
- Mix_PlayMusic(mMusic, -1); // Loop forever
+ if (!fileName.empty())
+ {
+ mMusic = loadMusic(fileName);
+ if (mMusic)
+ mMusic->play();
+ }
}
void Sound::stopMusic()
{
- if (!mInstalled)
- return;
-
- logger->log1("Sound::stopMusic()");
-
- if (mMusic)
- {
- Mix_HaltMusic();
- Mix_FreeMusic(mMusic);
- mMusic = nullptr;
- }
+ haltMusic();
}
-void Sound::fadeInMusic(const std::string &path, int ms)
+void Sound::fadeInMusic(const std::string &fileName, int ms)
{
- mCurrentMusicFile = path;
+ mCurrentMusicFile = fileName;
if (!mInstalled || !mPlayMusic)
return;
haltMusic();
- if ((mMusic = loadMusic(path.c_str())))
- Mix_FadeInMusic(mMusic, -1, ms); // Loop forever
+ if (!fileName.empty())
+ {
+ mMusic = loadMusic(fileName);
+ if (mMusic)
+ mMusic->play(-1, ms);
+ }
}
void Sound::fadeOutMusic(int ms)
@@ -285,9 +251,9 @@ void Sound::fadeOutMusic(int ms)
}
}
-void Sound::fadeOutAndPlayMusic(const std::string &path, int ms)
+void Sound::fadeOutAndPlayMusic(const std::string &fileName, int ms)
{
- mNextMusicPath = path;
+ mNextMusicFile = fileName;
fadeOutMusic(ms);
}
@@ -297,15 +263,15 @@ void Sound::logic()
{
if (mMusic)
{
- Mix_FreeMusic(mMusic);
+ mMusic->decRef();
mMusic = nullptr;
}
sFadingOutEnded = false;
- if (!mNextMusicPath.empty())
+ if (!mNextMusicFile.empty())
{
- playMusic(mNextMusicPath);
- mNextMusicPath.clear();
+ playMusic(mNextMusicFile);
+ mNextMusicFile.clear();
}
}
}
@@ -349,9 +315,13 @@ void Sound::playGuiSfx(const std::string &path)
if (!mInstalled || path.empty() || !mPlayGui)
return;
+ std::string tmpPath;
+ if (!path.compare(0, 4, "sfx/"))
+ tmpPath = path;
+ else
+ tmpPath = paths.getValue("sfx", "sfx/") + path;
ResourceManager *resman = ResourceManager::getInstance();
- SoundEffect *sample = resman->getSoundEffect(
- paths.getStringValue("sfx") + path);
+ SoundEffect *sample = resman->getSoundEffect(tmpPath);
if (sample)
{
logger->log("Sound::playGuiSfx() Playing: %s", path.c_str());
@@ -379,8 +349,11 @@ void Sound::haltMusic()
return;
Mix_HaltMusic();
- Mix_FreeMusic(mMusic);
- mMusic = nullptr;
+ if (mMusic)
+ {
+ mMusic->decRef();
+ mMusic = nullptr;
+ }
}
void Sound::changeAudio()
diff --git a/src/sound.h b/src/sound.h
index 16fff161b..869f136da 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -29,6 +29,8 @@
#include <string>
+class Music;
+
/** Sound engine
*
* \ingroup CORE
@@ -54,9 +56,9 @@ class Sound : public ConfigListener
/**
* Starts background music.
*
- * @param path The full path to the music file.
+ * @param fileName The name of the music file.
*/
- void playMusic(const std::string &path);
+ void playMusic(const std::string &fileName);
/**
* Stops currently running background music track.
@@ -66,10 +68,10 @@ class Sound : public ConfigListener
/**
* Fades in background music.
*
- * @param path The full path to the music file.
- * @param ms Duration of fade-in effect (ms)
+ * @param fileName The name of the music file.
+ * @param ms Duration of fade-in effect (ms)
*/
- void fadeInMusic(const std::string &path, int ms = 1000);
+ void fadeInMusic(const std::string &fileName, int ms = 1000);
/**
* Fades out currently running background music track.
@@ -81,15 +83,16 @@ class Sound : public ConfigListener
/**
* Fades out a background music and play a new one.
*
- * @param path The full path to the fade in music file.
- * @param ms Duration of fade-out effect (ms)
+ * @param fileName The name of the music file.
+ * @param ms Duration of fade-out effect (ms)
*/
- void fadeOutAndPlayMusic(const std::string &path, int ms = 1000);
+ void fadeOutAndPlayMusic(const std::string &fileName, int ms = 1000);
int getMaxVolume() const
{ return MIX_MAX_VOLUME; }
void setMusicVolume(int volume);
+
void setSfxVolume(int volume);
/**
@@ -133,7 +136,7 @@ class Sound : public ConfigListener
* When calling fadeOutAndPlayMusic(),
* the music file below will then be played
*/
- std::string mNextMusicPath;
+ std::string mNextMusicFile;
bool mInstalled;
@@ -141,7 +144,7 @@ class Sound : public ConfigListener
int mMusicVolume;
std::string mCurrentMusicFile;
- Mix_Music *mMusic;
+ Music *mMusic;
bool mPlayBattle;
bool mPlayGui;
bool mPlayMusic;
diff --git a/src/sprite.h b/src/sprite.h
index 64721b740..ffee97d49 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index f7bffc31f..a7e06a2f4 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -37,7 +37,7 @@
#define STATUS_EFFECTS_FILE "status-effects.xml"
-void unloadMap(std::map<int, StatusEffect *> map);
+void unloadMap(std::map<int, StatusEffect *> &map);
bool StatusEffect::mLoaded = false;
@@ -130,9 +130,9 @@ void StatusEffect::load()
unload();
XML::Document doc(STATUS_EFFECTS_FILE);
- xmlNodePtr rootNode = doc.rootNode();
+ XmlNodePtr rootNode = doc.rootNode();
- if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "status-effects"))
+ if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
{
logger->log1("Error loading status effects file: "
STATUS_EFFECTS_FILE);
@@ -145,7 +145,7 @@ void StatusEffect::load()
int index = atoi(XML::getProperty(node, "id", "-1").c_str());
- if (xmlStrEqual(node->name, BAD_CAST "status-effect"))
+ if (xmlNameEqual(node, "status-effect"))
{
the_map = &statusEffects;
int block_index = atoi(XML::getProperty(
@@ -155,8 +155,10 @@ void StatusEffect::load()
blockEffectIndexMap[block_index] = index;
}
- else if (xmlStrEqual(node->name, BAD_CAST "stun-effect"))
+ else if (xmlNameEqual(node, "stun-effect"))
+ {
the_map = &stunEffects;
+ }
if (the_map)
{
@@ -187,7 +189,7 @@ void StatusEffect::load()
mLoaded = true;
}
-void unloadMap(std::map<int, StatusEffect *> map)
+void unloadMap(std::map<int, StatusEffect *> &map)
{
std::map<int, StatusEffect *>::iterator it;
diff --git a/src/statuseffect.h b/src/statuseffect.h
index 8af1607a5..326a0d3c1 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
new file mode 100644
index 000000000..d3caa8938
--- /dev/null
+++ b/src/test/testlauncher.cpp
@@ -0,0 +1,172 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "test/testlauncher.h"
+
+#include "client.h"
+#include "configuration.h"
+#include "graphics.h"
+#include "localconsts.h"
+#include "logger.h"
+#include "sound.h"
+
+#include "gui/theme.h"
+
+#include "utils/gettext.h"
+#include "utils/mkdir.h"
+#include "utils/stringutils.h"
+
+#include "resources/image.h"
+#include "resources/wallpaper.h"
+
+#include <unistd.h>
+
+#ifdef WIN32
+#include <windows.h>
+#define sleep(seconds) Sleep((seconds) * 1000)
+#endif
+
+//#include <unistd.h>
+
+#include "debug.h"
+
+TestLauncher::TestLauncher(std::string test) :
+ mTest(test)
+{
+ file.open((Client::getLocalDataDirectory()
+ + std::string("/test.log")).c_str(), std::ios::out);
+}
+
+TestLauncher::~TestLauncher()
+{
+ file.close();
+}
+
+int TestLauncher::exec()
+{
+ if (mTest == "1" || mTest == "2" || mTest == "3")
+ return testBackend();
+ else if (mTest == "4")
+ return testSound();
+ else if (mTest == "5" || mTest == "6" || mTest == "7")
+ return testRescale();
+ else if (mTest == "8" || mTest == "9" || mTest == "10")
+ return testFps();
+
+ return -1;
+}
+
+int TestLauncher::testBackend()
+{
+ Image *img = Theme::getImageFromTheme("graphics/sprites/arrow_up.gif");
+ if (!img)
+ return 1;
+ int cnt = 100;
+
+ for (int f = 0; f < cnt; f ++)
+ {
+ mainGraphics->drawImage(img, cnt * 7, cnt * 5);
+ mainGraphics->updateScreen();
+ }
+
+ sleep(1);
+ return 0;
+}
+
+int TestLauncher::testSound()
+{
+ sound.playGuiSfx("system/newmessage.ogg");
+ sleep(1);
+ sound.playSfx("system/newmessage.ogg", 0, 0);
+ sound.playMusic("sfx/system/newmessage.ogg");
+ sleep(3);
+ sound.stopMusic();
+ return 0;
+}
+
+int TestLauncher::testRescale()
+{
+ Wallpaper::loadWallpapers();
+ const std::string wallpaperName = Wallpaper::getWallpaper(800, 600);
+ volatile Image *img = Theme::getImageFromTheme(wallpaperName);
+ if (!img)
+ return 1;
+
+ sleep(1);
+ return 0;
+}
+
+int TestLauncher::testFps()
+{
+ timeval start;
+ timeval end;
+
+ Wallpaper::loadWallpapers();
+ Wallpaper::getWallpaper(800, 600);
+ Image *img[4];
+
+ img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.gif");
+ img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_down.gif");
+ img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.gif");
+ img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.gif");
+ int idx = 0;
+
+ int cnt = 500;
+
+ gettimeofday(&start, nullptr);
+ for (int k = 0; k < cnt; k ++)
+ {
+ for (int x = 0; x < 800; x += 20)
+ {
+ for (int y = 0; y < 600; y += 25)
+ {
+ mainGraphics->drawImage(img[idx], x, y);
+ idx ++;
+ if (idx > 3)
+ idx = 0;
+ }
+ }
+ mainGraphics->updateScreen();
+ }
+
+ gettimeofday(&end, nullptr);
+ int tFps = calcFps(&start, &end, cnt);
+ file << mTest << std::endl;
+ file << tFps << std::endl;
+
+ sleep(1);
+ return 0;
+}
+
+int TestLauncher::calcFps(timeval *start, timeval *end, int calls)
+{
+ long mtime;
+ long seconds;
+ long useconds;
+
+ seconds = end->tv_sec - start->tv_sec;
+ useconds = end->tv_usec - start->tv_usec;
+
+ mtime = (seconds * 1000 + useconds / 1000.0) + 0.5;
+ if (mtime == 0)
+ return 100000;
+
+ return static_cast<long>(calls) * 1000 / mtime;
+}
diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h
new file mode 100644
index 000000000..b1031a9c1
--- /dev/null
+++ b/src/test/testlauncher.h
@@ -0,0 +1,54 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEST_TESTLAUNCHER_H
+#define TEST_TESTLAUNCHER_H
+
+#include "logger.h"
+
+#include <string>
+#include <sys/time.h>
+
+class TestLauncher
+{
+ public:
+ TestLauncher(std::string test);
+
+ ~TestLauncher();
+
+ int exec();
+
+ int calcFps(timeval *start, timeval *end, int calls);
+
+ int testBackend();
+
+ int testSound();
+
+ int testRescale();
+
+ int testFps();
+
+ private:
+ std::string mTest;
+
+ std::ofstream file;
+};
+
+#endif // TEST_TESTLAUNCHER_H
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
new file mode 100644
index 000000000..70fcfc346
--- /dev/null
+++ b/src/test/testmain.cpp
@@ -0,0 +1,287 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "test/testmain.h"
+
+#include "utils/gettext.h"
+
+#include "client.h"
+#include "configuration.h"
+#include "localconsts.h"
+
+#include "utils/gettext.h"
+#include "utils/mkdir.h"
+#include "utils/stringutils.h"
+#include "utils/process.h"
+
+#include <iostream>
+
+#include "debug.h"
+
+std::string fileName = "";
+extern char *selfName;
+
+TestMain::TestMain()
+{
+#ifdef WIN32
+ fileName = "manaplus.exe";
+#else
+ fileName = selfName;
+#endif
+
+ log = new Logger;
+// log->setLogFile(Client::getLocalDataDirectory()
+// + std::string("/test.log"));
+ log->setLogFile(Client::getLocalDataDirectory()
+ + std::string("/manaplustest.log"));
+}
+
+void TestMain::initConfig()
+{
+ config.init(Client::getConfigDirectory() + "/test.xml");
+// config.setDefaultValues(getConfigDefaults());
+
+ config.setValue("hwaccel", false);
+ config.setValue("screen", false);
+ config.setValue("sound", false);
+ config.setValue("guialpha", 0.8f);
+ config.setValue("remember", true);
+ config.setValue("sfxVolume", 50);
+ config.setValue("musicVolume", 60);
+ config.setValue("fpslimit", 0);
+ config.setValue("customcursor", true);
+ config.setValue("useScreenshotDirectorySuffix", true);
+ config.setValue("ChatLogLength", 128);
+ config.setValue("screenwidth", 800);
+ config.setValue("screenheight", 600);
+}
+
+int TestMain::exec()
+{
+ initConfig();
+ int softwareTest = invokeSoftwareRenderTest("1");
+ int fastOpenGLTest = invokeFastOpenGLRenderTest("2");
+ int safeOpenGLTest = invokeSafeOpenGLRenderTest("3");
+ int soundTest = invokeTest4();
+ int rescaleTest[3];
+ int softFps = 0;
+ int fastOpenGLFps = 0;
+ int safeOpenGLFps = 0;
+
+ int openGLMode = 0;
+ int maxFps = 0;
+ rescaleTest[0] = -1;
+ rescaleTest[1] = -1;
+ rescaleTest[2] = -1;
+ std::string info;
+
+ info += strprintf("%d.%d,%d,%d.", soundTest, softwareTest,
+ fastOpenGLTest, safeOpenGLTest);
+
+ if (!softwareTest)
+ {
+ int softFpsTest = invokeSoftwareRenderTest("8");
+ info += strprintf ("%d", softFpsTest);
+ if (!softFpsTest)
+ {
+ softFps = readValue(8);
+ info += strprintf (",%d", softFps);
+ if (!softFps)
+ {
+ softwareTest = -1;
+ softFpsTest = -1;
+ }
+ else
+ {
+ rescaleTest[0] = invokeSoftwareRenderTest("5");
+ info += strprintf (",%d", rescaleTest[0]);
+ }
+ }
+ else
+ {
+ softwareTest = -1;
+ }
+ }
+ info += ".";
+ if (!fastOpenGLTest)
+ {
+ int fastOpenGLFpsTest = invokeFastOpenGLRenderTest("9");
+ info += strprintf ("%d", fastOpenGLFpsTest);
+ if (!fastOpenGLFpsTest)
+ {
+ fastOpenGLFps = readValue(9);
+ info += strprintf (",%d", fastOpenGLFps);
+ if (!fastOpenGLFps)
+ {
+ fastOpenGLTest = -1;
+ fastOpenGLFpsTest = -1;
+ }
+ else
+ {
+ rescaleTest[1] = invokeFastOpenGLRenderTest("6");
+ info += strprintf (",%d", rescaleTest[1]);
+ }
+ }
+ else
+ {
+ fastOpenGLTest = -1;
+ }
+ }
+ info += ".";
+ if (!safeOpenGLTest)
+ {
+ int safeOpenGLFpsTest = invokeSafeOpenGLRenderTest("10");
+ info += strprintf ("%d", safeOpenGLFpsTest);
+ if (!safeOpenGLFpsTest)
+ {
+ safeOpenGLFps = readValue(10);
+ info += strprintf (",%d", safeOpenGLFps);
+ if (!safeOpenGLFps)
+ {
+ safeOpenGLTest = -1;
+ safeOpenGLFpsTest = -1;
+ }
+ else
+ {
+ rescaleTest[2] = invokeSafeOpenGLRenderTest("7");
+ info += strprintf (",%d", rescaleTest[2]);
+ }
+ }
+ else
+ {
+ safeOpenGLTest = -1;
+ }
+ }
+ info += ".";
+
+ maxFps = softFps;
+ if (maxFps < fastOpenGLFps)
+ {
+ openGLMode = 1;
+ maxFps = fastOpenGLFps;
+ }
+ if (maxFps < safeOpenGLFps)
+ {
+ openGLMode = 2;
+ maxFps = safeOpenGLFps;
+ }
+
+ writeConfig(openGLMode, rescaleTest[openGLMode], soundTest, info);
+ return 0;
+}
+
+void TestMain::writeConfig(int openGLMode, int rescale,
+ int sound, std::string info)
+{
+ config.init(Client::getConfigDirectory() + "/config.xml");
+
+ // searched values
+ config.setValue("opengl", openGLMode);
+ config.setValue("showBackground", !rescale);
+ config.setValue("sound", !sound);
+
+ // better perfomance
+ config.setValue("hwaccel", true);
+ config.setValue("fpslimit", 60);
+ config.setValue("altfpslimit", 2);
+ config.setValue("safemode", false);
+ config.setValue("enableMapReduce", true);
+
+ // stats
+ config.setValue("testInfo", info);
+
+ config.write();
+}
+
+int TestMain::readValue(int ver, int def)
+{
+ std::string tmp;
+ int var;
+ file.open((Client::getLocalDataDirectory()
+ + std::string("/test.log")).c_str(), std::ios::in);
+ if (!getline(file, tmp))
+ {
+ file.close();
+ return def;
+ }
+ var = atoi(tmp.c_str());
+ if (ver != var || !getline(file, tmp))
+ {
+ file.close();
+ return def;
+ }
+ def = atoi(tmp.c_str());
+ file.close();
+ log->log("value for %d = %d", ver, def);
+ return def;
+}
+
+int TestMain::invokeTest(std::string test)
+{
+ config.setValue("opengl", 0);
+
+ config.write();
+ int ret = execFile(fileName, fileName, "-t", test);
+ return ret;
+}
+
+int TestMain::invokeTest4()
+{
+ config.setValue("sound", true);
+ int ret = invokeTest("4");
+
+ log->log("4: %d", ret);
+ return ret;
+}
+
+int TestMain::invokeSoftwareRenderTest(std::string test)
+{
+ config.setValue("opengl", 0);
+ config.write();
+ int ret = execFile(fileName, fileName, "-t", test, 30);
+ log->log("%s: %d", test.c_str(), ret);
+ return ret;
+}
+
+int TestMain::invokeFastOpenGLRenderTest(std::string test)
+{
+#if defined USE_OPENGL
+ config.setValue("opengl", 1);
+ config.write();
+ int ret = execFile(fileName, fileName, "-t", test, 30);
+ log->log("%s: %d", test.c_str(), ret);
+ return ret;
+#else
+ return -1;
+#endif
+}
+
+int TestMain::invokeSafeOpenGLRenderTest(std::string test)
+{
+#if defined USE_OPENGL
+ config.setValue("opengl", 2);
+ config.write();
+ int ret = execFile(fileName, fileName, "-t", test, 30);
+ log->log("%s: %d", test.c_str(), ret);
+ return ret;
+#else
+ return -1;
+#endif
+}
diff --git a/src/test/testmain.h b/src/test/testmain.h
new file mode 100644
index 000000000..8e5ce162f
--- /dev/null
+++ b/src/test/testmain.h
@@ -0,0 +1,64 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TEST_TESTMAIN_H
+#define TEST_TESTMAIN_H
+
+#include "logger.h"
+
+#include <string>
+
+class TestMain
+{
+ public:
+ TestMain();
+
+ int exec();
+
+ private:
+ void initConfig();
+
+ int readValue(int ver, int def = 0);
+
+ int invokeTest(std::string test);
+
+ int invokeTest3();
+
+ int invokeTest4();
+
+ int invokeTest7();
+
+ int invokeSoftwareRenderTest(std::string test);
+
+ int invokeFastOpenGLRenderTest(std::string test);
+
+ int invokeSafeOpenGLRenderTest(std::string test);
+
+ void testsMain();
+
+ void writeConfig(int openGLMode, int rescale,
+ int sound, std::string info);
+
+ Logger *log;
+
+ std::ifstream file;
+};
+
+#endif // TEST_TESTMAIN_H
diff --git a/src/text.cpp b/src/text.cpp
index bb480811f..4d54dd431 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/text.h b/src/text.h
index 2b0eaa97b..25fbe66f0 100644
--- a/src/text.h
+++ b/src/text.h
@@ -3,7 +3,7 @@
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net>
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -26,6 +26,7 @@
#include "graphics.h"
#include "guichanfwd.h"
+#include "localconsts.h"
#include <guichan/color.hpp>
@@ -42,7 +43,7 @@ class Text
Text(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
const gcn::Color *color, bool isSpeech = false,
- gcn::Font *font = 0);
+ gcn::Font *font = nullptr);
/**
* Destructor. The text is removed from the screen.
@@ -90,7 +91,7 @@ class FlashText : public Text
FlashText(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
const gcn::Color* color,
- gcn::Font *font = 0);
+ gcn::Font *font = nullptr);
/**
* Remove the text from the screen
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index 02cc97459..d8c0b7a8e 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/textparticle.h b/src/textparticle.h
index b37f25732..c85aff476 100644
--- a/src/textparticle.h
+++ b/src/textparticle.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2006-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/textrenderer.h b/src/textrenderer.h
index 8fe2c5954..9309c5415 100644
--- a/src/textrenderer.h
+++ b/src/textrenderer.h
@@ -2,7 +2,7 @@
* Text Renderer
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/tileset.h b/src/tileset.h
index 0867e5716..c21d6948a 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/units.cpp b/src/units.cpp
index edf9c749a..804512dbd 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -2,7 +2,7 @@
* Support for custom units
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -100,9 +100,9 @@ void Units::loadUnits()
}
XML::Document doc("units.xml");
- xmlNodePtr root = doc.rootNode();
+ XmlNodePtr root = doc.rootNode();
- if (!root || !xmlStrEqual(root->name, BAD_CAST "units"))
+ if (!root || !xmlNameEqual(root, "units"))
{
logger->log1("Error loading unit definition file: units.xml");
return;
@@ -110,7 +110,7 @@ void Units::loadUnits()
for_each_xml_child_node(node, root)
{
- if (xmlStrEqual(node->name, BAD_CAST "unit"))
+ if (xmlNameEqual(node, "unit"))
{
struct UnitDescription ud;
int level = 1;
@@ -127,7 +127,7 @@ void Units::loadUnits()
for_each_xml_child_node(uLevel, node)
{
- if (xmlStrEqual(uLevel->name, BAD_CAST "level"))
+ if (xmlNameEqual(uLevel, "level"))
{
struct UnitLevel ul;
ul.symbol = XML::getProperty(uLevel, "symbol",
diff --git a/src/units.h b/src/units.h
index 7705a9bd4..ba1f720e3 100644
--- a/src/units.h
+++ b/src/units.h
@@ -2,7 +2,7 @@
* Support for custom units
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp
new file mode 100644
index 000000000..64bb42d0c
--- /dev/null
+++ b/src/utils/checkutils.cpp
@@ -0,0 +1,39 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "utils/checkutils.h"
+
+#include <string.h>
+
+#include "logger.h"
+
+bool reportFalseReal(bool val, const char* file, unsigned line)
+{
+ if (!val)
+ logger->log("Debug: false value at %s:%u", file, line);
+ return val;
+}
+
+bool reportTrueReal(bool val, const char* file, unsigned line)
+{
+ if (val)
+ logger->log("Debug: true value at %s:%u", file, line);
+ return val;
+}
diff --git a/src/utils/checkutils.h b/src/utils/checkutils.h
new file mode 100644
index 000000000..6791ff7e0
--- /dev/null
+++ b/src/utils/checkutils.h
@@ -0,0 +1,30 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_CHECKUTILS_H
+#define UTILS_CHECKUTILS_H
+
+#include <string>
+
+bool reportFalseReal(bool val, const char* file, unsigned line);
+
+bool reportTrueReal(bool val, const char* file, unsigned line);
+
+#endif // UTILS_CHECKUTILS_H
diff --git a/src/utils/dtor.h b/src/utils/dtor.h
index fbe903ced..54fa11549 100644
--- a/src/utils/dtor.h
+++ b/src/utils/dtor.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/gettext.h b/src/utils/gettext.h
index 696f0d4bf..8bb41a4cb 100644
--- a/src/utils/gettext.h
+++ b/src/utils/gettext.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h
index 40a9e5d79..9f6818146 100644
--- a/src/utils/mathutils.h
+++ b/src/utils/mathutils.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp
index dc2ab63ef..582c9c7dc 100644
--- a/src/utils/mkdir.cpp
+++ b/src/utils/mkdir.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/mkdir.h b/src/utils/mkdir.h
index deff75475..8c5ab4ca2 100644
--- a/src/utils/mkdir.h
+++ b/src/utils/mkdir.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/mutex.h b/src/utils/mutex.h
index 03dac2e7a..a97a8d3f8 100644
--- a/src/utils/mutex.h
+++ b/src/utils/mutex.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index 3cc35cb55..8decb6e95 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -43,6 +43,8 @@ std::string getRealPath(const std::string &str)
#else
char *realPath = realpath(str.c_str(), nullptr);
#endif
+ if (!realPath)
+ return "";
path = realPath;
free(realPath);
return path;
diff --git a/src/utils/paths.h b/src/utils/paths.h
index 1723bf6c4..804900587 100644
--- a/src/utils/paths.h
+++ b/src/utils/paths.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp
new file mode 100644
index 000000000..1960f0dee
--- /dev/null
+++ b/src/utils/physfsrwops.cpp
@@ -0,0 +1,186 @@
+/*
+ * This code provides a glue layer between PhysicsFS and Simple Directmedia
+ * Layer's (SDL) RWops i/o abstraction.
+ *
+ * License: this code is public domain. I make no warranty that it is useful,
+ * correct, harmless, or environmentally safe.
+ *
+ * This particular file may be used however you like, including copying it
+ * verbatim into a closed-source project, exploiting it commercially, and
+ * removing any trace of my name from the source (although I hope you won't
+ * do that). I welcome enhancements and corrections to this file, but I do
+ * not require you to send me patches if you make changes. This code has
+ * NO WARRANTY.
+ *
+ * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
+ * Please see LICENSE.txt in the root of the source tree.
+ *
+ * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
+ *
+ * This file was written by Ryan C. Gordon. (icculus@icculus.org).
+ *
+ * Copyright (C) 2012 The ManaPlus Developers
+ */
+
+#include <stdio.h> /* used for SEEK_SET, SEEK_CUR, SEEK_END ... */
+#include "utils/physfsrwops.h"
+
+#include "localconsts.h"
+
+static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
+{
+ PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
+ int pos = 0;
+
+ if (whence == SEEK_SET)
+ {
+ pos = offset;
+ } /* if */
+ else if (whence == SEEK_CUR)
+ {
+ PHYSFS_sint64 current = PHYSFS_tell(handle);
+ if (current == -1)
+ {
+ SDL_SetError("Can't find position in file: %s",
+ PHYSFS_getLastError());
+ return -1;
+ } /* if */
+
+ pos = (int)current;
+ if (((PHYSFS_sint64)pos) != current)
+ {
+ SDL_SetError("Can't fit current file position in an int!");
+ return -1;
+ } /* if */
+
+ if (offset == 0) /* this is a "tell" call. We're done. */
+ return pos;
+
+ pos += offset;
+ } /* else if */
+ else if (whence == SEEK_END)
+ {
+ PHYSFS_sint64 len = PHYSFS_fileLength(handle);
+ if (len == -1)
+ {
+ SDL_SetError("Can't find end of file: %s", PHYSFS_getLastError());
+ return -1;
+ } /* if */
+
+ pos = (int)len;
+ if (((PHYSFS_sint64)pos) != len)
+ {
+ SDL_SetError("Can't fit end-of-file position in an int!");
+ return -1;
+ } /* if */
+
+ pos += offset;
+ } /* else if */
+ else
+ {
+ SDL_SetError("Invalid 'whence' parameter.");
+ return -1;
+ } /* else */
+
+ if ( pos < 0 )
+ {
+ SDL_SetError("Attempt to seek past start of file.");
+ return -1;
+ } /* if */
+
+ if (!PHYSFS_seek(handle, (PHYSFS_uint64) pos))
+ {
+ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+ return -1;
+ } /* if */
+
+ return pos;
+} /* physfsrwops_seek */
+
+static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
+{
+ PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1;
+ PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
+ if (rc != maxnum)
+ {
+ if (!PHYSFS_eof(handle)) /* not EOF? Must be an error. */
+ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+ } /* if */
+
+ return (int)rc;
+} /* physfsrwops_read */
+
+static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
+{
+ PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1;
+ PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
+ if (rc != num)
+ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+
+ return (int) rc;
+} /* physfsrwops_write */
+
+static int physfsrwops_close(SDL_RWops *rw)
+{
+ PHYSFS_file *handle = (PHYSFS_file*)rw->hidden.unknown.data1;
+ if (!PHYSFS_close(handle))
+ {
+ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+ return -1;
+ } /* if */
+
+ SDL_FreeRW(rw);
+ return 0;
+} /* physfsrwops_close */
+
+static SDL_RWops *create_rwops(PHYSFS_file *handle)
+{
+ SDL_RWops *retval = nullptr;
+
+ if (!handle)
+ {
+ SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
+ }
+ else
+ {
+ retval = SDL_AllocRW();
+ if (retval)
+ {
+ retval->seek = physfsrwops_seek;
+ retval->read = physfsrwops_read;
+ retval->write = physfsrwops_write;
+ retval->close = physfsrwops_close;
+ retval->hidden.unknown.data1 = handle;
+ } /* if */
+ } /* else */
+
+ return retval;
+} /* create_rwops */
+
+SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
+{
+ SDL_RWops *retval = nullptr;
+ if (!handle)
+ SDL_SetError("NULL pointer passed to PHYSFSRWOPS_makeRWops().");
+ else
+ retval = create_rwops(handle);
+
+ return retval;
+} /* PHYSFSRWOPS_makeRWops */
+
+SDL_RWops *PHYSFSRWOPS_openRead(const char *fname)
+{
+ return create_rwops(PHYSFS_openRead(fname));
+} /* PHYSFSRWOPS_openRead */
+
+SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname)
+{
+ return create_rwops(PHYSFS_openWrite(fname));
+} /* PHYSFSRWOPS_openWrite */
+
+SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname)
+{
+ return create_rwops(PHYSFS_openAppend(fname));
+} /* PHYSFSRWOPS_openAppend */
+
+/* end of physfsrwops.c ... */
diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h
new file mode 100644
index 000000000..efa004ac6
--- /dev/null
+++ b/src/utils/physfsrwops.h
@@ -0,0 +1,82 @@
+/*
+ * This code provides a glue layer between PhysicsFS and Simple Directmedia
+ * Layer's (SDL) RWops i/o abstraction.
+ *
+ * License: this code is public domain. I make no warranty that it is useful,
+ * correct, harmless, or environmentally safe.
+ *
+ * This particular file may be used however you like, including copying it
+ * verbatim into a closed-source project, exploiting it commercially, and
+ * removing any trace of my name from the source (although I hope you won't
+ * do that). I welcome enhancements and corrections to this file, but I do
+ * not require you to send me patches if you make changes. This code has
+ * NO WARRANTY.
+ *
+ * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
+ * Please see LICENSE.txt in the root of the source tree.
+ *
+ * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
+ *
+ * This file was written by Ryan C. Gordon. (icculus@icculus.org).
+ *
+ * Copyright (C) 2012 The ManaPlus Developers
+ */
+
+#ifndef UTILS_PHYSFSRWOPS_H
+#define UTILS_PHYSFSRWOPS_H
+
+#include <physfs.h>
+#include <SDL.h>
+
+/**
+ * Open a platform-independent filename for reading, and make it accessible
+ * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
+ * RWops is closed. PhysicsFS should be configured to your liking before
+ * opening files through this method.
+ *
+ * @param filename File to open in platform-independent notation.
+ * @return A valid SDL_RWops structure on success, NULL on error. Specifics
+ * of the error can be gleaned from PHYSFS_getLastError().
+ */
+SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
+
+/**
+ * Open a platform-independent filename for writing, and make it accessible
+ * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
+ * RWops is closed. PhysicsFS should be configured to your liking before
+ * opening files through this method.
+ *
+ * @param filename File to open in platform-independent notation.
+ * @return A valid SDL_RWops structure on success, NULL on error. Specifics
+ * of the error can be gleaned from PHYSFS_getLastError().
+ */
+SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
+
+/**
+ * Open a platform-independent filename for appending, and make it accessible
+ * via an SDL_RWops structure. The file will be closed in PhysicsFS when the
+ * RWops is closed. PhysicsFS should be configured to your liking before
+ * opening files through this method.
+ *
+ * @param filename File to open in platform-independent notation.
+ * @return A valid SDL_RWops structure on success, NULL on error. Specifics
+ * of the error can be gleaned from PHYSFS_getLastError().
+ */
+SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
+
+/**
+ * Make a SDL_RWops from an existing PhysicsFS file handle. You should
+ * dispose of any references to the handle after successful creation of
+ * the RWops. The actual PhysicsFS handle will be destroyed when the
+ * RWops is closed.
+ *
+ * @param handle a valid PhysicsFS file handle.
+ * @return A valid SDL_RWops structure on success, NULL on error. Specifics
+ * of the error can be gleaned from PHYSFS_getLastError().
+ */
+SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
+
+#endif /* include-once blocker */
+
+/* end of physfsrwops.h ... */
+
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
new file mode 100644
index 000000000..4a2081514
--- /dev/null
+++ b/src/utils/process.cpp
@@ -0,0 +1,172 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "utils/process.h"
+
+#include <string.h>
+#include <cstdarg>
+#include <cstdio>
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "localconsts.h"
+
+#include "debug.h"
+
+const int timeOut = 10;
+
+#ifdef WIN32
+
+#include <windows.h>
+
+int execFile(std::string pathName, std::string name,
+ std::string arg1, std::string arg2, int waitTime)
+{
+ if (!waitTime)
+ waitTime = timeOut;
+
+ STARTUPINFO siStartupInfo;
+ PROCESS_INFORMATION piProcessInfo;
+ memset(&siStartupInfo, 0, sizeof(siStartupInfo));
+ memset(&piProcessInfo, 0, sizeof(piProcessInfo));
+ siStartupInfo.cb = sizeof(siStartupInfo);
+ DWORD ret = -1;
+ std::string args(pathName + " " + arg1);
+ if (!arg2.empty())
+ args += " " + arg2;
+
+ if (CreateProcess(pathName.c_str(), (char*)args.c_str(), 0, 0, false,
+ CREATE_DEFAULT_ERROR_MODE, 0, 0, &siStartupInfo,
+ &piProcessInfo) != false)
+ {
+ if (!WaitForSingleObject(piProcessInfo.hProcess, timeOut * 1000))
+ {
+ if (GetExitCodeProcess(piProcessInfo.hProcess, &ret))
+ {
+ CloseHandle(piProcessInfo.hProcess);
+ CloseHandle(piProcessInfo.hThread);
+ return ret;
+ }
+ }
+ TerminateProcess(piProcessInfo.hProcess, -1);
+ }
+
+ CloseHandle(piProcessInfo.hProcess);
+ CloseHandle(piProcessInfo.hThread);
+ return -1;
+}
+
+#elif defined(__APPLE__)
+
+int execFile(std::string pathName, std::string name,
+ std::string arg1, std::string arg2, int waitTime)
+{
+ return -1;
+}
+
+#elif defined __linux__ || defined __linux
+
+#include <sys/types.h>
+#include <sys/wait.h>
+
+int execFile(std::string pathName, std::string name,
+ std::string arg1, std::string arg2, int waitTime)
+{
+ pid_t mon_pid;
+ int status;
+
+ if (!waitTime)
+ waitTime = timeOut;
+
+ if ((mon_pid = fork()) == -1)
+ { // fork error
+ return -1;
+ }
+ else if (!mon_pid)
+ { // monitoring child
+ pid_t pid;
+ if ((pid = fork()) == -1)
+ { // fork error
+ return -1;
+ }
+ else if (!pid)
+ { // work child
+ if (arg2.empty())
+ {
+ execl(pathName.c_str(), name.c_str(),
+ arg1.c_str(), (char *)nullptr);
+ }
+ else
+ {
+ execl(pathName.c_str(), name.c_str(),
+ arg1.c_str(), arg2.c_str(), (char *)nullptr);
+ }
+ exit(-1);
+ }
+
+ // monitoring process
+ pid_t sleep_pid;
+ if ((sleep_pid = fork()) == -1)
+ { // fork error
+ return -1;
+ }
+ else if (!sleep_pid)
+ { // sleep pid
+ sleep (timeOut);
+// printf ("time out\n");
+ exit(-1);
+ }
+
+ // monitoring process
+ pid_t exited_pid = wait(&status);
+ int ret = -1;
+ if (exited_pid == pid)
+ {
+ kill(sleep_pid, SIGKILL);
+ if (WIFEXITED(status))
+ ret = WEXITSTATUS(status);
+ }
+ else
+ {
+ kill(pid, SIGKILL);
+ ret = -1;
+ }
+ wait(nullptr);
+ exit(ret);
+ }
+
+ // monitoring parent
+ waitpid(mon_pid, &status, 0);
+ if (WIFEXITED(status))
+ return WEXITSTATUS(status);
+
+ return -1;
+}
+
+#else
+
+int execFile(std::string pathName, std::string name,
+ std::string arg1, std::string arg2, int waitTime)
+{
+ return -1;
+}
+
+#endif
diff --git a/src/utils/process.h b/src/utils/process.h
new file mode 100644
index 000000000..12421729f
--- /dev/null
+++ b/src/utils/process.h
@@ -0,0 +1,29 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_PROCESS_H
+#define UTILS_PROCESS_H
+
+#include <string>
+
+int execFile(std::string pathName, std::string name,
+ std::string arg1, std::string arg2, int waitTime = 0);
+
+#endif // UTILS_PROCESS_H
diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp
index 523c021a4..ac9c78b2a 100644
--- a/src/utils/sha256.cpp
+++ b/src/utils/sha256.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2008-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file has been slighly modified as part of The ManaPlus Client.
*
diff --git a/src/utils/sha256.h b/src/utils/sha256.h
index aa2468d56..54bb92f3c 100644
--- a/src/utils/sha256.h
+++ b/src/utils/sha256.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp
index fae0fbf47..9690a9fb7 100644
--- a/src/utils/specialfolder.cpp
+++ b/src/utils/specialfolder.cpp
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h
index 571817370..8eb00a637 100644
--- a/src/utils/specialfolder.h
+++ b/src/utils/specialfolder.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 39f14a646..26accbc7d 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -509,6 +509,19 @@ std::vector<std::string> getLang()
return langs;
}
+std::string getLangSimple()
+{
+ std::string lang = config.getValue("lang", "").c_str();
+ if (lang.empty())
+ {
+ char *lng = getenv("LANG");
+ if (!lng)
+ return "";
+ return lng;
+ }
+ return lang;
+}
+
std::string packList(std::list<std::string> &list)
{
std::list<std::string>::const_iterator i = list.begin();
@@ -612,3 +625,13 @@ std::string &removeProtocol(std::string &url)
url = url.substr(i + 3);
return url;
}
+
+bool checkPath(std::string path)
+{
+ if (path.empty())
+ return true;
+ return path.find("../") == std::string::npos
+ && path.find("..\\") == std::string::npos
+ && path.find("/..") == std::string::npos
+ && path.find("\\..") == std::string::npos;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 273fa0c8c..5cb726eef 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -188,6 +188,8 @@ std::string combineDye2(std::string file, std::string dye);
std::vector<std::string> getLang();
+std::string getLangSimple();
+
std::string packList(std::list<std::string> &list);
std::list<std::string> unpackList(const std::string &str);
@@ -206,4 +208,6 @@ bool findCutFirst(std::string &str1, std::string str2);
std::string &removeProtocol(std::string &url);
+bool checkPath(std::string path);
+
#endif // UTILS_STRINGUTILS_H
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 10436067f..420915d8f 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -32,6 +32,11 @@
#include "debug.h"
+static void xmlNullLogger(void *ctx A_UNUSED, const char *msg A_UNUSED, ...)
+{
+ // Does nothing, that's the whole point of it
+}
+
namespace XML
{
Document::Document(const std::string &filename, bool useResman):
@@ -96,12 +101,12 @@ namespace XML
xmlFreeDoc(mDoc);
}
- xmlNodePtr Document::rootNode()
+ XmlNodePtr Document::rootNode()
{
return mDoc ? xmlDocGetRootElement(mDoc) : nullptr;
}
- int getProperty(xmlNodePtr node, const char* name, int def)
+ int getProperty(XmlNodePtr node, const char* name, int def)
{
int &ret = def;
@@ -115,7 +120,7 @@ namespace XML
return ret;
}
- double getFloatProperty(xmlNodePtr node, const char* name, double def)
+ double getFloatProperty(XmlNodePtr node, const char* name, double def)
{
double &ret = def;
@@ -129,7 +134,7 @@ namespace XML
return ret;
}
- std::string getProperty(xmlNodePtr node, const char *name,
+ std::string getProperty(XmlNodePtr node, const char *name,
const std::string &def)
{
xmlChar *prop = xmlGetProp(node, BAD_CAST name);
@@ -143,7 +148,7 @@ namespace XML
return def;
}
- bool getBoolProperty(xmlNodePtr node, const char* name, bool def)
+ bool getBoolProperty(XmlNodePtr node, const char* name, bool def)
{
xmlChar *prop = xmlGetProp(node, BAD_CAST name);
@@ -154,15 +159,32 @@ namespace XML
return def;
}
- xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name)
+ XmlNodePtr findFirstChildByName(XmlNodePtr parent, const char *name)
{
for_each_xml_child_node(child, parent)
{
- if (xmlStrEqual(child->name, BAD_CAST name))
+ if (xmlNameEqual(child, name))
return child;
}
return nullptr;
}
+ // Initialize libxml2 and check for potential ABI mismatches between
+ // compiled version and the shared library actually used.
+ void initXML()
+ {
+ xmlInitParser();
+ LIBXML_TEST_VERSION;
+
+ // Suppress libxml2 error messages
+ xmlSetGenericErrorFunc(nullptr, xmlNullLogger);
+ }
+
+ // Shutdown libxml
+ void cleanupXML()
+ {
+ xmlCleanupParser();
+ }
+
} // namespace XML
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 7bcec2c83..f623fa618 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -23,10 +23,16 @@
#ifndef XML_H
#define XML_H
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
#include <libxml/tree.h>
#include <string>
+#define XmlNodePtr xmlNodePtr
+#define xmlNameEqual(node, str) xmlStrEqual((node)->name, BAD_CAST (str))
+#define XmlTextWriterPtr xmlTextWriterPtr
+
/**
* XML helper functions.
*/
@@ -63,40 +69,44 @@ namespace XML
* Returns the root node of the document (or NULL if there was a
* load error).
*/
- xmlNodePtr rootNode();
+ XmlNodePtr rootNode();
private:
xmlDocPtr mDoc;
};
/**
- * Gets an floating point property from an xmlNodePtr.
+ * Gets an floating point property from an XmlNodePtr.
*/
- double getFloatProperty(xmlNodePtr node, const char *name, double def);
+ double getFloatProperty(XmlNodePtr node, const char *name, double def);
/**
- * Gets an integer property from an xmlNodePtr.
+ * Gets an integer property from an XmlNodePtr.
*/
- int getProperty(xmlNodePtr node, const char *name, int def);
+ int getProperty(XmlNodePtr node, const char *name, int def);
/**
- * Gets a string property from an xmlNodePtr.
+ * Gets a string property from an XmlNodePtr.
*/
- std::string getProperty(xmlNodePtr node, const char *name,
+ std::string getProperty(XmlNodePtr node, const char *name,
const std::string &def);
/**
- * Gets a boolean property from an xmlNodePtr.
+ * Gets a boolean property from an XmlNodePtr.
*/
- bool getBoolProperty(xmlNodePtr node, const char *name, bool def);
+ bool getBoolProperty(XmlNodePtr node, const char *name, bool def);
/**
* Finds the first child node with the given name
*/
- xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name);
+ XmlNodePtr findFirstChildByName(XmlNodePtr parent, const char *name);
+
+ void initXML();
+
+ void cleanupXML();
}
#define for_each_xml_child_node(var, parent) \
- for (xmlNodePtr var = parent->xmlChildrenNode; var; var = var->next)
+ for (XmlNodePtr var = parent->xmlChildrenNode; var; var = var->next)
#endif // XML_H
diff --git a/src/variabledata.h b/src/variabledata.h
index 73eca2198..e5516bd9f 100644
--- a/src/variabledata.h
+++ b/src/variabledata.h
@@ -1,7 +1,7 @@
/*
* The ManaPlus Client
* Copyright (C) 2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/vector.cpp b/src/vector.cpp
index c234dea4c..e134a777a 100644
--- a/src/vector.cpp
+++ b/src/vector.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
diff --git a/src/vector.h b/src/vector.h
index 0f10bae96..744b235c0 100644
--- a/src/vector.h
+++ b/src/vector.h
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*