From aa3f63fd497558a02feb3ddbc44f31eac091f39b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 10 Oct 2017 22:14:45 +0300 Subject: Remove most unused files. --- src/CMakeLists.txt | 2163 ---- src/Makefile.am | 2148 ---- src/SDLMain.m | 385 - src/actions/actiondef.h | 53 - src/actions/actionfuncptr.h | 28 - src/actions/actions.h | 127 - src/actions/chat.h | 72 - src/actions/commands.h | 170 - src/actions/move.h | 47 - src/actions/pets.h | 52 - src/actions/statusbar.h | 52 - src/actions/tabs.h | 42 - src/actions/target.h | 42 - src/actions/windows.h | 63 - src/actormanager.cpp | 2265 ---- src/actormanager.h | 454 - src/avatar.cpp | 66 - src/avatar.h | 207 - src/being/actor.cpp | 87 - src/being/actor.h | 146 - src/being/actorsprite.cpp | 602 -- src/being/actorsprite.h | 274 - src/being/being.cpp | 5470 ---------- src/being/being.h | 1375 --- src/being/beingcacheentry.h | 138 - src/being/beingflag.h | 37 - src/being/beingspeech.h | 37 - src/being/castingeffect.cpp | 105 - src/being/castingeffect.h | 75 - src/being/compounditem.h | 46 - src/being/compoundsprite.cpp | 566 - src/being/compoundsprite.h | 143 - src/being/crazymoves.cpp | 824 -- src/being/crazymoves.h | 62 - src/being/flooritem.cpp | 225 - src/being/flooritem.h | 153 - src/being/homunculusinfo.h | 53 - src/being/localplayer.cpp | 2816 ----- src/being/localplayer.h | 533 - src/being/mercenaryinfo.h | 46 - src/being/petinfo.h | 57 - src/being/playerignorestrategy.h | 58 - src/being/playerinfo.cpp | 693 -- src/being/playerinfo.h | 313 - src/being/playerrelation.cpp | 30 - src/being/playerrelation.h | 57 - src/being/playerrelations.cpp | 661 -- src/being/playerrelations.h | 213 - src/beingequipbackend.cpp | 92 - src/beingequipbackend.h | 53 - src/chatlogger.cpp | 233 - src/chatlogger.h | 88 - src/client.h | 31 - src/commandline.cpp | 293 - src/commandline.h | 30 - src/configmanager.cpp | 453 - src/configmanager.h | 48 - src/configuration.cpp | 969 -- src/configuration.h | 392 - src/const/emoteshortcut.h | 26 - src/const/equipment.h | 30 - src/const/gui/chat.h | 32 - src/const/gui/pages.h | 30 - src/const/gui/theme.h | 32 - src/const/itemshortcut.h | 30 - src/const/net/inventory.h | 29 - src/const/net/maxpacketversion.h | 32 - src/const/net/net.h | 36 - src/const/net/nostat.h | 28 - src/const/net/skill.h | 57 - src/const/render/graphics.h | 31 - src/const/resources/currency.h | 28 - src/const/resources/item/cards.h | 31 - src/const/resources/item/itemoptions.h | 26 - src/const/resources/map/map.h | 28 - src/const/resources/skill.h | 27 - src/const/resources/spriteaction.h | 74 - src/const/sound.h | 37 - src/const/spells.h | 32 - src/const/utils/timer.h | 31 - src/const/utils/utf8.h | 28 - src/debug.h | 64 - src/debug/mse/LICENSE_1_0.txt | 23 - src/debug/mse/msemsevector.h | 2432 ----- src/debug/mse/msemstdvector.h | 413 - src/debug/mse/mseprimitives.h | 872 -- src/debug/mse/source.txt | 1 - src/debug/nvwa/_nvwa.h | 112 - src/debug/nvwa/c++11.h | 340 - src/debug/nvwa/debug_new.cpp | 1197 --- src/debug/nvwa/debug_new.h | 207 - src/debug/nvwa/fast_mutex.h | 427 - src/debug/nvwa/source.txt | 1 - src/debug/nvwa/static_assert.h | 62 - src/debug/readme.txt | 2 - src/defaults.cpp | 742 -- src/defaults.h | 47 - src/dirs.cpp | 615 -- src/dirs.h | 67 - src/dragdrop.h | 266 - src/effectmanager.cpp | 270 - src/effectmanager.h | 101 - src/enums/being/actortype.h | 44 - src/enums/being/attacktype.h | 48 - src/enums/being/attributes.h | 119 - src/enums/being/attributesstrings.cpp | 119 - src/enums/being/attributesstrings.h | 36 - src/enums/being/badgedrawtype.h | 35 - src/enums/being/badgeindex.h | 42 - src/enums/being/beingaction.h | 42 - src/enums/being/beingdirection.h | 40 - src/enums/being/cookingtype.h | 37 - src/enums/being/gender.h | 37 - src/enums/being/pickup.h | 45 - src/enums/being/rank.h | 35 - src/enums/being/reachable.h | 36 - src/enums/being/relation.h | 40 - src/enums/being/targetcursorsize.h | 36 - src/enums/being/targetcursortype.h | 36 - src/enums/being/visiblename.h | 34 - src/enums/being/visiblenamepos.h | 33 - src/enums/commandtarget.h | 34 - src/enums/cutin.h | 36 - src/enums/dragdropsource.h | 49 - src/enums/emotetype.h | 35 - src/enums/equipslot.h | 58 - src/enums/events/keyeventtype.h | 76 - src/enums/events/mousebutton.h | 79 - src/enums/events/mouseeventtype.h | 84 - src/enums/fs/fsentrytype.h | 33 - src/enums/gui/chatmsgtype.h | 42 - src/enums/gui/chattabtype.h | 51 - src/enums/gui/colorname.h | 45 - src/enums/gui/dialogtype.h | 38 - src/enums/gui/gradienttype.h | 39 - src/enums/gui/itemamountwindowusage.h | 44 - src/enums/gui/layouttype.h | 42 - src/enums/gui/linkhighlightmode.h | 42 - src/enums/gui/npcactionstate.h | 46 - src/enums/gui/npcinputstate.h | 40 - src/enums/gui/orientation.h | 78 - src/enums/gui/progresscolorid.h | 48 - src/enums/gui/serverdialogdonwloadstatus.h | 40 - src/enums/gui/shoplistboxtype.h | 34 - src/enums/gui/slidergrid.h | 85 - src/enums/gui/themecolorid.h | 258 - src/enums/gui/updatedownloadstatus.h | 42 - src/enums/gui/usercolorid.h | 100 - src/enums/guildpositionflags.h | 38 - src/enums/input/inputaction.h | 716 -- src/enums/input/inputcondition.h | 61 - src/enums/input/inputgroup.h | 45 - src/enums/input/inputtype.h | 43 - src/enums/input/keyboardfocus.h | 34 - src/enums/input/keyvalue.h | 131 - src/enums/inventorytype.h | 43 - src/enums/magicschool.h | 40 - src/enums/net/auctionsearchtype.h | 37 - src/enums/net/battlegroundtype.h | 35 - src/enums/net/beingtype.h | 42 - src/enums/net/deleteitemreason.h | 39 - src/enums/net/downloadstatus.h | 38 - src/enums/net/mailmessagetype.h | 39 - src/enums/net/mailopentype.h | 34 - src/enums/net/menutype.h | 48 - src/enums/net/npcaction.h | 34 - src/enums/net/packettype.h | 45 - src/enums/net/partyshare.h | 37 - src/enums/net/serverfreetype.h | 37 - src/enums/net/servertype.h | 37 - src/enums/net/storesearchtype.h | 33 - src/enums/net/updatetype.h | 37 - src/enums/particle/alivestatus.h | 40 - src/enums/particle/particlechangefunc.h | 38 - src/enums/particle/particlephysics.h | 34 - src/enums/particle/particletype.h | 36 - src/enums/render/blitmode.h | 35 - src/enums/render/rendertype.h | 37 - src/enums/resources/cursor.h | 45 - src/enums/resources/displaytype.h | 33 - src/enums/resources/frametype.h | 40 - src/enums/resources/imageposition.h | 61 - src/enums/resources/imagetype.h | 33 - src/enums/resources/item/itemdbtype.h | 50 - src/enums/resources/item/itemsoundevent.h | 47 - src/enums/resources/item/itemtype.h | 44 - src/enums/resources/mailqueuetype.h | 35 - src/enums/resources/map/blockmask.h | 40 - src/enums/resources/map/blocktype.h | 42 - src/enums/resources/map/collisiontype.h | 41 - src/enums/resources/map/mapitemtype.h | 47 - src/enums/resources/map/maplayerposition.h | 37 - src/enums/resources/map/maplayertype.h | 39 - src/enums/resources/map/maptype.h | 40 - src/enums/resources/notifyflags.h | 39 - src/enums/resources/notifytypes.h | 255 - src/enums/resources/questtype.h | 37 - src/enums/resources/servercommandenable.h | 37 - src/enums/resources/servercommandtype.h | 44 - src/enums/resources/serverpermissiontype.h | 41 - src/enums/resources/skill/casttype.h | 35 - src/enums/resources/skill/skillowner.h | 35 - src/enums/resources/skill/skillsettype.h | 33 - src/enums/resources/skill/skilltype.h | 39 - src/enums/resources/skill/skilltype2.h | 51 - src/enums/resources/spritedirection.h | 43 - src/enums/screendensity.h | 35 - src/enums/simpletypes/advanced.h | 33 - src/enums/simpletypes/allowquit.h | 33 - src/enums/simpletypes/allowsort.h | 33 - src/enums/simpletypes/allplayers.h | 33 - src/enums/simpletypes/append.h | 33 - src/enums/simpletypes/autorelease.h | 33 - src/enums/simpletypes/autotarget.h | 33 - src/enums/simpletypes/beingid.h | 34 - src/enums/simpletypes/beingtypeid.h | 34 - src/enums/simpletypes/booldefines.h | 53 - src/enums/simpletypes/damaged.h | 33 - src/enums/simpletypes/donotalign.h | 33 - src/enums/simpletypes/enable.h | 33 - src/enums/simpletypes/enumdefines.h | 62 - src/enums/simpletypes/equipm.h | 33 - src/enums/simpletypes/equipped.h | 33 - src/enums/simpletypes/favorite.h | 33 - src/enums/simpletypes/forcedisplay.h | 33 - src/enums/simpletypes/forcequantity.h | 33 - src/enums/simpletypes/identified.h | 33 - src/enums/simpletypes/ignorerecord.h | 33 - src/enums/simpletypes/intdefines.h | 51 - src/enums/simpletypes/issell.h | 33 - src/enums/simpletypes/isstart.h | 33 - src/enums/simpletypes/itemcolor.h | 33 - src/enums/simpletypes/keep.h | 33 - src/enums/simpletypes/losefocusontab.h | 33 - src/enums/simpletypes/mainconfig.h | 33 - src/enums/simpletypes/modal.h | 33 - src/enums/simpletypes/modifiable.h | 33 - src/enums/simpletypes/move.h | 33 - src/enums/simpletypes/notify.h | 33 - src/enums/simpletypes/npcnames.h | 33 - src/enums/simpletypes/online.h | 33 - src/enums/simpletypes/onthefly.h | 33 - src/enums/simpletypes/opaque.h | 33 - src/enums/simpletypes/protected.h | 33 - src/enums/simpletypes/separator.h | 33 - src/enums/simpletypes/sfx.h | 33 - src/enums/simpletypes/showcenter.h | 33 - src/enums/simpletypes/showemptyrows.h | 33 - src/enums/simpletypes/skiperror.h | 33 - src/enums/simpletypes/speech.h | 33 - src/enums/simpletypes/stringdefines.h | 51 - src/enums/simpletypes/stringdefines2.h | 31 - src/enums/simpletypes/trading.h | 33 - src/enums/simpletypes/tryremovecolors.h | 33 - src/enums/simpletypes/useargs.h | 33 - src/enums/simpletypes/usebase64.h | 33 - src/enums/simpletypes/usevirtfs.h | 33 - src/enums/simpletypes/visible.h | 33 - src/enums/state.h | 72 - src/enums/textcommandtype.h | 33 - src/equipment.h | 95 - src/events/actionevent.h | 137 - src/events/event.h | 113 - src/events/inputevent.h | 75 - src/events/inputguievent.h | 118 - src/events/keyevent.h | 159 - src/events/mouseevent.h | 199 - src/events/selectionevent.h | 99 - src/eventsmanager.cpp | 683 -- src/eventsmanager.h | 71 - src/filefilter.txt | 21 - src/filefilter_more.txt | 12 - src/fs/files.cpp | 319 - src/fs/files.h | 69 - src/fs/mkdir.cpp | 166 - src/fs/mkdir.h | 27 - src/fs/paths.cpp | 279 - src/fs/paths.h | 54 - src/fs/specialfolder.cpp | 59 - src/fs/specialfolder.h | 33 - src/fs/virtfs/direntry.cpp | 45 - src/fs/virtfs/direntry.h | 49 - src/fs/virtfs/file.cpp | 56 - src/fs/virtfs/file.h | 61 - src/fs/virtfs/fileapi.h | 48 - src/fs/virtfs/fs.cpp | 880 -- src/fs/virtfs/fs.h | 127 - src/fs/virtfs/fsdir.cpp | 686 -- src/fs/virtfs/fsdir.h | 104 - src/fs/virtfs/fsdirrwops.cpp | 269 - src/fs/virtfs/fsdirrwops.h | 55 - src/fs/virtfs/fsentry.cpp | 41 - src/fs/virtfs/fsentry.h | 55 - src/fs/virtfs/fsfuncs.h | 136 - src/fs/virtfs/fszip.cpp | 705 -- src/fs/virtfs/fszip.h | 93 - src/fs/virtfs/fsziprwops.cpp | 160 - src/fs/virtfs/fsziprwops.h | 55 - src/fs/virtfs/list.cpp | 37 - src/fs/virtfs/list.h | 44 - src/fs/virtfs/rwops.cpp | 149 - src/fs/virtfs/rwops.h | 66 - src/fs/virtfs/rwopstypes.h | 34 - src/fs/virtfs/tools.cpp | 157 - src/fs/virtfs/tools.h | 46 - src/fs/virtfs/zipentry.cpp | 48 - src/fs/virtfs/zipentry.h | 51 - src/fs/virtfs/ziplocalheader.cpp | 40 - src/fs/virtfs/ziplocalheader.h | 49 - src/fs/virtfs/zipreader.cpp | 334 - src/fs/virtfs/zipreader.h | 46 - src/game.cpp | 1260 --- src/game.h | 159 - src/gamemodifiers.cpp | 517 - src/gamemodifiers.h | 79 - src/graphicsmanager.cpp | 1724 --- src/graphicsmanager.h | 229 - src/gui/browserlink.h | 53 - src/gui/buttoninfo.h | 49 - src/gui/buttontext.h | 45 - src/gui/chatlog.h | 48 - src/gui/cliprect.h | 129 - src/gui/color.h | 253 - src/gui/colorpair.h | 43 - src/gui/dialogsmanager.cpp | 222 - src/gui/dialogsmanager.h | 65 - src/gui/focushandler.cpp | 621 -- src/gui/focushandler.h | 410 - src/gui/fonts/font.cpp | 499 - src/gui/fonts/font.h | 158 - src/gui/fonts/textchunk.cpp | 203 - src/gui/fonts/textchunk.h | 75 - src/gui/fonts/textchunklist.cpp | 153 - src/gui/fonts/textchunklist.h | 60 - src/gui/fonts/textchunksmall.cpp | 83 - src/gui/fonts/textchunksmall.h | 49 - src/gui/gui.cpp | 1515 --- src/gui/gui.h | 527 - src/gui/mailmessage.h | 59 - src/gui/models/avatarlistmodel.h | 44 - src/gui/models/beingslistmodel.h | 66 - src/gui/models/colorlistmodel.h | 87 - src/gui/models/colormodel.cpp | 97 - src/gui/models/colormodel.h | 69 - src/gui/models/extendedlistmodel.h | 40 - src/gui/models/extendednamesmodel.cpp | 68 - src/gui/models/extendednamesmodel.h | 62 - src/gui/models/fontsizechoicelistmodel.h | 92 - src/gui/models/fontsmodel.h | 44 - src/gui/models/iconsmodel.h | 88 - src/gui/models/ignorechoiceslistmodel.h | 64 - src/gui/models/itemsmodel.h | 88 - src/gui/models/keylistmodel.h | 88 - src/gui/models/langlistmodel.h | 145 - src/gui/models/listmodel.h | 108 - src/gui/models/magicschoolmodel.h | 73 - src/gui/models/modelistmodel.cpp | 101 - src/gui/models/modelistmodel.h | 70 - src/gui/models/namesmodel.cpp | 68 - src/gui/models/namesmodel.h | 64 - src/gui/models/opengllistmodel.h | 53 - src/gui/models/playerrelationlistmodel.h | 75 - src/gui/models/playertablemodel.cpp | 148 - src/gui/models/playertablemodel.h | 68 - src/gui/models/questsmodel.h | 40 - src/gui/models/serverslistmodel.h | 119 - src/gui/models/shopitems.cpp | 206 - src/gui/models/shopitems.h | 170 - src/gui/models/skillmodel.cpp | 62 - src/gui/models/skillmodel.h | 58 - src/gui/models/sortlistmodelbuy.h | 71 - src/gui/models/sortlistmodelinv.h | 69 - src/gui/models/soundsmodel.h | 49 - src/gui/models/tablemodel.cpp | 182 - src/gui/models/tablemodel.h | 153 - src/gui/models/targettypemodel.h | 64 - src/gui/models/themesmodel.h | 49 - src/gui/models/touchactionmodel.cpp | 91 - src/gui/models/touchactionmodel.h | 49 - src/gui/models/typelistmodel.h | 74 - src/gui/models/updatelistmodel.h | 79 - src/gui/models/updatetypemodel.h | 63 - src/gui/models/worldlistmodel.h | 68 - src/gui/mouseoverlink.h | 51 - src/gui/onlineplayer.h | 90 - src/gui/palette.cpp | 199 - src/gui/palette.h | 158 - src/gui/popupmanager.cpp | 113 - src/gui/popupmanager.h | 71 - src/gui/popups/beingpopup.cpp | 337 - src/gui/popups/beingpopup.h | 68 - src/gui/popups/itempopup.cpp | 465 - src/gui/popups/itempopup.h | 103 - src/gui/popups/popupmenu.cpp | 3613 ------- src/gui/popups/popupmenu.h | 321 - src/gui/popups/skillpopup.cpp | 250 - src/gui/popups/skillpopup.h | 84 - src/gui/popups/speechbubble.cpp | 98 - src/gui/popups/speechbubble.h | 67 - src/gui/popups/spellpopup.cpp | 123 - src/gui/popups/spellpopup.h | 71 - src/gui/popups/statuspopup.cpp | 171 - src/gui/popups/statuspopup.h | 72 - src/gui/popups/textboxpopup.cpp | 83 - src/gui/popups/textboxpopup.h | 64 - src/gui/popups/textpopup.cpp | 112 - src/gui/popups/textpopup.h | 83 - src/gui/rect.h | 226 - src/gui/sdlinput.cpp | 405 - src/gui/sdlinput.h | 391 - src/gui/setupactiondata.h | 52 - src/gui/setupinputpages.cpp | 80 - src/gui/setupinputpages.h | 32 - src/gui/shortcut/dropshortcut.cpp | 171 - src/gui/shortcut/dropshortcut.h | 69 - src/gui/shortcut/emoteshortcut.cpp | 115 - src/gui/shortcut/emoteshortcut.h | 133 - src/gui/shortcut/itemshortcut.cpp | 289 - src/gui/shortcut/itemshortcut.h | 183 - src/gui/shortcut/shortcutbase.cpp | 128 - src/gui/shortcut/shortcutbase.h | 141 - src/gui/shortcut/spellshortcut.cpp | 63 - src/gui/shortcut/spellshortcut.h | 88 - src/gui/skin.cpp | 152 - src/gui/skin.h | 135 - src/gui/theme.cpp | 1283 --- src/gui/theme.h | 207 - src/gui/themecolorsidoperators.cpp | 30 - src/gui/themecolorsidoperators.h | 28 - src/gui/themeinfo.h | 64 - src/gui/touchactiondata.cpp | 38 - src/gui/touchactiondata.h | 28 - src/gui/userpalette.cpp | 649 -- src/gui/userpalette.h | 250 - src/gui/viewport.h | 32 - src/gui/widgets/attrs/attrdisplay.cpp | 67 - src/gui/widgets/attrs/attrdisplay.h | 82 - src/gui/widgets/attrs/changedisplay.cpp | 119 - src/gui/widgets/attrs/changedisplay.h | 61 - src/gui/widgets/attrs/derdisplay.cpp | 40 - src/gui/widgets/attrs/derdisplay.h | 44 - src/gui/widgets/avatarlistbox.cpp | 740 -- src/gui/widgets/avatarlistbox.h | 64 - src/gui/widgets/basiccontainer.cpp | 439 - src/gui/widgets/basiccontainer.h | 213 - src/gui/widgets/basiccontainer2.cpp | 128 - src/gui/widgets/basiccontainer2.h | 153 - src/gui/widgets/browserbox.cpp | 936 -- src/gui/widgets/browserbox.h | 210 - src/gui/widgets/browserbox.inc | 30 - src/gui/widgets/button.cpp | 934 -- src/gui/widgets/button.h | 347 - src/gui/widgets/characterdisplay.cpp | 160 - src/gui/widgets/characterdisplay.h | 93 - src/gui/widgets/characterviewbase.h | 63 - src/gui/widgets/characterviewnormal.cpp | 121 - src/gui/widgets/characterviewnormal.h | 50 - src/gui/widgets/characterviewsmall.cpp | 136 - src/gui/widgets/characterviewsmall.h | 54 - src/gui/widgets/chatinput.h | 105 - src/gui/widgets/checkbox.cpp | 338 - src/gui/widgets/checkbox.h | 216 - src/gui/widgets/colorpage.cpp | 124 - src/gui/widgets/colorpage.h | 48 - src/gui/widgets/container.cpp | 60 - src/gui/widgets/container.h | 51 - src/gui/widgets/containerplacer.cpp | 44 - src/gui/widgets/containerplacer.h | 73 - src/gui/widgets/createwidget.h | 41 - src/gui/widgets/desktop.cpp | 229 - src/gui/widgets/desktop.h | 88 - src/gui/widgets/dropdown.cpp | 580 - src/gui/widgets/dropdown.h | 166 - src/gui/widgets/emotepage.cpp | 167 - src/gui/widgets/emotepage.h | 67 - src/gui/widgets/emoteshortcutcontainer.cpp | 297 - src/gui/widgets/emoteshortcutcontainer.h | 92 - src/gui/widgets/equipmentbox.h | 41 - src/gui/widgets/equipmentpage.h | 53 - src/gui/widgets/extendedlistbox.cpp | 257 - src/gui/widgets/extendedlistbox.h | 61 - src/gui/widgets/extendedlistboxitem.h | 49 - src/gui/widgets/flowcontainer.cpp | 97 - src/gui/widgets/flowcontainer.h | 75 - src/gui/widgets/guitable.cpp | 675 -- src/gui/widgets/guitable.h | 207 - src/gui/widgets/horizontcontainer.cpp | 66 - src/gui/widgets/horizontcontainer.h | 62 - src/gui/widgets/icon.cpp | 105 - src/gui/widgets/icon.h | 83 - src/gui/widgets/inttextfield.cpp | 148 - src/gui/widgets/inttextfield.h | 85 - src/gui/widgets/itemcontainer.cpp | 1322 --- src/gui/widgets/itemcontainer.h | 223 - src/gui/widgets/itemlinkhandler.cpp | 223 - src/gui/widgets/itemlinkhandler.h | 61 - src/gui/widgets/itemshortcutcontainer.cpp | 650 -- src/gui/widgets/itemshortcutcontainer.h | 89 - src/gui/widgets/label.cpp | 292 - src/gui/widgets/label.h | 195 - src/gui/widgets/layout.cpp | 46 - src/gui/widgets/layout.h | 66 - src/gui/widgets/layoutarray.cpp | 313 - src/gui/widgets/layoutarray.h | 127 - src/gui/widgets/layoutcell.cpp | 136 - src/gui/widgets/layoutcell.h | 196 - src/gui/widgets/layouthelper.cpp | 79 - src/gui/widgets/layouthelper.h | 91 - src/gui/widgets/linepart.cpp | 33 - src/gui/widgets/linepart.h | 102 - src/gui/widgets/linkhandler.h | 49 - src/gui/widgets/listbox.cpp | 446 - src/gui/widgets/listbox.h | 296 - src/gui/widgets/passwordfield.cpp | 55 - src/gui/widgets/passwordfield.h | 55 - src/gui/widgets/playerbox.cpp | 190 - src/gui/widgets/playerbox.h | 112 - src/gui/widgets/popup.cpp | 273 - src/gui/widgets/popup.h | 193 - src/gui/widgets/popuplist.cpp | 188 - src/gui/widgets/popuplist.h | 84 - src/gui/widgets/progressbar.cpp | 376 - src/gui/widgets/progressbar.h | 166 - src/gui/widgets/progressindicator.cpp | 98 - src/gui/widgets/progressindicator.h | 54 - src/gui/widgets/radiobutton.cpp | 373 - src/gui/widgets/radiobutton.h | 247 - src/gui/widgets/radiogroup.cpp | 41 - src/gui/widgets/radiogroup.h | 41 - src/gui/widgets/scrollarea.cpp | 1460 --- src/gui/widgets/scrollarea.h | 598 -- src/gui/widgets/selldialog.cpp | 397 - src/gui/widgets/selldialog.h | 156 - src/gui/widgets/serverslistbox.h | 159 - src/gui/widgets/setupbuttonitem.cpp | 95 - src/gui/widgets/setupbuttonitem.h | 69 - src/gui/widgets/setupitem.cpp | 1338 --- src/gui/widgets/setupitem.h | 613 -- src/gui/widgets/setupquickitem.cpp | 117 - src/gui/widgets/setupquickitem.h | 80 - src/gui/widgets/setuptouchitem.cpp | 132 - src/gui/widgets/setuptouchitem.h | 67 - src/gui/widgets/shoplistbox.cpp | 310 - src/gui/widgets/shoplistbox.h | 113 - src/gui/widgets/shortcutcontainer.cpp | 159 - src/gui/widgets/shortcutcontainer.h | 120 - src/gui/widgets/skilllistbox.h | 290 - src/gui/widgets/skillrectanglelistbox.h | 418 - src/gui/widgets/slider.cpp | 517 - src/gui/widgets/slider.h | 337 - src/gui/widgets/sliderlist.cpp | 240 - src/gui/widgets/sliderlist.h | 89 - src/gui/widgets/spellshortcutcontainer.cpp | 371 - src/gui/widgets/spellshortcutcontainer.h | 86 - src/gui/widgets/staticbrowserbox.cpp | 781 -- src/gui/widgets/staticbrowserbox.h | 194 - src/gui/widgets/statspage.cpp | 88 - src/gui/widgets/statspage.h | 61 - src/gui/widgets/statspagebasic.cpp | 163 - src/gui/widgets/statspagebasic.h | 67 - src/gui/widgets/tabbedarea.cpp | 827 -- src/gui/widgets/tabbedarea.h | 299 - src/gui/widgets/tabs/chat/battletab.cpp | 44 - src/gui/widgets/tabs/chat/battletab.h | 43 - src/gui/widgets/tabs/chat/channeltab.cpp | 77 - src/gui/widgets/tabs/chat/channeltab.h | 51 - src/gui/widgets/tabs/chat/chattab.cpp | 563 - src/gui/widgets/tabs/chat/chattab.h | 216 - src/gui/widgets/tabs/chat/emulateguildtab.cpp | 108 - src/gui/widgets/tabs/chat/emulateguildtab.h | 59 - src/gui/widgets/tabs/chat/gmtab.cpp | 57 - src/gui/widgets/tabs/chat/gmtab.h | 49 - src/gui/widgets/tabs/chat/guildtab.cpp | 125 - src/gui/widgets/tabs/chat/guildtab.h | 56 - src/gui/widgets/tabs/chat/langtab.cpp | 38 - src/gui/widgets/tabs/chat/langtab.h | 39 - src/gui/widgets/tabs/chat/partytab.cpp | 151 - src/gui/widgets/tabs/chat/partytab.h | 58 - src/gui/widgets/tabs/chat/tradetab.cpp | 50 - src/gui/widgets/tabs/chat/tradetab.h | 46 - src/gui/widgets/tabs/chat/whispertab.cpp | 130 - src/gui/widgets/tabs/chat/whispertab.h | 73 - src/gui/widgets/tabs/debugwindowtabs.cpp | 492 - src/gui/widgets/tabs/debugwindowtabs.h | 129 - src/gui/widgets/tabs/setup_audio.cpp | 214 - src/gui/widgets/tabs/setup_audio.h | 47 - src/gui/widgets/tabs/setup_chat.cpp | 347 - src/gui/widgets/tabs/setup_chat.h | 40 - src/gui/widgets/tabs/setup_colors.cpp | 491 - src/gui/widgets/tabs/setup_colors.h | 91 - src/gui/widgets/tabs/setup_input.cpp | 399 - src/gui/widgets/tabs/setup_input.h | 105 - src/gui/widgets/tabs/setup_joystick.cpp | 184 - src/gui/widgets/tabs/setup_joystick.h | 62 - src/gui/widgets/tabs/setup_misc.cpp | 518 - src/gui/widgets/tabs/setup_misc.h | 52 - src/gui/widgets/tabs/setup_mods.cpp | 129 - src/gui/widgets/tabs/setup_mods.h | 50 - src/gui/widgets/tabs/setup_perfomance.cpp | 209 - src/gui/widgets/tabs/setup_perfomance.h | 46 - src/gui/widgets/tabs/setup_players.cpp | 211 - src/gui/widgets/tabs/setup_players.h | 49 - src/gui/widgets/tabs/setup_quick.cpp | 118 - src/gui/widgets/tabs/setup_quick.h | 45 - src/gui/widgets/tabs/setup_relations.cpp | 266 - src/gui/widgets/tabs/setup_relations.h | 79 - src/gui/widgets/tabs/setup_theme.cpp | 415 - src/gui/widgets/tabs/setup_theme.h | 113 - src/gui/widgets/tabs/setup_touch.cpp | 134 - src/gui/widgets/tabs/setup_touch.h | 44 - src/gui/widgets/tabs/setup_video.cpp | 534 - src/gui/widgets/tabs/setup_video.h | 88 - src/gui/widgets/tabs/setup_visual.cpp | 252 - src/gui/widgets/tabs/setup_visual.h | 51 - src/gui/widgets/tabs/setuptab.cpp | 44 - src/gui/widgets/tabs/setuptab.h | 74 - src/gui/widgets/tabs/setuptabscroll.cpp | 163 - src/gui/widgets/tabs/setuptabscroll.h | 81 - src/gui/widgets/tabs/shortcuttab.h | 47 - src/gui/widgets/tabs/skilltab.h | 88 - src/gui/widgets/tabs/socialattacktab.h | 77 - src/gui/widgets/tabs/socialfriendsfunctor.h | 59 - src/gui/widgets/tabs/socialfriendstab.h | 127 - src/gui/widgets/tabs/socialguildtab.h | 179 - src/gui/widgets/tabs/socialguildtab2.h | 106 - src/gui/widgets/tabs/socialnavigationtab.h | 308 - src/gui/widgets/tabs/socialpartytab.h | 171 - src/gui/widgets/tabs/socialpickuptab.h | 75 - src/gui/widgets/tabs/socialplayerstab.h | 198 - src/gui/widgets/tabs/socialtab.h | 143 - src/gui/widgets/tabs/socialtabbase.h | 84 - src/gui/widgets/tabs/tab.cpp | 488 - src/gui/widgets/tabs/tab.h | 245 - src/gui/widgets/tabstrip.cpp | 124 - src/gui/widgets/tabstrip.h | 57 - src/gui/widgets/textbox.cpp | 647 -- src/gui/widgets/textbox.h | 329 - src/gui/widgets/textfield.cpp | 837 -- src/gui/widgets/textfield.h | 293 - src/gui/widgets/textpreview.cpp | 151 - src/gui/widgets/textpreview.h | 144 - src/gui/widgets/vertcontainer.cpp | 89 - src/gui/widgets/vertcontainer.h | 66 - src/gui/widgets/virtshortcutcontainer.cpp | 383 - src/gui/widgets/virtshortcutcontainer.h | 92 - src/gui/widgets/widget.cpp | 526 - src/gui/widgets/widget.h | 1181 --- src/gui/widgets/widget2.h | 117 - src/gui/widgets/widgetgroup.cpp | 87 - src/gui/widgets/widgetgroup.h | 69 - src/gui/widgets/window.cpp | 1499 --- src/gui/widgets/window.h | 725 -- src/gui/widgets/windowcontainer.cpp | 105 - src/gui/widgets/windowcontainer.h | 74 - src/gui/windowmanager.cpp | 498 - src/gui/windowmanager.h | 87 - src/gui/windowmenu.cpp | 493 - src/gui/windowmenu.h | 118 - src/gui/windows/bankwindow.cpp | 102 - src/gui/windows/bankwindow.h | 64 - src/gui/windows/buydialog.cpp | 794 -- src/gui/windows/buydialog.h | 207 - src/gui/windows/buyingstoreselldialog.cpp | 70 - src/gui/windows/buyingstoreselldialog.h | 55 - src/gui/windows/buyselldialog.cpp | 167 - src/gui/windows/buyselldialog.h | 86 - src/gui/windows/changeemaildialog.cpp | 186 - src/gui/windows/changeemaildialog.h | 81 - src/gui/windows/changepassworddialog.cpp | 177 - src/gui/windows/changepassworddialog.h | 76 - src/gui/windows/charcreatedialog.cpp | 885 -- src/gui/windows/charcreatedialog.h | 171 - src/gui/windows/chardeleteconfirm.h | 65 - src/gui/windows/charselectdialog.cpp | 644 -- src/gui/windows/charselectdialog.h | 136 - src/gui/windows/chatwindow.cpp | 2181 ---- src/gui/windows/chatwindow.h | 406 - src/gui/windows/confirmdialog.cpp | 120 - src/gui/windows/confirmdialog.h | 71 - src/gui/windows/connectiondialog.cpp | 90 - src/gui/windows/connectiondialog.h | 69 - src/gui/windows/cutinwindow.cpp | 153 - src/gui/windows/cutinwindow.h | 61 - src/gui/windows/debugwindow.cpp | 173 - src/gui/windows/debugwindow.h | 78 - src/gui/windows/didyouknowwindow.cpp | 188 - src/gui/windows/didyouknowwindow.h | 76 - src/gui/windows/editdialog.cpp | 80 - src/gui/windows/editdialog.h | 72 - src/gui/windows/editserverdialog.cpp | 297 - src/gui/windows/editserverdialog.h | 86 - src/gui/windows/eggselectiondialog.cpp | 67 - src/gui/windows/eggselectiondialog.h | 45 - src/gui/windows/emotewindow.cpp | 278 - src/gui/windows/emotewindow.h | 89 - src/gui/windows/equipmentwindow.cpp | 848 -- src/gui/windows/equipmentwindow.h | 167 - src/gui/windows/helpwindow.cpp | 220 - src/gui/windows/helpwindow.h | 92 - src/gui/windows/insertcarddialog.cpp | 79 - src/gui/windows/insertcarddialog.h | 49 - src/gui/windows/inventorywindow.cpp | 1083 -- src/gui/windows/inventorywindow.h | 210 - src/gui/windows/itemamountwindow.cpp | 504 - src/gui/windows/itemamountwindow.h | 123 - src/gui/windows/killstats.cpp | 479 - src/gui/windows/killstats.h | 116 - src/gui/windows/logindialog.cpp | 402 - src/gui/windows/logindialog.h | 113 - src/gui/windows/maileditwindow.cpp | 278 - src/gui/windows/maileditwindow.h | 92 - src/gui/windows/mailviewwindow.cpp | 269 - src/gui/windows/mailviewwindow.h | 80 - src/gui/windows/mailwindow.cpp | 393 - src/gui/windows/mailwindow.h | 108 - src/gui/windows/minimap.cpp | 540 - src/gui/windows/minimap.h | 95 - src/gui/windows/ministatuswindow.cpp | 594 -- src/gui/windows/ministatuswindow.h | 151 - src/gui/windows/npcdialog.cpp | 1395 --- src/gui/windows/npcdialog.h | 324 - src/gui/windows/npcselldialog.cpp | 154 - src/gui/windows/npcselldialog.h | 59 - src/gui/windows/okdialog.cpp | 94 - src/gui/windows/okdialog.h | 72 - src/gui/windows/outfitwindow.cpp | 749 -- src/gui/windows/outfitwindow.h | 133 - src/gui/windows/questswindow.cpp | 483 - src/gui/windows/questswindow.h | 105 - src/gui/windows/quitdialog.cpp | 260 - src/gui/windows/quitdialog.h | 84 - src/gui/windows/registerdialog.cpp | 317 - src/gui/windows/registerdialog.h | 95 - src/gui/windows/serverdialog.cpp | 902 -- src/gui/windows/serverdialog.h | 150 - src/gui/windows/serverinfowindow.cpp | 184 - src/gui/windows/serverinfowindow.h | 68 - src/gui/windows/setupwindow.cpp | 335 - src/gui/windows/setupwindow.h | 96 - src/gui/windows/shopselldialog.cpp | 60 - src/gui/windows/shopselldialog.h | 54 - src/gui/windows/shopwindow.cpp | 1175 --- src/gui/windows/shopwindow.h | 207 - src/gui/windows/shortcutwindow.cpp | 269 - src/gui/windows/shortcutwindow.h | 100 - src/gui/windows/skilldialog.cpp | 1432 --- src/gui/windows/skilldialog.h | 237 - src/gui/windows/socialwindow.cpp | 659 -- src/gui/windows/socialwindow.h | 171 - src/gui/windows/statuswindow.cpp | 652 -- src/gui/windows/statuswindow.h | 119 - src/gui/windows/textcommandeditor.cpp | 344 - src/gui/windows/textcommandeditor.h | 116 - src/gui/windows/textdialog.cpp | 135 - src/gui/windows/textdialog.h | 85 - src/gui/windows/textselectdialog.cpp | 192 - src/gui/windows/textselectdialog.h | 104 - src/gui/windows/tradewindow.cpp | 553 - src/gui/windows/tradewindow.h | 214 - src/gui/windows/updaterwindow.cpp | 1217 --- src/gui/windows/updaterwindow.h | 252 - src/gui/windows/whoisonline.cpp | 909 -- src/gui/windows/whoisonline.h | 182 - src/gui/windows/worldselectdialog.cpp | 134 - src/gui/windows/worldselectdialog.h | 77 - src/guild.cpp | 389 - src/guild.h | 224 - src/input/inputactiondata.h | 52 - src/input/inputactionmap.h | 5963 ----------- src/input/inputactionoperators.cpp | 42 - src/input/inputactionoperators.h | 30 - src/input/inputactionsortfunctor.h | 46 - src/input/inputfunction.h | 37 - src/input/inputitem.h | 47 - src/input/inputmanager.cpp | 1096 -- src/input/inputmanager.h | 189 - src/input/joystick.cpp | 446 - src/input/joystick.h | 175 - src/input/key.cpp | 111 - src/input/key.h | 147 - src/input/keyboardconfig.cpp | 307 - src/input/keyboardconfig.h | 156 - src/input/keyinput.h | 177 - src/input/mouseinput.h | 219 - src/input/pages/basic.cpp | 271 - src/input/pages/basic.h | 31 - src/input/pages/chat.cpp | 251 - src/input/pages/chat.h | 28 - src/input/pages/craft.cpp | 89 - src/input/pages/craft.h | 28 - src/input/pages/emotes.cpp | 655 -- src/input/pages/emotes.h | 31 - src/input/pages/gui.cpp | 198 - src/input/pages/gui.h | 28 - src/input/pages/move.cpp | 404 - src/input/pages/move.h | 31 - src/input/pages/other.cpp | 465 - src/input/pages/other.h | 31 - src/input/pages/outfits.cpp | 374 - src/input/pages/outfits.h | 31 - src/input/pages/shortcuts.cpp | 176 - src/input/pages/shortcuts.h | 31 - src/input/pages/windows.cpp | 271 - src/input/pages/windows.h | 31 - src/input/touch/multitouchmanager.cpp | 88 - src/input/touch/multitouchmanager.h | 72 - src/input/touch/touchactions.cpp | 129 - src/input/touch/touchactions.h | 39 - src/input/touch/touchmanager.cpp | 709 -- src/input/touch/touchmanager.h | 204 - src/itemcolormanager.cpp | 57 - src/itemcolormanager.h | 42 - src/itemsoundmanager.cpp | 68 - src/itemsoundmanager.h | 50 - src/listeners/actionlistener.h | 108 - src/listeners/actorspritelistener.h | 51 - src/listeners/arrowslistener.cpp | 38 - src/listeners/arrowslistener.h | 40 - src/listeners/assertlistener.cpp | 41 - src/listeners/assertlistener.h | 47 - src/listeners/attributelistener.cpp | 40 - src/listeners/attributelistener.h | 46 - src/listeners/awaylistener.cpp | 48 - src/listeners/awaylistener.h | 39 - src/listeners/banklistener.cpp | 38 - src/listeners/banklistener.h | 40 - src/listeners/baselistener.hpp | 70 - src/listeners/buyingstoremodelistener.cpp | 38 - src/listeners/buyingstoremodelistener.h | 40 - src/listeners/buyingstoreslotslistener.cpp | 38 - src/listeners/buyingstoreslotslistener.h | 40 - src/listeners/charrenamelistener.cpp | 48 - src/listeners/charrenamelistener.h | 54 - src/listeners/configlistener.h | 57 - src/listeners/debugmessagelistener.cpp | 38 - src/listeners/debugmessagelistener.h | 42 - src/listeners/errorlistener.cpp | 39 - src/listeners/errorlistener.h | 44 - src/listeners/focuslistener.h | 115 - src/listeners/gamemodifierlistener.cpp | 38 - src/listeners/gamemodifierlistener.h | 40 - src/listeners/guiconfiglistener.h | 61 - src/listeners/guitableactionlistener.cpp | 64 - src/listeners/guitableactionlistener.h | 53 - src/listeners/inputactionremotelistener.cpp | 50 - src/listeners/inputactionremotelistener.h | 51 - src/listeners/inputactionreplaylistener.cpp | 66 - src/listeners/inputactionreplaylistener.h | 55 - src/listeners/insertcardlistener.h | 54 - src/listeners/inventorylistener.h | 45 - src/listeners/keylistener.h | 118 - src/listeners/mouselistener.h | 185 - src/listeners/openurllistener.h | 52 - src/listeners/pincodelistener.cpp | 40 - src/listeners/pincodelistener.h | 42 - src/listeners/playerdeathlistener.cpp | 38 - src/listeners/playerdeathlistener.h | 40 - src/listeners/playerlistener.cpp | 51 - src/listeners/playerlistener.h | 56 - src/listeners/playerpostdeathlistener.h | 65 - src/listeners/playerrelationslistener.h | 47 - src/listeners/renamelistener.cpp | 80 - src/listeners/renamelistener.h | 51 - src/listeners/requestadoptchildlistener.h | 46 - src/listeners/requesttradelistener.h | 58 - src/listeners/selectionlistener.h | 112 - src/listeners/shoprenamelistener.cpp | 45 - src/listeners/shoprenamelistener.h | 48 - src/listeners/skillwarplistener.cpp | 48 - src/listeners/skillwarplistener.h | 52 - src/listeners/statlistener.cpp | 40 - src/listeners/statlistener.h | 46 - src/listeners/tablemodellistener.h | 54 - src/listeners/textskilllistener.cpp | 63 - src/listeners/textskilllistener.h | 55 - src/listeners/tooltiplistener.cpp | 62 - src/listeners/tooltiplistener.h | 51 - src/listeners/updatestatuslistener.cpp | 38 - src/listeners/updatestatuslistener.h | 40 - src/listeners/uploadlistener.cpp | 32 - src/listeners/uploadlistener.h | 44 - src/listeners/vendingmodelistener.cpp | 38 - src/listeners/vendingmodelistener.h | 40 - src/listeners/vendingslotslistener.cpp | 38 - src/listeners/vendingslotslistener.h | 40 - src/listeners/weightlistener.h | 50 - src/listeners/widgetdeathlistener.h | 105 - src/listeners/widgetlistener.h | 135 - src/listeners/wrongdatanoticelistener.cpp | 44 - src/listeners/wrongdatanoticelistener.h | 49 - src/localconsts.h | 393 - src/logger.cpp | 493 - src/logger.h | 225 - src/main.cpp | 43 - src/main.h | 180 - src/maingui.cpp | 172 - src/maingui.h | 30 - src/manaplus.rc | 25 - src/mumblemanager.cpp | 318 - src/mumblemanager.h | 91 - src/navigationmanager.cpp | 178 - src/navigationmanager.h | 61 - src/net/adminhandler.h | 192 - src/net/auctionhandler.h | 76 - src/net/bankhandler.h | 55 - src/net/battlegroundhandler.h | 60 - src/net/beinghandler.h | 58 - src/net/buyingstorehandler.h | 67 - src/net/buysellhandler.h | 66 - src/net/cashshophandler.h | 67 - src/net/character.h | 64 - src/net/characters.h | 37 - src/net/charserverhandler.cpp | 48 - src/net/charserverhandler.h | 125 - src/net/chathandler.h | 111 - src/net/download.cpp | 643 -- src/net/download.h | 144 - src/net/ea/adminhandler.cpp | 76 - src/net/ea/adminhandler.h | 65 - src/net/ea/adminrecv.cpp | 44 - src/net/ea/adminrecv.h | 41 - src/net/ea/beinghandler.cpp | 39 - src/net/ea/beinghandler.h | 42 - src/net/ea/beingrecv.cpp | 520 - src/net/ea/beingrecv.h | 56 - src/net/ea/buysellhandler.cpp | 44 - src/net/ea/buysellhandler.h | 44 - src/net/ea/buysellrecv.cpp | 92 - src/net/ea/buysellrecv.h | 47 - src/net/ea/charserverhandler.cpp | 82 - src/net/ea/charserverhandler.h | 62 - src/net/ea/charserverrecv.cpp | 143 - src/net/ea/charserverrecv.h | 41 - src/net/ea/chathandler.cpp | 63 - src/net/ea/chathandler.h | 52 - src/net/ea/chatrecv.cpp | 192 - src/net/ea/chatrecv.h | 66 - src/net/ea/eaprotocol.h | 57 - src/net/ea/equipbackend.h | 109 - src/net/ea/gamehandler.cpp | 62 - src/net/ea/gamehandler.h | 52 - src/net/ea/gamerecv.cpp | 80 - src/net/ea/gamerecv.h | 48 - src/net/ea/inventoryhandler.cpp | 128 - src/net/ea/inventoryhandler.h | 72 - src/net/ea/inventoryitem.h | 125 - src/net/ea/inventoryrecv.cpp | 193 - src/net/ea/inventoryrecv.h | 64 - src/net/ea/itemhandler.cpp | 38 - src/net/ea/itemhandler.h | 43 - src/net/ea/itemrecv.cpp | 48 - src/net/ea/itemrecv.h | 41 - src/net/ea/loginhandler.cpp | 183 - src/net/ea/loginhandler.h | 86 - src/net/ea/loginrecv.cpp | 135 - src/net/ea/loginrecv.h | 50 - src/net/ea/maprecv.cpp | 59 - src/net/ea/maprecv.h | 40 - src/net/ea/network.cpp | 372 - src/net/ea/network.h | 121 - src/net/ea/npchandler.cpp | 43 - src/net/ea/npchandler.h | 46 - src/net/ea/npcrecv.cpp | 246 - src/net/ea/npcrecv.h | 53 - src/net/ea/partyhandler.cpp | 80 - src/net/ea/partyhandler.h | 57 - src/net/ea/partyrecv.cpp | 232 - src/net/ea/partyrecv.h | 54 - src/net/ea/playerhandler.cpp | 55 - src/net/ea/playerhandler.h | 50 - src/net/ea/playerrecv.cpp | 266 - src/net/ea/playerrecv.h | 48 - src/net/ea/skillhandler.cpp | 34 - src/net/ea/skillhandler.h | 43 - src/net/ea/skillrecv.cpp | 59 - src/net/ea/skillrecv.h | 41 - src/net/ea/token.h | 54 - src/net/ea/tradehandler.cpp | 51 - src/net/ea/tradehandler.h | 44 - src/net/ea/traderecv.cpp | 184 - src/net/ea/traderecv.h | 53 - src/net/eathena/adminhandler.cpp | 379 - src/net/eathena/adminhandler.h | 167 - src/net/eathena/adminrecv.cpp | 81 - src/net/eathena/adminrecv.h | 39 - src/net/eathena/auctionhandler.cpp | 116 - src/net/eathena/auctionhandler.h | 65 - src/net/eathena/auctionrecv.cpp | 85 - src/net/eathena/auctionrecv.h | 41 - src/net/eathena/bankhandler.cpp | 86 - src/net/eathena/bankhandler.h | 50 - src/net/eathena/bankrecv.cpp | 65 - src/net/eathena/bankrecv.h | 39 - src/net/eathena/battlegroundhandler.cpp | 81 - src/net/eathena/battlegroundhandler.h | 51 - src/net/eathena/battlegroundrecv.cpp | 123 - src/net/eathena/battlegroundrecv.h | 46 - src/net/eathena/beinghandler.cpp | 109 - src/net/eathena/beinghandler.h | 54 - src/net/eathena/beingrecv.cpp | 2191 ---- src/net/eathena/beingrecv.h | 136 - src/net/eathena/buyingstorehandler.cpp | 112 - src/net/eathena/buyingstorehandler.h | 54 - src/net/eathena/buyingstorerecv.cpp | 238 - src/net/eathena/buyingstorerecv.h | 55 - src/net/eathena/buysellhandler.cpp | 77 - src/net/eathena/buysellhandler.h | 59 - src/net/eathena/buysellrecv.cpp | 141 - src/net/eathena/buysellrecv.h | 41 - src/net/eathena/cashshophandler.cpp | 160 - src/net/eathena/cashshophandler.h | 57 - src/net/eathena/cashshoprecv.cpp | 181 - src/net/eathena/cashshoprecv.h | 45 - src/net/eathena/charserverhandler.cpp | 248 - src/net/eathena/charserverhandler.h | 88 - src/net/eathena/charserverrecv.cpp | 570 - src/net/eathena/charserverrecv.h | 68 - src/net/eathena/chathandler.cpp | 338 - src/net/eathena/chathandler.h | 103 - src/net/eathena/chatrecv.cpp | 768 -- src/net/eathena/chatrecv.h | 78 - src/net/eathena/elementalhandler.cpp | 39 - src/net/eathena/elementalhandler.h | 40 - src/net/eathena/elementalrecv.cpp | 73 - src/net/eathena/elementalrecv.h | 38 - src/net/eathena/familyhandler.cpp | 67 - src/net/eathena/familyhandler.h | 44 - src/net/eathena/familyrecv.cpp | 123 - src/net/eathena/familyrecv.h | 45 - src/net/eathena/friendshandler.cpp | 64 - src/net/eathena/friendshandler.h | 49 - src/net/eathena/friendsrecv.cpp | 76 - src/net/eathena/friendsrecv.h | 41 - src/net/eathena/gamehandler.cpp | 226 - src/net/eathena/gamehandler.h | 60 - src/net/eathena/gamerecv.cpp | 86 - src/net/eathena/gamerecv.h | 42 - src/net/eathena/generalhandler.cpp | 245 - src/net/eathena/generalhandler.h | 134 - src/net/eathena/generalrecv.cpp | 180 - src/net/eathena/generalrecv.h | 40 - src/net/eathena/guildhandler.cpp | 291 - src/net/eathena/guildhandler.h | 104 - src/net/eathena/guildrecv.cpp | 717 -- src/net/eathena/guildrecv.h | 77 - src/net/eathena/homunculushandler.cpp | 141 - src/net/eathena/homunculushandler.h | 59 - src/net/eathena/homunculusrecv.cpp | 227 - src/net/eathena/homunculusrecv.h | 42 - src/net/eathena/inventoryhandler.cpp | 603 -- src/net/eathena/inventoryhandler.h | 97 - src/net/eathena/inventoryrecv.cpp | 1441 --- src/net/eathena/inventoryrecv.h | 81 - src/net/eathena/itemflags.h | 45 - src/net/eathena/itemhandler.cpp | 35 - src/net/eathena/itemhandler.h | 41 - src/net/eathena/itemrecv.cpp | 178 - src/net/eathena/itemrecv.h | 43 - src/net/eathena/loginhandler.cpp | 167 - src/net/eathena/loginhandler.h | 70 - src/net/eathena/loginrecv.cpp | 294 - src/net/eathena/loginrecv.h | 44 - src/net/eathena/mail2handler.cpp | 285 - src/net/eathena/mail2handler.h | 88 - src/net/eathena/mail2recv.cpp | 526 - src/net/eathena/mail2recv.h | 55 - src/net/eathena/mailhandler.cpp | 109 - src/net/eathena/mailhandler.h | 61 - src/net/eathena/mailrecv.cpp | 251 - src/net/eathena/mailrecv.h | 45 - src/net/eathena/maphandler.cpp | 39 - src/net/eathena/maphandler.h | 41 - src/net/eathena/maprecv.cpp | 68 - src/net/eathena/maprecv.h | 41 - src/net/eathena/maptypeproperty2.h | 55 - src/net/eathena/markethandler.cpp | 145 - src/net/eathena/markethandler.h | 51 - src/net/eathena/marketrecv.cpp | 108 - src/net/eathena/marketrecv.h | 42 - src/net/eathena/menu.cpp | 28 - src/net/eathena/menu.h | 31 - src/net/eathena/mercenaryhandler.cpp | 121 - src/net/eathena/mercenaryhandler.h | 55 - src/net/eathena/mercenaryrecv.cpp | 194 - src/net/eathena/mercenaryrecv.h | 40 - src/net/eathena/messagein.cpp | 178 - src/net/eathena/messagein.h | 69 - src/net/eathena/messageout.cpp | 150 - src/net/eathena/messageout.h | 85 - src/net/eathena/network.cpp | 255 - src/net/eathena/network.h | 66 - src/net/eathena/npchandler.cpp | 365 - src/net/eathena/npchandler.h | 101 - src/net/eathena/npcrecv.cpp | 132 - src/net/eathena/npcrecv.h | 48 - src/net/eathena/packetsin.inc | 972 -- src/net/eathena/packetsout.inc | 8044 -------------- src/net/eathena/partyhandler.cpp | 203 - src/net/eathena/partyhandler.h | 69 - src/net/eathena/partyrecv.cpp | 422 - src/net/eathena/partyrecv.h | 54 - src/net/eathena/pethandler.cpp | 126 - src/net/eathena/pethandler.h | 64 - src/net/eathena/petrecv.cpp | 181 - src/net/eathena/petrecv.h | 43 - src/net/eathena/playerhandler.cpp | 718 -- src/net/eathena/playerhandler.h | 82 - src/net/eathena/playerrecv.cpp | 498 - src/net/eathena/playerrecv.h | 60 - src/net/eathena/protocolout.cpp | 32 - src/net/eathena/protocolout.h | 40 - src/net/eathena/questhandler.cpp | 50 - src/net/eathena/questhandler.h | 44 - src/net/eathena/questrecv.cpp | 205 - src/net/eathena/questrecv.h | 45 - src/net/eathena/recvpackets.inc | 32 - src/net/eathena/roulettehandler.cpp | 39 - src/net/eathena/roulettehandler.h | 40 - src/net/eathena/rouletterecv.cpp | 79 - src/net/eathena/rouletterecv.h | 40 - src/net/eathena/searchstorehandler.cpp | 88 - src/net/eathena/searchstorehandler.h | 53 - src/net/eathena/searchstorerecv.cpp | 109 - src/net/eathena/searchstorerecv.h | 40 - src/net/eathena/serverfeatures.cpp | 153 - src/net/eathena/serverfeatures.h | 86 - src/net/eathena/skillhandler.cpp | 152 - src/net/eathena/skillhandler.h | 70 - src/net/eathena/skillrecv.cpp | 529 - src/net/eathena/skillrecv.h | 56 - src/net/eathena/sp.h | 271 - src/net/eathena/sprite.h | 49 - src/net/eathena/tradehandler.cpp | 107 - src/net/eathena/tradehandler.h | 58 - src/net/eathena/traderecv.cpp | 185 - src/net/eathena/traderecv.h | 47 - src/net/eathena/updateprotocol.cpp | 57 - src/net/eathena/updateprotocol.h | 29 - src/net/eathena/vendinghandler.cpp | 150 - src/net/eathena/vendinghandler.h | 62 - src/net/eathena/vendingrecv.cpp | 277 - src/net/eathena/vendingrecv.h | 48 - src/net/elementalhandler.h | 45 - src/net/familyhandler.h | 51 - src/net/friendshandler.h | 55 - src/net/gamehandler.h | 71 - src/net/generalhandler.h | 65 - src/net/guildhandler.h | 106 - src/net/homunculushandler.h | 69 - src/net/hostsgroup.h | 42 - src/net/inventoryhandler.h | 114 - src/net/ipc.cpp | 226 - src/net/ipc.h | 79 - src/net/logindata.h | 110 - src/net/loginhandler.h | 114 - src/net/mail2handler.h | 100 - src/net/mailhandler.h | 67 - src/net/maphandler.h | 45 - src/net/markethandler.h | 62 - src/net/mercenaryhandler.h | 65 - src/net/messagein.cpp | 332 - src/net/messagein.h | 152 - src/net/messageout.cpp | 175 - src/net/messageout.h | 123 - src/net/net.cpp | 194 - src/net/net.h | 56 - src/net/npchandler.h | 123 - src/net/packetcounters.cpp | 137 - src/net/packetcounters.h | 71 - src/net/packetfunction.h | 33 - src/net/packetinfo.h | 46 - src/net/packetlimiter.cpp | 323 - src/net/packetlimiter.h | 41 - src/net/partyhandler.h | 90 - src/net/pethandler.h | 68 - src/net/playerhandler.h | 120 - src/net/protocoloutdefine.h | 28 - src/net/protocoloutinclude.h | 27 - src/net/protocoloutupdate.h | 28 - src/net/questhandler.h | 48 - src/net/recvpacketdefine.h | 36 - src/net/roulettehandler.h | 45 - src/net/sdltcpnet.cpp | 197 - src/net/sdltcpnet.h | 68 - src/net/searchstorehandler.h | 60 - src/net/serverfeatures.h | 90 - src/net/serverinfo.h | 228 - src/net/serverurlinfo.h | 49 - src/net/skillhandler.h | 77 - src/net/tmwa/adminhandler.cpp | 299 - src/net/tmwa/adminhandler.h | 178 - src/net/tmwa/auctionhandler.cpp | 81 - src/net/tmwa/auctionhandler.h | 65 - src/net/tmwa/bankhandler.cpp | 59 - src/net/tmwa/bankhandler.h | 51 - src/net/tmwa/battlegroundhandler.cpp | 58 - src/net/tmwa/battlegroundhandler.h | 54 - src/net/tmwa/beinghandler.cpp | 74 - src/net/tmwa/beinghandler.h | 55 - src/net/tmwa/beingrecv.cpp | 1517 --- src/net/tmwa/beingrecv.h | 78 - src/net/tmwa/buyingstorehandler.cpp | 61 - src/net/tmwa/buyingstorehandler.h | 56 - src/net/tmwa/buysellhandler.cpp | 131 - src/net/tmwa/buysellhandler.h | 59 - src/net/tmwa/buysellrecv.cpp | 123 - src/net/tmwa/buysellrecv.h | 41 - src/net/tmwa/cashshophandler.cpp | 68 - src/net/tmwa/cashshophandler.h | 58 - src/net/tmwa/charserverhandler.cpp | 196 - src/net/tmwa/charserverhandler.h | 91 - src/net/tmwa/charserverrecv.cpp | 304 - src/net/tmwa/charserverrecv.h | 47 - src/net/tmwa/chathandler.cpp | 260 - src/net/tmwa/chathandler.h | 109 - src/net/tmwa/chatrecv.cpp | 377 - src/net/tmwa/chatrecv.h | 50 - src/net/tmwa/elementalhandler.cpp | 39 - src/net/tmwa/elementalhandler.h | 39 - src/net/tmwa/familyhandler.cpp | 47 - src/net/tmwa/familyhandler.h | 46 - src/net/tmwa/friendshandler.cpp | 53 - src/net/tmwa/friendshandler.h | 49 - src/net/tmwa/gamehandler.cpp | 135 - src/net/tmwa/gamehandler.h | 60 - src/net/tmwa/gamerecv.cpp | 63 - src/net/tmwa/gamerecv.h | 39 - src/net/tmwa/generalhandler.cpp | 245 - src/net/tmwa/generalhandler.h | 133 - src/net/tmwa/generalrecv.cpp | 85 - src/net/tmwa/generalrecv.h | 39 - src/net/tmwa/guildhandler.cpp | 142 - src/net/tmwa/guildhandler.h | 102 - src/net/tmwa/guildmanager.cpp | 543 - src/net/tmwa/guildmanager.h | 106 - src/net/tmwa/homunculushandler.cpp | 75 - src/net/tmwa/homunculushandler.h | 62 - src/net/tmwa/inventoryhandler.cpp | 196 - src/net/tmwa/inventoryhandler.h | 91 - src/net/tmwa/inventoryrecv.cpp | 563 - src/net/tmwa/inventoryrecv.h | 52 - src/net/tmwa/itemhandler.cpp | 35 - src/net/tmwa/itemhandler.h | 41 - src/net/tmwa/itemrecv.cpp | 89 - src/net/tmwa/itemrecv.h | 40 - src/net/tmwa/loginhandler.cpp | 142 - src/net/tmwa/loginhandler.h | 72 - src/net/tmwa/loginrecv.cpp | 175 - src/net/tmwa/loginrecv.h | 41 - src/net/tmwa/mail2handler.cpp | 118 - src/net/tmwa/mail2handler.h | 88 - src/net/tmwa/mailhandler.cpp | 77 - src/net/tmwa/mailhandler.h | 62 - src/net/tmwa/maphandler.cpp | 39 - src/net/tmwa/maphandler.h | 41 - src/net/tmwa/markethandler.cpp | 55 - src/net/tmwa/markethandler.h | 50 - src/net/tmwa/mercenaryhandler.cpp | 67 - src/net/tmwa/mercenaryhandler.h | 58 - src/net/tmwa/messagein.cpp | 168 - src/net/tmwa/messagein.h | 68 - src/net/tmwa/messageout.cpp | 132 - src/net/tmwa/messageout.h | 82 - src/net/tmwa/network.cpp | 183 - src/net/tmwa/network.h | 63 - src/net/tmwa/npchandler.cpp | 246 - src/net/tmwa/npchandler.h | 102 - src/net/tmwa/packetsin.inc | 147 - src/net/tmwa/packetsout.inc | 110 - src/net/tmwa/partyhandler.cpp | 162 - src/net/tmwa/partyhandler.h | 70 - src/net/tmwa/partyrecv.cpp | 304 - src/net/tmwa/partyrecv.h | 44 - src/net/tmwa/pethandler.cpp | 84 - src/net/tmwa/pethandler.h | 67 - src/net/tmwa/playerhandler.cpp | 422 - src/net/tmwa/playerhandler.h | 92 - src/net/tmwa/playerrecv.cpp | 165 - src/net/tmwa/playerrecv.h | 40 - src/net/tmwa/protocolout.cpp | 30 - src/net/tmwa/protocolout.h | 40 - src/net/tmwa/questhandler.cpp | 44 - src/net/tmwa/questhandler.h | 45 - src/net/tmwa/questrecv.cpp | 67 - src/net/tmwa/questrecv.h | 38 - src/net/tmwa/recvpackets.inc | 32 - src/net/tmwa/roulettehandler.cpp | 39 - src/net/tmwa/roulettehandler.h | 40 - src/net/tmwa/searchstorehandler.cpp | 60 - src/net/tmwa/searchstorehandler.h | 53 - src/net/tmwa/serverfeatures.cpp | 151 - src/net/tmwa/serverfeatures.h | 86 - src/net/tmwa/skillhandler.cpp | 106 - src/net/tmwa/skillhandler.h | 70 - src/net/tmwa/skillrecv.cpp | 217 - src/net/tmwa/skillrecv.h | 40 - src/net/tmwa/sp.h | 80 - src/net/tmwa/sprite.h | 45 - src/net/tmwa/tradehandler.cpp | 103 - src/net/tmwa/tradehandler.h | 58 - src/net/tmwa/traderecv.cpp | 170 - src/net/tmwa/traderecv.h | 42 - src/net/tmwa/updateprotocol.cpp | 49 - src/net/tmwa/updateprotocol.h | 29 - src/net/tmwa/vendinghandler.cpp | 72 - src/net/tmwa/vendinghandler.h | 63 - src/net/tradehandler.h | 76 - src/net/updatetypeoperators.cpp | 40 - src/net/updatetypeoperators.h | 30 - src/net/uploadcharinfo.h | 52 - src/net/useragent.cpp | 42 - src/net/useragent.h | 31 - src/net/vendinghandler.h | 72 - src/net/worldinfo.h | 60 - src/notifymanager.cpp | 195 - src/notifymanager.h | 34 - src/options.h | 105 - src/particle/animationparticle.cpp | 42 - src/particle/animationparticle.h | 45 - src/particle/imageparticle.cpp | 92 - src/particle/imageparticle.h | 61 - src/particle/particle.cpp | 590 -- src/particle/particle.h | 329 - src/particle/particlecontainer.cpp | 55 - src/particle/particlecontainer.h | 71 - src/particle/particleemitter.cpp | 632 -- src/particle/particleemitter.h | 172 - src/particle/particleemitterprop.h | 127 - src/particle/particleengine.cpp | 343 - src/particle/particleengine.h | 130 - src/particle/particleinfo.h | 42 - src/particle/particlelist.cpp | 106 - src/particle/particlelist.h | 69 - src/particle/particletimer.h | 43 - src/particle/particlevector.cpp | 109 - src/particle/particlevector.h | 71 - src/particle/rotationalparticle.cpp | 43 - src/particle/rotationalparticle.h | 44 - src/particle/textparticle.cpp | 96 - src/particle/textparticle.h | 69 - src/party.cpp | 337 - src/party.h | 182 - src/position.cpp | 49 - src/position.h | 63 - src/progs/dyecmd/actions/actions.cpp | 120 - src/progs/dyecmd/actions/chat.cpp | 69 - src/progs/dyecmd/actions/commands.cpp | 167 - src/progs/dyecmd/actions/move.cpp | 44 - src/progs/dyecmd/actions/pets.cpp | 49 - src/progs/dyecmd/actions/statusbar.cpp | 49 - src/progs/dyecmd/actions/tabs.cpp | 39 - src/progs/dyecmd/actions/target.cpp | 39 - src/progs/dyecmd/actions/windows.cpp | 60 - src/progs/dyecmd/client.cpp | 818 -- src/progs/dyecmd/client.h | 119 - src/progs/dyecmd/dyemain.cpp | 119 - src/progs/dyecmd/gui/viewport.cpp | 272 - src/progs/dyecmd/gui/viewport.h | 213 - src/progs/manaplus/actions/actions.cpp | 1918 ---- src/progs/manaplus/actions/chat.cpp | 808 -- src/progs/manaplus/actions/commands.cpp | 2156 ---- src/progs/manaplus/actions/move.cpp | 280 - src/progs/manaplus/actions/pets.cpp | 248 - src/progs/manaplus/actions/statusbar.cpp | 200 - src/progs/manaplus/actions/tabs.cpp | 106 - src/progs/manaplus/actions/target.cpp | 90 - src/progs/manaplus/actions/windows.cpp | 383 - src/progs/manaplus/client.cpp | 1991 ---- src/progs/manaplus/client.h | 167 - src/progs/manaplus/gui/viewport.cpp | 1148 -- src/progs/manaplus/gui/viewport.h | 249 - src/render/graphics.cpp | 775 -- src/render/graphics.h | 557 - src/render/graphics_calcImageRect.hpp | 94 - src/render/graphics_drawImageRect.hpp | 83 - src/render/graphicsdef.hpp | 154 - src/render/imagegraphics.cpp | 64 - src/render/imagegraphics.h | 208 - src/render/mobileopengl2graphics.cpp | 1389 --- src/render/mobileopengl2graphics.h | 164 - src/render/mobileopenglgraphics.cpp | 1385 --- src/render/mobileopenglgraphics.h | 115 - src/render/modernopenglgraphics.cpp | 1403 --- src/render/modernopenglgraphics.h | 159 - src/render/nacl/naclfunctions.h | 35 - src/render/nacl/naclgles.cpp | 55 - src/render/nacl/naclgles.h | 32 - src/render/normalopenglgraphics.cpp | 1782 ---- src/render/normalopenglgraphics.h | 133 - src/render/nullopenglgraphics.cpp | 1251 --- src/render/nullopenglgraphics.h | 111 - src/render/opengl/mgl.cpp | 34 - src/render/opengl/mgl.h | 38 - src/render/opengl/mgl.hpp | 144 - src/render/opengl/mglcheck.h | 30 - src/render/opengl/mgldefines.h | 136 - src/render/opengl/mglemu.cpp | 54 - src/render/opengl/mglemu.h | 41 - src/render/opengl/mglfunctions.h | 101 - src/render/opengl/mgltypes.h | 226 - src/render/opengl/naclglfunctions.h | 322 - src/render/opengl/opengldebug.h | 38 - src/render/openglgraphicsdef.hpp | 58 - src/render/openglgraphicsdef1.hpp | 30 - src/render/openglgraphicsdefadvanced.hpp | 43 - src/render/openglx/mglx.cpp | 34 - src/render/openglx/mglx.h | 35 - src/render/openglx/mglx.hpp | 29 - src/render/openglx/mglxinit.cpp | 42 - src/render/openglx/mglxinit.h | 32 - src/render/openglx/mglxtypes.h | 41 - src/render/renderers.cpp | 117 - src/render/renderers.h | 32 - src/render/rendererslistsdl.h | 176 - src/render/rendererslistsdl2.h | 184 - src/render/safeopenglgraphics.cpp | 763 -- src/render/safeopenglgraphics.h | 80 - src/render/sdl2graphics.cpp | 789 -- src/render/sdl2graphics.h | 116 - src/render/sdl2softwaregraphics.cpp | 1530 --- src/render/sdl2softwaregraphics.h | 89 - src/render/sdlgraphics.cpp | 1518 --- src/render/sdlgraphics.h | 75 - src/render/shaders/shader.cpp | 41 - src/render/shaders/shader.h | 45 - src/render/shaders/shaderprogram.cpp | 54 - src/render/shaders/shaderprogram.h | 51 - src/render/shaders/shadersmanager.cpp | 146 - src/render/shaders/shadersmanager.h | 57 - src/render/softwaregraphicsdef.hpp | 27 - src/render/surfacegraphics.cpp | 156 - src/render/surfacegraphics.h | 218 - src/render/vertexes/imagecollection.cpp | 52 - src/render/vertexes/imagecollection.h | 52 - src/render/vertexes/imagevertexes.cpp | 41 - src/render/vertexes/imagevertexes.h | 59 - src/render/vertexes/openglgraphicsvertexes.cpp | 225 - src/render/vertexes/openglgraphicsvertexes.h | 109 - src/resources/action.cpp | 105 - src/resources/action.h | 79 - src/resources/ambientlayer.cpp | 155 - src/resources/ambientlayer.h | 89 - src/resources/animation/animation.cpp | 107 - src/resources/animation/animation.h | 103 - src/resources/animation/simpleanimation.cpp | 237 - src/resources/animation/simpleanimation.h | 99 - src/resources/atlas/atlasitem.h | 62 - src/resources/atlas/atlasmanager.cpp | 555 - src/resources/atlas/atlasmanager.h | 78 - src/resources/atlas/atlasresource.cpp | 91 - src/resources/atlas/atlasresource.h | 55 - src/resources/atlas/textureatlas.h | 81 - src/resources/attack.h | 73 - src/resources/basicstat.h | 49 - src/resources/beingcommon.cpp | 268 - src/resources/beingcommon.h | 82 - src/resources/beinginfo.cpp | 268 - src/resources/beinginfo.h | 404 - src/resources/beingmenuitem.h | 43 - src/resources/beingslot.cpp | 25 - src/resources/beingslot.h | 52 - src/resources/chatobject.cpp | 69 - src/resources/chatobject.h | 56 - src/resources/cursors.cpp | 69 - src/resources/cursors.h | 43 - src/resources/db/avatardb.cpp | 146 - src/resources/db/avatardb.h | 47 - src/resources/db/badgesdb.cpp | 114 - src/resources/db/badgesdb.h | 45 - src/resources/db/chardb.cpp | 189 - src/resources/db/chardb.h | 75 - src/resources/db/colordb.cpp | 225 - src/resources/db/colordb.h | 74 - src/resources/db/commandsdb.cpp | 162 - src/resources/db/commandsdb.h | 50 - src/resources/db/deaddb.cpp | 108 - src/resources/db/deaddb.h | 49 - src/resources/db/elementaldb.cpp | 153 - src/resources/db/elementaldb.h | 50 - src/resources/db/emotedb.cpp | 317 - src/resources/db/emotedb.h | 70 - src/resources/db/groupdb.cpp | 394 - src/resources/db/groupdb.h | 55 - src/resources/db/homunculusdb.cpp | 159 - src/resources/db/homunculusdb.h | 50 - src/resources/db/horsedb.cpp | 302 - src/resources/db/horsedb.h | 59 - src/resources/db/itemdb.cpp | 1232 --- src/resources/db/itemdb.h | 78 - src/resources/db/itemfielddb.cpp | 153 - src/resources/db/itemfielddb.h | 49 - src/resources/db/itemoptiondb.cpp | 151 - src/resources/db/itemoptiondb.h | 49 - src/resources/db/languagedb.cpp | 124 - src/resources/db/languagedb.h | 44 - src/resources/db/mapdb.cpp | 225 - src/resources/db/mapdb.h | 72 - src/resources/db/mercenarydb.cpp | 157 - src/resources/db/mercenarydb.h | 50 - src/resources/db/moddb.cpp | 118 - src/resources/db/moddb.h | 46 - src/resources/db/monsterdb.cpp | 160 - src/resources/db/monsterdb.h | 50 - src/resources/db/networkdb.cpp | 88 - src/resources/db/networkdb.h | 56 - src/resources/db/npcdb.cpp | 203 - src/resources/db/npcdb.h | 52 - src/resources/db/npcdialogdb.cpp | 229 - src/resources/db/npcdialogdb.h | 60 - src/resources/db/palettedb.cpp | 115 - src/resources/db/palettedb.h | 39 - src/resources/db/petdb.cpp | 167 - src/resources/db/petdb.h | 47 - src/resources/db/questdb.cpp | 264 - src/resources/db/questdb.h | 55 - src/resources/db/skillunitdb.cpp | 161 - src/resources/db/skillunitdb.h | 47 - src/resources/db/sounddb.cpp | 99 - src/resources/db/sounddb.h | 42 - src/resources/db/statdb.cpp | 235 - src/resources/db/statdb.h | 50 - src/resources/db/statuseffectdb.cpp | 251 - src/resources/db/statuseffectdb.h | 76 - src/resources/db/textdb.cpp | 104 - src/resources/db/textdb.h | 44 - src/resources/db/unitsdb.cpp | 400 - src/resources/db/unitsdb.h | 68 - src/resources/db/weaponsdb.cpp | 85 - src/resources/db/weaponsdb.h | 44 - src/resources/dbmanager.cpp | 139 - src/resources/dbmanager.h | 30 - src/resources/delayedmanager.cpp | 71 - src/resources/delayedmanager.h | 57 - src/resources/dye/dye.cpp | 411 - src/resources/dye/dye.h | 95 - src/resources/dye/dyecolor.h | 84 - src/resources/dye/dyepalette.cpp | 311 - src/resources/dye/dyepalette.h | 187 - src/resources/dye/dyepalette_replaceacolor.cpp | 282 - src/resources/dye/dyepalette_replaceaoglcolor.cpp | 398 - src/resources/dye/dyepalette_replacescolor.cpp | 300 - src/resources/dye/dyepalette_replacesoglcolor.cpp | 402 - src/resources/dye/dyepaletteptr.h | 31 - src/resources/effectdescription.h | 49 - src/resources/emoteinfo.h | 50 - src/resources/emotesprite.h | 46 - src/resources/equipmentslots.h | 41 - src/resources/fboinfo.h | 60 - src/resources/frame.h | 50 - src/resources/groupinfo.cpp | 37 - src/resources/groupinfo.h | 50 - src/resources/horseinfo.h | 56 - src/resources/horseoffset.h | 47 - src/resources/image/image.cpp | 527 - src/resources/image/image.h | 258 - src/resources/image/subimage.cpp | 233 - src/resources/image/subimage.h | 84 - src/resources/imagehelper.cpp | 256 - src/resources/imagehelper.h | 122 - src/resources/imagerect.h | 44 - src/resources/imageset.cpp | 82 - src/resources/imageset.h | 98 - src/resources/inventory/complexinventory.cpp | 170 - src/resources/inventory/complexinventory.h | 65 - src/resources/inventory/inventory.cpp | 556 - src/resources/inventory/inventory.h | 219 - src/resources/item/cardslist.cpp | 25 - src/resources/item/cardslist.h | 72 - src/resources/item/complexitem.cpp | 96 - src/resources/item/complexitem.h | 65 - src/resources/item/item.cpp | 198 - src/resources/item/item.h | 267 - src/resources/item/itemfieldtype.h | 45 - src/resources/item/itemoption.h | 39 - src/resources/item/itemoptionslist.h | 102 - src/resources/item/shopitem.cpp | 174 - src/resources/item/shopitem.h | 181 - src/resources/itemcolordata.h | 56 - src/resources/iteminfo.cpp | 483 - src/resources/iteminfo.h | 397 - src/resources/itemmenuitem.h | 49 - src/resources/itemtypemap.h | 40 - src/resources/itemtypemapdata.h | 107 - src/resources/loaders/atlasloader.cpp | 62 - src/resources/loaders/atlasloader.h | 38 - src/resources/loaders/emptyatlasloader.cpp | 63 - src/resources/loaders/emptyatlasloader.h | 38 - src/resources/loaders/imageloader.cpp | 90 - src/resources/loaders/imageloader.h | 41 - src/resources/loaders/imagesetloader.cpp | 79 - src/resources/loaders/imagesetloader.h | 43 - src/resources/loaders/musicloader.cpp | 81 - src/resources/loaders/musicloader.h | 41 - src/resources/loaders/rescaledloader.cpp | 76 - src/resources/loaders/rescaledloader.h | 37 - src/resources/loaders/shaderloader.cpp | 67 - src/resources/loaders/shaderloader.h | 41 - src/resources/loaders/shaderprogramloader.cpp | 73 - src/resources/loaders/shaderprogramloader.h | 42 - src/resources/loaders/soundloader.cpp | 75 - src/resources/loaders/soundloader.h | 41 - src/resources/loaders/spritedefloader.cpp | 69 - src/resources/loaders/spritedefloader.h | 43 - src/resources/loaders/subimageloader.cpp | 90 - src/resources/loaders/subimageloader.h | 39 - src/resources/loaders/subimagesetloader.cpp | 78 - src/resources/loaders/subimagesetloader.h | 38 - src/resources/loaders/walklayerloader.cpp | 71 - src/resources/loaders/walklayerloader.h | 39 - src/resources/loaders/xmlloader.cpp | 62 - src/resources/loaders/xmlloader.h | 38 - src/resources/mailqueue.h | 49 - src/resources/map/location.h | 60 - src/resources/map/map.cpp | 1786 ---- src/resources/map/map.h | 495 - src/resources/map/mapheights.cpp | 49 - src/resources/map/mapheights.h | 60 - src/resources/map/mapitem.cpp | 174 - src/resources/map/mapitem.h | 92 - src/resources/map/maplayer.cpp | 853 -- src/resources/map/maplayer.h | 229 - src/resources/map/mapobject.h | 46 - src/resources/map/mapobjectlist.h | 45 - src/resources/map/maprowvertexes.h | 52 - src/resources/map/metatile.h | 53 - src/resources/map/objectslayer.cpp | 86 - src/resources/map/objectslayer.h | 57 - src/resources/map/properties.h | 136 - src/resources/map/speciallayer.cpp | 189 - src/resources/map/speciallayer.h | 85 - src/resources/map/tileanimation.cpp | 67 - src/resources/map/tileanimation.h | 66 - src/resources/map/tileinfo.h | 53 - src/resources/map/tileset.h | 101 - src/resources/map/walklayer.cpp | 51 - src/resources/map/walklayer.h | 53 - src/resources/mapinfo.h | 43 - src/resources/mapreader.cpp | 1324 --- src/resources/mapreader.h | 123 - src/resources/memorycounter.cpp | 50 - src/resources/memorycounter.h | 51 - src/resources/memorymanager.cpp | 99 - src/resources/memorymanager.h | 54 - src/resources/missileinfo.h | 47 - src/resources/mobileopenglscreenshothelper.cpp | 131 - src/resources/mobileopenglscreenshothelper.h | 52 - src/resources/modinfo.cpp | 34 - src/resources/modinfo.h | 71 - src/resources/mstack.h | 100 - src/resources/notificationinfo.h | 47 - src/resources/notifications.h | 914 -- src/resources/npcbuttoninfo.h | 52 - src/resources/npcdialoginfo.h | 47 - src/resources/npcdialogmenuinfo.h | 48 - src/resources/npcimageinfo.h | 44 - src/resources/npcinventoryinfo.h | 42 - src/resources/npctextinfo.h | 48 - src/resources/openglimagehelper.cpp | 528 - src/resources/openglimagehelper.h | 162 - src/resources/openglscreenshothelper.cpp | 107 - src/resources/openglscreenshothelper.h | 52 - src/resources/questeffect.h | 51 - src/resources/questitem.h | 58 - src/resources/questitemtext.h | 51 - src/resources/questvar.h | 60 - src/resources/rect/doublerect.h | 39 - src/resources/resource.cpp | 80 - src/resources/resource.h | 95 - src/resources/resourcefunctiontypes.h | 41 - src/resources/resourcemanager/resourcemanager.cpp | 711 -- src/resources/resourcemanager/resourcemanager.h | 125 - src/resources/resourcetypes.h | 41 - src/resources/safeopenglimagehelper.cpp | 501 - src/resources/safeopenglimagehelper.h | 162 - src/resources/screenshothelper.h | 51 - src/resources/sdl2imagehelper.cpp | 109 - src/resources/sdl2imagehelper.h | 100 - src/resources/sdl2softwareimagehelper.cpp | 83 - src/resources/sdl2softwareimagehelper.h | 96 - src/resources/sdl2softwarescreenshothelper.cpp | 85 - src/resources/sdl2softwarescreenshothelper.h | 47 - src/resources/sdlgfxblitfunc.cpp | 542 - src/resources/sdlgfxblitfunc.h | 42 - src/resources/sdlimagehelper.cpp | 339 - src/resources/sdlimagehelper.h | 106 - src/resources/sdlmusic.cpp | 73 - src/resources/sdlmusic.h | 83 - src/resources/sdlscreenshothelper.cpp | 80 - src/resources/sdlscreenshothelper.h | 44 - src/resources/servercommands.inc | 290 - src/resources/serverpermissions.inc | 54 - src/resources/skill/skilldata.cpp | 80 - src/resources/skill/skilldata.h | 67 - src/resources/skill/skillinfo.cpp | 204 - src/resources/skill/skillinfo.h | 108 - src/resources/skill/skilltypeentry.h | 36 - src/resources/skill/skilltypelist.h | 48 - src/resources/soundeffect.cpp | 45 - src/resources/soundeffect.h | 81 - src/resources/soundinfo.h | 51 - src/resources/sprite/animatedsprite.cpp | 485 - src/resources/sprite/animatedsprite.h | 186 - src/resources/sprite/animationdelayload.cpp | 65 - src/resources/sprite/animationdelayload.h | 55 - src/resources/sprite/imagesprite.cpp | 60 - src/resources/sprite/imagesprite.h | 82 - src/resources/sprite/sprite.h | 132 - src/resources/sprite/spritedef.cpp | 694 -- src/resources/sprite/spritedef.h | 166 - src/resources/sprite/spritedisplay.h | 50 - src/resources/sprite/spritereference.h | 53 - src/resources/surfaceimagehelper.cpp | 86 - src/resources/surfaceimagehelper.h | 95 - src/resources/updatefile.h | 53 - src/resources/wallpaper.cpp | 166 - src/resources/wallpaper.h | 56 - src/resources/wallpaperdata.h | 46 - src/sdl2gfx/SDL2_framerate.cpp | 211 - src/sdl2gfx/SDL2_framerate.h | 110 - src/sdl2gfx/SDL2_rotozoom.cpp | 1944 ---- src/sdl2gfx/SDL2_rotozoom.h | 131 - src/sdlshared.h | 66 - src/settings.cpp | 39 - src/settings.h | 168 - src/soundmanager.cpp | 589 -- src/soundmanager.h | 177 - src/spellmanager.cpp | 449 - src/spellmanager.h | 90 - src/statuseffect.cpp | 100 - src/statuseffect.h | 91 - src/test/testlauncher.cpp | 835 -- src/test/testlauncher.h | 92 - src/test/testmain.cpp | 431 - src/test/testmain.h | 93 - src/text.cpp | 206 - src/text.h | 138 - src/textcommand.cpp | 141 - src/textcommand.h | 180 - src/textmanager.cpp | 195 - src/textmanager.h | 82 - src/unittests/catch.hpp | 10502 ------------------- src/unittests/configuration.cc | 293 - src/unittests/doctest.h | 5613 ---------- src/unittests/endian.cc | 60 - src/unittests/enums/enums.cc | 35 - src/unittests/enums/render/mockdrawtype.h | 35 - src/unittests/fs/files.cc | 207 - src/unittests/fs/virtfs/throw.cc | 225 - src/unittests/fs/virtfs/virtfs.cc | 996 -- src/unittests/fs/virtfs/virtfs1_basic.cc | 46 - src/unittests/fs/virtfs/virtfs1_enumerate.cc | 410 - src/unittests/fs/virtfs/virtfs1_exists.cc | 154 - src/unittests/fs/virtfs/virtfs1_getrealdir.cc | 202 - src/unittests/fs/virtfs/virtfs1_mountdir1.cc | 195 - src/unittests/fs/virtfs/virtfs1_mountdir2.cc | 315 - src/unittests/fs/virtfs/virtfs1_mountzip1.cc | 173 - src/unittests/fs/virtfs/virtfs1_mountzip2.cc | 202 - src/unittests/fs/virtfs/virtfs1_unmount.cc | 377 - src/unittests/fs/virtfs/virtfs2.cc | 1643 --- src/unittests/fs/virtfs/zip.cc | 283 - src/unittests/gui/fonts/textchunklist.cc | 548 - src/unittests/gui/widgets/browserbox.cc | 191 - src/unittests/gui/windowmanager.cc | 991 -- src/unittests/integrity.cc | 360 - src/unittests/render/mockdrawitem.h | 60 - src/unittests/render/mockgraphics.cc | 302 - src/unittests/render/mockgraphics.h | 55 - src/unittests/resources/dye/dye.cc | 2014 ---- src/unittests/resources/dye/dyepalette.cc | 400 - src/unittests/resources/map/maplayer/draw.cc | 580 - .../resources/map/maplayer/drawfringenormal.cc | 529 - .../resources/map/maplayer/drawfringesimple.cc | 507 - .../resources/map/maplayer/drawspeciallayer1.cc | 396 - .../resources/map/maplayer/drawspeciallayer2.cc | 402 - .../map/maplayer/getemptytiledrawwidth.cc | 162 - .../resources/map/maplayer/gettiledrawwidth.cc | 399 - .../resources/map/maplayer/updatecache.cc | 399 - .../resources/map/maplayer/updateconditiontiles.cc | 231 - src/unittests/resources/map/speciallayer.cc | 288 - src/unittests/resources/mstack.cc | 165 - .../resources/resourcemanager/resourcemanager.cc | 693 -- src/unittests/resources/sdlimagehelper.cc | 559 - src/unittests/resources/sprite/animatedsprite.cc | 198 - src/unittests/sdl.cc | 405 - src/unittests/unittests.h | 52 - src/unittests/utils/chatutils.cc | 265 - src/unittests/utils/checkutils.cc | 174 - src/unittests/utils/dumplibs.cc | 138 - src/unittests/utils/langs.cc | 115 - src/unittests/utils/mathutils.cc | 102 - src/unittests/utils/parameters.cc | 327 - src/unittests/utils/stringutils.cc | 1715 --- src/unittests/utils/timer.cc | 88 - src/unittests/utils/translation/poparser.cc | 136 - src/unittests/utils/xml.cc | 393 - src/unittests/utils/xmlutils.cc | 225 - src/utils/base64.cpp | 214 - src/utils/base64.h | 46 - src/utils/booleanoptions.h | 32 - src/utils/browserboxtools.cpp | 169 - src/utils/browserboxtools.h | 39 - src/utils/buildhex.h | 48 - src/utils/cast.h | 35 - src/utils/chatutils.cpp | 201 - src/utils/chatutils.h | 36 - src/utils/checkutils.cpp | 76 - src/utils/checkutils.h | 261 - src/utils/copynpaste.cpp | 522 - src/utils/copynpaste.h | 42 - src/utils/cpu.cpp | 178 - src/utils/cpu.h | 48 - src/utils/delete2.h | 36 - src/utils/dtor.h | 60 - src/utils/dumplibs.cpp | 169 - src/utils/dumplibs.h | 28 - src/utils/dumpsizes.cpp | 40 - src/utils/dumpsizes.h | 28 - src/utils/env.cpp | 73 - src/utils/env.h | 30 - src/utils/foreach.h | 36 - src/utils/fuzzer.cpp | 60 - src/utils/fuzzer.h | 34 - src/utils/gettext.h | 55 - src/utils/gettexthelper.cpp | 156 - src/utils/gettexthelper.h | 45 - src/utils/glxhelper.cpp | 142 - src/utils/glxhelper.h | 42 - src/utils/gmfunctions.cpp | 122 - src/utils/gmfunctions.h | 43 - src/utils/intmap.h | 30 - src/utils/langs.cpp | 123 - src/utils/langs.h | 41 - src/utils/likely.h | 32 - src/utils/mathutils.h | 251 - src/utils/mrand.cpp | 45 - src/utils/mrand.h | 30 - src/utils/mutex.h | 110 - src/utils/naclmessages.cpp | 109 - src/utils/naclmessages.h | 41 - src/utils/parameters.cpp | 119 - src/utils/parameters.h | 33 - src/utils/perfomance.cpp | 100 - src/utils/perfomance.h | 83 - src/utils/pnglib.cpp | 113 - src/utils/pnglib.h | 38 - src/utils/process.cpp | 328 - src/utils/process.h | 37 - src/utils/sdl2helper.cpp | 271 - src/utils/sdl2helper.h | 84 - src/utils/sdl2logger.cpp | 161 - src/utils/sdl2logger.h | 36 - src/utils/sdlcheckutils.cpp | 201 - src/utils/sdlcheckutils.h | 78 - src/utils/sdlhelper.cpp | 217 - src/utils/sdlhelper.h | 85 - src/utils/sdlmemoryobject.h | 55 - src/utils/sdlpixel.h | 254 - src/utils/sdlsharedhelper.cpp | 55 - src/utils/sdlsharedhelper.h | 31 - src/utils/stdmove.h | 30 - src/utils/stringmap.h | 31 - src/utils/stringutils.cpp | 1238 --- src/utils/stringutils.h | 288 - src/utils/stringvector.h | 32 - src/utils/timer.cpp | 124 - src/utils/timer.h | 44 - src/utils/translation/podict.cpp | 61 - src/utils/translation/podict.h | 73 - src/utils/translation/poparser.cpp | 286 - src/utils/translation/poparser.h | 87 - src/utils/translation/translationmanager.cpp | 154 - src/utils/translation/translationmanager.h | 58 - src/utils/vector.h | 32 - src/utils/x11logger.cpp | 213 - src/utils/x11logger.h | 36 - src/utils/xml.h | 34 - src/utils/xml.inc | 30 - src/utils/xml/libxml.cpp | 346 - src/utils/xml/libxml.h | 164 - src/utils/xml/libxml.inc | 73 - src/utils/xml/pugixml.cpp | 352 - src/utils/xml/pugixml.h | 166 - src/utils/xml/pugixml.inc | 58 - src/utils/xml/pugixmlwriter.cpp | 74 - src/utils/xml/pugixmlwriter.h | 65 - src/utils/xml/tinyxml2.cpp | 323 - src/utils/xml/tinyxml2.h | 168 - src/utils/xml/tinyxml2.inc | 77 - src/utils/xmlutils.cpp | 185 - src/utils/xmlutils.h | 57 - src/utils/xmlwriter.h | 28 - src/variabledata.h | 132 - src/vector.cpp | 31 - src/vector.h | 216 - src/winver.h | 26 - src/winver.h.in | 26 - 1896 files changed, 364314 deletions(-) delete mode 100644 src/CMakeLists.txt delete mode 100644 src/Makefile.am delete mode 100644 src/SDLMain.m delete mode 100644 src/actions/actiondef.h delete mode 100644 src/actions/actionfuncptr.h delete mode 100644 src/actions/actions.h delete mode 100644 src/actions/chat.h delete mode 100644 src/actions/commands.h delete mode 100644 src/actions/move.h delete mode 100644 src/actions/pets.h delete mode 100644 src/actions/statusbar.h delete mode 100644 src/actions/tabs.h delete mode 100644 src/actions/target.h delete mode 100644 src/actions/windows.h delete mode 100644 src/actormanager.cpp delete mode 100644 src/actormanager.h delete mode 100644 src/avatar.cpp delete mode 100644 src/avatar.h delete mode 100644 src/being/actor.cpp delete mode 100644 src/being/actor.h delete mode 100644 src/being/actorsprite.cpp delete mode 100644 src/being/actorsprite.h delete mode 100644 src/being/being.cpp delete mode 100644 src/being/being.h delete mode 100644 src/being/beingcacheentry.h delete mode 100644 src/being/beingflag.h delete mode 100644 src/being/beingspeech.h delete mode 100644 src/being/castingeffect.cpp delete mode 100644 src/being/castingeffect.h delete mode 100644 src/being/compounditem.h delete mode 100644 src/being/compoundsprite.cpp delete mode 100644 src/being/compoundsprite.h delete mode 100644 src/being/crazymoves.cpp delete mode 100644 src/being/crazymoves.h delete mode 100644 src/being/flooritem.cpp delete mode 100644 src/being/flooritem.h delete mode 100644 src/being/homunculusinfo.h delete mode 100644 src/being/localplayer.cpp delete mode 100644 src/being/localplayer.h delete mode 100644 src/being/mercenaryinfo.h delete mode 100644 src/being/petinfo.h delete mode 100644 src/being/playerignorestrategy.h delete mode 100644 src/being/playerinfo.cpp delete mode 100644 src/being/playerinfo.h delete mode 100644 src/being/playerrelation.cpp delete mode 100644 src/being/playerrelation.h delete mode 100644 src/being/playerrelations.cpp delete mode 100644 src/being/playerrelations.h delete mode 100644 src/beingequipbackend.cpp delete mode 100644 src/beingequipbackend.h delete mode 100644 src/chatlogger.cpp delete mode 100644 src/chatlogger.h delete mode 100644 src/client.h delete mode 100644 src/commandline.cpp delete mode 100644 src/commandline.h delete mode 100644 src/configmanager.cpp delete mode 100644 src/configmanager.h delete mode 100644 src/configuration.cpp delete mode 100644 src/configuration.h delete mode 100644 src/const/emoteshortcut.h delete mode 100644 src/const/equipment.h delete mode 100644 src/const/gui/chat.h delete mode 100644 src/const/gui/pages.h delete mode 100644 src/const/gui/theme.h delete mode 100644 src/const/itemshortcut.h delete mode 100644 src/const/net/inventory.h delete mode 100644 src/const/net/maxpacketversion.h delete mode 100644 src/const/net/net.h delete mode 100644 src/const/net/nostat.h delete mode 100644 src/const/net/skill.h delete mode 100644 src/const/render/graphics.h delete mode 100644 src/const/resources/currency.h delete mode 100644 src/const/resources/item/cards.h delete mode 100644 src/const/resources/item/itemoptions.h delete mode 100644 src/const/resources/map/map.h delete mode 100644 src/const/resources/skill.h delete mode 100644 src/const/resources/spriteaction.h delete mode 100644 src/const/sound.h delete mode 100644 src/const/spells.h delete mode 100644 src/const/utils/timer.h delete mode 100644 src/const/utils/utf8.h delete mode 100644 src/debug.h delete mode 100644 src/debug/mse/LICENSE_1_0.txt delete mode 100644 src/debug/mse/msemsevector.h delete mode 100644 src/debug/mse/msemstdvector.h delete mode 100644 src/debug/mse/mseprimitives.h delete mode 100644 src/debug/mse/source.txt delete mode 100644 src/debug/nvwa/_nvwa.h delete mode 100644 src/debug/nvwa/c++11.h delete mode 100644 src/debug/nvwa/debug_new.cpp delete mode 100644 src/debug/nvwa/debug_new.h delete mode 100644 src/debug/nvwa/fast_mutex.h delete mode 100644 src/debug/nvwa/source.txt delete mode 100644 src/debug/nvwa/static_assert.h delete mode 100644 src/debug/readme.txt delete mode 100644 src/defaults.cpp delete mode 100644 src/defaults.h delete mode 100644 src/dirs.cpp delete mode 100644 src/dirs.h delete mode 100644 src/dragdrop.h delete mode 100644 src/effectmanager.cpp delete mode 100644 src/effectmanager.h delete mode 100644 src/enums/being/actortype.h delete mode 100644 src/enums/being/attacktype.h delete mode 100644 src/enums/being/attributes.h delete mode 100644 src/enums/being/attributesstrings.cpp delete mode 100644 src/enums/being/attributesstrings.h delete mode 100644 src/enums/being/badgedrawtype.h delete mode 100644 src/enums/being/badgeindex.h delete mode 100644 src/enums/being/beingaction.h delete mode 100644 src/enums/being/beingdirection.h delete mode 100644 src/enums/being/cookingtype.h delete mode 100644 src/enums/being/gender.h delete mode 100644 src/enums/being/pickup.h delete mode 100644 src/enums/being/rank.h delete mode 100644 src/enums/being/reachable.h delete mode 100644 src/enums/being/relation.h delete mode 100644 src/enums/being/targetcursorsize.h delete mode 100644 src/enums/being/targetcursortype.h delete mode 100644 src/enums/being/visiblename.h delete mode 100644 src/enums/being/visiblenamepos.h delete mode 100644 src/enums/commandtarget.h delete mode 100644 src/enums/cutin.h delete mode 100644 src/enums/dragdropsource.h delete mode 100644 src/enums/emotetype.h delete mode 100644 src/enums/equipslot.h delete mode 100644 src/enums/events/keyeventtype.h delete mode 100644 src/enums/events/mousebutton.h delete mode 100644 src/enums/events/mouseeventtype.h delete mode 100644 src/enums/fs/fsentrytype.h delete mode 100644 src/enums/gui/chatmsgtype.h delete mode 100644 src/enums/gui/chattabtype.h delete mode 100644 src/enums/gui/colorname.h delete mode 100644 src/enums/gui/dialogtype.h delete mode 100644 src/enums/gui/gradienttype.h delete mode 100644 src/enums/gui/itemamountwindowusage.h delete mode 100644 src/enums/gui/layouttype.h delete mode 100644 src/enums/gui/linkhighlightmode.h delete mode 100644 src/enums/gui/npcactionstate.h delete mode 100644 src/enums/gui/npcinputstate.h delete mode 100644 src/enums/gui/orientation.h delete mode 100644 src/enums/gui/progresscolorid.h delete mode 100644 src/enums/gui/serverdialogdonwloadstatus.h delete mode 100644 src/enums/gui/shoplistboxtype.h delete mode 100644 src/enums/gui/slidergrid.h delete mode 100644 src/enums/gui/themecolorid.h delete mode 100644 src/enums/gui/updatedownloadstatus.h delete mode 100644 src/enums/gui/usercolorid.h delete mode 100644 src/enums/guildpositionflags.h delete mode 100644 src/enums/input/inputaction.h delete mode 100644 src/enums/input/inputcondition.h delete mode 100644 src/enums/input/inputgroup.h delete mode 100644 src/enums/input/inputtype.h delete mode 100644 src/enums/input/keyboardfocus.h delete mode 100644 src/enums/input/keyvalue.h delete mode 100644 src/enums/inventorytype.h delete mode 100644 src/enums/magicschool.h delete mode 100644 src/enums/net/auctionsearchtype.h delete mode 100644 src/enums/net/battlegroundtype.h delete mode 100644 src/enums/net/beingtype.h delete mode 100644 src/enums/net/deleteitemreason.h delete mode 100644 src/enums/net/downloadstatus.h delete mode 100644 src/enums/net/mailmessagetype.h delete mode 100644 src/enums/net/mailopentype.h delete mode 100644 src/enums/net/menutype.h delete mode 100644 src/enums/net/npcaction.h delete mode 100644 src/enums/net/packettype.h delete mode 100644 src/enums/net/partyshare.h delete mode 100644 src/enums/net/serverfreetype.h delete mode 100644 src/enums/net/servertype.h delete mode 100644 src/enums/net/storesearchtype.h delete mode 100644 src/enums/net/updatetype.h delete mode 100644 src/enums/particle/alivestatus.h delete mode 100644 src/enums/particle/particlechangefunc.h delete mode 100644 src/enums/particle/particlephysics.h delete mode 100644 src/enums/particle/particletype.h delete mode 100644 src/enums/render/blitmode.h delete mode 100644 src/enums/render/rendertype.h delete mode 100644 src/enums/resources/cursor.h delete mode 100644 src/enums/resources/displaytype.h delete mode 100644 src/enums/resources/frametype.h delete mode 100644 src/enums/resources/imageposition.h delete mode 100644 src/enums/resources/imagetype.h delete mode 100644 src/enums/resources/item/itemdbtype.h delete mode 100644 src/enums/resources/item/itemsoundevent.h delete mode 100644 src/enums/resources/item/itemtype.h delete mode 100644 src/enums/resources/mailqueuetype.h delete mode 100644 src/enums/resources/map/blockmask.h delete mode 100644 src/enums/resources/map/blocktype.h delete mode 100644 src/enums/resources/map/collisiontype.h delete mode 100644 src/enums/resources/map/mapitemtype.h delete mode 100644 src/enums/resources/map/maplayerposition.h delete mode 100644 src/enums/resources/map/maplayertype.h delete mode 100644 src/enums/resources/map/maptype.h delete mode 100644 src/enums/resources/notifyflags.h delete mode 100644 src/enums/resources/notifytypes.h delete mode 100644 src/enums/resources/questtype.h delete mode 100644 src/enums/resources/servercommandenable.h delete mode 100644 src/enums/resources/servercommandtype.h delete mode 100644 src/enums/resources/serverpermissiontype.h delete mode 100644 src/enums/resources/skill/casttype.h delete mode 100644 src/enums/resources/skill/skillowner.h delete mode 100644 src/enums/resources/skill/skillsettype.h delete mode 100644 src/enums/resources/skill/skilltype.h delete mode 100644 src/enums/resources/skill/skilltype2.h delete mode 100644 src/enums/resources/spritedirection.h delete mode 100644 src/enums/screendensity.h delete mode 100644 src/enums/simpletypes/advanced.h delete mode 100644 src/enums/simpletypes/allowquit.h delete mode 100644 src/enums/simpletypes/allowsort.h delete mode 100644 src/enums/simpletypes/allplayers.h delete mode 100644 src/enums/simpletypes/append.h delete mode 100644 src/enums/simpletypes/autorelease.h delete mode 100644 src/enums/simpletypes/autotarget.h delete mode 100644 src/enums/simpletypes/beingid.h delete mode 100644 src/enums/simpletypes/beingtypeid.h delete mode 100644 src/enums/simpletypes/booldefines.h delete mode 100644 src/enums/simpletypes/damaged.h delete mode 100644 src/enums/simpletypes/donotalign.h delete mode 100644 src/enums/simpletypes/enable.h delete mode 100644 src/enums/simpletypes/enumdefines.h delete mode 100644 src/enums/simpletypes/equipm.h delete mode 100644 src/enums/simpletypes/equipped.h delete mode 100644 src/enums/simpletypes/favorite.h delete mode 100644 src/enums/simpletypes/forcedisplay.h delete mode 100644 src/enums/simpletypes/forcequantity.h delete mode 100644 src/enums/simpletypes/identified.h delete mode 100644 src/enums/simpletypes/ignorerecord.h delete mode 100644 src/enums/simpletypes/intdefines.h delete mode 100644 src/enums/simpletypes/issell.h delete mode 100644 src/enums/simpletypes/isstart.h delete mode 100644 src/enums/simpletypes/itemcolor.h delete mode 100644 src/enums/simpletypes/keep.h delete mode 100644 src/enums/simpletypes/losefocusontab.h delete mode 100644 src/enums/simpletypes/mainconfig.h delete mode 100644 src/enums/simpletypes/modal.h delete mode 100644 src/enums/simpletypes/modifiable.h delete mode 100644 src/enums/simpletypes/move.h delete mode 100644 src/enums/simpletypes/notify.h delete mode 100644 src/enums/simpletypes/npcnames.h delete mode 100644 src/enums/simpletypes/online.h delete mode 100644 src/enums/simpletypes/onthefly.h delete mode 100644 src/enums/simpletypes/opaque.h delete mode 100644 src/enums/simpletypes/protected.h delete mode 100644 src/enums/simpletypes/separator.h delete mode 100644 src/enums/simpletypes/sfx.h delete mode 100644 src/enums/simpletypes/showcenter.h delete mode 100644 src/enums/simpletypes/showemptyrows.h delete mode 100644 src/enums/simpletypes/skiperror.h delete mode 100644 src/enums/simpletypes/speech.h delete mode 100644 src/enums/simpletypes/stringdefines.h delete mode 100644 src/enums/simpletypes/stringdefines2.h delete mode 100644 src/enums/simpletypes/trading.h delete mode 100644 src/enums/simpletypes/tryremovecolors.h delete mode 100644 src/enums/simpletypes/useargs.h delete mode 100644 src/enums/simpletypes/usebase64.h delete mode 100644 src/enums/simpletypes/usevirtfs.h delete mode 100644 src/enums/simpletypes/visible.h delete mode 100644 src/enums/state.h delete mode 100644 src/enums/textcommandtype.h delete mode 100644 src/equipment.h delete mode 100644 src/events/actionevent.h delete mode 100644 src/events/event.h delete mode 100644 src/events/inputevent.h delete mode 100644 src/events/inputguievent.h delete mode 100644 src/events/keyevent.h delete mode 100644 src/events/mouseevent.h delete mode 100644 src/events/selectionevent.h delete mode 100644 src/eventsmanager.cpp delete mode 100644 src/eventsmanager.h delete mode 100644 src/filefilter.txt delete mode 100644 src/filefilter_more.txt delete mode 100644 src/fs/files.cpp delete mode 100644 src/fs/files.h delete mode 100644 src/fs/mkdir.cpp delete mode 100644 src/fs/mkdir.h delete mode 100644 src/fs/paths.cpp delete mode 100644 src/fs/paths.h delete mode 100644 src/fs/specialfolder.cpp delete mode 100644 src/fs/specialfolder.h delete mode 100644 src/fs/virtfs/direntry.cpp delete mode 100644 src/fs/virtfs/direntry.h delete mode 100644 src/fs/virtfs/file.cpp delete mode 100644 src/fs/virtfs/file.h delete mode 100644 src/fs/virtfs/fileapi.h delete mode 100644 src/fs/virtfs/fs.cpp delete mode 100644 src/fs/virtfs/fs.h delete mode 100644 src/fs/virtfs/fsdir.cpp delete mode 100644 src/fs/virtfs/fsdir.h delete mode 100644 src/fs/virtfs/fsdirrwops.cpp delete mode 100644 src/fs/virtfs/fsdirrwops.h delete mode 100644 src/fs/virtfs/fsentry.cpp delete mode 100644 src/fs/virtfs/fsentry.h delete mode 100644 src/fs/virtfs/fsfuncs.h delete mode 100644 src/fs/virtfs/fszip.cpp delete mode 100644 src/fs/virtfs/fszip.h delete mode 100644 src/fs/virtfs/fsziprwops.cpp delete mode 100644 src/fs/virtfs/fsziprwops.h delete mode 100644 src/fs/virtfs/list.cpp delete mode 100644 src/fs/virtfs/list.h delete mode 100644 src/fs/virtfs/rwops.cpp delete mode 100644 src/fs/virtfs/rwops.h delete mode 100644 src/fs/virtfs/rwopstypes.h delete mode 100644 src/fs/virtfs/tools.cpp delete mode 100644 src/fs/virtfs/tools.h delete mode 100644 src/fs/virtfs/zipentry.cpp delete mode 100644 src/fs/virtfs/zipentry.h delete mode 100644 src/fs/virtfs/ziplocalheader.cpp delete mode 100644 src/fs/virtfs/ziplocalheader.h delete mode 100644 src/fs/virtfs/zipreader.cpp delete mode 100644 src/fs/virtfs/zipreader.h delete mode 100644 src/game.cpp delete mode 100644 src/game.h delete mode 100644 src/gamemodifiers.cpp delete mode 100644 src/gamemodifiers.h delete mode 100644 src/graphicsmanager.cpp delete mode 100644 src/graphicsmanager.h delete mode 100644 src/gui/browserlink.h delete mode 100644 src/gui/buttoninfo.h delete mode 100644 src/gui/buttontext.h delete mode 100644 src/gui/chatlog.h delete mode 100644 src/gui/cliprect.h delete mode 100644 src/gui/color.h delete mode 100644 src/gui/colorpair.h delete mode 100644 src/gui/dialogsmanager.cpp delete mode 100644 src/gui/dialogsmanager.h delete mode 100644 src/gui/focushandler.cpp delete mode 100644 src/gui/focushandler.h delete mode 100644 src/gui/fonts/font.cpp delete mode 100644 src/gui/fonts/font.h delete mode 100644 src/gui/fonts/textchunk.cpp delete mode 100644 src/gui/fonts/textchunk.h delete mode 100644 src/gui/fonts/textchunklist.cpp delete mode 100644 src/gui/fonts/textchunklist.h delete mode 100644 src/gui/fonts/textchunksmall.cpp delete mode 100644 src/gui/fonts/textchunksmall.h delete mode 100644 src/gui/gui.cpp delete mode 100644 src/gui/gui.h delete mode 100644 src/gui/mailmessage.h delete mode 100644 src/gui/models/avatarlistmodel.h delete mode 100644 src/gui/models/beingslistmodel.h delete mode 100644 src/gui/models/colorlistmodel.h delete mode 100644 src/gui/models/colormodel.cpp delete mode 100644 src/gui/models/colormodel.h delete mode 100644 src/gui/models/extendedlistmodel.h delete mode 100644 src/gui/models/extendednamesmodel.cpp delete mode 100644 src/gui/models/extendednamesmodel.h delete mode 100644 src/gui/models/fontsizechoicelistmodel.h delete mode 100644 src/gui/models/fontsmodel.h delete mode 100644 src/gui/models/iconsmodel.h delete mode 100644 src/gui/models/ignorechoiceslistmodel.h delete mode 100644 src/gui/models/itemsmodel.h delete mode 100644 src/gui/models/keylistmodel.h delete mode 100644 src/gui/models/langlistmodel.h delete mode 100644 src/gui/models/listmodel.h delete mode 100644 src/gui/models/magicschoolmodel.h delete mode 100644 src/gui/models/modelistmodel.cpp delete mode 100644 src/gui/models/modelistmodel.h delete mode 100644 src/gui/models/namesmodel.cpp delete mode 100644 src/gui/models/namesmodel.h delete mode 100644 src/gui/models/opengllistmodel.h delete mode 100644 src/gui/models/playerrelationlistmodel.h delete mode 100644 src/gui/models/playertablemodel.cpp delete mode 100644 src/gui/models/playertablemodel.h delete mode 100644 src/gui/models/questsmodel.h delete mode 100644 src/gui/models/serverslistmodel.h delete mode 100644 src/gui/models/shopitems.cpp delete mode 100644 src/gui/models/shopitems.h delete mode 100644 src/gui/models/skillmodel.cpp delete mode 100644 src/gui/models/skillmodel.h delete mode 100644 src/gui/models/sortlistmodelbuy.h delete mode 100644 src/gui/models/sortlistmodelinv.h delete mode 100644 src/gui/models/soundsmodel.h delete mode 100644 src/gui/models/tablemodel.cpp delete mode 100644 src/gui/models/tablemodel.h delete mode 100644 src/gui/models/targettypemodel.h delete mode 100644 src/gui/models/themesmodel.h delete mode 100644 src/gui/models/touchactionmodel.cpp delete mode 100644 src/gui/models/touchactionmodel.h delete mode 100644 src/gui/models/typelistmodel.h delete mode 100644 src/gui/models/updatelistmodel.h delete mode 100644 src/gui/models/updatetypemodel.h delete mode 100644 src/gui/models/worldlistmodel.h delete mode 100644 src/gui/mouseoverlink.h delete mode 100644 src/gui/onlineplayer.h delete mode 100644 src/gui/palette.cpp delete mode 100644 src/gui/palette.h delete mode 100644 src/gui/popupmanager.cpp delete mode 100644 src/gui/popupmanager.h delete mode 100644 src/gui/popups/beingpopup.cpp delete mode 100644 src/gui/popups/beingpopup.h delete mode 100644 src/gui/popups/itempopup.cpp delete mode 100644 src/gui/popups/itempopup.h delete mode 100644 src/gui/popups/popupmenu.cpp delete mode 100644 src/gui/popups/popupmenu.h delete mode 100644 src/gui/popups/skillpopup.cpp delete mode 100644 src/gui/popups/skillpopup.h delete mode 100644 src/gui/popups/speechbubble.cpp delete mode 100644 src/gui/popups/speechbubble.h delete mode 100644 src/gui/popups/spellpopup.cpp delete mode 100644 src/gui/popups/spellpopup.h delete mode 100644 src/gui/popups/statuspopup.cpp delete mode 100644 src/gui/popups/statuspopup.h delete mode 100644 src/gui/popups/textboxpopup.cpp delete mode 100644 src/gui/popups/textboxpopup.h delete mode 100644 src/gui/popups/textpopup.cpp delete mode 100644 src/gui/popups/textpopup.h delete mode 100644 src/gui/rect.h delete mode 100644 src/gui/sdlinput.cpp delete mode 100644 src/gui/sdlinput.h delete mode 100644 src/gui/setupactiondata.h delete mode 100644 src/gui/setupinputpages.cpp delete mode 100644 src/gui/setupinputpages.h delete mode 100644 src/gui/shortcut/dropshortcut.cpp delete mode 100644 src/gui/shortcut/dropshortcut.h delete mode 100644 src/gui/shortcut/emoteshortcut.cpp delete mode 100644 src/gui/shortcut/emoteshortcut.h delete mode 100644 src/gui/shortcut/itemshortcut.cpp delete mode 100644 src/gui/shortcut/itemshortcut.h delete mode 100644 src/gui/shortcut/shortcutbase.cpp delete mode 100644 src/gui/shortcut/shortcutbase.h delete mode 100644 src/gui/shortcut/spellshortcut.cpp delete mode 100644 src/gui/shortcut/spellshortcut.h delete mode 100644 src/gui/skin.cpp delete mode 100644 src/gui/skin.h delete mode 100644 src/gui/theme.cpp delete mode 100644 src/gui/theme.h delete mode 100644 src/gui/themecolorsidoperators.cpp delete mode 100644 src/gui/themecolorsidoperators.h delete mode 100644 src/gui/themeinfo.h delete mode 100644 src/gui/touchactiondata.cpp delete mode 100644 src/gui/touchactiondata.h delete mode 100644 src/gui/userpalette.cpp delete mode 100644 src/gui/userpalette.h delete mode 100644 src/gui/viewport.h delete mode 100644 src/gui/widgets/attrs/attrdisplay.cpp delete mode 100644 src/gui/widgets/attrs/attrdisplay.h delete mode 100644 src/gui/widgets/attrs/changedisplay.cpp delete mode 100644 src/gui/widgets/attrs/changedisplay.h delete mode 100644 src/gui/widgets/attrs/derdisplay.cpp delete mode 100644 src/gui/widgets/attrs/derdisplay.h delete mode 100644 src/gui/widgets/avatarlistbox.cpp delete mode 100644 src/gui/widgets/avatarlistbox.h delete mode 100644 src/gui/widgets/basiccontainer.cpp delete mode 100644 src/gui/widgets/basiccontainer.h delete mode 100644 src/gui/widgets/basiccontainer2.cpp delete mode 100644 src/gui/widgets/basiccontainer2.h delete mode 100644 src/gui/widgets/browserbox.cpp delete mode 100644 src/gui/widgets/browserbox.h delete mode 100644 src/gui/widgets/browserbox.inc delete mode 100644 src/gui/widgets/button.cpp delete mode 100644 src/gui/widgets/button.h delete mode 100644 src/gui/widgets/characterdisplay.cpp delete mode 100644 src/gui/widgets/characterdisplay.h delete mode 100644 src/gui/widgets/characterviewbase.h delete mode 100644 src/gui/widgets/characterviewnormal.cpp delete mode 100644 src/gui/widgets/characterviewnormal.h delete mode 100644 src/gui/widgets/characterviewsmall.cpp delete mode 100644 src/gui/widgets/characterviewsmall.h delete mode 100644 src/gui/widgets/chatinput.h delete mode 100644 src/gui/widgets/checkbox.cpp delete mode 100644 src/gui/widgets/checkbox.h delete mode 100644 src/gui/widgets/colorpage.cpp delete mode 100644 src/gui/widgets/colorpage.h delete mode 100644 src/gui/widgets/container.cpp delete mode 100644 src/gui/widgets/container.h delete mode 100644 src/gui/widgets/containerplacer.cpp delete mode 100644 src/gui/widgets/containerplacer.h delete mode 100644 src/gui/widgets/createwidget.h delete mode 100644 src/gui/widgets/desktop.cpp delete mode 100644 src/gui/widgets/desktop.h delete mode 100644 src/gui/widgets/dropdown.cpp delete mode 100644 src/gui/widgets/dropdown.h delete mode 100644 src/gui/widgets/emotepage.cpp delete mode 100644 src/gui/widgets/emotepage.h delete mode 100644 src/gui/widgets/emoteshortcutcontainer.cpp delete mode 100644 src/gui/widgets/emoteshortcutcontainer.h delete mode 100644 src/gui/widgets/equipmentbox.h delete mode 100644 src/gui/widgets/equipmentpage.h delete mode 100644 src/gui/widgets/extendedlistbox.cpp delete mode 100644 src/gui/widgets/extendedlistbox.h delete mode 100644 src/gui/widgets/extendedlistboxitem.h delete mode 100644 src/gui/widgets/flowcontainer.cpp delete mode 100644 src/gui/widgets/flowcontainer.h delete mode 100644 src/gui/widgets/guitable.cpp delete mode 100644 src/gui/widgets/guitable.h delete mode 100644 src/gui/widgets/horizontcontainer.cpp delete mode 100644 src/gui/widgets/horizontcontainer.h delete mode 100644 src/gui/widgets/icon.cpp delete mode 100644 src/gui/widgets/icon.h delete mode 100644 src/gui/widgets/inttextfield.cpp delete mode 100644 src/gui/widgets/inttextfield.h delete mode 100644 src/gui/widgets/itemcontainer.cpp delete mode 100644 src/gui/widgets/itemcontainer.h delete mode 100644 src/gui/widgets/itemlinkhandler.cpp delete mode 100644 src/gui/widgets/itemlinkhandler.h delete mode 100644 src/gui/widgets/itemshortcutcontainer.cpp delete mode 100644 src/gui/widgets/itemshortcutcontainer.h delete mode 100644 src/gui/widgets/label.cpp delete mode 100644 src/gui/widgets/label.h delete mode 100644 src/gui/widgets/layout.cpp delete mode 100644 src/gui/widgets/layout.h delete mode 100644 src/gui/widgets/layoutarray.cpp delete mode 100644 src/gui/widgets/layoutarray.h delete mode 100644 src/gui/widgets/layoutcell.cpp delete mode 100644 src/gui/widgets/layoutcell.h delete mode 100644 src/gui/widgets/layouthelper.cpp delete mode 100644 src/gui/widgets/layouthelper.h delete mode 100644 src/gui/widgets/linepart.cpp delete mode 100644 src/gui/widgets/linepart.h delete mode 100644 src/gui/widgets/linkhandler.h delete mode 100644 src/gui/widgets/listbox.cpp delete mode 100644 src/gui/widgets/listbox.h delete mode 100644 src/gui/widgets/passwordfield.cpp delete mode 100644 src/gui/widgets/passwordfield.h delete mode 100644 src/gui/widgets/playerbox.cpp delete mode 100644 src/gui/widgets/playerbox.h delete mode 100644 src/gui/widgets/popup.cpp delete mode 100644 src/gui/widgets/popup.h delete mode 100644 src/gui/widgets/popuplist.cpp delete mode 100644 src/gui/widgets/popuplist.h delete mode 100644 src/gui/widgets/progressbar.cpp delete mode 100644 src/gui/widgets/progressbar.h delete mode 100644 src/gui/widgets/progressindicator.cpp delete mode 100644 src/gui/widgets/progressindicator.h delete mode 100644 src/gui/widgets/radiobutton.cpp delete mode 100644 src/gui/widgets/radiobutton.h delete mode 100644 src/gui/widgets/radiogroup.cpp delete mode 100644 src/gui/widgets/radiogroup.h delete mode 100644 src/gui/widgets/scrollarea.cpp delete mode 100644 src/gui/widgets/scrollarea.h delete mode 100644 src/gui/widgets/selldialog.cpp delete mode 100644 src/gui/widgets/selldialog.h delete mode 100644 src/gui/widgets/serverslistbox.h delete mode 100644 src/gui/widgets/setupbuttonitem.cpp delete mode 100644 src/gui/widgets/setupbuttonitem.h delete mode 100644 src/gui/widgets/setupitem.cpp delete mode 100644 src/gui/widgets/setupitem.h delete mode 100644 src/gui/widgets/setupquickitem.cpp delete mode 100644 src/gui/widgets/setupquickitem.h delete mode 100644 src/gui/widgets/setuptouchitem.cpp delete mode 100644 src/gui/widgets/setuptouchitem.h delete mode 100644 src/gui/widgets/shoplistbox.cpp delete mode 100644 src/gui/widgets/shoplistbox.h delete mode 100644 src/gui/widgets/shortcutcontainer.cpp delete mode 100644 src/gui/widgets/shortcutcontainer.h delete mode 100644 src/gui/widgets/skilllistbox.h delete mode 100644 src/gui/widgets/skillrectanglelistbox.h delete mode 100644 src/gui/widgets/slider.cpp delete mode 100644 src/gui/widgets/slider.h delete mode 100644 src/gui/widgets/sliderlist.cpp delete mode 100644 src/gui/widgets/sliderlist.h delete mode 100644 src/gui/widgets/spellshortcutcontainer.cpp delete mode 100644 src/gui/widgets/spellshortcutcontainer.h delete mode 100644 src/gui/widgets/staticbrowserbox.cpp delete mode 100644 src/gui/widgets/staticbrowserbox.h delete mode 100644 src/gui/widgets/statspage.cpp delete mode 100644 src/gui/widgets/statspage.h delete mode 100644 src/gui/widgets/statspagebasic.cpp delete mode 100644 src/gui/widgets/statspagebasic.h delete mode 100644 src/gui/widgets/tabbedarea.cpp delete mode 100644 src/gui/widgets/tabbedarea.h delete mode 100644 src/gui/widgets/tabs/chat/battletab.cpp delete mode 100644 src/gui/widgets/tabs/chat/battletab.h delete mode 100644 src/gui/widgets/tabs/chat/channeltab.cpp delete mode 100644 src/gui/widgets/tabs/chat/channeltab.h delete mode 100644 src/gui/widgets/tabs/chat/chattab.cpp delete mode 100644 src/gui/widgets/tabs/chat/chattab.h delete mode 100644 src/gui/widgets/tabs/chat/emulateguildtab.cpp delete mode 100644 src/gui/widgets/tabs/chat/emulateguildtab.h delete mode 100644 src/gui/widgets/tabs/chat/gmtab.cpp delete mode 100644 src/gui/widgets/tabs/chat/gmtab.h delete mode 100644 src/gui/widgets/tabs/chat/guildtab.cpp delete mode 100644 src/gui/widgets/tabs/chat/guildtab.h delete mode 100644 src/gui/widgets/tabs/chat/langtab.cpp delete mode 100644 src/gui/widgets/tabs/chat/langtab.h delete mode 100644 src/gui/widgets/tabs/chat/partytab.cpp delete mode 100644 src/gui/widgets/tabs/chat/partytab.h delete mode 100644 src/gui/widgets/tabs/chat/tradetab.cpp delete mode 100644 src/gui/widgets/tabs/chat/tradetab.h delete mode 100644 src/gui/widgets/tabs/chat/whispertab.cpp delete mode 100644 src/gui/widgets/tabs/chat/whispertab.h delete mode 100644 src/gui/widgets/tabs/debugwindowtabs.cpp delete mode 100644 src/gui/widgets/tabs/debugwindowtabs.h delete mode 100644 src/gui/widgets/tabs/setup_audio.cpp delete mode 100644 src/gui/widgets/tabs/setup_audio.h delete mode 100644 src/gui/widgets/tabs/setup_chat.cpp delete mode 100644 src/gui/widgets/tabs/setup_chat.h delete mode 100644 src/gui/widgets/tabs/setup_colors.cpp delete mode 100644 src/gui/widgets/tabs/setup_colors.h delete mode 100644 src/gui/widgets/tabs/setup_input.cpp delete mode 100644 src/gui/widgets/tabs/setup_input.h delete mode 100644 src/gui/widgets/tabs/setup_joystick.cpp delete mode 100644 src/gui/widgets/tabs/setup_joystick.h delete mode 100644 src/gui/widgets/tabs/setup_misc.cpp delete mode 100644 src/gui/widgets/tabs/setup_misc.h delete mode 100644 src/gui/widgets/tabs/setup_mods.cpp delete mode 100644 src/gui/widgets/tabs/setup_mods.h delete mode 100644 src/gui/widgets/tabs/setup_perfomance.cpp delete mode 100644 src/gui/widgets/tabs/setup_perfomance.h delete mode 100644 src/gui/widgets/tabs/setup_players.cpp delete mode 100644 src/gui/widgets/tabs/setup_players.h delete mode 100644 src/gui/widgets/tabs/setup_quick.cpp delete mode 100644 src/gui/widgets/tabs/setup_quick.h delete mode 100644 src/gui/widgets/tabs/setup_relations.cpp delete mode 100644 src/gui/widgets/tabs/setup_relations.h delete mode 100644 src/gui/widgets/tabs/setup_theme.cpp delete mode 100644 src/gui/widgets/tabs/setup_theme.h delete mode 100644 src/gui/widgets/tabs/setup_touch.cpp delete mode 100644 src/gui/widgets/tabs/setup_touch.h delete mode 100644 src/gui/widgets/tabs/setup_video.cpp delete mode 100644 src/gui/widgets/tabs/setup_video.h delete mode 100644 src/gui/widgets/tabs/setup_visual.cpp delete mode 100644 src/gui/widgets/tabs/setup_visual.h delete mode 100644 src/gui/widgets/tabs/setuptab.cpp delete mode 100644 src/gui/widgets/tabs/setuptab.h delete mode 100644 src/gui/widgets/tabs/setuptabscroll.cpp delete mode 100644 src/gui/widgets/tabs/setuptabscroll.h delete mode 100644 src/gui/widgets/tabs/shortcuttab.h delete mode 100644 src/gui/widgets/tabs/skilltab.h delete mode 100644 src/gui/widgets/tabs/socialattacktab.h delete mode 100644 src/gui/widgets/tabs/socialfriendsfunctor.h delete mode 100644 src/gui/widgets/tabs/socialfriendstab.h delete mode 100644 src/gui/widgets/tabs/socialguildtab.h delete mode 100644 src/gui/widgets/tabs/socialguildtab2.h delete mode 100644 src/gui/widgets/tabs/socialnavigationtab.h delete mode 100644 src/gui/widgets/tabs/socialpartytab.h delete mode 100644 src/gui/widgets/tabs/socialpickuptab.h delete mode 100644 src/gui/widgets/tabs/socialplayerstab.h delete mode 100644 src/gui/widgets/tabs/socialtab.h delete mode 100644 src/gui/widgets/tabs/socialtabbase.h delete mode 100644 src/gui/widgets/tabs/tab.cpp delete mode 100644 src/gui/widgets/tabs/tab.h delete mode 100644 src/gui/widgets/tabstrip.cpp delete mode 100644 src/gui/widgets/tabstrip.h delete mode 100644 src/gui/widgets/textbox.cpp delete mode 100644 src/gui/widgets/textbox.h delete mode 100644 src/gui/widgets/textfield.cpp delete mode 100644 src/gui/widgets/textfield.h delete mode 100644 src/gui/widgets/textpreview.cpp delete mode 100644 src/gui/widgets/textpreview.h delete mode 100644 src/gui/widgets/vertcontainer.cpp delete mode 100644 src/gui/widgets/vertcontainer.h delete mode 100644 src/gui/widgets/virtshortcutcontainer.cpp delete mode 100644 src/gui/widgets/virtshortcutcontainer.h delete mode 100644 src/gui/widgets/widget.cpp delete mode 100644 src/gui/widgets/widget.h delete mode 100644 src/gui/widgets/widget2.h delete mode 100644 src/gui/widgets/widgetgroup.cpp delete mode 100644 src/gui/widgets/widgetgroup.h delete mode 100644 src/gui/widgets/window.cpp delete mode 100644 src/gui/widgets/window.h delete mode 100644 src/gui/widgets/windowcontainer.cpp delete mode 100644 src/gui/widgets/windowcontainer.h delete mode 100644 src/gui/windowmanager.cpp delete mode 100644 src/gui/windowmanager.h delete mode 100644 src/gui/windowmenu.cpp delete mode 100644 src/gui/windowmenu.h delete mode 100644 src/gui/windows/bankwindow.cpp delete mode 100644 src/gui/windows/bankwindow.h delete mode 100644 src/gui/windows/buydialog.cpp delete mode 100644 src/gui/windows/buydialog.h delete mode 100644 src/gui/windows/buyingstoreselldialog.cpp delete mode 100644 src/gui/windows/buyingstoreselldialog.h delete mode 100644 src/gui/windows/buyselldialog.cpp delete mode 100644 src/gui/windows/buyselldialog.h delete mode 100644 src/gui/windows/changeemaildialog.cpp delete mode 100644 src/gui/windows/changeemaildialog.h delete mode 100644 src/gui/windows/changepassworddialog.cpp delete mode 100644 src/gui/windows/changepassworddialog.h delete mode 100644 src/gui/windows/charcreatedialog.cpp delete mode 100644 src/gui/windows/charcreatedialog.h delete mode 100644 src/gui/windows/chardeleteconfirm.h delete mode 100644 src/gui/windows/charselectdialog.cpp delete mode 100644 src/gui/windows/charselectdialog.h delete mode 100644 src/gui/windows/chatwindow.cpp delete mode 100644 src/gui/windows/chatwindow.h delete mode 100644 src/gui/windows/confirmdialog.cpp delete mode 100644 src/gui/windows/confirmdialog.h delete mode 100644 src/gui/windows/connectiondialog.cpp delete mode 100644 src/gui/windows/connectiondialog.h delete mode 100644 src/gui/windows/cutinwindow.cpp delete mode 100644 src/gui/windows/cutinwindow.h delete mode 100644 src/gui/windows/debugwindow.cpp delete mode 100644 src/gui/windows/debugwindow.h delete mode 100644 src/gui/windows/didyouknowwindow.cpp delete mode 100644 src/gui/windows/didyouknowwindow.h delete mode 100644 src/gui/windows/editdialog.cpp delete mode 100644 src/gui/windows/editdialog.h delete mode 100644 src/gui/windows/editserverdialog.cpp delete mode 100644 src/gui/windows/editserverdialog.h delete mode 100644 src/gui/windows/eggselectiondialog.cpp delete mode 100644 src/gui/windows/eggselectiondialog.h delete mode 100644 src/gui/windows/emotewindow.cpp delete mode 100644 src/gui/windows/emotewindow.h delete mode 100644 src/gui/windows/equipmentwindow.cpp delete mode 100644 src/gui/windows/equipmentwindow.h delete mode 100644 src/gui/windows/helpwindow.cpp delete mode 100644 src/gui/windows/helpwindow.h delete mode 100644 src/gui/windows/insertcarddialog.cpp delete mode 100644 src/gui/windows/insertcarddialog.h delete mode 100644 src/gui/windows/inventorywindow.cpp delete mode 100644 src/gui/windows/inventorywindow.h delete mode 100644 src/gui/windows/itemamountwindow.cpp delete mode 100644 src/gui/windows/itemamountwindow.h delete mode 100644 src/gui/windows/killstats.cpp delete mode 100644 src/gui/windows/killstats.h delete mode 100644 src/gui/windows/logindialog.cpp delete mode 100644 src/gui/windows/logindialog.h delete mode 100644 src/gui/windows/maileditwindow.cpp delete mode 100644 src/gui/windows/maileditwindow.h delete mode 100644 src/gui/windows/mailviewwindow.cpp delete mode 100644 src/gui/windows/mailviewwindow.h delete mode 100644 src/gui/windows/mailwindow.cpp delete mode 100644 src/gui/windows/mailwindow.h delete mode 100644 src/gui/windows/minimap.cpp delete mode 100644 src/gui/windows/minimap.h delete mode 100644 src/gui/windows/ministatuswindow.cpp delete mode 100644 src/gui/windows/ministatuswindow.h delete mode 100644 src/gui/windows/npcdialog.cpp delete mode 100644 src/gui/windows/npcdialog.h delete mode 100644 src/gui/windows/npcselldialog.cpp delete mode 100644 src/gui/windows/npcselldialog.h delete mode 100644 src/gui/windows/okdialog.cpp delete mode 100644 src/gui/windows/okdialog.h delete mode 100644 src/gui/windows/outfitwindow.cpp delete mode 100644 src/gui/windows/outfitwindow.h delete mode 100644 src/gui/windows/questswindow.cpp delete mode 100644 src/gui/windows/questswindow.h delete mode 100644 src/gui/windows/quitdialog.cpp delete mode 100644 src/gui/windows/quitdialog.h delete mode 100644 src/gui/windows/registerdialog.cpp delete mode 100644 src/gui/windows/registerdialog.h delete mode 100644 src/gui/windows/serverdialog.cpp delete mode 100644 src/gui/windows/serverdialog.h delete mode 100644 src/gui/windows/serverinfowindow.cpp delete mode 100644 src/gui/windows/serverinfowindow.h delete mode 100644 src/gui/windows/setupwindow.cpp delete mode 100644 src/gui/windows/setupwindow.h delete mode 100644 src/gui/windows/shopselldialog.cpp delete mode 100644 src/gui/windows/shopselldialog.h delete mode 100644 src/gui/windows/shopwindow.cpp delete mode 100644 src/gui/windows/shopwindow.h delete mode 100644 src/gui/windows/shortcutwindow.cpp delete mode 100644 src/gui/windows/shortcutwindow.h delete mode 100644 src/gui/windows/skilldialog.cpp delete mode 100644 src/gui/windows/skilldialog.h delete mode 100644 src/gui/windows/socialwindow.cpp delete mode 100644 src/gui/windows/socialwindow.h delete mode 100644 src/gui/windows/statuswindow.cpp delete mode 100644 src/gui/windows/statuswindow.h delete mode 100644 src/gui/windows/textcommandeditor.cpp delete mode 100644 src/gui/windows/textcommandeditor.h delete mode 100644 src/gui/windows/textdialog.cpp delete mode 100644 src/gui/windows/textdialog.h delete mode 100644 src/gui/windows/textselectdialog.cpp delete mode 100644 src/gui/windows/textselectdialog.h delete mode 100644 src/gui/windows/tradewindow.cpp delete mode 100644 src/gui/windows/tradewindow.h delete mode 100644 src/gui/windows/updaterwindow.cpp delete mode 100644 src/gui/windows/updaterwindow.h delete mode 100644 src/gui/windows/whoisonline.cpp delete mode 100644 src/gui/windows/whoisonline.h delete mode 100644 src/gui/windows/worldselectdialog.cpp delete mode 100644 src/gui/windows/worldselectdialog.h delete mode 100644 src/guild.cpp delete mode 100644 src/guild.h delete mode 100644 src/input/inputactiondata.h delete mode 100644 src/input/inputactionmap.h delete mode 100644 src/input/inputactionoperators.cpp delete mode 100644 src/input/inputactionoperators.h delete mode 100644 src/input/inputactionsortfunctor.h delete mode 100644 src/input/inputfunction.h delete mode 100644 src/input/inputitem.h delete mode 100644 src/input/inputmanager.cpp delete mode 100644 src/input/inputmanager.h delete mode 100644 src/input/joystick.cpp delete mode 100644 src/input/joystick.h delete mode 100644 src/input/key.cpp delete mode 100644 src/input/key.h delete mode 100644 src/input/keyboardconfig.cpp delete mode 100644 src/input/keyboardconfig.h delete mode 100644 src/input/keyinput.h delete mode 100644 src/input/mouseinput.h delete mode 100644 src/input/pages/basic.cpp delete mode 100644 src/input/pages/basic.h delete mode 100644 src/input/pages/chat.cpp delete mode 100644 src/input/pages/chat.h delete mode 100644 src/input/pages/craft.cpp delete mode 100644 src/input/pages/craft.h delete mode 100644 src/input/pages/emotes.cpp delete mode 100644 src/input/pages/emotes.h delete mode 100644 src/input/pages/gui.cpp delete mode 100644 src/input/pages/gui.h delete mode 100644 src/input/pages/move.cpp delete mode 100644 src/input/pages/move.h delete mode 100644 src/input/pages/other.cpp delete mode 100644 src/input/pages/other.h delete mode 100644 src/input/pages/outfits.cpp delete mode 100644 src/input/pages/outfits.h delete mode 100644 src/input/pages/shortcuts.cpp delete mode 100644 src/input/pages/shortcuts.h delete mode 100644 src/input/pages/windows.cpp delete mode 100644 src/input/pages/windows.h delete mode 100644 src/input/touch/multitouchmanager.cpp delete mode 100644 src/input/touch/multitouchmanager.h delete mode 100644 src/input/touch/touchactions.cpp delete mode 100644 src/input/touch/touchactions.h delete mode 100644 src/input/touch/touchmanager.cpp delete mode 100644 src/input/touch/touchmanager.h delete mode 100644 src/itemcolormanager.cpp delete mode 100644 src/itemcolormanager.h delete mode 100644 src/itemsoundmanager.cpp delete mode 100644 src/itemsoundmanager.h delete mode 100644 src/listeners/actionlistener.h delete mode 100644 src/listeners/actorspritelistener.h delete mode 100644 src/listeners/arrowslistener.cpp delete mode 100644 src/listeners/arrowslistener.h delete mode 100644 src/listeners/assertlistener.cpp delete mode 100644 src/listeners/assertlistener.h delete mode 100644 src/listeners/attributelistener.cpp delete mode 100644 src/listeners/attributelistener.h delete mode 100644 src/listeners/awaylistener.cpp delete mode 100644 src/listeners/awaylistener.h delete mode 100644 src/listeners/banklistener.cpp delete mode 100644 src/listeners/banklistener.h delete mode 100644 src/listeners/baselistener.hpp delete mode 100644 src/listeners/buyingstoremodelistener.cpp delete mode 100644 src/listeners/buyingstoremodelistener.h delete mode 100644 src/listeners/buyingstoreslotslistener.cpp delete mode 100644 src/listeners/buyingstoreslotslistener.h delete mode 100644 src/listeners/charrenamelistener.cpp delete mode 100644 src/listeners/charrenamelistener.h delete mode 100644 src/listeners/configlistener.h delete mode 100644 src/listeners/debugmessagelistener.cpp delete mode 100644 src/listeners/debugmessagelistener.h delete mode 100644 src/listeners/errorlistener.cpp delete mode 100644 src/listeners/errorlistener.h delete mode 100644 src/listeners/focuslistener.h delete mode 100644 src/listeners/gamemodifierlistener.cpp delete mode 100644 src/listeners/gamemodifierlistener.h delete mode 100644 src/listeners/guiconfiglistener.h delete mode 100644 src/listeners/guitableactionlistener.cpp delete mode 100644 src/listeners/guitableactionlistener.h delete mode 100644 src/listeners/inputactionremotelistener.cpp delete mode 100644 src/listeners/inputactionremotelistener.h delete mode 100644 src/listeners/inputactionreplaylistener.cpp delete mode 100644 src/listeners/inputactionreplaylistener.h delete mode 100644 src/listeners/insertcardlistener.h delete mode 100644 src/listeners/inventorylistener.h delete mode 100644 src/listeners/keylistener.h delete mode 100644 src/listeners/mouselistener.h delete mode 100644 src/listeners/openurllistener.h delete mode 100644 src/listeners/pincodelistener.cpp delete mode 100644 src/listeners/pincodelistener.h delete mode 100644 src/listeners/playerdeathlistener.cpp delete mode 100644 src/listeners/playerdeathlistener.h delete mode 100644 src/listeners/playerlistener.cpp delete mode 100644 src/listeners/playerlistener.h delete mode 100644 src/listeners/playerpostdeathlistener.h delete mode 100644 src/listeners/playerrelationslistener.h delete mode 100644 src/listeners/renamelistener.cpp delete mode 100644 src/listeners/renamelistener.h delete mode 100644 src/listeners/requestadoptchildlistener.h delete mode 100644 src/listeners/requesttradelistener.h delete mode 100644 src/listeners/selectionlistener.h delete mode 100644 src/listeners/shoprenamelistener.cpp delete mode 100644 src/listeners/shoprenamelistener.h delete mode 100644 src/listeners/skillwarplistener.cpp delete mode 100644 src/listeners/skillwarplistener.h delete mode 100644 src/listeners/statlistener.cpp delete mode 100644 src/listeners/statlistener.h delete mode 100644 src/listeners/tablemodellistener.h delete mode 100644 src/listeners/textskilllistener.cpp delete mode 100644 src/listeners/textskilllistener.h delete mode 100644 src/listeners/tooltiplistener.cpp delete mode 100644 src/listeners/tooltiplistener.h delete mode 100644 src/listeners/updatestatuslistener.cpp delete mode 100644 src/listeners/updatestatuslistener.h delete mode 100644 src/listeners/uploadlistener.cpp delete mode 100644 src/listeners/uploadlistener.h delete mode 100644 src/listeners/vendingmodelistener.cpp delete mode 100644 src/listeners/vendingmodelistener.h delete mode 100644 src/listeners/vendingslotslistener.cpp delete mode 100644 src/listeners/vendingslotslistener.h delete mode 100644 src/listeners/weightlistener.h delete mode 100644 src/listeners/widgetdeathlistener.h delete mode 100644 src/listeners/widgetlistener.h delete mode 100644 src/listeners/wrongdatanoticelistener.cpp delete mode 100644 src/listeners/wrongdatanoticelistener.h delete mode 100644 src/localconsts.h delete mode 100644 src/logger.cpp delete mode 100644 src/logger.h delete mode 100644 src/main.cpp delete mode 100644 src/main.h delete mode 100644 src/maingui.cpp delete mode 100644 src/maingui.h delete mode 100644 src/manaplus.rc delete mode 100644 src/mumblemanager.cpp delete mode 100644 src/mumblemanager.h delete mode 100644 src/navigationmanager.cpp delete mode 100644 src/navigationmanager.h delete mode 100644 src/net/adminhandler.h delete mode 100644 src/net/auctionhandler.h delete mode 100644 src/net/bankhandler.h delete mode 100644 src/net/battlegroundhandler.h delete mode 100644 src/net/beinghandler.h delete mode 100644 src/net/buyingstorehandler.h delete mode 100644 src/net/buysellhandler.h delete mode 100644 src/net/cashshophandler.h delete mode 100644 src/net/character.h delete mode 100644 src/net/characters.h delete mode 100644 src/net/charserverhandler.cpp delete mode 100644 src/net/charserverhandler.h delete mode 100644 src/net/chathandler.h delete mode 100644 src/net/download.cpp delete mode 100644 src/net/download.h delete mode 100644 src/net/ea/adminhandler.cpp delete mode 100644 src/net/ea/adminhandler.h delete mode 100644 src/net/ea/adminrecv.cpp delete mode 100644 src/net/ea/adminrecv.h delete mode 100644 src/net/ea/beinghandler.cpp delete mode 100644 src/net/ea/beinghandler.h delete mode 100644 src/net/ea/beingrecv.cpp delete mode 100644 src/net/ea/beingrecv.h delete mode 100644 src/net/ea/buysellhandler.cpp delete mode 100644 src/net/ea/buysellhandler.h delete mode 100644 src/net/ea/buysellrecv.cpp delete mode 100644 src/net/ea/buysellrecv.h delete mode 100644 src/net/ea/charserverhandler.cpp delete mode 100644 src/net/ea/charserverhandler.h delete mode 100644 src/net/ea/charserverrecv.cpp delete mode 100644 src/net/ea/charserverrecv.h delete mode 100644 src/net/ea/chathandler.cpp delete mode 100644 src/net/ea/chathandler.h delete mode 100644 src/net/ea/chatrecv.cpp delete mode 100644 src/net/ea/chatrecv.h delete mode 100644 src/net/ea/eaprotocol.h delete mode 100644 src/net/ea/equipbackend.h delete mode 100644 src/net/ea/gamehandler.cpp delete mode 100644 src/net/ea/gamehandler.h delete mode 100644 src/net/ea/gamerecv.cpp delete mode 100644 src/net/ea/gamerecv.h delete mode 100644 src/net/ea/inventoryhandler.cpp delete mode 100644 src/net/ea/inventoryhandler.h delete mode 100644 src/net/ea/inventoryitem.h delete mode 100644 src/net/ea/inventoryrecv.cpp delete mode 100644 src/net/ea/inventoryrecv.h delete mode 100644 src/net/ea/itemhandler.cpp delete mode 100644 src/net/ea/itemhandler.h delete mode 100644 src/net/ea/itemrecv.cpp delete mode 100644 src/net/ea/itemrecv.h delete mode 100644 src/net/ea/loginhandler.cpp delete mode 100644 src/net/ea/loginhandler.h delete mode 100644 src/net/ea/loginrecv.cpp delete mode 100644 src/net/ea/loginrecv.h delete mode 100644 src/net/ea/maprecv.cpp delete mode 100644 src/net/ea/maprecv.h delete mode 100644 src/net/ea/network.cpp delete mode 100644 src/net/ea/network.h delete mode 100644 src/net/ea/npchandler.cpp delete mode 100644 src/net/ea/npchandler.h delete mode 100644 src/net/ea/npcrecv.cpp delete mode 100644 src/net/ea/npcrecv.h delete mode 100644 src/net/ea/partyhandler.cpp delete mode 100644 src/net/ea/partyhandler.h delete mode 100644 src/net/ea/partyrecv.cpp delete mode 100644 src/net/ea/partyrecv.h delete mode 100644 src/net/ea/playerhandler.cpp delete mode 100644 src/net/ea/playerhandler.h delete mode 100644 src/net/ea/playerrecv.cpp delete mode 100644 src/net/ea/playerrecv.h delete mode 100644 src/net/ea/skillhandler.cpp delete mode 100644 src/net/ea/skillhandler.h delete mode 100644 src/net/ea/skillrecv.cpp delete mode 100644 src/net/ea/skillrecv.h delete mode 100644 src/net/ea/token.h delete mode 100644 src/net/ea/tradehandler.cpp delete mode 100644 src/net/ea/tradehandler.h delete mode 100644 src/net/ea/traderecv.cpp delete mode 100644 src/net/ea/traderecv.h delete mode 100644 src/net/eathena/adminhandler.cpp delete mode 100644 src/net/eathena/adminhandler.h delete mode 100644 src/net/eathena/adminrecv.cpp delete mode 100644 src/net/eathena/adminrecv.h delete mode 100644 src/net/eathena/auctionhandler.cpp delete mode 100644 src/net/eathena/auctionhandler.h delete mode 100644 src/net/eathena/auctionrecv.cpp delete mode 100644 src/net/eathena/auctionrecv.h delete mode 100644 src/net/eathena/bankhandler.cpp delete mode 100644 src/net/eathena/bankhandler.h delete mode 100644 src/net/eathena/bankrecv.cpp delete mode 100644 src/net/eathena/bankrecv.h delete mode 100644 src/net/eathena/battlegroundhandler.cpp delete mode 100644 src/net/eathena/battlegroundhandler.h delete mode 100644 src/net/eathena/battlegroundrecv.cpp delete mode 100644 src/net/eathena/battlegroundrecv.h delete mode 100644 src/net/eathena/beinghandler.cpp delete mode 100644 src/net/eathena/beinghandler.h delete mode 100644 src/net/eathena/beingrecv.cpp delete mode 100644 src/net/eathena/beingrecv.h delete mode 100644 src/net/eathena/buyingstorehandler.cpp delete mode 100644 src/net/eathena/buyingstorehandler.h delete mode 100644 src/net/eathena/buyingstorerecv.cpp delete mode 100644 src/net/eathena/buyingstorerecv.h delete mode 100644 src/net/eathena/buysellhandler.cpp delete mode 100644 src/net/eathena/buysellhandler.h delete mode 100644 src/net/eathena/buysellrecv.cpp delete mode 100644 src/net/eathena/buysellrecv.h delete mode 100644 src/net/eathena/cashshophandler.cpp delete mode 100644 src/net/eathena/cashshophandler.h delete mode 100644 src/net/eathena/cashshoprecv.cpp delete mode 100644 src/net/eathena/cashshoprecv.h delete mode 100644 src/net/eathena/charserverhandler.cpp delete mode 100644 src/net/eathena/charserverhandler.h delete mode 100644 src/net/eathena/charserverrecv.cpp delete mode 100644 src/net/eathena/charserverrecv.h delete mode 100644 src/net/eathena/chathandler.cpp delete mode 100644 src/net/eathena/chathandler.h delete mode 100644 src/net/eathena/chatrecv.cpp delete mode 100644 src/net/eathena/chatrecv.h delete mode 100644 src/net/eathena/elementalhandler.cpp delete mode 100644 src/net/eathena/elementalhandler.h delete mode 100644 src/net/eathena/elementalrecv.cpp delete mode 100644 src/net/eathena/elementalrecv.h delete mode 100644 src/net/eathena/familyhandler.cpp delete mode 100644 src/net/eathena/familyhandler.h delete mode 100644 src/net/eathena/familyrecv.cpp delete mode 100644 src/net/eathena/familyrecv.h delete mode 100644 src/net/eathena/friendshandler.cpp delete mode 100644 src/net/eathena/friendshandler.h delete mode 100644 src/net/eathena/friendsrecv.cpp delete mode 100644 src/net/eathena/friendsrecv.h delete mode 100644 src/net/eathena/gamehandler.cpp delete mode 100644 src/net/eathena/gamehandler.h delete mode 100644 src/net/eathena/gamerecv.cpp delete mode 100644 src/net/eathena/gamerecv.h delete mode 100644 src/net/eathena/generalhandler.cpp delete mode 100644 src/net/eathena/generalhandler.h delete mode 100644 src/net/eathena/generalrecv.cpp delete mode 100644 src/net/eathena/generalrecv.h delete mode 100644 src/net/eathena/guildhandler.cpp delete mode 100644 src/net/eathena/guildhandler.h delete mode 100644 src/net/eathena/guildrecv.cpp delete mode 100644 src/net/eathena/guildrecv.h delete mode 100644 src/net/eathena/homunculushandler.cpp delete mode 100644 src/net/eathena/homunculushandler.h delete mode 100644 src/net/eathena/homunculusrecv.cpp delete mode 100644 src/net/eathena/homunculusrecv.h delete mode 100644 src/net/eathena/inventoryhandler.cpp delete mode 100644 src/net/eathena/inventoryhandler.h delete mode 100644 src/net/eathena/inventoryrecv.cpp delete mode 100644 src/net/eathena/inventoryrecv.h delete mode 100644 src/net/eathena/itemflags.h delete mode 100644 src/net/eathena/itemhandler.cpp delete mode 100644 src/net/eathena/itemhandler.h delete mode 100644 src/net/eathena/itemrecv.cpp delete mode 100644 src/net/eathena/itemrecv.h delete mode 100644 src/net/eathena/loginhandler.cpp delete mode 100644 src/net/eathena/loginhandler.h delete mode 100644 src/net/eathena/loginrecv.cpp delete mode 100644 src/net/eathena/loginrecv.h delete mode 100644 src/net/eathena/mail2handler.cpp delete mode 100644 src/net/eathena/mail2handler.h delete mode 100644 src/net/eathena/mail2recv.cpp delete mode 100644 src/net/eathena/mail2recv.h delete mode 100644 src/net/eathena/mailhandler.cpp delete mode 100644 src/net/eathena/mailhandler.h delete mode 100644 src/net/eathena/mailrecv.cpp delete mode 100644 src/net/eathena/mailrecv.h delete mode 100644 src/net/eathena/maphandler.cpp delete mode 100644 src/net/eathena/maphandler.h delete mode 100644 src/net/eathena/maprecv.cpp delete mode 100644 src/net/eathena/maprecv.h delete mode 100644 src/net/eathena/maptypeproperty2.h delete mode 100644 src/net/eathena/markethandler.cpp delete mode 100644 src/net/eathena/markethandler.h delete mode 100644 src/net/eathena/marketrecv.cpp delete mode 100644 src/net/eathena/marketrecv.h delete mode 100644 src/net/eathena/menu.cpp delete mode 100644 src/net/eathena/menu.h delete mode 100644 src/net/eathena/mercenaryhandler.cpp delete mode 100644 src/net/eathena/mercenaryhandler.h delete mode 100644 src/net/eathena/mercenaryrecv.cpp delete mode 100644 src/net/eathena/mercenaryrecv.h delete mode 100644 src/net/eathena/messagein.cpp delete mode 100644 src/net/eathena/messagein.h delete mode 100644 src/net/eathena/messageout.cpp delete mode 100644 src/net/eathena/messageout.h delete mode 100644 src/net/eathena/network.cpp delete mode 100644 src/net/eathena/network.h delete mode 100644 src/net/eathena/npchandler.cpp delete mode 100644 src/net/eathena/npchandler.h delete mode 100644 src/net/eathena/npcrecv.cpp delete mode 100644 src/net/eathena/npcrecv.h delete mode 100644 src/net/eathena/packetsin.inc delete mode 100644 src/net/eathena/packetsout.inc delete mode 100644 src/net/eathena/partyhandler.cpp delete mode 100644 src/net/eathena/partyhandler.h delete mode 100644 src/net/eathena/partyrecv.cpp delete mode 100644 src/net/eathena/partyrecv.h delete mode 100644 src/net/eathena/pethandler.cpp delete mode 100644 src/net/eathena/pethandler.h delete mode 100644 src/net/eathena/petrecv.cpp delete mode 100644 src/net/eathena/petrecv.h delete mode 100644 src/net/eathena/playerhandler.cpp delete mode 100644 src/net/eathena/playerhandler.h delete mode 100644 src/net/eathena/playerrecv.cpp delete mode 100644 src/net/eathena/playerrecv.h delete mode 100644 src/net/eathena/protocolout.cpp delete mode 100644 src/net/eathena/protocolout.h delete mode 100644 src/net/eathena/questhandler.cpp delete mode 100644 src/net/eathena/questhandler.h delete mode 100644 src/net/eathena/questrecv.cpp delete mode 100644 src/net/eathena/questrecv.h delete mode 100644 src/net/eathena/recvpackets.inc delete mode 100644 src/net/eathena/roulettehandler.cpp delete mode 100644 src/net/eathena/roulettehandler.h delete mode 100644 src/net/eathena/rouletterecv.cpp delete mode 100644 src/net/eathena/rouletterecv.h delete mode 100644 src/net/eathena/searchstorehandler.cpp delete mode 100644 src/net/eathena/searchstorehandler.h delete mode 100644 src/net/eathena/searchstorerecv.cpp delete mode 100644 src/net/eathena/searchstorerecv.h delete mode 100644 src/net/eathena/serverfeatures.cpp delete mode 100644 src/net/eathena/serverfeatures.h delete mode 100644 src/net/eathena/skillhandler.cpp delete mode 100644 src/net/eathena/skillhandler.h delete mode 100644 src/net/eathena/skillrecv.cpp delete mode 100644 src/net/eathena/skillrecv.h delete mode 100644 src/net/eathena/sp.h delete mode 100644 src/net/eathena/sprite.h delete mode 100644 src/net/eathena/tradehandler.cpp delete mode 100644 src/net/eathena/tradehandler.h delete mode 100644 src/net/eathena/traderecv.cpp delete mode 100644 src/net/eathena/traderecv.h delete mode 100644 src/net/eathena/updateprotocol.cpp delete mode 100644 src/net/eathena/updateprotocol.h delete mode 100644 src/net/eathena/vendinghandler.cpp delete mode 100644 src/net/eathena/vendinghandler.h delete mode 100644 src/net/eathena/vendingrecv.cpp delete mode 100644 src/net/eathena/vendingrecv.h delete mode 100644 src/net/elementalhandler.h delete mode 100644 src/net/familyhandler.h delete mode 100644 src/net/friendshandler.h delete mode 100644 src/net/gamehandler.h delete mode 100644 src/net/generalhandler.h delete mode 100644 src/net/guildhandler.h delete mode 100644 src/net/homunculushandler.h delete mode 100644 src/net/hostsgroup.h delete mode 100644 src/net/inventoryhandler.h delete mode 100644 src/net/ipc.cpp delete mode 100644 src/net/ipc.h delete mode 100644 src/net/logindata.h delete mode 100644 src/net/loginhandler.h delete mode 100644 src/net/mail2handler.h delete mode 100644 src/net/mailhandler.h delete mode 100644 src/net/maphandler.h delete mode 100644 src/net/markethandler.h delete mode 100644 src/net/mercenaryhandler.h delete mode 100644 src/net/messagein.cpp delete mode 100644 src/net/messagein.h delete mode 100644 src/net/messageout.cpp delete mode 100644 src/net/messageout.h delete mode 100644 src/net/net.cpp delete mode 100644 src/net/net.h delete mode 100644 src/net/npchandler.h delete mode 100644 src/net/packetcounters.cpp delete mode 100644 src/net/packetcounters.h delete mode 100644 src/net/packetfunction.h delete mode 100644 src/net/packetinfo.h delete mode 100644 src/net/packetlimiter.cpp delete mode 100644 src/net/packetlimiter.h delete mode 100644 src/net/partyhandler.h delete mode 100644 src/net/pethandler.h delete mode 100644 src/net/playerhandler.h delete mode 100644 src/net/protocoloutdefine.h delete mode 100644 src/net/protocoloutinclude.h delete mode 100644 src/net/protocoloutupdate.h delete mode 100644 src/net/questhandler.h delete mode 100644 src/net/recvpacketdefine.h delete mode 100644 src/net/roulettehandler.h delete mode 100644 src/net/sdltcpnet.cpp delete mode 100644 src/net/sdltcpnet.h delete mode 100644 src/net/searchstorehandler.h delete mode 100644 src/net/serverfeatures.h delete mode 100644 src/net/serverinfo.h delete mode 100644 src/net/serverurlinfo.h delete mode 100644 src/net/skillhandler.h delete mode 100644 src/net/tmwa/adminhandler.cpp delete mode 100644 src/net/tmwa/adminhandler.h delete mode 100644 src/net/tmwa/auctionhandler.cpp delete mode 100644 src/net/tmwa/auctionhandler.h delete mode 100644 src/net/tmwa/bankhandler.cpp delete mode 100644 src/net/tmwa/bankhandler.h delete mode 100644 src/net/tmwa/battlegroundhandler.cpp delete mode 100644 src/net/tmwa/battlegroundhandler.h delete mode 100644 src/net/tmwa/beinghandler.cpp delete mode 100644 src/net/tmwa/beinghandler.h delete mode 100644 src/net/tmwa/beingrecv.cpp delete mode 100644 src/net/tmwa/beingrecv.h delete mode 100644 src/net/tmwa/buyingstorehandler.cpp delete mode 100644 src/net/tmwa/buyingstorehandler.h delete mode 100644 src/net/tmwa/buysellhandler.cpp delete mode 100644 src/net/tmwa/buysellhandler.h delete mode 100644 src/net/tmwa/buysellrecv.cpp delete mode 100644 src/net/tmwa/buysellrecv.h delete mode 100644 src/net/tmwa/cashshophandler.cpp delete mode 100644 src/net/tmwa/cashshophandler.h delete mode 100644 src/net/tmwa/charserverhandler.cpp delete mode 100644 src/net/tmwa/charserverhandler.h delete mode 100644 src/net/tmwa/charserverrecv.cpp delete mode 100644 src/net/tmwa/charserverrecv.h delete mode 100644 src/net/tmwa/chathandler.cpp delete mode 100644 src/net/tmwa/chathandler.h delete mode 100644 src/net/tmwa/chatrecv.cpp delete mode 100644 src/net/tmwa/chatrecv.h delete mode 100644 src/net/tmwa/elementalhandler.cpp delete mode 100644 src/net/tmwa/elementalhandler.h delete mode 100644 src/net/tmwa/familyhandler.cpp delete mode 100644 src/net/tmwa/familyhandler.h delete mode 100644 src/net/tmwa/friendshandler.cpp delete mode 100644 src/net/tmwa/friendshandler.h delete mode 100644 src/net/tmwa/gamehandler.cpp delete mode 100644 src/net/tmwa/gamehandler.h delete mode 100644 src/net/tmwa/gamerecv.cpp delete mode 100644 src/net/tmwa/gamerecv.h delete mode 100644 src/net/tmwa/generalhandler.cpp delete mode 100644 src/net/tmwa/generalhandler.h delete mode 100644 src/net/tmwa/generalrecv.cpp delete mode 100644 src/net/tmwa/generalrecv.h delete mode 100644 src/net/tmwa/guildhandler.cpp delete mode 100644 src/net/tmwa/guildhandler.h delete mode 100644 src/net/tmwa/guildmanager.cpp delete mode 100644 src/net/tmwa/guildmanager.h delete mode 100644 src/net/tmwa/homunculushandler.cpp delete mode 100644 src/net/tmwa/homunculushandler.h delete mode 100644 src/net/tmwa/inventoryhandler.cpp delete mode 100644 src/net/tmwa/inventoryhandler.h delete mode 100644 src/net/tmwa/inventoryrecv.cpp delete mode 100644 src/net/tmwa/inventoryrecv.h delete mode 100644 src/net/tmwa/itemhandler.cpp delete mode 100644 src/net/tmwa/itemhandler.h delete mode 100644 src/net/tmwa/itemrecv.cpp delete mode 100644 src/net/tmwa/itemrecv.h delete mode 100644 src/net/tmwa/loginhandler.cpp delete mode 100644 src/net/tmwa/loginhandler.h delete mode 100644 src/net/tmwa/loginrecv.cpp delete mode 100644 src/net/tmwa/loginrecv.h delete mode 100644 src/net/tmwa/mail2handler.cpp delete mode 100644 src/net/tmwa/mail2handler.h delete mode 100644 src/net/tmwa/mailhandler.cpp delete mode 100644 src/net/tmwa/mailhandler.h delete mode 100644 src/net/tmwa/maphandler.cpp delete mode 100644 src/net/tmwa/maphandler.h delete mode 100644 src/net/tmwa/markethandler.cpp delete mode 100644 src/net/tmwa/markethandler.h delete mode 100644 src/net/tmwa/mercenaryhandler.cpp delete mode 100644 src/net/tmwa/mercenaryhandler.h delete mode 100644 src/net/tmwa/messagein.cpp delete mode 100644 src/net/tmwa/messagein.h delete mode 100644 src/net/tmwa/messageout.cpp delete mode 100644 src/net/tmwa/messageout.h delete mode 100644 src/net/tmwa/network.cpp delete mode 100644 src/net/tmwa/network.h delete mode 100644 src/net/tmwa/npchandler.cpp delete mode 100644 src/net/tmwa/npchandler.h delete mode 100644 src/net/tmwa/packetsin.inc delete mode 100644 src/net/tmwa/packetsout.inc delete mode 100644 src/net/tmwa/partyhandler.cpp delete mode 100644 src/net/tmwa/partyhandler.h delete mode 100644 src/net/tmwa/partyrecv.cpp delete mode 100644 src/net/tmwa/partyrecv.h delete mode 100644 src/net/tmwa/pethandler.cpp delete mode 100644 src/net/tmwa/pethandler.h delete mode 100644 src/net/tmwa/playerhandler.cpp delete mode 100644 src/net/tmwa/playerhandler.h delete mode 100644 src/net/tmwa/playerrecv.cpp delete mode 100644 src/net/tmwa/playerrecv.h delete mode 100644 src/net/tmwa/protocolout.cpp delete mode 100644 src/net/tmwa/protocolout.h delete mode 100644 src/net/tmwa/questhandler.cpp delete mode 100644 src/net/tmwa/questhandler.h delete mode 100644 src/net/tmwa/questrecv.cpp delete mode 100644 src/net/tmwa/questrecv.h delete mode 100644 src/net/tmwa/recvpackets.inc delete mode 100644 src/net/tmwa/roulettehandler.cpp delete mode 100644 src/net/tmwa/roulettehandler.h delete mode 100644 src/net/tmwa/searchstorehandler.cpp delete mode 100644 src/net/tmwa/searchstorehandler.h delete mode 100644 src/net/tmwa/serverfeatures.cpp delete mode 100644 src/net/tmwa/serverfeatures.h delete mode 100644 src/net/tmwa/skillhandler.cpp delete mode 100644 src/net/tmwa/skillhandler.h delete mode 100644 src/net/tmwa/skillrecv.cpp delete mode 100644 src/net/tmwa/skillrecv.h delete mode 100644 src/net/tmwa/sp.h delete mode 100644 src/net/tmwa/sprite.h delete mode 100644 src/net/tmwa/tradehandler.cpp delete mode 100644 src/net/tmwa/tradehandler.h delete mode 100644 src/net/tmwa/traderecv.cpp delete mode 100644 src/net/tmwa/traderecv.h delete mode 100644 src/net/tmwa/updateprotocol.cpp delete mode 100644 src/net/tmwa/updateprotocol.h delete mode 100644 src/net/tmwa/vendinghandler.cpp delete mode 100644 src/net/tmwa/vendinghandler.h delete mode 100644 src/net/tradehandler.h delete mode 100644 src/net/updatetypeoperators.cpp delete mode 100644 src/net/updatetypeoperators.h delete mode 100644 src/net/uploadcharinfo.h delete mode 100644 src/net/useragent.cpp delete mode 100644 src/net/useragent.h delete mode 100644 src/net/vendinghandler.h delete mode 100644 src/net/worldinfo.h delete mode 100644 src/notifymanager.cpp delete mode 100644 src/notifymanager.h delete mode 100644 src/options.h delete mode 100644 src/particle/animationparticle.cpp delete mode 100644 src/particle/animationparticle.h delete mode 100644 src/particle/imageparticle.cpp delete mode 100644 src/particle/imageparticle.h delete mode 100644 src/particle/particle.cpp delete mode 100644 src/particle/particle.h delete mode 100644 src/particle/particlecontainer.cpp delete mode 100644 src/particle/particlecontainer.h delete mode 100644 src/particle/particleemitter.cpp delete mode 100644 src/particle/particleemitter.h delete mode 100644 src/particle/particleemitterprop.h delete mode 100644 src/particle/particleengine.cpp delete mode 100644 src/particle/particleengine.h delete mode 100644 src/particle/particleinfo.h delete mode 100644 src/particle/particlelist.cpp delete mode 100644 src/particle/particlelist.h delete mode 100644 src/particle/particletimer.h delete mode 100644 src/particle/particlevector.cpp delete mode 100644 src/particle/particlevector.h delete mode 100644 src/particle/rotationalparticle.cpp delete mode 100644 src/particle/rotationalparticle.h delete mode 100644 src/particle/textparticle.cpp delete mode 100644 src/particle/textparticle.h delete mode 100644 src/party.cpp delete mode 100644 src/party.h delete mode 100644 src/position.cpp delete mode 100644 src/position.h delete mode 100644 src/progs/dyecmd/actions/actions.cpp delete mode 100644 src/progs/dyecmd/actions/chat.cpp delete mode 100644 src/progs/dyecmd/actions/commands.cpp delete mode 100644 src/progs/dyecmd/actions/move.cpp delete mode 100644 src/progs/dyecmd/actions/pets.cpp delete mode 100644 src/progs/dyecmd/actions/statusbar.cpp delete mode 100644 src/progs/dyecmd/actions/tabs.cpp delete mode 100644 src/progs/dyecmd/actions/target.cpp delete mode 100644 src/progs/dyecmd/actions/windows.cpp delete mode 100644 src/progs/dyecmd/client.cpp delete mode 100644 src/progs/dyecmd/client.h delete mode 100644 src/progs/dyecmd/dyemain.cpp delete mode 100644 src/progs/dyecmd/gui/viewport.cpp delete mode 100644 src/progs/dyecmd/gui/viewport.h delete mode 100644 src/progs/manaplus/actions/actions.cpp delete mode 100644 src/progs/manaplus/actions/chat.cpp delete mode 100644 src/progs/manaplus/actions/commands.cpp delete mode 100644 src/progs/manaplus/actions/move.cpp delete mode 100644 src/progs/manaplus/actions/pets.cpp delete mode 100644 src/progs/manaplus/actions/statusbar.cpp delete mode 100644 src/progs/manaplus/actions/tabs.cpp delete mode 100644 src/progs/manaplus/actions/target.cpp delete mode 100644 src/progs/manaplus/actions/windows.cpp delete mode 100644 src/progs/manaplus/client.cpp delete mode 100644 src/progs/manaplus/client.h delete mode 100644 src/progs/manaplus/gui/viewport.cpp delete mode 100644 src/progs/manaplus/gui/viewport.h delete mode 100644 src/render/graphics.cpp delete mode 100644 src/render/graphics.h delete mode 100644 src/render/graphics_calcImageRect.hpp delete mode 100644 src/render/graphics_drawImageRect.hpp delete mode 100644 src/render/graphicsdef.hpp delete mode 100644 src/render/imagegraphics.cpp delete mode 100644 src/render/imagegraphics.h delete mode 100644 src/render/mobileopengl2graphics.cpp delete mode 100644 src/render/mobileopengl2graphics.h delete mode 100644 src/render/mobileopenglgraphics.cpp delete mode 100644 src/render/mobileopenglgraphics.h delete mode 100644 src/render/modernopenglgraphics.cpp delete mode 100644 src/render/modernopenglgraphics.h delete mode 100644 src/render/nacl/naclfunctions.h delete mode 100644 src/render/nacl/naclgles.cpp delete mode 100644 src/render/nacl/naclgles.h delete mode 100644 src/render/normalopenglgraphics.cpp delete mode 100644 src/render/normalopenglgraphics.h delete mode 100644 src/render/nullopenglgraphics.cpp delete mode 100644 src/render/nullopenglgraphics.h delete mode 100644 src/render/opengl/mgl.cpp delete mode 100644 src/render/opengl/mgl.h delete mode 100644 src/render/opengl/mgl.hpp delete mode 100644 src/render/opengl/mglcheck.h delete mode 100644 src/render/opengl/mgldefines.h delete mode 100644 src/render/opengl/mglemu.cpp delete mode 100644 src/render/opengl/mglemu.h delete mode 100644 src/render/opengl/mglfunctions.h delete mode 100644 src/render/opengl/mgltypes.h delete mode 100644 src/render/opengl/naclglfunctions.h delete mode 100644 src/render/opengl/opengldebug.h delete mode 100644 src/render/openglgraphicsdef.hpp delete mode 100644 src/render/openglgraphicsdef1.hpp delete mode 100644 src/render/openglgraphicsdefadvanced.hpp delete mode 100644 src/render/openglx/mglx.cpp delete mode 100644 src/render/openglx/mglx.h delete mode 100644 src/render/openglx/mglx.hpp delete mode 100644 src/render/openglx/mglxinit.cpp delete mode 100644 src/render/openglx/mglxinit.h delete mode 100644 src/render/openglx/mglxtypes.h delete mode 100644 src/render/renderers.cpp delete mode 100644 src/render/renderers.h delete mode 100644 src/render/rendererslistsdl.h delete mode 100644 src/render/rendererslistsdl2.h delete mode 100644 src/render/safeopenglgraphics.cpp delete mode 100644 src/render/safeopenglgraphics.h delete mode 100644 src/render/sdl2graphics.cpp delete mode 100644 src/render/sdl2graphics.h delete mode 100644 src/render/sdl2softwaregraphics.cpp delete mode 100644 src/render/sdl2softwaregraphics.h delete mode 100644 src/render/sdlgraphics.cpp delete mode 100644 src/render/sdlgraphics.h delete mode 100644 src/render/shaders/shader.cpp delete mode 100644 src/render/shaders/shader.h delete mode 100644 src/render/shaders/shaderprogram.cpp delete mode 100644 src/render/shaders/shaderprogram.h delete mode 100644 src/render/shaders/shadersmanager.cpp delete mode 100644 src/render/shaders/shadersmanager.h delete mode 100644 src/render/softwaregraphicsdef.hpp delete mode 100644 src/render/surfacegraphics.cpp delete mode 100644 src/render/surfacegraphics.h delete mode 100644 src/render/vertexes/imagecollection.cpp delete mode 100644 src/render/vertexes/imagecollection.h delete mode 100644 src/render/vertexes/imagevertexes.cpp delete mode 100644 src/render/vertexes/imagevertexes.h delete mode 100644 src/render/vertexes/openglgraphicsvertexes.cpp delete mode 100644 src/render/vertexes/openglgraphicsvertexes.h delete mode 100644 src/resources/action.cpp delete mode 100644 src/resources/action.h delete mode 100644 src/resources/ambientlayer.cpp delete mode 100644 src/resources/ambientlayer.h delete mode 100644 src/resources/animation/animation.cpp delete mode 100644 src/resources/animation/animation.h delete mode 100644 src/resources/animation/simpleanimation.cpp delete mode 100644 src/resources/animation/simpleanimation.h delete mode 100644 src/resources/atlas/atlasitem.h delete mode 100644 src/resources/atlas/atlasmanager.cpp delete mode 100644 src/resources/atlas/atlasmanager.h delete mode 100644 src/resources/atlas/atlasresource.cpp delete mode 100644 src/resources/atlas/atlasresource.h delete mode 100644 src/resources/atlas/textureatlas.h delete mode 100644 src/resources/attack.h delete mode 100644 src/resources/basicstat.h delete mode 100644 src/resources/beingcommon.cpp delete mode 100644 src/resources/beingcommon.h delete mode 100644 src/resources/beinginfo.cpp delete mode 100644 src/resources/beinginfo.h delete mode 100644 src/resources/beingmenuitem.h delete mode 100644 src/resources/beingslot.cpp delete mode 100644 src/resources/beingslot.h delete mode 100644 src/resources/chatobject.cpp delete mode 100644 src/resources/chatobject.h delete mode 100644 src/resources/cursors.cpp delete mode 100644 src/resources/cursors.h delete mode 100644 src/resources/db/avatardb.cpp delete mode 100644 src/resources/db/avatardb.h delete mode 100644 src/resources/db/badgesdb.cpp delete mode 100644 src/resources/db/badgesdb.h delete mode 100644 src/resources/db/chardb.cpp delete mode 100644 src/resources/db/chardb.h delete mode 100644 src/resources/db/colordb.cpp delete mode 100644 src/resources/db/colordb.h delete mode 100644 src/resources/db/commandsdb.cpp delete mode 100644 src/resources/db/commandsdb.h delete mode 100644 src/resources/db/deaddb.cpp delete mode 100644 src/resources/db/deaddb.h delete mode 100644 src/resources/db/elementaldb.cpp delete mode 100644 src/resources/db/elementaldb.h delete mode 100644 src/resources/db/emotedb.cpp delete mode 100644 src/resources/db/emotedb.h delete mode 100644 src/resources/db/groupdb.cpp delete mode 100644 src/resources/db/groupdb.h delete mode 100644 src/resources/db/homunculusdb.cpp delete mode 100644 src/resources/db/homunculusdb.h delete mode 100644 src/resources/db/horsedb.cpp delete mode 100644 src/resources/db/horsedb.h delete mode 100644 src/resources/db/itemdb.cpp delete mode 100644 src/resources/db/itemdb.h delete mode 100644 src/resources/db/itemfielddb.cpp delete mode 100644 src/resources/db/itemfielddb.h delete mode 100644 src/resources/db/itemoptiondb.cpp delete mode 100644 src/resources/db/itemoptiondb.h delete mode 100644 src/resources/db/languagedb.cpp delete mode 100644 src/resources/db/languagedb.h delete mode 100644 src/resources/db/mapdb.cpp delete mode 100644 src/resources/db/mapdb.h delete mode 100644 src/resources/db/mercenarydb.cpp delete mode 100644 src/resources/db/mercenarydb.h delete mode 100644 src/resources/db/moddb.cpp delete mode 100644 src/resources/db/moddb.h delete mode 100644 src/resources/db/monsterdb.cpp delete mode 100644 src/resources/db/monsterdb.h delete mode 100644 src/resources/db/networkdb.cpp delete mode 100644 src/resources/db/networkdb.h delete mode 100644 src/resources/db/npcdb.cpp delete mode 100644 src/resources/db/npcdb.h delete mode 100644 src/resources/db/npcdialogdb.cpp delete mode 100644 src/resources/db/npcdialogdb.h delete mode 100644 src/resources/db/palettedb.cpp delete mode 100644 src/resources/db/palettedb.h delete mode 100644 src/resources/db/petdb.cpp delete mode 100644 src/resources/db/petdb.h delete mode 100644 src/resources/db/questdb.cpp delete mode 100644 src/resources/db/questdb.h delete mode 100644 src/resources/db/skillunitdb.cpp delete mode 100644 src/resources/db/skillunitdb.h delete mode 100644 src/resources/db/sounddb.cpp delete mode 100644 src/resources/db/sounddb.h delete mode 100644 src/resources/db/statdb.cpp delete mode 100644 src/resources/db/statdb.h delete mode 100644 src/resources/db/statuseffectdb.cpp delete mode 100644 src/resources/db/statuseffectdb.h delete mode 100644 src/resources/db/textdb.cpp delete mode 100644 src/resources/db/textdb.h delete mode 100644 src/resources/db/unitsdb.cpp delete mode 100644 src/resources/db/unitsdb.h delete mode 100644 src/resources/db/weaponsdb.cpp delete mode 100644 src/resources/db/weaponsdb.h delete mode 100644 src/resources/dbmanager.cpp delete mode 100644 src/resources/dbmanager.h delete mode 100644 src/resources/delayedmanager.cpp delete mode 100644 src/resources/delayedmanager.h delete mode 100644 src/resources/dye/dye.cpp delete mode 100644 src/resources/dye/dye.h delete mode 100644 src/resources/dye/dyecolor.h delete mode 100644 src/resources/dye/dyepalette.cpp delete mode 100644 src/resources/dye/dyepalette.h delete mode 100644 src/resources/dye/dyepalette_replaceacolor.cpp delete mode 100644 src/resources/dye/dyepalette_replaceaoglcolor.cpp delete mode 100644 src/resources/dye/dyepalette_replacescolor.cpp delete mode 100644 src/resources/dye/dyepalette_replacesoglcolor.cpp delete mode 100644 src/resources/dye/dyepaletteptr.h delete mode 100644 src/resources/effectdescription.h delete mode 100644 src/resources/emoteinfo.h delete mode 100644 src/resources/emotesprite.h delete mode 100644 src/resources/equipmentslots.h delete mode 100644 src/resources/fboinfo.h delete mode 100644 src/resources/frame.h delete mode 100644 src/resources/groupinfo.cpp delete mode 100644 src/resources/groupinfo.h delete mode 100644 src/resources/horseinfo.h delete mode 100644 src/resources/horseoffset.h delete mode 100644 src/resources/image/image.cpp delete mode 100644 src/resources/image/image.h delete mode 100644 src/resources/image/subimage.cpp delete mode 100644 src/resources/image/subimage.h delete mode 100644 src/resources/imagehelper.cpp delete mode 100644 src/resources/imagehelper.h delete mode 100644 src/resources/imagerect.h delete mode 100644 src/resources/imageset.cpp delete mode 100644 src/resources/imageset.h delete mode 100644 src/resources/inventory/complexinventory.cpp delete mode 100644 src/resources/inventory/complexinventory.h delete mode 100644 src/resources/inventory/inventory.cpp delete mode 100644 src/resources/inventory/inventory.h delete mode 100644 src/resources/item/cardslist.cpp delete mode 100644 src/resources/item/cardslist.h delete mode 100644 src/resources/item/complexitem.cpp delete mode 100644 src/resources/item/complexitem.h delete mode 100644 src/resources/item/item.cpp delete mode 100644 src/resources/item/item.h delete mode 100644 src/resources/item/itemfieldtype.h delete mode 100644 src/resources/item/itemoption.h delete mode 100644 src/resources/item/itemoptionslist.h delete mode 100644 src/resources/item/shopitem.cpp delete mode 100644 src/resources/item/shopitem.h delete mode 100644 src/resources/itemcolordata.h delete mode 100644 src/resources/iteminfo.cpp delete mode 100644 src/resources/iteminfo.h delete mode 100644 src/resources/itemmenuitem.h delete mode 100644 src/resources/itemtypemap.h delete mode 100644 src/resources/itemtypemapdata.h delete mode 100644 src/resources/loaders/atlasloader.cpp delete mode 100644 src/resources/loaders/atlasloader.h delete mode 100644 src/resources/loaders/emptyatlasloader.cpp delete mode 100644 src/resources/loaders/emptyatlasloader.h delete mode 100644 src/resources/loaders/imageloader.cpp delete mode 100644 src/resources/loaders/imageloader.h delete mode 100644 src/resources/loaders/imagesetloader.cpp delete mode 100644 src/resources/loaders/imagesetloader.h delete mode 100644 src/resources/loaders/musicloader.cpp delete mode 100644 src/resources/loaders/musicloader.h delete mode 100644 src/resources/loaders/rescaledloader.cpp delete mode 100644 src/resources/loaders/rescaledloader.h delete mode 100644 src/resources/loaders/shaderloader.cpp delete mode 100644 src/resources/loaders/shaderloader.h delete mode 100644 src/resources/loaders/shaderprogramloader.cpp delete mode 100644 src/resources/loaders/shaderprogramloader.h delete mode 100644 src/resources/loaders/soundloader.cpp delete mode 100644 src/resources/loaders/soundloader.h delete mode 100644 src/resources/loaders/spritedefloader.cpp delete mode 100644 src/resources/loaders/spritedefloader.h delete mode 100644 src/resources/loaders/subimageloader.cpp delete mode 100644 src/resources/loaders/subimageloader.h delete mode 100644 src/resources/loaders/subimagesetloader.cpp delete mode 100644 src/resources/loaders/subimagesetloader.h delete mode 100644 src/resources/loaders/walklayerloader.cpp delete mode 100644 src/resources/loaders/walklayerloader.h delete mode 100644 src/resources/loaders/xmlloader.cpp delete mode 100644 src/resources/loaders/xmlloader.h delete mode 100644 src/resources/mailqueue.h delete mode 100644 src/resources/map/location.h delete mode 100644 src/resources/map/map.cpp delete mode 100644 src/resources/map/map.h delete mode 100644 src/resources/map/mapheights.cpp delete mode 100644 src/resources/map/mapheights.h delete mode 100644 src/resources/map/mapitem.cpp delete mode 100644 src/resources/map/mapitem.h delete mode 100644 src/resources/map/maplayer.cpp delete mode 100644 src/resources/map/maplayer.h delete mode 100644 src/resources/map/mapobject.h delete mode 100644 src/resources/map/mapobjectlist.h delete mode 100644 src/resources/map/maprowvertexes.h delete mode 100644 src/resources/map/metatile.h delete mode 100644 src/resources/map/objectslayer.cpp delete mode 100644 src/resources/map/objectslayer.h delete mode 100644 src/resources/map/properties.h delete mode 100644 src/resources/map/speciallayer.cpp delete mode 100644 src/resources/map/speciallayer.h delete mode 100644 src/resources/map/tileanimation.cpp delete mode 100644 src/resources/map/tileanimation.h delete mode 100644 src/resources/map/tileinfo.h delete mode 100644 src/resources/map/tileset.h delete mode 100644 src/resources/map/walklayer.cpp delete mode 100644 src/resources/map/walklayer.h delete mode 100644 src/resources/mapinfo.h delete mode 100644 src/resources/mapreader.cpp delete mode 100644 src/resources/mapreader.h delete mode 100644 src/resources/memorycounter.cpp delete mode 100644 src/resources/memorycounter.h delete mode 100644 src/resources/memorymanager.cpp delete mode 100644 src/resources/memorymanager.h delete mode 100644 src/resources/missileinfo.h delete mode 100644 src/resources/mobileopenglscreenshothelper.cpp delete mode 100644 src/resources/mobileopenglscreenshothelper.h delete mode 100644 src/resources/modinfo.cpp delete mode 100644 src/resources/modinfo.h delete mode 100644 src/resources/mstack.h delete mode 100644 src/resources/notificationinfo.h delete mode 100644 src/resources/notifications.h delete mode 100644 src/resources/npcbuttoninfo.h delete mode 100644 src/resources/npcdialoginfo.h delete mode 100644 src/resources/npcdialogmenuinfo.h delete mode 100644 src/resources/npcimageinfo.h delete mode 100644 src/resources/npcinventoryinfo.h delete mode 100644 src/resources/npctextinfo.h delete mode 100644 src/resources/openglimagehelper.cpp delete mode 100644 src/resources/openglimagehelper.h delete mode 100644 src/resources/openglscreenshothelper.cpp delete mode 100644 src/resources/openglscreenshothelper.h delete mode 100644 src/resources/questeffect.h delete mode 100644 src/resources/questitem.h delete mode 100644 src/resources/questitemtext.h delete mode 100644 src/resources/questvar.h delete mode 100644 src/resources/rect/doublerect.h delete mode 100644 src/resources/resource.cpp delete mode 100644 src/resources/resource.h delete mode 100644 src/resources/resourcefunctiontypes.h delete mode 100644 src/resources/resourcemanager/resourcemanager.cpp delete mode 100644 src/resources/resourcemanager/resourcemanager.h delete mode 100644 src/resources/resourcetypes.h delete mode 100644 src/resources/safeopenglimagehelper.cpp delete mode 100644 src/resources/safeopenglimagehelper.h delete mode 100644 src/resources/screenshothelper.h delete mode 100644 src/resources/sdl2imagehelper.cpp delete mode 100644 src/resources/sdl2imagehelper.h delete mode 100644 src/resources/sdl2softwareimagehelper.cpp delete mode 100644 src/resources/sdl2softwareimagehelper.h delete mode 100644 src/resources/sdl2softwarescreenshothelper.cpp delete mode 100644 src/resources/sdl2softwarescreenshothelper.h delete mode 100644 src/resources/sdlgfxblitfunc.cpp delete mode 100644 src/resources/sdlgfxblitfunc.h delete mode 100644 src/resources/sdlimagehelper.cpp delete mode 100644 src/resources/sdlimagehelper.h delete mode 100644 src/resources/sdlmusic.cpp delete mode 100644 src/resources/sdlmusic.h delete mode 100644 src/resources/sdlscreenshothelper.cpp delete mode 100644 src/resources/sdlscreenshothelper.h delete mode 100644 src/resources/servercommands.inc delete mode 100644 src/resources/serverpermissions.inc delete mode 100644 src/resources/skill/skilldata.cpp delete mode 100644 src/resources/skill/skilldata.h delete mode 100644 src/resources/skill/skillinfo.cpp delete mode 100644 src/resources/skill/skillinfo.h delete mode 100644 src/resources/skill/skilltypeentry.h delete mode 100644 src/resources/skill/skilltypelist.h delete mode 100644 src/resources/soundeffect.cpp delete mode 100644 src/resources/soundeffect.h delete mode 100644 src/resources/soundinfo.h delete mode 100644 src/resources/sprite/animatedsprite.cpp delete mode 100644 src/resources/sprite/animatedsprite.h delete mode 100644 src/resources/sprite/animationdelayload.cpp delete mode 100644 src/resources/sprite/animationdelayload.h delete mode 100644 src/resources/sprite/imagesprite.cpp delete mode 100644 src/resources/sprite/imagesprite.h delete mode 100644 src/resources/sprite/sprite.h delete mode 100644 src/resources/sprite/spritedef.cpp delete mode 100644 src/resources/sprite/spritedef.h delete mode 100644 src/resources/sprite/spritedisplay.h delete mode 100644 src/resources/sprite/spritereference.h delete mode 100644 src/resources/surfaceimagehelper.cpp delete mode 100644 src/resources/surfaceimagehelper.h delete mode 100644 src/resources/updatefile.h delete mode 100644 src/resources/wallpaper.cpp delete mode 100644 src/resources/wallpaper.h delete mode 100644 src/resources/wallpaperdata.h delete mode 100644 src/sdl2gfx/SDL2_framerate.cpp delete mode 100644 src/sdl2gfx/SDL2_framerate.h delete mode 100644 src/sdl2gfx/SDL2_rotozoom.cpp delete mode 100644 src/sdl2gfx/SDL2_rotozoom.h delete mode 100644 src/sdlshared.h delete mode 100644 src/settings.cpp delete mode 100644 src/settings.h delete mode 100644 src/soundmanager.cpp delete mode 100644 src/soundmanager.h delete mode 100644 src/spellmanager.cpp delete mode 100644 src/spellmanager.h delete mode 100644 src/statuseffect.cpp delete mode 100644 src/statuseffect.h delete mode 100644 src/test/testlauncher.cpp delete mode 100644 src/test/testlauncher.h delete mode 100644 src/test/testmain.cpp delete mode 100644 src/test/testmain.h delete mode 100644 src/text.cpp delete mode 100644 src/text.h delete mode 100644 src/textcommand.cpp delete mode 100644 src/textcommand.h delete mode 100644 src/textmanager.cpp delete mode 100644 src/textmanager.h delete mode 100644 src/unittests/catch.hpp delete mode 100644 src/unittests/configuration.cc delete mode 100644 src/unittests/doctest.h delete mode 100644 src/unittests/endian.cc delete mode 100644 src/unittests/enums/enums.cc delete mode 100644 src/unittests/enums/render/mockdrawtype.h delete mode 100644 src/unittests/fs/files.cc delete mode 100644 src/unittests/fs/virtfs/throw.cc delete mode 100644 src/unittests/fs/virtfs/virtfs.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_basic.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_enumerate.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_exists.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_getrealdir.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_mountdir1.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_mountdir2.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_mountzip1.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_mountzip2.cc delete mode 100644 src/unittests/fs/virtfs/virtfs1_unmount.cc delete mode 100644 src/unittests/fs/virtfs/virtfs2.cc delete mode 100644 src/unittests/fs/virtfs/zip.cc delete mode 100644 src/unittests/gui/fonts/textchunklist.cc delete mode 100644 src/unittests/gui/widgets/browserbox.cc delete mode 100644 src/unittests/gui/windowmanager.cc delete mode 100644 src/unittests/integrity.cc delete mode 100644 src/unittests/render/mockdrawitem.h delete mode 100644 src/unittests/render/mockgraphics.cc delete mode 100644 src/unittests/render/mockgraphics.h delete mode 100644 src/unittests/resources/dye/dye.cc delete mode 100644 src/unittests/resources/dye/dyepalette.cc delete mode 100644 src/unittests/resources/map/maplayer/draw.cc delete mode 100644 src/unittests/resources/map/maplayer/drawfringenormal.cc delete mode 100644 src/unittests/resources/map/maplayer/drawfringesimple.cc delete mode 100644 src/unittests/resources/map/maplayer/drawspeciallayer1.cc delete mode 100644 src/unittests/resources/map/maplayer/drawspeciallayer2.cc delete mode 100644 src/unittests/resources/map/maplayer/getemptytiledrawwidth.cc delete mode 100644 src/unittests/resources/map/maplayer/gettiledrawwidth.cc delete mode 100644 src/unittests/resources/map/maplayer/updatecache.cc delete mode 100644 src/unittests/resources/map/maplayer/updateconditiontiles.cc delete mode 100644 src/unittests/resources/map/speciallayer.cc delete mode 100644 src/unittests/resources/mstack.cc delete mode 100644 src/unittests/resources/resourcemanager/resourcemanager.cc delete mode 100644 src/unittests/resources/sdlimagehelper.cc delete mode 100644 src/unittests/resources/sprite/animatedsprite.cc delete mode 100644 src/unittests/sdl.cc delete mode 100644 src/unittests/unittests.h delete mode 100644 src/unittests/utils/chatutils.cc delete mode 100644 src/unittests/utils/checkutils.cc delete mode 100644 src/unittests/utils/dumplibs.cc delete mode 100644 src/unittests/utils/langs.cc delete mode 100644 src/unittests/utils/mathutils.cc delete mode 100644 src/unittests/utils/parameters.cc delete mode 100644 src/unittests/utils/stringutils.cc delete mode 100644 src/unittests/utils/timer.cc delete mode 100644 src/unittests/utils/translation/poparser.cc delete mode 100644 src/unittests/utils/xml.cc delete mode 100644 src/unittests/utils/xmlutils.cc delete mode 100644 src/utils/base64.cpp delete mode 100644 src/utils/base64.h delete mode 100644 src/utils/booleanoptions.h delete mode 100644 src/utils/browserboxtools.cpp delete mode 100644 src/utils/browserboxtools.h delete mode 100644 src/utils/buildhex.h delete mode 100644 src/utils/cast.h delete mode 100644 src/utils/chatutils.cpp delete mode 100644 src/utils/chatutils.h delete mode 100644 src/utils/checkutils.cpp delete mode 100644 src/utils/checkutils.h delete mode 100644 src/utils/copynpaste.cpp delete mode 100644 src/utils/copynpaste.h delete mode 100644 src/utils/cpu.cpp delete mode 100644 src/utils/cpu.h delete mode 100644 src/utils/delete2.h delete mode 100644 src/utils/dtor.h delete mode 100644 src/utils/dumplibs.cpp delete mode 100644 src/utils/dumplibs.h delete mode 100644 src/utils/dumpsizes.cpp delete mode 100644 src/utils/dumpsizes.h delete mode 100644 src/utils/env.cpp delete mode 100644 src/utils/env.h delete mode 100644 src/utils/foreach.h delete mode 100644 src/utils/fuzzer.cpp delete mode 100644 src/utils/fuzzer.h delete mode 100644 src/utils/gettext.h delete mode 100644 src/utils/gettexthelper.cpp delete mode 100644 src/utils/gettexthelper.h delete mode 100644 src/utils/glxhelper.cpp delete mode 100644 src/utils/glxhelper.h delete mode 100644 src/utils/gmfunctions.cpp delete mode 100644 src/utils/gmfunctions.h delete mode 100644 src/utils/intmap.h delete mode 100644 src/utils/langs.cpp delete mode 100644 src/utils/langs.h delete mode 100644 src/utils/likely.h delete mode 100644 src/utils/mathutils.h delete mode 100644 src/utils/mrand.cpp delete mode 100644 src/utils/mrand.h delete mode 100644 src/utils/mutex.h delete mode 100644 src/utils/naclmessages.cpp delete mode 100644 src/utils/naclmessages.h delete mode 100644 src/utils/parameters.cpp delete mode 100644 src/utils/parameters.h delete mode 100644 src/utils/perfomance.cpp delete mode 100644 src/utils/perfomance.h delete mode 100644 src/utils/pnglib.cpp delete mode 100644 src/utils/pnglib.h delete mode 100644 src/utils/process.cpp delete mode 100644 src/utils/process.h delete mode 100644 src/utils/sdl2helper.cpp delete mode 100644 src/utils/sdl2helper.h delete mode 100644 src/utils/sdl2logger.cpp delete mode 100644 src/utils/sdl2logger.h delete mode 100644 src/utils/sdlcheckutils.cpp delete mode 100644 src/utils/sdlcheckutils.h delete mode 100644 src/utils/sdlhelper.cpp delete mode 100644 src/utils/sdlhelper.h delete mode 100644 src/utils/sdlmemoryobject.h delete mode 100644 src/utils/sdlpixel.h delete mode 100644 src/utils/sdlsharedhelper.cpp delete mode 100644 src/utils/sdlsharedhelper.h delete mode 100644 src/utils/stdmove.h delete mode 100644 src/utils/stringmap.h delete mode 100644 src/utils/stringutils.cpp delete mode 100644 src/utils/stringutils.h delete mode 100644 src/utils/stringvector.h delete mode 100644 src/utils/timer.cpp delete mode 100644 src/utils/timer.h delete mode 100644 src/utils/translation/podict.cpp delete mode 100644 src/utils/translation/podict.h delete mode 100644 src/utils/translation/poparser.cpp delete mode 100644 src/utils/translation/poparser.h delete mode 100644 src/utils/translation/translationmanager.cpp delete mode 100644 src/utils/translation/translationmanager.h delete mode 100644 src/utils/vector.h delete mode 100644 src/utils/x11logger.cpp delete mode 100644 src/utils/x11logger.h delete mode 100644 src/utils/xml.h delete mode 100644 src/utils/xml.inc delete mode 100644 src/utils/xml/libxml.cpp delete mode 100644 src/utils/xml/libxml.h delete mode 100644 src/utils/xml/libxml.inc delete mode 100644 src/utils/xml/pugixml.cpp delete mode 100644 src/utils/xml/pugixml.h delete mode 100644 src/utils/xml/pugixml.inc delete mode 100644 src/utils/xml/pugixmlwriter.cpp delete mode 100644 src/utils/xml/pugixmlwriter.h delete mode 100644 src/utils/xml/tinyxml2.cpp delete mode 100644 src/utils/xml/tinyxml2.h delete mode 100644 src/utils/xml/tinyxml2.inc delete mode 100644 src/utils/xmlutils.cpp delete mode 100644 src/utils/xmlutils.h delete mode 100644 src/utils/xmlwriter.h delete mode 100644 src/variabledata.h delete mode 100644 src/vector.cpp delete mode 100644 src/vector.h delete mode 100644 src/winver.h delete mode 100644 src/winver.h.in (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index e64b6cf4f..000000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,2163 +0,0 @@ -FIND_PACKAGE(SDL REQUIRED) -FIND_PACKAGE(SDL_image REQUIRED) -FIND_PACKAGE(SDL_mixer REQUIRED) -FIND_PACKAGE(SDL_net REQUIRED) -FIND_PACKAGE(SDL_ttf REQUIRED) -FIND_PACKAGE(SDL_gfx REQUIRED) -FIND_PACKAGE(CURL REQUIRED) -FIND_PACKAGE(LibXml2 REQUIRED) -FIND_PACKAGE(PNG REQUIRED) -FIND_PACKAGE(Gettext REQUIRED) -FIND_PACKAGE(ZLIB REQUIRED) - -IF (POLICY CMP0015) - CMAKE_POLICY(SET CMP0015 OLD) -ENDIF() - -SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"") -SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") -SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") -SET(DYE_FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\" -DDYECMD") -SET(DYE_FLAGS "${DYE_FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"") -SET(DYE_FLAGS "${DYE_FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"") - -IF (ENABLE_NLS) - SET(FLAGS "${FLAGS} -DENABLE_NLS=1") -ENDIF() - -IF (ENABLE_TMWA) - SET(FLAGS "${FLAGS} -DTMWA_SUPPORT=1") -ENDIF() - -SET(FLAGS "${FLAGS} -DENABLE_LIBXML -DENABLE_ASSERTS") - -IF (CMAKE_BUILD_TYPE) - STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) - IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug OR - CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo) - SET(FLAGS "${FLAGS} -DDEBUG") - SET(DYE_FLAGS "${DYE_FLAGS} -DDEBUG") - ENDIF() -ENDIF() - -IF (WIN32) - SET(EXTRA_LIBRARIES ws2_32 winmm) - FIND_PACKAGE(LibIntl REQUIRED) -ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR BEOS) - FIND_PACKAGE(LibIntl REQUIRED) -ELSEIF (CMAKE_SYSTEM_NAME STREQUAL SunOS) - # explicit linking to libintl is required on Solaris - SET(EXTRA_LIBRARIES intl) -ELSEIF (CMAKE_SYSTEM_NAME STREQUAL Linux) - #some distros need this explicitly linked - SET(EXTRA_LIBRARIES rt) -ENDIF() - -SET(FLAGS "${FLAGS} -DUSE_MUMBLE") - -IF (WITH_OPENGL) - FIND_PACKAGE(OpenGL REQUIRED) - INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) - SET(FLAGS "${FLAGS} -DUSE_OPENGL") -ENDIF (WITH_OPENGL) - -IF (USE_X11) - FIND_PACKAGE(X11 REQUIRED) - INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) - SET(FLAGS "${FLAGS} -DUSE_X11") -ENDIF (USE_X11) - -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR} - ${SDL_INCLUDE_DIR} - ${SDLIMAGE_INCLUDE_DIR} - ${SDLMIXER_INCLUDE_DIR} - ${SDLNET_INCLUDE_DIR} - ${SDLTTF_INCLUDE_DIR} - ${SDLGFX_INCLUDE_DIR} - ${PNG_INCLUDE_DIR} - ${CURL_INCLUDE_DIR} - ${LIBXML2_INCLUDE_DIR} - ) - -# enable rc-handling with mingw -# most likely this part can be kicked out with some later cmake version -IF (MINGW) - FIND_PATH(MINGW_INCLUDE_DIR windows.h $ENV{INCLUDE}) - IF (MINGW_INCLUDE_DIR) - MESSAGE(STATUS "Found mingw headers: ${MINGW_INCLUDE_DIR}") - INCLUDE_DIRECTORIES(${MINGW_INCLUDE_DIR}) - ELSE() - MESSAGE(FATAL_ERROR "Unable to find mingw headers. Required for windres") - ENDIF() - SET(CMAKE_RC_COMPILER_INIT windres) - ENABLE_LANGUAGE(RC) - SET(CMAKE_RC_COMPILE_OBJECT - " -O coff -o ") -ENDIF() - -# Fix some stuff that gets not hidden by mainline modules -MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR) -MARK_AS_ADVANCED(SDLIMAGE_LIBRARY) -MARK_AS_ADVANCED(SDLMAIN_LIBRARY) -MARK_AS_ADVANCED(SDLMIXER_INCLUDE_DIR) -MARK_AS_ADVANCED(SDLMIXER_LIBRARY) -MARK_AS_ADVANCED(SDLNET_INCLUDE_DIR) -MARK_AS_ADVANCED(SDLNET_LIBRARY) -MARK_AS_ADVANCED(SDL_INCLUDE_DIR) -MARK_AS_ADVANCED(SDL_LIBRARY) - -SET(SRCS - gui/widgets/avatarlistbox.cpp - gui/widgets/avatarlistbox.h - gui/models/avatarlistmodel.h - gui/models/beingslistmodel.h - gui/models/colorlistmodel.h - gui/widgets/tabs/chat/battletab.cpp - gui/widgets/tabs/chat/battletab.h - gui/widgets/tabs/chat/channeltab.cpp - gui/widgets/tabs/chat/channeltab.h - gui/widgets/browserbox.cpp - gui/widgets/browserbox.h - gui/widgets/browserbox.inc - gui/widgets/button.cpp - gui/widgets/button.h - gui/widgets/characterdisplay.cpp - gui/widgets/characterdisplay.h - gui/widgets/characterviewbase.h - gui/widgets/characterviewnormal.cpp - gui/widgets/characterviewnormal.h - gui/widgets/characterviewsmall.cpp - gui/widgets/characterviewsmall.h - gui/widgets/attrs/attrdisplay.cpp - gui/widgets/attrs/attrdisplay.h - gui/widgets/attrs/changedisplay.cpp - gui/widgets/attrs/changedisplay.h - gui/widgets/attrs/derdisplay.cpp - gui/widgets/attrs/derdisplay.h - gui/widgets/tabs/debugwindowtabs.cpp - gui/widgets/tabs/debugwindowtabs.h - gui/widgets/tabs/chat/chattab.cpp - gui/widgets/tabs/chat/chattab.h - gui/widgets/chatinput.h - gui/widgets/checkbox.cpp - gui/widgets/checkbox.h - gui/models/colormodel.cpp - gui/models/colormodel.h - gui/widgets/colorpage.cpp - gui/widgets/colorpage.h - gui/widgets/container.cpp - gui/widgets/container.h - gui/widgets/containerplacer.cpp - gui/widgets/containerplacer.h - gui/widgets/createwidget.h - gui/widgets/desktop.cpp - gui/widgets/desktop.h - gui/widgets/dropdown.cpp - gui/widgets/dropdown.h - gui/widgets/emoteshortcutcontainer.cpp - gui/widgets/emoteshortcutcontainer.h - gui/widgets/equipmentbox.h - gui/widgets/equipmentpage.h - gui/widgets/extendedlistbox.cpp - gui/widgets/extendedlistbox.h - gui/widgets/extendedlistboxitem.h - gui/models/extendedlistmodel.h - gui/models/extendednamesmodel.cpp - gui/models/extendednamesmodel.h - gui/models/fontsizechoicelistmodel.h - gui/models/fontsmodel.h - gui/models/iconsmodel.h - gui/models/ignorechoiceslistmodel.h - gui/models/itemsmodel.h - gui/models/keylistmodel.h - gui/models/langlistmodel.h - gui/widgets/flowcontainer.cpp - gui/widgets/flowcontainer.h - gui/widgets/tabs/chat/gmtab.cpp - gui/widgets/tabs/chat/gmtab.h - gui/widgets/tabs/chat/guildtab.cpp - gui/widgets/tabs/chat/guildtab.h - gui/widgets/tabs/chat/partytab.cpp - gui/widgets/tabs/chat/partytab.h - gui/widgets/horizontcontainer.cpp - gui/widgets/horizontcontainer.h - gui/widgets/icon.cpp - gui/widgets/icon.h - gui/widgets/inttextfield.cpp - gui/widgets/inttextfield.h - gui/widgets/itemcontainer.cpp - gui/widgets/itemcontainer.h - gui/widgets/itemlinkhandler.cpp - gui/widgets/itemlinkhandler.h - gui/widgets/virtshortcutcontainer.cpp - gui/widgets/virtshortcutcontainer.h - gui/widgets/emotepage.cpp - gui/widgets/emotepage.h - gui/widgets/itemshortcutcontainer.cpp - gui/widgets/itemshortcutcontainer.h - gui/widgets/spellshortcutcontainer.cpp - gui/widgets/spellshortcutcontainer.h - gui/widgets/staticbrowserbox.cpp - gui/widgets/staticbrowserbox.h - gui/widgets/statspage.cpp - gui/widgets/statspage.h - gui/widgets/statspagebasic.cpp - gui/widgets/statspagebasic.h - gui/widgets/label.cpp - gui/widgets/label.h - gui/widgets/tabs/chat/langtab.cpp - gui/widgets/tabs/chat/langtab.h - gui/widgets/layout.cpp - gui/widgets/layout.h - gui/widgets/layoutarray.cpp - gui/widgets/layoutarray.h - gui/widgets/layoutcell.cpp - gui/widgets/layoutcell.h - gui/widgets/layouthelper.cpp - gui/widgets/layouthelper.h - enums/gui/layouttype.h - enums/gui/linkhighlightmode.h - enums/gui/npcactionstate.h - enums/gui/npcinputstate.h - gui/widgets/linepart.cpp - gui/widgets/linepart.h - gui/widgets/linkhandler.h - gui/widgets/listbox.cpp - gui/widgets/listbox.h - gui/models/modelistmodel.cpp - gui/models/modelistmodel.h - gui/models/namesmodel.cpp - gui/models/namesmodel.h - gui/models/opengllistmodel.h - gui/models/playerrelationlistmodel.h - gui/models/playertablemodel.cpp - gui/models/playertablemodel.h - gui/models/questsmodel.h - gui/models/serverslistmodel.h - gui/widgets/passwordfield.cpp - gui/widgets/passwordfield.h - gui/widgets/playerbox.cpp - gui/widgets/playerbox.h - gui/widgets/popup.cpp - gui/widgets/popup.h - gui/widgets/popuplist.cpp - gui/widgets/popuplist.h - gui/widgets/progressbar.cpp - gui/widgets/progressbar.h - gui/widgets/progressindicator.cpp - gui/widgets/progressindicator.h - gui/widgets/radiobutton.cpp - gui/widgets/radiobutton.h - gui/widgets/radiogroup.cpp - gui/widgets/radiogroup.h - gui/widgets/scrollarea.cpp - gui/widgets/scrollarea.h - gui/widgets/serverslistbox.h - gui/widgets/setupbuttonitem.cpp - gui/widgets/setupbuttonitem.h - gui/widgets/setupitem.cpp - gui/widgets/setupitem.h - gui/widgets/setupquickitem.cpp - gui/widgets/setupquickitem.h - gui/widgets/tabs/setuptab.cpp - gui/widgets/tabs/setuptab.h - gui/widgets/tabs/setuptabscroll.cpp - gui/widgets/tabs/setuptabscroll.h - gui/widgets/setuptouchitem.cpp - gui/widgets/setuptouchitem.h - gui/models/shopitems.cpp - gui/models/shopitems.h - gui/widgets/shoplistbox.cpp - gui/widgets/shoplistbox.h - gui/widgets/shortcutcontainer.cpp - gui/widgets/shortcutcontainer.h - resources/skill/skilldata.cpp - resources/skill/skilldata.h - resources/skill/skillinfo.cpp - resources/skill/skillinfo.h - gui/widgets/skilllistbox.h - gui/widgets/skillrectanglelistbox.h - gui/models/skillmodel.cpp - gui/models/skillmodel.h - gui/models/sortlistmodelbuy.h - gui/models/sortlistmodelinv.h - gui/models/soundsmodel.h - gui/widgets/slider.cpp - gui/widgets/slider.h - gui/widgets/sliderlist.cpp - gui/widgets/sliderlist.h - gui/widgets/tabs/shortcuttab.h - gui/widgets/tabs/skilltab.h - gui/widgets/tabs/socialattacktab.h - gui/widgets/tabs/socialfriendsfunctor.h - gui/widgets/tabs/socialfriendstab.h - gui/widgets/tabs/socialguildtab.h - gui/widgets/tabs/socialnavigationtab.h - gui/widgets/tabs/socialpartytab.h - gui/widgets/tabs/socialpickuptab.h - gui/widgets/tabs/socialplayerstab.h - gui/widgets/tabs/socialtab.h - gui/widgets/tabs/socialtabbase.h - gui/widgets/tabs/tab.cpp - gui/widgets/tabs/tab.h - gui/widgets/tabbedarea.cpp - gui/widgets/tabbedarea.h - gui/widgets/guitable.cpp - gui/widgets/guitable.h - gui/models/tablemodel.cpp - gui/models/tablemodel.h - gui/models/targettypemodel.h - gui/models/touchactionmodel.cpp - gui/models/touchactionmodel.h - gui/models/typelistmodel.h - gui/models/updatetypemodel.h - gui/models/updatelistmodel.h - gui/models/worldlistmodel.h - gui/models/themesmodel.h - gui/widgets/tabstrip.cpp - gui/widgets/tabstrip.h - gui/widgets/textbox.cpp - gui/widgets/textbox.h - gui/widgets/textfield.cpp - gui/widgets/textfield.h - gui/widgets/textpreview.cpp - gui/widgets/textpreview.h - gui/widgets/tabs/chat/tradetab.cpp - gui/widgets/tabs/chat/tradetab.h - gui/widgets/vertcontainer.cpp - gui/widgets/vertcontainer.h - gui/widgets/tabs/chat/whispertab.cpp - gui/widgets/tabs/chat/whispertab.h - gui/widgets/widget2.h - gui/widgets/widgetgroup.cpp - gui/widgets/widgetgroup.h - gui/widgets/window.cpp - gui/widgets/window.h - gui/widgets/windowcontainer.cpp - gui/widgets/windowcontainer.h - gui/popups/beingpopup.cpp - gui/popups/beingpopup.h - gui/windows/buydialog.cpp - gui/windows/buydialog.h - gui/windows/buyselldialog.cpp - gui/windows/buyselldialog.h - gui/windows/changeemaildialog.cpp - gui/windows/changeemaildialog.h - gui/windows/changepassworddialog.cpp - gui/windows/changepassworddialog.h - gui/windows/charselectdialog.cpp - gui/windows/charselectdialog.h - gui/windows/charcreatedialog.cpp - gui/windows/charcreatedialog.h - gui/windows/chardeleteconfirm.h - gui/windows/chatwindow.cpp - gui/windows/chatwindow.h - gui/windows/confirmdialog.cpp - gui/windows/confirmdialog.h - gui/windows/connectiondialog.cpp - gui/windows/connectiondialog.h - gui/windows/cutinwindow.cpp - gui/windows/cutinwindow.h - gui/windows/debugwindow.cpp - gui/windows/debugwindow.h - gui/windows/didyouknowwindow.cpp - gui/windows/didyouknowwindow.h - gui/windows/editdialog.cpp - gui/windows/editdialog.h - gui/windows/editserverdialog.cpp - gui/windows/editserverdialog.h - gui/windows/emotewindow.cpp - gui/windows/emotewindow.h - gui/windows/equipmentwindow.cpp - gui/windows/equipmentwindow.h - gui/focushandler.cpp - gui/focushandler.h - gui/gui.cpp - gui/gui.h - gui/mailmessage.h - gui/mouseoverlink.h - gui/windows/helpwindow.cpp - gui/windows/helpwindow.h - gui/windows/insertcarddialog.cpp - gui/windows/insertcarddialog.h - gui/windows/inventorywindow.cpp - gui/windows/inventorywindow.h - gui/windows/itemamountwindow.cpp - gui/windows/itemamountwindow.h - gui/popups/itempopup.cpp - gui/popups/itempopup.h - gui/popups/spellpopup.cpp - gui/popups/spellpopup.h - gui/popups/statuspopup.cpp - gui/popups/statuspopup.h - gui/popups/textboxpopup.cpp - gui/popups/textboxpopup.h - gui/windows/killstats.cpp - gui/windows/killstats.h - gui/windows/logindialog.cpp - gui/windows/logindialog.h - gui/windows/minimap.cpp - gui/windows/minimap.h - gui/windows/ministatuswindow.cpp - gui/windows/ministatuswindow.h - gui/windows/npcdialog.cpp - gui/windows/npcdialog.h - gui/windows/npcselldialog.cpp - gui/windows/npcselldialog.h - gui/windows/okdialog.cpp - gui/windows/okdialog.h - gui/windows/outfitwindow.cpp - gui/windows/outfitwindow.h - gui/windows/textcommandeditor.cpp - gui/windows/textcommandeditor.h - gui/onlineplayer.h - gui/palette.cpp - gui/palette.h - gui/popupmanager.cpp - gui/popupmanager.h - gui/popups/popupmenu.cpp - gui/popups/popupmenu.h - gui/popups/skillpopup.cpp - gui/popups/skillpopup.h - gui/windows/questswindow.cpp - gui/windows/questswindow.h - gui/windows/quitdialog.cpp - gui/windows/quitdialog.h - gui/windows/registerdialog.cpp - gui/windows/registerdialog.h - gui/sdlinput.cpp - gui/sdlinput.h - gui/widgets/selldialog.cpp - gui/widgets/selldialog.h - gui/windows/serverdialog.cpp - gui/windows/serverdialog.h - gui/windows/serverinfowindow.cpp - gui/windows/serverinfowindow.h - gui/windows/setupwindow.cpp - gui/windows/setupwindow.h - gui/widgets/tabs/setup_audio.cpp - gui/widgets/tabs/setup_audio.h - gui/widgets/tabs/setup_colors.cpp - gui/widgets/tabs/setup_colors.h - gui/widgets/tabs/setup_joystick.cpp - gui/widgets/tabs/setup_joystick.h - gui/widgets/tabs/setup_misc.cpp - gui/widgets/tabs/setup_misc.h - gui/widgets/tabs/setup_mods.cpp - gui/widgets/tabs/setup_mods.h - gui/widgets/tabs/setup_theme.cpp - gui/widgets/tabs/setup_theme.h - gui/widgets/tabs/setup_touch.cpp - gui/widgets/tabs/setup_touch.h - gui/widgets/tabs/setup_chat.cpp - gui/widgets/tabs/setup_chat.h - gui/widgets/tabs/setup_input.cpp - gui/widgets/tabs/setup_input.h - gui/widgets/tabs/setup_perfomance.cpp - gui/widgets/tabs/setup_perfomance.h - gui/widgets/tabs/setup_relations.cpp - gui/widgets/tabs/setup_relations.h - gui/widgets/tabs/setup_players.cpp - gui/widgets/tabs/setup_players.h - gui/widgets/tabs/setup_quick.cpp - gui/widgets/tabs/setup_quick.h - gui/widgets/tabs/setup_video.cpp - gui/widgets/tabs/setup_video.h - gui/widgets/tabs/setup_visual.cpp - gui/widgets/tabs/setup_visual.h - gui/setupactiondata.h - gui/setupinputpages.cpp - gui/setupinputpages.h - input/pages/basic.cpp - input/pages/basic.h - input/pages/chat.cpp - input/pages/chat.h - input/pages/craft.cpp - input/pages/craft.h - input/pages/emotes.cpp - input/pages/emotes.h - input/pages/gui.cpp - input/pages/gui.h - input/pages/move.cpp - input/pages/move.h - input/pages/other.cpp - input/pages/other.h - input/pages/outfits.cpp - input/pages/outfits.h - input/pages/shortcuts.cpp - input/pages/shortcuts.h - input/pages/windows.cpp - input/pages/windows.h - gui/fonts/font.cpp - gui/fonts/font.h - gui/fonts/textchunk.cpp - gui/fonts/textchunk.h - gui/fonts/textchunklist.cpp - gui/fonts/textchunklist.h - gui/fonts/textchunksmall.cpp - gui/fonts/textchunksmall.h - gui/windows/shopwindow.cpp - gui/windows/shopwindow.h - gui/windows/shortcutwindow.cpp - gui/windows/shortcutwindow.h - gui/windows/skilldialog.cpp - gui/windows/skilldialog.h - gui/windows/socialwindow.cpp - gui/windows/socialwindow.h - gui/popups/speechbubble.cpp - gui/popups/speechbubble.h - gui/windows/statuswindow.cpp - gui/windows/statuswindow.h - gui/windows/textdialog.cpp - gui/windows/textdialog.h - gui/windows/textselectdialog.cpp - gui/windows/textselectdialog.h - gui/popups/textpopup.cpp - gui/popups/textpopup.h - gui/skin.cpp - gui/skin.h - gui/theme.cpp - gui/theme.h - gui/themecolorsidoperators.cpp - gui/themecolorsidoperators.h - gui/themeinfo.h - gui/touchactiondata.cpp - gui/touchactiondata.h - gui/windows/tradewindow.cpp - gui/windows/tradewindow.h - gui/windows/updaterwindow.cpp - gui/windows/updaterwindow.h - gui/userpalette.cpp - gui/userpalette.h - progs/manaplus/gui/viewport.cpp - progs/manaplus/gui/viewport.h - gui/viewport.h - gui/windowmanager.cpp - gui/windowmanager.h - gui/windows/whoisonline.cpp - gui/windows/whoisonline.h - gui/windowmenu.cpp - gui/windowmenu.h - gui/windows/worldselectdialog.cpp - gui/windows/worldselectdialog.h - net/adminhandler.h - net/character.h - net/characters.h - net/charserverhandler.cpp - net/charserverhandler.h - net/chathandler.h - net/download.cpp - net/download.h - enums/net/auctionsearchtype.h - enums/net/battlegroundtype.h - enums/net/deleteitemreason.h - enums/net/downloadstatus.h - enums/net/mailmessagetype.h - enums/net/mailopentype.h - enums/net/npcaction.h - enums/net/packettype.h - net/gamehandler.h - net/generalhandler.h - net/guildhandler.h - net/inventoryhandler.h - net/ipc.cpp - net/ipc.h - net/ea/inventoryitem.h - net/logindata.h - net/loginhandler.h - net/messagein.cpp - net/messagein.h - net/messageout.cpp - net/messageout.h - net/npchandler.h - net/net.cpp - net/net.h - const/net/inventory.h - const/net/maxpacketversion.h - const/net/net.h - const/net/nostat.h - net/partyhandler.h - enums/net/partyshare.h - enums/net/serverfreetype.h - enums/net/servertype.h - enums/net/storesearchtype.h - net/pethandler.h - net/playerhandler.h - net/sdltcpnet.cpp - net/sdltcpnet.h - net/serverfeatures.h - net/serverinfo.h - net/serverurlinfo.h - net/skillhandler.h - net/tradehandler.h - net/updatetypeoperators.cpp - net/updatetypeoperators.h - enums/net/updatetype.h - net/uploadcharinfo.h - net/useragent.cpp - net/useragent.h - net/worldinfo.h - net/packetcounters.cpp - net/packetcounters.h - net/packetfunction.h - net/packetinfo.h - net/packetlimiter.cpp - net/packetlimiter.h - net/protocoloutdefine.h - net/protocoloutinclude.h - net/protocoloutupdate.h - net/recvpacketdefine.h - resources/action.cpp - resources/action.h - resources/ambientlayer.cpp - resources/ambientlayer.h - resources/animation/animation.cpp - resources/animation/animation.h - resources/atlas/atlasitem.h - resources/atlas/atlasmanager.cpp - resources/atlas/atlasmanager.h - resources/atlas/atlasresource.cpp - resources/atlas/atlasresource.h - resources/rect/doublerect.h - resources/attack.h - resources/db/avatardb.cpp - resources/db/avatardb.h - resources/db/badgesdb.cpp - resources/db/badgesdb.h - resources/beingcommon.cpp - resources/beingcommon.h - resources/beinginfo.cpp - resources/beinginfo.h - resources/beingmenuitem.h - resources/beingslot.cpp - resources/beingslot.h - resources/chatobject.cpp - resources/chatobject.h - resources/db/chardb.cpp - resources/db/chardb.h - resources/db/colordb.cpp - resources/db/colordb.h - resources/db/commandsdb.cpp - resources/db/commandsdb.h - resources/cursors.cpp - resources/cursors.h - resources/dbmanager.cpp - resources/dbmanager.h - resources/delayedmanager.cpp - resources/delayedmanager.h - resources/db/deaddb.cpp - resources/db/deaddb.h - resources/db/elementaldb.cpp - resources/db/elementaldb.h - resources/dye/dye.cpp - resources/dye/dye.h - resources/dye/dyecolor.h - resources/dye/dyepalette.cpp - resources/dye/dyepalette.h - resources/dye/dyepalette_replaceacolor.cpp - resources/dye/dyepalette_replaceaoglcolor.cpp - resources/dye/dyepalette_replacescolor.cpp - resources/dye/dyepalette_replacesoglcolor.cpp - resources/dye/dyepaletteptr.h - resources/effectdescription.h - resources/emoteinfo.h - resources/emotesprite.h - resources/equipmentslots.h - resources/db/emotedb.cpp - resources/db/emotedb.h - resources/db/groupdb.cpp - resources/db/groupdb.h - resources/db/homunculusdb.cpp - resources/db/homunculusdb.h - resources/db/horsedb.cpp - resources/db/horsedb.h - resources/fboinfo.h - resources/frame.h - resources/groupinfo.cpp - resources/groupinfo.h - resources/horseinfo.h - resources/horseoffset.h - resources/image/image.cpp - resources/image/image.h - resources/imagehelper.cpp - resources/imagehelper.h - resources/imagerect.h - resources/imageset.h - resources/imageset.cpp - resources/itemcolordata.h - resources/db/itemdb.cpp - resources/db/itemdb.h - resources/basicstat.h - resources/db/itemfielddb.cpp - resources/db/itemfielddb.h - resources/db/itemoptiondb.cpp - resources/db/itemoptiondb.h - resources/db/languagedb.cpp - resources/db/languagedb.h - resources/iteminfo.h - resources/iteminfo.cpp - resources/itemmenuitem.h - enums/resources/cursor.h - enums/resources/displaytype.h - enums/resources/frametype.h - enums/resources/imageposition.h - enums/resources/imagetype.h - enums/resources/mailqueuetype.h - enums/resources/map/maplayertype.h - enums/resources/item/itemdbtype.h - enums/resources/item/itemsoundevent.h - enums/resources/item/itemtype.h - resources/itemtypemap.h - resources/itemtypemapdata.h - resources/mailqueue.h - resources/db/mapdb.cpp - resources/db/mapdb.h - resources/db/mercenarydb.cpp - resources/db/mercenarydb.h - resources/db/moddb.cpp - resources/db/moddb.h - resources/mapinfo.h - enums/resources/map/mapitemtype.h - enums/resources/map/maplayerposition.h - resources/mapreader.cpp - resources/mapreader.h - resources/memorycounter.cpp - resources/memorycounter.h - resources/memorymanager.cpp - resources/memorymanager.h - resources/missileinfo.h - resources/mobileopenglscreenshothelper.cpp - resources/mobileopenglscreenshothelper.h - resources/modinfo.cpp - resources/modinfo.h - resources/mstack.h - resources/notificationinfo.h - resources/notifications.h - resources/npcbuttoninfo.h - resources/npcdialoginfo.h - resources/npcdialogmenuinfo.h - resources/npcimageinfo.h - resources/npcinventoryinfo.h - resources/npctextinfo.h - enums/resources/notifyflags.h - enums/resources/notifytypes.h - resources/db/monsterdb.cpp - resources/db/monsterdb.h - resources/db/networkdb.cpp - resources/db/networkdb.h - resources/db/npcdb.cpp - resources/db/npcdb.h - resources/db/npcdialogdb.cpp - resources/db/npcdialogdb.h - resources/openglimagehelper.cpp - resources/openglimagehelper.h - resources/openglscreenshothelper.cpp - resources/openglscreenshothelper.h - resources/questeffect.h - resources/questitem.h - resources/questitemtext.h - resources/questvar.h - enums/resources/questtype.h - enums/resources/servercommandenable.h - enums/resources/servercommandtype.h - enums/resources/serverpermissiontype.h - resources/db/palettedb.cpp - resources/db/palettedb.h - resources/db/petdb.cpp - resources/db/petdb.h - resources/db/questdb.cpp - resources/db/questdb.h - resources/db/skillunitdb.cpp - resources/db/skillunitdb.h - resources/resource.cpp - resources/resource.h - resources/resourcefunctiontypes.h - resources/resourcetypes.h - resources/loaders/atlasloader.cpp - resources/loaders/atlasloader.h - resources/loaders/emptyatlasloader.cpp - resources/loaders/emptyatlasloader.h - resources/loaders/imageloader.cpp - resources/loaders/imageloader.h - resources/loaders/imagesetloader.cpp - resources/loaders/imagesetloader.h - resources/loaders/musicloader.cpp - resources/loaders/musicloader.h - resources/loaders/rescaledloader.cpp - resources/loaders/rescaledloader.h - resources/loaders/shaderloader.cpp - resources/loaders/shaderloader.h - resources/loaders/shaderprogramloader.cpp - resources/loaders/shaderprogramloader.h - resources/loaders/soundloader.cpp - resources/loaders/soundloader.h - resources/loaders/spritedefloader.cpp - resources/loaders/spritedefloader.h - resources/loaders/subimageloader.cpp - resources/loaders/subimageloader.h - resources/loaders/subimagesetloader.cpp - resources/loaders/subimagesetloader.h - resources/loaders/walklayerloader.cpp - resources/loaders/walklayerloader.h - resources/loaders/xmlloader.cpp - resources/loaders/xmlloader.h - resources/resourcemanager/resourcemanager.cpp - resources/resourcemanager/resourcemanager.h - resources/safeopenglimagehelper.cpp - resources/safeopenglimagehelper.h - resources/screenshothelper.h - resources/sdl2imagehelper.cpp - resources/sdl2imagehelper.h - resources/sdl2softwareimagehelper.cpp - resources/sdl2softwareimagehelper.h - resources/sdl2softwarescreenshothelper.cpp - resources/sdl2softwarescreenshothelper.h - resources/sdlgfxblitfunc.cpp - resources/sdlgfxblitfunc.h - resources/sdlimagehelper.cpp - resources/sdlimagehelper.h - resources/sdlmusic.cpp - resources/sdlmusic.h - resources/sdlscreenshothelper.cpp - resources/sdlscreenshothelper.h - resources/skill/skilltypeentry.h - resources/skill/skilltypelist.h - const/net/skill.h - const/resources/currency.h - const/resources/skill.h - enums/resources/skill/skillowner.h - enums/resources/skill/skillsettype.h - enums/resources/skill/skilltype.h - enums/resources/skill/skilltype2.h - resources/db/sounddb.cpp - resources/db/sounddb.h - resources/db/statdb.cpp - resources/db/statdb.h - resources/db/statuseffectdb.cpp - resources/db/statuseffectdb.h - resources/db/textdb.cpp - resources/db/textdb.h - resources/db/unitsdb.cpp - resources/db/unitsdb.h - resources/db/weaponsdb.cpp - resources/db/weaponsdb.h - resources/servercommands.inc - resources/serverpermissions.inc - resources/soundeffect.cpp - resources/soundeffect.h - resources/soundinfo.h - const/resources/spriteaction.h - resources/sprite/spritedef.h - resources/sprite/spritedef.cpp - enums/resources/spritedirection.h - resources/sprite/spritedisplay.h - resources/sprite/spritereference.h - resources/image/subimage.cpp - resources/image/subimage.h - resources/surfaceimagehelper.cpp - resources/surfaceimagehelper.h - resources/atlas/textureatlas.h - resources/updatefile.h - resources/wallpaper.cpp - resources/wallpaper.h - resources/wallpaperdata.h - utils/translation/podict.cpp - utils/translation/podict.h - utils/translation/poparser.cpp - utils/translation/poparser.h - utils/translation/translationmanager.cpp - utils/translation/translationmanager.h - utils/base64.cpp - utils/base64.h - utils/booleanoptions.h - utils/browserboxtools.cpp - utils/browserboxtools.h - utils/buildhex.h - utils/cast.h - utils/chatutils.cpp - utils/chatutils.h - utils/checkutils.cpp - utils/checkutils.h - utils/copynpaste.cpp - utils/copynpaste.h - utils/cpu.cpp - utils/cpu.h - utils/delete2.h - utils/dtor.h - utils/dumplibs.cpp - utils/dumplibs.h - utils/dumpsizes.cpp - utils/dumpsizes.h - utils/env.cpp - utils/env.h - utils/foreach.h - fs/files.cpp - fs/files.h - utils/fuzzer.cpp - utils/fuzzer.h - utils/gettext.h - utils/gettexthelper.cpp - utils/gettexthelper.h - utils/glxhelper.cpp - utils/glxhelper.h - utils/gmfunctions.cpp - utils/gmfunctions.h - utils/intmap.h - utils/langs.cpp - utils/langs.h - utils/likely.h - utils/mathutils.h - utils/parameters.cpp - utils/parameters.h - fs/paths.cpp - fs/paths.h - utils/perfomance.cpp - utils/perfomance.h - utils/pnglib.cpp - utils/pnglib.h - fs/virtfs/fsfuncs.h - fs/virtfs/rwops.cpp - fs/virtfs/rwops.h - fs/virtfs/tools.cpp - fs/virtfs/tools.h - fs/virtfs/list.cpp - fs/virtfs/list.h - fs/virtfs/fs.cpp - fs/virtfs/fs.h - fs/virtfs/rwopstypes.h - fs/virtfs/direntry.cpp - fs/virtfs/direntry.h - fs/virtfs/fsdir.cpp - fs/virtfs/fsdir.h - fs/virtfs/fsdirrwops.cpp - fs/virtfs/fsdirrwops.h - fs/virtfs/fsentry.cpp - fs/virtfs/fsentry.h - fs/virtfs/fszip.cpp - fs/virtfs/fszip.h - fs/virtfs/fsziprwops.cpp - fs/virtfs/fsziprwops.h - fs/virtfs/zipentry.cpp - fs/virtfs/zipentry.h - fs/virtfs/zipreader.cpp - fs/virtfs/zipreader.h - fs/virtfs/ziplocalheader.cpp - fs/virtfs/ziplocalheader.h - utils/process.cpp - utils/process.h - utils/sdl2helper.cpp - utils/sdl2helper.h - utils/sdl2logger.cpp - utils/sdl2logger.h - utils/sdlcheckutils.cpp - utils/sdlcheckutils.h - utils/sdlhelper.cpp - utils/sdlhelper.h - utils/sdlmemoryobject.h - utils/stringmap.h - utils/stringutils.cpp - utils/stringutils.h - utils/stringvector.h - utils/timer.cpp - utils/timer.h - utils/vector.h - utils/x11logger.cpp - utils/x11logger.h - fs/virtfs/file.cpp - fs/virtfs/file.h - utils/mutex.h - utils/naclmessages.cpp - utils/naclmessages.h - fs/mkdir.cpp - fs/mkdir.h - utils/mrand.cpp - utils/mrand.h - utils/xml.h - utils/xml.inc - utils/xmlutils.cpp - utils/xmlutils.h - utils/xmlwriter.h - utils/xml/libxml.cpp - utils/xml/libxml.h - utils/xml/libxml.inc - test/testlauncher.cpp - test/testlauncher.h - test/testmain.cpp - test/testmain.h - actions/actiondef.h - actions/actionfuncptr.h - progs/manaplus/actions/actions.cpp - actions/actions.h - progs/manaplus/actions/chat.cpp - actions/chat.h - progs/manaplus/actions/commands.cpp - actions/commands.h - progs/manaplus/actions/move.cpp - actions/move.h - progs/manaplus/actions/pets.cpp - actions/pets.h - progs/manaplus/actions/statusbar.cpp - actions/statusbar.h - progs/manaplus/actions/tabs.cpp - actions/tabs.h - progs/manaplus/actions/target.cpp - actions/target.h - progs/manaplus/actions/windows.cpp - actions/windows.h - being/actor.cpp - being/actor.h - being/actorsprite.cpp - being/actorsprite.h - enums/being/actortype.h - enums/being/attacktype.h - enums/being/attributes.h - enums/being/attributesstrings.cpp - enums/being/attributesstrings.h - enums/being/badgedrawtype.h - enums/being/badgeindex.h - listeners/actorspritelistener.h - listeners/arrowslistener.cpp - listeners/arrowslistener.h - listeners/assertlistener.cpp - listeners/assertlistener.h - listeners/attributelistener.cpp - listeners/attributelistener.h - listeners/awaylistener.cpp - listeners/awaylistener.h - listeners/baselistener.hpp - listeners/charrenamelistener.cpp - listeners/charrenamelistener.h - actormanager.cpp - actormanager.h - resources/sprite/animatedsprite.cpp - resources/sprite/animatedsprite.h - resources/sprite/animationdelayload.cpp - resources/sprite/animationdelayload.h - particle/animationparticle.cpp - particle/animationparticle.h - avatar.cpp - avatar.h - being/being.cpp - being/being.h - enums/being/beingaction.h - being/beingcacheentry.h - enums/being/beingdirection.h - being/beingflag.h - being/beingspeech.h - being/castingeffect.cpp - being/castingeffect.h - beingequipbackend.cpp - beingequipbackend.h - spellmanager.cpp - spellmanager.h - chatlogger.cpp - chatlogger.h - progs/manaplus/client.cpp - progs/manaplus/client.h - client.h - commandline.cpp - commandline.h - configmanager.cpp - configmanager.h - being/compounditem.h - being/compoundsprite.cpp - being/compoundsprite.h - being/crazymoves.cpp - being/crazymoves.h - enums/being/cookingtype.h - enums/being/gender.h - being/homunculusinfo.h - listeners/configlistener.h - listeners/debugmessagelistener.cpp - listeners/debugmessagelistener.h - configuration.cpp - configuration.h - debug.h - defaults.cpp - defaults.h - dirs.cpp - dirs.h - dragdrop.h - effectmanager.cpp - effectmanager.h - gui/shortcut/emoteshortcut.cpp - gui/shortcut/emoteshortcut.h - const/emoteshortcut.h - equipment.h - eventsmanager.cpp - eventsmanager.h - being/flooritem.cpp - being/flooritem.h - game.cpp - game.h - gamemodifiers.cpp - gamemodifiers.h - const/equipment.h - const/itemshortcut.h - const/spells.h - const/utils/timer.h - const/utils/utf8.h - const/gui/chat.h - const/gui/pages.h - const/gui/theme.h - const/render/graphics.h - render/graphics.cpp - render/graphics.h - graphicsmanager.cpp - graphicsmanager.h - render/vertexes/imagecollection.cpp - render/vertexes/imagecollection.h - render/vertexes/imagevertexes.cpp - render/vertexes/imagevertexes.h - render/vertexes/openglgraphicsvertexes.cpp - render/vertexes/openglgraphicsvertexes.h - guild.cpp - guild.h - enums/commandtarget.h - enums/cutin.h - enums/dragdropsource.h - enums/emotetype.h - enums/equipslot.h - enums/guildpositionflags.h - enums/inventorytype.h - enums/magicschool.h - particle/imageparticle.cpp - particle/imageparticle.h - resources/sprite/imagesprite.cpp - resources/sprite/imagesprite.h - resources/inventory/complexinventory.cpp - resources/inventory/complexinventory.h - resources/inventory/inventory.cpp - resources/inventory/inventory.h - resources/item/cardslist.cpp - resources/item/cardslist.h - resources/item/complexitem.cpp - resources/item/complexitem.h - resources/item/item.cpp - resources/item/item.h - resources/item/itemfieldtype.h - resources/item/itemoption.h - resources/item/itemoptionslist.h - itemcolormanager.cpp - itemcolormanager.h - gui/shortcut/itemshortcut.cpp - gui/shortcut/itemshortcut.h - itemsoundmanager.cpp - itemsoundmanager.h - gui/shortcut/dropshortcut.cpp - gui/shortcut/dropshortcut.h - gui/shortcut/spellshortcut.cpp - gui/shortcut/spellshortcut.h - textcommand.cpp - textcommand.h - enums/input/inputaction.h - enums/input/inputgroup.h - input/inputactiondata.h - input/inputactionmap.h - input/inputactionoperators.cpp - input/inputactionoperators.h - input/inputactionsortfunctor.h - enums/input/inputcondition.h - input/inputfunction.h - input/inputitem.h - input/inputmanager.cpp - input/inputmanager.h - enums/input/inputtype.h - enums/input/keyboardfocus.h - enums/input/keyvalue.h - events/inputevent.h - input/joystick.cpp - input/joystick.h - input/keyboardconfig.cpp - input/keyboardconfig.h - input/keyinput.h - input/touch/multitouchmanager.cpp - input/touch/multitouchmanager.h - localconsts.h - being/localplayer.cpp - being/localplayer.h - being/mercenaryinfo.h - being/petinfo.h - enums/being/pickup.h - logger.cpp - logger.h - main.cpp - main.h - maingui.cpp - maingui.h - enums/resources/map/blockmask.h - enums/resources/map/blocktype.h - enums/resources/map/collisiontype.h - enums/resources/skill/casttype.h - resources/map/location.h - resources/map/map.cpp - resources/map/map.h - const/resources/item/cards.h - const/resources/item/itemoptions.h - const/resources/map/map.h - resources/map/mapheights.cpp - resources/map/mapheights.h - resources/map/mapitem.cpp - resources/map/mapitem.h - resources/map/maplayer.cpp - resources/map/maplayer.h - resources/map/mapobject.h - resources/map/mapobjectlist.h - resources/map/maprowvertexes.h - enums/resources/map/maptype.h - resources/map/metatile.h - resources/map/objectslayer.cpp - resources/map/objectslayer.h - render/opengl/mgl.cpp - render/opengl/mgl.h - render/opengl/mgl.hpp - render/opengl/mglcheck.h - render/opengl/mgldefines.h - render/opengl/mglemu.cpp - render/opengl/mglemu.h - render/opengl/mglfunctions.h - render/opengl/mgltypes.h - render/openglx/mglx.cpp - render/openglx/mglx.h - render/openglx/mglx.hpp - render/openglx/mglxinit.cpp - render/openglx/mglxinit.h - render/openglx/mglxtypes.h - render/mobileopengl2graphics.cpp - render/mobileopengl2graphics.h - render/mobileopenglgraphics.cpp - render/mobileopenglgraphics.h - render/modernopenglgraphics.cpp - render/modernopenglgraphics.h - render/nacl/naclfunctions.h - render/nacl/naclgles.cpp - render/nacl/naclgles.h - input/mouseinput.h - mumblemanager.cpp - mumblemanager.h - navigationmanager.cpp - navigationmanager.h - render/opengl/naclglfunctions.h - render/normalopenglgraphics.cpp - render/normalopenglgraphics.h - notifymanager.cpp - notifymanager.h - options.h - render/graphicsdef.hpp - render/imagegraphics.cpp - render/imagegraphics.h - render/graphics_calcImageRect.hpp - render/graphics_drawImageRect.hpp - render/nullopenglgraphics.cpp - render/nullopenglgraphics.h - render/opengl/opengldebug.h - render/openglgraphicsdef.hpp - render/openglgraphicsdef1.hpp - render/openglgraphicsdefadvanced.hpp - render/renderers.cpp - render/renderers.h - render/rendererslistsdl.h - render/rendererslistsdl2.h - enums/particle/alivestatus.h - enums/particle/particlechangefunc.h - enums/particle/particlephysics.h - enums/particle/particletype.h - enums/render/rendertype.h - particle/particle.cpp - particle/particle.h - particle/particlecontainer.cpp - particle/particlecontainer.h - particle/particleemitter.cpp - particle/particleemitter.h - particle/particleemitterprop.h - particle/particleengine.cpp - particle/particleengine.h - particle/particleinfo.h - particle/particlelist.cpp - particle/particlelist.h - particle/particletimer.h - particle/particlevector.cpp - particle/particlevector.h - party.cpp - party.h - being/playerignorestrategy.h - being/playerinfo.cpp - being/playerinfo.h - being/playerrelation.cpp - being/playerrelation.h - being/playerrelations.cpp - being/playerrelations.h - enums/being/rank.h - enums/being/reachable.h - enums/being/relation.h - enums/being/targetcursorsize.h - enums/being/targetcursortype.h - enums/being/visiblename.h - enums/being/visiblenamepos.h - listeners/playerrelationslistener.h - listeners/renamelistener.cpp - listeners/renamelistener.h - listeners/requestadoptchildlistener.h - listeners/requesttradelistener.h - position.cpp - position.h - resources/map/properties.h - resources/map/speciallayer.cpp - resources/map/speciallayer.h - resources/map/tileanimation.cpp - resources/map/tileanimation.h - particle/rotationalparticle.cpp - particle/rotationalparticle.h - render/safeopenglgraphics.cpp - render/safeopenglgraphics.h - render/sdl2graphics.cpp - render/sdl2graphics.h - render/sdl2softwaregraphics.cpp - render/sdl2softwaregraphics.h - render/sdlgraphics.cpp - render/sdlgraphics.h - render/softwaregraphicsdef.hpp - sdlshared.h - settings.cpp - settings.h - resources/item/shopitem.cpp - resources/item/shopitem.h - gui/shortcut/shortcutbase.cpp - gui/shortcut/shortcutbase.h - resources/animation/simpleanimation.cpp - resources/animation/simpleanimation.h - const/sound.h - soundmanager.cpp - soundmanager.h - resources/sprite/sprite.h - enums/screendensity.h - enums/state.h - enums/textcommandtype.h - enums/simpletypes/advanced.h - enums/simpletypes/allowquit.h - enums/simpletypes/allowsort.h - enums/simpletypes/allplayers.h - enums/simpletypes/append.h - enums/simpletypes/autorelease.h - enums/simpletypes/autotarget.h - enums/simpletypes/beingid.h - enums/simpletypes/beingtypeid.h - enums/simpletypes/booldefines.h - enums/simpletypes/damaged.h - enums/simpletypes/donotalign.h - enums/simpletypes/enable.h - enums/simpletypes/enumdefines.h - enums/simpletypes/equipm.h - enums/simpletypes/equipped.h - enums/simpletypes/favorite.h - enums/simpletypes/forcedisplay.h - enums/simpletypes/forcequantity.h - enums/simpletypes/identified.h - enums/simpletypes/ignorerecord.h - enums/simpletypes/intdefines.h - enums/simpletypes/issell.h - enums/simpletypes/isstart.h - enums/simpletypes/itemcolor.h - enums/simpletypes/keep.h - enums/simpletypes/losefocusontab.h - enums/simpletypes/mainconfig.h - enums/simpletypes/modal.h - enums/simpletypes/modifiable.h - enums/simpletypes/move.h - enums/simpletypes/notify.h - enums/simpletypes/npcnames.h - enums/simpletypes/online.h - enums/simpletypes/onthefly.h - enums/simpletypes/opaque.h - enums/simpletypes/protected.h - enums/simpletypes/separator.h - enums/simpletypes/sfx.h - enums/simpletypes/showcenter.h - enums/simpletypes/showemptyrows.h - enums/simpletypes/skiperror.h - enums/simpletypes/speech.h - enums/simpletypes/stringdefines.h - enums/simpletypes/stringdefines2.h - enums/simpletypes/trading.h - enums/simpletypes/tryremovecolors.h - enums/simpletypes/useargs.h - enums/simpletypes/usebase64.h - enums/simpletypes/usevirtfs.h - enums/simpletypes/visible.h - statuseffect.cpp - statuseffect.h - render/surfacegraphics.cpp - render/surfacegraphics.h - render/shaders/shader.cpp - render/shaders/shader.h - render/shaders/shaderprogram.cpp - render/shaders/shaderprogram.h - render/shaders/shadersmanager.cpp - render/shaders/shadersmanager.h - text.cpp - text.h - textmanager.cpp - textmanager.h - particle/textparticle.cpp - particle/textparticle.h - resources/map/tileinfo.h - resources/map/tileset.h - input/touch/touchactions.cpp - input/touch/touchactions.h - input/touch/touchmanager.cpp - input/touch/touchmanager.h - variabledata.h - vector.cpp - vector.h - resources/map/walklayer.cpp - resources/map/walklayer.h - events/actionevent.h - listeners/actionlistener.h - gui/widgets/basiccontainer.h - gui/browserlink.h - gui/buttoninfo.h - gui/buttontext.h - const/gui/chat.h - gui/chatlog.h - enums/gui/chatmsgtype.h - enums/gui/chattabtype.h - enums/gui/colorname.h - gui/cliprect.h - gui/color.h - gui/colorpair.h - enums/gui/dialogtype.h - enums/gui/gradienttype.h - enums/gui/itemamountwindowusage.h - enums/gui/orientation.h - enums/gui/progresscolorid.h - enums/gui/serverdialogdonwloadstatus.h - enums/gui/shoplistboxtype.h - enums/gui/slidergrid.h - enums/gui/themecolorid.h - enums/gui/updatedownloadstatus.h - enums/gui/usercolorid.h - listeners/errorlistener.cpp - listeners/errorlistener.h - listeners/widgetdeathlistener.h - events/event.h - listeners/focuslistener.h - listeners/gamemodifierlistener.cpp - listeners/gamemodifierlistener.h - listeners/guiconfiglistener.h - listeners/guitableactionlistener.cpp - listeners/guitableactionlistener.h - listeners/inputactionremotelistener.cpp - listeners/inputactionremotelistener.h - listeners/inputactionreplaylistener.cpp - listeners/inputactionreplaylistener.h - listeners/insertcardlistener.h - listeners/inventorylistener.h - events/inputguievent.h - input/key.h - events/keyevent.h - enums/events/keyeventtype.h - listeners/keylistener.h - gui/models/listmodel.h - gui/models/magicschoolmodel.h - events/mouseevent.h - enums/events/mousebutton.h - enums/events/mouseeventtype.h - listeners/mouselistener.h - listeners/openurllistener.h - listeners/playerdeathlistener.cpp - listeners/playerdeathlistener.h - listeners/playerpostdeathlistener.h - listeners/playerlistener.cpp - listeners/playerlistener.h - gui/rect.h - events/selectionevent.h - listeners/selectionlistener.h - listeners/statlistener.cpp - listeners/statlistener.h - listeners/tablemodellistener.h - listeners/textskilllistener.cpp - listeners/textskilllistener.h - listeners/tooltiplistener.cpp - listeners/tooltiplistener.h - listeners/updatestatuslistener.cpp - listeners/updatestatuslistener.h - listeners/uploadlistener.cpp - listeners/uploadlistener.h - utils/sdlpixel.h - utils/sdlsharedhelper.cpp - utils/sdlsharedhelper.h - utils/stdmove.h - gui/widgets/widget.h - listeners/weightlistener.h - listeners/widgetlistener.h - listeners/wrongdatanoticelistener.cpp - listeners/wrongdatanoticelistener.h - gui/widgets/basiccontainer2.h - gui/widgets/basiccontainer.cpp - gui/dialogsmanager.cpp - gui/dialogsmanager.h - input/key.cpp - gui/widgets/widget.cpp - gui/widgets/basiccontainer2.cpp - gui/windows/bankwindow.cpp - gui/windows/bankwindow.h - gui/windows/buyingstoreselldialog.cpp - gui/windows/buyingstoreselldialog.h - gui/windows/eggselectiondialog.cpp - gui/windows/eggselectiondialog.h - gui/windows/maileditwindow.cpp - gui/windows/maileditwindow.h - gui/windows/mailviewwindow.cpp - gui/windows/mailviewwindow.h - gui/windows/mailwindow.cpp - gui/windows/mailwindow.h - listeners/banklistener.cpp - listeners/banklistener.h - listeners/buyingstoremodelistener.cpp - listeners/buyingstoremodelistener.h - listeners/buyingstoreslotslistener.cpp - listeners/buyingstoreslotslistener.h - listeners/pincodelistener.cpp - listeners/pincodelistener.h - listeners/shoprenamelistener.cpp - listeners/shoprenamelistener.h - listeners/skillwarplistener.cpp - listeners/skillwarplistener.h - listeners/vendingmodelistener.cpp - listeners/vendingmodelistener.h - listeners/vendingslotslistener.cpp - listeners/vendingslotslistener.h - net/auctionhandler.h - net/bankhandler.h - net/battlegroundhandler.h - net/buyingstorehandler.h - net/cashshophandler.h - net/elementalhandler.h - net/familyhandler.h - net/friendshandler.h - net/homunculushandler.h - net/hostsgroup.h - net/mailhandler.h - net/mail2handler.h - net/maphandler.h - net/markethandler.h - net/mercenaryhandler.h - net/roulettehandler.h - net/searchstorehandler.h - net/vendinghandler.h - net/eathena/adminrecv.cpp - net/eathena/adminrecv.h - net/eathena/adminhandler.cpp - net/eathena/adminhandler.h - net/eathena/auctionrecv.cpp - net/eathena/auctionrecv.h - net/eathena/auctionhandler.cpp - net/eathena/auctionhandler.h - net/eathena/bankrecv.cpp - net/eathena/bankrecv.h - net/eathena/bankhandler.cpp - net/eathena/bankhandler.h - net/eathena/battlegroundrecv.cpp - net/eathena/battlegroundrecv.h - net/eathena/battlegroundhandler.cpp - net/eathena/battlegroundhandler.h - net/eathena/cashshophandler.cpp - net/eathena/cashshophandler.h - net/eathena/cashshoprecv.cpp - net/eathena/cashshoprecv.h - net/eathena/beingrecv.cpp - net/eathena/beingrecv.h - net/eathena/beinghandler.cpp - net/eathena/beinghandler.h - net/eathena/buyingstorehandler.cpp - net/eathena/buyingstorehandler.h - net/eathena/buyingstorerecv.cpp - net/eathena/buyingstorerecv.h - enums/net/beingtype.h - net/eathena/buysellhandler.cpp - net/eathena/buysellhandler.h - net/eathena/buysellrecv.cpp - net/eathena/buysellrecv.h - net/eathena/charserverhandler.cpp - net/eathena/charserverhandler.h - net/eathena/charserverrecv.cpp - net/eathena/charserverrecv.h - net/eathena/chathandler.cpp - net/eathena/chathandler.h - net/eathena/chatrecv.cpp - net/eathena/chatrecv.h - net/eathena/elementalhandler.cpp - net/eathena/elementalhandler.h - net/eathena/elementalrecv.cpp - net/eathena/elementalrecv.h - net/eathena/familyhandler.cpp - net/eathena/familyhandler.h - net/eathena/familyrecv.cpp - net/eathena/familyrecv.h - net/eathena/friendshandler.cpp - net/eathena/friendshandler.h - net/eathena/friendsrecv.cpp - net/eathena/friendsrecv.h - net/eathena/gamehandler.cpp - net/eathena/gamehandler.h - net/eathena/gamerecv.cpp - net/eathena/gamerecv.h - net/eathena/generalhandler.cpp - net/eathena/generalhandler.h - net/eathena/generalrecv.cpp - net/eathena/generalrecv.h - net/eathena/guildhandler.cpp - net/eathena/guildhandler.h - net/eathena/guildrecv.cpp - net/eathena/guildrecv.h - net/eathena/homunculushandler.cpp - net/eathena/homunculushandler.h - net/eathena/homunculusrecv.cpp - net/eathena/homunculusrecv.h - net/eathena/inventoryhandler.cpp - net/eathena/inventoryhandler.h - net/eathena/inventoryrecv.cpp - net/eathena/inventoryrecv.h - net/eathena/itemflags.h - net/eathena/itemhandler.cpp - net/eathena/itemhandler.h - net/eathena/itemrecv.cpp - net/eathena/itemrecv.h - net/eathena/loginhandler.cpp - net/eathena/loginhandler.h - net/eathena/loginrecv.cpp - net/eathena/loginrecv.h - net/eathena/mail2recv.cpp - net/eathena/mail2recv.h - net/eathena/mail2handler.cpp - net/eathena/mail2handler.h - net/eathena/mailhandler.cpp - net/eathena/mailhandler.h - net/eathena/mailrecv.cpp - net/eathena/mailrecv.h - net/eathena/maphandler.cpp - net/eathena/maphandler.h - net/eathena/maprecv.cpp - net/eathena/maprecv.h - net/eathena/maptypeproperty2.h - net/eathena/markethandler.cpp - net/eathena/markethandler.h - net/eathena/marketrecv.cpp - net/eathena/marketrecv.h - net/eathena/menu.cpp - net/eathena/menu.h - enums/net/menutype.h - net/eathena/mercenaryhandler.cpp - net/eathena/mercenaryhandler.h - net/eathena/mercenaryrecv.cpp - net/eathena/mercenaryrecv.h - net/eathena/messagein.cpp - net/eathena/messagein.h - net/eathena/messageout.cpp - net/eathena/messageout.h - net/eathena/network.cpp - net/eathena/network.h - net/eathena/npchandler.cpp - net/eathena/npchandler.h - net/eathena/npcrecv.cpp - net/eathena/npcrecv.h - net/eathena/packetsin.inc - net/eathena/packetsout.inc - net/eathena/partyhandler.cpp - net/eathena/partyhandler.h - net/eathena/partyrecv.cpp - net/eathena/partyrecv.h - net/eathena/pethandler.cpp - net/eathena/pethandler.h - net/eathena/petrecv.cpp - net/eathena/petrecv.h - net/eathena/playerhandler.cpp - net/eathena/playerhandler.h - net/eathena/playerrecv.cpp - net/eathena/playerrecv.h - net/eathena/protocolout.cpp - net/eathena/protocolout.h - net/eathena/questhandler.cpp - net/eathena/questhandler.h - net/eathena/questrecv.cpp - net/eathena/questrecv.h - net/eathena/recvpackets.inc - net/eathena/roulettehandler.cpp - net/eathena/roulettehandler.h - net/eathena/rouletterecv.cpp - net/eathena/rouletterecv.h - net/eathena/searchstorehandler.cpp - net/eathena/searchstorehandler.h - net/eathena/searchstorerecv.cpp - net/eathena/searchstorerecv.h - net/eathena/serverfeatures.cpp - net/eathena/serverfeatures.h - net/eathena/skillhandler.cpp - net/eathena/skillhandler.h - net/eathena/skillrecv.cpp - net/eathena/skillrecv.h - net/eathena/sp.h - net/eathena/sprite.h - net/eathena/tradehandler.cpp - net/eathena/tradehandler.h - net/eathena/traderecv.cpp - net/eathena/traderecv.h - net/eathena/updateprotocol.cpp - net/eathena/updateprotocol.h - net/eathena/vendinghandler.cpp - net/eathena/vendinghandler.h - net/eathena/vendingrecv.cpp - net/eathena/vendingrecv.h - ) - -SET(DYE_CMD_SRCS - gui/cliprect.cpp - gui/rect.cpp - events/actionevent.h - gui/cliprect.h - gui/color.h - events/event.h - gui/rect.h - progs/dyecmd/dyemain.cpp - resources/sprite/animatedsprite.cpp - resources/sprite/animatedsprite.h - resources/sprite/animationdelayload.cpp - resources/sprite/animationdelayload.h - configuration.cpp - configuration.h - graphicsmanager.cpp - graphicsmanager.h - render/vertexes/imagecollection.cpp - render/vertexes/imagecollection.h - render/vertexes/imagevertexes.cpp - render/vertexes/imagevertexes.h - render/vertexes/openglgraphicsvertexes.cpp - render/vertexes/openglgraphicsvertexes.h - logger.cpp - logger.h - navigationmanager.cpp - navigationmanager.h - settings.cpp - settings.h - listeners/debugmessagelistener.cpp - listeners/debugmessagelistener.h - resources/map/walklayer.cpp - resources/map/walklayer.h - render/graphics.cpp - render/graphics.h - render/renderers.cpp - render/renderers.h - render/sdl2softwaregraphics.cpp - render/sdl2softwaregraphics.h - render/sdl2graphics.cpp - render/sdl2graphics.h - render/sdlgraphics.cpp - render/sdlgraphics.h - render/softwaregraphicsdef.hpp - render/mgltypes.h - resources/action.cpp - resources/action.h - resources/animation/animation.cpp - resources/animation/animation.h - resources/db/palettedb.cpp - resources/db/palettedb.h - resources/delayedmanager.cpp - resources/delayedmanager.h - resources/dye/dye.cpp - resources/dye/dye.h - resources/dye/dyepalette.cpp - resources/dye/dyepalette.h - resources/effectdescription.h - resources/emoteinfo.h - resources/emotesprite.h - resources/image/image.cpp - resources/image/image.h - resources/imagehelper.cpp - resources/imagehelper.h - resources/imagerect.h - resources/imageset.cpp - resources/imageset.h - resources/itemcolordata.h - resources/resource.cpp - resources/resource.h - resources/resourcefunctiontypes.h - resources/resourcetypes.h - resources/loaders/atlasloader.cpp - resources/loaders/atlasloader.h - resources/loaders/emptyatlasloader.cpp - resources/loaders/emptyatlasloader.h - resources/loaders/imageloader.cpp - resources/loaders/imageloader.h - resources/loaders/imagesetloader.cpp - resources/loaders/imagesetloader.h - resources/loaders/musicloader.cpp - resources/loaders/musicloader.h - resources/loaders/rescaledloader.cpp - resources/loaders/rescaledloader.h - resources/loaders/shaderloader.cpp - resources/loaders/shaderloader.h - resources/loaders/shaderprogramloader.cpp - resources/loaders/shaderprogramloader.h - resources/loaders/spritedefloader.cpp - resources/loaders/spritedefloader.h - resources/loaders/subimageloader.cpp - resources/loaders/subimageloader.h - resources/loaders/subimagesetloader.cpp - resources/loaders/subimagesetloader.h - resources/loaders/walklayerloader.cpp - resources/loaders/walklayerloader.h - resources/resourcemanager/resourcemanager.cpp - resources/resourcemanager/resourcemanager.h - resources/sdl2softwareimagehelper.cpp - resources/sdl2softwareimagehelper.h - resources/sdl2imagehelper.cpp - resources/sdl2imagehelper.h - resources/sdlgfxblitfunc.cpp - resources/sdlgfxblitfunc.h - resources/sdlimagehelper.cpp - resources/sdlimagehelper.h - resources/sdlmusic.cpp - resources/sdlmusic.h - resources/skillconsts.h - resources/servercommands.inc - resources/serverpermissions.inc - resources/soundeffect.cpp - resources/soundeffect.h - resources/image/subimage.cpp - resources/image/subimage.h - resources/surfaceimagehelper.cpp - resources/surfaceimagehelper.h - resources/atlas/textureatlas.h - resources/updatefile.h - resources/sprite/spritedef.cpp - resources/sprite/spritedef.h - resources/sprite/spritedisplay.h - resources/sprite/spritereference.h - fs/files.cpp - fs/files.h - fs/mkdir.cpp - fs/mkdir.h - utils/mrand.cpp - utils/mrand.h - fs/paths.cpp - fs/paths.h - utils/perfomance.cpp - utils/perfomance.h - utils/pnglib.cpp - utils/pnglib.h - fs/virtfs/fsfuncs.h - fs/virtfs/rwops.cpp - fs/virtfs/rwops.h - fs/virtfs/tools.cpp - fs/virtfs/tools.h - fs/virtfs/list.cpp - fs/virtfs/list.h - fs/virtfs/fs.cpp - fs/virtfs/fs.h - fs/virtfs/rwopstypes.h - fs/virtfs/direntry.cpp - fs/virtfs/direntry.h - fs/virtfs/fsdir.cpp - fs/virtfs/fsdir.h - fs/virtfs/fsdirrwops.cpp - fs/virtfs/fsdirrwops.h - fs/virtfs/fsentry.cpp - fs/virtfs/fsentry.h - fs/virtfs/fszip.cpp - fs/virtfs/fszip.h - fs/virtfs/fsziprwops.cpp - fs/virtfs/fsziprwops.h - fs/virtfs/zipentry.cpp - fs/virtfs/zipentry.h - fs/virtfs/zipreader.cpp - fs/virtfs/zipreader.h - fs/virtfs/ziplocalheader.cpp - fs/virtfs/ziplocalheader.h - utils/sdl2helper.cpp - utils/sdl2helper.h - utils/sdl2logger.cpp - utils/sdl2logger.h - utils/sdlcheckutils.cpp - utils/sdlcheckutils.h - utils/sdlhelper.cpp - utils/sdlhelper.h - utils/sdlmemoryobject.h - utils/stringutils.cpp - utils/stringutils.h - utils/timer.cpp - utils/timer.h - utils/vector.h - utils/x11logger.cpp - utils/x11logger.h - fs/virtfs/virtfile.cpp - fs/virtfs/virtfile.h - utils/xml.cpp - utils/xml.h - utils/xml.inc - utils/xmlutils.cpp - utils/xmlutils.h - utils/translation/podict.cpp - utils/translation/podict.h -) - -SET(SRCS_EVOL - net/ea/adminrecv.cpp - net/ea/adminrecv.h - net/ea/adminhandler.cpp - net/ea/adminhandler.h - net/ea/beingrecv.cpp - net/ea/beingrecv.h - net/ea/beinghandler.cpp - net/ea/beinghandler.h - net/ea/buysellhandler.cpp - net/ea/buysellhandler.h - net/ea/buysellrecv.cpp - net/ea/buysellrecv.h - net/ea/charserverhandler.cpp - net/ea/charserverhandler.h - net/ea/charserverrecv.cpp - net/ea/charserverrecv.h - net/ea/chathandler.cpp - net/ea/chathandler.h - net/ea/chatrecv.cpp - net/ea/chatrecv.h - net/ea/eaprotocol.h - net/ea/equipbackend.h - net/ea/gamehandler.cpp - net/ea/gamehandler.h - net/ea/gamerecv.cpp - net/ea/gamerecv.h - net/ea/inventoryhandler.cpp - net/ea/inventoryhandler.h - net/ea/inventoryrecv.cpp - net/ea/inventoryrecv.h - net/ea/itemhandler.cpp - net/ea/itemhandler.h - net/ea/itemrecv.cpp - net/ea/itemrecv.h - net/ea/loginhandler.cpp - net/ea/loginhandler.h - net/ea/loginrecv.cpp - net/ea/loginrecv.h - net/ea/network.cpp - net/ea/network.h - net/ea/maprecv.cpp - net/ea/maprecv.h - net/ea/npchandler.cpp - net/ea/npchandler.h - net/ea/npcrecv.cpp - net/ea/npcrecv.h - net/ea/partyhandler.cpp - net/ea/partyhandler.h - net/ea/partyrecv.cpp - net/ea/partyrecv.h - net/ea/playerhandler.cpp - net/ea/playerhandler.h - net/ea/playerrecv.cpp - net/ea/playerrecv.h - net/ea/skillhandler.cpp - net/ea/skillhandler.h - net/ea/skillrecv.cpp - net/ea/skillrecv.h - net/ea/token.h - net/ea/tradehandler.cpp - net/ea/tradehandler.h - net/ea/traderecv.cpp - net/ea/traderecv.h - ) - -SET(SRCS_TMWA - gui/widgets/tabs/chat/emulateguildtab.cpp - gui/widgets/tabs/chat/emulateguildtab.h - gui/windows/shopselldialog.cpp - gui/windows/shopselldialog.h - net/tmwa/adminhandler.cpp - net/tmwa/adminhandler.h - net/tmwa/beingrecv.cpp - net/tmwa/beingrecv.h - net/tmwa/beinghandler.cpp - net/tmwa/beinghandler.h - net/tmwa/buysellhandler.cpp - net/tmwa/buysellhandler.h - net/tmwa/buysellrecv.cpp - net/tmwa/buysellrecv.h - net/tmwa/charserverhandler.cpp - net/tmwa/charserverhandler.h - net/tmwa/charserverrecv.cpp - net/tmwa/charserverrecv.h - net/tmwa/chathandler.cpp - net/tmwa/chathandler.h - net/tmwa/chatrecv.cpp - net/tmwa/chatrecv.h - net/tmwa/gamehandler.cpp - net/tmwa/gamehandler.h - net/tmwa/gamerecv.cpp - net/tmwa/gamerecv.h - net/tmwa/generalhandler.cpp - net/tmwa/generalhandler.h - net/tmwa/generalrecv.cpp - net/tmwa/generalrecv.h - net/tmwa/guildhandler.cpp - net/tmwa/guildhandler.h - net/tmwa/guildmanager.cpp - net/tmwa/guildmanager.h - net/tmwa/inventoryhandler.cpp - net/tmwa/inventoryhandler.h - net/tmwa/inventoryrecv.cpp - net/tmwa/inventoryrecv.h - net/tmwa/itemhandler.cpp - net/tmwa/itemhandler.h - net/tmwa/itemrecv.cpp - net/tmwa/itemrecv.h - net/tmwa/loginhandler.cpp - net/tmwa/loginhandler.h - net/tmwa/loginrecv.cpp - net/tmwa/loginrecv.h - net/tmwa/messagein.cpp - net/tmwa/messagein.h - net/tmwa/messageout.cpp - net/tmwa/messageout.h - net/tmwa/network.cpp - net/tmwa/network.h - net/tmwa/npchandler.cpp - net/tmwa/npchandler.h - net/tmwa/packetsin.inc - net/tmwa/packetsout.inc - net/tmwa/partyhandler.cpp - net/tmwa/partyhandler.h - net/tmwa/partyrecv.cpp - net/tmwa/partyrecv.h - net/tmwa/pethandler.cpp - net/tmwa/pethandler.h - net/tmwa/playerhandler.cpp - net/tmwa/playerhandler.h - net/tmwa/playerrecv.cpp - net/tmwa/playerrecv.h - net/tmwa/protocolout.cpp - net/tmwa/protocolout.h - net/tmwa/questhandler.cpp - net/tmwa/questhandler.h - net/tmwa/questrecv.cpp - net/tmwa/questrecv.h - net/tmwa/recvpackets.inc - net/tmwa/serverfeatures.cpp - net/tmwa/serverfeatures.h - net/tmwa/skillhandler.cpp - net/tmwa/skillhandler.h - net/tmwa/skillrecv.cpp - net/tmwa/skillrecv.h - net/tmwa/sp.h - net/tmwa/sprite.h - net/tmwa/tradehandler.cpp - net/tmwa/tradehandler.h - net/tmwa/traderecv.cpp - net/tmwa/traderecv.h - net/tmwa/updateprotocol.cpp - net/tmwa/updateprotocol.h - net/tmwa/auctionhandler.cpp - net/tmwa/auctionhandler.h - net/tmwa/bankhandler.cpp - net/tmwa/bankhandler.h - net/tmwa/battlegroundhandler.cpp - net/tmwa/battlegroundhandler.h - net/tmwa/buyingstorehandler.cpp - net/tmwa/buyingstorehandler.h - net/tmwa/cashshophandler.cpp - net/tmwa/cashshophandler.h - net/tmwa/elementalhandler.cpp - net/tmwa/elementalhandler.h - net/tmwa/familyhandler.cpp - net/tmwa/familyhandler.h - net/tmwa/friendshandler.cpp - net/tmwa/friendshandler.h - net/tmwa/homunculushandler.cpp - net/tmwa/homunculushandler.h - net/tmwa/mailhandler.cpp - net/tmwa/mailhandler.h - net/tmwa/mail2handler.cpp - net/tmwa/mail2handler.h - net/tmwa/maphandler.cpp - net/tmwa/maphandler.h - net/tmwa/markethandler.cpp - net/tmwa/markethandler.h - net/tmwa/mercenaryhandler.cpp - net/tmwa/mercenaryhandler.h - net/tmwa/roulettehandler.cpp - net/tmwa/roulettehandler.h - net/tmwa/searchstorehandler.cpp - net/tmwa/searchstorehandler.h - net/tmwa/vendinghandler.cpp - net/tmwa/vendinghandler.h - gui/widgets/tabs/socialguildtab2.h - ) - -IF (WIN32) - SET(SRCS - ${SRCS} - fs/specialfolder.cpp - fs/specialfolder.h - manaplus.rc - ) - SET(DYE_CMD_SRCS - ${DYE_CMD_SRCS} - fs/specialfolder.cpp - fs/specialfolder.h - manaplus.rc - ) -ENDIF () - -#SET (PROGRAMS manaplus dyecmd) -SET (PROGRAMS manaplus) - -IF (ENABLE_TMWA) - SET(SRCS ${SRCS} ${SRCS_TMWA}) -ELSE() - SET(SRCS ${SRCS}) -ENDIF(ENABLE_TMWA) - -ADD_EXECUTABLE(manaplus WIN32 ${SRCS} ${SRCS_EVOL}) -#ADD_EXECUTABLE(dyecmd WIN32 ${DYE_CMD_SRCS}) - -TARGET_LINK_LIBRARIES(manaplus - ${X11_LIBRARIES} - ${SDLGFX_LIBRARIES} - ${SDL_LIBRARY} - ${SDLIMAGE_LIBRARY} - ${SDLMIXER_LIBRARY} - ${SDLNET_LIBRARY} - ${SDLTTF_LIBRARY} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${CURL_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${OPENGL_LIBRARIES} - ${LIBINTL_LIBRARIES} - ${EXTRA_LIBRARIES}) -INSTALL(TARGETS manaplus RUNTIME DESTINATION ${PKG_BINDIR}) - -#TARGET_LINK_LIBRARIES(dyecmd -# ${SDLGFX_LIBRARIES} -# ${SDL_LIBRARY} -# ${SDLIMAGE_LIBRARY} -# ${SDLMIXER_LIBRARY} -# ${SDLNET_LIBRARY} -# ${SDLTTF_LIBRARY} -# ${PNG_LIBRARIES} -# ${ZLIB_LIBRARIES} -# ${CURL_LIBRARIES} -# ${LIBXML2_LIBRARIES} -# ${OPENGL_LIBRARIES} -# ${LIBINTL_LIBRARIES} -# ${EXTRA_LIBRARIES}) -#INSTALL(TARGETS dyecmd RUNTIME DESTINATION ${PKG_BINDIR}) - -IF (CMAKE_SYSTEM_NAME STREQUAL SunOS) - # we expect the SMCgtxt package to be present on Solaris; - # the Solaris gettext is not API-compatible to GNU gettext - SET_TARGET_PROPERTIES(manaplus PROPERTIES LINK_FLAGS "-L/usr/local/lib") -# SET_TARGET_PROPERTIES(dyecmd PROPERTIES LINK_FLAGS "-L/usr/local/lib") -ENDIF() - -SET_TARGET_PROPERTIES(manaplus PROPERTIES COMPILE_FLAGS "${FLAGS}") -#SET_TARGET_PROPERTIES(dyecmd PROPERTIES COMPILE_FLAGS "${DYE_FLAGS}") diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 7f22f0507..000000000 --- a/src/Makefile.am +++ /dev/null @@ -1,2148 +0,0 @@ -AUTOMAKE_OPTIONS = subdir-objects - -.rc.o: - ${WINDRES} -o $@ $< - -# this need for enable asan in tests -#AM_TESTS_ENVIRONMENT = \ -# ASAN_OPTIONS=detect_leaks=1 - -if ENABLE_MANAPLUSGAME -if ENABLE_DYECMD -bin_PROGRAMS = manaplus dyecmd -else -bin_PROGRAMS = manaplus -endif -else -if ENABLE_DYECMD -bin_PROGRAMS = dyecmd -else -bin_PROGRAMS = -endif -endif -if ENABLE_UNITTESTSBIN -bin_PROGRAMS += manaplustests -endif - -manaplustests_CXXFLAGS = -if ENABLE_UNITTESTS_CATCH -manaplustests_CXXFLAGS += -DUNITTESTS_CATCH -endif -if ENABLE_UNITTESTSBIN_CATCH -manaplustests_CXXFLAGS += -DUNITTESTS_CATCH -endif -if ENABLE_UNITTESTS_DOCTEST -manaplustests_CXXFLAGS += -DUNITTESTS_DOCTEST -endif -if ENABLE_UNITTESTSBIN_DOCTEST -manaplustests_CXXFLAGS += -DUNITTESTS_DOCTEST -endif - -dyecmd_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \ - -DLOCALEDIR=\""$(localedir)"\" \ - -Wall -manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \ - -DLOCALEDIR=\""$(localedir)"\" \ - -Wall - -if ENABLE_WERROR -manaplus_CXXFLAGS += -Werror -dyecmd_CXXFLAGS += -Werror -endif - -if ENABLE_GLIBCDEBUG -manaplus_CXXFLAGS += -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -dyecmd_CXXFLAGS += -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -endif - -if USE_X11 -manaplus_CXXFLAGS += -DUSE_X11 -dyecmd_CXXFLAGS += -DUSE_X11 -endif - -if ENABLE_ASSERTS -manaplus_CXXFLAGS += -DENABLE_ASSERTS -dyecmd_CXXFLAGS += -DENABLE_ASSERTS -if HAVE_RDYNAMIC -manaplus_LDFLAGS = -rdynamic -dyecmd_LDFLAGS = -rdynamic -endif -endif - -if HAVE_EXECINFO -manaplus_CXXFLAGS += -DHAVE_EXECINFO -dyecmd_CXXFLAGS += -DHAVE_EXECINFO -endif - -if ENABLE_PUGIXML -manaplus_CXXFLAGS += -DENABLE_PUGIXML -dyecmd_CXXFLAGS += -DENABLE_PUGIXML -endif -if ENABLE_LIBXML -manaplus_CXXFLAGS += -DENABLE_LIBXML -dyecmd_CXXFLAGS += -DENABLE_LIBXML -endif -if ENABLE_TINYXML2 -manaplus_CXXFLAGS += -DENABLE_TINYXML2 -dyecmd_CXXFLAGS += -DENABLE_TINYXML2 -endif - -if ENABLE_PORTABLE -dyecmd_CXXFLAGS += -DENABLE_PORTABLE -manaplus_CXXFLAGS += -DENABLE_PORTABLE -endif - -if ENABLE_CUSTOMNLS -dyecmd_CXXFLAGS += -DENABLE_CUSTOMNLS -manaplus_CXXFLAGS += -DENABLE_CUSTOMNLS -endif - -if ENABLE_CHECKPLUGIN -dyecmd_CXXFLAGS += -DENABLE_CHECKPLUGIN -fplugin=../build/checkplugin.so -fplugin-arg-checkplugin-command=detectnullpointers -manaplus_CXXFLAGS += -DENABLE_CHECKPLUGIN -fplugin=../build/checkplugin.so -fplugin-arg-checkplugin-command=detectnullpointers -endif - -if USE_OPENGL -dyecmd_CXXFLAGS += -DUSE_OPENGL -manaplus_CXXFLAGS += -DUSE_OPENGL -endif -if ENABLE_OPENGLERRORS -dyecmd_CXXFLAGS += -DOPENGLERRORS -manaplus_CXXFLAGS += -DOPENGLERRORS -endif - -if ENABLE_MEM_DEBUG -dyecmd_CXXFLAGS += -DENABLE_MEM_DEBUG -DDEBUG_DUMP_LEAKS -manaplus_CXXFLAGS += -DENABLE_MEM_DEBUG -DDEBUG_DUMP_LEAKS - -manaplus_SOURCES = debug/nvwa/_nvwa.h \ - debug/nvwa/c++11.h \ - debug/nvwa/debug_new.cpp \ - debug/nvwa/debug_new.h \ - debug/nvwa/fast_mutex.h \ - debug/nvwa/static_assert.h -dyecmd_SOURCES = debug/nvwa/_nvwa.h \ - debug/nvwa/c++11.h \ - debug/nvwa/debug_new.cpp \ - debug/nvwa/debug_new.h \ - debug/nvwa/fast_mutex.h \ - debug/nvwa/static_assert.h -else -manaplus_SOURCES = -dyecmd_SOURCES = -endif - -if ENABLE_STLDEBUG -dyecmd_CXXFLAGS += -DENABLE_STLDEBUG -manaplus_CXXFLAGS += -DENABLE_STLDEBUG - -manaplus_SOURCES += debug/mse/msemsevector.h \ - debug/mse/msemstdvector.h \ - debug/mse/mseprimitives.h -dyecmd_SOURCES += debug/mse/msemsevector.h \ - debug/mse/msemstdvector.h \ - debug/mse/mseprimitives.h -endif - -if MINGW -manaplus_SOURCES += manaplus.rc -dyecmd_SOURCES += manaplus.rc -endif - -if ENABLE_CILKPLUS -dyecmd_CXXFLAGS += -DENABLE_CILKPLUS -fcilkplus -lcilkrts -manaplus_CXXFLAGS += -DENABLE_CILKPLUS -fcilkplus -lcilkrts -endif - -dyecmd_CXXFLAGS += -DDYECMD -dyecmd_SOURCES += progs/dyecmd/dyemain.cpp - -if USE_MUMBLE -manaplus_CXXFLAGS += -DUSE_MUMBLE -endif - -if ENABLE_CHECKS -dyecmd_CXXFLAGS += -DENABLE_CHECKS -manaplus_CXXFLAGS += -DENABLE_CHECKS -endif - -BASE_SRC = - -if USE_SDL2 -if USE_INTERNALSDLGFX -dyecmd_CXXFLAGS += -I$(srcdir)/sdl2gfx -DUSE_SDL2 -manaplus_CXXFLAGS += -I$(srcdir)/sdl2gfx -DUSE_SDL2 -BASE_SRC += sdl2gfx/SDL2_framerate.cpp \ - sdl2gfx/SDL2_framerate.h \ - sdl2gfx/SDL2_rotozoom.cpp \ - sdl2gfx/SDL2_rotozoom.h -else -dyecmd_CXXFLAGS += -DUSE_SDL2 -manaplus_CXXFLAGS += -DUSE_SDL2 -endif -endif - -BASE_SRC += client.h \ - events/actionevent.h \ - listeners/actionlistener.h \ - listeners/attributelistener.cpp \ - listeners/attributelistener.h \ - gui/widgets/basiccontainer.h \ - gui/browserlink.h \ - gui/buttoninfo.h \ - gui/buttontext.h \ - const/gui/chat.h \ - const/gui/pages.h \ - gui/chatlog.h \ - enums/gui/chatmsgtype.h \ - enums/gui/chattabtype.h \ - enums/gui/colorname.h \ - gui/cliprect.h \ - gui/color.h \ - enums/gui/dialogtype.h \ - enums/gui/gradienttype.h \ - enums/gui/itemamountwindowusage.h \ - enums/gui/orientation.h \ - enums/gui/progresscolorid.h \ - enums/gui/serverdialogdonwloadstatus.h \ - enums/gui/shoplistboxtype.h \ - enums/gui/slidergrid.h \ - enums/gui/themecolorid.h \ - enums/gui/updatedownloadstatus.h \ - enums/gui/usercolorid.h \ - listeners/errorlistener.cpp \ - listeners/errorlistener.h \ - listeners/widgetdeathlistener.h \ - events/event.h \ - listeners/focuslistener.h \ - listeners/gamemodifierlistener.cpp \ - listeners/gamemodifierlistener.h \ - listeners/guiconfiglistener.h \ - listeners/debugmessagelistener.cpp \ - listeners/debugmessagelistener.h \ - listeners/guitableactionlistener.cpp \ - listeners/guitableactionlistener.h \ - listeners/tooltiplistener.cpp \ - listeners/tooltiplistener.h \ - events/inputguievent.h \ - input/key.h \ - events/keyevent.h \ - enums/events/keyeventtype.h \ - listeners/keylistener.h \ - gui/models/listmodel.h \ - events/mouseevent.h \ - enums/events/mousebutton.h \ - enums/events/mouseeventtype.h \ - listeners/mouselistener.h \ - listeners/openurllistener.h \ - listeners/playerdeathlistener.cpp \ - listeners/playerdeathlistener.h \ - gui/rect.h \ - events/selectionevent.h \ - listeners/selectionlistener.h \ - listeners/statlistener.cpp \ - listeners/statlistener.h \ - listeners/tablemodellistener.h \ - utils/sdlpixel.h \ - utils/sdlsharedhelper.cpp \ - utils/sdlsharedhelper.h \ - utils/stdmove.h \ - gui/widgets/widget.h \ - listeners/weightlistener.h \ - listeners/widgetlistener.h \ - listeners/wrongdatanoticelistener.cpp \ - listeners/wrongdatanoticelistener.h \ - gui/viewport.h \ - gui/widgets/basiccontainer2.h \ - gui/widgets/basiccontainer.cpp \ - gui/colorpair.h \ - gui/dialogsmanager.cpp \ - gui/dialogsmanager.h \ - input/key.cpp \ - gui/widgets/widget.cpp \ - gui/widgets/basiccontainer2.cpp \ - gui/models/colorlistmodel.h \ - gui/widgets/browserbox.cpp \ - gui/widgets/browserbox.h \ - gui/widgets/browserbox.inc \ - gui/widgets/staticbrowserbox.cpp \ - gui/widgets/staticbrowserbox.h \ - gui/widgets/button.cpp \ - gui/widgets/button.h \ - gui/widgets/chatinput.h \ - gui/widgets/checkbox.cpp \ - gui/widgets/checkbox.h \ - gui/models/colormodel.cpp \ - gui/models/colormodel.h \ - gui/widgets/colorpage.cpp \ - gui/widgets/colorpage.h \ - gui/widgets/container.cpp \ - gui/widgets/container.h \ - gui/widgets/containerplacer.cpp \ - gui/widgets/containerplacer.h \ - gui/widgets/createwidget.h \ - gui/widgets/desktop.cpp \ - gui/widgets/desktop.h \ - gui/widgets/dropdown.cpp \ - gui/widgets/dropdown.h \ - gui/widgets/equipmentbox.h \ - gui/widgets/equipmentpage.h \ - gui/widgets/extendedlistbox.cpp \ - gui/widgets/extendedlistbox.h \ - gui/widgets/extendedlistboxitem.h \ - gui/models/extendedlistmodel.h \ - gui/models/extendednamesmodel.cpp \ - gui/models/extendednamesmodel.h \ - gui/models/fontsizechoicelistmodel.h \ - gui/models/fontsmodel.h \ - gui/models/iconsmodel.h \ - gui/models/ignorechoiceslistmodel.h \ - gui/models/itemsmodel.h \ - gui/models/keylistmodel.h \ - gui/models/langlistmodel.h \ - gui/widgets/flowcontainer.cpp \ - gui/widgets/flowcontainer.h \ - gui/widgets/guitable.cpp \ - gui/widgets/guitable.h \ - gui/widgets/horizontcontainer.cpp \ - gui/widgets/horizontcontainer.h \ - gui/widgets/icon.cpp \ - gui/widgets/icon.h \ - gui/widgets/inttextfield.cpp \ - gui/widgets/inttextfield.h \ - gui/widgets/label.cpp \ - gui/widgets/label.h \ - gui/widgets/layout.cpp \ - gui/widgets/layout.h \ - gui/widgets/layoutarray.cpp \ - gui/widgets/layoutarray.h \ - gui/widgets/layoutcell.cpp \ - gui/widgets/layoutcell.h \ - gui/widgets/layouthelper.cpp \ - gui/widgets/layouthelper.h \ - enums/gui/layouttype.h \ - enums/gui/linkhighlightmode.h \ - enums/gui/npcactionstate.h \ - enums/gui/npcinputstate.h \ - gui/widgets/linepart.cpp \ - gui/widgets/linepart.h \ - gui/widgets/linkhandler.h \ - gui/widgets/listbox.cpp \ - gui/widgets/listbox.h \ - gui/models/modelistmodel.cpp \ - gui/models/modelistmodel.h \ - gui/models/namesmodel.cpp \ - gui/models/namesmodel.h \ - gui/models/serverslistmodel.h \ - gui/widgets/passwordfield.cpp \ - gui/widgets/passwordfield.h \ - gui/widgets/popup.cpp \ - gui/widgets/popup.h \ - gui/widgets/popuplist.cpp \ - gui/widgets/popuplist.h \ - gui/widgets/progressbar.cpp \ - gui/widgets/progressbar.h \ - gui/widgets/progressindicator.cpp \ - gui/widgets/progressindicator.h \ - gui/widgets/radiobutton.cpp \ - gui/widgets/radiobutton.h \ - gui/widgets/radiogroup.cpp \ - gui/widgets/radiogroup.h \ - gui/widgets/scrollarea.cpp \ - gui/widgets/scrollarea.h \ - gui/models/soundsmodel.h \ - gui/widgets/slider.cpp \ - gui/widgets/slider.h \ - gui/widgets/sliderlist.cpp \ - gui/widgets/sliderlist.h \ - gui/widgets/tabs/tab.cpp \ - gui/widgets/tabs/tab.h \ - gui/widgets/tabbedarea.cpp \ - gui/widgets/tabbedarea.h \ - gui/models/tablemodel.cpp \ - gui/models/tablemodel.h \ - gui/models/targettypemodel.h \ - gui/models/typelistmodel.h \ - gui/models/themesmodel.h \ - gui/widgets/tabstrip.cpp \ - gui/widgets/tabstrip.h \ - gui/widgets/textbox.cpp \ - gui/widgets/textbox.h \ - gui/widgets/textfield.cpp \ - gui/widgets/textfield.h \ - gui/widgets/textpreview.cpp \ - gui/widgets/textpreview.h \ - gui/widgets/vertcontainer.cpp \ - gui/widgets/vertcontainer.h \ - gui/widgets/widget2.h \ - gui/widgets/widgetgroup.cpp \ - gui/widgets/widgetgroup.h \ - gui/widgets/window.cpp \ - gui/widgets/window.h \ - gui/widgets/windowcontainer.cpp \ - gui/widgets/windowcontainer.h \ - gui/windows/confirmdialog.cpp \ - gui/windows/confirmdialog.h \ - gui/focushandler.cpp \ - gui/focushandler.h \ - gui/gui.cpp \ - gui/gui.h \ - gui/mailmessage.h \ - gui/mouseoverlink.h \ - gui/windows/okdialog.cpp \ - gui/windows/okdialog.h \ - gui/onlineplayer.h \ - gui/palette.cpp \ - gui/palette.h \ - gui/sdlinput.cpp \ - gui/sdlinput.h \ - gui/windows/editdialog.cpp \ - gui/windows/editdialog.h \ - gui/setupactiondata.h \ - gui/fonts/font.cpp \ - gui/fonts/font.h \ - gui/fonts/textchunk.cpp \ - gui/fonts/textchunk.h \ - gui/fonts/textchunklist.cpp \ - gui/fonts/textchunklist.h \ - gui/fonts/textchunksmall.cpp \ - gui/fonts/textchunksmall.h \ - gui/skin.cpp \ - gui/skin.h \ - gui/theme.cpp \ - gui/theme.h \ - gui/themecolorsidoperators.cpp \ - gui/themecolorsidoperators.h \ - gui/themeinfo.h \ - gui/userpalette.cpp \ - gui/userpalette.h \ - gui/windowmanager.cpp \ - gui/windowmanager.h \ - enums/net/auctionsearchtype.h \ - enums/net/battlegroundtype.h \ - enums/net/deleteitemreason.h \ - enums/net/downloadstatus.h \ - enums/net/mailmessagetype.h \ - enums/net/mailopentype.h \ - enums/net/npcaction.h \ - enums/net/packettype.h \ - enums/net/partyshare.h \ - enums/net/serverfreetype.h \ - enums/net/servertype.h \ - enums/net/storesearchtype.h \ - enums/net/updatetype.h \ - resources/action.cpp \ - resources/action.h \ - resources/ambientlayer.cpp \ - resources/ambientlayer.h \ - resources/atlas/atlasitem.h \ - resources/atlas/atlasmanager.cpp \ - resources/atlas/atlasmanager.h \ - resources/atlas/atlasresource.cpp \ - resources/atlas/atlasresource.h \ - resources/rect/doublerect.h \ - resources/attack.h \ - resources/cursors.cpp \ - resources/cursors.h \ - resources/dye/dye.cpp \ - resources/dye/dye.h \ - resources/dye/dyecolor.h \ - resources/dye/dyepalette.cpp \ - resources/dye/dyepalette.h \ - resources/dye/dyepalette_replaceacolor.cpp \ - resources/dye/dyepalette_replaceaoglcolor.cpp \ - resources/dye/dyepalette_replacescolor.cpp \ - resources/dye/dyepalette_replacesoglcolor.cpp \ - resources/dye/dyepaletteptr.h \ - resources/fboinfo.h \ - resources/frame.h \ - resources/groupinfo.cpp \ - resources/groupinfo.h \ - resources/image/image.cpp \ - resources/image/image.h \ - resources/imagehelper.cpp \ - resources/imagehelper.h \ - resources/imageset.cpp \ - resources/imageset.h \ - resources/itemcolordata.h \ - resources/mstack.h \ - resources/notificationinfo.h \ - resources/notifications.h \ - resources/npcbuttoninfo.h \ - resources/npcdialoginfo.h \ - resources/npcdialogmenuinfo.h \ - resources/npcimageinfo.h \ - resources/npcinventoryinfo.h \ - resources/npctextinfo.h \ - enums/resources/notifyflags.h \ - enums/resources/notifytypes.h \ - resources/imagerect.h \ - resources/openglimagehelper.cpp \ - resources/openglimagehelper.h \ - resources/openglscreenshothelper.cpp \ - resources/openglscreenshothelper.h \ - resources/mobileopenglscreenshothelper.cpp \ - resources/mobileopenglscreenshothelper.h \ - resources/questeffect.h \ - resources/questitem.h \ - resources/questitemtext.h \ - resources/questvar.h \ - enums/resources/questtype.h \ - enums/resources/servercommandenable.h \ - enums/resources/servercommandtype.h \ - enums/resources/serverpermissiontype.h \ - resources/resource.cpp \ - resources/resource.h \ - resources/resourcefunctiontypes.h \ - resources/resourcetypes.h \ - resources/loaders/atlasloader.cpp \ - resources/loaders/atlasloader.h \ - resources/loaders/emptyatlasloader.cpp \ - resources/loaders/emptyatlasloader.h \ - resources/loaders/imageloader.cpp \ - resources/loaders/imageloader.h \ - resources/loaders/imagesetloader.cpp \ - resources/loaders/imagesetloader.h \ - resources/loaders/musicloader.cpp \ - resources/loaders/musicloader.h \ - resources/loaders/rescaledloader.cpp \ - resources/loaders/rescaledloader.h \ - resources/loaders/shaderloader.cpp \ - resources/loaders/shaderloader.h \ - resources/loaders/shaderprogramloader.cpp \ - resources/loaders/shaderprogramloader.h \ - resources/loaders/soundloader.cpp \ - resources/loaders/soundloader.h \ - resources/loaders/spritedefloader.cpp \ - resources/loaders/spritedefloader.h \ - resources/loaders/subimageloader.cpp \ - resources/loaders/subimageloader.h \ - resources/loaders/subimagesetloader.cpp \ - resources/loaders/subimagesetloader.h \ - resources/loaders/walklayerloader.cpp \ - resources/loaders/walklayerloader.h \ - resources/loaders/xmlloader.cpp \ - resources/loaders/xmlloader.h \ - resources/resourcemanager/resourcemanager.cpp \ - resources/resourcemanager/resourcemanager.h \ - resources/safeopenglimagehelper.cpp \ - resources/safeopenglimagehelper.h \ - resources/screenshothelper.h \ - resources/sdl2imagehelper.cpp \ - resources/sdl2imagehelper.h \ - resources/sdl2softwareimagehelper.cpp \ - resources/sdl2softwareimagehelper.h \ - resources/sdl2softwarescreenshothelper.cpp \ - resources/sdl2softwarescreenshothelper.h \ - resources/sdlgfxblitfunc.cpp \ - resources/sdlgfxblitfunc.h \ - resources/sdlimagehelper.cpp \ - resources/sdlimagehelper.h \ - resources/sdlmusic.cpp \ - resources/sdlmusic.h \ - resources/sdlscreenshothelper.cpp \ - resources/sdlscreenshothelper.h \ - resources/skill/skilltypeentry.h \ - resources/skill/skilltypelist.h \ - const/net/skill.h \ - const/resources/currency.h \ - const/resources/skill.h \ - enums/resources/skill/skillowner.h \ - enums/resources/skill/skillsettype.h \ - enums/resources/skill/skilltype.h \ - enums/resources/skill/skilltype2.h \ - resources/servercommands.inc \ - resources/serverpermissions.inc \ - resources/soundeffect.cpp \ - resources/soundeffect.h \ - resources/soundinfo.h \ - const/resources/spriteaction.h \ - resources/sprite/spritedef.cpp \ - resources/sprite/spritedef.h \ - enums/resources/spritedirection.h \ - resources/image/subimage.cpp \ - resources/image/subimage.h \ - resources/surfaceimagehelper.cpp \ - resources/surfaceimagehelper.h \ - resources/wallpaper.cpp \ - resources/wallpaper.h \ - resources/wallpaperdata.h \ - utils/translation/podict.cpp \ - utils/translation/podict.h \ - utils/translation/poparser.cpp \ - utils/translation/poparser.h \ - utils/translation/translationmanager.cpp \ - utils/translation/translationmanager.h \ - utils/base64.cpp \ - utils/base64.h \ - utils/booleanoptions.h \ - utils/browserboxtools.cpp \ - utils/browserboxtools.h \ - utils/buildhex.h \ - utils/cast.h \ - utils/checkutils.cpp \ - utils/checkutils.h \ - utils/copynpaste.cpp \ - utils/copynpaste.h \ - utils/cpu.cpp \ - utils/cpu.h \ - utils/delete2.h \ - utils/dtor.h \ - utils/dumplibs.cpp \ - utils/dumplibs.h \ - utils/dumpsizes.cpp \ - utils/dumpsizes.h \ - utils/env.cpp \ - utils/env.h \ - utils/foreach.h \ - fs/files.cpp \ - fs/files.h \ - utils/fuzzer.cpp \ - utils/fuzzer.h \ - utils/gettext.h \ - utils/gettexthelper.cpp \ - utils/gettexthelper.h \ - utils/glxhelper.cpp \ - utils/glxhelper.h \ - utils/intmap.h \ - utils/langs.cpp \ - utils/langs.h \ - utils/likely.h \ - utils/mathutils.h \ - fs/mkdir.cpp \ - fs/mkdir.h \ - utils/mrand.cpp \ - utils/mrand.h \ - utils/parameters.cpp \ - utils/parameters.h \ - fs/paths.cpp \ - fs/paths.h \ - utils/perfomance.cpp \ - utils/perfomance.h \ - utils/pnglib.cpp \ - utils/pnglib.h \ - fs/virtfs/fsfuncs.h \ - fs/virtfs/rwops.cpp \ - fs/virtfs/rwops.h \ - fs/virtfs/tools.cpp \ - fs/virtfs/tools.h \ - fs/virtfs/list.cpp \ - fs/virtfs/list.h \ - utils/process.cpp \ - utils/process.h \ - utils/sdl2helper.cpp \ - utils/sdl2helper.h \ - utils/sdl2logger.cpp \ - utils/sdl2logger.h \ - utils/sdlcheckutils.cpp \ - utils/sdlcheckutils.h \ - utils/sdlhelper.cpp \ - utils/sdlhelper.h \ - utils/sdlmemoryobject.h \ - fs/specialfolder.cpp \ - fs/specialfolder.h \ - utils/stringmap.h \ - utils/stringutils.cpp \ - utils/stringutils.h \ - utils/stringvector.h \ - utils/timer.cpp \ - utils/timer.h \ - utils/vector.h \ - utils/x11logger.cpp \ - utils/x11logger.h \ - fs/virtfs/file.cpp \ - fs/virtfs/file.h \ - utils/mutex.h \ - utils/naclmessages.cpp \ - utils/naclmessages.h \ - utils/xml.h \ - utils/xml.inc \ - utils/xmlutils.cpp \ - utils/xmlutils.h \ - utils/xmlwriter.h \ - test/testlauncher.cpp \ - test/testlauncher.h \ - test/testmain.cpp \ - test/testmain.h \ - actions/actiondef.h \ - actions/actionfuncptr.h \ - actions/actions.h \ - actions/chat.h \ - actions/commands.h \ - actions/move.h \ - actions/pets.h \ - actions/statusbar.h \ - actions/tabs.h \ - actions/target.h \ - actions/windows.h \ - listeners/baselistener.hpp \ - commandline.cpp \ - commandline.h \ - configmanager.cpp \ - configmanager.h \ - listeners/configlistener.h \ - configuration.cpp \ - configuration.h \ - debug.h \ - defaults.cpp \ - defaults.h \ - dirs.cpp \ - dirs.h \ - eventsmanager.cpp \ - eventsmanager.h \ - const/equipment.h \ - const/itemshortcut.h \ - const/spells.h \ - const/utils/timer.h \ - const/utils/utf8.h \ - const/gui/chat.h \ - const/gui/theme.h \ - const/render/graphics.h \ - render/graphics.cpp \ - render/graphics.h \ - graphicsmanager.cpp \ - graphicsmanager.h \ - render/vertexes/imagecollection.cpp \ - render/vertexes/imagecollection.h \ - render/vertexes/imagevertexes.cpp \ - render/vertexes/imagevertexes.h \ - render/vertexes/openglgraphicsvertexes.cpp \ - render/vertexes/openglgraphicsvertexes.h \ - events/inputevent.h \ - input/inputactiondata.h \ - input/inputactionoperators.cpp \ - input/inputactionoperators.h \ - input/inputactionsortfunctor.h \ - enums/input/inputcondition.h \ - input/inputfunction.h \ - input/inputitem.h \ - input/inputmanager.cpp \ - input/inputmanager.h \ - enums/input/inputtype.h \ - enums/input/keyboardfocus.h \ - enums/input/keyvalue.h \ - input/joystick.cpp \ - input/joystick.h \ - input/keyboardconfig.cpp \ - input/keyboardconfig.h \ - input/keyinput.h \ - input/touch/multitouchmanager.cpp \ - input/touch/multitouchmanager.h \ - localconsts.h \ - logger.cpp \ - logger.h \ - maingui.cpp \ - maingui.h \ - render/opengl/mgl.cpp \ - render/opengl/mgl.h \ - render/opengl/mgl.hpp \ - render/opengl/mglcheck.h \ - render/opengl/mgldefines.h \ - render/opengl/mglemu.cpp \ - render/opengl/mglemu.h \ - render/opengl/mglfunctions.h \ - render/opengl/mgltypes.h \ - render/openglx/mglx.cpp \ - render/openglx/mglx.h \ - render/openglx/mglx.hpp \ - render/openglx/mglxinit.cpp \ - render/openglx/mglxinit.h \ - render/openglx/mglxtypes.h \ - render/mobileopengl2graphics.cpp \ - render/mobileopengl2graphics.h \ - render/mobileopenglgraphics.cpp \ - render/mobileopenglgraphics.h \ - render/modernopenglgraphics.cpp \ - render/modernopenglgraphics.h \ - render/nacl/naclfunctions.h \ - render/nacl/naclgles.cpp \ - render/nacl/naclgles.h \ - render/opengl/naclglfunctions.h \ - render/normalopenglgraphics.cpp \ - render/normalopenglgraphics.h \ - input/mouseinput.h \ - options.h \ - render/graphicsdef.hpp \ - render/imagegraphics.cpp \ - render/imagegraphics.h \ - render/graphics_calcImageRect.hpp \ - render/graphics_drawImageRect.hpp \ - render/nullopenglgraphics.cpp \ - render/nullopenglgraphics.h \ - render/opengl/opengldebug.h \ - render/openglgraphicsdef.hpp \ - render/openglgraphicsdef1.hpp \ - render/openglgraphicsdefadvanced.hpp \ - render/renderers.cpp \ - render/renderers.h \ - render/rendererslistsdl.h \ - render/rendererslistsdl2.h \ - enums/particle/alivestatus.h \ - enums/particle/particlechangefunc.h \ - enums/particle/particlephysics.h \ - enums/particle/particletype.h \ - enums/render/blitmode.h \ - enums/render/rendertype.h \ - being/playerignorestrategy.h \ - enums/being/rank.h \ - enums/being/reachable.h \ - enums/being/relation.h \ - enums/being/targetcursorsize.h \ - enums/being/targetcursortype.h \ - enums/being/visiblename.h \ - enums/being/visiblenamepos.h \ - position.cpp \ - position.h \ - render/safeopenglgraphics.cpp\ - render/safeopenglgraphics.h \ - render/sdl2graphics.cpp \ - render/sdl2graphics.h \ - render/sdl2softwaregraphics.cpp \ - render/sdl2softwaregraphics.h \ - render/sdlgraphics.cpp \ - render/sdlgraphics.h \ - render/softwaregraphicsdef.hpp \ - sdlshared.h \ - settings.cpp \ - settings.h \ - enums/screendensity.h \ - enums/state.h \ - enums/textcommandtype.h \ - enums/simpletypes/advanced.h \ - enums/simpletypes/allowquit.h \ - enums/simpletypes/allowsort.h \ - enums/simpletypes/allplayers.h \ - enums/simpletypes/append.h \ - enums/simpletypes/autorelease.h \ - enums/simpletypes/autotarget.h \ - enums/simpletypes/beingid.h \ - enums/simpletypes/beingtypeid.h \ - enums/simpletypes/booldefines.h \ - enums/simpletypes/damaged.h \ - enums/simpletypes/donotalign.h \ - enums/simpletypes/enable.h \ - enums/simpletypes/enumdefines.h \ - enums/simpletypes/equipm.h \ - enums/simpletypes/equipped.h \ - enums/simpletypes/favorite.h \ - enums/simpletypes/forcedisplay.h \ - enums/simpletypes/forcequantity.h \ - enums/simpletypes/identified.h \ - enums/simpletypes/ignorerecord.h \ - enums/simpletypes/intdefines.h \ - enums/simpletypes/issell.h \ - enums/simpletypes/isstart.h \ - enums/simpletypes/itemcolor.h \ - enums/simpletypes/keep.h \ - enums/simpletypes/losefocusontab.h \ - enums/simpletypes/mainconfig.h \ - enums/simpletypes/modal.h \ - enums/simpletypes/modifiable.h \ - enums/simpletypes/move.h \ - enums/simpletypes/notify.h \ - enums/simpletypes/npcnames.h \ - enums/simpletypes/online.h \ - enums/simpletypes/onthefly.h \ - enums/simpletypes/opaque.h \ - enums/simpletypes/protected.h \ - enums/simpletypes/separator.h \ - enums/simpletypes/sfx.h \ - enums/simpletypes/showcenter.h \ - enums/simpletypes/showemptyrows.h \ - enums/simpletypes/skiperror.h \ - enums/simpletypes/speech.h \ - enums/simpletypes/stringdefines.h \ - enums/simpletypes/stringdefines2.h \ - enums/simpletypes/trading.h \ - enums/simpletypes/tryremovecolors.h \ - enums/simpletypes/useargs.h \ - enums/simpletypes/usebase64.h \ - enums/simpletypes/usevirtfs.h \ - enums/simpletypes/visible.h \ - render/surfacegraphics.cpp \ - render/surfacegraphics.h \ - render/shaders/shader.cpp \ - render/shaders/shader.h \ - render/shaders/shaderprogram.cpp \ - render/shaders/shaderprogram.h \ - render/shaders/shadersmanager.cpp \ - render/shaders/shadersmanager.h \ - resources/animation/animation.cpp \ - resources/animation/animation.h \ - resources/animation/simpleanimation.cpp \ - resources/animation/simpleanimation.h \ - resources/sprite/sprite.h \ - const/sound.h \ - soundmanager.cpp \ - soundmanager.h \ - text.cpp \ - text.h \ - textmanager.cpp \ - textmanager.h \ - input/touch/touchactions.cpp \ - input/touch/touchactions.h \ - input/touch/touchmanager.cpp \ - input/touch/touchmanager.h \ - variabledata.h \ - vector.cpp \ - vector.h \ - net/ipc.cpp \ - net/ipc.h \ - net/sdltcpnet.cpp \ - net/sdltcpnet.h \ - gui/popups/textboxpopup.cpp \ - gui/popups/textboxpopup.h \ - gui/popups/textpopup.cpp \ - gui/popups/textpopup.h \ - gui/popupmanager.cpp \ - gui/popupmanager.h \ - enums/input/inputaction.h \ - enums/input/inputgroup.h \ - input/inputactionmap.h \ - resources/memorycounter.cpp \ - resources/memorycounter.h \ - resources/memorymanager.cpp \ - resources/memorymanager.h \ - resources/missileinfo.h \ - winver.h \ - enums/fs/fsentrytype.h \ - fs/virtfs/fileapi.h \ - fs/virtfs/rwopstypes.h \ - fs/virtfs/direntry.cpp \ - fs/virtfs/direntry.h \ - fs/virtfs/fs.cpp \ - fs/virtfs/fs.h \ - fs/virtfs/fsdir.cpp \ - fs/virtfs/fsdir.h \ - fs/virtfs/fsdirrwops.cpp \ - fs/virtfs/fsdirrwops.h \ - fs/virtfs/fsentry.cpp \ - fs/virtfs/fsentry.h \ - fs/virtfs/fszip.cpp \ - fs/virtfs/fszip.h \ - fs/virtfs/fsziprwops.cpp \ - fs/virtfs/fsziprwops.h \ - fs/virtfs/zipentry.cpp \ - fs/virtfs/zipentry.h \ - fs/virtfs/zipreader.cpp \ - fs/virtfs/zipreader.h \ - fs/virtfs/ziplocalheader.cpp \ - fs/virtfs/ziplocalheader.h - -if ENABLE_PUGIXML -BASE_SRC += utils/xml/pugixml.cpp \ - utils/xml/pugixml.h \ - utils/xml/pugixml.inc \ - utils/xml/pugixmlwriter.cpp \ - utils/xml/pugixmlwriter.h -endif -if ENABLE_LIBXML -BASE_SRC += utils/xml/libxml.cpp \ - utils/xml/libxml.h \ - utils/xml/libxml.inc -endif -if ENABLE_TINYXML2 -BASE_SRC += utils/xml/tinyxml2.cpp \ - utils/xml/tinyxml2.h \ - utils/xml/tinyxml2.inc -endif - -dyecmd_SOURCES += ${BASE_SRC} - -SRC = ${BASE_SRC} \ - main.cpp \ - main.h \ - avatar.cpp \ - avatar.h \ - actormanager.cpp \ - actormanager.h \ - resources/sprite/animatedsprite.cpp \ - resources/sprite/animatedsprite.h \ - resources/sprite/animationdelayload.cpp \ - resources/sprite/animationdelayload.h \ - resources/dbmanager.cpp \ - resources/dbmanager.h \ - resources/sprite/imagesprite.cpp \ - resources/sprite/imagesprite.h \ - resources/inventory/inventory.cpp \ - resources/inventory/inventory.h \ - textcommand.cpp \ - textcommand.h \ - resources/item/cardslist.cpp \ - resources/item/cardslist.h \ - resources/item/complexitem.cpp \ - resources/item/complexitem.h \ - resources/item/item.cpp \ - resources/item/item.h \ - resources/item/itemfieldtype.h \ - resources/item/itemoption.h \ - resources/item/itemoptionslist.h \ - itemcolormanager.cpp \ - itemcolormanager.h \ - gui/shortcut/itemshortcut.cpp \ - gui/shortcut/itemshortcut.h \ - itemsoundmanager.cpp \ - itemsoundmanager.h \ - enums/commandtarget.h \ - enums/dragdropsource.h \ - enums/emotetype.h \ - enums/equipslot.h \ - enums/guildpositionflags.h \ - enums/inventorytype.h \ - gui/shortcut/spellshortcut.cpp \ - gui/shortcut/spellshortcut.h \ - statuseffect.cpp \ - statuseffect.h \ - particle/animationparticle.cpp \ - particle/animationparticle.h \ - being/being.cpp \ - being/being.h \ - enums/being/beingaction.h \ - being/beingcacheentry.h \ - enums/being/beingdirection.h \ - being/beingflag.h \ - being/beingspeech.h \ - being/castingeffect.cpp \ - being/castingeffect.h \ - being/localplayer.cpp \ - being/localplayer.h \ - being/mercenaryinfo.h \ - being/petinfo.h \ - being/compounditem.h \ - being/compoundsprite.cpp \ - being/compoundsprite.h \ - being/crazymoves.cpp \ - being/crazymoves.h \ - enums/being/cookingtype.h \ - enums/being/gender.h \ - being/homunculusinfo.h \ - enums/being/pickup.h \ - beingequipbackend.cpp \ - beingequipbackend.h \ - resources/item/shopitem.cpp \ - resources/item/shopitem.h \ - being/flooritem.cpp \ - being/flooritem.h \ - game.cpp \ - game.h \ - gamemodifiers.cpp \ - gamemodifiers.h \ - guild.cpp \ - guild.h \ - spellmanager.cpp \ - spellmanager.h \ - chatlogger.cpp \ - chatlogger.h \ - gui/shortcut/shortcutbase.cpp \ - gui/shortcut/shortcutbase.h \ - being/playerinfo.cpp \ - being/playerinfo.h \ - being/playerrelation.cpp \ - being/playerrelation.h \ - being/playerrelations.cpp \ - being/playerrelations.h \ - gui/touchactiondata.cpp \ - gui/touchactiondata.h \ - gui/models/avatarlistmodel.h \ - gui/models/beingslistmodel.h \ - gui/models/opengllistmodel.h \ - gui/models/playerrelationlistmodel.h \ - gui/models/playertablemodel.cpp \ - gui/models/playertablemodel.h \ - gui/models/questsmodel.h \ - being/actor.cpp \ - being/actor.h \ - being/actorsprite.cpp \ - being/actorsprite.h \ - enums/being/actortype.h \ - enums/being/attacktype.h \ - enums/being/attributes.h \ - enums/being/attributesstrings.cpp \ - enums/being/attributesstrings.h \ - enums/being/badgedrawtype.h \ - enums/being/badgeindex.h \ - dragdrop.h \ - gui/shortcut/dropshortcut.cpp \ - gui/shortcut/dropshortcut.h \ - effectmanager.cpp \ - effectmanager.h \ - gui/shortcut/emoteshortcut.cpp \ - gui/shortcut/emoteshortcut.h \ - const/emoteshortcut.h \ - equipment.h \ - listeners/actorspritelistener.h \ - listeners/arrowslistener.cpp \ - listeners/arrowslistener.h \ - listeners/assertlistener.cpp \ - listeners/assertlistener.h \ - listeners/awaylistener.cpp \ - listeners/awaylistener.h \ - listeners/charrenamelistener.cpp \ - listeners/charrenamelistener.h \ - gui/popups/itempopup.cpp \ - gui/popups/itempopup.h \ - gui/popups/spellpopup.cpp \ - gui/popups/spellpopup.h \ - gui/popups/statuspopup.cpp \ - gui/popups/statuspopup.h \ - gui/popups/popupmenu.cpp \ - gui/popups/popupmenu.h \ - gui/popups/skillpopup.cpp \ - gui/popups/skillpopup.h \ - gui/popups/speechbubble.cpp \ - gui/popups/speechbubble.h \ - gui/popups/beingpopup.cpp \ - gui/popups/beingpopup.h \ - gui/widgets/itemcontainer.cpp \ - gui/widgets/itemcontainer.h \ - gui/widgets/tabs/chat/battletab.cpp \ - gui/widgets/tabs/chat/battletab.h \ - gui/widgets/tabs/chat/channeltab.cpp \ - gui/widgets/tabs/chat/channeltab.h \ - gui/widgets/attrs/attrdisplay.cpp \ - gui/widgets/attrs/attrdisplay.h \ - gui/widgets/attrs/changedisplay.cpp \ - gui/widgets/attrs/changedisplay.h \ - gui/widgets/attrs/derdisplay.cpp \ - gui/widgets/attrs/derdisplay.h \ - gui/widgets/tabs/debugwindowtabs.cpp \ - gui/widgets/tabs/debugwindowtabs.h \ - gui/widgets/tabs/chat/chattab.cpp \ - gui/widgets/tabs/chat/chattab.h \ - gui/widgets/tabs/chat/gmtab.cpp \ - gui/widgets/tabs/chat/gmtab.h \ - gui/widgets/tabs/chat/langtab.cpp \ - gui/widgets/tabs/chat/langtab.h \ - gui/widgets/tabs/chat/tradetab.cpp \ - gui/widgets/tabs/chat/tradetab.h \ - gui/widgets/tabs/chat/whispertab.cpp \ - gui/widgets/tabs/chat/whispertab.h \ - gui/widgets/tabs/chat/guildtab.cpp \ - gui/widgets/tabs/chat/guildtab.h \ - gui/widgets/tabs/chat/partytab.cpp \ - gui/widgets/tabs/chat/partytab.h \ - gui/widgets/avatarlistbox.cpp \ - gui/widgets/avatarlistbox.h \ - gui/widgets/characterdisplay.cpp \ - gui/widgets/characterdisplay.h \ - gui/widgets/characterviewbase.h \ - gui/widgets/characterviewnormal.cpp \ - gui/widgets/characterviewnormal.h \ - gui/widgets/characterviewsmall.cpp \ - gui/widgets/characterviewsmall.h \ - gui/widgets/itemlinkhandler.cpp \ - gui/widgets/itemlinkhandler.h \ - gui/widgets/emoteshortcutcontainer.cpp \ - gui/widgets/emoteshortcutcontainer.h \ - gui/widgets/virtshortcutcontainer.cpp \ - gui/widgets/virtshortcutcontainer.h \ - gui/widgets/emotepage.cpp \ - gui/widgets/emotepage.h \ - gui/widgets/itemshortcutcontainer.cpp \ - gui/widgets/itemshortcutcontainer.h \ - gui/widgets/spellshortcutcontainer.cpp \ - gui/widgets/spellshortcutcontainer.h \ - gui/widgets/statspage.cpp \ - gui/widgets/statspage.h \ - gui/widgets/statspagebasic.cpp \ - gui/widgets/statspagebasic.h \ - gui/widgets/selldialog.cpp \ - gui/widgets/selldialog.h \ - gui/widgets/tabs/setup_audio.cpp \ - gui/widgets/tabs/setup_audio.h \ - gui/widgets/tabs/setup_colors.cpp \ - gui/widgets/tabs/setup_colors.h \ - gui/widgets/tabs/setup_joystick.cpp \ - gui/widgets/tabs/setup_joystick.h \ - gui/widgets/tabs/setup_misc.cpp \ - gui/widgets/tabs/setup_misc.h \ - gui/widgets/tabs/setup_mods.cpp \ - gui/widgets/tabs/setup_mods.h \ - gui/widgets/tabs/setup_theme.cpp \ - gui/widgets/tabs/setup_theme.h \ - gui/widgets/tabs/setup_touch.cpp \ - gui/widgets/tabs/setup_touch.h \ - gui/widgets/tabs/setup_chat.cpp \ - gui/widgets/tabs/setup_chat.h \ - gui/widgets/tabs/setup_input.cpp \ - gui/widgets/tabs/setup_input.h \ - gui/widgets/tabs/setup_perfomance.cpp \ - gui/widgets/tabs/setup_perfomance.h \ - gui/widgets/tabs/setup_players.cpp \ - gui/widgets/tabs/setup_players.h \ - gui/widgets/tabs/setup_quick.cpp \ - gui/widgets/tabs/setup_quick.h \ - gui/widgets/tabs/setup_relations.cpp \ - gui/widgets/tabs/setup_relations.h \ - gui/widgets/tabs/setup_video.cpp \ - gui/widgets/tabs/setup_video.h \ - gui/widgets/tabs/setup_visual.cpp \ - gui/widgets/tabs/setup_visual.h \ - gui/widgets/serverslistbox.h \ - gui/widgets/setupbuttonitem.cpp \ - gui/widgets/setupbuttonitem.h \ - gui/widgets/setupitem.cpp \ - gui/widgets/setupitem.h \ - gui/widgets/setupquickitem.cpp \ - gui/widgets/setupquickitem.h \ - gui/widgets/tabs/setuptab.cpp \ - gui/widgets/tabs/setuptab.h \ - gui/widgets/tabs/setuptabscroll.cpp \ - gui/widgets/tabs/setuptabscroll.h \ - gui/widgets/setuptouchitem.cpp \ - gui/widgets/setuptouchitem.h \ - gui/widgets/playerbox.cpp \ - gui/widgets/playerbox.h \ - gui/models/shopitems.cpp \ - gui/models/shopitems.h \ - gui/widgets/shoplistbox.cpp \ - gui/widgets/shoplistbox.h \ - gui/widgets/shortcutcontainer.cpp \ - gui/widgets/shortcutcontainer.h \ - resources/skill/skilldata.cpp \ - resources/skill/skilldata.h \ - resources/skill/skillinfo.cpp \ - resources/skill/skillinfo.h \ - gui/widgets/skilllistbox.h \ - gui/widgets/skillrectanglelistbox.h \ - gui/widgets/tabs/shortcuttab.h \ - gui/widgets/tabs/skilltab.h \ - gui/widgets/tabs/socialattacktab.h \ - gui/widgets/tabs/socialfriendsfunctor.h \ - gui/widgets/tabs/socialfriendstab.h \ - gui/widgets/tabs/socialguildtab.h \ - gui/widgets/tabs/socialnavigationtab.h \ - gui/widgets/tabs/socialpartytab.h \ - gui/widgets/tabs/socialpickuptab.h \ - gui/widgets/tabs/socialplayerstab.h \ - gui/widgets/tabs/socialtab.h \ - gui/widgets/tabs/socialtabbase.h \ - gui/models/skillmodel.cpp \ - gui/models/skillmodel.h \ - gui/models/sortlistmodelbuy.h \ - gui/models/sortlistmodelinv.h \ - gui/models/touchactionmodel.cpp \ - gui/models/touchactionmodel.h \ - gui/models/updatetypemodel.h \ - gui/models/updatelistmodel.h \ - gui/models/worldlistmodel.h \ - gui/windowmenu.cpp \ - gui/windowmenu.h \ - gui/windows/tradewindow.cpp \ - gui/windows/tradewindow.h \ - gui/windows/updaterwindow.cpp \ - gui/windows/updaterwindow.h \ - gui/windows/whoisonline.cpp \ - gui/windows/whoisonline.h \ - gui/windows/worldselectdialog.cpp \ - gui/windows/worldselectdialog.h \ - gui/windows/shopwindow.cpp \ - gui/windows/shopwindow.h \ - gui/windows/shortcutwindow.cpp \ - gui/windows/shortcutwindow.h \ - gui/windows/skilldialog.cpp \ - gui/windows/skilldialog.h \ - gui/windows/socialwindow.cpp \ - gui/windows/socialwindow.h \ - gui/windows/statuswindow.cpp \ - gui/windows/statuswindow.h \ - gui/windows/textdialog.cpp \ - gui/windows/textdialog.h \ - gui/windows/textselectdialog.cpp \ - gui/windows/textselectdialog.h \ - gui/windows/setupwindow.cpp \ - gui/windows/setupwindow.h \ - gui/windows/serverdialog.cpp \ - gui/windows/serverdialog.h \ - gui/windows/serverinfowindow.cpp \ - gui/windows/serverinfowindow.h \ - gui/windows/quitdialog.cpp \ - gui/windows/quitdialog.h \ - gui/windows/questswindow.cpp \ - gui/windows/questswindow.h \ - gui/windows/registerdialog.cpp \ - gui/windows/registerdialog.h \ - gui/windows/buydialog.cpp \ - gui/windows/buydialog.h \ - gui/windows/buyselldialog.cpp \ - gui/windows/buyselldialog.h \ - gui/windows/changeemaildialog.cpp \ - gui/windows/changeemaildialog.h \ - gui/windows/changepassworddialog.cpp \ - gui/windows/changepassworddialog.h \ - gui/windows/charselectdialog.cpp \ - gui/windows/charselectdialog.h \ - gui/windows/charcreatedialog.cpp \ - gui/windows/charcreatedialog.h \ - gui/windows/chardeleteconfirm.h \ - gui/windows/chatwindow.cpp \ - gui/windows/chatwindow.h \ - gui/windows/connectiondialog.cpp \ - gui/windows/connectiondialog.h \ - gui/windows/debugwindow.cpp \ - gui/windows/debugwindow.h \ - gui/windows/didyouknowwindow.cpp \ - gui/windows/didyouknowwindow.h \ - gui/windows/editserverdialog.cpp \ - gui/windows/editserverdialog.h \ - gui/windows/emotewindow.cpp \ - gui/windows/emotewindow.h \ - gui/windows/equipmentwindow.cpp \ - gui/windows/equipmentwindow.h \ - gui/windows/helpwindow.cpp \ - gui/windows/helpwindow.h \ - gui/windows/inventorywindow.cpp \ - gui/windows/inventorywindow.h \ - gui/windows/itemamountwindow.cpp \ - gui/windows/itemamountwindow.h \ - gui/windows/killstats.cpp \ - gui/windows/killstats.h \ - gui/windows/logindialog.cpp \ - gui/windows/logindialog.h \ - gui/windows/minimap.cpp \ - gui/windows/minimap.h \ - gui/windows/ministatuswindow.cpp \ - gui/windows/ministatuswindow.h \ - gui/windows/npcdialog.cpp \ - gui/windows/npcdialog.h \ - gui/windows/npcselldialog.cpp \ - gui/windows/npcselldialog.h \ - gui/windows/outfitwindow.cpp \ - gui/windows/outfitwindow.h \ - gui/windows/textcommandeditor.cpp \ - gui/windows/textcommandeditor.h \ - gui/setupinputpages.cpp \ - gui/setupinputpages.h \ - input/pages/basic.cpp \ - input/pages/basic.h \ - input/pages/chat.cpp \ - input/pages/chat.h \ - input/pages/craft.cpp \ - input/pages/craft.h \ - input/pages/emotes.cpp \ - input/pages/emotes.h \ - input/pages/gui.cpp \ - input/pages/gui.h \ - input/pages/move.cpp \ - input/pages/move.h \ - input/pages/other.cpp \ - input/pages/other.h \ - input/pages/outfits.cpp \ - input/pages/outfits.h \ - input/pages/shortcuts.cpp \ - input/pages/shortcuts.h \ - input/pages/windows.cpp \ - input/pages/windows.h \ - listeners/playerpostdeathlistener.h \ - listeners/inputactionremotelistener.cpp \ - listeners/inputactionremotelistener.h \ - listeners/inputactionreplaylistener.cpp \ - listeners/inputactionreplaylistener.h \ - listeners/insertcardlistener.h \ - listeners/inventorylistener.h \ - listeners/updatestatuslistener.cpp \ - listeners/updatestatuslistener.h \ - listeners/uploadlistener.cpp \ - listeners/uploadlistener.h \ - listeners/playerlistener.cpp \ - listeners/playerlistener.h \ - listeners/playerrelationslistener.h \ - listeners/renamelistener.cpp \ - listeners/renamelistener.h \ - listeners/requesttradelistener.h \ - listeners/textskilllistener.cpp \ - listeners/textskilllistener.h \ - particle/rotationalparticle.cpp \ - particle/rotationalparticle.h \ - navigationmanager.cpp \ - navigationmanager.h \ - notifymanager.cpp \ - notifymanager.h \ - particle/imageparticle.cpp \ - particle/imageparticle.h \ - particle/particle.cpp \ - particle/particle.h \ - particle/particlecontainer.cpp \ - particle/particlecontainer.h \ - particle/particleemitter.cpp \ - particle/particleemitter.h \ - particle/particleemitterprop.h \ - particle/particleengine.cpp \ - particle/particleengine.h \ - particle/particleinfo.h \ - particle/particlelist.cpp \ - particle/particlelist.h \ - particle/particletimer.h \ - particle/particlevector.cpp \ - particle/particlevector.h \ - party.cpp \ - party.h \ - utils/chatutils.cpp \ - utils/chatutils.h \ - utils/gmfunctions.cpp \ - utils/gmfunctions.h \ - resources/db/avatardb.cpp \ - resources/db/avatardb.h \ - resources/db/badgesdb.cpp \ - resources/db/badgesdb.h \ - resources/db/chardb.cpp \ - resources/db/chardb.h \ - resources/db/colordb.cpp \ - resources/db/colordb.h \ - resources/db/commandsdb.cpp \ - resources/db/commandsdb.h \ - resources/db/deaddb.cpp \ - resources/db/deaddb.h \ - resources/db/elementaldb.cpp \ - resources/db/elementaldb.h \ - resources/db/emotedb.cpp \ - resources/db/emotedb.h \ - resources/db/groupdb.cpp \ - resources/db/groupdb.h \ - resources/db/homunculusdb.cpp \ - resources/db/homunculusdb.h \ - resources/db/horsedb.cpp \ - resources/db/horsedb.h \ - resources/db/itemdb.cpp \ - resources/db/itemdb.h \ - resources/basicstat.h \ - resources/db/itemfielddb.cpp \ - resources/db/itemfielddb.h \ - resources/db/itemoptiondb.cpp \ - resources/db/itemoptiondb.h \ - resources/db/languagedb.cpp \ - resources/db/languagedb.h \ - resources/db/mapdb.cpp \ - resources/db/mapdb.h \ - resources/db/mercenarydb.cpp \ - resources/db/mercenarydb.h \ - resources/db/moddb.cpp \ - resources/db/moddb.h \ - resources/db/monsterdb.cpp \ - resources/db/monsterdb.h \ - resources/db/networkdb.cpp \ - resources/db/networkdb.h \ - resources/db/npcdb.cpp \ - resources/db/npcdb.h \ - resources/db/npcdialogdb.cpp \ - resources/db/npcdialogdb.h \ - resources/db/palettedb.cpp \ - resources/db/palettedb.h \ - resources/db/petdb.cpp \ - resources/db/petdb.h \ - resources/db/questdb.cpp \ - resources/db/questdb.h \ - resources/db/skillunitdb.cpp \ - resources/db/skillunitdb.h \ - resources/db/sounddb.cpp \ - resources/db/sounddb.h \ - resources/db/statdb.cpp \ - resources/db/statdb.h \ - resources/db/statuseffectdb.cpp \ - resources/db/statuseffectdb.h \ - resources/db/textdb.cpp \ - resources/db/textdb.h \ - resources/db/unitsdb.cpp \ - resources/db/unitsdb.h \ - resources/db/weaponsdb.cpp \ - resources/db/weaponsdb.h \ - resources/iteminfo.h \ - resources/iteminfo.cpp \ - resources/itemmenuitem.h \ - enums/resources/cursor.h \ - enums/resources/displaytype.h \ - enums/resources/frametype.h \ - enums/resources/imageposition.h \ - enums/resources/imagetype.h \ - enums/resources/mailqueuetype.h \ - enums/resources/map/maplayertype.h \ - enums/resources/item/itemdbtype.h \ - enums/resources/item/itemsoundevent.h \ - enums/resources/item/itemtype.h \ - resources/itemtypemap.h \ - resources/itemtypemapdata.h \ - resources/mailqueue.h \ - resources/mapinfo.h \ - enums/resources/map/mapitemtype.h \ - enums/resources/map/maplayerposition.h \ - resources/mapreader.cpp \ - resources/mapreader.h \ - resources/modinfo.cpp \ - resources/modinfo.h \ - resources/beingcommon.cpp \ - resources/beingcommon.h \ - resources/beinginfo.cpp \ - resources/beinginfo.h \ - resources/beingmenuitem.h \ - resources/beingslot.cpp \ - resources/beingslot.h \ - resources/chatobject.cpp \ - resources/chatobject.h \ - resources/delayedmanager.cpp \ - resources/delayedmanager.h \ - resources/effectdescription.h \ - resources/emoteinfo.h \ - resources/emotesprite.h \ - resources/equipmentslots.h \ - resources/horseinfo.h \ - resources/horseoffset.h \ - resources/sprite/spritedisplay.h \ - resources/sprite/spritereference.h \ - resources/atlas/textureatlas.h \ - resources/updatefile.h \ - enums/resources/map/blockmask.h \ - enums/resources/map/blocktype.h \ - enums/resources/map/collisiontype.h \ - enums/resources/skill/casttype.h \ - resources/map/location.h \ - resources/map/map.cpp \ - resources/map/map.h \ - const/resources/item/cards.h \ - const/resources/item/itemoptions.h \ - const/resources/map/map.h \ - resources/map/mapheights.cpp \ - resources/map/mapheights.h \ - resources/map/mapitem.cpp \ - resources/map/mapitem.h \ - resources/map/maplayer.cpp \ - resources/map/maplayer.h \ - resources/map/mapobject.h \ - resources/map/mapobjectlist.h \ - resources/map/maprowvertexes.h \ - enums/resources/map/maptype.h \ - resources/map/metatile.h \ - resources/map/objectslayer.cpp \ - resources/map/objectslayer.h \ - particle/textparticle.cpp \ - particle/textparticle.h \ - resources/map/properties.h \ - resources/map/speciallayer.cpp \ - resources/map/speciallayer.h \ - resources/map/tileanimation.cpp \ - resources/map/tileanimation.h \ - resources/map/tileinfo.h \ - resources/map/tileset.h \ - resources/map/walklayer.cpp \ - resources/map/walklayer.h \ - net/adminhandler.h \ - net/beinghandler.h \ - net/buysellhandler.h \ - net/character.h \ - net/characters.h \ - net/charserverhandler.cpp \ - net/charserverhandler.h \ - net/chathandler.h \ - net/download.cpp \ - net/download.h \ - net/gamehandler.h \ - net/generalhandler.h \ - net/guildhandler.h \ - net/inventoryhandler.h \ - net/ea/inventoryitem.h \ - net/logindata.h \ - net/loginhandler.h \ - net/messagein.cpp \ - net/messagein.h \ - net/messageout.cpp \ - net/messageout.h \ - net/net.cpp \ - net/net.h \ - const/net/inventory.h \ - const/net/maxpacketversion.h \ - const/net/net.h \ - const/net/nostat.h \ - net/npchandler.h \ - net/partyhandler.h \ - net/pethandler.h \ - net/playerhandler.h \ - net/questhandler.h \ - net/recvpacketdefine.h \ - net/serverfeatures.h \ - net/serverinfo.h \ - net/serverurlinfo.h \ - net/skillhandler.h \ - net/tradehandler.h \ - net/updatetypeoperators.cpp \ - net/updatetypeoperators.h \ - net/uploadcharinfo.h \ - net/useragent.cpp \ - net/useragent.h \ - net/worldinfo.h \ - net/packetcounters.cpp \ - net/packetcounters.h \ - net/packetfunction.h \ - net/packetinfo.h \ - net/packetlimiter.cpp \ - net/packetlimiter.h \ - net/protocoloutdefine.h \ - net/protocoloutinclude.h \ - net/protocoloutupdate.h \ - net/ea/adminrecv.cpp \ - net/ea/adminrecv.h \ - net/ea/adminhandler.cpp \ - net/ea/adminhandler.h \ - net/ea/beingrecv.cpp \ - net/ea/beingrecv.h \ - net/ea/beinghandler.cpp \ - net/ea/beinghandler.h \ - net/ea/buysellhandler.cpp \ - net/ea/buysellhandler.h \ - net/ea/buysellrecv.cpp \ - net/ea/buysellrecv.h \ - net/ea/charserverhandler.cpp \ - net/ea/charserverhandler.h \ - net/ea/charserverrecv.cpp \ - net/ea/charserverrecv.h \ - net/ea/chathandler.cpp \ - net/ea/chathandler.h \ - net/ea/chatrecv.cpp \ - net/ea/chatrecv.h \ - net/ea/eaprotocol.h \ - net/ea/equipbackend.h \ - net/ea/gamehandler.cpp \ - net/ea/gamehandler.h \ - net/ea/gamerecv.cpp \ - net/ea/gamerecv.h \ - net/ea/inventoryhandler.cpp \ - net/ea/inventoryhandler.h \ - net/ea/inventoryrecv.cpp \ - net/ea/inventoryrecv.h \ - net/ea/itemhandler.cpp \ - net/ea/itemhandler.h \ - net/ea/itemrecv.cpp \ - net/ea/itemrecv.h \ - net/ea/loginhandler.cpp \ - net/ea/loginhandler.h \ - net/ea/loginrecv.cpp \ - net/ea/loginrecv.h \ - net/ea/network.cpp \ - net/ea/network.h \ - net/ea/maprecv.cpp \ - net/ea/maprecv.h \ - net/ea/npchandler.cpp \ - net/ea/npchandler.h \ - net/ea/npcrecv.cpp \ - net/ea/npcrecv.h \ - net/ea/partyhandler.cpp \ - net/ea/partyhandler.h \ - net/ea/partyrecv.cpp \ - net/ea/partyrecv.h \ - net/ea/playerhandler.cpp \ - net/ea/playerhandler.h \ - net/ea/playerrecv.cpp \ - net/ea/playerrecv.h \ - net/ea/skillhandler.cpp \ - net/ea/skillhandler.h \ - net/ea/skillrecv.cpp \ - net/ea/skillrecv.h \ - net/ea/token.h \ - net/ea/tradehandler.cpp \ - net/ea/tradehandler.h \ - net/ea/traderecv.cpp \ - net/ea/traderecv.h \ - progs/manaplus/actions/actions.cpp \ - progs/manaplus/actions/chat.cpp \ - progs/manaplus/actions/commands.cpp \ - progs/manaplus/actions/move.cpp \ - progs/manaplus/actions/pets.cpp \ - progs/manaplus/actions/statusbar.cpp \ - progs/manaplus/actions/tabs.cpp \ - progs/manaplus/actions/target.cpp \ - progs/manaplus/actions/windows.cpp \ - progs/manaplus/client.cpp \ - progs/manaplus/client.h \ - progs/manaplus/gui/viewport.cpp \ - progs/manaplus/gui/viewport.h - -if ENABLE_TMWA -manaplus_CXXFLAGS += -DTMWA_SUPPORT -SRC += \ - enums/magicschool.h \ - gui/models/magicschoolmodel.h \ - gui/widgets/tabs/socialguildtab2.h \ - gui/widgets/tabs/chat/emulateguildtab.cpp \ - gui/widgets/tabs/chat/emulateguildtab.h \ - gui/windows/shopselldialog.cpp \ - gui/windows/shopselldialog.h \ - net/tmwa/adminhandler.cpp \ - net/tmwa/adminhandler.h \ - net/tmwa/beingrecv.cpp \ - net/tmwa/beingrecv.h \ - net/tmwa/beinghandler.cpp \ - net/tmwa/beinghandler.h \ - net/tmwa/buysellhandler.cpp \ - net/tmwa/buysellhandler.h \ - net/tmwa/buysellrecv.cpp \ - net/tmwa/buysellrecv.h \ - net/tmwa/charserverhandler.cpp \ - net/tmwa/charserverhandler.h \ - net/tmwa/charserverrecv.cpp \ - net/tmwa/charserverrecv.h \ - net/tmwa/chathandler.cpp \ - net/tmwa/chathandler.h \ - net/tmwa/chatrecv.cpp \ - net/tmwa/chatrecv.h \ - net/tmwa/gamehandler.cpp \ - net/tmwa/gamehandler.h \ - net/tmwa/gamerecv.cpp \ - net/tmwa/gamerecv.h \ - net/tmwa/generalhandler.cpp \ - net/tmwa/generalhandler.h \ - net/tmwa/generalrecv.cpp \ - net/tmwa/generalrecv.h \ - net/tmwa/guildhandler.cpp \ - net/tmwa/guildhandler.h \ - net/tmwa/guildmanager.cpp \ - net/tmwa/guildmanager.h \ - net/tmwa/inventoryhandler.cpp \ - net/tmwa/inventoryhandler.h \ - net/tmwa/inventoryrecv.cpp \ - net/tmwa/inventoryrecv.h \ - net/tmwa/itemhandler.cpp \ - net/tmwa/itemhandler.h \ - net/tmwa/itemrecv.cpp \ - net/tmwa/itemrecv.h \ - net/tmwa/loginhandler.cpp \ - net/tmwa/loginhandler.h \ - net/tmwa/loginrecv.cpp \ - net/tmwa/loginrecv.h \ - net/tmwa/messagein.cpp \ - net/tmwa/messagein.h \ - net/tmwa/messageout.cpp \ - net/tmwa/messageout.h \ - net/tmwa/network.cpp \ - net/tmwa/network.h \ - net/tmwa/npchandler.cpp \ - net/tmwa/npchandler.h \ - net/tmwa/packetsin.inc \ - net/tmwa/packetsout.inc \ - net/tmwa/partyhandler.cpp \ - net/tmwa/partyhandler.h \ - net/tmwa/partyrecv.cpp \ - net/tmwa/partyrecv.h \ - net/tmwa/pethandler.cpp \ - net/tmwa/pethandler.h \ - net/tmwa/playerhandler.cpp \ - net/tmwa/playerhandler.h \ - net/tmwa/playerrecv.cpp \ - net/tmwa/playerrecv.h \ - net/tmwa/protocolout.cpp \ - net/tmwa/protocolout.h \ - net/tmwa/questhandler.cpp \ - net/tmwa/questhandler.h \ - net/tmwa/questrecv.cpp \ - net/tmwa/questrecv.h \ - net/tmwa/recvpackets.inc \ - net/tmwa/serverfeatures.cpp \ - net/tmwa/serverfeatures.h \ - net/tmwa/skillhandler.cpp \ - net/tmwa/skillhandler.h \ - net/tmwa/skillrecv.cpp \ - net/tmwa/skillrecv.h \ - net/tmwa/sp.h \ - net/tmwa/sprite.h \ - net/tmwa/tradehandler.cpp \ - net/tmwa/tradehandler.h \ - net/tmwa/traderecv.cpp \ - net/tmwa/traderecv.h \ - net/tmwa/updateprotocol.cpp \ - net/tmwa/updateprotocol.h \ - net/tmwa/auctionhandler.cpp \ - net/tmwa/auctionhandler.h \ - net/tmwa/bankhandler.cpp \ - net/tmwa/bankhandler.h \ - net/tmwa/battlegroundhandler.cpp \ - net/tmwa/battlegroundhandler.h \ - net/tmwa/buyingstorehandler.cpp \ - net/tmwa/buyingstorehandler.h \ - net/tmwa/cashshophandler.cpp \ - net/tmwa/cashshophandler.h \ - net/tmwa/elementalhandler.cpp \ - net/tmwa/elementalhandler.h \ - net/tmwa/familyhandler.cpp \ - net/tmwa/familyhandler.h \ - net/tmwa/friendshandler.cpp \ - net/tmwa/friendshandler.h \ - net/tmwa/homunculushandler.cpp \ - net/tmwa/homunculushandler.h \ - net/tmwa/mailhandler.cpp \ - net/tmwa/mailhandler.h \ - net/tmwa/mail2handler.cpp \ - net/tmwa/mail2handler.h \ - net/tmwa/maphandler.cpp \ - net/tmwa/maphandler.h \ - net/tmwa/markethandler.cpp \ - net/tmwa/markethandler.h \ - net/tmwa/mercenaryhandler.cpp \ - net/tmwa/mercenaryhandler.h \ - net/tmwa/roulettehandler.cpp \ - net/tmwa/roulettehandler.h \ - net/tmwa/searchstorehandler.cpp \ - net/tmwa/searchstorehandler.h \ - net/tmwa/vendinghandler.cpp \ - net/tmwa/vendinghandler.h -endif - -SRC += gui/windows/bankwindow.cpp \ - gui/windows/bankwindow.h \ - gui/windows/buyingstoreselldialog.cpp \ - gui/windows/buyingstoreselldialog.h \ - gui/windows/cutinwindow.cpp \ - gui/windows/cutinwindow.h \ - gui/windows/eggselectiondialog.cpp \ - gui/windows/eggselectiondialog.h \ - gui/windows/insertcarddialog.cpp \ - gui/windows/insertcarddialog.h \ - gui/windows/maileditwindow.cpp \ - gui/windows/maileditwindow.h \ - gui/windows/mailviewwindow.cpp \ - gui/windows/mailviewwindow.h \ - gui/windows/mailwindow.cpp \ - gui/windows/mailwindow.h \ - enums/cutin.h \ - listeners/banklistener.cpp \ - listeners/banklistener.h \ - listeners/buyingstoremodelistener.cpp \ - listeners/buyingstoremodelistener.h \ - listeners/buyingstoreslotslistener.cpp \ - listeners/buyingstoreslotslistener.h \ - listeners/pincodelistener.cpp \ - listeners/pincodelistener.h \ - listeners/requestadoptchildlistener.h \ - listeners/shoprenamelistener.cpp \ - listeners/shoprenamelistener.h \ - listeners/skillwarplistener.cpp \ - listeners/skillwarplistener.h \ - listeners/vendingmodelistener.cpp \ - listeners/vendingmodelistener.h \ - listeners/vendingslotslistener.cpp \ - listeners/vendingslotslistener.h \ - resources/inventory/complexinventory.cpp \ - resources/inventory/complexinventory.h \ - net/auctionhandler.h \ - net/bankhandler.h \ - net/battlegroundhandler.h \ - net/buyingstorehandler.h \ - net/cashshophandler.h \ - net/elementalhandler.h \ - net/familyhandler.h \ - net/friendshandler.h \ - net/homunculushandler.h \ - net/hostsgroup.h \ - net/mailhandler.h \ - net/mail2handler.h \ - net/maphandler.h \ - net/markethandler.h \ - net/mercenaryhandler.h \ - net/roulettehandler.h \ - net/searchstorehandler.h \ - net/vendinghandler.h \ - net/eathena/adminrecv.cpp \ - net/eathena/adminrecv.h \ - net/eathena/adminhandler.cpp \ - net/eathena/adminhandler.h \ - net/eathena/auctionrecv.cpp \ - net/eathena/auctionrecv.h \ - net/eathena/auctionhandler.cpp \ - net/eathena/auctionhandler.h \ - net/eathena/bankrecv.cpp \ - net/eathena/bankrecv.h \ - net/eathena/bankhandler.cpp \ - net/eathena/bankhandler.h \ - net/eathena/battlegroundrecv.cpp \ - net/eathena/battlegroundrecv.h \ - net/eathena/battlegroundhandler.cpp \ - net/eathena/battlegroundhandler.h \ - net/eathena/cashshophandler.cpp \ - net/eathena/cashshophandler.h \ - net/eathena/cashshoprecv.cpp \ - net/eathena/cashshoprecv.h \ - net/eathena/beingrecv.cpp \ - net/eathena/beingrecv.h \ - net/eathena/beinghandler.cpp \ - net/eathena/beinghandler.h \ - net/eathena/buyingstorehandler.cpp \ - net/eathena/buyingstorehandler.h \ - net/eathena/buyingstorerecv.cpp \ - net/eathena/buyingstorerecv.h \ - enums/net/beingtype.h \ - net/eathena/buysellhandler.cpp \ - net/eathena/buysellhandler.h \ - net/eathena/buysellrecv.cpp \ - net/eathena/buysellrecv.h \ - net/eathena/charserverhandler.cpp \ - net/eathena/charserverhandler.h \ - net/eathena/charserverrecv.cpp \ - net/eathena/charserverrecv.h \ - net/eathena/chathandler.cpp \ - net/eathena/chathandler.h \ - net/eathena/chatrecv.cpp \ - net/eathena/chatrecv.h \ - net/eathena/elementalhandler.cpp \ - net/eathena/elementalhandler.h \ - net/eathena/elementalrecv.cpp \ - net/eathena/elementalrecv.h \ - net/eathena/familyhandler.cpp \ - net/eathena/familyhandler.h \ - net/eathena/familyrecv.cpp \ - net/eathena/familyrecv.h \ - net/eathena/friendshandler.cpp \ - net/eathena/friendshandler.h \ - net/eathena/friendsrecv.cpp \ - net/eathena/friendsrecv.h \ - net/eathena/gamehandler.cpp \ - net/eathena/gamehandler.h \ - net/eathena/gamerecv.cpp \ - net/eathena/gamerecv.h \ - net/eathena/generalhandler.cpp \ - net/eathena/generalhandler.h \ - net/eathena/generalrecv.cpp \ - net/eathena/generalrecv.h \ - net/eathena/guildhandler.cpp \ - net/eathena/guildhandler.h \ - net/eathena/guildrecv.cpp \ - net/eathena/guildrecv.h \ - net/eathena/homunculushandler.cpp \ - net/eathena/homunculushandler.h \ - net/eathena/homunculusrecv.cpp \ - net/eathena/homunculusrecv.h \ - net/eathena/inventoryhandler.cpp \ - net/eathena/inventoryhandler.h \ - net/eathena/inventoryrecv.cpp \ - net/eathena/inventoryrecv.h \ - net/eathena/itemflags.h \ - net/eathena/itemhandler.cpp \ - net/eathena/itemhandler.h \ - net/eathena/itemrecv.cpp \ - net/eathena/itemrecv.h \ - net/eathena/loginhandler.cpp \ - net/eathena/loginhandler.h \ - net/eathena/loginrecv.cpp \ - net/eathena/loginrecv.h \ - net/eathena/mail2handler.cpp \ - net/eathena/mail2handler.h \ - net/eathena/mail2recv.cpp \ - net/eathena/mail2recv.h \ - net/eathena/mailhandler.cpp \ - net/eathena/mailhandler.h \ - net/eathena/mailrecv.cpp \ - net/eathena/mailrecv.h \ - net/eathena/maphandler.cpp \ - net/eathena/maphandler.h \ - net/eathena/maprecv.cpp \ - net/eathena/maprecv.h \ - net/eathena/maptypeproperty2.h \ - net/eathena/markethandler.cpp \ - net/eathena/markethandler.h \ - net/eathena/marketrecv.cpp \ - net/eathena/marketrecv.h \ - net/eathena/menu.cpp \ - net/eathena/menu.h \ - enums/net/menutype.h \ - net/eathena/mercenaryhandler.cpp \ - net/eathena/mercenaryhandler.h \ - net/eathena/mercenaryrecv.cpp \ - net/eathena/mercenaryrecv.h \ - net/eathena/messagein.cpp \ - net/eathena/messagein.h \ - net/eathena/messageout.cpp \ - net/eathena/messageout.h \ - net/eathena/network.cpp \ - net/eathena/network.h \ - net/eathena/npchandler.cpp \ - net/eathena/npchandler.h \ - net/eathena/npcrecv.cpp \ - net/eathena/npcrecv.h \ - net/eathena/packetsin.inc \ - net/eathena/packetsout.inc \ - net/eathena/partyhandler.cpp \ - net/eathena/partyhandler.h \ - net/eathena/partyrecv.cpp \ - net/eathena/partyrecv.h \ - net/eathena/pethandler.cpp \ - net/eathena/pethandler.h \ - net/eathena/petrecv.cpp \ - net/eathena/petrecv.h \ - net/eathena/playerhandler.cpp \ - net/eathena/playerhandler.h \ - net/eathena/playerrecv.cpp \ - net/eathena/playerrecv.h \ - net/eathena/protocolout.cpp \ - net/eathena/protocolout.h \ - net/eathena/questhandler.cpp \ - net/eathena/questhandler.h \ - net/eathena/questrecv.cpp \ - net/eathena/questrecv.h \ - net/eathena/recvpackets.inc \ - net/eathena/roulettehandler.cpp \ - net/eathena/roulettehandler.h \ - net/eathena/rouletterecv.cpp \ - net/eathena/rouletterecv.h \ - net/eathena/searchstorehandler.cpp \ - net/eathena/searchstorehandler.h \ - net/eathena/searchstorerecv.cpp \ - net/eathena/searchstorerecv.h \ - net/eathena/serverfeatures.cpp \ - net/eathena/serverfeatures.h \ - net/eathena/skillhandler.cpp \ - net/eathena/skillhandler.h \ - net/eathena/skillrecv.cpp \ - net/eathena/skillrecv.h \ - net/eathena/sp.h \ - net/eathena/sprite.h \ - net/eathena/tradehandler.cpp \ - net/eathena/tradehandler.h \ - net/eathena/traderecv.cpp \ - net/eathena/traderecv.h \ - net/eathena/updateprotocol.cpp \ - net/eathena/updateprotocol.h \ - net/eathena/vendinghandler.cpp \ - net/eathena/vendinghandler.h \ - net/eathena/vendingrecv.cpp \ - net/eathena/vendingrecv.h - -SRC += \ - mumblemanager.cpp \ - mumblemanager.h - -dyecmd_SOURCES += progs/dyecmd/gui/viewport.cpp \ - progs/dyecmd/gui/viewport.h \ - progs/dyecmd/client.cpp \ - progs/dyecmd/client.h \ - progs/dyecmd/actions/actions.cpp \ - progs/dyecmd/actions/chat.cpp \ - progs/dyecmd/actions/commands.cpp \ - progs/dyecmd/actions/move.cpp \ - progs/dyecmd/actions/pets.cpp \ - progs/dyecmd/actions/statusbar.cpp \ - progs/dyecmd/actions/tabs.cpp \ - progs/dyecmd/actions/target.cpp \ - progs/dyecmd/actions/windows.cpp - -if ENABLE_MANAPLUSGAME -manaplus_SOURCES += ${SRC} -endif - -manaplustests_CXXFLAGS += ${manaplus_CXXFLAGS} \ - -DUNITTESTS -manaplustests_LDFLAGS = -if ENABLE_PUGIXML -manaplustests_CXXFLAGS += -DENABLE_PUGIXML -endif -if ENABLE_LIBXML -manaplustests_CXXFLAGS += -DENABLE_LIBXML -endif -if ENABLE_TINYXML2 -manaplustests_CXXFLAGS += -DENABLE_TINYXML2 -endif -if USE_SDL2 -manaplustests_CXXFLAGS += -DUSE_SDL2 -endif -if ENABLE_WERROR -manaplustests_CXXFLAGS += -Werror -endif -if ENABLE_ASSERTS -manaplustests_CXXFLAGS += -DENABLE_ASSERTS -if HAVE_RDYNAMIC -manaplustests_LDFLAGS += -rdynamic -endif -endif -if HAVE_EXECINFO -manaplustests_CXXFLAGS += -DHAVE_EXECINFO -endif -if ENABLE_GLIBCDEBUG -manaplustests_CXXFLAGS += -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -endif -if USE_X11 -manaplustests_CXXFLAGS += -DUSE_X11 -endif -if ENABLE_OPENGLERRORS -manaplustests_CXXFLAGS += -DOPENGLERRORS -endif - -manaplustests_SOURCES = \ - unittests/unittests.h \ - unittests/enums/render/mockdrawtype.h \ - unittests/render/mockdrawitem.h \ - unittests/render/mockgraphics.cc \ - unittests/render/mockgraphics.h \ - unittests/endian.cc \ - unittests/enums/enums.cc \ - unittests/sdl.cc \ - unittests/utils/dumplibs.cc \ - unittests/utils/checkutils.cc - -if ENABLE_UNITTESTS_CATCH -manaplustests_SOURCES += \ - unittests/catch.hpp -endif -if ENABLE_UNITTESTS_DOCTEST -manaplustests_SOURCES += \ - unittests/doctest.h -endif - -if MINGW -manaplustests_SOURCES += manaplus.rc -manaplustests_LDFLAGS += -mconsole -endif - -manaplustests_SOURCES += \ - unittests/fs/virtfs/virtfs1_basic.cc \ - unittests/fs/virtfs/virtfs1_enumerate.cc \ - unittests/fs/virtfs/virtfs1_exists.cc \ - unittests/fs/virtfs/virtfs1_getrealdir.cc \ - unittests/fs/virtfs/virtfs1_mountdir1.cc \ - unittests/fs/virtfs/virtfs1_mountdir2.cc \ - unittests/fs/virtfs/virtfs1_mountzip1.cc \ - unittests/fs/virtfs/virtfs1_mountzip2.cc \ - unittests/fs/virtfs/virtfs1_unmount.cc \ - unittests/fs/virtfs/virtfs2.cc \ - unittests/fs/virtfs/zip.cc \ - unittests/fs/virtfs/virtfs.cc \ - unittests/fs/virtfs/throw.cc \ - unittests/utils/xml.cc \ - unittests/configuration.cc \ - unittests/utils/timer.cc \ - unittests/utils/xmlutils.cc \ - unittests/utils/mathutils.cc \ - unittests/fs/files.cc \ - unittests/utils/stringutils.cc \ - unittests/utils/parameters.cc \ - unittests/resources/mstack.cc \ - unittests/utils/translation/poparser.cc \ - unittests/utils/langs.cc \ - unittests/resources/sprite/animatedsprite.cc \ - unittests/gui/fonts/textchunklist.cc \ - unittests/gui/widgets/browserbox.cc \ - unittests/resources/dye/dye.cc \ - unittests/resources/dye/dyepalette.cc \ - unittests/integrity.cc \ - unittests/utils/chatutils.cc \ - unittests/resources/map/speciallayer.cc \ - unittests/resources/map/maplayer/draw.cc \ - unittests/resources/map/maplayer/drawfringenormal.cc \ - unittests/resources/map/maplayer/drawfringesimple.cc \ - unittests/resources/map/maplayer/drawspeciallayer1.cc \ - unittests/resources/map/maplayer/drawspeciallayer2.cc \ - unittests/resources/map/maplayer/getemptytiledrawwidth.cc \ - unittests/resources/map/maplayer/gettiledrawwidth.cc \ - unittests/resources/map/maplayer/updatecache.cc \ - unittests/resources/map/maplayer/updateconditiontiles.cc \ - unittests/resources/resourcemanager/resourcemanager.cc \ - unittests/resources/sdlimagehelper.cc \ - unittests/gui/windowmanager.cc - -manaplustests_SOURCES += ${SRC} - -if ENABLE_UNITTESTS -TESTS = manaplustests -check_PROGRAMS = manaplustests -endif - -EXTRA_DIST = CMakeLists.txt \ - winver.h.in \ - manaplus.rc \ - SDLMain.m - -# set the include path found by configure -AM_CPPFLAGS = $(all_includes) diff --git a/src/SDLMain.m b/src/SDLMain.m deleted file mode 100644 index d7e9273bc..000000000 --- a/src/SDLMain.m +++ /dev/null @@ -1,385 +0,0 @@ -/* SDLMain.m - main entry point for our Cocoa-ized SDL app - Initial Version: Darrell Walisser - Non-NIB-Code & other changes: Max Horn - - Feel free to customize this file to suit your needs - */ - -#import "SDL.h" -#import "SDLMain.h" -#import /* for MAXPATHLEN */ -#import - -/* For some reaon, Apple removed setAppleMenu from the headers in 10.4, - but the method still is there and works. To avoid warnings, we declare - it ourselves here. */ -@interface NSApplication(SDL_Missing_Methods) -- (void)setAppleMenu:(NSMenu *)menu; -@end - -/* Use this flag to determine whether we use SDLMain.nib or not */ -#define SDL_USE_NIB_FILE 0 - -/* Use this flag to determine whether we use CPS (docking) or not */ -#define SDL_USE_CPS 1 -#ifdef SDL_USE_CPS -/* Portions of CPS.h */ -typedef struct CPSProcessSerNum - { - UInt32 lo; - UInt32 hi; - } CPSProcessSerNum; - -extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn); -extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5); -extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn); - -#endif /* SDL_USE_CPS */ - -static int gArgc; -static char **gArgv; -static BOOL gFinderLaunch; -static BOOL gCalledAppMainline = FALSE; - -static NSString *getApplicationName(void) -{ - NSDictionary *dict; - NSString *appName = 0; - - /* Determine the application name */ - dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); - if (dict) - appName = [dict objectForKey: @"CFBundleName"]; - - if (![appName length]) - appName = [[NSProcessInfo processInfo] processName]; - - return appName; -} - -#if SDL_USE_NIB_FILE -/* A helper category for NSString */ -@interface NSString (ReplaceSubString) -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; -@end -#endif - -@interface SDLApplication : NSApplication -@end - -@implementation SDLApplication -/* Invoked from the Quit menu item */ -- (void)terminate:(id)sender -{ - /* Post a SDL_QUIT event */ - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); -} -@end - -/* The main class of the application, the application's delegate */ -@implementation SDLMain - -/* Set the working directory to the .app's parent directory */ -- (void) setupWorkingDirectory:(BOOL)shouldChdir -{ - if (shouldChdir) - { - char parentdir[MAXPATHLEN]; - CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); - CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url); - if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) { - assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ - } - CFRelease(url); - CFRelease(url2); - } - -} - -#if SDL_USE_NIB_FILE - -/* Fix menu to contain the real app name instead of "SDL App" */ -- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName -{ - NSRange aRange; - NSEnumerator *enumerator; - NSMenuItem *menuItem; - - aRange = [[aMenu title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]]; - - enumerator = [[aMenu itemArray] objectEnumerator]; - while ((menuItem = [enumerator nextObject])) - { - aRange = [[menuItem title] rangeOfString:@"SDL App"]; - if (aRange.length != 0) - [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]]; - if ([menuItem hasSubmenu]) - [self fixMenu:[menuItem submenu] withAppName:appName]; - } - [ aMenu sizeToFit ]; -} - -#else - -static void setApplicationMenu(void) -{ - /* warning: this code is very odd */ - NSMenu *appleMenu; - NSMenuItem *menuItem; - NSString *title; - NSString *appName; - - appName = getApplicationName(); - appleMenu = [[NSMenu alloc] initWithTitle:@""]; - - /* Add menu items */ - title = [@"About " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Hide " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; - - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; - - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - - [appleMenu addItem:[NSMenuItem separatorItem]]; - - title = [@"Quit " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; - - - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:appleMenu]; - [[NSApp mainMenu] addItem:menuItem]; - - /* Tell the application object that this is now the application menu */ - [NSApp setAppleMenu:appleMenu]; - - /* Finally give up our references to the objects */ - [appleMenu release]; - [menuItem release]; -} - -/* Create a window menu */ -static void setupWindowMenu(void) -{ - NSMenu *windowMenu; - NSMenuItem *windowMenuItem; - NSMenuItem *menuItem; - - windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - - /* "Minimize" item */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; - [windowMenu addItem:menuItem]; - [menuItem release]; - - /* Put menu into the menubar */ - windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; - [windowMenuItem setSubmenu:windowMenu]; - [[NSApp mainMenu] addItem:windowMenuItem]; - - /* Tell the application object that this is now the window menu */ - [NSApp setWindowsMenu:windowMenu]; - - /* Finally give up our references to the objects */ - [windowMenu release]; - [windowMenuItem release]; -} - -/* Replacement for NSApplicationMain */ -static void CustomApplicationMain (int argc, char **argv) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - SDLMain *sdlMain; - - /* Ensure the application object is initialised */ - [SDLApplication sharedApplication]; - -#ifdef SDL_USE_CPS - { - CPSProcessSerNum PSN; - /* Tell the dock about us */ - if (!CPSGetCurrentProcess(&PSN)) - if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103)) - if (!CPSSetFrontProcess(&PSN)) - [SDLApplication sharedApplication]; - } -#endif /* SDL_USE_CPS */ - - /* Set up the menubar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; - setApplicationMenu(); - setupWindowMenu(); - - /* Create SDLMain and make it the app delegate */ - sdlMain = [[SDLMain alloc] init]; - [NSApp setDelegate:sdlMain]; - - /* Start the main event loop */ - [NSApp run]; - - [sdlMain release]; - [pool release]; -} - -#endif - - -/* - * Catch document open requests...this lets us notice files when the app - * was launched by double-clicking a document, or when a document was - * dragged/dropped on the app's icon. You need to have a - * CFBundleDocumentsType section in your Info.plist to get this message, - * apparently. - * - * Files are added to gArgv, so to the app, they'll look like command line - * arguments. Previously, apps launched from the finder had nothing but - * an argv[0]. - * - * This message may be received multiple times to open several docs on launch. - * - * This message is ignored once the app's mainline has been called. - */ -- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename -{ - const char *temparg; - size_t arglen; - char *arg; - char **newargv; - - if (!gFinderLaunch) /* MacOS is passing command line args. */ - return FALSE; - - if (gCalledAppMainline) /* app has started, ignore this document. */ - return FALSE; - - temparg = [filename UTF8String]; - arglen = SDL_strlen(temparg) + 1; - arg = (char *) SDL_malloc(arglen); - if (arg == NULL) - return FALSE; - - newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2)); - if (newargv == NULL) - { - SDL_free(arg); - return FALSE; - } - gArgv = newargv; - - SDL_strlcpy(arg, temparg, arglen); - gArgv[gArgc++] = arg; - gArgv[gArgc] = NULL; - return TRUE; -} - - -/* Called when the internal event loop has just started running */ -- (void) applicationDidFinishLaunching: (NSNotification *) note -{ - int status; - - /* Set the working directory to the .app's parent directory */ - [self setupWorkingDirectory:gFinderLaunch]; - -#if SDL_USE_NIB_FILE - /* Set the main menu to contain the real app name instead of "SDL App" */ - [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()]; -#endif - - /* Hand off to main application code */ - gCalledAppMainline = TRUE; - status = SDL_main (gArgc, gArgv); - - /* We're done, thank you for playing */ - exit(status); -} -@end - - -@implementation NSString (ReplaceSubString) - -- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString -{ - unsigned int bufferSize; - unsigned int selfLen = [self length]; - unsigned int aStringLen = [aString length]; - unichar *buffer; - NSRange localRange; - NSString *result; - - bufferSize = selfLen + aStringLen - aRange.length; - buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar)); - - /* Get first part into buffer */ - localRange.location = 0; - localRange.length = aRange.location; - [self getCharacters:buffer range:localRange]; - - /* Get middle part into buffer */ - localRange.location = 0; - localRange.length = aStringLen; - [aString getCharacters:(buffer+aRange.location) range:localRange]; - - /* Get last part into buffer */ - localRange.location = aRange.location + aRange.length; - localRange.length = selfLen - localRange.location; - [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange]; - - /* Build output string */ - result = [NSString stringWithCharacters:buffer length:bufferSize]; - - NSDeallocateMemoryPages(buffer, bufferSize); - - return result; -} - -@end - - - -#ifdef main -# undef main -#endif - - -/* Main entry point to executable - should *not* be SDL_main! */ -int main (int argc, char **argv) -{ - /* Copy the arguments into a global variable */ - /* This is passed if we are launched by double-clicking */ - if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { - gArgv = (char **) SDL_malloc(sizeof (char *) * 2); - gArgv[0] = argv[0]; - gArgv[1] = NULL; - gArgc = 1; - gFinderLaunch = YES; - } - else - { - int i; - gArgc = argc; - gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1)); - for (i = 0; i <= argc; i++) - gArgv[i] = argv[i]; - gFinderLaunch = NO; - } - -#if SDL_USE_NIB_FILE - [SDLApplication poseAsClass:[NSApplication class]]; - NSApplicationMain (argc, argv); -#else - CustomApplicationMain (argc, argv); -#endif - return 0; -} diff --git a/src/actions/actiondef.h b/src/actions/actiondef.h deleted file mode 100644 index 7465b8521..000000000 --- a/src/actions/actiondef.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ACTIONS_ACTIONDEF_H -#define ACTIONS_ACTIONDEF_H - -#include "gamemodifiers.h" -#include "settings.h" -GAMEMODIFIERS_H -SETTINGS_H - -#include "input/inputmanager.h" -INPUT_INPUTMANAGER_H - -#define impHandler(name) bool name(InputEvent &event) -#define impHandler0(name) bool name(InputEvent &event A_UNUSED) -#define impHandlerVoid(name) bool name(InputEvent &event A_UNUSED) \ - { \ - return false; \ - } - -#define callYellowBar(name) \ - GameModifiers::name(!inputManager.isActionActive( \ - InputAction::STOP_ATTACK)); \ - return true; - -#define callYellowBarCond(name) \ - if (!settings.disableGameModifiers) \ - { \ - GameModifiers::name(!inputManager.isActionActive( \ - InputAction::STOP_ATTACK)); \ - return true; \ - } \ - return false; - -#endif // ACTIONS_ACTIONDEF_H diff --git a/src/actions/actionfuncptr.h b/src/actions/actionfuncptr.h deleted file mode 100644 index c68c66a57..000000000 --- a/src/actions/actionfuncptr.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_ACTIONFUNCPTR_H -#define ACTIONS_ACTIONFUNCPTR_H - -#include "events/inputevent.h" - -typedef bool (*ActionFuncPtr) (InputEvent &event); - -#endif // ACTIONS_ACTIONFUNCPTR_H diff --git a/src/actions/actions.h b/src/actions/actions.h deleted file mode 100644 index 83072680c..000000000 --- a/src/actions/actions.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_ACTIONS_H -#define ACTIONS_ACTIONS_H - -#include "localconsts.h" - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(emote); - decHandler(outfit); - decHandler(mouseClick); - decHandler(ok); - decHandler(shortcut); - decHandler(quit); - decHandler(dropItem0); - decHandler(dropItem); - decHandler(dropItemId); - decHandler(dropItemInv); - decHandler(dropItemIdAll); - decHandler(dropItemInvAll); - decHandler(heal); - decHandler(healmd); - decHandler(itenplz); - decHandler(setHome); - decHandler(magicAttack); - decHandler(copyEquippedToOutfit); - decHandler(pickup); - decHandler(sit); - decHandler(screenshot); - decHandler(ignoreInput); - decHandler(talk); - decHandler(buy); - decHandler(sell); - decHandler(stopAttack); - decHandler(untarget); - decHandler(attack); - decHandler(targetAttack); - decHandler(safeVideoMode); - decHandler(stopSit); - decHandler(showKeyboard); - decHandler(showWindows); - decHandler(openTrade); - decHandler(ipcToggle); - decHandler(where); - decHandler(who); - decHandler(cleanGraphics); - decHandler(cleanFonts); - decHandler(attackHuman); - decHandler(trade); - decHandler(priceLoad); - decHandler(priceSave); - decHandler(cacheInfo); - decHandler(disconnect); - decHandler(undress); - decHandler(dirs); - decHandler(uptime); - decHandler(dump); - decHandler(serverIgnoreAll); - decHandler(serverUnIgnoreAll); - decHandler(error) -#ifndef BAD_CILKPLUS - __attribute__ ((noreturn)) -#endif // BAD_CILKPLUS - ; - decHandler(dumpGraphics); - decHandler(dumpEnvironment); - decHandler(dumpTests); - decHandler(dumpOGL); - decHandler(dumpGL); - decHandler(dumpMods); -#if defined USE_OPENGL && defined DEBUG_SDLFONT - decHandler(testSdlFont); -#endif // defined USE_OPENGL && defined DEBUG_SDLFONT - - decHandler(createItems); - decHandler(createItem); - decHandler(uploadConfig); - decHandler(uploadServerConfig); - decHandler(uploadLog); - decHandler(mercenaryFire); - decHandler(mercenaryToMaster); - decHandler(homunculusToMaster); - decHandler(homunculusFeed); - decHandler(useItem); - decHandler(useItemInv); - decHandler(invToStorage); - decHandler(tradeAdd); - decHandler(storageToInv); - decHandler(protectItem); - decHandler(unprotectItem); - decHandler(kick); - decHandler(clearDrop); - decHandler(testInfo); - decHandler(craftKey); - decHandler(resetGameModifiers); - decHandler(barToChat); - decHandler(seen); - decHandler(dumpMemoryUsage); - decHandler(setEmoteType); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_ACTIONS_H diff --git a/src/actions/chat.h b/src/actions/chat.h deleted file mode 100644 index 0e3c362a7..000000000 --- a/src/actions/chat.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_CHAT_H -#define ACTIONS_CHAT_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(toggleChat); - decHandler(prevChatTab); - decHandler(nextChatTab); - decHandler(closeChatTab); - decHandler(closeAllChatTabs); - decHandler(ignoreAllWhispers); - decHandler(scrollChatUp); - decHandler(scrollChatDown); - decHandler(msg); - decHandler(msgText); - decHandler(msg2); - decHandler(query); - decHandler(clearChatTab); - decHandler(createParty); - decHandler(createGuild); - decHandler(party); - decHandler(guild); - decHandler(me); - decHandler(toggle); - decHandler(kickParty); - decHandler(kickGuild); - decHandler(addText); - decHandler(clearChat); - decHandler(chatGeneralTab); - decHandler(chatDebugTab); - decHandler(chatBattleTab); - decHandler(chatTradeTab); - decHandler(chatLangTab); - decHandler(chatGmTab); - decHandler(chatPartyTab); - decHandler(chatGuildTab); - decHandler(hat); - decHandler(chatClipboard); - decHandler(guildNotice); - decHandler(translate); - decHandler(sendGuiKey); - decHandler(sendMouseKey); - decHandler(sendChars); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_CHAT_H diff --git a/src/actions/commands.h b/src/actions/commands.h deleted file mode 100644 index 414e20658..000000000 --- a/src/actions/commands.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_COMMANDS_H -#define ACTIONS_COMMANDS_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(chatAnnounce); - decHandler(chatIgnore); - decHandler(chatUnignore); - decHandler(chatFriend); - decHandler(chatDisregard); - decHandler(chatNeutral); - decHandler(chatBlackList); - decHandler(chatEnemy); - decHandler(chatErase); - decHandler(chatNuke); - decHandler(chatAdd); - decHandler(present); - decHandler(printAll); - decHandler(move); - decHandler(setTarget); - decHandler(commandOutfit); - decHandler(commandEmote); - decHandler(awayMessage); - decHandler(pseudoAway); - decHandler(follow); - decHandler(navigate); - decHandler(navigateTo); - decHandler(moveCamera); - decHandler(restoreCamera); - decHandler(imitation); - decHandler(sendMail); - decHandler(info); - decHandler(wait); - decHandler(addPriorityAttack); - decHandler(addAttack); - decHandler(removeAttack); - decHandler(addIgnoreAttack); - decHandler(setDrop); - decHandler(url); - decHandler(openUrl); - decHandler(execute); - decHandler(enableHighlight); - decHandler(disableHighlight); - decHandler(dontRemoveName); - decHandler(removeName); - decHandler(disableAway); - decHandler(enableAway); - decHandler(testParticle); - decHandler(talkRaw); - decHandler(gm); - decHandler(hack); - decHandler(debugSpawn); - decHandler(serverIgnoreWhisper); - decHandler(serverUnIgnoreWhisper); - decHandler(setHomunculusName); - decHandler(fireHomunculus); - decHandler(leaveParty); - decHandler(leaveGuild); - decHandler(warp); - decHandler(homunTalk); - decHandler(homunEmote); - decHandler(commandHomunEmote); - decHandler(createPublicChatRoom); - decHandler(joinChatRoom); - decHandler(leaveChatRoom); - decHandler(confSet); - decHandler(serverConfSet); - decHandler(confGet); - decHandler(serverConfGet); - decHandler(slide); - decHandler(selectSkillLevel); - decHandler(skill); - decHandler(craft); - decHandler(npcClipboard); - decHandler(clipboardCopy); - decHandler(addPickup); - decHandler(removePickup); - decHandler(ignorePickup); - decHandler(monsterInfo); - decHandler(itemInfo); - decHandler(whoDrops); - decHandler(mobSearch); - decHandler(mobSpawnSearch); - decHandler(playerGmCommands); - decHandler(playerCharGmCommands); - decHandler(commandShowLevel); - decHandler(commandShowStats); - decHandler(commandShowStorage); - decHandler(commandShowCart); - decHandler(commandShowInventory); - decHandler(locatePlayer); - decHandler(commandShowAccountInfo); - decHandler(commandSpawn); - decHandler(commandSpawnSlave); - decHandler(commandSpawnClone); - decHandler(commandSpawnSlaveClone); - decHandler(commandSpawnEvilClone); - decHandler(commandSavePosition); - decHandler(commandLoadPosition); - decHandler(commandRandomWarp); - decHandler(commandGotoNpc); - decHandler(commandGotoPc); - decHandler(commandRecallPc); - decHandler(commandIpCheck); - decHandler(commandKiller); - decHandler(commandKillable); - decHandler(commandHeal); - decHandler(commandAlive); - decHandler(commandDisguise); - decHandler(commandImmortal); - decHandler(commandHide); - decHandler(commandNuke); - decHandler(commandKill); - decHandler(commandJail); - decHandler(commandUnjail); - decHandler(commandNpcMove); - decHandler(commandNpcHide); - decHandler(commandNpcShow); - decHandler(commandChangePartyLeader); - decHandler(commandPartyRecall); - decHandler(commandBreakGuild); - decHandler(commandGuildRecall); - decHandler(mailTo); - decHandler(adoptChild); - decHandler(showSkillLevels); - decHandler(showSkillType); - decHandler(selectSkillType); - decHandler(showSkillOffsetX); - decHandler(showSkillOffsetY); - decHandler(setSkillOffsetX); - decHandler(setSkillOffsetY); - decHandler(partyItemShare); - decHandler(partyExpShare); - decHandler(partyAutoItemShare); - decHandler(outfitToChat); - decHandler(outfitClear); - decHandler(moveAttackUp); - decHandler(moveAttackDown); - decHandler(movePriorityAttackUp); - decHandler(movePriorityAttackDown); - decHandler(addSkillShortcut); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_COMMANDS_H diff --git a/src/actions/move.h b/src/actions/move.h deleted file mode 100644 index 362cc254e..000000000 --- a/src/actions/move.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_MOVE_H -#define ACTIONS_MOVE_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(moveUp); - decHandler(moveDown); - decHandler(moveLeft); - decHandler(moveRight); - decHandler(moveForward); - decHandler(moveToPoint); - decHandler(crazyMoves); - decHandler(moveToTarget); - decHandler(moveToHome); - decHandler(directUp); - decHandler(directDown); - decHandler(directLeft); - decHandler(directRight); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_MOVE_H diff --git a/src/actions/pets.h b/src/actions/pets.h deleted file mode 100644 index 5bc3bd5a9..000000000 --- a/src/actions/pets.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_PETS_H -#define ACTIONS_PETS_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(commandEmotePet); - decHandler(talkPet); - decHandler(setPetName); - decHandler(petEmote); - decHandler(catchPet); - decHandler(petMoveUp); - decHandler(petMoveDown); - decHandler(petMoveLeft); - decHandler(petMoveRight); - decHandler(petDirectUp); - decHandler(petDirectDown); - decHandler(petDirectLeft); - decHandler(petDirectRight); - decHandler(petMove); - decHandler(petFeed); - decHandler(petDropLoot); - decHandler(petReturnToEgg); - decHandler(petUnequip); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_PETS_H diff --git a/src/actions/statusbar.h b/src/actions/statusbar.h deleted file mode 100644 index 093aefd04..000000000 --- a/src/actions/statusbar.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_STATUSBAR_H -#define ACTIONS_STATUSBAR_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(switchQuickDrop); - decHandler(changeCrazyMove); - decHandler(changePickupType); - decHandler(changeMoveType); - decHandler(changeAttackWeaponType); - decHandler(changeAttackType); - decHandler(changeTargetingType); - decHandler(changeFollowMode); - decHandler(changeImitationMode); - decHandler(changeMagicAttackType); - decHandler(changePvpMode); - decHandler(changeMoveToTarget); - decHandler(changeGameModifier); - decHandler(changeAudio); - decHandler(away); - decHandler(camera); - decHandler(changeMapMode); - decHandler(changeTrade); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_STATUSBAR_H diff --git a/src/actions/tabs.h b/src/actions/tabs.h deleted file mode 100644 index f7edb1c8c..000000000 --- a/src/actions/tabs.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_TABS_H -#define ACTIONS_TABS_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(prevSocialTab); - decHandler(nextSocialTab); - decHandler(nextShortcutsTab); - decHandler(prevShortcutsTab); - decHandler(nextCommandsTab); - decHandler(prevCommandsTab); - decHandler(nextInvTab); - decHandler(prevInvTab); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_TABS_H diff --git a/src/actions/target.h b/src/actions/target.h deleted file mode 100644 index cf5bacf26..000000000 --- a/src/actions/target.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_TARGET_H -#define ACTIONS_TARGET_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(targetPlayer); - decHandler(targetMonster); - decHandler(targetClosestMonster); - decHandler(targetNPC); - decHandler(targetMercenary); - decHandler(targetPet); - decHandler(targetSkillUnit); - decHandler(contextMenu); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_TARGET_H diff --git a/src/actions/windows.h b/src/actions/windows.h deleted file mode 100644 index 8b6311281..000000000 --- a/src/actions/windows.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTIONS_WINDOWS_H -#define ACTIONS_WINDOWS_H - -#define decHandler(name) bool name(InputEvent &event) - -struct InputEvent; - -namespace Actions -{ - decHandler(hideWindows); - decHandler(helpWindowShow); - decHandler(aboutWindowShow); - decHandler(setupWindowShow); - decHandler(statusWindowShow); - decHandler(inventoryWindowShow); - decHandler(equipmentWindowShow); - decHandler(skillDialogShow); - decHandler(minimapWindowShow); - decHandler(chatWindowShow); - decHandler(shortcutWindowShow); - decHandler(debugWindowShow); - decHandler(socialWindowShow); - decHandler(emoteShortcutWindowShow); - decHandler(outfitWindowShow); - decHandler(shopWindowShow); - decHandler(dropShortcutWindowShow); - decHandler(killStatsWindowShow); - decHandler(spellShortcutWindowShow); - decHandler(whoIsOnlineWindowShow); - decHandler(didYouKnowWindowShow); - decHandler(questsWindowShow); - decHandler(updaterWindowShow); - decHandler(bankWindowShow); - decHandler(cartWindowShow); - decHandler(quickWindowShow); - decHandler(mailWindowShow); - decHandler(serverInfoWindowShow); - decHandler(showItems); -} // namespace Actions - -#undef decHandler - -#endif // ACTIONS_WINDOWS_H diff --git a/src/actormanager.cpp b/src/actormanager.cpp deleted file mode 100644 index c4079f776..000000000 --- a/src/actormanager.cpp +++ /dev/null @@ -1,2265 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "actormanager.h" - -#include "game.h" -#include "configuration.h" -#include "settings.h" - -#include "being/localplayer.h" -#include "being/playerrelations.h" - -#include "gui/sdlinput.h" -#include "gui/viewport.h" - -#include "gui/widgets/tabs/chat/chattab.h" - -#include "gui/windows/equipmentwindow.h" -#include "gui/windows/socialwindow.h" -#include "gui/windows/questswindow.h" - -#include "fs/files.h" - -#include "input/inputmanager.h" - -#include "utils/checkutils.h" -#include "utils/foreach.h" -#include "utils/mathutils.h" -#include "utils/gettext.h" - -#include "net/beinghandler.h" -#include "net/charserverhandler.h" -#include "net/packetlimiter.h" -#include "net/playerhandler.h" -#include "net/serverfeatures.h" - -#include "resources/chatobject.h" -#include "resources/iteminfo.h" - -#include "resources/map/map.h" - -#include "resources/db/itemdb.h" - -#ifdef TMWA_SUPPORT -#include "being/playerinfo.h" - -#include "gui/windows/chatwindow.h" - -#include "net/net.h" -#endif // TMWA_SUPPORT - -#include - -#include "debug.h" - -#define for_actors for (ActorSpritesConstIterator it = mActors.begin(), \ - it_fend = mActors.end(); it != it_fend; ++it) - -#define for_actorsm for (ActorSpritesIterator it = mActors.begin(), \ - it_fend = mActors.end(); it != it_fend; ++it) - -ActorManager *actorManager = nullptr; - -class FindBeingFunctor final -{ - public: - A_DEFAULT_COPY(FindBeingFunctor) - - bool operator() (const ActorSprite *const actor) const - { - if ((actor == nullptr) - || actor->getType() == ActorType::FloorItem - || actor->getType() == ActorType::Portal) - { - return false; - } - const Being *const b = static_cast(actor); - - const unsigned other_y = y - + ((b->getType() == ActorType::Npc) ? 1 : 0); - const Vector &pos = b->getPixelPositionF(); - // +++ probably here need use int positions and not float? - // but for now correct int positions only in Being - return CAST_U32(pos.x) / mapTileSize == x && - (CAST_U32(pos.y) / mapTileSize == y - || CAST_U32(pos.y) / mapTileSize == other_y) && - b->isAlive() && (type == ActorType::Unknown - || b->getType() == type); - } - - uint16_t x, y; - ActorTypeT type; -} beingActorFinder; - -class FindBeingEqualFunctor final -{ - public: - A_DEFAULT_COPY(FindBeingEqualFunctor) - - bool operator() (const Being *const being) const - { - if ((being == nullptr) || (findBeing == nullptr)) - return false; - return being->getId() == findBeing->getId(); - } - - Being *findBeing; -} beingEqualActorFinder; - -class SortBeingFunctor final -{ - public: - A_DEFAULT_COPY(SortBeingFunctor) - - bool operator() (const Being *const being1, - const Being *const being2) const - { - if ((being1 == nullptr) || (being2 == nullptr)) - return false; - - if (priorityBeings != nullptr) - { - int w1 = defaultPriorityIndex; - int w2 = defaultPriorityIndex; - const StringIntMapCIter it1 = priorityBeings->find( - being1->getName()); - const StringIntMapCIter it2 = priorityBeings->find( - being2->getName()); - if (it1 != priorityBeings->end()) - w1 = (*it1).second; - if (it2 != priorityBeings->end()) - w2 = (*it2).second; - - if (w1 != w2) - return w1 < w2; - } - if (being1->getDistance() != being2->getDistance()) - { - if (specialDistance && being1->getDistance() <= 2 - && being2->getDistance() <= attackRange - && being2->getDistance() > 2) - { - return false; - } - else if (specialDistance && being2->getDistance() <= 2 - && being1->getDistance() <= attackRange - && being1->getDistance() > 2) - { - return true; - } - return being1->getDistance() < being2->getDistance(); - } - - const int d1 = abs(being1->getTileX() - x) - + abs(being1->getTileY() - y); - const int d2 = abs(being2->getTileX() - x) - + abs(being2->getTileY() - y); - - if (d1 != d2) - return d1 < d2; - if (attackBeings != nullptr) - { - int w1 = defaultAttackIndex; - int w2 = defaultAttackIndex; - const StringIntMapCIter it1 = attackBeings->find( - being1->getName()); - const StringIntMapCIter it2 = attackBeings->find( - being2->getName()); - if (it1 != attackBeings->end()) - w1 = (*it1).second; - if (it2 != attackBeings->end()) - w2 = (*it2).second; - - if (w1 != w2) - return w1 < w2; - } - - return being1->getName() < being2->getName(); - } - StringIntMap *attackBeings; - StringIntMap *priorityBeings; - int x; - int y; - int defaultAttackIndex; - int defaultPriorityIndex; - int attackRange; - bool specialDistance; -} beingActorSorter; - -ActorManager::ActorManager() : - mActors(), - mDeleteActors(), - mActorsIdMap(), - mIdName(), - mBlockedBeings(), - mChars(), - mMap(nullptr), -#ifdef TMWA_SUPPORT - mSpellHeal1(serverConfig.getValue("spellHeal1", "#lum")), - mSpellHeal2(serverConfig.getValue("spellHeal2", "#inma")), - mSpellItenplz(serverConfig.getValue("spellItenplz", "#itenplz")), -#endif // TMWA_SUPPORT - mTargetDeadPlayers(config.getBoolValue("targetDeadPlayers")), - mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")), - mCyclePlayers(config.getBoolValue("cyclePlayers")), - mCycleMonsters(config.getBoolValue("cycleMonsters")), - mCycleNPC(config.getBoolValue("cycleNPC")), - mExtMouseTargeting(config.getBoolValue("extMouseTargeting")), - mEnableIdCollecting(config.getBoolValue("enableIdCollecting")), - mPriorityAttackMobs(), - mPriorityAttackMobsSet(), - mPriorityAttackMobsMap(), - mAttackMobs(), - mAttackMobsSet(), - mAttackMobsMap(), - mIgnoreAttackMobs(), - mIgnoreAttackMobsSet(), - mPickupItems(), - mPickupItemsSet(), - mPickupItemsMap(), - mIgnorePickupItems(), - mIgnorePickupItemsSet() -{ - config.addListener("targetDeadPlayers", this); - config.addListener("targetOnlyReachable", this); - config.addListener("cyclePlayers", this); - config.addListener("cycleMonsters", this); - config.addListener("cycleNPC", this); - config.addListener("extMouseTargeting", this); - config.addListener("showBadges", this); - config.addListener("enableIdCollecting", this); - config.addListener("visiblenamespos", this); - - loadAttackList(); -} - -ActorManager::~ActorManager() -{ - config.removeListeners(this); - CHECKLISTENERS - storeAttackList(); - clear(); -} - -void ActorManager::setMap(Map *const map) -{ - mMap = map; - - if (localPlayer != nullptr) - localPlayer->setMap(map); -} - -void ActorManager::setPlayer(LocalPlayer *const player) -{ - localPlayer = player; - mActors.insert(player); - mActorsIdMap[player->getId()] = player; - if (socialWindow != nullptr) - socialWindow->updateAttackFilter(); - if (socialWindow != nullptr) - socialWindow->updatePickupFilter(); -} - -Being *ActorManager::createBeing(const BeingId id, - const ActorTypeT type, - const BeingTypeId subtype) -{ - Being *const being = Being::createBeing(id, - type, - subtype, - mMap); - - mActors.insert(being); - - mActorsIdMap[being->getId()] = being; - - switch (type) - { - case ActorType::Player: - case ActorType::Mercenary: - case ActorType::Pet: - case ActorType::Homunculus: - case ActorType::Npc: - being->updateFromCache(); - if (beingHandler != nullptr) - beingHandler->requestNameById(id); - if (localPlayer != nullptr) - localPlayer->checkNewName(being); - break; - case ActorType::Monster: -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() != ServerType::TMWATHENA) -#endif // TMWA_SUPPORT - { - beingHandler->requestNameById(id); - } - break; - case ActorType::Portal: - if ((beingHandler != nullptr) && - (serverFeatures != nullptr) && - serverFeatures->haveServerWarpNames()) - { - beingHandler->requestNameById(id); - } - break; - case ActorType::Elemental: - if (beingHandler != nullptr) - beingHandler->requestNameById(id); - break; - case ActorType::SkillUnit: - break; - default: - case ActorType::FloorItem: - case ActorType::Avatar: - case ActorType::Unknown: - reportAlways("CreateBeing for unknown type %d", CAST_S32(type)); - break; - } - - if (type == ActorType::Player) - { - if (socialWindow != nullptr) - socialWindow->updateActiveList(); - } - else if (type == ActorType::Npc) - { - if (questsWindow != nullptr) - questsWindow->addEffect(being); - } - return being; -} - -FloorItem *ActorManager::createItem(const BeingId id, - const int itemId, - const int x, const int y, - const ItemTypeT itemType, - const int amount, - const int refine, - const ItemColor color, - const Identified identified, - const Damaged damaged, - const int subX, const int subY, - const int *const cards) -{ - FloorItem *const floorItem = new FloorItem(id, - itemId, - x, y, - itemType, - amount, - refine, - color, - identified, - damaged, - cards); - floorItem->postInit(mMap, subX, subY); - - if (!checkForPickup(floorItem)) - floorItem->disableHightlight(); - mActors.insert(floorItem); - mActorsIdMap[floorItem->getId()] = floorItem; - return floorItem; -} - -void ActorManager::destroy(ActorSprite *const actor) -{ - returnNullptrV(actor); - - if (actor == localPlayer) - return; - - mDeleteActors.insert(actor); -} - -void ActorManager::erase(ActorSprite *const actor) -{ - returnNullptrV(actor); - - if (actor == localPlayer) - return; - - mActors.erase(actor); - const ActorSpritesMapIterator it = mActorsIdMap.find(actor->getId()); - if (it != mActorsIdMap.end() && (*it).second == actor) - mActorsIdMap.erase(it); -} - -void ActorManager::undelete(const ActorSprite *const actor) -{ - returnNullptrV(actor); - - if (actor == localPlayer) - return; - - FOR_EACH (ActorSpritesConstIterator, it, mDeleteActors) - { - if (*it == actor) - { - mDeleteActors.erase(*it); - return; - } - } -} - -Being *ActorManager::findBeing(const BeingId id) const -{ - const ActorSpritesMapConstIterator it = mActorsIdMap.find(id); - if (it != mActorsIdMap.end()) - { - ActorSprite *const actor = (*it).second; - if ((actor != nullptr) && - actor->getId() == id && - actor->getType() != ActorType::FloorItem) - { - return static_cast(actor); - } - } - return nullptr; -} - -ActorSprite *ActorManager::findActor(const BeingId id) const -{ - const ActorSpritesMapConstIterator it = mActorsIdMap.find(id); - if (it != mActorsIdMap.end()) - { - ActorSprite *const actor = (*it).second; - if ((actor != nullptr) && - actor->getId() == id) - { - return actor; - } - } - return nullptr; -} - -Being *ActorManager::findBeing(const int x, const int y, - const ActorTypeT type) const -{ - beingActorFinder.x = CAST_U16(x); - beingActorFinder.y = CAST_U16(y); - beingActorFinder.type = type; - - const ActorSpritesConstIterator it = std::find_if( - mActors.begin(), mActors.end(), beingActorFinder); - - return (it == mActors.end()) ? nullptr : static_cast(*it); -} - -Being *ActorManager::findBeingByPixel(const int x, const int y, - const AllPlayers allPlayers) const -{ - if (mMap == nullptr) - return nullptr; - - const bool targetDead = mTargetDeadPlayers; - const bool modActive = inputManager.isActionActive( - InputAction::STOP_ATTACK); - - if (mExtMouseTargeting) - { - Being *tempBeing = nullptr; - bool noBeing(false); - - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::Portal) - continue; - - if ((*it)->getType() == ActorType::FloorItem) - { - if (!noBeing) - { - const FloorItem *const floor - = static_cast(*it); - const int px = floor->getPixelX(); - const int py = floor->getPixelY(); - if ((px - mapTileSize <= x) && - (px + mapTileSize > x) && - (py - mapTileSize * 2 <= y) && - (py + mapTileSize / 2 > y)) - { - noBeing = true; - } - } - continue; - } - - Being *const being = static_cast(*it); - - if (being->getInfo() != nullptr && - !(being->getInfo()->isTargetSelection() || modActive)) - { - continue; - } - - if ((being->mAction != BeingAction::DEAD || - (targetDead && being->getType() == ActorType::Player)) && - (allPlayers == AllPlayers_true || being != localPlayer)) - { - const int px = being->getPixelX(); - const int py = being->getPixelY(); - if ((px - mapTileSize / 2 <= x) && - (px + mapTileSize / 2 > x) && - (py - mapTileSize <= y) && - (py > y)) - { - return being; - } - else if (!noBeing && - (px - mapTileSize <= x) && - (px + mapTileSize > x) && - (py - mapTileSize * 2 <= y) && - (py + mapTileSize / 2 > y)) - { - if (tempBeing != nullptr) - noBeing = true; - else - tempBeing = being; - } - } - } - - if (noBeing) - return nullptr; - return tempBeing; - } - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::Portal || - (*it)->getType() == ActorType::FloorItem) - { - continue; - } - - Being *const being = static_cast(*it); - - if (being->getInfo() != nullptr && - !(being->getInfo()->isTargetSelection() || modActive)) - { - continue; - } - - const int px = being->getPixelX(); - const int py = being->getPixelY(); - if ((px - mapTileSize / 2 <= x) && - (px + mapTileSize / 2 > x) && - (py - mapTileSize <= y) && - (py > y)) - { - return being; - } - } - return nullptr; -} - -void ActorManager::findBeingsByPixel(STD_VECTOR &beings, - const int x, const int y, - const AllPlayers allPlayers) const -{ - if (mMap == nullptr) - return; - - const int xtol = mapTileSize / 2; - const int uptol = mapTileSize; - const bool modActive = inputManager.isActionActive( - InputAction::STOP_ATTACK); - - for_actors - { - ActorSprite *const actor = *it; - -// disabled for performance -// if (reportTrue(actor == nullptr)) -// continue; - - const ActorTypeT actorType = actor->getType(); - switch (actorType) - { - default: - case ActorType::Unknown: - case ActorType::Avatar: - case ActorType::Portal: - break; - case ActorType::FloorItem: - if ((actor->getPixelX() - xtol <= x) && - (actor->getPixelX() + xtol > x) && - (actor->getPixelY() - uptol <= y) && - (actor->getPixelY() > y)) - { - beings.push_back(actor); - } - break; - case ActorType::Player: - case ActorType::Npc: - case ActorType::Monster: - case ActorType::Pet: - case ActorType::Mercenary: - case ActorType::Homunculus: - case ActorType::SkillUnit: - case ActorType::Elemental: - { - const Being *const being = static_cast(*it); - if (being == nullptr) - continue; - if ((being->getInfo() != nullptr) && - !(being->getInfo()->isTargetSelection() || modActive)) - { - continue; - } - if ((being->isAlive() || - (mTargetDeadPlayers && - actorType == ActorType::Player)) && - (allPlayers == AllPlayers_true || - being != localPlayer)) - { - if ((actor->getPixelX() - xtol <= x) && - (actor->getPixelX() + xtol > x) && - (actor->getPixelY() - uptol <= y) && - (actor->getPixelY() > y)) - { - beings.push_back(actor); - } - } - break; - } - } - } -} - -Being *ActorManager::findPortalByTile(const int x, const int y) const -{ - if (mMap == nullptr) - return nullptr; - - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() != ActorType::Portal) - continue; - - Being *const being = static_cast(*it); - - if (being->getTileX() == x && being->getTileY() == y) - return being; - } - - return nullptr; -} - -FloorItem *ActorManager::findItem(const BeingId id) const -{ - const ActorSpritesMapConstIterator it = mActorsIdMap.find(id); - if (it != mActorsIdMap.end()) - { - ActorSprite *const actor = (*it).second; - returnNullptr(nullptr, actor); - if (actor->getId() == id && - actor->getType() == ActorType::FloorItem) - { - return static_cast(actor); - } - } - return nullptr; -} - -FloorItem *ActorManager::findItem(const int x, const int y) const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getTileX() == x && (*it)->getTileY() == y && - (*it)->getType() == ActorType::FloorItem) - { - return static_cast(*it); - } - } - - return nullptr; -} - -bool ActorManager::pickUpAll(const int x1, const int y1, - const int x2, const int y2, - const bool serverBuggy) const -{ - if (localPlayer == nullptr) - return false; - - bool finded(false); - const bool allowAll = mPickupItemsSet.find("") != mPickupItemsSet.end(); - if (!serverBuggy) - { - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - && ((*it)->getTileX() >= x1 && (*it)->getTileX() <= x2) - && ((*it)->getTileY() >= y1 && (*it)->getTileY() <= y2)) - { - FloorItem *const item = static_cast(*it); - if (allowAll) - { - if (mIgnorePickupItemsSet.find(item->getName()) - == mIgnorePickupItemsSet.end()) - { - if (localPlayer->pickUp(item)) - finded = true; - } - } - else - { - if (mPickupItemsSet.find(item->getName()) - != mPickupItemsSet.end()) - { - if (localPlayer->pickUp(item)) - finded = true; - } - } - } - } - } - else if (PacketLimiter::checkPackets(PacketType::PACKET_PICKUP)) - { - FloorItem *item = nullptr; - unsigned cnt = 65535; - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - && ((*it)->getTileX() >= x1 && (*it)->getTileX() <= x2) - && ((*it)->getTileY() >= y1 && (*it)->getTileY() <= y2)) - { - FloorItem *const tempItem = static_cast(*it); - if (tempItem->getPickupCount() < cnt) - { - if (allowAll) - { - if (mIgnorePickupItemsSet.find(tempItem->getName()) - == mIgnorePickupItemsSet.end()) - { - item = tempItem; - cnt = item->getPickupCount(); - if (cnt == 0) - { - item->incrementPickup(); - localPlayer->pickUp(item); - return true; - } - } - } - else - { - if (mPickupItemsSet.find(tempItem->getName()) - != mPickupItemsSet.end()) - { - item = tempItem; - cnt = item->getPickupCount(); - if (cnt == 0) - { - item->incrementPickup(); - localPlayer->pickUp(item); - return true; - } - } - } - } - } - } - if ((item != nullptr) && localPlayer->pickUp(item)) - finded = true; - } - return finded; -} - -bool ActorManager::pickUpNearest(const int x, const int y, - int maxdist) const -{ - if (localPlayer == nullptr) - return false; - - maxdist = maxdist * maxdist; - FloorItem *closestItem = nullptr; - int dist = 0; - const bool allowAll = mPickupItemsSet.find("") != mPickupItemsSet.end(); - - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem) - { - FloorItem *const item = static_cast(*it); - - const int d = (item->getTileX() - x) * (item->getTileX() - x) - + (item->getTileY() - y) * (item->getTileY() - y); - - if ((d < dist || closestItem == nullptr) && - (!mTargetOnlyReachable || localPlayer->isReachable( - item->getTileX(), item->getTileY(), - false))) - { - if (allowAll) - { - if (mIgnorePickupItemsSet.find(item->getName()) - == mIgnorePickupItemsSet.end()) - { - dist = d; - closestItem = item; - } - } - else - { - if (mPickupItemsSet.find(item->getName()) - != mPickupItemsSet.end()) - { - dist = d; - closestItem = item; - } - } - } - } - } - if ((closestItem != nullptr) && dist <= maxdist) - return localPlayer->pickUp(closestItem); - - return false; -} - -Being *ActorManager::findBeingByName(const std::string &name, - const ActorTypeT type) const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*it); - if (being->getName() == name && - (type == ActorType::Unknown || type == being->getType())) - { - return being; - } - } - return nullptr; -} - -Being *ActorManager::findNearestByName(const std::string &name, - const ActorTypeT &type) const -{ - if (localPlayer == nullptr) - return nullptr; - - int dist = 0; - Being* closestBeing = nullptr; - int x, y; - - x = localPlayer->getTileX(); - y = localPlayer->getTileY(); - - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*it); - - if ((being != nullptr) && being->getName() == name && - (type == ActorType::Unknown || type == being->getType())) - { - if (being->getType() == ActorType::Player) - { - return being; - } - const int d = (being->getTileX() - x) * (being->getTileX() - x) - + (being->getTileY() - y) * (being->getTileY() - y); - - if (validateBeing(nullptr, being, type, nullptr, 50) - && (d < dist || closestBeing == nullptr)) - { - dist = d; - closestBeing = being; - } - } - } - return closestBeing; -} - -const ActorSprites &ActorManager::getAll() const -{ - return mActors; -} - -void ActorManager::logic() -{ - BLOCK_START("ActorManager::logic") - for_actors - { -// disabled for performance -// if (reportFalse(*it)) - (*it)->logic(); - } - - if (mDeleteActors.empty()) - { - BLOCK_END("ActorManager::logic") - return; - } - - BLOCK_START("ActorManager::logic 1") - FOR_EACH (ActorSpritesConstIterator, it, mDeleteActors) - { - const ActorSprite *const actor = *it; - const ActorTypeT &type = actor->getType(); - if (type == ActorType::Player) - { - const Being *const being = static_cast(actor); - being->addToCache(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->resetBeing(being); - } - if (localPlayer != nullptr) - { - if (localPlayer->getTarget() == actor) - localPlayer->setTarget(nullptr); - if (localPlayer->getPickUpTarget() == actor) - localPlayer->unSetPickUpTarget(); - } - if (viewport != nullptr) - viewport->clearHover(*it); - } - - FOR_EACH (ActorSpritesConstIterator, it, mDeleteActors) - { - ActorSprite *actor = *it; - mActors.erase(actor); - - if (actor != nullptr) - { - const ActorSpritesMapIterator itr = mActorsIdMap.find( - actor->getId()); - if (itr != mActorsIdMap.end() && (*itr).second == actor) - mActorsIdMap.erase(itr); - - delete actor; - } - } - - mDeleteActors.clear(); - BLOCK_END("ActorManager::logic 1") - BLOCK_END("ActorManager::logic") -} - -void ActorManager::clear() -{ - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->setBeing(nullptr); - - if (localPlayer != nullptr) - { - localPlayer->setTarget(nullptr); - localPlayer->unSetPickUpTarget(); - mActors.erase(localPlayer); - } - - for_actors - delete *it; - mActors.clear(); - mDeleteActors.clear(); - mActorsIdMap.clear(); - - if (localPlayer != nullptr) - { - mActors.insert(localPlayer); - mActorsIdMap[localPlayer->getId()] = localPlayer; - } - - mChars.clear(); -} - -Being *ActorManager::findNearestPvpPlayer() const -{ - if (localPlayer == nullptr) - return nullptr; - - // don't attack players - if (settings.pvpAttackType == 3) - return nullptr; - - const Game *const game = Game::instance(); - if (game == nullptr) - return nullptr; - - const Map *const map = game->getCurrentMap(); - if (map == nullptr) - return nullptr; - - const int mapPvpMode = map->getPvpMode(); - Being *target = nullptr; - int minDistSquared = 20000; - - for_actors - { - if ((*it)->getType() != ActorType::Player) - continue; - - Being *const being = static_cast(*it); - - if (reportTrue(being == nullptr) || - !being->isAlive() || - localPlayer == being) - { - continue; - } - - const int teamId = being->getTeamId(); - // this condition is very TMW-specific - if (!((mapPvpMode != 0) || (teamId != 0))) - continue; - - if (!LocalPlayer::checAttackPermissions(being)) - continue; - - const int dx = being->getTileX() - localPlayer->getTileX(); - const int dy = being->getTileY() - localPlayer->getTileY(); - const int distSquared = dx * dx + dy * dy; - if (distSquared < minDistSquared) - { - minDistSquared = distSquared; - target = being; - } - } - - return target; -} - - -Being *ActorManager::findNearestLivingBeing(const int x, const int y, - const int maxTileDist, - const ActorTypeT type, - const Being *const excluded) const -{ - const int maxDist = maxTileDist * mapTileSize; - - return findNearestLivingBeing(nullptr, maxDist, - type, - x, y, - excluded, - AllowSort_true); -} - -Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, - const int maxDist, - const ActorTypeT type, - const AllowSort allowSort) const -{ - if (aroundBeing == nullptr) - return nullptr; - - return findNearestLivingBeing(aroundBeing, - maxDist, - type, - aroundBeing->getTileX(), - aroundBeing->getTileY(), - aroundBeing, - allowSort); -} - -Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, - int maxDist, - const ActorTypeT &type, - const int x, const int y, - const Being *const excluded, - const AllowSort allowSort) const -{ - if ((aroundBeing == nullptr) || (localPlayer == nullptr)) - return nullptr; - - std::set attackMobs; - std::set priorityMobs; - std::set ignoreAttackMobs; - StringIntMap attackMobsMap; - StringIntMap priorityMobsMap; - int defaultAttackIndex = 10000; - int defaultPriorityIndex = 10000; - const int attackRange = localPlayer->getAttackRange(); - - bool specialDistance = false; - if (settings.moveToTargetType == 11 - && localPlayer->getAttackRange() > 2) - { - specialDistance = true; - } - - maxDist = maxDist * maxDist; - - const bool cycleSelect = allowSort == AllowSort_true - && ((mCyclePlayers && type == ActorType::Player) - || (mCycleMonsters && type == ActorType::Monster) - || (mCycleNPC && type == ActorType::Npc)); - - const bool filtered = allowSort == AllowSort_true - && config.getBoolValue("enableAttackFilter") - && type == ActorType::Monster; - const bool modActive = inputManager.isActionActive( - InputAction::STOP_ATTACK); - - bool ignoreDefault = false; - if (filtered) - { - attackMobs = mAttackMobsSet; - priorityMobs = mPriorityAttackMobsSet; - ignoreAttackMobs = mIgnoreAttackMobsSet; - attackMobsMap = mAttackMobsMap; - priorityMobsMap = mPriorityAttackMobsMap; - beingActorSorter.attackBeings = &attackMobsMap; - beingActorSorter.priorityBeings = &priorityMobsMap; - beingActorSorter.specialDistance = specialDistance; - beingActorSorter.attackRange = attackRange; - if (ignoreAttackMobs.find("") != ignoreAttackMobs.end()) - ignoreDefault = true; - StringIntMapCIter itr = attackMobsMap.find(""); - if (itr != attackMobsMap.end()) - defaultAttackIndex = (*itr).second; - itr = priorityMobsMap.find(""); - if (itr != priorityMobsMap.end()) - defaultPriorityIndex = (*itr).second; - } - - if (cycleSelect) - { - STD_VECTOR sortedBeings; - - FOR_EACH (ActorSprites::iterator, i, mActors) - { -// disabled for performance -// if (reportTrue(*i == nullptr)) -// continue; - - if ((*i)->getType() == ActorType::FloorItem - || (*i)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*i); - - if (filtered) - { - if (ignoreAttackMobs.find(being->getName()) - != ignoreAttackMobs.end()) - { - continue; - } - if (ignoreDefault && attackMobs.find(being->getName()) - == attackMobs.end() && priorityMobs.find(being->getName()) - == priorityMobs.end()) - { - continue; - } - } - - if ((being->getInfo() != nullptr) - && !(being->getInfo()->isTargetSelection() || modActive)) - { - continue; - } - - if (validateBeing(aroundBeing, being, type, nullptr, maxDist)) - { - if (being != excluded) - sortedBeings.push_back(being); - } - } - - // no selectable beings - if (sortedBeings.empty()) - return nullptr; - - beingActorSorter.x = x; - beingActorSorter.y = y; - if (filtered) - { - beingActorSorter.attackBeings = &attackMobsMap; - beingActorSorter.defaultAttackIndex = defaultAttackIndex; - beingActorSorter.priorityBeings = &priorityMobsMap; - beingActorSorter.defaultPriorityIndex = defaultPriorityIndex; - } - else - { - beingActorSorter.attackBeings = nullptr; - beingActorSorter.priorityBeings = nullptr; - } - std::sort(sortedBeings.begin(), sortedBeings.end(), beingActorSorter); - if (filtered) - { - beingActorSorter.attackBeings = nullptr; - beingActorSorter.priorityBeings = nullptr; - } - - if (localPlayer->getTarget() == nullptr) - { - Being *const target = sortedBeings.at(0); - - if (specialDistance && target->getType() == ActorType::Monster - && target->getDistance() <= 2) - { - return nullptr; - } - // if no selected being in vector, return first nearest being - return target; - } - - beingEqualActorFinder.findBeing = localPlayer->getTarget(); - STD_VECTOR::const_iterator i = std::find_if( - sortedBeings.begin(), sortedBeings.end(), beingEqualActorFinder); - - if (i == sortedBeings.end() || ++i == sortedBeings.end()) - { - // if no selected being in vector, return first nearest being - return sortedBeings.at(0); - } - - // we find next being after target - return *i; - } - - int dist = 0; - int index = defaultPriorityIndex; - Being *closestBeing = nullptr; - - FOR_EACH (ActorSprites::iterator, i, mActors) - { -// disabled for performance -// if (reportTrue(*i == nullptr)) -// continue; - - if ((*i)->getType() == ActorType::FloorItem || - (*i)->getType() == ActorType::Portal) - { - continue; - } - Being *const being = static_cast(*i); - - if (filtered) - { - if (ignoreAttackMobs.find(being->getName()) - != ignoreAttackMobs.end()) - { - continue; - } - if (ignoreDefault && attackMobs.find(being->getName()) - == attackMobs.end() && priorityMobs.find(being->getName()) - == priorityMobs.end()) - { - continue; - } - } - - if ((being->getInfo() != nullptr) - && !(being->getInfo()->isTargetSelection() || modActive)) - { - continue; - } - - const bool valid = validateBeing(aroundBeing, being, - type, excluded, 50); - int d = being->getDistance(); - if (being->getType() != ActorType::Monster - || !mTargetOnlyReachable) - { // if distance not calculated, use old distance - d = (being->getTileX() - x) * (being->getTileX() - x) - + (being->getTileY() - y) * (being->getTileY() - y); - } - - if (!valid) - continue; - - if (specialDistance && being->getDistance() <= 2 - && being->getType() == type) - { - continue; - } - -// logger->log("being name:" + being->getName()); -// logger->log("index:" + toString(index)); -// logger->log("d:" + toString(d)); - - if (!filtered && (d <= dist || (closestBeing == nullptr))) - { - dist = d; - closestBeing = being; - } - else if (filtered) - { - int w2 = defaultPriorityIndex; - if (closestBeing != nullptr) - { - const StringIntMapCIter it2 = priorityMobsMap.find( - being->getName()); - if (it2 != priorityMobsMap.end()) - w2 = (*it2).second; - - if (w2 < index) - { - dist = d; - closestBeing = being; - index = w2; - continue; - } - if (w2 == index && d <= dist) - { - dist = d; - closestBeing = being; - index = w2; - continue; - } - } - - if (closestBeing == nullptr) - { - dist = d; - closestBeing = being; - const StringIntMapCIter it1 = priorityMobsMap.find( - being->getName()); - if (it1 != priorityMobsMap.end()) - index = (*it1).second; - else - index = defaultPriorityIndex; - } - } - } - return (maxDist >= dist) ? closestBeing : nullptr; -} - -bool ActorManager::validateBeing(const Being *const aroundBeing, - Being *const being, - const ActorTypeT &type, - const Being* const excluded, - const int maxCost) const -{ - if (localPlayer == nullptr) - return false; - return (being != nullptr) && ((being->getType() == type - || type == ActorType::Unknown) && (being->isAlive() - || (mTargetDeadPlayers && type == ActorType::Player)) - && being != aroundBeing) && being != excluded - && (type != ActorType::Monster || !mTargetOnlyReachable - || localPlayer->isReachable(being, maxCost)); -} - -#ifdef TMWA_SUPPORT -void ActorManager::healTarget() const -{ - if (localPlayer == nullptr) - return; - - heal(localPlayer->getTarget()); -} - -void ActorManager::heal(const Being *const target) const -{ - if (Net::getNetworkType() != ServerType::TMWATHENA) - return; - - if (localPlayer == nullptr || - chatWindow == nullptr || - !localPlayer->isAlive() || - !playerHandler->canUseMagic()) - { - return; - } - - // self - if (target != nullptr && - localPlayer->getName() == target->getName()) - { - if (PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 6 - && PlayerInfo::getAttribute(Attributes::PLAYER_HP) - != PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP)) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal1); - } - } - // magic levels < 2 - else if (PlayerInfo::getSkillLevel(340) < 2 || - PlayerInfo::getSkillLevel(341) < 2) - { - if (PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 6) - { - if (target != nullptr && - target->getType() != ActorType::Monster) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal1 + " " - + target->getName()); - } - else if (PlayerInfo::getAttribute(Attributes::PLAYER_HP) - != PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP)) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal1); - } - } - } - // magic level >= 2 and not self - else - { - // mp > 10 and target not monster - if (PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 10 && - target != nullptr && - target->getType() != ActorType::Monster) - { - // target not enemy - if (playerRelations.getRelation(target->getName()) != - Relation::ENEMY2) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal2 + " " - + target->getName()); - } - // target enemy - else - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal1); - } - } - // heal self if selected monster or selection empty - else if ((target == nullptr || target->getType() == ActorType::Monster) - && PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 6 - && PlayerInfo::getAttribute(Attributes::PLAYER_HP) - != PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP)) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - chatWindow->localChatInput(mSpellHeal1); - } - } -} -#endif // TMWA_SUPPORT - -Being* ActorManager::findMostDamagedPlayer(const int maxTileDist) const -{ - if (localPlayer == nullptr) - return nullptr; - - int maxDamageTaken = 0; - Being *target = nullptr; - - for_actors - { - if ((*it)->getType() != ActorType::Player) - continue; - - Being *const being = static_cast(*it); - - if ((being == nullptr) || !being->isAlive() || // don't heal dead - playerRelations.getRelation(being->getName()) == - Relation::ENEMY2 || // don't heal enemy - localPlayer == being) // don't heal self - { - continue; - } - - const int dx = being->getTileX() - localPlayer->getTileX(); - const int dy = being->getTileY() - localPlayer->getTileY(); - const int distance = fastSqrtInt(dx * dx + dy * dy); - - if (distance > maxTileDist) - continue; - - if (being->getDamageTaken() > maxDamageTaken) - { - maxDamageTaken = being->getDamageTaken(); - target = being; - } - } - - return target; -} - -#ifdef TMWA_SUPPORT -void ActorManager::itenplz() const -{ - if (Net::getNetworkType() != ServerType::TMWATHENA) - return; - if (localPlayer == nullptr || - chatWindow == nullptr || - !localPlayer->isAlive() || - !playerHandler->canUseMagic()) - { - return; - } - - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - - chatWindow->localChatInput(mSpellItenplz); -} -#endif // TMWA_SUPPORT - -bool ActorManager::hasActorSprite(const ActorSprite *const actor) const -{ - for_actors - { - if (actor == *it) - return true; - } - - return false; -} - -void ActorManager::addBlock(const BeingId id) -{ - mBlockedBeings.insert(id); -} - -void ActorManager::deleteBlock(const BeingId id) -{ - mBlockedBeings.erase(id); -} - -bool ActorManager::isBlocked(const BeingId id) const -{ - return mBlockedBeings.find(id) != mBlockedBeings.end(); -} - -void ActorManager::printAllToChat() -{ - // TRANSLATORS: visible beings on map - printBeingsToChat(_("Visible on map")); -} - -void ActorManager::printBeingsToChat(const std::string &header) const -{ - if (debugChatTab == nullptr) - return; - - debugChatTab->chatLog("---------------------------------------", - ChatMsgType::BY_SERVER); - debugChatTab->chatLog(header, ChatMsgType::BY_SERVER); - for_actors - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem) - continue; - - const Being *const being = static_cast(*it); - - debugChatTab->chatLog(strprintf("%s (%d,%d) %d", - being->getName().c_str(), being->getTileX(), being->getTileY(), - toInt(being->getSubType(), int)), ChatMsgType::BY_SERVER); - if (mActorsIdMap.find(being->getId()) == mActorsIdMap.end()) - { - debugChatTab->chatLog("missing in id map: %s", - being->getName().c_str()); - } - } - debugChatTab->chatLog("---------------------------------------", - ChatMsgType::BY_SERVER); - FOR_EACH (ActorSpritesMapConstIterator, itr, mActorsIdMap) - { - const ActorSprite *const actor = (*itr).second; - if (actor == nullptr) - continue; - if (actor->getId() != (*itr).first) - debugChatTab->chatLog("Actor with wrong key in map", ""); - - bool found(false); - - for_actors - { -// disabled for performance -// if (!*it) -// continue; - - if ((*it)->getId() == actor->getId()) - { - found = true; - break; - } - } - if (!found) - debugChatTab->chatLog("Actor present in map but not in set", ""); - } -} - -void ActorManager::printBeingsToChat(const STD_VECTOR &beings, - const std::string &header) -{ - if (debugChatTab == nullptr) - return; - - debugChatTab->chatLog("---------------------------------------", - ChatMsgType::BY_SERVER); - debugChatTab->chatLog(header, ChatMsgType::BY_SERVER); - - FOR_EACH (STD_VECTOR::const_iterator, i, beings) - { - if (*i == nullptr) - continue; - - const Being *const being = *i; - - debugChatTab->chatLog(strprintf("%s (%d,%d) %d", - being->getName().c_str(), being->getTileX(), being->getTileY(), - toInt(being->getSubType(), int)), ChatMsgType::BY_SERVER); - } - debugChatTab->chatLog("---------------------------------------", - ChatMsgType::BY_SERVER); -} - -void ActorManager::getPlayerNames(StringVect &names, - const NpcNames npcNames) const -{ - names.clear(); - - for_actors - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem || - (*it)->getType() == ActorType::Portal) - { - continue; - } - - const Being *const being = static_cast(*it); - if ((being->getType() == ActorType::Player || - (being->getType() == ActorType::Npc && - npcNames == NpcNames_true)) && - !being->getName().empty()) - { - names.push_back(being->getName()); - } - } -} - -void ActorManager::getMobNames(StringVect &names) const -{ - names.clear(); - - for_actors - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - const Being *const being = static_cast(*it); - if (being->getType() == ActorType::Monster && - !being->getName().empty()) - { - names.push_back(being->getName()); - } - } -} - -void ActorManager::updatePlayerNames() const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*it); - being->setGoodStatus(-1); - if (being->getType() == ActorType::Player && !being->getName().empty()) - being->updateName(); - } -} - -void ActorManager::updatePlayerColors() const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*it); - if (being->getType() == ActorType::Player && !being->getName().empty()) - being->updateColors(); - } -} - -void ActorManager::updatePlayerGuild() const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - - if ((*it)->getType() == ActorType::FloorItem - || (*it)->getType() == ActorType::Portal) - { - continue; - } - - Being *const being = static_cast(*it); - if (being->getType() == ActorType::Player && !being->getName().empty()) - being->updateGuild(); - } -} - -#ifdef TMWA_SUPPORT -void ActorManager::parseLevels(std::string levels) const -{ - levels.append(", "); - size_t f = 0; - const std::string brkEnd("), "); - size_t pos = levels.find(brkEnd, f); - - while (pos != std::string::npos) - { - std::string part = levels.substr(f, pos - f); - if (part.empty()) - break; - const size_t bktPos = part.rfind('('); - if (bktPos != std::string::npos) - { - Being *const being = findBeingByName(part.substr(0, bktPos), - ActorType::Player); - if (being != nullptr) - { - being->setLevel(atoi(part.substr(bktPos + 1).c_str())); - being->addToCache(); - } - } - f = CAST_SIZE(pos + brkEnd.length()); - pos = levels.find(brkEnd, f); - } - updatePlayerNames(); -} -#endif // TMWA_SUPPORT - -void ActorManager::optionChanged(const std::string &name) -{ - if (name == "targetDeadPlayers") - mTargetDeadPlayers = config.getBoolValue("targetDeadPlayers"); - else if (name == "targetOnlyReachable") - mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); - else if (name == "cyclePlayers") - mCyclePlayers = config.getBoolValue("cyclePlayers"); - else if (name == "cycleMonsters") - mCycleMonsters = config.getBoolValue("cycleMonsters"); - else if (name == "cycleNPC") - mCycleNPC = config.getBoolValue("cycleNPC"); - else if (name == "extMouseTargeting") - mExtMouseTargeting = config.getBoolValue("extMouseTargeting"); - else if (name == "showBadges") - updateBadges(); - else if (name == "visiblenamespos") - updateBadges(); - else if (name == "enableIdCollecting") - mEnableIdCollecting = config.getBoolValue("enableIdCollecting"); -} - -void ActorManager::removeAttackMob(const std::string &name) -{ - mPriorityAttackMobs.remove(name); - mAttackMobs.remove(name); - mIgnoreAttackMobs.remove(name); - mPriorityAttackMobsSet.erase(name); - mAttackMobsSet.erase(name); - mIgnoreAttackMobsSet.erase(name); - rebuildAttackMobs(); - rebuildPriorityAttackMobs(); - storeAttackList(); -} - -void ActorManager::removePickupItem(const std::string &name) -{ - mPickupItems.remove(name); - mPickupItemsSet.erase(name); - mIgnorePickupItems.remove(name); - mIgnorePickupItemsSet.erase(name); - rebuildPickupItems(); - storeAttackList(); -} - -#define addMobToList(name, mob) \ -{\ - const int sz = get##mob##sSize();\ - if (sz > 0)\ - {\ - const int idx = get##mob##Index("");\ - if (idx + 1 == sz)\ - {\ - std::list::iterator itr = m##mob##s.end();\ - -- itr;\ - m##mob##s.insert(itr, name);\ - }\ - else\ - {\ - m##mob##s.push_back(name);\ - }\ - }\ - else\ - {\ - m##mob##s.push_back(name);\ - }\ - m##mob##sSet.insert(name);\ - rebuild##mob##s();\ -} - -#define rebuildMobsList(mob) \ -{\ - m##mob##sMap.clear();\ - std::list::const_iterator i = m##mob##s.begin();\ - int cnt = 0;\ - while (i != m##mob##s.end())\ - {\ - m##mob##sMap[*i] = cnt;\ - ++ i;\ - ++ cnt;\ - }\ -} - -void ActorManager::addAttackMob(const std::string &name) -{ - addMobToList(name, AttackMob); - rebuildPriorityAttackMobs(); - storeAttackList(); -} - -void ActorManager::addPriorityAttackMob(const std::string &name) -{ - addMobToList(name, PriorityAttackMob); - storeAttackList(); -} - -void ActorManager::addIgnoreAttackMob(const std::string &name) -{ - mIgnoreAttackMobs.push_back(name); - mIgnoreAttackMobsSet.insert(name); - rebuildAttackMobs(); - rebuildPriorityAttackMobs(); - storeAttackList(); -} - -void ActorManager::addPickupItem(const std::string &name) -{ - addMobToList(name, PickupItem); - rebuildPickupItems(); - storeAttackList(); -} - -void ActorManager::addIgnorePickupItem(const std::string &name) -{ - mIgnorePickupItems.push_back(name); - mIgnorePickupItemsSet.insert(name); - rebuildPickupItems(); - storeAttackList(); -} - -void ActorManager::rebuildPriorityAttackMobs() -{ - rebuildMobsList(PriorityAttackMob); -} - -void ActorManager::rebuildAttackMobs() -{ - rebuildMobsList(AttackMob); -} - -void ActorManager::rebuildPickupItems() -{ - rebuildMobsList(PickupItem); -} - -int ActorManager::getIndexByName(const std::string &name, - const StringIntMap &map) -{ - const StringIntMapCIter i = map.find(name); - if (i == map.end()) - return -1; - - return (*i).second; -} - -int ActorManager::getPriorityAttackMobIndex(const std::string &name) const -{ - return getIndexByName(name, mPriorityAttackMobsMap); -} - -int ActorManager::getAttackMobIndex(const std::string &name) const -{ - return getIndexByName(name, mAttackMobsMap); -} - -int ActorManager::getPickupItemIndex(const std::string &name) const -{ - return getIndexByName(name, mPickupItemsMap); -} - -#define loadList(key, mob) \ -{\ - list = unpackList(serverConfig.getValue(key, ""));\ - i = list.begin();\ - i_end = list.end();\ - while (i != i_end)\ - {\ - if ((*i).empty())\ - empty = true;\ - m##mob##s.push_back(*i);\ - m##mob##sSet.insert(*i);\ - ++ i;\ - }\ -} - -void ActorManager::loadAttackList() -{ - bool empty = false; - std::list list; - std::list::const_iterator i; - std::list::const_iterator i_end; - - loadList("attackPriorityMobs", PriorityAttackMob); - loadList("attackMobs", AttackMob); - loadList("ignoreAttackMobs", IgnoreAttackMob); - if (!empty) - { - mAttackMobs.push_back(""); - mAttackMobsSet.insert(""); - } - empty = false; - - loadList("pickupItems", PickupItem); - loadList("ignorePickupItems", IgnorePickupItem); - if (!empty) - { - mPickupItems.push_back(""); - mPickupItemsSet.insert(""); - } - - rebuildAttackMobs(); - rebuildPriorityAttackMobs(); - rebuildPickupItems(); -} - -void ActorManager::storeAttackList() const -{ - serverConfig.setValue("attackPriorityMobs", packList(mPriorityAttackMobs)); - serverConfig.setValue("attackMobs", packList(mAttackMobs)); - serverConfig.setValue("ignoreAttackMobs", packList(mIgnoreAttackMobs)); - - serverConfig.setValue("pickupItems", packList(mPickupItems)); - serverConfig.setValue("ignorePickupItems", packList(mIgnorePickupItems)); -} - -bool ActorManager::checkForPickup(const FloorItem *const item) const -{ - if (mPickupItemsSet.find("") != mPickupItemsSet.end()) - { - if (mIgnorePickupItemsSet.find(item->getName()) - == mIgnorePickupItemsSet.end()) - { - return true; - } - } - else if ((item != nullptr) && mPickupItemsSet.find(item->getName()) - != mPickupItemsSet.end()) - { - return true; - } - return false; -} - -bool ActorManager::checkDefaultPickup() const -{ - return mPickupItemsSet.find("") != mPickupItemsSet.end(); -} - -void ActorManager::updateEffects(const std::map &addEffects, - const std::set &removeEffects) - const -{ - for_actorsm - { -// disabled for performance -// if (reportTrue(*it == nullptr)) -// continue; - if ((*it)->getType() != ActorType::Npc) - continue; - Being *const being = static_cast(*it); - const BeingTypeId type = being->getSubType(); - if (removeEffects.find(type) != removeEffects.end()) - being->removeSpecialEffect(); - const std::map::const_iterator - idAdd = addEffects.find(type); - if (idAdd != addEffects.end()) - being->addSpecialEffect((*idAdd).second); - } -} - -Being *ActorManager::cloneBeing(const Being *const srcBeing, - const int dx, const int dy, - const int id) -{ - returnNullptr(nullptr, srcBeing); - Being *const dstBeing = actorManager->createBeing(fromInt( - toInt(srcBeing->getId(), int) + id, BeingId), - ActorType::Player, - srcBeing->getSubType()); - if (dstBeing == nullptr) - return nullptr; - dstBeing->setGender(srcBeing->getGender()); - dstBeing->setAction(srcBeing->getCurrentAction(), 0); - dstBeing->setTileCoords(srcBeing->getTileX() + dx, - srcBeing->getTileY() + dy); - dstBeing->setName(srcBeing->getName()); - dstBeing->setDirection(srcBeing->getDirection()); - const int sz = CAST_S32(srcBeing->mSprites.size()); - for (int slot = 0; slot < sz; slot ++) - { - const int spriteId = srcBeing->getSpriteID(slot); - const ItemColor color = srcBeing->getSpriteColor(slot); - dstBeing->setSpriteColorId(slot, - spriteId, - color); - } - const int hairSlot = charServerHandler->hairSprite(); - const int hairStyle = -srcBeing->getSpriteID(hairSlot); - const ItemColor hairColor = srcBeing->getHairColor(); - if (hairStyle != 0) - { - dstBeing->setSpriteColor(hairSlot, - hairStyle * -1, - ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); - } - else - { - dstBeing->unSetSprite(hairSlot); - } - dstBeing->setHairColor(hairColor); - return dstBeing; -} - -void ActorManager::updateBadges() const -{ - const BadgeDrawType::Type showBadges = static_cast( - config.getIntValue("showBadges")); - Being::mShowBadges = showBadges; - Being::mVisibleNamePos = static_cast( - config.getIntValue("visiblenamespos")); - - for_actors - { - ActorSprite *const actor = *it; - if (actor->getType() == ActorType::Player) - { - Being *const being = static_cast(actor); - being->showBadges(showBadges != BadgeDrawType::Hide); - } - } -} - -void ActorManager::updateNameId(const std::string &name, - const BeingId beingId) -{ - if (!mEnableIdCollecting) - return; - const int id = CAST_S32(beingId); - if ((id != 0) && - (id < 2000000 || - id >= 110000000)) - { - return; - } - - if (mIdName.find(beingId) == mIdName.end() || - mIdName[beingId].find(name) == mIdName[beingId].end()) - { - mIdName[beingId].insert(name); - const std::string idStr = toString(id); - const std::string dateStr = getDateTimeString(); - std::string dir; - if (beingId != BeingId_zero) - { - dir = pathJoin(settings.usersIdDir, - idStr, - stringToHexPath(name)); - Files::saveTextFile(dir, - "info.txt", - (name + "\n").append(dateStr)); - } - - dir = settings.usersDir; - dir.append(stringToHexPath(name)); - Files::saveTextFile(dir, - "seen.txt", - (name + "\n").append(idStr).append("\n").append(dateStr)); - } -} - -void ActorManager::updateSeenPlayers(const std::set - &onlinePlayers) -{ - if (!mEnableIdCollecting) - return; - - FOR_EACH (std::set::const_iterator, it, onlinePlayers) - { - const std::string name = *it; - if (findBeingByName(name, ActorType::Player) == nullptr) - updateNameId(name, BeingId_zero); - } -} - -std::string ActorManager::getSeenPlayerById(const BeingId id) const -{ - if (!mEnableIdCollecting) - return std::string(); - - const IdNameMappingCIter it = mIdName.find(id); - if (it != mIdName.end()) - { - if (!it->second.empty()) - return *(it->second.begin()); - } - return std::string(); -} - -void ActorManager::removeRoom(const int chatId) -{ - for_actors - { - ActorSprite *const actor = *it; - if (actor->getType() == ActorType::Npc) - { - Being *const being = static_cast(actor); - const ChatObject *const chat = being->getChat(); - if ((chat != nullptr) && chat->chatId == chatId) - { - being->setChat(nullptr); - } - } - } -} - -void ActorManager::updateRoom(const ChatObject *const newChat) -{ - if (newChat == nullptr) - return; - - for_actors - { - const ActorSprite *const actor = *it; - if (actor->getType() == ActorType::Npc) - { - const Being *const being = static_cast(actor); - ChatObject *const chat = being->getChat(); - if ((chat != nullptr) && chat->chatId == newChat->chatId) - { - chat->ownerId = newChat->ownerId; - chat->maxUsers = newChat->maxUsers; - chat->type = newChat->type; - chat->title = newChat->title; - } - } - } -} - -std::string ActorManager::findCharById(const int32_t id) -{ - const std::map::const_iterator it = mChars.find(id); - if (it == mChars.end()) - return std::string(); - return (*it).second; -} - -void ActorManager::addChar(const int32_t id, - const std::string &name) -{ - mChars[id] = name; - - if (guiInput == nullptr) - return; - - guiInput->simulateMouseMove(); -} diff --git a/src/actormanager.h b/src/actormanager.h deleted file mode 100644 index 6fdf8d64c..000000000 --- a/src/actormanager.h +++ /dev/null @@ -1,454 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ACTORMANAGER_H -#define ACTORMANAGER_H - -#include "enums/being/actortype.h" - -#include "enums/resources/item/itemtype.h" - -#include "enums/simpletypes/allowsort.h" -#include "enums/simpletypes/allplayers.h" -#include "enums/simpletypes/beingid.h" -#include "enums/simpletypes/beingtypeid.h" -#include "enums/simpletypes/damaged.h" -#include "enums/simpletypes/identified.h" -#include "enums/simpletypes/itemcolor.h" -#include "enums/simpletypes/npcnames.h" - -#include "listeners/configlistener.h" - -#include "utils/cast.h" -#include "utils/stringmap.h" -#include "utils/stringvector.h" - -#include -#include - -#include "localconsts.h" - -class ActorSprite; -class Being; -class FloorItem; -class LocalPlayer; -class Map; - -struct ChatObject; - -typedef std::set ActorSprites; -typedef ActorSprites::iterator ActorSpritesIterator; -typedef ActorSprites::const_iterator ActorSpritesConstIterator; -typedef std::map ActorSpritesMap; -typedef ActorSpritesMap::iterator ActorSpritesMapIterator; -typedef ActorSpritesMap::const_iterator ActorSpritesMapConstIterator; - -typedef std::map > IdNameMapping; -typedef IdNameMapping::const_iterator IdNameMappingCIter; - -class ActorManager final: public ConfigListener -{ - public: - ActorManager(); - - A_DELETE_COPY(ActorManager) - - ~ActorManager(); - - /** - * Sets the map on which ActorSprites are created. - */ - void setMap(Map *const map); - - /** - * Sets the current player. - */ - void setPlayer(LocalPlayer *const player) A_NONNULL(2); - - /** - * Create a Being and add it to the list of ActorSprites. - */ - Being *createBeing(const BeingId id, - const ActorTypeT type, - const BeingTypeId subtype) A_WARN_UNUSED; - - static Being *cloneBeing(const Being *const srcBeing, - const int dx, const int dy, - const int id); - - /** - * Create a FloorItem and add it to the list of ActorSprites. - */ - FloorItem *createItem(const BeingId id, - const int itemId, - const int x, const int y, - const ItemTypeT itemType, - const int amount, - const int refine, - const ItemColor color, - const Identified identified, - const Damaged damaged, - const int subX, const int subY, - const int *const cards); - - /** - * Destroys the given ActorSprite at the end of - * ActorManager::logic. - */ - void destroy(ActorSprite *const actor); - - void erase(ActorSprite *const actor); - - void undelete(const ActorSprite *const actor); - - /** - * Returns a specific Being, by id; - */ - Being *findBeing(const BeingId id) const A_WARN_UNUSED; - - ActorSprite *findActor(const BeingId id) const A_WARN_UNUSED; - - /** - * Returns a being at specific coordinates. - */ - Being *findBeing(const int x, const int y, const ActorTypeT - type = ActorType::Unknown) const A_WARN_UNUSED; - - /** - * Returns a being at the specific pixel. - */ - Being *findBeingByPixel(const int x, const int y, - const AllPlayers allPlayers = AllPlayers_false) - const A_WARN_UNUSED; - - /** - * Returns a beings at the specific pixel. - */ - void findBeingsByPixel(STD_VECTOR &beings, - const int x, const int y, - const AllPlayers allPlayers) const; - - /** - * Returns a portal at the specific tile. - */ - Being *findPortalByTile(const int x, const int y) const A_WARN_UNUSED; - - /** - * Returns a specific FloorItem, by id. - */ - FloorItem *findItem(const BeingId id) const A_WARN_UNUSED; - - /** - * Returns a FloorItem at specific coordinates. - */ - FloorItem *findItem(const int x, const int y) const A_WARN_UNUSED; - - /** - * Returns a being nearest to specific coordinates. - * - * @param x X coordinate in pixels. - * @param y Y coordinate in pixels. - * @param maxTileDist Maximal distance in tiles. If minimal distance is - * larger, no being is returned. - * @param type The type of being to look for. - */ - Being *findNearestLivingBeing(const int x, const int y, - int maxTileDist, - const ActorTypeT type, - const Being *const excluded) - const A_WARN_UNUSED; - - /** - * Returns a being nearest to another being. - * - * @param aroundBeing The being to search around. - * @param maxTileDist Maximal distance in tiles. If minimal distance is - * larger, no being is returned. - * @param type The type of being to look for. - */ - Being *findNearestLivingBeing(const Being *const aroundBeing, - const int maxTileDist, - const ActorTypeT type, - const AllowSort allowSort) - const A_WARN_UNUSED; - - /** - * Finds a being by name and (optionally) by type. - */ - Being *findBeingByName(const std::string &name, - const ActorTypeT - type = ActorType::Unknown) - const A_WARN_UNUSED; - - /** - * Finds a nearest being by name and (optionally) by type. - */ - Being *findNearestByName(const std::string &name, - const ActorTypeT &type - = ActorType::Unknown) const A_WARN_UNUSED; - - /** - * Finds most damaged player, non-enemy and alive - * \param maxTileDist maximal distance. - */ - Being *findMostDamagedPlayer(const int maxTileDist) - const A_WARN_UNUSED; - - /** - * Finds the nearest player who has PVP on, - * or just the nearest player if map pvp is on - */ - Being *findNearestPvpPlayer() const A_WARN_UNUSED; - -#ifdef TMWA_SUPPORT - /** - * Heal all players in distance. - * - * \param maxdist maximal distance. If minimal distance is larger, - * no being is returned - */ -// void HealAllTargets(Being *aroundBeing, int maxdist, -// ActorTypeT type) const; - - void healTarget() const; - - void heal(const Being *const target) const; - - void itenplz() const; -#endif // TMWA_SUPPORT - - /** - * Returns the whole list of beings. - */ - const ActorSprites &getAll() const A_CONST; - - /** - * Returns true if the given ActorSprite is in the manager's list, - * false otherwise. - * - * \param actor the ActorSprite to search for - */ - bool hasActorSprite(const ActorSprite *const actor) - const A_WARN_UNUSED; - - /** - * Performs ActorSprite logic and deletes ActorSprite scheduled to be - * deleted. - */ - void logic(); - - /** - * Destroys all ActorSprites except the local player - */ - void clear(); - - void addBlock(const BeingId id); - - void deleteBlock(const BeingId id); - - bool isBlocked(const BeingId id) const; - - void printAllToChat(); - - void printBeingsToChat(const std::string &header) const; - - static void printBeingsToChat(const STD_VECTOR &beings, - const std::string &header); - - void getPlayerNames(StringVect &names, - const NpcNames npcNames) const; - - void getMobNames(StringVect &names) const; - - void updatePlayerNames() const; - - void updatePlayerColors() const; - - void updatePlayerGuild() const; - -#ifdef TMWA_SUPPORT - void parseLevels(std::string levels) const; -#endif // TMWA_SUPPORT - - bool pickUpAll(const int x1, - const int y1, - const int x2, - const int y2, - const bool serverBuggy = false) const; - - bool pickUpNearest(const int x, const int y, int maxdist) const; - - void optionChanged(const std::string &name) override final; - - void removeAttackMob(const std::string &name); - - void removePickupItem(const std::string &name); - - void addPriorityAttackMob(const std::string &name); - - void addAttackMob(const std::string &name); - - void addIgnoreAttackMob(const std::string &name); - - void addPickupItem(const std::string &name); - - void addIgnorePickupItem(const std::string &name); - - void setPriorityAttackMobs(const std::list &mobs) - { mPriorityAttackMobs = mobs; } - - void setAttackMobs(const std::list &mobs) - { mAttackMobs = mobs; } - - int getPriorityAttackMobsSize() const noexcept2 A_WARN_UNUSED - { return CAST_S32(mPriorityAttackMobs.size()); } - - int getAttackMobsSize() const noexcept2 A_WARN_UNUSED - { return CAST_S32(mAttackMobs.size()); } - - int getPickupItemsSize() const noexcept2 A_WARN_UNUSED - { return CAST_S32(mPickupItems.size()); } - -#define defList(list1, mob) \ - bool isIn##list1##List(const std::string &name) const A_WARN_UNUSED\ - { return m##list1##mob##Set.find(name) != m##list1##mob##Set.end(); }\ - void rebuild##list1##mob();\ - std::set get##list1##mob##Set() const noexcept2\ - A_WARN_UNUSED\ - { return m##list1##mob##Set; }\ - std::list get##list1##mob() const noexcept2 A_WARN_UNUSED\ - { return m##list1##mob; } - - defList(Attack, Mobs) - defList(PriorityAttack, Mobs) - defList(IgnoreAttack, Mobs) - defList(Pickup, Items) - defList(IgnorePickup, Items) - - const StringIntMap &getAttackMobsMap() const noexcept2 A_WARN_UNUSED - { return mAttackMobsMap; } - - const StringIntMap &getPriorityAttackMobsMap() const noexcept2 - A_WARN_UNUSED - { return mPriorityAttackMobsMap; } - - int getAttackMobIndex(const std::string &name) const A_WARN_UNUSED; - - int getPriorityAttackMobIndex(const std::string &name) - const A_WARN_UNUSED; - - int getPickupItemIndex(const std::string &name) const A_WARN_UNUSED; - - static int getIndexByName(const std::string &name, - const StringIntMap &map) - A_WARN_UNUSED; - - bool checkForPickup(const FloorItem *const item) const A_WARN_UNUSED; - - bool checkDefaultPickup() const A_WARN_UNUSED; - - void updateEffects(const std::map &addEffects, - const std::set &removeEffects) const; - - void updateBadges() const; - - void updateNameId(const std::string &name, - const BeingId beingId); - - void updateSeenPlayers(const std::set &onlinePlayers); - - std::string getSeenPlayerById(const BeingId id) const; - - size_t size() const - { return mActors.size(); } - - void removeRoom(const int chatId); - - void updateRoom(const ChatObject *const newChat); - - std::string findCharById(const int32_t id); - - void addChar(const int32_t id, - const std::string &name); - -#ifndef UNITTESTS - protected: -#endif // UNITTESTS - bool validateBeing(const Being *const aroundBeing, - Being *const being, - const ActorTypeT &type, - const Being *const excluded = nullptr, - const int maxCost = 20) const A_WARN_UNUSED; - - Being *findNearestLivingBeing(const Being *const aroundBeing, - const int maxdist, - const ActorTypeT &type, - const int x, const int y, - const Being *const excluded, - const AllowSort allowSort) - const A_WARN_UNUSED; - - void loadAttackList(); - - void storeAttackList() const; - - ActorSprites mActors; - ActorSprites mDeleteActors; - ActorSpritesMap mActorsIdMap; - IdNameMapping mIdName; - std::set mBlockedBeings; - std::map mChars; - Map *mMap; -#ifdef TMWA_SUPPORT - std::string mSpellHeal1; - std::string mSpellHeal2; - std::string mSpellItenplz; -#endif // TMWA_SUPPORT - - bool mTargetDeadPlayers; - bool mTargetOnlyReachable; - bool mCyclePlayers; - bool mCycleMonsters; - bool mCycleNPC; - bool mExtMouseTargeting; - bool mEnableIdCollecting; - -#define defVarsP(mob) \ - std::list mPriority##mob;\ - std::set mPriority##mob##Set;\ - StringIntMap mPriority##mob##Map; - -#define defVars(mob) \ - std::list m##mob;\ - std::set m##mob##Set;\ - StringIntMap m##mob##Map;\ - std::list mIgnore##mob;\ - std::set mIgnore##mob##Set; - - defVarsP(AttackMobs) - defVars(AttackMobs) - defVars(PickupItems) -}; - -extern ActorManager *actorManager; - -#endif // ACTORMANAGER_H diff --git a/src/avatar.cpp b/src/avatar.cpp deleted file mode 100644 index e3975a3d7..000000000 --- a/src/avatar.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "avatar.h" - -#include "debug.h" - -Avatar::Avatar(const std::string &name) : - mId(BeingId_zero), - mCharId(0), - mName(name), - mOriginalName(name), - mHp(0), - mMaxHp(0), - mDamageHp(0), - mLevel(1), - mMap(), - mX(-1), - mY(-1), - mType(AVATAR_PLAYER), - mExp(0), - mGender(Gender::UNSPECIFIED), - mRace(-1), - mIp(), - mOnline(false), - mDisplayBold(false), - mPoison(false) -{ -} - -std::string Avatar::getComplexName() const -{ - if (mName == mOriginalName || - mOriginalName.empty()) - { - return mName; - } - return std::string(mName).append("(").append( - mOriginalName).append(")"); -} - -std::string Avatar::getAdditionString() const -{ - if (!getIp().empty()) - return " - " + getIp(); - return ""; -} diff --git a/src/avatar.h b/src/avatar.h deleted file mode 100644 index 3db83de12..000000000 --- a/src/avatar.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef AVATAR_H -#define AVATAR_H - -#include "enums/being/gender.h" - -#include "enums/simpletypes/beingid.h" - -#include - -#include "localconsts.h" - -enum AvatarType -{ - AVATAR_PLAYER = 0 -}; - -class Avatar notfinal -{ - public: - explicit Avatar(const std::string &name = ""); - - A_DELETE_COPY(Avatar) - - virtual ~Avatar() - { } - - /** - * Returns the avatar's name. - */ - std::string getName() const noexcept2 A_WARN_UNUSED - { return mName; } - - /** - * Set the avatar's name. - */ - void setName(const std::string &name) - { mName = name; } - - /** - * Returns the avatar's original name. - */ - std::string getOriginalName() const noexcept2 A_WARN_UNUSED - { return mOriginalName; } - - std::string getComplexName() const A_WARN_UNUSED; - - virtual std::string getAdditionString() const A_WARN_UNUSED; - - /** - * Set the avatar's original name. - */ - void setOriginalName(const std::string &name) - { mOriginalName = name; } - - /** - * Returns the avatar's online status. - */ - bool getOnline() const noexcept2 A_WARN_UNUSED - { return mOnline; } - - /** - * Set the avatar's online status. - */ - void setOnline(const bool online) - { mOnline = online; } - - int getHp() const noexcept2 A_WARN_UNUSED - { return mHp; } - - void setHp(const int hp) - { mHp = hp; } - - int getMaxHp() const noexcept2 A_WARN_UNUSED - { return mMaxHp; } - - void setMaxHp(const int maxHp) - { mMaxHp = maxHp; } - - int getDamageHp() const noexcept2 A_WARN_UNUSED - { return mDamageHp; } - - void setDamageHp(const int damageHp) - { mDamageHp = damageHp; } - - bool getDisplayBold() const noexcept2 A_WARN_UNUSED - { return mDisplayBold; } - - void setDisplayBold(const bool displayBold) - { mDisplayBold = displayBold; } - - int getLevel() const noexcept2 A_WARN_UNUSED - { return mLevel; } - - void setLevel(const int level) - { mLevel = level; } - - std::string getMap() const noexcept2 A_WARN_UNUSED - { return mMap; } - - void setMap(const std::string &map) - { mMap = map; } - - int getX() const noexcept2 A_WARN_UNUSED - { return mX; } - - void setX(const int x) - { mX = x; } - - int getY() const noexcept2 A_WARN_UNUSED - { return mY; } - - void setY(const int y) - { mY = y; } - - int getType() const noexcept2 A_WARN_UNUSED - { return mType; } - - void setType(const int n) - { mType = n; } - - int getExp() const noexcept2 A_WARN_UNUSED - { return mExp; } - - void setExp(const int n) - { mExp = n; } - - BeingId getID() const noexcept2 A_WARN_UNUSED - { return mId; } - - void setID(const BeingId id) - { mId = id; } - - int getCharId() const noexcept2 A_WARN_UNUSED - { return mCharId; } - - void setCharId(const int id) - { mCharId = id; } - - GenderT getGender() const noexcept2 A_WARN_UNUSED - { return mGender; } - - void setGender(const GenderT g) - { mGender = g; } - - int getRace() const noexcept2 A_WARN_UNUSED - { return mRace; } - - void setRace(const int r) - { mRace = r; } - - const std::string &getIp() const noexcept2 A_WARN_UNUSED - { return mIp; } - - void setIp(const std::string &ip) - { mIp = ip; } - - bool getPoison() const noexcept2 A_WARN_UNUSED - { return mPoison; } - - void setPoison(const bool b) - { mPoison = b; } - - protected: - BeingId mId; - int mCharId; - std::string mName; - std::string mOriginalName; - int mHp; - int mMaxHp; - int mDamageHp; - int mLevel; - std::string mMap; - int mX; - int mY; - int mType; - int mExp; - GenderT mGender; - int mRace; - std::string mIp; - bool mOnline; - bool mDisplayBold; - bool mPoison; -}; - -#endif // AVATAR_H diff --git a/src/being/actor.cpp b/src/being/actor.cpp deleted file mode 100644 index a881c005e..000000000 --- a/src/being/actor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/actor.h" - -#include "resources/map/map.h" - -#include "debug.h" - -Actor::Actor() : - mPixelX(0), - mPixelY(0), - mMap(nullptr), - mPos(), - mYDiff(0), - mMapActor() -{ -} - -Actor::~Actor() -{ - if (mMap != nullptr) - { - mMap->removeActor(mMapActor); - mMap = nullptr; - } -} - -void Actor::setMap(Map *const map) -{ - // Remove Actor from potential previous map - if (mMap != nullptr) - mMap->removeActor(mMapActor); - - mMap = map; - - // Add Actor to potential new map - if (mMap != nullptr) - mMapActor = mMap->addActor(this); -} - -int Actor::getTileX() const -{ - if (mMap == nullptr || - mMap->getTileWidth() == 0) - { - return 0; - } - - return getPixelX() / mMap->getTileWidth(); -} - -int Actor::getTileY() const -{ - if (mMap == nullptr || - mMap->getTileHeight() == 0) - { - return 0; - } - - return getPixelY() / mMap->getTileHeight(); -} - -void Actor::setPixelPositionF(const Vector &restrict pos) restrict2 -{ - mPos = pos; - mPixelX = CAST_S32(mPos.x); - mPixelY = CAST_S32(mPos.y); -} diff --git a/src/being/actor.h b/src/being/actor.h deleted file mode 100644 index 50a9dca24..000000000 --- a/src/being/actor.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_ACTOR_H -#define BEING_ACTOR_H - -#include "vector.h" - -#include "utils/cast.h" - -#include - -#include "localconsts.h" - -class Actor; -class Graphics; -class Map; - -typedef std::list Actors; -typedef Actors::const_iterator ActorsCIter; - -class Actor notfinal -{ - public: - A_DELETE_COPY(Actor) - - virtual ~Actor(); - - /** - * Draws the Actor to the given graphics context. - * - * Note: this function could be simplified if the graphics context - * would support setting a translation offset. It already does this - * partly with the clipping rectangle support. - */ - virtual void draw(Graphics *const graphics, - const int offsetX, - const int offsetY) const A_NONNULL(2) = 0; - - /** - * Returns the horizontal size of the actors graphical representation - * in pixels or 0 when it is undefined. - */ - virtual int getWidth() const A_WARN_UNUSED - { return 0; } - - /** - * Returns the vertical size of the actors graphical representation - * in pixels or 0 when it is undefined. - */ - virtual int getHeight() const A_WARN_UNUSED - { return 0; } - - /** - * Returns the pixel position of this actor. - */ - const Vector &getPixelPositionF() const noexcept2 A_WARN_UNUSED - { return mPos; } - - /** - * Sets the pixel position of this actor. - */ - virtual void setPixelPositionF(const Vector &restrict pos) restrict2; - - /** - * Returns the pixels X coordinate of the actor. - */ - int getPixelX() const noexcept2 A_WARN_UNUSED - { return CAST_S32(mPos.x); } - - /** - * Returns the pixel Y coordinate of the actor. - */ - virtual int getPixelY() const A_WARN_UNUSED - { return CAST_S32(mPos.y); } - - /** - * Returns the pixel Y coordinate of the actor for sorting only. - */ - virtual int getSortPixelY() const A_WARN_UNUSED - { return CAST_S32(mPos.y) - mYDiff; } - - /** - * Returns the x coordinate in tiles of the actor. - */ - virtual int getTileX() const A_WARN_UNUSED; - - /** - * Returns the y coordinate in tiles of the actor. - */ - virtual int getTileY() const A_WARN_UNUSED; - - /** - * Returns the number of Image layers used to draw the actor. - */ - virtual int getNumberOfLayers() const A_WARN_UNUSED - { return 0; } - - /** - * Returns the current alpha value used to draw the actor. - */ - virtual float getAlpha() const A_WARN_UNUSED = 0; - - /** - * Sets the alpha value used to draw the actor. - */ - virtual void setAlpha(float alpha) = 0; - - virtual void setMap(Map *const map); - - const Map* getMap() const noexcept2 A_WARN_UNUSED - { return mMap; } - - int mPixelX; - int mPixelY; - - protected: - Actor(); - - Map *mMap; - Vector mPos; /**< Position in pixels relative to map. */ - int mYDiff; - - private: - Actors::iterator mMapActor; -}; - -#endif // BEING_ACTOR_H diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp deleted file mode 100644 index 6594c7e3c..000000000 --- a/src/being/actorsprite.cpp +++ /dev/null @@ -1,602 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/actorsprite.h" - -#include "configuration.h" -#include "settings.h" -#include "statuseffect.h" - -#include "being/localplayer.h" - -#include "const/utils/timer.h" - -#include "gui/theme.h" - -#include "listeners/debugmessagelistener.h" - -#include "particle/particle.h" - -#include "resources/db/statuseffectdb.h" - -#include "resources/loaders/imageloader.h" - -#include "resources/sprite/animatedsprite.h" -#include "resources/sprite/imagesprite.h" -#include "resources/sprite/spritereference.h" - -#include "utils/checkutils.h" -#include "utils/delete2.h" -#include "utils/foreach.h" -#include "utils/timer.h" - -#include "debug.h" - -#define for_each_cursors() \ - for (int size = CAST_S32(TargetCursorSize::SMALL); \ - size < CAST_S32(TargetCursorSize::NUM_TC); \ - size ++) \ - { \ - for (int type = CAST_S32(TargetCursorType::NORMAL); \ - type < CAST_S32(TargetCursorType::NUM_TCT); \ - type ++) \ - -#define end_foreach } - -static const unsigned int STATUS_EFFECTS = 32; - -AnimatedSprite *ActorSprite::targetCursor - [CAST_SIZE(TargetCursorType::NUM_TCT)] - [CAST_SIZE(TargetCursorSize::NUM_TC)]; -bool ActorSprite::loaded = false; - -ActorSprite::ActorSprite(const BeingId id) : - CompoundSprite(), - Actor(), - mStatusEffects(), - mStatusParticleEffects(), - mChildParticleEffects(&mStatusParticleEffects, false), - mHorseId(0), - mId(id), - mUsedTargetCursor(nullptr), - mActorSpriteListeners(), - mCursorPaddingX(0), - mCursorPaddingY(0), - mMustResetParticles(false), - mPoison(false), - mHaveCart(false), - mTrickDead(false) -{ -} - -ActorSprite::~ActorSprite() -{ - mChildParticleEffects.clear(); - mMustResetParticles = true; - - mUsedTargetCursor = nullptr; - - if (localPlayer != nullptr && - localPlayer != this && - localPlayer->getTarget() == this) - { - localPlayer->setTarget(nullptr); - } - - // Notify listeners of the destruction. - FOR_EACH (ActorSpriteListenerIterator, iter, mActorSpriteListeners) - { - if (reportFalse(*iter)) - (*iter)->actorSpriteDestroyed(*this); - } -} - -void ActorSprite::logic() -{ - BLOCK_START("ActorSprite::logic") - // Update sprite animations - update(tick_time * MILLISECONDS_IN_A_TICK); - - // Restart status/particle effects, if needed - if (mMustResetParticles) - { - mMustResetParticles = false; - FOR_EACH (std::set::const_iterator, it, mStatusEffects) - { - const StatusEffect *const effect - = StatusEffectDB::getStatusEffect(*it, Enable_true); - if (effect != nullptr && - effect->mIsPersistent) - { - updateStatusEffect(*it, - Enable_true, - IsStart_false); - } - } - } - - // Update particle effects - mChildParticleEffects.moveTo(mPos.x, mPos.y); - BLOCK_END("ActorSprite::logic") -} - -void ActorSprite::setMap(Map *const map) -{ - Actor::setMap(map); - - // Clear particle effect list because child particles became invalid - mChildParticleEffects.clear(); - mMustResetParticles = true; // Reset status particles on next redraw -} - -void ActorSprite::controlAutoParticle(Particle *const particle) -{ - if (particle != nullptr) - { - particle->setActor(mId); - mChildParticleEffects.addLocally(particle); - } -} - -void ActorSprite::controlCustomParticle(Particle *const particle) -{ - if (particle != nullptr) - { - // The effect may not die without the beings permission or we segfault - particle->disableAutoDelete(); - mChildParticleEffects.addLocally(particle); - } -} - -void ActorSprite::controlParticleDeleted(const Particle *const particle) -{ - if (particle != nullptr) - mChildParticleEffects.removeLocally(particle); -} - -void ActorSprite::setTargetType(const TargetCursorTypeT type) -{ - if (type == TargetCursorType::NONE) - { - untarget(); - } - else - { - const size_t sz = CAST_SIZE(getTargetCursorSize()); - mUsedTargetCursor = targetCursor[CAST_S32(type)][sz]; - if (mUsedTargetCursor != nullptr) - { - static const int targetWidths[CAST_SIZE( - TargetCursorSize::NUM_TC)] - = {0, 0, 0}; - static const int targetHeights[CAST_SIZE( - TargetCursorSize::NUM_TC)] - = {-mapTileSize / 2, -mapTileSize / 2, -mapTileSize}; - - mCursorPaddingX = CAST_S32(targetWidths[sz]); - mCursorPaddingY = CAST_S32(targetHeights[sz]); - } - } -} - -void ActorSprite::setStatusEffect(const int32_t index, - const Enable active, - const IsStart start) -{ - const Enable wasActive = fromBool( - mStatusEffects.find(index) != mStatusEffects.end(), Enable); - - if (active != wasActive) - { - updateStatusEffect(index, active, start); - if (active == Enable_true) - { - mStatusEffects.insert(index); - } - else - { - mStatusEffects.erase(index); - } - } -} - -// function for legacy configs only. Must be removed in future -void ActorSprite::setStatusEffectBlock(const int offset, - const uint16_t newEffects) -{ - for (unsigned i = 0; i < STATUS_EFFECTS; i++) - { - const bool val = (newEffects & (1 << i)) > 0; - const int32_t index = StatusEffectDB::blockIdToId( - offset + i); // block-id (offset + i) to id (index) - - if (index != -1) - { - setStatusEffect(index, - fromBool(val, Enable), - IsStart_true); - } - else if (val && config.getBoolValue("unimplimentedLog")) - { - const std::string str = strprintf( - "Error: unknown effect by block-index. " - "Offset: %d, effect int: %d, i: %u", - offset, CAST_S32(newEffects), i); - logger->log(str); - DebugMessageListener::distributeEvent(str); - } - } -} - -static void applyEffectByOption(ActorSprite *const actor, - uint32_t option, - const char *const name, - const OptionsMap& options) -{ - FOR_EACH (OptionsMapCIter, it, options) - { - const uint32_t opt = (*it).first; - const int32_t id = (*it).second; - const Enable enable = (opt & option) != 0 ? Enable_true : Enable_false; - option |= opt; - option ^= opt; - actor->setStatusEffect(id, - enable, - IsStart_false); - } - if (option != 0U && - config.getBoolValue("unimplimentedLog")) - { - const std::string str = strprintf( - "Error: unknown effect by %s. " - "Left value: %u", - name, - option); - logger->log(str); - DebugMessageListener::distributeEvent(str); - } -} - -static void applyEffectByOption1(ActorSprite *const actor, - uint32_t option, - const char *const name, - const OptionsMap& options) -{ - FOR_EACH (OptionsMapCIter, it, options) - { - const uint32_t opt = (*it).first; - const int32_t id = (*it).second; - if (opt == option) - { - actor->setStatusEffect(id, - Enable_true, - IsStart_false); - option = 0U; - } - else - { - actor->setStatusEffect(id, - Enable_false, - IsStart_false); - } - } - if (option != 0 && - config.getBoolValue("unimplimentedLog")) - { - const std::string str = strprintf( - "Error: unknown effect by %s. " - "Left value: %u", - name, - option); - logger->log(str); - DebugMessageListener::distributeEvent(str); - } -} - -void ActorSprite::setStatusEffectOpitons(const uint32_t option, - const uint32_t opt1, - const uint32_t opt2, - const uint32_t opt3) -{ - if (settings.legacyEffects == false) - { - applyEffectByOption(this, option, "option", - StatusEffectDB::getOptionMap()); - applyEffectByOption1(this, opt1, "opt1", - StatusEffectDB::getOpt1Map()); - applyEffectByOption(this, opt2, "opt2", - StatusEffectDB::getOpt2Map()); - applyEffectByOption(this, opt3, "opt3", - StatusEffectDB::getOpt3Map()); - } - else - { - uint32_t statusEffects = opt2; - statusEffects |= option << 16; - setStatusEffectBlock(0, - CAST_U16((statusEffects >> 16) & 0xffffU)); - setStatusEffectBlock(16, - CAST_U16(statusEffects & 0xffffU)); - setStatusEffectBlock(32, - CAST_U16(opt3)); - } -} - -void ActorSprite::setStatusEffectOpitons(const uint32_t option, - const uint32_t opt1, - const uint32_t opt2) -{ - if (settings.legacyEffects == false) - { - applyEffectByOption(this, option, "option", - StatusEffectDB::getOptionMap()); - applyEffectByOption1(this, opt1, "opt1", - StatusEffectDB::getOpt1Map()); - applyEffectByOption(this, opt2, "opt2", - StatusEffectDB::getOpt2Map()); - } - else - { - uint32_t statusEffects = opt2; - statusEffects |= option << 16; - setStatusEffectBlock(0, - CAST_U16((statusEffects >> 16) & 0xffffU)); - setStatusEffectBlock(16, - CAST_U16(statusEffects & 0xffffU)); - } -} - -void ActorSprite::setStatusEffectOpiton0(const uint32_t option) -{ - if (settings.legacyEffects == false) - { - applyEffectByOption(this, option, "option", - StatusEffectDB::getOptionMap()); - } - else - { - const uint32_t statusEffects = option << 16; - setStatusEffectBlock(0, - CAST_U16((statusEffects >> 16) & 0xffff)); - } -} - -void ActorSprite::updateStatusEffect(const int32_t index, - const Enable newStatus, - const IsStart start) -{ - StatusEffect *const effect = StatusEffectDB::getStatusEffect( - index, newStatus); - if (effect == nullptr) - return; - if (effect->mIsPoison && getType() == ActorType::Player) - setPoison(newStatus == Enable_true); - else if (effect->mIsCart && localPlayer == this) - setHaveCart(newStatus == Enable_true); - else if (effect->mIsRiding) - setRiding(newStatus == Enable_true); - else if (effect->mIsTrickDead) - setTrickDead(newStatus == Enable_true); - else if (effect->mIsPostDelay) - stopCast(newStatus == Enable_true); - handleStatusEffect(effect, index, newStatus, start); -} - -void ActorSprite::handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId, - const Enable newStatus, - const IsStart start) -{ - if (effect == nullptr) - return; - - if (newStatus == Enable_true) - { - if (effectId >= 0) - { - Particle *particle = nullptr; - if (start == IsStart_true) - particle = effect->getStartParticle(); - if (particle == nullptr) - particle = effect->getParticle(); - if (particle != nullptr) - mStatusParticleEffects.setLocally(effectId, particle); - } - } - else - { - mStatusParticleEffects.delLocally(effectId); - } -} - -void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, - const ForceDisplay forceDisplay, - const DisplayTypeT displayType, - const std::string &color) -{ - clear(); - - FOR_EACH (SpriteRefs, it, display.sprites) - { - if (*it == nullptr) - continue; - const std::string file = pathJoin(paths.getStringValue("sprites"), - combineDye3((*it)->sprite, color)); - - const int variant = (*it)->variant; - addSprite(AnimatedSprite::delayedLoad(file, variant)); - } - - // Ensure that something is shown, if desired - if (mSprites.empty() && forceDisplay == ForceDisplay_true) - { - if (display.image.empty()) - { - addSprite(AnimatedSprite::delayedLoad(pathJoin( - paths.getStringValue("sprites"), - paths.getStringValue("spriteErrorFile")))); - } - else - { - std::string imagePath; - switch (displayType) - { - case DisplayType::Item: - default: - imagePath = pathJoin(paths.getStringValue("itemIcons"), - display.image); - break; - case DisplayType::Floor: - imagePath = pathJoin(paths.getStringValue("itemIcons"), - display.floor); - break; - } - imagePath = combineDye2(imagePath, color); - Image *img = Loader::getImage(imagePath); - - if (img == nullptr) - img = Theme::getImageFromTheme("unknown-item.png"); - - addSprite(new ImageSprite(img)); - if (img != nullptr) - img->decRef(); - } - } - - mChildParticleEffects.clear(); - - // setup particle effects - if (ParticleEngine::enabled && (particleEngine != nullptr)) - { - FOR_EACH (StringVectCIter, itr, display.particles) - { - Particle *const p = particleEngine->addEffect(*itr, 0, 0); - controlAutoParticle(p); - } - } - - mMustResetParticles = true; -} - -void ActorSprite::load() -{ - if (loaded) - unload(); - - initTargetCursor(); - - loaded = true; -} - -void ActorSprite::unload() -{ - if (reportTrue(!loaded)) - return; - - cleanupTargetCursors(); - loaded = false; -} - -void ActorSprite::addActorSpriteListener(ActorSpriteListener *const listener) -{ - mActorSpriteListeners.push_front(listener); -} - -void ActorSprite::removeActorSpriteListener(ActorSpriteListener *const - listener) -{ - mActorSpriteListeners.remove(listener); -} - -static const char *cursorType(const TargetCursorTypeT type) -{ - switch (type) - { - case TargetCursorType::IN_RANGE: - return "in-range"; - default: - case TargetCursorType::NONE: - case TargetCursorType::NUM_TCT: - case TargetCursorType::NORMAL: - return "normal"; - } -} - -static const char *cursorSize(const TargetCursorSizeT size) -{ - switch (size) - { - case TargetCursorSize::LARGE: - return "l"; - case TargetCursorSize::MEDIUM: - return "m"; - default: - case TargetCursorSize::NUM_TC: - case TargetCursorSize::SMALL: - return "s"; - } -} - -void ActorSprite::initTargetCursor() -{ - static const std::string targetCursorFile("target-cursor-%s-%s.xml"); - - // Load target cursors - for_each_cursors() - { - targetCursor[type][size] = AnimatedSprite::load( - Theme::resolveThemePath(strprintf( - targetCursorFile.c_str(), - cursorType(static_cast(type)), - cursorSize(static_cast(size))))); - } - end_foreach -} - -void ActorSprite::cleanupTargetCursors() -{ - for_each_cursors() - { - delete2(targetCursor[type][size]) - } - end_foreach -} - -std::string ActorSprite::getStatusEffectsString() const -{ - std::string effectsStr; - if (!mStatusEffects.empty()) - { - FOR_EACH (std::set::const_iterator, it, mStatusEffects) - { - const StatusEffect *const effect = - StatusEffectDB::getStatusEffect( - *it, - Enable_true); - if (effect == nullptr) - continue; - if (!effectsStr.empty()) - effectsStr.append(", "); - effectsStr.append(effect->mName); - } - } - return effectsStr; -} diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h deleted file mode 100644 index db912e059..000000000 --- a/src/being/actorsprite.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_ACTORSPRITE_H -#define BEING_ACTORSPRITE_H - -#include "being/actor.h" -#include "being/compoundsprite.h" - -#include "const/resources/map/map.h" - -#include "enums/being/actortype.h" -#include "enums/being/targetcursorsize.h" -#include "enums/being/targetcursortype.h" - -#include "enums/simpletypes/beingid.h" -#include "enums/simpletypes/enable.h" -#include "enums/simpletypes/forcedisplay.h" -#include "enums/simpletypes/isstart.h" - -#include "enums/resources/displaytype.h" - -#include "enums/resources/map/blocktype.h" - -#include "particle/particlelist.h" -#include "particle/particlevector.h" - -#include "localconsts.h" - -class AnimatedSprite; -class StatusEffect; -class ActorSpriteListener; - -struct SpriteDisplay; - -class ActorSprite notfinal : public CompoundSprite, public Actor -{ - public: - explicit ActorSprite(const BeingId id); - - A_DELETE_COPY(ActorSprite) - - virtual ~ActorSprite(); - - BeingId getId() const noexcept2 A_WARN_UNUSED - { return mId; } - - void setId(const BeingId id) noexcept2 - { mId = id; } - - /** - * Returns the type of the ActorSprite. - */ - virtual ActorTypeT getType() const noexcept2 A_WARN_UNUSED - { return ActorType::Unknown; } - - virtual void logic(); - - void setMap(Map *const map) override; - - /** - * Gets the way the object blocks pathfinding for other objects - */ - virtual BlockTypeT getBlockType() const A_WARN_UNUSED - { return BlockType::NONE; } - - /** - * Take control of a particle. Particle can be auto deleted. - */ - void controlAutoParticle(Particle *const particle); - - /** - * Take control of a particle. Owner must remove particle by self. - */ - void controlCustomParticle(Particle *const particle); - - /** - * Returns the required size of a target cursor for this being. - */ - virtual TargetCursorSizeT getTargetCursorSize() const A_WARN_UNUSED - { return TargetCursorSize::MEDIUM; } - - virtual int getTargetOffsetX() const A_WARN_UNUSED - { return 0; } - - virtual int getTargetOffsetY() const A_WARN_UNUSED - { return 0; } - - /** - * Sets the target animation for this actor. - */ - void setTargetType(const TargetCursorTypeT type); - - /** - * Untargets the actor. - */ - void untarget() - { mUsedTargetCursor = nullptr; } - - void setStatusEffect(const int32_t index, - const Enable active, - const IsStart start); - - void setStatusEffectOpitons(const uint32_t option, - const uint32_t opt1, - const uint32_t opt2, - const uint32_t opt3); - - void setStatusEffectOpitons(const uint32_t option, - const uint32_t opt1, - const uint32_t opt2); - - void setStatusEffectOpiton0(const uint32_t option); - - void setAlpha(const float alpha) override final - { CompoundSprite::setAlpha(alpha); } - - float getAlpha() const override final A_WARN_UNUSED - { return CompoundSprite::getAlpha(); } - - int getWidth() const override A_WARN_UNUSED - { return CompoundSprite::getWidth(); } - - int getHeight() const override A_WARN_UNUSED - { return CompoundSprite::getHeight(); } - - static void load(); - - static void unload(); - - /** - * Add an ActorSprite listener. - */ - void addActorSpriteListener(ActorSpriteListener *const listener); - - /** - * Remove an ActorSprite listener. - */ - void removeActorSpriteListener(ActorSpriteListener *const listener); - - int getActorX() const A_WARN_UNUSED - { return getPixelX() - mapTileSize / 2; } - - int getActorY() const A_WARN_UNUSED - { return getPixelY() - mapTileSize; } - - void setPoison(const bool b) - { mPoison = b; } - - bool getPoison() const A_WARN_UNUSED - { return mPoison; } - - void setHaveCart(const bool b) - { mHaveCart = b; } - - bool getHaveCart() const A_WARN_UNUSED - { return mHaveCart; } - - virtual void setRiding(const bool b) - { mHorseId = b ? 1 : 0; } - - virtual void setTrickDead(const bool b) - { mTrickDead = b; } - - bool isTrickDead() const A_WARN_UNUSED - { return mTrickDead; } - - const std::set &getStatusEffects() const A_WARN_UNUSED - { return mStatusEffects; } - - std::string getStatusEffectsString() const; - - virtual void stopCast(const bool b A_UNUSED) - { } - - size_t getParticlesCount() const - { - return mStatusParticleEffects.usedSize() + - mChildParticleEffects.size(); - } - - void controlParticleDeleted(const Particle *const particle); - - protected: - /** - * A status effect block is a 16 bit mask of status effects. We assign - * each such flag a block ID of offset + bitnr. - * - * These are NOT the same as the status effect indices. - */ - void setStatusEffectBlock(const int offset, - const uint16_t newEffects); - - /** - * Notify self that a status effect has flipped. - * The new flag is passed. - */ - virtual void updateStatusEffect(const int32_t index, - const Enable newStatus, - const IsStart start); - - /** - * Handle an update to a status or stun effect - * - * \param The StatusEffect to effect - * \param effectId -1 for stun, otherwise the effect index - */ - virtual void handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId, - const Enable newStatus, - const IsStart start); - - void setupSpriteDisplay(const SpriteDisplay &display, - const ForceDisplay forceDisplay, - const DisplayTypeT displayType, - const std::string &color); - - /** Load the target cursors into memory */ - static void initTargetCursor(); - - /** Remove the target cursors from memory */ - static void cleanupTargetCursors(); - - /** Animated target cursors. */ - static AnimatedSprite *targetCursor - [CAST_SIZE(TargetCursorType::NUM_TCT)] - [CAST_SIZE(TargetCursorSize::NUM_TC)]; - - static bool loaded; - - /**< set of active status effects */ - std::set mStatusEffects; - - ParticleVector mStatusParticleEffects; - ParticleList mChildParticleEffects; - int mHorseId; - BeingId mId; - - /** Target cursor being used */ - AnimatedSprite *mUsedTargetCursor; - - typedef std::list ActorSpriteListeners; - typedef ActorSpriteListeners::iterator ActorSpriteListenerIterator; - ActorSpriteListeners mActorSpriteListeners; - - int mCursorPaddingX; - int mCursorPaddingY; - - /** Reset particle status effects on next redraw? */ - bool mMustResetParticles; - bool mPoison; - bool mHaveCart; - bool mTrickDead; -}; - -#endif // BEING_ACTORSPRITE_H diff --git a/src/being/being.cpp b/src/being/being.cpp deleted file mode 100644 index 6bbf50a48..000000000 --- a/src/being/being.cpp +++ /dev/null @@ -1,5470 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/being.h" - -#include "actormanager.h" -#include "beingequipbackend.h" -#include "configuration.h" -#include "effectmanager.h" -#include "guild.h" -#include "itemcolormanager.h" -#include "party.h" -#include "settings.h" -#include "soundmanager.h" -#include "text.h" - -#include "being/beingcacheentry.h" -#include "being/beingflag.h" -#include "being/beingspeech.h" -#include "being/castingeffect.h" -#include "being/localplayer.h" -#include "being/playerinfo.h" -#include "being/playerrelations.h" -#include "being/homunculusinfo.h" -#include "being/mercenaryinfo.h" - -#include "const/utils/timer.h" - -#include "const/resources/spriteaction.h" - -#include "enums/being/beingdirection.h" - -#include "enums/resources/map/blockmask.h" - -#include "fs/files.h" - -#include "gui/gui.h" -#include "gui/userpalette.h" - -#include "gui/fonts/font.h" - -#include "gui/popups/speechbubble.h" - -#include "gui/windows/chatwindow.h" -#include "gui/windows/equipmentwindow.h" -#include "gui/windows/skilldialog.h" -#include "gui/windows/socialwindow.h" - -#include "net/charserverhandler.h" -#include "net/gamehandler.h" -#include "net/homunculushandler.h" -#include "net/mercenaryhandler.h" -#include "net/net.h" -#include "net/npchandler.h" -#include "net/packetlimiter.h" -#include "net/playerhandler.h" -#include "net/serverfeatures.h" - -#include "particle/particleinfo.h" - -#include "resources/attack.h" -#include "resources/chatobject.h" -#include "resources/emoteinfo.h" -#include "resources/emotesprite.h" -#include "resources/horseinfo.h" -#include "resources/iteminfo.h" - -#include "resources/db/avatardb.h" -#include "resources/db/badgesdb.h" -#include "resources/db/groupdb.h" -#include "resources/db/elementaldb.h" -#include "resources/db/emotedb.h" -#include "resources/db/homunculusdb.h" -#include "resources/db/horsedb.h" -#include "resources/db/languagedb.h" -#include "resources/db/mercenarydb.h" -#include "resources/db/monsterdb.h" -#include "resources/db/npcdb.h" -#include "resources/db/petdb.h" -#include "resources/db/skillunitdb.h" - -#include "resources/image/image.h" - -#include "resources/item/item.h" - -#include "resources/map/map.h" - -#include "resources/skill/skilldata.h" -#include "resources/skill/skillinfo.h" - -#include "resources/sprite/animatedsprite.h" - -#include "gui/widgets/createwidget.h" - -#include "gui/widgets/tabs/chat/langtab.h" - -#include "utils/checkutils.h" -#include "utils/delete2.h" -#include "utils/foreach.h" -#include "utils/gettext.h" -#include "utils/likely.h" -#include "utils/stdmove.h" -#include "utils/timer.h" - -#include "debug.h" - -const unsigned int CACHE_SIZE = 50; - -time_t Being::mUpdateConfigTime = 0; -unsigned int Being::mConfLineLim = 0; -int Being::mSpeechType = 0; -bool Being::mHighlightMapPortals = false; -bool Being::mHighlightMonsterAttackRange = false; -bool Being::mLowTraffic = true; -bool Being::mDrawHotKeys = true; -bool Being::mShowBattleEvents = false; -bool Being::mShowMobHP = false; -bool Being::mShowOwnHP = false; -bool Being::mShowGender = false; -bool Being::mShowLevel = false; -bool Being::mShowPlayersStatus = false; -bool Being::mEnableReorderSprites = true; -bool Being::mHideErased = false; -Move Being::mMoveNames = Move_false; -bool Being::mUseDiagonal = true; -BadgeDrawType::Type Being::mShowBadges = BadgeDrawType::Top; -int Being::mAwayEffect = -1; -VisibleNamePos::Type Being::mVisibleNamePos = VisibleNamePos::Bottom; - -std::list beingInfoCache; -typedef std::map::const_iterator GuildsMapCIter; -typedef std::map::const_iterator IntMapCIter; - -static const unsigned int SPEECH_TIME = 500; -static const unsigned int SPEECH_MIN_TIME = 200; -static const unsigned int SPEECH_MAX_TIME = 800; - -#define for_each_badges() \ - for (int f = 0; f < BadgeIndex::BadgeIndexSize; f++) - -#define for_each_horses(name) \ - FOR_EACH (STD_VECTOR::const_iterator, it, name) - -Being::Being(const BeingId id, - const ActorTypeT type) : - ActorSprite(id), - mNextSound(), - mInfo(BeingInfo::unknown), - mEmotionSprite(nullptr), - mAnimationEffect(nullptr), - mCastingEffect(nullptr), - mBadges(), - mSpriteAction(SpriteAction::STAND), - mName(), - mExtName(), - mRaceName(), - mPartyName(), - mGuildName(), - mSpeech(), - mDispName(nullptr), - mNameColor(nullptr), - mEquippedWeapon(nullptr), - mPath(), - mText(nullptr), - mTextColor(nullptr), - mDest(), - mSlots(), - mSpriteParticles(), - mGuilds(), - mParty(nullptr), - mActionTime(0), - mEmotionTime(0), - mSpeechTime(0), - mAttackSpeed(350), - mLevel(0), - mGroupId(0), - mAttackRange(1), - mLastAttackX(0), - mLastAttackY(0), - mPreStandTime(0), - mGender(Gender::UNSPECIFIED), - mAction(BeingAction::STAND), - mSubType(fromInt(0xFFFF, BeingTypeId)), - mDirection(BeingDirection::DOWN), - mDirectionDelayed(0), - mSpriteDirection(SpriteDirection::DOWN), - mShowName(false), - mIsGM(false), - mType(type), - mSpeechBubble(nullptr), - mWalkSpeed(playerHandler != nullptr ? - playerHandler->getDefaultWalkSpeed() : 1), - mSpeed(playerHandler != nullptr ? - playerHandler->getDefaultWalkSpeed() : 1), - mIp(), - mSpriteRemap(new int[20]), - mSpriteHide(new int[20]), - mSpriteDraw(new int[20]), - mComment(), - mBuyBoard(), - mSellBoard(), - mOwner(nullptr), - mSpecialParticle(nullptr), - mChat(nullptr), - mHorseInfo(nullptr), - mDownHorseSprites(), - mUpHorseSprites(), - mSpiritParticles(), - mX(0), - mY(0), - mCachedX(0), - mCachedY(0), - mSortOffsetY(0), - mPixelOffsetY(0), - mFixedOffsetY(0), - mOldHeight(0), - mDamageTaken(0), - mHP(0), - mMaxHP(0), - mDistance(0), - mReachable(Reachable::REACH_UNKNOWN), - mGoodStatus(-1), - mMoveTime(0), - mAttackTime(0), - mTalkTime(0), - mOtherTime(0), - mTestTime(cur_time), - mAttackDelay(0), - mMinHit(0), - mMaxHit(0), - mCriticalHit(0), - mPvpRank(0), - mNumber(100), - mSpiritBalls(0U), - mUsageCounter(1), - mKarma(0), - mManner(0), - mAreaSize(11), - mCastEndTime(0), - mLanguageId(-1), - mBadgesX(0), - mBadgesY(0), - mCreatorId(BeingId_zero), - mTeamId(0U), - mLook(0U), - mBadgesCount(0U), - mHairColor(ItemColor_zero), - mErased(false), - mEnemy(false), - mGotComment(false), - mAdvanced(false), - mShop(false), - mAway(false), - mInactive(false), - mNeedPosUpdate(true), - mBotAi(true) -{ - for (int f = 0; f < 20; f ++) - { - mSpriteRemap[f] = f; - mSpriteHide[f] = 0; - mSpriteDraw[f] = 0; - } - - for_each_badges() - mBadges[f] = nullptr; -} - -void Being::postInit(const BeingTypeId subtype, - Map *const map) -{ - setMap(map); - setSubtype(subtype, 0); - - VisibleName::Type showName1 = VisibleName::Hide; - - switch (mType) - { - case ActorType::Player: - case ActorType::Mercenary: - case ActorType::Pet: - case ActorType::Homunculus: - case ActorType::Elemental: - showName1 = static_cast( - config.getIntValue("visiblenames")); - break; - case ActorType::Portal: - case ActorType::SkillUnit: - showName1 = VisibleName::Hide; - break; - default: - case ActorType::Unknown: - case ActorType::Npc: - case ActorType::Monster: - case ActorType::FloorItem: - case ActorType::Avatar: - break; - } - - if (mType != ActorType::Npc) - mGotComment = true; - - config.addListener("visiblenames", this); - - reReadConfig(); - - if (mType == ActorType::Npc || - showName1 == VisibleName::Show) - { - setShowName(true); - } - - updateColors(); - updatePercentHP(); -} - -Being::~Being() -{ - config.removeListener("visiblenames", this); - CHECKLISTENERS - - delete [] mSpriteRemap; - mSpriteRemap = nullptr; - delete [] mSpriteHide; - mSpriteHide = nullptr; - delete [] mSpriteDraw; - mSpriteDraw = nullptr; - - for_each_badges() - delete2(mBadges[f]); - - delete2(mSpeechBubble); - delete2(mDispName); - delete2(mText); - delete2(mEmotionSprite); - delete2(mAnimationEffect); - delete2(mCastingEffect); - mBadgesCount = 0; - delete2(mChat); - removeHorse(); - - removeAllItemsParticles(); - mSpiritParticles.clear(); -} - -void Being::createSpeechBubble() restrict2 -{ - CREATEWIDGETV0(mSpeechBubble, SpeechBubble); -} - -void Being::setSubtype(const BeingTypeId subtype, - const uint16_t look) restrict2 -{ - if (mInfo == nullptr) - return; - - if (subtype == mSubType && mLook == look) - return; - - mSubType = subtype; - mLook = look; - - switch (mType) - { - case ActorType::Monster: - mInfo = MonsterDB::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_true, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Pet: - mInfo = PETDB::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_true, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Mercenary: - mInfo = MercenaryDB::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_true, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Homunculus: - mInfo = HomunculusDB::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_true, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::SkillUnit: - mInfo = SkillUnitDb::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_false, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Elemental: - mInfo = ElementalDb::get(mSubType); - if (mInfo != nullptr) - { - setName(mInfo->getName()); - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_false, - DisplayType::Item, - mInfo->getColor(fromInt(mLook, ItemColor))); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Npc: - mInfo = NPCDB::get(mSubType); - if (mInfo != nullptr) - { - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_false, - DisplayType::Item, - std::string()); - mYDiff = mInfo->getSortOffsetY(); - } - break; - case ActorType::Avatar: - mInfo = AvatarDB::get(mSubType); - if (mInfo != nullptr) - { - setupSpriteDisplay(mInfo->getDisplay(), - ForceDisplay_false, - DisplayType::Item, - std::string()); - } - break; - case ActorType::Player: - { - int id = -100 - toInt(subtype, int); - // Prevent showing errors when sprite doesn't exist - if (!ItemDB::exists(id)) - { - id = -100; - // TRANSLATORS: default race name - setRaceName(_("Human")); - if (charServerHandler != nullptr) - { - setSpriteId(charServerHandler->baseSprite(), - id); - } - } - else - { - const ItemInfo &restrict info = ItemDB::get(id); - setRaceName(info.getName()); - if (charServerHandler != nullptr) - { - setSpriteColor(charServerHandler->baseSprite(), - id, - info.getColor(fromInt(mLook, ItemColor))); - } - } - break; - } - case ActorType::Portal: - break; - case ActorType::Unknown: - case ActorType::FloorItem: - default: - reportAlways("Wrong being type %d in setSubType", - CAST_S32(mType)); - break; - } -} - -TargetCursorSizeT Being::getTargetCursorSize() const restrict2 -{ - if (mInfo == nullptr) - return TargetCursorSize::SMALL; - - return mInfo->getTargetCursorSize(); -} - -void Being::setPixelPositionF(const Vector &restrict pos) restrict2 -{ - Actor::setPixelPositionF(pos); - - updateCoords(); - - if (mText != nullptr) - { - mText->adviseXY(CAST_S32(pos.x), - CAST_S32(pos.y) - getHeight() - mText->getHeight() - 9, - mMoveNames); - } -} - -void Being::setDestination(const int dstX, - const int dstY) restrict2 -{ - if (mMap == nullptr) - return; - - setPath(mMap->findPath(mX, mY, dstX, dstY, getBlockWalkMask())); -} - -void Being::clearPath() restrict2 -{ - mPath.clear(); -} - -void Being::setPath(const Path &restrict path) restrict2 -{ - mPath = path; - if (mPath.empty()) - return; - - if (mAction != BeingAction::MOVE && mAction != BeingAction::DEAD) - { - nextTile(); - mActionTime = tick_time; - } -} - -void Being::setSpeech(const std::string &restrict text, - const std::string &restrict channel, - int time) restrict2 -{ - if (userPalette == nullptr) - return; - - if (!channel.empty() && - ((langChatTab == nullptr) || langChatTab->getChannelName() != channel)) - { - return; - } - - // Remove colors - mSpeech = removeColors(text); - - // Trim whitespace - trim(mSpeech); - - const unsigned int lineLim = mConfLineLim; - if (lineLim > 0 && mSpeech.length() > lineLim) - mSpeech = mSpeech.substr(0, lineLim); - - trim(mSpeech); - if (mSpeech.empty()) - return; - - if (time == 0) - { - const size_t sz = mSpeech.size(); - if (sz < 200) - time = CAST_S32(SPEECH_TIME - 300 + (3 * sz)); - } - - if (time < CAST_S32(SPEECH_MIN_TIME)) - time = CAST_S32(SPEECH_MIN_TIME); - - // Check for links - size_t start = mSpeech.find('['); - size_t e = mSpeech.find(']', start); - - while (start != std::string::npos && e != std::string::npos) - { - // Catch multiple embeds and ignore them so it doesn't crash the client. - while ((mSpeech.find('[', start + 1) != std::string::npos) && - (mSpeech.find('[', start + 1) < e)) - { - start = mSpeech.find('[', start + 1); - } - - size_t position = mSpeech.find('|'); - if (mSpeech[start + 1] == '@' && mSpeech[start + 2] == '@') - { - mSpeech.erase(e, 1); - mSpeech.erase(start, (position - start) + 1); - } - position = mSpeech.find("@@"); - - while (position != std::string::npos) - { - mSpeech.erase(position, 2); - position = mSpeech.find('@'); - } - - start = mSpeech.find('[', start + 1); - e = mSpeech.find(']', start); - } - - if (!mSpeech.empty()) - { - mSpeechTime = time <= CAST_S32(SPEECH_MAX_TIME) - ? time : CAST_S32(SPEECH_MAX_TIME); - } - - const int speech = mSpeechType; - if (speech == BeingSpeech::TEXT_OVERHEAD) - { - delete mText; - mText = nullptr; - mText = new Text(mSpeech, - mPixelX, - mPixelY - getHeight(), - Graphics::CENTER, - &userPalette->getColor(UserColorId::PARTICLE), - Speech_true); - mText->adviseXY(mPixelX, - (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9, - mMoveNames); - } - else - { - const bool isShowName = (speech == BeingSpeech::NAME_IN_BUBBLE); - if (mSpeechBubble == nullptr) - createSpeechBubble(); - if (mSpeechBubble != nullptr) - { - mSpeechBubble->setCaption(isShowName ? mName : ""); - mSpeechBubble->setText(mSpeech, isShowName); - } - } -} - -void Being::takeDamage(Being *restrict const attacker, - const int amount, - const AttackTypeT type, - const int attackId, - const int level) restrict2 -{ - if (userPalette == nullptr || attacker == nullptr) - return; - - BLOCK_START("Being::takeDamage1") - - Font *font = nullptr; - const Color *color; - - if (gui != nullptr) - font = gui->getInfoParticleFont(); - - // Selecting the right color - if (type == AttackType::CRITICAL || type == AttackType::FLEE) - { - if (type == AttackType::CRITICAL) - attacker->setCriticalHit(amount); - - if (attacker == localPlayer) - { - color = &userPalette->getColor( - UserColorId::HIT_LOCAL_PLAYER_CRITICAL); - } - else - { - color = &userPalette->getColor(UserColorId::HIT_CRITICAL); - } - } - else if (amount == 0) - { - if (attacker == localPlayer) - { - // This is intended to be the wrong direction to visually - // differentiate between hits and misses - color = &userPalette->getColor(UserColorId::HIT_LOCAL_PLAYER_MISS); - } - else - { - color = &userPalette->getColor(UserColorId::MISS); - } - } - else if (mType == ActorType::Monster || - mType == ActorType::Mercenary || - mType == ActorType::Pet || - mType == ActorType::Homunculus || - mType == ActorType::SkillUnit) - { - if (attacker == localPlayer) - { - color = &userPalette->getColor( - UserColorId::HIT_LOCAL_PLAYER_MONSTER); - } - else - { - color = &userPalette->getColor( - UserColorId::HIT_PLAYER_MONSTER); - } - } - else if (mType == ActorType::Player && - attacker != localPlayer && - this == localPlayer) - { - // here player was attacked by other player. mark him as enemy. - color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER); - attacker->setEnemy(true); - attacker->updateColors(); - } - else - { - color = &userPalette->getColor(UserColorId::HIT_MONSTER_PLAYER); - } - - if (chatWindow != nullptr && mShowBattleEvents) - { - if (this == localPlayer) - { - if (attacker->mType == ActorType::Player || (amount != 0)) - { - ChatWindow::battleChatLog(strprintf("%s : Hit you -%d", - attacker->getName().c_str(), amount), - ChatMsgType::BY_OTHER); - } - } - else if (attacker == localPlayer && (amount != 0)) - { - ChatWindow::battleChatLog(strprintf("%s : You hit %s -%d", - attacker->mName.c_str(), - mName.c_str(), - amount), - ChatMsgType::BY_PLAYER); - } - } - if (font != nullptr && particleEngine != nullptr) - { - const std::string damage = amount != 0 ? toString(amount) : - // TRANSLATORS: dodge or miss message in attacks - type == AttackType::FLEE ? _("dodge") : _("miss"); - // Show damage number - particleEngine->addTextSplashEffect(damage, - mPixelX, - mPixelY - 16, - color, - font, - true); - } - BLOCK_END("Being::takeDamage1") - BLOCK_START("Being::takeDamage2") - - if (type != AttackType::SKILL) - attacker->updateHit(amount); - - if (amount > 0) - { - if ((localPlayer != nullptr) && localPlayer == this) - localPlayer->setLastHitFrom(attacker->mName); - - mDamageTaken += amount; - if (mInfo != nullptr) - { - playSfx(mInfo->getSound(ItemSoundEvent::HURT), - this, - false, - mX, - mY); - - if (!mInfo->isStaticMaxHP()) - { - if ((mHP == 0) && mInfo->getMaxHP() < mDamageTaken) - mInfo->setMaxHP(mDamageTaken); - } - } - if ((mHP != 0) && isAlive()) - { - mHP -= amount; - if (mHP < 0) - mHP = 0; - } - - if (mType == ActorType::Monster) - { - updatePercentHP(); - updateName(); - } - else if (mType == ActorType::Player && - (socialWindow != nullptr) && - !mName.empty()) - { - socialWindow->updateAvatar(mName); - } - - if (effectManager != nullptr) - { - const int hitEffectId = getHitEffect(attacker, - type, - attackId, - level); - if (hitEffectId >= 0) - effectManager->trigger(hitEffectId, this); - } - } - else - { - if (effectManager != nullptr) - { - int hitEffectId = -1; - if (type == AttackType::SKILL) - { - hitEffectId = getHitEffect(attacker, - AttackType::SKILLMISS, - attackId, - level); - } - else - { - hitEffectId = getHitEffect(attacker, - AttackType::MISS, - attackId, - level); - } - if (hitEffectId >= 0) - effectManager->trigger(hitEffectId, this); - } - } - BLOCK_END("Being::takeDamage2") -} - -int Being::getHitEffect(const Being *restrict const attacker, - const AttackTypeT type, - const int attackId, - const int level) const restrict2 -{ - if (effectManager == nullptr) - return 0; - - BLOCK_START("Being::getHitEffect") - // Init the particle effect path based on current - // weapon or default. - int hitEffectId = 0; - if (type == AttackType::SKILL || type == AttackType::SKILLMISS) - { - const SkillData *restrict const data = - skillDialog->getSkillDataByLevel(attackId, level); - if (data == nullptr) - return -1; - if (type == AttackType::SKILL) - { - hitEffectId = data->hitEffectId; - if (hitEffectId == -1) - hitEffectId = paths.getIntValue("skillHitEffectId"); - } - else - { - hitEffectId = data->missEffectId; - if (hitEffectId == -1) - hitEffectId = paths.getIntValue("skillMissEffectId"); - } - } - else - { - if (attacker != nullptr) - { - const ItemInfo *restrict const attackerWeapon - = attacker->getEquippedWeapon(); - if (attackerWeapon != nullptr && - attacker->getType() == ActorType::Player) - { - if (type == AttackType::MISS) - hitEffectId = attackerWeapon->getMissEffectId(); - else if (type != AttackType::CRITICAL) - hitEffectId = attackerWeapon->getHitEffectId(); - else - hitEffectId = attackerWeapon->getCriticalHitEffectId(); - } - else if (attacker->getType() == ActorType::Monster) - { - const BeingInfo *restrict const info = attacker->getInfo(); - if (info != nullptr) - { - const Attack *restrict const atk = - info->getAttack(attackId); - if (atk != nullptr) - { - if (type == AttackType::MISS) - hitEffectId = atk->mMissEffectId; - else if (type != AttackType::CRITICAL) - hitEffectId = atk->mHitEffectId; - else - hitEffectId = atk->mCriticalHitEffectId; - } - else - { - hitEffectId = getDefaultEffectId(type); - } - } - } - else - { - hitEffectId = getDefaultEffectId(type); - } - } - else - { - hitEffectId = getDefaultEffectId(type); - } - } - BLOCK_END("Being::getHitEffect") - return hitEffectId; -} - -int Being::getDefaultEffectId(const AttackTypeT &restrict type) -{ - if (type == AttackType::MISS) - return paths.getIntValue("missEffectId"); - else if (type != AttackType::CRITICAL) - return paths.getIntValue("hitEffectId"); - else - return paths.getIntValue("criticalHitEffectId"); -} - -void Being::handleAttack(Being *restrict const victim, - const int damage, - const int attackId) restrict2 -{ - if ((victim == nullptr) || (mInfo == nullptr)) - return; - - BLOCK_START("Being::handleAttack") - - if (this != localPlayer) - setAction(BeingAction::ATTACK, attackId); - - mLastAttackX = victim->mX; - mLastAttackY = victim->mY; - - if (mType == ActorType::Player && (mEquippedWeapon != nullptr)) - fireMissile(victim, mEquippedWeapon->getMissileConst()); - else if (mInfo->getAttack(attackId) != nullptr) - fireMissile(victim, mInfo->getAttack(attackId)->mMissile); - - reset(); - mActionTime = tick_time; - - if (Net::getNetworkType() == ServerType::TMWATHENA && - this != localPlayer) - { - const uint8_t dir = calcDirection(victim->mX, - victim->mY); - if (dir != 0u) - setDirection(dir); - } - - if ((damage != 0) && victim->mType == ActorType::Player - && victim->mAction == BeingAction::SIT) - { - victim->setAction(BeingAction::STAND, 0); - } - - if (mType == ActorType::Player) - { - if (mSlots.size() >= 10) - { - // here 10 is weapon slot - int weaponId = mSlots[10].spriteId; - if (weaponId == 0) - weaponId = -100 - toInt(mSubType, int); - const ItemInfo &info = ItemDB::get(weaponId); - playSfx(info.getSound( - (damage > 0) ? ItemSoundEvent::HIT : ItemSoundEvent::MISS), - victim, - true, - mX, mY); - } - } - else - { - playSfx(mInfo->getSound((damage > 0) ? - ItemSoundEvent::HIT : ItemSoundEvent::MISS), victim, true, mX, mY); - } - BLOCK_END("Being::handleAttack") -} - -void Being::handleSkillCasting(Being *restrict const victim, - const int skillId, - const int skillLevel) restrict2 -{ - if ((victim == nullptr) || (mInfo == nullptr) || (skillDialog == nullptr)) - return; - - setAction(BeingAction::CAST, skillId); - - const SkillData *restrict const data = skillDialog->getSkillDataByLevel( - skillId, - skillLevel); - - if (data != nullptr) - { - effectManager->triggerDefault(data->castingSrcEffectId, - this, - paths.getIntValue("skillCastingSrcEffectId")); - effectManager->triggerDefault(data->castingDstEffectId, - victim, - paths.getIntValue("skillCastingDstEffectId")); - fireMissile(victim, data->castingMissile); - } -} - -void Being::handleSkill(Being *restrict const victim, - const int damage, - const int skillId, - const int skillLevel) restrict2 -{ - if ((victim == nullptr) || (mInfo == nullptr) || (skillDialog == nullptr)) - return; - - const SkillInfo *restrict const skill = skillDialog->getSkill(skillId); - const SkillData *restrict const data = skill != nullptr - ? skill->getData1(skillLevel) : nullptr; - if (data != nullptr) - { - effectManager->triggerDefault(data->srcEffectId, - this, - paths.getIntValue("skillSrcEffectId")); - effectManager->triggerDefault(data->dstEffectId, - victim, - paths.getIntValue("skillDstEffectId")); - fireMissile(victim, data->missile); - } - - if (this != localPlayer && (skill != nullptr)) - { - const SkillType::SkillType type = skill->type; - if ((type & SkillType::Attack) != 0 || - (type & SkillType::Ground) != 0) - { - setAction(BeingAction::ATTACK, 1); - } - else - { - setAction(BeingAction::STAND, 1); - } - } - - reset(); - mActionTime = tick_time; - - if (Net::getNetworkType() == ServerType::TMWATHENA && - this != localPlayer) - { - const uint8_t dir = calcDirection(victim->mX, - victim->mY); - if (dir != 0u) - setDirection(dir); - } - if ((damage != 0) && victim->mType == ActorType::Player - && victim->mAction == BeingAction::SIT) - { - victim->setAction(BeingAction::STAND, 0); - } - if (data != nullptr) - { - if (damage > 0) - playSfx(data->soundHit, victim, true, mX, mY); - else - playSfx(data->soundMiss, victim, true, mX, mY); - } - else - { - playSfx(mInfo->getSound((damage > 0) ? - ItemSoundEvent::HIT : ItemSoundEvent::MISS), - victim, - true, - mX, mY); - } -} - -void Being::showNameBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Name]); - if (show && - !mName.empty() && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = BadgesDB::getNameBadge(mName); - if (!badge.empty()) - { - mBadges[BadgeIndex::Name] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } -} - -void Being::setName(const std::string &restrict name) restrict2 -{ - mExtName = name; - if (mType == ActorType::Npc) - { - mName = name.substr(0, name.find('#', 0)); - showName(); - } - else if (mType == ActorType::Player) - { - if (mName != name) - { - mName = name; - showNameBadge(!mName.empty()); - } - if (getShowName()) - showName(); - } - else - { - if (mType == ActorType::Portal) - mName = name.substr(0, name.find('#', 0)); - else - mName = name; - - if (getShowName()) - showName(); - } -} - -void Being::setShowName(const bool doShowName) restrict2 -{ - if (mShowName == doShowName) - return; - - mShowName = doShowName; - - if (doShowName) - showName(); - else - delete2(mDispName) -} - -void Being::showGuildBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Guild]); - if (show && - !mGuildName.empty() && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = BadgesDB::getGuildBadge(mGuildName); - if (!badge.empty()) - { - mBadges[BadgeIndex::Guild] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } -} - -void Being::setGuildName(const std::string &restrict name) restrict2 -{ - if (mGuildName != name) - { - mGuildName = name; - showGuildBadge(!mGuildName.empty()); - updateBadgesCount(); - } -} - -void Being::setGuildPos(const std::string &restrict pos A_UNUSED) restrict2 -{ -} - -void Being::addGuild(Guild *restrict const guild) restrict2 -{ - if (guild == nullptr) - return; - - mGuilds[guild->getId()] = guild; - - if (this == localPlayer && (socialWindow != nullptr)) - socialWindow->addTab(guild); -} - -void Being::removeGuild(const int id) restrict2 -{ - if (this == localPlayer && (socialWindow != nullptr)) - socialWindow->removeTab(mGuilds[id]); - - if (mGuilds[id] != nullptr) - mGuilds[id]->removeMember(mName); - mGuilds.erase(id); -} - -const Guild *Being::getGuild(const std::string &restrict guildName) const - restrict2 -{ - FOR_EACH (GuildsMapCIter, itr, mGuilds) - { - const Guild *restrict const guild = itr->second; - if ((guild != nullptr) && guild->getName() == guildName) - return guild; - } - - return nullptr; -} - -const Guild *Being::getGuild(const int id) const restrict2 -{ - const std::map::const_iterator itr = mGuilds.find(id); - if (itr != mGuilds.end()) - return itr->second; - - return nullptr; -} - -Guild *Being::getGuild() const restrict2 -{ - const std::map::const_iterator itr = mGuilds.begin(); - if (itr != mGuilds.end()) - return itr->second; - - return nullptr; -} - -void Being::clearGuilds() restrict2 -{ - FOR_EACH (GuildsMapCIter, itr, mGuilds) - { - Guild *const guild = itr->second; - - if (guild != nullptr) - { - if (this == localPlayer && (socialWindow != nullptr)) - socialWindow->removeTab(guild); - - guild->removeMember(mId); - } - } - - mGuilds.clear(); -} - -void Being::setParty(Party *restrict const party) restrict2 -{ - if (party == mParty) - return; - - Party *const old = mParty; - mParty = party; - - if (old != nullptr) - old->removeMember(mId); - - if (party != nullptr) - party->addMember(mId, mName); - - updateColors(); - - if (this == localPlayer && (socialWindow != nullptr)) - { - if (old != nullptr) - socialWindow->removeTab(old); - - if (party != nullptr) - socialWindow->addTab(party); - } -} - -void Being::updateGuild() restrict2 -{ - if (localPlayer == nullptr) - return; - - Guild *restrict const guild = localPlayer->getGuild(); - if (guild == nullptr) - { - clearGuilds(); - updateColors(); - return; - } - if (guild->getMember(mName) != nullptr) - { - setGuild(guild); - if (!guild->getName().empty()) - setGuildName(guild->getName()); - } - updateColors(); -} - -void Being::setGuild(Guild *restrict const guild) restrict2 -{ - Guild *restrict const old = getGuild(); - if (guild == old) - return; - - clearGuilds(); - addGuild(guild); - - if (old != nullptr) - old->removeMember(mName); - - updateColors(); - - if (this == localPlayer && (socialWindow != nullptr)) - { - if (old != nullptr) - socialWindow->removeTab(old); - - if (guild != nullptr) - socialWindow->addTab(guild); - } -} - -void Being::fireMissile(Being *restrict const victim, - const MissileInfo &restrict missile) const restrict2 -{ - BLOCK_START("Being::fireMissile") - - if (victim == nullptr || - missile.particle.empty() || - particleEngine == nullptr) - { - BLOCK_END("Being::fireMissile") - return; - } - - Particle *restrict const target = particleEngine->createChild(); - - if (target == nullptr) - { - BLOCK_END("Being::fireMissile") - return; - } - - Particle *restrict const missileParticle = target->addEffect( - missile.particle, - mPixelX, - mPixelY); - - target->moveBy(Vector(0.0F, 0.0F, missile.z)); - target->setLifetime(missile.lifeTime); - victim->controlAutoParticle(target); - - if (missileParticle != nullptr) - { - missileParticle->setDestination(target, missile.speed, 0.0F); - missileParticle->setDieDistance(missile.dieDistance); - missileParticle->setLifetime(missile.lifeTime); - } - BLOCK_END("Being::fireMissile") -} - -std::string Being::getSitAction() const restrict2 -{ - if (mHorseId != 0) - return SpriteAction::SITRIDE; - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if ((mask & BlockMask::GROUNDTOP) != 0) - return SpriteAction::SITTOP; - else if ((mask & BlockMask::AIR) != 0) - return SpriteAction::SITSKY; - else if ((mask & BlockMask::WATER) != 0) - return SpriteAction::SITWATER; - } - return SpriteAction::SIT; -} - - -std::string Being::getMoveAction() const restrict2 -{ - if (mHorseId != 0) - return SpriteAction::RIDE; - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if ((mask & BlockMask::AIR) != 0) - return SpriteAction::FLY; - else if ((mask & BlockMask::WATER) != 0) - return SpriteAction::SWIM; - } - return SpriteAction::MOVE; -} - -std::string Being::getWeaponAttackAction(const ItemInfo *restrict const weapon) - const restrict2 -{ - if (weapon == nullptr) - return getAttackAction(); - - if (mHorseId != 0) - return weapon->getRideAttackAction(); - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if ((mask & BlockMask::AIR) != 0) - return weapon->getSkyAttackAction(); - else if ((mask & BlockMask::WATER) != 0) - return weapon->getWaterAttackAction(); - } - return weapon->getAttackAction(); -} - -std::string Being::getAttackAction(const Attack *restrict const attack1) const - restrict2 -{ - if (attack1 == nullptr) - return getAttackAction(); - - if (mHorseId != 0) - return attack1->mRideAction; - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if ((mask & BlockMask::AIR) != 0) - return attack1->mSkyAction; - else if ((mask & BlockMask::WATER) != 0) - return attack1->mWaterAction; - } - return attack1->mAction; -} - -std::string Being::getCastAction(const SkillInfo *restrict const skill) const - restrict2 -{ - if (skill == nullptr) - return getCastAction(); - - if (mHorseId != 0) - return skill->castingRideAction; - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if ((mask & BlockMask::AIR) != 0) - return skill->castingSkyAction; - else if ((mask & BlockMask::WATER) != 0) - return skill->castingWaterAction; - } - return skill->castingAction; -} - -#define getSpriteAction(func, action) \ - std::string Being::get##func##Action() const restrict2\ -{ \ - if (mHorseId != 0) \ - return SpriteAction::action##RIDE; \ - if (mMap) \ - { \ - const unsigned char mask = mMap->getBlockMask(mX, mY); \ - if (mask & BlockMask::AIR) \ - return SpriteAction::action##SKY; \ - else if (mask & BlockMask::WATER) \ - return SpriteAction::action##WATER; \ - } \ - return SpriteAction::action; \ -} - -getSpriteAction(Attack, ATTACK) -getSpriteAction(Cast, CAST) -getSpriteAction(Dead, DEAD) -getSpriteAction(Spawn, SPAWN) - -std::string Being::getStandAction() const restrict2 -{ - if (mHorseId != 0) - return SpriteAction::STANDRIDE; - if (mMap != nullptr) - { - const unsigned char mask = mMap->getBlockMask(mX, mY); - if (mTrickDead) - { - if ((mask & BlockMask::AIR) != 0) - return SpriteAction::DEADSKY; - else if ((mask & BlockMask::WATER) != 0) - return SpriteAction::DEADWATER; - else - return SpriteAction::DEAD; - } - if ((mask & BlockMask::AIR) != 0) - return SpriteAction::STANDSKY; - else if ((mask & BlockMask::WATER) != 0) - return SpriteAction::STANDWATER; - } - return SpriteAction::STAND; -} - -void Being::setAction(const BeingActionT &restrict action, - const int attackId) restrict2 -{ - std::string currentAction = SpriteAction::INVALID; - - switch (action) - { - case BeingAction::MOVE: - if (mInfo != nullptr) - { - playSfx(mInfo->getSound( - ItemSoundEvent::MOVE), nullptr, true, mX, mY); - } - currentAction = getMoveAction(); - // Note: When adding a run action, - // Differentiate walk and run with action name, - // while using only the ACTION_MOVE. - break; - case BeingAction::SIT: - currentAction = getSitAction(); - if (mInfo != nullptr) - { - ItemSoundEvent::Type event; - if (currentAction == SpriteAction::SITTOP) - event = ItemSoundEvent::SITTOP; - else - event = ItemSoundEvent::SIT; - playSfx(mInfo->getSound(event), nullptr, true, mX, mY); - } - break; - case BeingAction::ATTACK: - if (mEquippedWeapon != nullptr) - { - currentAction = getWeaponAttackAction(mEquippedWeapon); - reset(); - } - else - { - if (mInfo == nullptr || mInfo->getAttack(attackId) == nullptr) - break; - - currentAction = getAttackAction(mInfo->getAttack(attackId)); - reset(); - - // attack particle effect - if (ParticleEngine::enabled && (effectManager != nullptr)) - { - const int effectId = mInfo->getAttack(attackId)->mEffectId; - if (effectId >= 0) - { - effectManager->triggerDirection(effectId, - this, - mSpriteDirection); - } - } - } - break; - case BeingAction::CAST: - if (skillDialog != nullptr) - { - const SkillInfo *restrict const info = - skillDialog->getSkill(attackId); - currentAction = getCastAction(info); - } - break; - case BeingAction::HURT: - if (mInfo != nullptr) - { - playSfx(mInfo->getSound(ItemSoundEvent::HURT), - this, false, mX, mY); - } - break; - case BeingAction::DEAD: - currentAction = getDeadAction(); - if (mInfo != nullptr) - { - playSfx(mInfo->getSound(ItemSoundEvent::DIE), - this, - false, - mX, mY); - if (mType == ActorType::Monster || - mType == ActorType::Npc || - mType == ActorType::SkillUnit) - { - mYDiff = mInfo->getDeadSortOffsetY(); - } - } - break; - case BeingAction::STAND: - currentAction = getStandAction(); - break; - case BeingAction::SPAWN: - if (mInfo != nullptr) - { - playSfx(mInfo->getSound(ItemSoundEvent::SPAWN), - nullptr, true, mX, mY); - } - currentAction = getSpawnAction(); - break; - case BeingAction::PRESTAND: - break; - default: - logger->log("Being::setAction unknown action: " - + toString(CAST_U32(action))); - break; - } - - if (currentAction != SpriteAction::INVALID) - { - mSpriteAction = currentAction; - play(currentAction); - if (mEmotionSprite != nullptr) - mEmotionSprite->play(currentAction); - if (mAnimationEffect != nullptr) - mAnimationEffect->play(currentAction); - for_each_badges() - { - AnimatedSprite *const sprite = mBadges[f]; - if (sprite != nullptr) - sprite->play(currentAction); - } - for_each_horses(mDownHorseSprites) - (*it)->play(currentAction); - for_each_horses(mUpHorseSprites) - (*it)->play(currentAction); - mAction = action; - } - - if (currentAction != SpriteAction::MOVE - && currentAction != SpriteAction::FLY - && currentAction != SpriteAction::SWIM) - { - mActionTime = tick_time; - } -} - -void Being::setDirection(const uint8_t direction) restrict2 -{ - if (mDirection == direction) - return; - - mDirection = direction; - - mDirectionDelayed = 0; - - // if the direction does not change much, keep the common component - int mFaceDirection = mDirection & direction; - if (mFaceDirection == 0) - mFaceDirection = direction; - - SpriteDirection::Type dir; - if ((mFaceDirection & BeingDirection::UP) != 0) - { - if ((mFaceDirection & BeingDirection::LEFT) != 0) - dir = SpriteDirection::UPLEFT; - else if ((mFaceDirection & BeingDirection::RIGHT) != 0) - dir = SpriteDirection::UPRIGHT; - else - dir = SpriteDirection::UP; - } - else if ((mFaceDirection & BeingDirection::DOWN) != 0) - { - if ((mFaceDirection & BeingDirection::LEFT) != 0) - dir = SpriteDirection::DOWNLEFT; - else if ((mFaceDirection & BeingDirection::RIGHT) != 0) - dir = SpriteDirection::DOWNRIGHT; - else - dir = SpriteDirection::DOWN; - } - else if ((mFaceDirection & BeingDirection::RIGHT) != 0) - { - dir = SpriteDirection::RIGHT; - } - else - { - dir = SpriteDirection::LEFT; - } - mSpriteDirection = dir; - - CompoundSprite::setSpriteDirection(dir); - if (mEmotionSprite != nullptr) - mEmotionSprite->setSpriteDirection(dir); - if (mAnimationEffect != nullptr) - mAnimationEffect->setSpriteDirection(dir); - - for_each_badges() - { - AnimatedSprite *const sprite = mBadges[f]; - if (sprite != nullptr) - sprite->setSpriteDirection(dir); - } - - for_each_horses(mDownHorseSprites) - (*it)->setSpriteDirection(dir); - for_each_horses(mUpHorseSprites) - (*it)->setSpriteDirection(dir); - recalcSpritesOrder(); -} - -uint8_t Being::calcDirection() const restrict2 -{ - uint8_t dir = 0; - if (mDest.x > mX) - dir |= BeingDirection::RIGHT; - else if (mDest.x < mX) - dir |= BeingDirection::LEFT; - if (mDest.y > mY) - dir |= BeingDirection::DOWN; - else if (mDest.y < mY) - dir |= BeingDirection::UP; - return dir; -} - -uint8_t Being::calcDirection(const int dstX, - const int dstY) const restrict2 -{ - uint8_t dir = 0; - if (dstX > mX) - dir |= BeingDirection::RIGHT; - else if (dstX < mX) - dir |= BeingDirection::LEFT; - if (dstY > mY) - dir |= BeingDirection::DOWN; - else if (dstY < mY) - dir |= BeingDirection::UP; - return dir; -} - -void Being::nextTile() restrict2 -{ - if (mPath.empty()) - { - mAction = BeingAction::PRESTAND; - mPreStandTime = tick_time; - return; - } - - const Position pos = mPath.front(); - mPath.pop_front(); - - const uint8_t dir = calcDirection(pos.x, pos.y); - if (dir != 0u) - setDirection(dir); - - if (mMap == nullptr || - !mMap->getWalk(pos.x, pos.y, getBlockWalkMask())) - { - setAction(BeingAction::STAND, 0); - return; - } - - mActionTime += mSpeed / 10; - if ((mType != ActorType::Player || mUseDiagonal) - && mX != pos.x && mY != pos.y) - { - mSpeed = mWalkSpeed * 14 / 10; - } - else - { - mSpeed = mWalkSpeed; - } - - if (mX != pos.x || mY != pos.y) - { - mOldHeight = mMap->getHeightOffset(mX, mY); - if (mReachable == Reachable::REACH_NO && - mMap->getBlockMask(mX, mY) != mMap->getBlockMask(pos.x, pos.y)) - { - mReachable = Reachable::REACH_UNKNOWN; - } - } - mX = pos.x; - mY = pos.y; - const uint8_t height = mMap->getHeightOffset(mX, mY); - mPixelOffsetY = height - mOldHeight; - mFixedOffsetY = height; - mNeedPosUpdate = true; - setAction(BeingAction::MOVE, 0); -} - -void Being::logic() restrict2 -{ - BLOCK_START("Being::logic") - if (A_UNLIKELY(mSpeechTime != 0)) - { - mSpeechTime--; - if (mSpeechTime == 0 && mText != nullptr) - delete2(mText) - } - - if (A_UNLIKELY(mOwner != nullptr)) - { - if (mType == ActorType::Homunculus || - mType == ActorType::Mercenary) - { - botLogic(); - } - } - - const int time = tick_time * MILLISECONDS_IN_A_TICK; - if (mEmotionSprite != nullptr) - mEmotionSprite->update(time); - for_each_horses(mDownHorseSprites) - (*it)->update(time); - for_each_horses(mUpHorseSprites) - (*it)->update(time); - - if (A_UNLIKELY(mCastEndTime != 0 && mCastEndTime < tick_time)) - { - mCastEndTime = 0; - delete2(mCastingEffect); - } - - if (A_UNLIKELY(mAnimationEffect)) - { - mAnimationEffect->update(time); - if (mAnimationEffect->isTerminated()) - delete2(mAnimationEffect) - } - if (A_UNLIKELY(mCastingEffect)) - { - mCastingEffect->update(time); - if (mCastingEffect->isTerminated()) - delete2(mCastingEffect) - } - for_each_badges() - { - AnimatedSprite *restrict const sprite = mBadges[f]; - if (sprite != nullptr) - sprite->update(time); - } - - int frameCount = CAST_S32(getFrameCount()); - - switch (mAction) - { - case BeingAction::STAND: - case BeingAction::SIT: - case BeingAction::DEAD: - case BeingAction::HURT: - case BeingAction::SPAWN: - case BeingAction::CAST: - default: - break; - - case BeingAction::MOVE: - { - if (get_elapsed_time(mActionTime) >= mSpeed) - nextTile(); - break; - } - - case BeingAction::ATTACK: - { - if (mActionTime == 0) - break; - - int curFrame = 0; - if (mAttackSpeed != 0) - { - curFrame = (get_elapsed_time(mActionTime) * frameCount) - / mAttackSpeed; - } - - if (this == localPlayer && curFrame >= frameCount) - nextTile(); - - break; - } - - case BeingAction::PRESTAND: - { - if (get_elapsed_time1(mPreStandTime) > 10) - setAction(BeingAction::STAND, 0); - break; - } - } - - if (mAction == BeingAction::MOVE || mNeedPosUpdate) - { - const int xOffset = getOffset(); - const int yOffset = getOffset(); - int offset = xOffset; - if (offset == 0) - offset = yOffset; - - if ((xOffset == 0) && (yOffset == 0)) - mNeedPosUpdate = false; - - const int halfTile = mapTileSize / 2; - const float offset2 = static_cast( - mPixelOffsetY * abs(offset)) / 2; -// mSortOffsetY = (mOldHeight - mFixedOffsetY + mPixelOffsetY) -// * halfTile - offset2; - mSortOffsetY = 0; - const float yOffset3 = (mY + 1) * mapTileSize + yOffset - - (mOldHeight + mPixelOffsetY) * halfTile + offset2; - - // Update pixel coordinates - setPixelPositionF(static_cast(mX * mapTileSize - + mapTileSize / 2 + xOffset), yOffset3); - } - - if (A_UNLIKELY(mEmotionSprite)) - { - mEmotionTime--; - if (mEmotionTime == 0) - delete2(mEmotionSprite) - } - - ActorSprite::logic(); - - if (frameCount < 10) - frameCount = 10; - - if (A_UNLIKELY(!isAlive() && - mSpeed != 0 && - gameHandler->removeDeadBeings() && - get_elapsed_time(mActionTime) / mSpeed >= frameCount)) - { - if (mType != ActorType::Player && (actorManager != nullptr)) - actorManager->destroy(this); - } - - const SoundInfo *restrict const sound = mNextSound.sound; - if (A_UNLIKELY(sound)) - { - const int time2 = tick_time; - if (time2 > mNextSound.time) - { - soundManager.playSfx(sound->sound, mNextSound.x, mNextSound.y); - - mNextSound.sound = nullptr; - mNextSound.time = time2 + sound->delay; - } - } - - BLOCK_END("Being::logic") -} - -void Being::botLogic() restrict2 -{ - if ((mOwner == nullptr) || (mMap == nullptr) || (mInfo == nullptr)) - return; - - const int time = tick_time; - const int thinkTime = mInfo->getThinkTime(); - if (abs(CAST_S32(mMoveTime) - time) < thinkTime) - return; - - mMoveTime = time; - - int dstX = mOwner->mX; - int dstY = mOwner->mY; - const int warpDist = mInfo->getWarpDist(); - const int divX = abs(dstX - mX); - const int divY = abs(dstY - mY); - - if (divX >= warpDist || divY >= warpDist) - { - if (mType == ActorType::Homunculus) - homunculusHandler->moveToMaster(); - else - mercenaryHandler->moveToMaster(); - mBotAi = true; - return; - } - if (!mBotAi) - return; - if (mAction == BeingAction::MOVE) - { - if (mOwner->mAction == BeingAction::MOVE) - { - updateBotFollow(dstX, dstY, - divX, divY); - } - return; - } - - switch (mOwner->mAction) - { - case BeingAction::MOVE: - case BeingAction::PRESTAND: - updateBotFollow(dstX, dstY, - divX, divY); - break; - case BeingAction::STAND: - case BeingAction::SPAWN: - botFixOffset(dstX, dstY); - moveBotTo(dstX, dstY); - break; - case BeingAction::ATTACK: - { - const Being *const target = localPlayer->getTarget(); - if (target == nullptr) - return; - const BeingId targetId = target->getId(); - if (mType == ActorType::Homunculus) - { - homunculusHandler->attack(targetId, - Keep_true); - } - else - { - mercenaryHandler->attack(targetId, - Keep_true); - } - break; - } - case BeingAction::SIT: - botFixOffset(dstX, dstY); - moveBotTo(dstX, dstY); - break; - case BeingAction::DEAD: - botFixOffset(dstX, dstY); - moveBotTo(dstX, dstY); - break; - case BeingAction::CAST: - case BeingAction::HURT: - default: - break; - } -} - -void Being::botFixOffset(int &restrict dstX, - int &restrict dstY) const -{ - if ((mInfo == nullptr) || (mOwner == nullptr)) - return; - - int offsetX1; - int offsetY1; - switch (mOwner->getCurrentAction()) - { - case BeingAction::SIT: - offsetX1 = mInfo->getSitOffsetX(); - offsetY1 = mInfo->getSitOffsetY(); - break; - - case BeingAction::MOVE: - offsetX1 = mInfo->getMoveOffsetX(); - offsetY1 = mInfo->getMoveOffsetY(); - break; - - case BeingAction::DEAD: - offsetX1 = mInfo->getDeadOffsetX(); - offsetY1 = mInfo->getDeadOffsetY(); - break; - - case BeingAction::ATTACK: - offsetX1 = mInfo->getAttackOffsetX(); - offsetY1 = mInfo->getAttackOffsetY(); - break; - - case BeingAction::SPAWN: - case BeingAction::HURT: - case BeingAction::STAND: - case BeingAction::PRESTAND: - case BeingAction::CAST: - default: - offsetX1 = mInfo->getTargetOffsetX(); - offsetY1 = mInfo->getTargetOffsetY(); - break; - } - - int offsetX = offsetX1; - int offsetY = offsetY1; - switch (mOwner->mDirection) - { - case BeingDirection::LEFT: - offsetX = -offsetY1; - offsetY = offsetX1; - break; - case BeingDirection::RIGHT: - offsetX = offsetY1; - offsetY = -offsetX1; - break; - case BeingDirection::UP: - offsetY = -offsetY; - offsetX = -offsetX; - break; - default: - case BeingDirection::DOWN: - break; - } - dstX += offsetX; - dstY += offsetY; - if (mMap != nullptr) - { - if (!mMap->getWalk(dstX, dstY, getBlockWalkMask())) - { - dstX = mOwner->mX; - dstY = mOwner->mY; - } - } -} - -void Being::updateBotFollow(int dstX, - int dstY, - const int divX, - const int divY) -{ - const int followDist = mInfo->getStartFollowDist(); - const int dist = mInfo->getFollowDist(); - if (divX > followDist || divY > followDist) - { - if (dist > 0) - { - if (divX > followDist) - { - if (dstX > mX + dist) - dstX -= dist; - else if (dstX + dist <= mX) - dstX += dist; - } - else - { - dstX = mX; - } - if (divY > followDist) - { - if (dstY > mY + dist) - dstY -= dist; - else if (dstX + dist <= mX) - dstY += dist; - } - else - { - dstY = mY; - } - } - botFixOffset(dstX, dstY); - moveBotTo(dstX, dstY); - } -} - -void Being::moveBotTo(int dstX, - int dstY) -{ - const int dstX0 = mOwner->mX; - const int dstY0 = mOwner->mY; - const unsigned char blockWalkMask = getBlockWalkMask(); - if (!mMap->getWalk(dstX, dstY, blockWalkMask)) - { - if (dstX != dstX0) - { - dstX = dstX0; - if (!mMap->getWalk(dstX, dstY, blockWalkMask)) - dstY = dstY0; - } - else if (dstY != dstY0) - { - dstY = dstY0; - if (!mMap->getWalk(dstX, dstY, blockWalkMask)) - dstX = dstX0; - } - } - if (mX != dstX || mY != dstY) - { - if (mType == ActorType::Homunculus) - homunculusHandler->move(dstX, dstY); - else - mercenaryHandler->move(dstX, dstY); - return; - } - updateBotDirection(dstX, dstY); -} - -void Being::updateBotDirection(const int dstX, - const int dstY) -{ - int directionType = 0; - switch (mOwner->getCurrentAction()) - { - case BeingAction::STAND: - case BeingAction::MOVE: - case BeingAction::HURT: - case BeingAction::SPAWN: - case BeingAction::CAST: - case BeingAction::PRESTAND: - default: - directionType = mInfo->getDirectionType(); - break; - case BeingAction::SIT: - directionType = mInfo->getSitDirectionType(); - break; - case BeingAction::DEAD: - directionType = mInfo->getDeadDirectionType(); - break; - case BeingAction::ATTACK: - directionType = mInfo->getAttackDirectionType(); - break; - } - - uint8_t newDir = 0; - switch (directionType) - { - case 0: - default: - return; - - case 1: - newDir = mOwner->mDirection; - break; - - case 2: - { - const int dstX0 = mOwner->mX; - const int dstY0 = mOwner->mY; - if (dstX > dstX0) - newDir |= BeingDirection::LEFT; - else if (dstX < dstX0) - newDir |= BeingDirection::RIGHT; - if (dstY > dstY0) - newDir |= BeingDirection::UP; - else if (dstY < dstY0) - newDir |= BeingDirection::DOWN; - break; - } - case 3: - { - const int dstX0 = mOwner->mX; - const int dstY0 = mOwner->mY; - if (dstX > dstX0) - newDir |= BeingDirection::RIGHT; - else if (dstX < dstX0) - newDir |= BeingDirection::LEFT; - if (dstY > dstY0) - newDir |= BeingDirection::DOWN; - else if (dstY < dstY0) - newDir |= BeingDirection::UP; - break; - } - case 4: - { - const int dstX2 = mOwner->getLastAttackX(); - const int dstY2 = mOwner->getLastAttackY(); - if (dstX > dstX2) - newDir |= BeingDirection::LEFT; - else if (dstX < dstX2) - newDir |= BeingDirection::RIGHT; - if (dstY > dstY2) - newDir |= BeingDirection::UP; - else if (dstY < dstY2) - newDir |= BeingDirection::DOWN; - break; - } - } - if ((newDir != 0u) && newDir != mDirection) - { - if (mType == ActorType::Homunculus) - homunculusHandler->setDirection(newDir); - else - mercenaryHandler->setDirection(newDir); - } -} - -void Being::updateBadgesPosition() -{ - const int px = mPixelX - mapTileSize / 2; - const int py = mPixelY - mapTileSize * 2 - mapTileSize; - if (mShowBadges != BadgeDrawType::Hide && - mBadgesCount != 0u) - { - if (mDispName != nullptr && - gui != nullptr) - { - if (mShowBadges == BadgeDrawType::Right) - { - const Font *restrict const font = gui->getFont(); - mBadgesX = mDispName->getX() + mDispName->getWidth(); - mBadgesY = mDispName->getY() - font->getHeight(); - } - else if (mShowBadges == BadgeDrawType::Bottom) - { - mBadgesX = px + 8 - mBadgesCount * 8; - if (mVisibleNamePos == VisibleNamePos::Bottom) - { - mBadgesY = mDispName->getY(); - } - else - { - mBadgesY = py + settings.playerNameOffset + 16; - } - } - else - { - mBadgesX = px + 8 - mBadgesCount * 8; - if (mVisibleNamePos == VisibleNamePos::Top) - mBadgesY = py - mDispName->getHeight(); - else - mBadgesY = py; - } - } - else - { - if (mShowBadges == BadgeDrawType::Right) - { - mBadgesX = px + settings.playerBadgeAtRightOffset; - mBadgesY = py; - } - else if (mShowBadges == BadgeDrawType::Bottom) - { - mBadgesX = px + 8 - mBadgesCount * 8; - const int height = settings.playerNameOffset; - if (mVisibleNamePos == VisibleNamePos::Bottom) - mBadgesY = py + height; - else - mBadgesY = py + height + 16; - } - else - { - mBadgesX = px + 8 - mBadgesCount * 8; - mBadgesY = py; - } - } - } -} - -void Being::drawEmotion(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - if (mErased) - return; - - const int px = mPixelX - offsetX - mapTileSize / 2; - const int py = mPixelY - offsetY - mapTileSize * 2 - mapTileSize; - if (mAnimationEffect != nullptr) - mAnimationEffect->draw(graphics, px, py); - if (mShowBadges != BadgeDrawType::Hide && - mBadgesCount != 0u) - { - int x = mBadgesX - offsetX; - const int y = mBadgesY - offsetY; - for_each_badges() - { - const AnimatedSprite *restrict const sprite = mBadges[f]; - if (sprite != nullptr) - { - sprite->draw(graphics, x, y); - x += 16; - } - } - } - if (mEmotionSprite != nullptr) - mEmotionSprite->draw(graphics, px, py); -} - -void Being::drawSpeech(const int offsetX, - const int offsetY) restrict2 -{ - if (mErased) - return; - if (mSpeech.empty()) - return; - - const int px = mPixelX - offsetX; - const int py = mPixelY - offsetY; - const int speech = mSpeechType; - - // Draw speech above this being - if (mSpeechTime == 0) - { - if (mSpeechBubble != nullptr && - mSpeechBubble->mVisible == Visible_true) - { - mSpeechBubble->setVisible(Visible_false); - } - mSpeech.clear(); - } - else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE || - speech == BeingSpeech::NO_NAME_IN_BUBBLE)) - { - delete2(mText) - - if (mSpeechBubble != nullptr) - { - mSpeechBubble->setPosition(px - (mSpeechBubble->getWidth() / 2), - py - getHeight() - (mSpeechBubble->getHeight())); - mSpeechBubble->setVisible(Visible_true); - mSpeechBubble->requestMoveToBackground(); - } - } - else if (mSpeechTime > 0 && speech == BeingSpeech::TEXT_OVERHEAD) - { - if (mSpeechBubble != nullptr) - mSpeechBubble->setVisible(Visible_false); - - if ((mText == nullptr) && (userPalette != nullptr)) - { - mText = new Text(mSpeech, - mPixelX, - mPixelY - getHeight(), - Graphics::CENTER, - &theme->getColor(ThemeColorId::BUBBLE_TEXT, 255), - Speech_true); - mText->adviseXY(mPixelX, - (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9, - mMoveNames); - } - } - else if (speech == BeingSpeech::NO_SPEECH) - { - if (mSpeechBubble != nullptr) - mSpeechBubble->setVisible(Visible_false); - delete2(mText) - } -} - -template -int Being::getOffset() const restrict2 -{ - // Check whether we're walking in the requested direction - if (mAction != BeingAction::MOVE || !(mDirection & (pos | neg))) - return 0; - - int offset = 0; - - if (mMap && mSpeed) - { - const int time = get_elapsed_time(mActionTime); - offset = (pos == BeingDirection::LEFT && - neg == BeingDirection::RIGHT) ? - (time * mMap->getTileWidth() / mSpeed) - : (time * mMap->getTileHeight() / mSpeed); - } - - // We calculate the offset _from_ the _target_ location - offset -= mapTileSize; - if (offset > 0) - offset = 0; - - // Going into negative direction? Invert the offset. - if (mDirection & pos) - offset = -offset; - - if (offset > mapTileSize) - offset = mapTileSize; - if (offset < -mapTileSize) - offset = -mapTileSize; - - return offset; -} - -void Being::updateCoords() restrict2 -{ - if (mDispName != nullptr) - { - int offsetX = mPixelX; - int offsetY = mPixelY; - if (mInfo != nullptr) - { - offsetX += mInfo->getNameOffsetX(); - offsetY += mInfo->getNameOffsetY(); - } - // Monster names show above the sprite instead of below it - if (mType == ActorType::Monster || - mVisibleNamePos == VisibleNamePos::Top) - { - offsetY += - settings.playerNameOffset - mDispName->getHeight(); - } - mDispName->adviseXY(offsetX, offsetY, mMoveNames); - } - updateBadgesPosition(); -} - -void Being::optionChanged(const std::string &restrict value) restrict2 -{ - if (mType == ActorType::Player && value == "visiblenames") - { - setShowName(config.getIntValue("visiblenames") == VisibleName::Show); - updateBadgesPosition(); - } -} - -void Being::flashName(const int time) restrict2 -{ - if (mDispName != nullptr) - mDispName->flash(time); -} - -std::string Being::getGenderSignWithSpace() const restrict2 -{ - const std::string &restrict str = getGenderSign(); - if (str.empty()) - return str; - else - return std::string(" ").append(str); -} - -std::string Being::getGenderSign() const restrict2 -{ - std::string str; - if (mShowGender) - { - if (getGender() == Gender::FEMALE) - str = "\u2640"; - else if (getGender() == Gender::MALE) - str = "\u2642"; - } - if (mShowPlayersStatus && - mShowBadges == BadgeDrawType::Hide) - { - if (mShop) - str.append("$"); - if (mAway) - { - // TRANSLATORS: this away status writed in player nick - str.append(_("A")); - } - else if (mInactive) - { - // TRANSLATORS: this inactive status writed in player nick - str.append(_("I")); - } - } - return str; -} - -void Being::showName() restrict2 -{ - if (mName.empty()) - return; - - delete2(mDispName); - - if (mHideErased && playerRelations.getRelation(mName) == Relation::ERASED) - return; - - std::string displayName(mName); - - if (mType != ActorType::Monster && (mShowGender || mShowLevel)) - { - displayName.append(" "); - if (mShowLevel && getLevel() != 0) - displayName.append(toString(getLevel())); - - displayName.append(getGenderSign()); - } - - if (mType == ActorType::Monster) - { - if (config.getBoolValue("showMonstersTakedDamage")) - displayName.append(", ").append(toString(getDamageTaken())); - } - - Font *font = nullptr; - if ((localPlayer != nullptr) && localPlayer->getTarget() == this - && mType != ActorType::Monster) - { - font = boldFont; - } - else if (mType == ActorType::Player - && !playerRelations.isGoodName(this) && (gui != nullptr)) - { - font = gui->getSecureFont(); - } - - if (mInfo != nullptr) - { - mDispName = new FlashText(displayName, - mPixelX + mInfo->getNameOffsetX(), - mPixelY + mInfo->getNameOffsetY(), - Graphics::CENTER, - mNameColor, - font); - } - else - { - mDispName = new FlashText(displayName, - mPixelX, - mPixelY, - Graphics::CENTER, - mNameColor, - font); - } - - updateCoords(); -} - -void Being::setDefaultNameColor(const UserColorIdT defaultColor) restrict2 -{ - switch (mTeamId) - { - case 0: - default: - mNameColor = &userPalette->getColor(defaultColor); - break; - case 1: - mNameColor = &userPalette->getColor(UserColorId::TEAM1); - break; - case 2: - mNameColor = &userPalette->getColor(UserColorId::TEAM2); - break; - case 3: - mNameColor = &userPalette->getColor(UserColorId::TEAM3); - break; - } -} - -void Being::updateColors() -{ - if (userPalette != nullptr) - { - if (mType == ActorType::Monster) - { - setDefaultNameColor(UserColorId::MONSTER); - mTextColor = &userPalette->getColor(UserColorId::MONSTER); - } - else if (mType == ActorType::Npc) - { - setDefaultNameColor(UserColorId::NPC); - mTextColor = &userPalette->getColor(UserColorId::NPC); - } - else if (mType == ActorType::Pet) - { - setDefaultNameColor(UserColorId::PET); - mTextColor = &userPalette->getColor(UserColorId::PET); - } - else if (mType == ActorType::Homunculus) - { - setDefaultNameColor(UserColorId::HOMUNCULUS); - mTextColor = &userPalette->getColor(UserColorId::HOMUNCULUS); - } - else if (mType == ActorType::SkillUnit) - { - setDefaultNameColor(UserColorId::SKILLUNIT); - mTextColor = &userPalette->getColor(UserColorId::SKILLUNIT); - } - else if (this == localPlayer) - { - mNameColor = &userPalette->getColor(UserColorId::SELF); - mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255); - } - else - { - mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255); - - if (playerRelations.getRelation(mName) != Relation::ERASED) - mErased = false; - else - mErased = true; - - if (mIsGM) - { - mTextColor = &userPalette->getColor(UserColorId::GM); - mNameColor = &userPalette->getColor(UserColorId::GM); - } - else if (mEnemy) - { - mNameColor = &userPalette->getColor(UserColorId::ENEMY); - } - else if ((mParty != nullptr) && (localPlayer != nullptr) - && mParty == localPlayer->getParty()) - { - mNameColor = &userPalette->getColor(UserColorId::PARTY); - } - else if ((localPlayer != nullptr) && (getGuild() != nullptr) - && getGuild() == localPlayer->getGuild()) - { - mNameColor = &userPalette->getColor(UserColorId::GUILD); - } - else if (playerRelations.getRelation(mName) == Relation::FRIEND) - { - mNameColor = &userPalette->getColor(UserColorId::FRIEND); - } - else if (playerRelations.getRelation(mName) == - Relation::DISREGARDED - || playerRelations.getRelation(mName) == - Relation::BLACKLISTED) - { - mNameColor = &userPalette->getColor(UserColorId::DISREGARDED); - } - else if (playerRelations.getRelation(mName) - == Relation::IGNORED || - playerRelations.getRelation(mName) == Relation::ENEMY2) - { - mNameColor = &userPalette->getColor(UserColorId::IGNORED); - } - else if (playerRelations.getRelation(mName) == Relation::ERASED) - { - mNameColor = &userPalette->getColor(UserColorId::ERASED); - } - else - { - setDefaultNameColor(UserColorId::PC); - } - } - - if (mDispName != nullptr) - mDispName->setColor(mNameColor); - } -} - -void Being::updateSprite(const unsigned int slot, - const int id, - const std::string &restrict color) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - if ((slot != 0u) && mSlots[slot].spriteId == id) - return; - setSpriteColor(slot, - id, - color); -} - -// set sprite id, reset colors, reset cards -void Being::setSpriteId(const unsigned int slot, - const int id) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = mSlots[slot].spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), filename)); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - addItemParticles(id, info.getDisplay()); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } - - BeingSlot &beingSlot = mSlots[slot]; - beingSlot.spriteId = id; - beingSlot.color.clear(); - beingSlot.colorId = ItemColor_one; - beingSlot.cardsId = CardsList(nullptr); - recalcSpritesOrder(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -// reset sprite id, reset colors, reset cards -void Being::unSetSprite(const unsigned int slot) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - removeSprite(slot); - mSpriteDraw[slot] = 0; - - BeingSlot &beingSlot = mSlots[slot]; - const int id1 = beingSlot.spriteId; - if (id1 != 0) - removeItemParticles(id1); - - beingSlot.spriteId = 0; - beingSlot.color.clear(); - beingSlot.colorId = ItemColor_one; - beingSlot.cardsId = CardsList(nullptr); - recalcSpritesOrder(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -// set sprite id, use color string, reset cards -void Being::setSpriteColor(const unsigned int slot, - const int id, - const std::string &color) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - // disabled for now, because it may broke replace/reorder sprites logic -// if (slot && mSlots[slot].spriteId == id) -// return; - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = mSlots[slot].spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - addItemParticles(id, info.getDisplay()); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } - - BeingSlot &beingSlot = mSlots[slot]; - beingSlot.spriteId = id; - beingSlot.color = color; - beingSlot.colorId = ItemColor_one; - beingSlot.cardsId = CardsList(nullptr); - recalcSpritesOrder(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -// set sprite id, use color id, reset cards -void Being::setSpriteColorId(const unsigned int slot, - const int id, - ItemColor colorId) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - // disabled for now, because it may broke replace/reorder sprites logic -// if (slot && mSlots[slot].spriteId == id) -// return; - - std::string color; - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = mSlots[slot].spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - color = info.getDyeColorsString(colorId); - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - addItemParticles(id, info.getDisplay()); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } - - BeingSlot &beingSlot = mSlots[slot]; - beingSlot.spriteId = id; - beingSlot.color = STD_MOVE(color); - beingSlot.colorId = colorId; - beingSlot.cardsId = CardsList(nullptr); - recalcSpritesOrder(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -// set sprite id, colors from cards, cards -void Being::setSpriteCards(const unsigned int slot, - const int id, - const CardsList &cards) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - // disabled for now, because it may broke replace/reorder sprites logic -// if (slot && mSlots[slot].spriteId == id) -// return; - - ItemColor colorId = ItemColor_one; - std::string color; - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = mSlots[slot].spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!cards.isEmpty()) - colorId = ItemColorManager::getColorFromCards(cards); - - if (!filename.empty()) - { - if (color.empty()) - color = info.getDyeColorsString(colorId); - - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - addItemParticlesCards(id, - info.getDisplay(), - cards); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } - - BeingSlot &beingSlot = mSlots[slot]; - beingSlot.spriteId = id; - beingSlot.color = STD_MOVE(color); - beingSlot.colorId = colorId; - beingSlot.cardsId = CardsList(cards); - recalcSpritesOrder(); - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -void Being::setWeaponId(const int id) restrict2 -{ - if (id == 0) - mEquippedWeapon = nullptr; - else - mEquippedWeapon = &ItemDB::get(id); -} - -void Being::setTempSprite(const unsigned int slot, - const int id) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - BeingSlot &beingSlot = mSlots[slot]; - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = beingSlot.spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - ItemColor colorId = ItemColor_one; - const CardsList &cards = beingSlot.cardsId; - if (!cards.isEmpty()) - colorId = ItemColorManager::getColorFromCards(cards); - std::string color = beingSlot.color; - if (color.empty()) - color = info.getDyeColorsString(colorId); - - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - // +++ here probably need use existing cards - addItemParticles(id, info.getDisplay()); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } -} - -void Being::setHairTempSprite(const unsigned int slot, - const int id) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - const CardsList &cards = mSlots[slot].cardsId; - - // id = 0 means unequip - if (id == 0) - { - removeSprite(slot); - mSpriteDraw[slot] = 0; - - const int id1 = mSlots[slot].spriteId; - if (id1 != 0) - removeItemParticles(id1); - } - else - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - ItemColor colorId = ItemColor_one; - if (!cards.isEmpty()) - colorId = ItemColorManager::getColorFromCards(cards); - - std::string color = info.getDyeColorsString(mHairColor); - if (color.empty()) - color = info.getDyeColorsString(colorId); - - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - mSpriteDraw[slot] = id; - - addItemParticles(id, info.getDisplay()); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } -} - -void Being::setHairColorSpriteID(const unsigned int slot, - const int id) restrict2 -{ - BeingSlot &beingSlot = mSlots[slot]; - setSpriteColor(slot, - id, - beingSlot.color); -} - -void Being::setSpriteColor(const unsigned int slot, - const std::string &restrict color) restrict2 -{ - if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite()) - return; - - if (slot >= CAST_U32(mSprites.size())) - ensureSize(slot + 1); - - if (slot >= CAST_U32(mSlots.size())) - mSlots.resize(slot + 1, BeingSlot()); - - // disabled for now, because it may broke replace/reorder sprites logic -// if (slot && mSlots[slot].spriteId == id) -// return; - - BeingSlot &beingSlot = mSlots[slot]; - const int id = beingSlot.spriteId; - - // id = 0 means unequip - if (id != 0) - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(slot, equipmentSprite); - - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - } - - beingSlot.color = color; - beingSlot.colorId = ItemColor_one; - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); -} - -void Being::setHairStyle(const unsigned int slot, - const int id) restrict2 -{ - if (id != 0) - { - setSpriteColor(slot, - id, - ItemDB::get(id).getDyeColorsString(mHairColor)); - } - else - { - setSpriteColor(slot, - 0, - std::string()); - } -} - -void Being::setHairColor(const unsigned int slot, - const ItemColor color) restrict2 -{ - mHairColor = color; - BeingSlot &beingSlot = mSlots[slot]; - const int id = beingSlot.spriteId; - if (id != 0) - { - setSpriteColor(slot, - id, - ItemDB::get(id).getDyeColorsString(color)); - } -} - -void Being::setSpriteSlot(const unsigned int slot, - const BeingSlot &beingSlot) -{ - mSlots[slot] = beingSlot; -} - -void Being::dumpSprites() const restrict2 -{ - STD_VECTOR::const_iterator it1 = mSlots.begin(); - const STD_VECTOR::const_iterator it1_end = mSlots.end(); - - logger->log("sprites"); - for (; it1 != it1_end; - ++ it1) - { - logger->log("%d,%s,%d", - (*it1).spriteId, - (*it1).color.c_str(), - toInt((*it1).colorId, int)); - } -} - -void Being::updateName() restrict2 -{ - if (mShowName) - showName(); -} - -void Being::reReadConfig() -{ - BLOCK_START("Being::reReadConfig") - if (mUpdateConfigTime + 1 < cur_time) - { - mAwayEffect = paths.getIntValue("afkEffectId"); - mHighlightMapPortals = config.getBoolValue("highlightMapPortals"); - mConfLineLim = config.getIntValue("chatMaxCharLimit"); - mSpeechType = config.getIntValue("speech"); - mHighlightMonsterAttackRange = - config.getBoolValue("highlightMonsterAttackRange"); - mLowTraffic = config.getBoolValue("lowTraffic"); - mDrawHotKeys = config.getBoolValue("drawHotKeys"); - mShowBattleEvents = config.getBoolValue("showBattleEvents"); - mShowMobHP = config.getBoolValue("showMobHP"); - mShowOwnHP = config.getBoolValue("showOwnHP"); - mShowGender = config.getBoolValue("showgender"); - mShowLevel = config.getBoolValue("showlevel"); - mShowPlayersStatus = config.getBoolValue("showPlayersStatus"); - mEnableReorderSprites = config.getBoolValue("enableReorderSprites"); - mHideErased = config.getBoolValue("hideErased"); - mMoveNames = fromBool(config.getBoolValue("moveNames"), Move); - mUseDiagonal = config.getBoolValue("useDiagonalSpeed"); - mShowBadges = static_cast( - config.getIntValue("showBadges")); - mVisibleNamePos = static_cast( - config.getIntValue("visiblenamespos")); - - mUpdateConfigTime = cur_time; - } - BLOCK_END("Being::reReadConfig") -} - -bool Being::updateFromCache() restrict2 -{ - const BeingCacheEntry *restrict const entry = - Being::getCacheEntry(getId()); - - if ((entry != nullptr) && entry->getTime() + 120 >= cur_time) - { - if (!entry->getName().empty()) - setName(entry->getName()); - setPartyName(entry->getPartyName()); - setGuildName(entry->getGuildName()); - setLevel(entry->getLevel()); - setPvpRank(entry->getPvpRank()); - setIp(entry->getIp()); - setTeamId(entry->getTeamId()); - - mAdvanced = entry->isAdvanced(); - if (mAdvanced) - { - const int flags = entry->getFlags(); - if ((serverFeatures != nullptr) && - Net::getNetworkType() == ServerType::TMWATHENA) - { - mShop = ((flags & BeingFlag::SHOP) != 0); - } - mAway = ((flags & BeingFlag::AWAY) != 0); - mInactive = ((flags & BeingFlag::INACTIVE) != 0); - if (mShop || mAway || mInactive) - updateName(); - } - else - { - if (Net::getNetworkType() == ServerType::TMWATHENA) - mShop = false; - mAway = false; - mInactive = false; - } - - showShopBadge(mShop); - showInactiveBadge(mInactive); - showAwayBadge(mAway); - updateAwayEffect(); - if (mType == ActorType::Player || (mTeamId != 0u)) - updateColors(); - return true; - } - return false; -} - -void Being::addToCache() const restrict2 -{ - if (localPlayer == this) - return; - - BeingCacheEntry *entry = Being::getCacheEntry(getId()); - if (entry == nullptr) - { - entry = new BeingCacheEntry(getId()); - beingInfoCache.push_front(entry); - - if (beingInfoCache.size() >= CACHE_SIZE) - { - delete beingInfoCache.back(); - beingInfoCache.pop_back(); - } - } - if (!mLowTraffic) - return; - - entry->setName(mName); - entry->setLevel(getLevel()); - entry->setPartyName(getPartyName()); - entry->setGuildName(getGuildName()); - entry->setTime(cur_time); - entry->setPvpRank(getPvpRank()); - entry->setIp(getIp()); - entry->setAdvanced(isAdvanced()); - entry->setTeamId(getTeamId()); - if (isAdvanced()) - { - int flags = 0; - if (Net::getNetworkType() == ServerType::TMWATHENA && mShop) - flags += BeingFlag::SHOP; - if (mAway) - flags += BeingFlag::AWAY; - if (mInactive) - flags += BeingFlag::INACTIVE; - entry->setFlags(flags); - } - else - { - entry->setFlags(0); - } -} - -BeingCacheEntry* Being::getCacheEntry(const BeingId id) -{ - FOR_EACH (std::list::iterator, i, beingInfoCache) - { - if (*i == nullptr) - continue; - - if (id == (*i)->getId()) - { - // Raise priority: move it to front - if ((*i)->getTime() + 120 < cur_time) - { - beingInfoCache.splice(beingInfoCache.begin(), - beingInfoCache, i); - } - return *i; - } - } - return nullptr; -} - - -void Being::setGender(const GenderT gender) restrict2 -{ - if (charServerHandler == nullptr) - return; - - if (gender != mGender) - { - mGender = gender; - - const unsigned int sz = CAST_U32(mSlots.size()); - - if (sz > CAST_U32(mSprites.size())) - ensureSize(sz); - - // Reload all subsprites - for (unsigned int i = 0; - i < sz; - i++) - { - BeingSlot &beingSlot = mSlots[i]; - const int id = beingSlot.spriteId; - if (id != 0) - { - const ItemInfo &info = ItemDB::get(id); - const std::string &restrict filename = info.getSprite( - mGender, mSubType); - int lastTime = 0; - int startTime = 0; - AnimatedSprite *restrict equipmentSprite = nullptr; - - if (!filename.empty()) - { - equipmentSprite = AnimatedSprite::delayedLoad( - pathJoin(paths.getStringValue("sprites"), - combineDye(filename, beingSlot.color))); - } - - if (equipmentSprite != nullptr) - { - equipmentSprite->setSpriteDirection(getSpriteDirection()); - startTime = getStartTime(); - lastTime = getLastTime(); - } - - CompoundSprite::setSprite(i, equipmentSprite); - setAction(mAction, 0); - if (equipmentSprite != nullptr) - { - if (lastTime > 0) - { - equipmentSprite->setLastTime(startTime); - equipmentSprite->update(lastTime); - } - } - - if (beingEquipmentWindow != nullptr) - beingEquipmentWindow->updateBeing(this); - } - } - - updateName(); - } -} - -void Being::showGmBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Gm]); - if (show && - mIsGM && - mShowBadges != BadgeDrawType::Hide && - GroupDb::getShowBadge(mGroupId)) - { - const std::string &gmBadge = GroupDb::getBadge(mGroupId); - if (!gmBadge.empty()) - { - mBadges[BadgeIndex::Gm] = AnimatedSprite::load( - paths.getStringValue("badges") + gmBadge); - } - } - updateBadgesCount(); - updateBadgesPosition(); -} - -void Being::setGM(const bool gm) restrict2 -{ - if (mIsGM != gm) - { - mIsGM = gm; - - showGmBadge(mIsGM); - updateColors(); - } -} - -void Being::talkTo() const restrict2 -{ - if (npcHandler == nullptr) - return; - - if (!PacketLimiter::limitPackets(PacketType::PACKET_NPC_TALK)) - { - // using workaround... - if ((playerHandler != nullptr) && - PacketLimiter::limitPackets(PacketType::PACKET_ATTACK)) - { - playerHandler->attack(mId, Keep_false); - } - return; - } - - npcHandler->talk(this); -} - -void Being::drawPlayer(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - if (!mErased) - { - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - if (mHorseInfo != nullptr) - { - HorseOffset &offset = mHorseInfo->offsets[mSpriteDirection]; - for_each_horses(mDownHorseSprites) - { - (*it)->draw(graphics, - px + offset.downOffsetX, - py + offset.downOffsetY); - } - - drawBeingCursor(graphics, px, py); - drawPlayerSpriteAt(graphics, - px + offset.riderOffsetX, - py + offset.riderOffsetY); - - for_each_horses(mUpHorseSprites) - { - (*it)->draw(graphics, - px + offset.upOffsetX, - py + offset.upOffsetY); - } - } - else - { - drawBeingCursor(graphics, px, py); - drawPlayerSpriteAt(graphics, px, py); - } - } -} - -void Being::drawBeingCursor(Graphics *const graphics, - const int offsetX, - const int offsetY) const -{ - if (mUsedTargetCursor != nullptr) - { - mUsedTargetCursor->update(tick_time * MILLISECONDS_IN_A_TICK); - if (mInfo == nullptr) - { - mUsedTargetCursor->draw(graphics, - offsetX - mCursorPaddingX, - offsetY - mCursorPaddingY); - } - else - { - mUsedTargetCursor->draw(graphics, - offsetX + mInfo->getTargetOffsetX() - mCursorPaddingX, - offsetY + mInfo->getTargetOffsetY() - mCursorPaddingY); - } - } -} - -void Being::drawOther(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawBeingCursor(graphics, px, py); - drawOtherSpriteAt(graphics, px, py); -} - -void Being::drawMonster(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawBeingCursor(graphics, px, py); - drawMonsterSpriteAt(graphics, px, py); -} - -void Being::drawHomunculus(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawBeingCursor(graphics, px, py); - drawHomunculusSpriteAt(graphics, px, py); -} - -void Being::drawMercenary(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawBeingCursor(graphics, px, py); - drawMercenarySpriteAt(graphics, px, py); -} - -void Being::drawElemental(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawBeingCursor(graphics, px, py); - drawElementalSpriteAt(graphics, px, py); -} - -void Being::drawPortal(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - // getActorX() + offsetX; - const int px = mPixelX - mapTileSize / 2 + offsetX; - // getActorY() + offsetY; - const int py = mPixelY - mapTileSize + offsetY; - drawPortalSpriteAt(graphics, px, py); -} - -void Being::draw(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 -{ - switch (mType) - { - case ActorType::Player: - drawPlayer(graphics, - offsetX, - offsetY); - break; - case ActorType::Portal: - drawPortal(graphics, - offsetX, - offsetY); - break; - case ActorType::Homunculus: - drawHomunculus(graphics, - offsetX, - offsetY); - break; - case ActorType::Mercenary: - drawMercenary(graphics, - offsetX, - offsetY); - break; - case ActorType::Elemental: - drawElemental(graphics, - offsetX, - offsetY); - break; - case ActorType::Monster: - drawMonster(graphics, - offsetX, - offsetY); - break; - case ActorType::Pet: - case ActorType::SkillUnit: - case ActorType::Unknown: - case ActorType::Npc: - case ActorType::FloorItem: - case ActorType::Avatar: - default: - drawOther(graphics, - offsetX, - offsetY); - break; - } -} - -void Being::drawPlayerSprites(Graphics *restrict const graphics, - const int posX, - const int posY) const restrict2 -{ - const int sz = CompoundSprite::getNumberOfLayers(); - for (int f = 0; f < sz; f ++) - { - const int rSprite = mSpriteHide[mSpriteRemap[f]]; - if (rSprite == 1) - continue; - - Sprite *restrict const sprite = mSprites[mSpriteRemap[f]]; - if (sprite != nullptr) - { - sprite->setAlpha(mAlpha); - sprite->draw(graphics, posX, posY); - } - } -} - -void Being::drawSpritesSDL(Graphics *restrict const graphics, - const int posX, - const int posY) const restrict2 -{ - const size_t sz = mSprites.size(); - for (size_t f = 0; f < sz; f ++) - { - const int rSprite = mSpriteHide[mSpriteRemap[f]]; - if (rSprite == 1) - continue; - - const Sprite *restrict const sprite = mSprites[mSpriteRemap[f]]; - if (sprite != nullptr) - sprite->draw(graphics, posX, posY); - } -} - -void Being::drawBasic(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - drawCompound(graphics, x, y); -} - -void Being::drawCompound(Graphics *const graphics, - const int posX, - const int posY) const -{ - FUNC_BLOCK("CompoundSprite::draw", 1) - if (mNeedsRedraw) - updateImages(); - - if (mSprites.empty()) // Nothing to draw - return; - - if (mAlpha == 1.0F && (mImage != nullptr)) - { - graphics->drawImage(mImage, - posX + mOffsetX, - posY + mOffsetY); - } - else if ((mAlpha != 0.0f) && (mAlphaImage != nullptr)) - { - mAlphaImage->setAlpha(mAlpha); - graphics->drawImage(mAlphaImage, - posX + mOffsetX, - posY + mOffsetY); - } - else - { - Being::drawPlayerSprites(graphics, posX, posY); - } -} - -void Being::drawPlayerSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - drawCompound(graphics, x, y); - - if (mShowOwnHP && - (mInfo != nullptr) && - localPlayer == this && - mAction != BeingAction::DEAD) - { - drawHpBar(graphics, - PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP), - PlayerInfo::getAttribute(Attributes::PLAYER_HP), - 0, - UserColorId::PLAYER_HP, - UserColorId::PLAYER_HP2, - x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), - y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, - 4); - } -} - -void Being::drawOtherSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - CompoundSprite::drawSimple(graphics, x, y); -} - -void Being::drawMonsterSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - if (mHighlightMonsterAttackRange && - mType == ActorType::Monster && - mAction != BeingAction::DEAD) - { - if (userPalette == nullptr) - { - CompoundSprite::drawSimple(graphics, x, y); - return; - } - - int attackRange; - if (mAttackRange != 0) - attackRange = mapTileSize * mAttackRange; - else - attackRange = mapTileSize; - - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::MONSTER_ATTACK_RANGE)); - - graphics->fillRectangle(Rect( - x - attackRange, y - attackRange, - 2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize)); - } - - CompoundSprite::drawSimple(graphics, x, y); - - if (mShowMobHP && - (mInfo != nullptr) && - (localPlayer != nullptr) && - localPlayer->getTarget() == this && - mType == ActorType::Monster) - { - // show hp bar here - int maxHP = mMaxHP; - if (maxHP == 0) - maxHP = mInfo->getMaxHP(); - - drawHpBar(graphics, - maxHP, - mHP, - mDamageTaken, - UserColorId::MONSTER_HP, - UserColorId::MONSTER_HP2, - x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), - y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, - 4); - } -} - -void Being::drawHomunculusSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - if (mHighlightMonsterAttackRange && - mAction != BeingAction::DEAD) - { - if (userPalette == nullptr) - { - CompoundSprite::drawSimple(graphics, x, y); - return; - } - - int attackRange; - if (mAttackRange != 0) - attackRange = mapTileSize * mAttackRange; - else - attackRange = mapTileSize; - - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::MONSTER_ATTACK_RANGE)); - - graphics->fillRectangle(Rect( - x - attackRange, y - attackRange, - 2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize)); - } - - CompoundSprite::drawSimple(graphics, x, y); - - if (mShowMobHP && - (mInfo != nullptr)) - { - const HomunculusInfo *const info = PlayerInfo::getHomunculus(); - if ((info != nullptr) && - mId == info->id) - { - // show hp bar here - int maxHP = PlayerInfo::getStatBase(Attributes::HOMUN_MAX_HP); - if (maxHP == 0) - maxHP = mInfo->getMaxHP(); - - drawHpBar(graphics, - maxHP, - PlayerInfo::getStatBase(Attributes::HOMUN_HP), - mDamageTaken, - UserColorId::HOMUN_HP, - UserColorId::HOMUN_HP2, - x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), - y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, - 4); - } - } -} - -void Being::drawMercenarySpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - if (mHighlightMonsterAttackRange && - mAction != BeingAction::DEAD) - { - if (userPalette == nullptr) - { - CompoundSprite::drawSimple(graphics, x, y); - return; - } - - int attackRange; - if (mAttackRange != 0) - attackRange = mapTileSize * mAttackRange; - else - attackRange = mapTileSize; - - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::MONSTER_ATTACK_RANGE)); - - graphics->fillRectangle(Rect( - x - attackRange, y - attackRange, - 2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize)); - } - - CompoundSprite::drawSimple(graphics, x, y); - - if (mShowMobHP && - (mInfo != nullptr)) - { - const MercenaryInfo *const info = PlayerInfo::getMercenary(); - if ((info != nullptr) && - mId == info->id) - { - // show hp bar here - int maxHP = PlayerInfo::getStatBase(Attributes::MERC_MAX_HP); - if (maxHP == 0) - maxHP = mInfo->getMaxHP(); - - drawHpBar(graphics, - maxHP, - PlayerInfo::getStatBase(Attributes::MERC_HP), - mDamageTaken, - UserColorId::MERC_HP, - UserColorId::MERC_HP2, - x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), - y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, - 4); - } - } -} - -void Being::drawElementalSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - if (mHighlightMonsterAttackRange && - mAction != BeingAction::DEAD) - { - if (userPalette == nullptr) - { - CompoundSprite::drawSimple(graphics, x, y); - return; - } - - int attackRange; - if (mAttackRange != 0) - attackRange = mapTileSize * mAttackRange; - else - attackRange = mapTileSize; - - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::MONSTER_ATTACK_RANGE)); - - graphics->fillRectangle(Rect( - x - attackRange, y - attackRange, - 2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize)); - } - - CompoundSprite::drawSimple(graphics, x, y); - - if (mShowMobHP && - (mInfo != nullptr)) - { - if (mId == PlayerInfo::getElementalId()) - { - // show hp bar here - int maxHP = PlayerInfo::getStatBase(Attributes::ELEMENTAL_MAX_HP); - if (maxHP == 0) - maxHP = mInfo->getMaxHP(); - - drawHpBar(graphics, - maxHP, - PlayerInfo::getStatBase(Attributes::ELEMENTAL_HP), - mDamageTaken, - UserColorId::ELEMENTAL_HP, - UserColorId::ELEMENTAL_HP2, - x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(), - y + mapTileSize - 6 + mInfo->getHpBarOffsetY(), - 2 * 50, - 4); - } - } -} - -void Being::drawPortalSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 -{ - if (mHighlightMapPortals && - (mMap != nullptr) && - !mMap->getHasWarps()) - { - if (userPalette == nullptr) - { - CompoundSprite::drawSimple(graphics, x, y); - return; - } - - graphics->setColor(userPalette-> - getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT)); - - graphics->fillRectangle(Rect(x, y, - mapTileSize, mapTileSize)); - - if (mDrawHotKeys && !mName.empty()) - { - const Color &color = userPalette->getColor(UserColorId::BEING); - gui->getFont()->drawString(graphics, color, color, mName, x, y); - } - } - - CompoundSprite::drawSimple(graphics, x, y); -} - -void Being::drawHpBar(Graphics *restrict const graphics, - const int maxHP, - const int hp, - const int damage, - const UserColorIdT color1, - const UserColorIdT color2, - const int x, - const int y, - const int width, - const int height) const restrict2 -{ - if (maxHP <= 0 || (userPalette == nullptr)) - return; - - float p; - - if (hp != 0) - { - p = static_cast(maxHP) / static_cast(hp); - } - else if (maxHP != damage) - { - p = static_cast(maxHP) - / static_cast(maxHP - damage); - } - else - { - p = 1; - } - - if (p <= 0 || p > width) - return; - - const int dx = static_cast(static_cast(width) / p); - -#ifdef TMWA_SUPPORT - if (!serverFeatures->haveServerHp()) - { // old servers - if ((damage == 0 && (this != localPlayer || hp == maxHP)) - || (hp == 0 && maxHP == damage)) - { - graphics->setColor(userPalette->getColorWithAlpha(color1)); - graphics->fillRectangle(Rect( - x, y, dx, height)); - return; - } - else if (width - dx <= 0) - { - graphics->setColor(userPalette->getColorWithAlpha(color2)); - graphics->fillRectangle(Rect( - x, y, width, height)); - return; - } - } - else -#endif // TMWA_SUPPORT - { - if (hp == maxHP) - { - graphics->setColor(userPalette->getColorWithAlpha(color1)); - graphics->fillRectangle(Rect( - x, y, dx, height)); - return; - } - else if (width - dx <= 0) - { - graphics->setColor(userPalette->getColorWithAlpha(color2)); - graphics->fillRectangle(Rect( - x, y, width, height)); - return; - } - } - - graphics->setColor(userPalette->getColorWithAlpha(color1)); - graphics->fillRectangle(Rect( - x, y, dx, height)); - - graphics->setColor(userPalette->getColorWithAlpha(color2)); - graphics->fillRectangle(Rect(x + dx, y, width - dx, height)); -} - -void Being::setHP(const int hp) restrict2 -{ - mHP = hp; - if (mMaxHP < mHP) - mMaxHP = mHP; - if (mType == ActorType::Monster) - updatePercentHP(); -} - -void Being::setMaxHP(const int hp) restrict2 -{ - mMaxHP = hp; - if (mMaxHP < mHP) - mMaxHP = mHP; -} - -void Being::resetCounters() restrict2 -{ - mMoveTime = 0; - mAttackTime = 0; - mTalkTime = 0; - mOtherTime = 0; - mTestTime = cur_time; -} - -void Being::recalcSpritesOrder() restrict2 -{ - if (!mEnableReorderSprites) - return; - -// logger->log("recalcSpritesOrder"); - const size_t sz = mSprites.size(); - if (sz < 1) - return; - - STD_VECTOR slotRemap; - IntMap itemSlotRemap; - - STD_VECTOR::iterator it; - int oldHide[20]; - bool updatedSprite[20]; - int dir = mSpriteDirection; - if (dir < 0 || dir >= 9) - dir = 0; - // hack for allow different logic in dead player - if (mAction == BeingAction::DEAD) - dir = 9; - - const unsigned int hairSlot = charServerHandler->hairSprite(); - - for (size_t slot = sz; slot < 20; slot ++) - { - oldHide[slot] = 0; - updatedSprite[slot] = false; - } - - for (size_t slot = 0; slot < sz; slot ++) - { - oldHide[slot] = mSpriteHide[slot]; - mSpriteHide[slot] = 0; - updatedSprite[slot] = false; - } - - size_t spriteIdSize = mSlots.size(); - if (reportTrue(spriteIdSize > 20)) - spriteIdSize = 20; - - for (size_t slot = 0; slot < sz; slot ++) - { - slotRemap.push_back(CAST_S32(slot)); - - if (spriteIdSize <= slot) - continue; - - const int id = mSlots[slot].spriteId; - if (id == 0) - continue; - - const ItemInfo &info = ItemDB::get(id); - - if (info.isRemoveSprites()) - { - const SpriteToItemMap *restrict const spriteToItems - = info.getSpriteToItemReplaceMap(dir); - - if (spriteToItems != nullptr) - { - FOR_EACHP (SpriteToItemMapCIter, itr, spriteToItems) - { - const int remSprite = itr->first; - const IntMap &restrict itemReplacer = itr->second; - if (remSprite >= 0) - { // slot known - if (itemReplacer.empty()) - { - mSpriteHide[remSprite] = 1; - } - else if (mSpriteHide[remSprite] != 1) - { - IntMapCIter repIt = itemReplacer.find( - mSlots[remSprite].spriteId); - if (repIt == itemReplacer.end()) - { - repIt = itemReplacer.find(0); - if (repIt->second == 0) - repIt = itemReplacer.end(); - } - if (repIt != itemReplacer.end()) - { - mSpriteHide[remSprite] = repIt->second; - if (repIt->second != 1) - { - if (CAST_U32(remSprite) - != hairSlot) - { - setTempSprite(remSprite, - repIt->second); - } - else - { - setHairTempSprite(remSprite, - repIt->second); - } - updatedSprite[remSprite] = true; - } - } - } - } - else - { // slot unknown. Search for real slot, this can be slow - FOR_EACH (IntMapCIter, repIt, itemReplacer) - { - for (unsigned int slot2 = 0; slot2 < sz; slot2 ++) - { - if (mSlots[slot2].spriteId == repIt->first) - { - mSpriteHide[slot2] = repIt->second; - if (repIt->second != 1) - { - if (slot2 != hairSlot) - { - setTempSprite(slot2, - repIt->second); - } - else - { - setHairTempSprite(slot2, - repIt->second); - } - updatedSprite[slot2] = true; - } - } - } - } - } - } - } - } - - if (info.mDrawBefore[dir] > 0) - { - const int id2 = mSlots[info.mDrawBefore[dir]].spriteId; - if (itemSlotRemap.find(id2) != itemSlotRemap.end()) - { -// logger->log("found duplicate (before)"); - const ItemInfo &info2 = ItemDB::get(id2); - if (info.mDrawPriority[dir] < info2.mDrawPriority[dir]) - { -// logger->log("old more priority"); - continue; - } - else - { -// logger->log("new more priority"); - itemSlotRemap.erase(id2); - } - } - - itemSlotRemap[id] = -info.mDrawBefore[dir]; - } - else if (info.mDrawAfter[dir] > 0) - { - const int id2 = mSlots[info.mDrawAfter[dir]].spriteId; - if (itemSlotRemap.find(id2) != itemSlotRemap.end()) - { - const ItemInfo &info2 = ItemDB::get(id2); - if (info.mDrawPriority[dir] < info2.mDrawPriority[dir]) - { -// logger->log("old more priority"); - continue; - } - else - { -// logger->log("new more priority"); - itemSlotRemap.erase(id2); - } - } - - itemSlotRemap[id] = info.mDrawAfter[dir]; -// logger->log("item slot->slot %d %d->%d", id, slot, itemSlotRemap[id]); - } - } -// logger->log("preparation end"); - - int lastRemap = 0; - unsigned cnt = 0; - - while (cnt < 15 && lastRemap >= 0) - { - lastRemap = -1; - cnt ++; -// logger->log("iteration"); - - for (unsigned int slot0 = 0; slot0 < sz; slot0 ++) - { - const int slot = searchSlotValue(slotRemap, slot0); - const int val = slotRemap.at(slot); - int id = 0; - - if (CAST_S32(spriteIdSize) > val) - id = mSlots[val].spriteId; - - int idx = -1; - int idx1 = -1; -// logger->log("item %d, id=%d", slot, id); - int reorder = 0; - const IntMapCIter orderIt = itemSlotRemap.find(id); - if (orderIt != itemSlotRemap.end()) - reorder = orderIt->second; - - if (reorder < 0) - { -// logger->log("move item %d before %d", slot, -reorder); - searchSlotValueItr(it, idx, slotRemap, -reorder); - if (it == slotRemap.end()) - return; - searchSlotValueItr(it, idx1, slotRemap, val); - if (it == slotRemap.end()) - return; - lastRemap = idx1; - if (idx1 + 1 != idx) - { - slotRemap.erase(it); - searchSlotValueItr(it, idx, slotRemap, -reorder); - slotRemap.insert(it, val); - } - } - else if (reorder > 0) - { -// logger->log("move item %d after %d", slot, reorder); - searchSlotValueItr(it, idx, slotRemap, reorder); - searchSlotValueItr(it, idx1, slotRemap, val); - if (it == slotRemap.end()) - return; - lastRemap = idx1; - if (idx1 != idx + 1) - { - slotRemap.erase(it); - searchSlotValueItr(it, idx, slotRemap, reorder); - if (it != slotRemap.end()) - { - ++ it; - if (it != slotRemap.end()) - slotRemap.insert(it, val); - else - slotRemap.push_back(val); - } - else - { - slotRemap.push_back(val); - } - } - } - } - } - -// logger->log("after remap"); - for (unsigned int slot = 0; slot < sz; slot ++) - { - mSpriteRemap[slot] = slotRemap[slot]; - if (mSpriteHide[slot] == 0) - { - if (oldHide[slot] != 0 && oldHide[slot] != 1) - { - const BeingSlot &beingSlot = mSlots[slot]; - const int id = beingSlot.spriteId; - if (id == 0) - continue; - - updatedSprite[slot] = true; - setTempSprite(slot, - id); - } - } - } - for (size_t slot = 0; slot < spriteIdSize; slot ++) - { - if (mSpriteHide[slot] == 0) - { - const BeingSlot &beingSlot = mSlots[slot]; - const int id = beingSlot.spriteId; - if (updatedSprite[slot] == false && - mSpriteDraw[slot] != id) - { - setTempSprite(static_cast(slot), - id); - } - } - } -} - -int Being::searchSlotValue(const STD_VECTOR &restrict slotRemap, - const int val) const restrict2 -{ - const size_t sz = mSprites.size(); - for (size_t slot = 0; slot < sz; slot ++) - { - if (slotRemap[slot] == val) - return CAST_S32(slot); - } - return CompoundSprite::getNumberOfLayers() - 1; -} - -void Being::searchSlotValueItr(STD_VECTOR::iterator &restrict it, - int &restrict idx, - STD_VECTOR &restrict slotRemap, - const int val) -{ -// logger->log("searching %d", val); - it = slotRemap.begin(); - const STD_VECTOR::iterator it_end = slotRemap.end(); - idx = 0; - while (it != it_end) - { -// logger->log("testing %d", *it); - if (*it == val) - { -// logger->log("found at %d", idx); - return; - } - ++ it; - idx ++; - } -// logger->log("not found"); - idx = -1; -} - -void Being::updateHit(const int amount) restrict2 -{ - if (amount > 0) - { - if ((mMinHit == 0) || amount < mMinHit) - mMinHit = amount; - if (amount != mCriticalHit && ((mMaxHit == 0) || amount > mMaxHit)) - mMaxHit = amount; - } -} - -Equipment *Being::getEquipment() restrict2 -{ - Equipment *restrict const eq = new Equipment; - Equipment::Backend *restrict const bk = new BeingEquipBackend(this); - eq->setBackend(bk); - return eq; -} - -void Being::undressItemById(const int id) restrict2 -{ - const size_t sz = mSlots.size(); - - for (size_t f = 0; f < sz; f ++) - { - if (id == mSlots[f].spriteId) - { - unSetSprite(CAST_U32(f)); - break; - } - } -} - -void Being::clearCache() -{ - delete_all(beingInfoCache); - beingInfoCache.clear(); -} - -void Being::updateComment() restrict2 -{ - if (mGotComment || mName.empty()) - return; - - mGotComment = true; - mComment = loadComment(mName, mType); -} - -std::string Being::loadComment(const std::string &restrict name, - const ActorTypeT &restrict type) -{ - std::string str; - switch (type) - { - case ActorType::Player: - str = settings.usersDir; - break; - case ActorType::Npc: - str = settings.npcsDir; - break; - case ActorType::Unknown: - case ActorType::Monster: - case ActorType::FloorItem: - case ActorType::Portal: - case ActorType::Avatar: - case ActorType::Mercenary: - case ActorType::Homunculus: - case ActorType::Pet: - case ActorType::SkillUnit: - case ActorType::Elemental: - default: - return ""; - } - - str = pathJoin(str, stringToHexPath(name), "comment.txt"); - if (Files::existsLocal(str)) - { - StringVect lines; - Files::loadTextFileLocal(str, lines); - if (lines.size() >= 2) - return lines[1]; - } - return std::string(); -} - -void Being::saveComment(const std::string &restrict name, - const std::string &restrict comment, - const ActorTypeT &restrict type) -{ - std::string dir; - switch (type) - { - case ActorType::Player: - dir = settings.usersDir; - break; - case ActorType::Npc: - dir = settings.npcsDir; - break; - case ActorType::Monster: - case ActorType::FloorItem: - case ActorType::Portal: - case ActorType::Avatar: - case ActorType::Unknown: - case ActorType::Pet: - case ActorType::Mercenary: - case ActorType::Homunculus: - case ActorType::SkillUnit: - case ActorType::Elemental: - default: - return; - } - dir = pathJoin(dir, stringToHexPath(name)); - Files::saveTextFile(dir, - "comment.txt", - (name + "\n").append(comment)); -} - -void Being::setState(const uint8_t state) restrict2 -{ - const bool shop = ((state & BeingFlag::SHOP) != 0); - const bool away = ((state & BeingFlag::AWAY) != 0); - const bool inactive = ((state & BeingFlag::INACTIVE) != 0); - const bool needUpdate = (shop != mShop || away != mAway - || inactive != mInactive); - - if (Net::getNetworkType() == ServerType::TMWATHENA) - mShop = shop; - mAway = away; - mInactive = inactive; - updateAwayEffect(); - showShopBadge(mShop); - showInactiveBadge(mInactive); - showAwayBadge(mAway); - - if (needUpdate) - { - if (shop || away || inactive) - mAdvanced = true; - updateName(); - addToCache(); - } -} - -void Being::setEmote(const uint8_t emotion, - const int emote_time) restrict2 -{ - if ((emotion & BeingFlag::SPECIAL) == BeingFlag::SPECIAL) - { - setState(emotion); - mAdvanced = true; - } - else - { - const int emotionIndex = emotion - 1; - if (emotionIndex >= 0 && emotionIndex <= EmoteDB::getLast()) - { - delete2(mEmotionSprite) - const EmoteInfo *const info = EmoteDB::get2(emotionIndex, true); - if (info != nullptr) - { - const EmoteSprite *restrict const sprite = - info->sprites.front(); - if (sprite != nullptr) - { - mEmotionSprite = AnimatedSprite::clone(sprite->sprite); - if (mEmotionSprite != nullptr) - mEmotionTime = info->time; - else - mEmotionTime = emote_time; - } - const int effectId = info->effectId; - if (effectId >= 0) - { - effectManager->trigger(effectId, this); - } - } - } - - if (mEmotionSprite != nullptr) - { - mEmotionSprite->play(mSpriteAction); - mEmotionSprite->setSpriteDirection(mSpriteDirection); - } - else - { - mEmotionTime = 0; - } - } -} - -void Being::updatePercentHP() restrict2 -{ - if (mMaxHP == 0) - return; - BLOCK_START("Being::updatePercentHP") - if (mHP != 0) - { - const unsigned num = mHP * 100 / mMaxHP; - if (num != mNumber) - { - mNumber = num; - if (updateNumber(mNumber)) - setAction(mAction, 0); - } - } - BLOCK_END("Being::updatePercentHP") -} - -int Being::getSpriteID(const int slot) const restrict2 -{ - if (slot < 0 || CAST_SIZE(slot) >= mSlots.size()) - return -1; - - return mSlots[slot].spriteId; -} - -const BeingSlot &Being::getSpriteSlot(const int slot) const restrict2 -{ - if (slot < 0 || CAST_SIZE(slot) >= mSlots.size()) - return *emptyBeingSlot; - - return mSlots[slot]; -} - -ItemColor Being::getSpriteColor(const int slot) const restrict2 -{ - if (slot < 0 || CAST_SIZE(slot) >= mSlots.size()) - return ItemColor_one; - - return mSlots[slot].colorId; -} - -void Being::addAfkEffect() restrict2 -{ - addSpecialEffect(mAwayEffect); -} - -void Being::removeAfkEffect() restrict2 -{ - removeSpecialEffect(); -} - -void Being::addSpecialEffect(const int effect) restrict2 -{ - if ((effectManager != nullptr) && - ParticleEngine::enabled && - (mSpecialParticle == nullptr) && - effect != -1) - { - mSpecialParticle = effectManager->triggerReturn(effect, this); - } -} - -void Being::removeSpecialEffect() restrict2 -{ - if ((effectManager != nullptr) && (mSpecialParticle != nullptr)) - { - mChildParticleEffects.removeLocally(mSpecialParticle); - mSpecialParticle = nullptr; - } - delete2(mAnimationEffect); -} - -void Being::updateAwayEffect() restrict2 -{ - if (mAway) - addAfkEffect(); - else - removeAfkEffect(); -} - -void Being::addEffect(const std::string &restrict name) restrict2 -{ - delete mAnimationEffect; - mAnimationEffect = AnimatedSprite::load( - paths.getStringValue("sprites") + name); -} - -void Being::playSfx(const SoundInfo &sound, - Being *const being, - const bool main, - const int x, const int y) const restrict2 -{ - BLOCK_START("Being::playSfx") - - if (being != nullptr) - { - // here need add timer and delay sound - const int time = tick_time; - if (main) - { - being->mNextSound.sound = nullptr; - being->mNextSound.time = time + sound.delay; - soundManager.playSfx(sound.sound, x, y); - } - else if (mNextSound.time <= time) - { // old event sound time is gone. we can play new sound - being->mNextSound.sound = nullptr; - being->mNextSound.time = time + sound.delay; - soundManager.playSfx(sound.sound, x, y); - } - else - { // old event sound in progress. need save sound and wait - being->mNextSound.sound = &sound; - being->mNextSound.x = x; - being->mNextSound.y = y; - } - } - else - { - soundManager.playSfx(sound.sound, x, y); - } - BLOCK_END("Being::playSfx") -} - -void Being::setLook(const uint16_t look) restrict2 -{ - if (mType == ActorType::Player) - setSubtype(mSubType, look); -} - -void Being::setTileCoords(const int x, const int y) restrict2 -{ - mX = x; - mY = y; - if (mMap != nullptr) - { - mPixelOffsetY = 0; - mFixedOffsetY = mPixelOffsetY; - mOldHeight = mMap->getHeightOffset(mX, mY); - mNeedPosUpdate = true; - } -} - -void Being::setMap(Map *restrict const map) restrict2 -{ - mCastEndTime = 0; - delete2(mCastingEffect); - ActorSprite::setMap(map); - if (mMap != nullptr) - { - mPixelOffsetY = mMap->getHeightOffset(mX, mY); - mFixedOffsetY = mPixelOffsetY; - mOldHeight = 0; - mNeedPosUpdate = true; - } -} - -void Being::removeAllItemsParticles() restrict2 -{ - FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) - delete (*it).second; - mSpriteParticles.clear(); -} - -void Being::addItemParticles(const int id, - const SpriteDisplay &restrict display) restrict2 -{ - const SpriteParticleInfoIter it = mSpriteParticles.find(id); - ParticleInfo *restrict pi = nullptr; - if (it == mSpriteParticles.end()) - { - pi = new ParticleInfo; - mSpriteParticles[id] = pi; - } - else - { - pi = (*it).second; - } - - if ((pi == nullptr) || !pi->particles.empty()) - return; - - // setup particle effects - if (ParticleEngine::enabled && - (particleEngine != nullptr)) - { - FOR_EACH (StringVectCIter, itr, display.particles) - { - Particle *const p = particleEngine->addEffect(*itr, 0, 0); - controlCustomParticle(p); - pi->files.push_back(*itr); - pi->particles.push_back(p); - } - } - else - { - FOR_EACH (StringVectCIter, itr, display.particles) - pi->files.push_back(*itr); - } -} - -void Being::addItemParticlesCards(const int id, - const SpriteDisplay &restrict display, - const CardsList &cards) restrict2 -{ - const SpriteParticleInfoIter it = mSpriteParticles.find(id); - ParticleInfo *restrict pi = nullptr; - if (it == mSpriteParticles.end()) - { - pi = new ParticleInfo; - mSpriteParticles[id] = pi; - } - else - { - pi = (*it).second; - } - - if ((pi == nullptr) || !pi->particles.empty()) - return; - - // setup particle effects - if (ParticleEngine::enabled && - (particleEngine != nullptr)) - { - FOR_EACH (StringVectCIter, itr, display.particles) - { - Particle *const p = particleEngine->addEffect(*itr, 0, 0); - controlCustomParticle(p); - pi->files.push_back(*itr); - pi->particles.push_back(p); - } - for (int f = 0; f < maxCards; f ++) - { - const int cardId = cards.cards[f]; - if (!Item::isItem(cardId)) - continue; - const ItemInfo &info = ItemDB::get(cardId); - const SpriteDisplay &restrict display2 = info.getDisplay(); - FOR_EACH (StringVectCIter, itr, display2.particles) - { - Particle *const p = particleEngine->addEffect(*itr, 0, 0); - controlCustomParticle(p); - pi->files.push_back(*itr); - pi->particles.push_back(p); - } - } - } - else - { - FOR_EACH (StringVectCIter, itr, display.particles) - { - pi->files.push_back(*itr); - } - for (int f = 0; f < maxCards; f ++) - { - const int cardId = cards.cards[f]; - if (!Item::isItem(cardId)) - continue; - const ItemInfo &info = ItemDB::get(cardId); - const SpriteDisplay &restrict display2 = info.getDisplay(); - FOR_EACH (StringVectCIter, itr, display2.particles) - { - pi->files.push_back(*itr); - } - } - } -} - -void Being::removeItemParticles(const int id) restrict2 -{ - const SpriteParticleInfoIter it = mSpriteParticles.find(id); - if (it == mSpriteParticles.end()) - return; - ParticleInfo *restrict const pi = (*it).second; - if (pi != nullptr) - { - FOR_EACH (STD_VECTOR::const_iterator, itp, pi->particles) - mChildParticleEffects.removeLocally(*itp); - delete pi; - } - mSpriteParticles.erase(it); -} - -void Being::recreateItemParticles() restrict2 -{ - FOR_EACH (SpriteParticleInfoIter, it, mSpriteParticles) - { - ParticleInfo *restrict const pi = (*it).second; - if ((pi != nullptr) && !pi->files.empty()) - { - FOR_EACH (STD_VECTOR::const_iterator, - itp, pi->particles) - { - mChildParticleEffects.removeLocally(*itp); - } - - FOR_EACH (STD_VECTOR::const_iterator, str, pi->files) - { - Particle *const p = particleEngine->addEffect( - *str, 0, 0); - controlCustomParticle(p); - pi->particles.push_back(p); - } - } - } -} - -void Being::setTeamId(const uint16_t teamId) restrict2 -{ - if (mTeamId != teamId) - { - mTeamId = teamId; - showTeamBadge(mTeamId != 0); - updateColors(); - } -} - -void Being::showTeamBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Team]); - if (show && - mTeamId != 0u && - mShowBadges != BadgeDrawType::Hide) - { - const std::string name = paths.getStringValue("badges") + - paths.getStringValue(strprintf("team%dbadge", - mTeamId)); - if (!name.empty()) - mBadges[BadgeIndex::Team] = AnimatedSprite::load(name); - } - updateBadgesCount(); - updateBadgesPosition(); -} - -void Being::showBadges(const bool show) restrict2 -{ - showTeamBadge(show); - showGuildBadge(show); - showGmBadge(show); - showPartyBadge(show); - showNameBadge(show); - showShopBadge(show); - showInactiveBadge(show); - showAwayBadge(show); -} - -void Being::showPartyBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Party]); - if (show && - !mPartyName.empty() && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = BadgesDB::getPartyBadge(mPartyName); - if (!badge.empty()) - { - mBadges[BadgeIndex::Party] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } - updateBadgesCount(); - updateBadgesPosition(); -} - - -void Being::setPartyName(const std::string &restrict name) restrict2 -{ - if (mPartyName != name) - { - mPartyName = name; - showPartyBadge(!mPartyName.empty()); - } -} - -void Being::showShopBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Shop]); - if (show && - mShop && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = paths.getStringValue("shopbadge"); - if (!badge.empty()) - { - mBadges[BadgeIndex::Shop] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } - updateBadgesCount(); - updateBadgesPosition(); -} - -void Being::showInactiveBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Inactive]); - if (show && - mInactive && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = paths.getStringValue("inactivebadge"); - if (!badge.empty()) - { - mBadges[BadgeIndex::Inactive] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } - updateBadgesCount(); - updateBadgesPosition(); -} - -void Being::showAwayBadge(const bool show) restrict2 -{ - delete2(mBadges[BadgeIndex::Away]); - if (show && - mAway && - mShowBadges != BadgeDrawType::Hide) - { - const std::string badge = paths.getStringValue("awaybadge"); - if (!badge.empty()) - { - mBadges[BadgeIndex::Away] = AnimatedSprite::load( - paths.getStringValue("badges") + badge); - } - } - updateBadgesCount(); - updateBadgesPosition(); -} - -void Being::updateBadgesCount() restrict2 -{ - mBadgesCount = 0; - for_each_badges() - { - if (mBadges[f] != nullptr) - mBadgesCount ++; - } -} - -void Being::setChat(ChatObject *restrict const obj) restrict2 -{ - delete mChat; - mChat = obj; -} - -void Being::setSellBoard(const std::string &restrict text) restrict2 -{ - mShop = !text.empty() || !mBuyBoard.empty(); - mSellBoard = text; - updateName(); - showShopBadge(mShop); -} - -void Being::setBuyBoard(const std::string &restrict text) restrict2 -{ - mShop = !text.empty() || !mSellBoard.empty(); - mBuyBoard = text; - updateName(); - showShopBadge(mShop); -} - -void Being::enableShop(const bool b) restrict2 -{ - mShop = b; - updateName(); - showShopBadge(mShop); -} - -bool Being::isBuyShopEnabled() const restrict2 -{ - return mShop && (Net::getNetworkType() == ServerType::TMWATHENA || - !mBuyBoard.empty()); -} - -bool Being::isSellShopEnabled() const restrict2 -{ - return mShop && (Net::getNetworkType() == ServerType::TMWATHENA || - !mSellBoard.empty()); -} - -void Being::serverRemove() restrict2 noexcept2 -{ - // remove some flags what can survive player remove and next visible - mTrickDead = false; -} - -void Being::addCast(const int dstX, - const int dstY, - const int skillId, - const int skillLevel, - const int range, - const int waitTimeTicks) -{ - if (waitTimeTicks <= 0) - { - mCastEndTime = 0; - return; - } - mCastEndTime = tick_time + waitTimeTicks; - SkillData *const data = skillDialog->getSkillDataByLevel( - skillId, - skillLevel); - delete2(mCastingEffect); - if (data != nullptr) - { - const std::string castingAnimation = data->castingAnimation; - mCastingEffect = new CastingEffect(skillId, - skillLevel, - castingAnimation, - dstX, - dstY, - range); - mCastingEffect->setMap(mMap); - } - else - { - reportAlways("Want to draw casting for unknown skill %d", - skillId); - } -} - -void Being::removeHorse() restrict2 -{ - delete_all(mUpHorseSprites); - mUpHorseSprites.clear(); - delete_all(mDownHorseSprites); - mDownHorseSprites.clear(); -} - -void Being::setRiding(const bool b) restrict2 -{ - if (serverFeatures->haveExtendedRiding()) - return; - - if (b == (mHorseId != 0)) - return; - if (b) - setHorse(1); - else - setHorse(0); -} - -void Being::setHorse(const int horseId) restrict2 -{ - if (mHorseId == horseId) - return; - mHorseId = horseId; - setAction(mAction, 0); - removeHorse(); - if (mHorseId != 0) - { - mHorseInfo = HorseDB::get(horseId); - if (mHorseInfo != nullptr) - { - FOR_EACH (SpriteRefs, it, mHorseInfo->downSprites) - { - const SpriteReference *restrict const ref = *it; - AnimatedSprite *const sprite = AnimatedSprite::load( - ref->sprite, - ref->variant); - mDownHorseSprites.push_back(sprite); - sprite->play(mSpriteAction); - sprite->setSpriteDirection(mSpriteDirection); - } - FOR_EACH (SpriteRefs, it, mHorseInfo->upSprites) - { - const SpriteReference *restrict const ref = *it; - AnimatedSprite *const sprite = AnimatedSprite::load( - ref->sprite, - ref->variant); - mUpHorseSprites.push_back(sprite); - sprite->play(mSpriteAction); - sprite->setSpriteDirection(mSpriteDirection); - } - } - } - else - { - mHorseInfo = nullptr; - } -} - -void Being::setTrickDead(const bool b) restrict2 -{ - if (b != mTrickDead) - { - mTrickDead = b; - setAction(mAction, 0); - } -} - -void Being::setSpiritBalls(const unsigned int balls) restrict2 -{ - if (!ParticleEngine::enabled) - { - mSpiritBalls = balls; - return; - } - - if (balls > mSpiritBalls) - { - const int effectId = paths.getIntValue("spiritEffectId"); - if (effectId != -1) - addSpiritBalls(balls - mSpiritBalls, effectId); - } - else if (balls < mSpiritBalls) - { - removeSpiritBalls(mSpiritBalls - balls); - } - mSpiritBalls = balls; -} - -void Being::addSpiritBalls(const unsigned int balls, - const int effectId) restrict2 -{ - if (effectManager == nullptr) - return; - for (unsigned int f = 0; f < balls; f ++) - { - Particle *const particle = effectManager->triggerReturn( - effectId, - this); - mSpiritParticles.push_back(particle); - } -} - -void Being::removeSpiritBalls(const unsigned int balls) restrict2 -{ - if (particleEngine == nullptr) - return; - for (unsigned int f = 0; f < balls && !mSpiritParticles.empty(); f ++) - { - const Particle *restrict const particle = mSpiritParticles.back(); - mChildParticleEffects.removeLocally(particle); - mSpiritParticles.pop_back(); - } -} - -void Being::stopCast(const bool b) -{ - if (b && mAction == BeingAction::CAST) - setAction(BeingAction::STAND, 0); -} - -void Being::fixDirectionOffsets(int &offsetX, - int &offsetY) const -{ - const uint8_t dir = mDirection; - if ((dir & BeingDirection::DOWN) != 0) - { - // do nothing - } - else if ((dir & BeingDirection::UP) != 0) - { - offsetX = -offsetX; - offsetY = -offsetY; - } - else if ((dir & BeingDirection::LEFT) != 0) - { - const int tmp = offsetY; - offsetY = offsetX; - offsetX = -tmp; - } - else if ((dir & BeingDirection::RIGHT) != 0) - { - const int tmp = offsetY; - offsetY = -offsetX; - offsetX = tmp; - } -} - -void Being::setLanguageId(const int lang) restrict2 noexcept2 -{ - if (lang != mLanguageId) - { - delete2(mBadges[BadgeIndex::Lang]); - const std::string &badge = LanguageDb::getIcon(lang); - if (!badge.empty()) - { - mBadges[BadgeIndex::Lang] = AnimatedSprite::load(pathJoin( - paths.getStringValue("languageIcons"), - badge)); - } - - mLanguageId = lang; - } - updateBadgesCount(); - updateBadgesPosition(); -} - -Being *Being::createBeing(const BeingId id, - const ActorTypeT type, - const BeingTypeId subType, - Map *const map) -{ - Being *const being = new Being(id, - type); - being->postInit(subType, - map); - return being; -} diff --git a/src/being/being.h b/src/being/being.h deleted file mode 100644 index 0ca1ce780..000000000 --- a/src/being/being.h +++ /dev/null @@ -1,1375 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_BEING_H -#define BEING_BEING_H - -#include "position.h" - -#include "enums/being/badgeindex.h" -#include "enums/being/reachable.h" - -#include "enums/gui/usercolorid.h" - -#include "enums/simpletypes/move.h" - -#include "enums/being/visiblenamepos.h" - -#include "resources/beinginfo.h" -#include "resources/beingslot.h" - -#include "being/actorsprite.h" - -#include "enums/being/attacktype.h" -#include "enums/being/badgedrawtype.h" -#include "enums/being/beingaction.h" -#include "enums/being/gender.h" - -#include "listeners/configlistener.h" - -#include "localconsts.h" - -static const int DEFAULT_BEING_WIDTH = 32; -static const int DEFAULT_BEING_HEIGHT = 32; - -class AnimatedSprite; -class BeingCacheEntry; -class CastingEffect; -class Color; -class Equipment; -class FlashText; -class Guild; -class ItemInfo; -class Particle; -class Party; -class SpeechBubble; -class Text; - -struct ChatObject; -struct HorseInfo; -struct MissileInfo; -struct SkillInfo; -struct ParticleInfo; - -extern volatile time_t cur_time; - -struct NextSoundInfo final -{ - NextSoundInfo() noexcept2 : - sound(nullptr), - x(0), - y(0), - time(0) - { - } - - A_DELETE_COPY(NextSoundInfo) - - const SoundInfo *sound; - int x; - int y; - int time; -}; - -class Being notfinal : public ActorSprite, - public ConfigListener -{ - public: - friend class ActorManager; - friend class BeingEquipBackend; - friend class LocalPlayer; - - /** - * Constructor. - * - * @param id a unique being id - * @param subtype partly determines the type of the being - * @param map the map the being is on - */ - Being(const BeingId id, - const ActorTypeT type); - - A_DELETE_COPY(Being) - - virtual ~Being(); - - ActorTypeT getType() const restrict2 noexcept2 override final - A_WARN_UNUSED - { return mType; } - - /** - * Removes all path nodes from this being. - */ - void clearPath() restrict2; - - /** - * Returns the time spent in the current action. - */ - int getActionTime() const restrict2 noexcept2 A_WARN_UNUSED - { return mActionTime; } - - /** - * Set the current action time. - * @see Ea::BeingHandler that set it to tick time. - */ - void setActionTime(const int actionTime) restrict2 noexcept2 - { mActionTime = actionTime; } - - /** - * Makes this being take the next tile of its path. - */ - virtual void nextTile() restrict2; - - /** - * Creates a path for the being from current position to ex and ey - */ - void setDestination(const int dstX, - const int dstY) restrict2; - - void setCachedDestination(const int dstX, - const int dstY) restrict2 noexcept2 - { mCachedX = dstX; mCachedY = dstY; } - - int getCachedX() const noexcept2 A_WARN_UNUSED - { return mCachedX; } - - int getCachedY() const noexcept2 A_WARN_UNUSED - { return mCachedY; } - - /** - * Returns the destination for this being. - */ - const Vector &getDestination() const restrict2 noexcept2 A_WARN_UNUSED - { return mDest; } - - /** - * Returns the tile x coord - */ - int getTileX() const restrict2 noexcept2 override A_WARN_UNUSED - { return mX; } - - /** - * Returns the tile y coord - */ - int getTileY() const restrict2 noexcept2 override A_WARN_UNUSED - { return mY; } - - /** - * Sets the tile x and y coord - */ - void setTileCoords(const int x, const int y) restrict2; - - /** - * Puts a "speech balloon" above this being for the specified amount - * of time. - * - * @param text The text that should appear. - * @param time The amount of time the text should stay in milliseconds. - */ - void setSpeech(const std::string &restrict text, - const std::string &restrict channel = "", - int time = 0) restrict2; - - /** - * Puts a damage bubble above this being. - * - * @param attacker the attacking being - * @param amount the amount of damage recieved (0 means miss) - * @param type the attack type - * @param attackId the attack id - * @param level the skill level - */ - void takeDamage(Being *restrict const attacker, - const int amount, - const AttackTypeT type, - const int attackId = 1, - const int level = 1) restrict2; - - /** - * Handles an attack of another being by this being. - * - * @param victim the victim being - * @param damage the amount of damage dealt (0 means miss) - * @param attackId the attack id - */ - void handleAttack(Being *restrict const victim, - const int damage, - const int attackId = 1) restrict2; - - void handleSkillCasting(Being *restrict const victim, - const int skillId, - const int skillLevel) restrict2; - - void handleSkill(Being *restrict const victim, - const int damage, - const int skillId, - const int skillLevel) restrict2; - - const ItemInfo *getEquippedWeapon() const restrict2 A_WARN_UNUSED - { return mEquippedWeapon; } - - /** - * Returns the name of the being. - */ - const std::string &getName() const restrict2 noexcept2 A_WARN_UNUSED - { return mName; } - - const std::string &getExtName() const restrict2 noexcept2 A_WARN_UNUSED - { return mExtName; } - - /** - * Sets the name for the being. - * - * @param name The name that should appear. - */ - void setName(const std::string &restrict name) restrict2; - - bool getShowName() const noexcept2 A_WARN_UNUSED - { return mShowName; } - - void setShowName(const bool doShowName) restrict2; - - /** - * Sets the name of the party the being is in. Shown in BeingPopup. - */ - void setPartyName(const std::string &restrict name) restrict2; - - const std::string &getPartyName() const restrict2 noexcept2 - A_WARN_UNUSED - { return mPartyName; } - - const std::string &getGuildName() const restrict2 noexcept2 - A_WARN_UNUSED - { return mGuildName; } - - /** - * Sets the name of the primary guild the being is in. Shown in - * BeingPopup (eventually). - */ - void setGuildName(const std::string &restrict name) restrict2; - - void setGuildPos(const std::string &restrict pos) restrict2 A_CONST; - - /** - * Adds a guild to the being. - */ - void addGuild(Guild *restrict const guild) restrict2; - - /** - * Removers a guild from the being. - */ - void removeGuild(const int id) restrict2; - - /** - * Returns a pointer to the specified guild that the being is in. - */ - const Guild *getGuild(const std::string &restrict guildName) - const restrict2 A_WARN_UNUSED; - - /** - * Returns a pointer to the specified guild that the being is in. - */ - const Guild *getGuild(const int id) const restrict2 A_WARN_UNUSED; - - /** - * Returns a pointer to the specified guild that the being is in. - */ - Guild *getGuild() const restrict2 A_WARN_UNUSED; - - /** - * Returns all guilds the being is in. - */ - const std::map &getGuilds() const restrict2 noexcept2 - A_WARN_UNUSED - { return mGuilds; } - - /** - * Removes all guilds the being is in. - */ - void clearGuilds() restrict2; - - /** - * Get number of guilds the being belongs to. - */ - int16_t getNumberOfGuilds() const restrict2 A_WARN_UNUSED - { return CAST_S16(mGuilds.size()); } - - bool isInParty() const restrict2 noexcept2 A_WARN_UNUSED - { return mParty != nullptr; } - - void setParty(Party *restrict const party) restrict2; - - void setGuild(Guild *restrict const guild) restrict2; - - void updateGuild() restrict2; - - Party *getParty() const restrict2 noexcept2 A_WARN_UNUSED - { return mParty; } - - void setSprite(const unsigned int slot, - const int id, - std::string color, - ItemColor colorId) restrict2; - - void setSpriteColor(const unsigned int slot, - const int id, - const std::string &color) restrict2; - - void setSpriteColorId(const unsigned int slot, - const int id, - ItemColor colorId) restrict2; - - void setSpriteCards(const unsigned int slot, - const int id, - const CardsList &restrict cards) restrict2; - - void setSpriteId(const unsigned int slot, - const int id) restrict2; - - void unSetSprite(const unsigned int slot) restrict2; - - void setWeaponId(const int id) restrict2; - - void setTempSprite(const unsigned int slot, - const int id) restrict2; - - void setHairTempSprite(const unsigned int slot, - const int id) restrict2; - - void updateSprite(const unsigned int slot, - const int id, - const std::string &restrict color = "") - restrict2; - - void setHairColorSpriteID(const unsigned int slot, - const int id) restrict2; - - void setSpriteColor(const unsigned int slot, - const std::string &restrict color = "") restrict2; - - /** - * Get the number of layers used to draw the being - */ - int getNumberOfLayers() const restrict2 override A_WARN_UNUSED - { return CompoundSprite::getNumberOfLayers(); } - - /** - * Performs being logic. - */ - void logic() restrict2 override; - - void botLogic() restrict2; - - /** - * Draws the speech text above the being. - */ - void drawSpeech(const int offsetX, - const int offsetY) restrict2; - - /** - * Draws the emotion picture above the being. - */ - void drawEmotion(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const restrict2 A_NONNULL(2); - - BeingTypeId getSubType() const restrict2 noexcept2 A_WARN_UNUSED - { return mSubType; } - - /** - * Set Being's subtype (mostly for view for monsters and NPCs) - */ - void setSubtype(const BeingTypeId subtype, - const uint16_t look) restrict2; - - const BeingInfo *getInfo() const restrict2 noexcept2 A_WARN_UNUSED - { return mInfo; } - - TargetCursorSizeT getTargetCursorSize() const restrict2 override final - A_WARN_UNUSED; - - int getTargetOffsetX() const restrict2 override A_WARN_UNUSED - { - if (mInfo == nullptr) - return 0; - return mInfo->getTargetOffsetX(); - } - - int getTargetOffsetY() const restrict2 override A_WARN_UNUSED - { - if (mInfo == nullptr) - return 0; - return mInfo->getTargetOffsetY(); - } - - /** - * Gets the way the object is blocked by other objects. - */ - virtual unsigned char getBlockWalkMask() const restrict2 A_WARN_UNUSED - { - if (mInfo == nullptr) - return 0; - return mInfo->getBlockWalkMask(); - } - - /** - * Gets the way the monster blocks pathfinding for other objects - */ - BlockTypeT getBlockType() const restrict2 override A_WARN_UNUSED - { - if (mInfo == nullptr) - return BlockType::NONE; - return mInfo->getBlockType(); - } - - /** - * Sets the walk speed in pixels per second. - */ - void setWalkSpeed(const int speed) restrict2 - { mWalkSpeed = speed; mSpeed = speed; } - - /** - * Gets the walk speed in pixels per second. - */ - int getWalkSpeed() const restrict2 noexcept2 A_WARN_UNUSED - { return mWalkSpeed; } - - /** - * Sets the attack speed. - */ - void setAttackSpeed(const int speed) restrict2 noexcept2 - { mAttackSpeed = speed; } - - /** - * Gets the attack speed. - */ - int getAttackSpeed() const restrict2 noexcept2 A_WARN_UNUSED - { return mAttackSpeed; } - - /** - * Sets the current action. - */ - virtual void setAction(const BeingActionT &restrict action, - const int attackId) restrict2; - - /** - * Get the being's action currently performed. - */ - BeingActionT getCurrentAction() const restrict2 noexcept2 A_WARN_UNUSED - { return mAction; } - - /** - * Returns whether this being is still alive. - */ - bool isAlive() const restrict2 noexcept2 A_WARN_UNUSED - { return mAction != BeingAction::DEAD; } - - /** - * Returns the current direction. - */ - uint8_t getDirection() const restrict2 noexcept2 A_WARN_UNUSED - { return mDirection; } - - /** - * Sets the current direction. - */ - virtual void setDirection(const uint8_t direction) restrict2; - - void setDirectionDelayed(const uint8_t direction) restrict2 noexcept2 - { mDirectionDelayed = direction; } - - uint8_t getDirectionDelayed() const restrict2 noexcept2 A_WARN_UNUSED - { return mDirectionDelayed; } - - /** - * Returns the direction the being is facing. - */ - SpriteDirection::Type getSpriteDirection() const restrict2 noexcept2 - A_WARN_UNUSED - { return mSpriteDirection; } - - void setPixelPositionF(const Vector &restrict pos) restrict2 override; - - /** - * Overloaded method provided for convenience. - * - * @see setPosition(const Vector &pos) - */ - inline void setPixelPositionF(const float x, - const float y, - const float z = 0.0F) restrict2 A_INLINE - { setPixelPositionF(Vector(x, y, z)); } - - /** - * Returns the horizontal size of the current base sprite of the being. - */ - int getWidth() const restrict2 override final A_WARN_UNUSED - { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); } - - /** - * Returns the vertical size of the current base sprite of the being. - */ - int getHeight() const restrict2 override final A_WARN_UNUSED - { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); } - - /** - * Shoots a missile particle from this being, to target being - */ - void fireMissile(Being *restrict const victim, - const MissileInfo &restrict missile) const restrict2; - - /** - * Returns the path this being is following. An empty path is returned - * when this being isn't following any path currently. - */ - const Path &getPath() const restrict2 noexcept2 A_WARN_UNUSED - { return mPath; } - - int getDistance() const restrict2 noexcept2 A_WARN_UNUSED - { return mDistance; } - - void setDistance(const int n) restrict2 noexcept2 - { mDistance = n; } - - /** - * Set the Emoticon type and time displayed above - * the being. - */ - void setEmote(const uint8_t emotion, - const int emote_time) restrict2; - - void setState(const uint8_t state) restrict2; - - void drawPlayerSprites(Graphics *restrict const graphics, - const int posX, - const int posY) const - restrict2 A_NONNULL(2); - - void drawSpritesSDL(Graphics *restrict const graphics, - const int posX, - const int posY) const - restrict2 override final A_NONNULL(2); - - void drawHpBar(Graphics *restrict const graphics, - const int maxHP, - const int hp, - const int damage, - const UserColorIdT color1, - const UserColorIdT color2, - const int x, - const int y, - const int width, - const int height) const restrict2 A_NONNULL(2); - - void optionChanged(const std::string &restrict value) - restrict2 override; - - void flashName(const int time) restrict2; - - int getDamageTaken() const restrict2 noexcept2 A_WARN_UNUSED - { return mDamageTaken; } - - void setDamageTaken(const int damage) restrict2 noexcept2 - { mDamageTaken = damage; } - - void updateName() restrict2; - - void setLevel(const int n) restrict2 noexcept2 - { mLevel = n; } - - virtual int getLevel() const restrict2 A_WARN_UNUSED - { return mLevel; } - - void setReachable(const ReachableT n) restrict2 noexcept2 - { mReachable = n; } - - ReachableT getReachable() const restrict2 noexcept2 A_WARN_UNUSED - { return mReachable; } - - static void reReadConfig(); - - static BeingCacheEntry* getCacheEntry(const BeingId id) A_WARN_UNUSED; - - void addToCache() const restrict2; - - bool updateFromCache() restrict2; - - /** - * Sets the gender of this being. - */ - virtual void setGender(const GenderT gender) restrict2; - - GenderT getGender() const restrict2 noexcept2 A_WARN_UNUSED - { return mGender; } - - /** - * Return sprite sit action for current environment. - */ - std::string getSitAction() const restrict2 A_WARN_UNUSED; - - std::string getCastAction() const restrict2 A_WARN_UNUSED; - - std::string getCastAction(const SkillInfo *restrict const skill) const - restrict2 A_WARN_UNUSED; - - std::string getMoveAction() const restrict2 A_WARN_UNUSED; - - std::string getDeadAction() const restrict2 A_WARN_UNUSED; - - std::string getStandAction() const restrict2 A_WARN_UNUSED; - - std::string getSpawnAction() const restrict2 A_WARN_UNUSED; - - std::string getWeaponAttackAction(const ItemInfo *restrict const - weapon) const - restrict2 A_WARN_UNUSED; - - std::string getAttackAction() const restrict2 A_WARN_UNUSED; - - std::string getAttackAction(const Attack *restrict const attack1) const - restrict2 A_WARN_UNUSED; - - /** - * Whether or not this player is a GM. - */ - bool isGM() const restrict2 noexcept2 A_WARN_UNUSED - { return mIsGM; } - - /** - * Triggers whether or not to show the name as a GM name. - */ - void setGM(const bool gm) restrict2; - - bool canTalk() const restrict2 noexcept2 A_WARN_UNUSED - { return mType == ActorType::Npc; } - - void talkTo() const restrict2; - - void draw(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 override final A_NONNULL(2); - - void drawPlayer(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawOther(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawMonster(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawPortal(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawBasic(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void setMoveTime() restrict2 noexcept2 - { mMoveTime = cur_time; } - - void setAttackTime() restrict2 noexcept2 - { mAttackTime = cur_time; } - - void setTalkTime() restrict2 noexcept2 - { mTalkTime = cur_time; } - - void setTestTime() restrict2 noexcept2 - { mTestTime = cur_time; } - - void setOtherTime() restrict2 noexcept2 - { mOtherTime = cur_time; } - - time_t getMoveTime() const restrict2 noexcept2 - { return mMoveTime; } - - time_t getAttackTime() const restrict2 noexcept2 - { return mAttackTime; } - - time_t getTalkTime() const restrict2 noexcept2 - { return mTalkTime; } - - time_t getTestTime() const restrict2 noexcept2 - { return mTestTime; } - - time_t getOtherTime() const restrict2 noexcept2 - { return mOtherTime; } - - void resetCounters() restrict2; - - void updateColors() restrict2; - - void setEnemy(const bool n) restrict2 noexcept2 - { mEnemy = n; } - - const std::string &getIp() const restrict2 noexcept2 A_WARN_UNUSED - { return mIp; } - - void setIp(const std::string &restrict ip) restrict2 noexcept2 - { mIp = ip; } - - unsigned int getPvpRank() const restrict2 noexcept2 A_WARN_UNUSED - { return mPvpRank; } - - void setPvpRank(const unsigned int rank) restrict2 noexcept2 - { mPvpRank = rank; } - - void setHP(const int hp) restrict2; - - void setMaxHP(const int hp) restrict2; - - int getHP() const restrict2 noexcept2 A_WARN_UNUSED - { return mHP; } - - int getMaxHP() const restrict2 noexcept2 A_WARN_UNUSED - { return mMaxHP; } - - uint8_t calcDirection(const int dstX, - const int dstY) const restrict2 A_WARN_UNUSED; - - uint8_t calcDirection() const restrict2 A_WARN_UNUSED; - - void setAttackDelay(const int n) restrict2 noexcept2 - { mAttackDelay = n; } - - int getAttackDelay() const restrict2 noexcept2 A_WARN_UNUSED - { return mAttackDelay; } - - int getMinHit() const restrict2 noexcept2 A_WARN_UNUSED - { return mMinHit; } - - void setMinHit(const int n) restrict2 noexcept2 - { mMinHit = n; } - - int getMaxHit() const restrict2 noexcept2 A_WARN_UNUSED - { return mMaxHit; } - - void setMaxHit(const int n) restrict2 noexcept2 - { mMaxHit = n; } - - int getCriticalHit() const restrict2 A_WARN_UNUSED - { return mCriticalHit; } - - void setCriticalHit(const int n) restrict2 noexcept2 - { mCriticalHit = n; } - - void updateHit(const int amount) restrict2; - - Equipment *getEquipment() restrict2 A_WARN_UNUSED; - - void undressItemById(const int id) restrict2; - - int getGoodStatus() const restrict2 noexcept2 A_WARN_UNUSED - { return mGoodStatus; } - - void setGoodStatus(const int n) restrict2 noexcept2 - { mGoodStatus = n; } - - std::string getGenderSign() const restrict2 A_WARN_UNUSED; - - std::string getGenderSignWithSpace() const restrict2 A_WARN_UNUSED; - - void updateComment() restrict2; - - const std::string getComment() const restrict2 noexcept2 A_WARN_UNUSED - { return mComment; } - - void setComment(const std::string &restrict n) restrict2 noexcept2 - { mComment = n; } - - static void clearCache(); - - static std::string loadComment(const std::string &restrict name, - const ActorTypeT &restrict type) - A_WARN_UNUSED; - - static void saveComment(const std::string &restrict name, - const std::string &restrict comment, - const ActorTypeT &restrict type); - - bool isAdvanced() const restrict2 noexcept2 A_WARN_UNUSED - { return mAdvanced; } - - void setAdvanced(const bool n) restrict2 - { mAdvanced = n; addToCache(); } - - bool isBuyShopEnabled() const restrict2 A_WARN_UNUSED; - - bool isSellShopEnabled() const restrict2 A_WARN_UNUSED; - - void enableShop(const bool b) restrict2; - - /** - * Sets the attack range. - */ - void setAttackRange(const int range) restrict2 noexcept2 - { mAttackRange = range; } - -/* - void attack(Being *restrict target = nullptr, - bool keep = false, - bool dontChangeEquipment = false) restrict2; - - void attack2(Being *restrict target = nullptr, - bool keep = false, - bool dontChangeEquipment = false) restrict2; -*/ - - void updatePercentHP() restrict2; - - void setRaceName(const std::string &restrict name) restrict2 noexcept2 - { mRaceName = name; } - - std::string getRaceName() const restrict2 noexcept2 A_WARN_UNUSED - { return mRaceName; } - - int getSpriteID(const int slot) const restrict2 A_WARN_UNUSED; - - const BeingSlot &getSpriteSlot(const int slot) const - restrict2 A_WARN_UNUSED; - - ItemColor getSpriteColor(const int slot) const restrict2 A_WARN_UNUSED; - - void setHairStyle(const unsigned int slot, - const int id) restrict2; - - void setHairColor(const unsigned int slot, - const ItemColor color) restrict2; - - void setHairColor(const ItemColor color) restrict2 noexcept2 - { mHairColor = color; } - - void setSpriteSlot(const unsigned int slot, - const BeingSlot &beingSlot); - - ItemColor getHairColor() const noexcept2 A_WARN_UNUSED - { return mHairColor; } - - void recalcSpritesOrder() restrict2; - - int getHitEffect(const Being *restrict const attacker, - const AttackTypeT type, - const int attackId, - const int level) const restrict2 A_WARN_UNUSED; - - CursorT getHoverCursor() const restrict2 A_WARN_UNUSED - { - return mInfo != nullptr ? - mInfo->getHoverCursor() : Cursor::CURSOR_POINTER; - } - - void addAfkEffect() restrict2; - - void removeAfkEffect() restrict2; - - void updateAwayEffect() restrict2; - - void addSpecialEffect(const int effect) restrict2; - - void removeSpecialEffect() restrict2; - - void addEffect(const std::string &restrict name) restrict2; - - void setOwner(Being *restrict const owner) restrict2 noexcept2 - { mOwner = owner; } - - Being *getOwner() const restrict2 noexcept2 - { return mOwner; } - - void playSfx(const SoundInfo &sound, - Being *const being, - const bool main, - const int x, const int y) const restrict2; - - uint16_t getLook() const restrict2 noexcept2 - { return mLook; } - - void setLook(const uint16_t look) restrict2; - - constexpr2 static uint8_t genderToInt(const GenderT sex) - A_CONST A_WARN_UNUSED - { - switch (sex) - { - case Gender::FEMALE: - case Gender::UNSPECIFIED: - default: - return 0; - case Gender::MALE: - return 1; - case Gender::OTHER: - return 3; - } - } - - constexpr2 static GenderT intToGender(const uint8_t sex) - A_CONST A_WARN_UNUSED - { - switch (sex) - { - case 0: - default: - return Gender::FEMALE; - case 1: - return Gender::MALE; - case 3: - return Gender::OTHER; - } - } - - NextSoundInfo mNextSound; - - /** - * Sets the new path for this being. - */ - void setPath(const Path &restrict path) restrict2; - - int getSortPixelY() const restrict2 override A_WARN_UNUSED - { return CAST_S32(mPos.y) - mYDiff - mSortOffsetY; } - - void setMap(Map *restrict const map) restrict2 override; - - void recreateItemParticles() restrict2; - - void incUsage() restrict2 noexcept2 - { mUsageCounter ++; } - - int decUsage() restrict2 noexcept2 - { return --mUsageCounter; } - - virtual int getLastAttackX() const restrict2 - { return mLastAttackX; } - - virtual int getLastAttackY() const restrict2 - { return mLastAttackY; } - - void drawHomunculus(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawMercenary(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void drawElemental(Graphics *restrict const graphics, - const int offsetX, - const int offsetY) const - restrict2 A_NONNULL(2); - - void setTrickDead(const bool b) restrict2 override final; - - void setChat(ChatObject *restrict const obj) restrict2; - - ChatObject *getChat() const restrict2 noexcept2 - { return mChat; } - - void setRiding(const bool b) restrict2 override final; - - void setHorse(const int horseId) restrict2; - - void removeHorse() restrict2; - - void setSellBoard(const std::string &restrict text) restrict2; - - std::string getSellBoard() const restrict2 noexcept2 A_WARN_UNUSED - { return mSellBoard; } - - void setBuyBoard(const std::string &restrict text) restrict2; - - std::string getBuyBoard() const restrict2 noexcept2 A_WARN_UNUSED - { return mBuyBoard; } - - void setSpiritBalls(const unsigned int balls) restrict2; - - unsigned int getSpiritBalls() const restrict2 noexcept2 A_WARN_UNUSED - { return mSpiritBalls; } - - void stopCast(const bool b) override final; - - void setCreatorId(const BeingId id) - { mCreatorId = id; } - - BeingId getCreatorId() const noexcept2 A_WARN_UNUSED - { return mCreatorId; } - - void setKarma(const int karma) restrict2 noexcept2 - { mKarma = karma; } - - int getKarma() const restrict2 noexcept2 A_WARN_UNUSED - { return mKarma; } - - void setManner(const int manner) restrict2 noexcept2 - { mManner = manner; } - - int getManner() const restrict2 noexcept2 A_WARN_UNUSED - { return mManner; } - - void disableBotAi() restrict2 noexcept2 - { mBotAi = false; } - - void enableBotAi() restrict2 noexcept2 - { mBotAi = true; } - - int getAreaSize() const restrict2 noexcept2 A_WARN_UNUSED - { return mAreaSize; } - - void setAreaSize(const int areaSize) restrict2 noexcept2 - { mAreaSize = areaSize; } - - void setTeamId(const uint16_t teamId) restrict2; - - void showTeamBadge(const bool show) restrict2; - - void showGuildBadge(const bool show) restrict2; - - void showGmBadge(const bool show) restrict2; - - void showPartyBadge(const bool show) restrict2; - - void showNameBadge(const bool show) restrict2; - - void showShopBadge(const bool show) restrict2; - - void showInactiveBadge(const bool show) restrict2; - - void showAwayBadge(const bool show) restrict2; - - void showBadges(const bool show) restrict2; - - void setLanguageId(const int lang) restrict2 noexcept2; - - int getLanguageId() restrict2 noexcept2 A_WARN_UNUSED - { return mLanguageId; } - - uint16_t getTeamId() const restrict2 noexcept2 A_WARN_UNUSED - { return mTeamId; } - - virtual void setGroupId(const int id) - { mGroupId = id; } - - int getGroupId() const noexcept2 A_WARN_UNUSED - { return mGroupId; } - - void serverRemove() restrict2 noexcept2; - - void addCast(const int dstX, - const int dstY, - const int skillId, - const int skillLevel, - const int range, - const int waitTimeTicks); - - void fixDirectionOffsets(int &offsetX, - int &offsetY) const; - - static Being *createBeing(const BeingId id, - const ActorTypeT type, - const BeingTypeId subtype, - Map *const map); - - protected: - void drawPlayerSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawOtherSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawPortalSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawMonsterSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawHomunculusSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawMercenarySpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawElementalSpriteAt(Graphics *restrict const graphics, - const int x, - const int y) const restrict2 A_NONNULL(2); - - void drawCompound(Graphics *const graphics, - const int posX, - const int posY) const A_NONNULL(2); - - /** - * Updates name's location. - */ - virtual void updateCoords() restrict2; - - void showName() restrict2; - - void addItemParticles(const int id, - const SpriteDisplay &restrict display) restrict2; - - void addItemParticlesCards(const int id, - const SpriteDisplay &restrict display, - const CardsList &restrict cards) restrict2; - - void removeAllItemsParticles() restrict2; - - void removeItemParticles(const int id) restrict2; - - void createSpeechBubble() restrict2; - - void setDefaultNameColor(const UserColorIdT defaultColor) restrict2; - - void updateBadgesCount() restrict2; - - static int getDefaultEffectId(const AttackTypeT &restrict type); - - BeingInfo *restrict mInfo; - AnimatedSprite *restrict mEmotionSprite; - AnimatedSprite *restrict mAnimationEffect; - CastingEffect *restrict mCastingEffect; - AnimatedSprite *restrict mBadges[BadgeIndex::BadgeIndexSize]; - - std::string mSpriteAction; - std::string mName; /**< Name of being */ - std::string mExtName; /**< Full name of being */ - std::string mRaceName; - std::string mPartyName; - std::string mGuildName; - std::string mSpeech; - - /** - * Holds a text object when the being displays it's name, 0 otherwise - */ - FlashText *restrict mDispName; - const Color *restrict mNameColor; - - /** Engine-related infos about weapon. */ - const ItemInfo *restrict mEquippedWeapon; - - Path mPath; - Text *restrict mText; - const Color *restrict mTextColor; - - Vector mDest; /**< destination coordinates. */ - - typedef std::map SpriteParticleInfo; - typedef SpriteParticleInfo::iterator SpriteParticleInfoIter; - - STD_VECTOR mSlots; - SpriteParticleInfo mSpriteParticles; - - // Character guild information - std::map mGuilds; - Party *mParty; - - int mActionTime; /**< Time spent in current action */ - int mEmotionTime; /**< Time until emotion disappears */ - - /** Time until the last speech sentence disappears */ - int mSpeechTime; - int mAttackSpeed; /**< Attack speed */ - - int mLevel; - int mGroupId; - int mAttackRange; - int mLastAttackX; - int mLastAttackY; - - int mPreStandTime; - - GenderT mGender; - BeingActionT mAction; - BeingTypeId mSubType; /**< Subtype (graphical view, basically) */ - uint8_t mDirection; /**< Facing direction */ - uint8_t mDirectionDelayed; /**< Facing direction */ - SpriteDirection::Type mSpriteDirection; /**< Facing direction */ - bool mShowName; - bool mIsGM; - - protected: - void postInit(const BeingTypeId subType, - Map *const map); - - void updateBadgesPosition(); - - /** - * Calculates the offset in the given directions. - * If walking in direction 'neg' the value is negated. - */ - template - int getOffset() const restrict2 A_WARN_UNUSED; - - int searchSlotValue(const STD_VECTOR &restrict slotRemap, - const int val) const restrict2 A_WARN_UNUSED; - - static void searchSlotValueItr(STD_VECTOR::iterator &restrict it, - int &idx, - STD_VECTOR &restrict slotRemap, - const int val); - - void addSpiritBalls(const unsigned int balls, - const int effectId) restrict2; - - void removeSpiritBalls(const unsigned int balls) restrict2; - - void dumpSprites() const restrict2; - - void drawBeingCursor(Graphics *const graphics, - const int offsetX, - const int offsetY) const A_NONNULL(2); - - void drawCasting(Graphics *const graphics, - const int offsetX, - const int offsetY) const A_NONNULL(2); - - void updateBotFollow(int dstX, - int dstY, - const int divX, - const int divY); - - void moveBotTo(int dstX, - int dstY); - - void updateBotDirection(const int dstX, - const int dstY); - - void botFixOffset(int &restrict dstX, - int &restrict dstY) const; - - const ActorTypeT mType; - - /** Speech Bubble components */ - SpeechBubble *restrict mSpeechBubble; - - /** - * Walk speed for x and y movement values. - * In pixels per second. - * @see MILLISECONDS_IN_A_TICK - */ - int mWalkSpeed; - int mSpeed; - std::string mIp; - int *restrict mSpriteRemap A_NONNULLPOINTER; - int *restrict mSpriteHide A_NONNULLPOINTER; - int *restrict mSpriteDraw A_NONNULLPOINTER; - std::string mComment; - std::string mBuyBoard; - std::string mSellBoard; - Being *restrict mOwner; - Particle *restrict mSpecialParticle; - ChatObject *restrict mChat; - HorseInfo *restrict mHorseInfo; - STD_VECTOR mDownHorseSprites; - STD_VECTOR mUpHorseSprites; - STD_VECTOR mSpiritParticles; - - int mX; // position in tiles - int mY; // position in tiles - int mCachedX; - int mCachedY; - int mSortOffsetY; // caculated offset in pixels based on mPixelOffsetY - int mPixelOffsetY; // tile height offset in pixels - // calculated between tiles - int mFixedOffsetY; // fixed tile height offset in pixels for tile - uint8_t mOldHeight; - - int mDamageTaken; - int mHP; - int mMaxHP; - int mDistance; - ReachableT mReachable; - int mGoodStatus; - - static time_t mUpdateConfigTime; - static unsigned int mConfLineLim; - static int mSpeechType; - static bool mHighlightMapPortals; - static bool mHighlightMonsterAttackRange; - static bool mLowTraffic; - static bool mDrawHotKeys; - static bool mShowBattleEvents; - static bool mShowMobHP; - static bool mShowOwnHP; - static bool mShowGender; - static bool mShowLevel; - static bool mShowPlayersStatus; - static bool mEnableReorderSprites; - static bool mHideErased; - static Move mMoveNames; - static bool mUseDiagonal; - static BadgeDrawType::Type mShowBadges; - static int mAwayEffect; - static VisibleNamePos::Type mVisibleNamePos; - - time_t mMoveTime; - time_t mAttackTime; - time_t mTalkTime; - time_t mOtherTime; - time_t mTestTime; - int mAttackDelay; - int mMinHit; - int mMaxHit; - int mCriticalHit; - unsigned int mPvpRank; - unsigned int mNumber; - unsigned int mSpiritBalls; - int mUsageCounter; - int mKarma; - int mManner; - int mAreaSize; - int mCastEndTime; - int mLanguageId; - int mBadgesX; - int mBadgesY; - BeingId mCreatorId; - uint16_t mTeamId; - uint16_t mLook; - uint16_t mBadgesCount; - ItemColor mHairColor; - bool mErased; - bool mEnemy; - bool mGotComment; - bool mAdvanced; - bool mShop; - bool mAway; - bool mInactive; - bool mNeedPosUpdate; - bool mBotAi; -}; - -extern std::list beingInfoCache; - -#endif // BEING_BEING_H diff --git a/src/being/beingcacheentry.h b/src/being/beingcacheentry.h deleted file mode 100644 index 4cfc6f64b..000000000 --- a/src/being/beingcacheentry.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_BEINGCACHEENTRY_H -#define BEING_BEINGCACHEENTRY_H - -#include "enums/simpletypes/beingid.h" - -#include "localconsts.h" - -#include - -class BeingCacheEntry final -{ - public: - explicit BeingCacheEntry(const BeingId id) : - mName(), - mPartyName(), - mGuildName(), - mIp(), - mId(id), - mLevel(0), - mPvpRank(0), - mTime(0), - mFlags(0), - mTeamId(0U), - mIsAdvanced(false) - { - } - - A_DELETE_COPY(BeingCacheEntry) - - BeingId getId() const - { return mId; } - - /** - * Returns the name of the being. - */ - const std::string &getName() const - { return mName; } - - /** - * Sets the name for the being. - * - * @param name The name that should appear. - */ - void setName(const std::string &name) - { mName = name; } - - /** - * Following are set from the server (mainly for players) - */ - void setPartyName(const std::string &name) - { mPartyName = name; } - - void setGuildName(const std::string &name) - { mGuildName = name; } - - const std::string &getPartyName() const - { return mPartyName; } - - const std::string &getGuildName() const - { return mGuildName; } - - void setLevel(const int n) - { mLevel = n; } - - int getLevel() const - { return mLevel; } - - void setTime(const time_t n) - { mTime = n; } - - time_t getTime() const - { return mTime; } - - unsigned getPvpRank() const - { return mPvpRank; } - - void setPvpRank(const int r) - { mPvpRank = r; } - - std::string getIp() const - { return mIp; } - - void setIp(const std::string &ip) - { mIp = ip; } - - bool isAdvanced() const - { return mIsAdvanced; } - - void setAdvanced(const bool a) - { mIsAdvanced = a; } - - int getFlags() const - { return mFlags; } - - void setFlags(const int flags) - { mFlags = flags; } - - uint16_t getTeamId() const - { return mTeamId; } - - void setTeamId(const uint16_t teamId) - { mTeamId = teamId; } - - protected: - std::string mName; /**< Name of character */ - std::string mPartyName; - std::string mGuildName; - std::string mIp; - BeingId mId; /**< Unique sprite id */ - int mLevel; - unsigned int mPvpRank; - time_t mTime; - int mFlags; - uint16_t mTeamId; - bool mIsAdvanced; -}; - -#endif // BEING_BEINGCACHEENTRY_H diff --git a/src/being/beingflag.h b/src/being/beingflag.h deleted file mode 100644 index 0669f78bf..000000000 --- a/src/being/beingflag.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_BEINGFLAG_H -#define BEING_BEINGFLAG_H - -namespace BeingFlag -{ - enum - { - SHOP = 1, - AWAY = 2, - INACTIVE = 4, - GENDER_OTHER = 32, - GM = 64, - GENDER_MALE = 128, - SPECIAL = 128 + 64 - }; -} // namespace BeingFlag -#endif // BEING_BEINGFLAG_H diff --git a/src/being/beingspeech.h b/src/being/beingspeech.h deleted file mode 100644 index 869d1b665..000000000 --- a/src/being/beingspeech.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_BEINGSPEECH_H -#define BEING_BEINGSPEECH_H - -namespace BeingSpeech -{ - enum - { - NO_SPEECH = 0, - TEXT_OVERHEAD, - NO_NAME_IN_BUBBLE, - NAME_IN_BUBBLE - }; -} // namespace BeingSpeech - -#endif // BEING_BEINGSPEECH_H diff --git a/src/being/castingeffect.cpp b/src/being/castingeffect.cpp deleted file mode 100644 index 872743f82..000000000 --- a/src/being/castingeffect.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "being/castingeffect.h" - -#include "configuration.h" - -#include "const/resources/map/map.h" - -#include "gui/userpalette.h" - -#include "render/graphics.h" - -#include "resources/sprite/animatedsprite.h" - -#include "utils/checkutils.h" -#include "utils/delete2.h" - -#include "debug.h" - -CastingEffect::CastingEffect(const int skillId, - const int skillLevel, - const std::string &animation, - const int x, - const int y, - const int range) : - Actor(), - mSprite(animation.empty() ? nullptr : - AnimatedSprite::load(paths.getStringValue("sprites") + animation)), - mRectX((x - range) * mapTileSize), - mRectY((y - range) * mapTileSize), - mRectSize(range * mapTileSize * 2 + mapTileSize), - mAnimationX(mRectX + (mRectSize - (mSprite != nullptr ? - mSprite->getWidth() : 0)) / 2), - mAnimationY(mRectY + (mRectSize - (mSprite != nullptr ? - mSprite->getHeight() : 0)) / 2) -{ - mPixelX = x * mapTileSize; - mPixelY = y * mapTileSize; - mYDiff = range * mapTileSize + 31; - if (mSprite == nullptr) - { - reportAlways("Skill %d/%d casting animation '%s' load failed", - skillId, - skillLevel, - animation.c_str()); - } -} - -CastingEffect::~CastingEffect() -{ - delete2(mSprite); -} - -void CastingEffect::draw(Graphics *const graphics, - const int offsetX, - const int offsetY) const -{ - graphics->setColor(userPalette->getColorWithAlpha( - UserColorId::ATTACK_RANGE_BORDER)); - - graphics->drawRectangle(Rect( - mRectX + offsetX, - mRectY + offsetY, - mRectSize, - mRectSize)); - if (mSprite != nullptr) - { - mSprite->drawRescaled(graphics, - mRectX + offsetX, - mRectY + offsetY, - mRectSize, - mRectSize); - } -} - -void CastingEffect::update(const int time) -{ - if (mSprite != nullptr) - mSprite->update(time); -} - -bool CastingEffect::isTerminated() const -{ - if (mSprite != nullptr) - return mSprite->isTerminated(); - return false; -} diff --git a/src/being/castingeffect.h b/src/being/castingeffect.h deleted file mode 100644 index 3a1d1a6b7..000000000 --- a/src/being/castingeffect.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_CASTINGEFFECT_H -#define BEING_CASTINGEFFECT_H - -#include "being/actor.h" - -#include "enums/being/actortype.h" - -#include "localconsts.h" - -class AnimatedSprite; - -class CastingEffect final : public Actor -{ - public: - CastingEffect(const int skillId, - const int skillLevel, - const std::string &animation, - const int x, - const int y, - const int range); - - A_DELETE_COPY(CastingEffect) - - virtual ~CastingEffect(); - - virtual ActorTypeT getType() const noexcept2 A_WARN_UNUSED - { return ActorType::Unknown; } - - void draw(Graphics *const graphics, - const int offsetX, - const int offsetY) const override final A_NONNULL(2); - - int getSortPixelY() const restrict2 override A_WARN_UNUSED - { return mPixelY - mYDiff; } - - void update(const int time); - - bool isTerminated() const; - - float getAlpha() const override final A_WARN_UNUSED - { return 1.0f; } - - void setAlpha(const float alpha A_UNUSED) override final - { } - - protected: - AnimatedSprite *mSprite; - int mRectX; - int mRectY; - int mRectSize; - int mAnimationX; - int mAnimationY; -}; - -#endif // BEING_CASTINGEFFECT_H diff --git a/src/being/compounditem.h b/src/being/compounditem.h deleted file mode 100644 index 541623ceb..000000000 --- a/src/being/compounditem.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_COMPOUNDITEM_H -#define BEING_COMPOUNDITEM_H - -#include - -#include "localconsts.h" - -class Image; - -typedef std::list VectorPointers; - -class CompoundItem final -{ - public: - CompoundItem(); - - A_DELETE_COPY(CompoundItem) - - ~CompoundItem(); - - VectorPointers data; - Image *image; - Image *alphaImage; -}; - -#endif // BEING_COMPOUNDITEM_H diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp deleted file mode 100644 index a32b7db1b..000000000 --- a/src/being/compoundsprite.cpp +++ /dev/null @@ -1,566 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/compoundsprite.h" - -#include "configuration.h" - -#include "sdlshared.h" - -#include "being/compounditem.h" - -#include "render/surfacegraphics.h" - -#if defined(USE_OPENGL) || !defined(USE_SDL2) -#include "resources/imagehelper.h" -#endif // USE_OPENGL -#include "resources/image/image.h" - -#include "utils/delete2.h" -#include "utils/dtor.h" -#include "utils/foreach.h" -#include "utils/likely.h" -#include "utils/sdlcheckutils.h" - -#ifndef USE_SDL2 -#include "game.h" - -#include "const/resources/map/map.h" - -#include "resources/map/map.h" - -#include "utils/timer.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#ifndef SDL_BIG_ENDIAN -#include -#endif // SDL_BYTEORDER -PRAGMA48(GCC diagnostic pop) -#endif // USE_SDL2 - -#include "debug.h" - -#ifndef USE_SDL2 -static const int BUFFER_WIDTH = 100; -static const int BUFFER_HEIGHT = 100; -static const unsigned cache_max_size = 10; -static const unsigned cache_clean_part = 3; -#endif // USE_SDL2 - -bool CompoundSprite::mEnableDelay = true; - -CompoundSprite::CompoundSprite() : - Sprite(), - mSprites(), - imagesCache(), - mCacheItem(nullptr), - mImage(nullptr), - mAlphaImage(nullptr), - mOffsetX(0), - mOffsetY(0), - mStartTime(0), - mLastTime(0), -#ifndef USE_SDL2 - mNextRedrawTime(0), -#endif // USE_SDL2 - mNeedsRedraw(false), - mEnableAlphaFix(config.getBoolValue("enableAlphaFix")), - mDisableAdvBeingCaching(config.getBoolValue("disableAdvBeingCaching")), - mDisableBeingCaching(config.getBoolValue("disableBeingCaching")) -{ - mAlpha = 1.0F; -} - -CompoundSprite::~CompoundSprite() -{ - clear(); - mImage = nullptr; - mAlphaImage = nullptr; -} - -bool CompoundSprite::reset() -{ - bool ret = false; - FOR_EACH (SpriteIterator, it, mSprites) - { - if (*it != nullptr) - ret |= (*it)->reset(); - } - if (ret) - mLastTime = 0; - mNeedsRedraw |= ret; - return ret; -} - -bool CompoundSprite::play(const std::string &action) -{ - bool ret = false; - bool ret2 = true; - FOR_EACH (SpriteIterator, it, mSprites) - { - if (*it != nullptr) - { - const bool tmpVal = (*it)->play(action); - ret |= tmpVal; - ret2 &= tmpVal; - } - } - mNeedsRedraw |= ret; - if (ret2) - mLastTime = 0; - return ret; -} - -bool CompoundSprite::update(const int time) -{ - bool ret = false; - if (A_UNLIKELY(mLastTime == 0)) - mStartTime = time; - mLastTime = time; - FOR_EACH (SpriteIterator, it, mSprites) - { - if (*it != nullptr) - ret |= (*it)->update(time); - } - mNeedsRedraw |= ret; - return ret; -} - -void CompoundSprite::drawSimple(Graphics *const graphics, - const int posX, - const int posY) const -{ - FUNC_BLOCK("CompoundSprite::draw", 1) - if (mNeedsRedraw) - updateImages(); - - if (mSprites.empty()) // Nothing to draw - return; - - if (mAlpha == 1.0F && (mImage != nullptr)) - { - graphics->drawImage(mImage, posX + mOffsetX, posY + mOffsetY); - } - else if ((mAlpha != 0.0f) && (mAlphaImage != nullptr)) - { - mAlphaImage->setAlpha(mAlpha); - graphics->drawImage(mAlphaImage, - posX + mOffsetX, posY + mOffsetY); - } - else - { - CompoundSprite::drawSprites(graphics, posX, posY); - } -} - -void CompoundSprite::drawSprites(Graphics *const graphics, - const int posX, - const int posY) const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - { - (*it)->setAlpha(mAlpha); - (*it)->draw(graphics, posX, posY); - } - } -} - -void CompoundSprite::drawSpritesSDL(Graphics *const graphics, - const int posX, - const int posY) const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - (*it)->draw(graphics, posX, posY); - } -} - -int CompoundSprite::getWidth() const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - const Sprite *const base = *it; - if (base != nullptr) - return base->getWidth(); - } - - return 0; -} - -int CompoundSprite::getHeight() const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - const Sprite *const base = *it; - if (base != nullptr) - return base->getHeight(); - } - - return 0; -} - -const Image *CompoundSprite::getImage() const -{ - return mImage; -} - -bool CompoundSprite::setSpriteDirection(const SpriteDirection::Type direction) -{ - bool ret = false; - FOR_EACH (SpriteIterator, it, mSprites) - { - if (*it != nullptr) - ret |= (*it)->setSpriteDirection(direction); - } - if (ret) - mLastTime = 0; - mNeedsRedraw |= ret; - return ret; -} - -int CompoundSprite::getNumberOfLayers() const -{ - if ((mImage != nullptr) || (mAlphaImage != nullptr)) - return 1; - return CAST_S32(mSprites.size()); -} - -unsigned int CompoundSprite::getCurrentFrame() const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - return (*it)->getCurrentFrame(); - } - return 0; -} - -unsigned int CompoundSprite::getFrameCount() const -{ - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - return (*it)->getFrameCount(); - } - return 0; -} - -void CompoundSprite::addSprite(Sprite *const sprite) -{ - mSprites.push_back(sprite); - mNeedsRedraw = true; -} - -void CompoundSprite::setSprite(const size_t layer, Sprite *const sprite) -{ - // Skip if it won't change anything - if (mSprites[layer] == sprite) - return; - - delete mSprites[layer]; - mSprites[layer] = sprite; - mNeedsRedraw = true; -} - -void CompoundSprite::removeSprite(const int layer) -{ - // Skip if it won't change anything - if (mSprites[layer] == nullptr) - return; - - delete2(mSprites[layer]); - mNeedsRedraw = true; -} - -void CompoundSprite::clear() -{ - // Skip if it won't change anything - if (!mSprites.empty()) - { - delete_all(mSprites); - mSprites.clear(); - } - mNeedsRedraw = true; - delete_all(imagesCache); - imagesCache.clear(); - delete2(mCacheItem); - mLastTime = 0; -} - -void CompoundSprite::ensureSize(const size_t layerCount) -{ - // Skip if it won't change anything - if (mSprites.size() >= layerCount) - return; - -// resize(layerCount, nullptr); - mSprites.resize(layerCount); -} - -void CompoundSprite::redraw() const -{ -#ifndef USE_SDL2 - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0xff000000; - const int gmask = 0x00ff0000; - const int bmask = 0x0000ff00; - const int amask = 0x000000ff; -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0x000000ff; - const int gmask = 0x0000ff00; - const int bmask = 0x00ff0000; - const int amask = 0xff000000; -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - SDL_Surface *const surface = MSDL_CreateRGBSurface(SDL_HWSURFACE, - BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask); - - if (surface == nullptr) - return; - - SurfaceGraphics *graphics = new SurfaceGraphics; - graphics->setBlitMode(BlitMode::BLIT_GFX); - graphics->setTarget(surface); - graphics->beginDraw(); - - int tileX = mapTileSize / 2; - int tileY = mapTileSize; - - const Game *const game = Game::instance(); - if (game != nullptr) - { - const Map *const map = game->getCurrentMap(); - if (map != nullptr) - { - tileX = map->getTileWidth() / 2; - tileY = map->getTileWidth(); - } - } - - const int posX = BUFFER_WIDTH / 2 - tileX; - const int posY = BUFFER_HEIGHT - tileY; - - mOffsetX = tileX - BUFFER_WIDTH / 2; - mOffsetY = tileY - BUFFER_HEIGHT; - - drawSpritesSDL(graphics, posX, posY); - - delete2(graphics); - - SDL_SetAlpha(surface, 0, SDL_ALPHA_OPAQUE); - - delete mAlphaImage; - - if (ImageHelper::mEnableAlpha) - { - SDL_Surface *const surfaceA = MSDL_CreateRGBSurface(SDL_HWSURFACE, - BUFFER_WIDTH, BUFFER_HEIGHT, 32, rmask, gmask, bmask, amask); - SDL_BlitSurface(surface, nullptr, surfaceA, nullptr); - mAlphaImage = imageHelper->loadSurface(surfaceA); - MSDL_FreeSurface(surfaceA); - } - else - { - mAlphaImage = nullptr; - } - - delete mImage; - mImage = imageHelper->loadSurface(surface); - MSDL_FreeSurface(surface); -#endif // USE_SDL2 -} - -void CompoundSprite::setAlpha(float alpha) -{ - if (alpha != mAlpha) - { - if (mEnableAlphaFix && -#ifdef USE_OPENGL - imageHelper->useOpenGL() == RENDER_SOFTWARE && -#endif // USE_OPENGL - mSprites.size() > 3U) - { - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - (*it)->setAlpha(alpha); - } - } - mAlpha = alpha; - } -} - -void CompoundSprite::updateImages() const -{ -#ifndef USE_SDL2 -#ifdef USE_OPENGL - if (imageHelper->useOpenGL() != RENDER_SOFTWARE) - return; -#endif // USE_OPENGL - - if (mEnableDelay) - { - if (get_elapsed_time1(mNextRedrawTime) < 10) - return; - mNextRedrawTime = tick_time; - } - mNeedsRedraw = false; - - if (!mDisableBeingCaching) - { - if (mSprites.size() <= 3U) - return; - - if (!mDisableAdvBeingCaching) - { - if (updateFromCache()) - return; - - redraw(); - - if (mImage != nullptr) - initCurrentCacheItem(); - } - else - { - redraw(); - } - } -#endif // USE_SDL2 -} - -bool CompoundSprite::updateFromCache() const -{ -#ifndef USE_SDL2 -// static int hits = 0; -// static int miss = 0; - - if ((mCacheItem != nullptr) && (mCacheItem->image != nullptr)) - { - imagesCache.push_front(mCacheItem); - mCacheItem = nullptr; - if (imagesCache.size() > cache_max_size) - { - for (unsigned f = 0; f < cache_clean_part; f ++) - { - CompoundItem *item = imagesCache.back(); - imagesCache.pop_back(); - delete item; - } - } - } - -// logger->log("cache size: %d, hit %d, miss %d", -// (int)imagesCache.size(), hits, miss); - - const size_t sz = mSprites.size(); - FOR_EACH (ImagesCache::iterator, it, imagesCache) - { - CompoundItem *const ic = *it; - if ((ic != nullptr) && ic->data.size() == sz) - { - bool fail(false); - VectorPointers::const_iterator it2 = ic->data.begin(); - const VectorPointers::const_iterator it2_end = ic->data.end(); - - for (SpriteConstIterator it1 = mSprites.begin(), - it1_end = mSprites.end(); - it1 != it1_end && it2 != it2_end; - ++ it1, ++ it2) - { - const void *ptr1 = nullptr; - const void *ptr2 = nullptr; - if (*it1 != nullptr) - ptr1 = (*it1)->getHash(); - if (*it2 != nullptr) - ptr2 = *it2; - if (ptr1 != ptr2) - { - fail = true; - break; - } - } - if (!fail) - { -// hits ++; - mImage = (*it)->image; - mAlphaImage = (*it)->alphaImage; - imagesCache.erase(it); - mCacheItem = ic; - return true; - } - } - } - mImage = nullptr; - mAlphaImage = nullptr; -// miss++; -#endif // USE_SDL2 - return false; -} - -void CompoundSprite::initCurrentCacheItem() const -{ - delete mCacheItem; - mCacheItem = new CompoundItem; - mCacheItem->image = mImage; - mCacheItem->alphaImage = mAlphaImage; -// mCacheItem->alpha = mAlpha; - - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - mCacheItem->data.push_back((*it)->getHash()); - else - mCacheItem->data.push_back(nullptr); - } -} - -bool CompoundSprite::updateNumber(const unsigned num) -{ - bool res(false); - FOR_EACH (SpriteConstIterator, it, mSprites) - { - if (*it != nullptr) - { - if ((*it)->updateNumber(num)) - res = true; - } - } - return res; -} - -CompoundItem::CompoundItem() : - data(), - image(nullptr), - alphaImage(nullptr) -{ -} - -CompoundItem::~CompoundItem() -{ - delete image; - delete alphaImage; -} diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h deleted file mode 100644 index bf6679963..000000000 --- a/src/being/compoundsprite.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_COMPOUNDSPRITE_H -#define BEING_COMPOUNDSPRITE_H - -#include "resources/sprite/sprite.h" - -#include "utils/vector.h" - -#include - -#include "localconsts.h" - -class CompoundItem; -class Image; - -class CompoundSprite notfinal : public Sprite -{ - public: - typedef STD_VECTOR::iterator SpriteIterator; - typedef STD_VECTOR::const_iterator SpriteConstIterator; - - CompoundSprite(); - - A_DELETE_COPY(CompoundSprite) - - virtual ~CompoundSprite(); - - bool reset() override final; - - bool play(const std::string &action) override final; - - bool update(const int time) override final; - - void drawSimple(Graphics *const graphics, - const int posX, - const int posY) const A_NONNULL(2); - - /** - * Gets the width in pixels of the first sprite in the list. - */ - int getWidth() const override A_WARN_UNUSED; - - /** - * Gets the height in pixels of the first sprite in the list. - */ - int getHeight() const override A_WARN_UNUSED; - - const Image *getImage() const override final A_WARN_UNUSED; - - bool setSpriteDirection(const SpriteDirection::Type direction) - override final; - - int getNumberOfLayers() const A_WARN_UNUSED; - - unsigned int getCurrentFrame() const override final A_WARN_UNUSED; - - unsigned int getFrameCount() const override final A_WARN_UNUSED; - - void addSprite(Sprite *const sprite); - - void setSprite(const size_t layer, Sprite *const sprite); - - void removeSprite(const int layer); - - void clear(); - - void ensureSize(const size_t layerCount); - - void drawSprites(Graphics *const graphics, - const int posX, - const int posY) const; - - virtual void drawSpritesSDL(Graphics *const graphics, - const int posX, - const int posY) const; - - void setAlpha(float alpha) override; - - bool updateNumber(const unsigned num) override final; - - constexpr2 static void setEnableDelay(bool b) noexcept2 - { mEnableDelay = b; } - - int getLastTime() const noexcept2 A_WARN_UNUSED - { return mLastTime; } - - int getStartTime() const noexcept2 A_WARN_UNUSED - { return mStartTime; } - - STD_VECTOR mSprites; - - protected: - void redraw() const; - - void updateImages() const; - - bool updateFromCache() const; - - void initCurrentCacheItem() const; - - typedef std::list ImagesCache; - mutable ImagesCache imagesCache; - mutable CompoundItem *mCacheItem; - - mutable Image *mImage; - mutable Image *mAlphaImage; - - mutable int mOffsetX; - mutable int mOffsetY; - int mStartTime; - int mLastTime; -#ifndef USE_SDL2 - mutable int mNextRedrawTime; -#endif // USE_SDL2 - - static bool mEnableDelay; - mutable bool mNeedsRedraw; - bool mEnableAlphaFix; - bool mDisableAdvBeingCaching; - bool mDisableBeingCaching; -}; - -#endif // BEING_COMPOUNDSPRITE_H diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp deleted file mode 100644 index 5fb093d9d..000000000 --- a/src/being/crazymoves.cpp +++ /dev/null @@ -1,824 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "being/crazymoves.h" - -#include "configuration.h" -#include "settings.h" - -#include "being/localplayer.h" - -#include "enums/being/beingdirection.h" - -#include "gui/shortcut/dropshortcut.h" - -#include "gui/windows/outfitwindow.h" - -#include "net/packetlimiter.h" -#include "net/pethandler.h" -#include "net/playerhandler.h" - -#include "resources/db/emotedb.h" - -#include "resources/map/map.h" - -#include "utils/timer.h" - -#include "debug.h" - -CrazyMoves *crazyMoves = nullptr; - -CrazyMoves::CrazyMoves() : - mMoveProgram(), - mDisableCrazyMove(false) -{ -} - -void CrazyMoves::crazyMove() -{ - const bool oldDisableCrazyMove = mDisableCrazyMove; - mDisableCrazyMove = true; - switch (settings.crazyMoveType) - { - case 1: - crazyMove1(); - break; - case 2: - crazyMove2(); - break; - case 3: - crazyMove3(); - break; - case 4: - crazyMove4(); - break; - case 5: - crazyMove5(); - break; - case 6: - crazyMove6(); - break; - case 7: - crazyMove7(); - break; - case 8: - crazyMove8(); - break; - case 9: - crazyMove9(); - break; - case 10: - crazyMoveA(); - break; - default: - break; - } - mDisableCrazyMove = oldDisableCrazyMove; -} - -void CrazyMoves::crazyMove1() -{ - if ((localPlayer == nullptr) || - (playerHandler == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - -// if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) -// return; - - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - localPlayer->setWalkingDir(BeingDirection::UP); - localPlayer->setDirection(BeingDirection::LEFT); - playerHandler->setDirection(BeingDirection::LEFT); - break; - case BeingDirection::LEFT: - localPlayer->setWalkingDir(BeingDirection::LEFT); - localPlayer->setDirection(BeingDirection::DOWN); - playerHandler->setDirection(BeingDirection::DOWN); - break; - case BeingDirection::DOWN: - localPlayer->setWalkingDir(BeingDirection::DOWN); - localPlayer->setDirection(BeingDirection::RIGHT); - playerHandler->setDirection(BeingDirection::RIGHT); - break; - case BeingDirection::RIGHT: - localPlayer->setWalkingDir(BeingDirection::RIGHT); - localPlayer->setDirection(BeingDirection::UP); - playerHandler->setDirection(BeingDirection::UP); - break; - default: - break; - } -} - -void CrazyMoves::crazyMove2() -{ - if ((localPlayer == nullptr) || - (playerHandler == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - -// if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) -// return; - - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - localPlayer->setWalkingDir(BeingDirection::UP | - BeingDirection::LEFT); - localPlayer->setDirection(BeingDirection::RIGHT); - playerHandler->setDirection( - BeingDirection::DOWN | BeingDirection::RIGHT); - break; - - case BeingDirection::RIGHT: - localPlayer->setWalkingDir(BeingDirection::UP | - BeingDirection::RIGHT); - localPlayer->setDirection(BeingDirection::DOWN); - playerHandler->setDirection( - BeingDirection::DOWN | BeingDirection::LEFT); - break; - - case BeingDirection::DOWN: - localPlayer->setWalkingDir(BeingDirection::DOWN | - BeingDirection::RIGHT); - localPlayer->setDirection(BeingDirection::LEFT); - playerHandler->setDirection( - BeingDirection::UP | BeingDirection::LEFT); - break; - - case BeingDirection::LEFT: - localPlayer->setWalkingDir(BeingDirection::DOWN | - BeingDirection::LEFT); - localPlayer->setDirection(BeingDirection::UP); - playerHandler->setDirection( - BeingDirection::UP | BeingDirection::RIGHT); - break; - - default: - break; - } -} - -void CrazyMoves::crazyMove3() -{ - if ((localPlayer == nullptr) || - (playerHandler == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - localPlayer->move(1, 1); - settings.crazyMoveState = 1; - break; - case 1: - localPlayer->move(1, -1); - settings.crazyMoveState = 2; - break; - case 2: - localPlayer->move(-1, -1); - settings.crazyMoveState = 3; - break; - case 3: - localPlayer->move(-1, 1); - settings.crazyMoveState = 0; - break; - default: - break; - } - -// if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) -// return; - - localPlayer->setDirection(BeingDirection::DOWN); - playerHandler->setDirection(BeingDirection::DOWN); -} - -void CrazyMoves::crazyMove4() -{ - if ((localPlayer == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - localPlayer->move(7, 0); - settings.crazyMoveState = 1; - break; - case 1: - localPlayer->move(-7, 0); - settings.crazyMoveState = 0; - break; - default: - break; - } -} - -void CrazyMoves::crazyMove5() -{ - if ((localPlayer == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - localPlayer->move(0, 7); - settings.crazyMoveState = 1; - break; - case 1: - localPlayer->move(0, -7); - settings.crazyMoveState = 0; - break; - default: - break; - } -} - -void CrazyMoves::crazyMove6() -{ - if ((localPlayer == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - localPlayer->move(3, 0); - settings.crazyMoveState = 1; - break; - case 1: - localPlayer->move(2, -2); - settings.crazyMoveState = 2; - break; - case 2: - localPlayer->move(0, -3); - settings.crazyMoveState = 3; - break; - case 3: - localPlayer->move(-2, -2); - settings.crazyMoveState = 4; - break; - case 4: - localPlayer->move(-3, 0); - settings.crazyMoveState = 5; - break; - case 5: - localPlayer->move(-2, 2); - settings.crazyMoveState = 6; - break; - case 6: - localPlayer->move(0, 3); - settings.crazyMoveState = 7; - break; - case 7: - localPlayer->move(2, 2); - settings.crazyMoveState = 0; - break; - default: - break; - } -} - -void CrazyMoves::crazyMove7() -{ - if ((localPlayer == nullptr) || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - localPlayer->move(1, 1); - settings.crazyMoveState = 1; - break; - case 1: - localPlayer->move(-1, 1); - settings.crazyMoveState = 2; - break; - case 2: - localPlayer->move(-1, -1); - settings.crazyMoveState = 3; - break; - case 3: - localPlayer->move(1, -1); - settings.crazyMoveState = 0; - break; - default: - break; - } -} - -void CrazyMoves::crazyMove8() -{ - if (localPlayer == nullptr || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - const Map *const map = localPlayer->getMap(); - if (map == nullptr) - return; - const int x = localPlayer->getTileX(); - const int y = localPlayer->getTileY(); - int idx = 0; - const int dist = 1; - -// look -// up, ri,do,le - static const int movesX[][4] = - { - {-1, 0, 1, 0}, // move left - { 0, 1, 0, -1}, // move up - { 1, 0, -1, 0}, // move right - { 0, -1, 0, 1} // move down - }; - -// look -// up, ri,do,le - static const int movesY[][4] = - { - { 0, -1, 0, 1}, // move left - {-1, 0, 1, 0}, // move up - { 0, 1, 0, -1}, // move right - { 1, 0, -1, 0} // move down - }; - - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - idx = 0; - break; - - case BeingDirection::RIGHT: - idx = 1; - break; - - case BeingDirection::DOWN: - idx = 2; - break; - - case BeingDirection::LEFT: - idx = 3; - break; - - default: - break; - } - - int mult = 1; - const unsigned char blockWalkMask = localPlayer->getBlockWalkMask(); - if (map->getWalk(x + movesX[idx][0], - y + movesY[idx][0], blockWalkMask)) - { - while (map->getWalk(x + movesX[idx][0] * mult, - y + movesY[idx][0] * mult, - blockWalkMask) && mult <= dist) - { - mult ++; - } - localPlayer->move(movesX[idx][0] * (mult - 1), - movesY[idx][0] * (mult - 1)); - } - else if (map->getWalk(x + movesX[idx][1], - y + movesY[idx][1], blockWalkMask)) - { - while (map->getWalk(x + movesX[idx][1] * mult, - y + movesY[idx][1] * mult, - blockWalkMask) && mult <= dist) - { - mult ++; - } - localPlayer->move(movesX[idx][1] * (mult - 1), - movesY[idx][1] * (mult - 1)); - } - else if (map->getWalk(x + movesX[idx][2], - y + movesY[idx][2], blockWalkMask)) - { - while (map->getWalk(x + movesX[idx][2] * mult, - y + movesY[idx][2] * mult, - blockWalkMask) && mult <= dist) - { - mult ++; - } - localPlayer->move(movesX[idx][2] * (mult - 1), - movesY[idx][2] * (mult - 1)); - } - else if (map->getWalk(x + movesX[idx][3], - y + movesY[idx][3], blockWalkMask)) - { - while (map->getWalk(x + movesX[idx][3] * mult, - y + movesY[idx][3] * mult, - blockWalkMask) && mult <= dist) - { - mult ++; - } - localPlayer->move(movesX[idx][3] * (mult - 1), - movesY[idx][3] * (mult - 1)); - } -} - -void CrazyMoves::crazyMove9() -{ - int dx = 0; - int dy = 0; - - if (localPlayer == nullptr || - localPlayer->getCurrentAction() == BeingAction::MOVE) - { - return; - } - - switch (settings.crazyMoveState) - { - case 0: - switch (localPlayer->getDirection()) - { - case BeingDirection::UP : dy = -1; break; - case BeingDirection::DOWN : dy = 1; break; - case BeingDirection::LEFT : dx = -1; break; - case BeingDirection::RIGHT: dx = 1; break; - default: break; - } - localPlayer->move(dx, dy); - settings.crazyMoveState = 1; - break; - case 1: - settings.crazyMoveState = 2; - if (!localPlayer->allowAction()) - return; - if (playerHandler != nullptr) - playerHandler->changeAction(BeingAction::SIT); - break; - case 2: - settings.crazyMoveState = 3; - break; - case 3: - settings.crazyMoveState = 0; - break; - default: - break; - } -} - -void CrazyMoves::crazyMoveAm() const -{ - if (localPlayer == nullptr) - return; - - settings.crazyMoveState ++; - if (settings.crazyMoveState < mMoveProgram.length()) - { - int dx = 0; - int dy = 0; - - signed char param = mMoveProgram[settings.crazyMoveState++]; - if (param == '?') - { - const char cmd[] = {'l', 'r', 'u', 'd', 'L', 'R', 'U', 'D'}; - srand(tick_time); - param = cmd[rand() % 8]; - } - switch (param) - { - case 'd': - localPlayer->move(0, 1); - break; - case 'u': - localPlayer->move(0, -1); - break; - case 'l': - localPlayer->move(-1, 0); - break; - case 'r': - localPlayer->move(1, 0); - break; - case 'D': - localPlayer->move(1, 1); - break; - case 'U': - localPlayer->move(-1, -1); - break; - case 'L': - localPlayer->move(-1, 1); - break; - case 'R': - localPlayer->move(1, -1); - break; - case 'f': - { - const uint8_t dir = localPlayer->getDirection(); - if ((dir & BeingDirection::UP) != 0) - dy = -1; - else if ((dir & BeingDirection::DOWN) != 0) - dy = 1; - if ((dir & BeingDirection::LEFT) != 0) - dx = -1; - else if ((dir & BeingDirection::RIGHT) != 0) - dx = 1; - localPlayer->move(dx, dy); - break; - } - case 'b': - { - const uint8_t dir = localPlayer->getDirection(); - if ((dir & BeingDirection::UP) != 0) - dy = 1; - else if ((dir & BeingDirection::DOWN) != 0) - dy = -1; - if ((dir & BeingDirection::LEFT) != 0) - dx = 1; - else if ((dir & BeingDirection::RIGHT) != 0) - dx = -1; - localPlayer->move(dx, dy); - break; - } - default: - break; - } - } -} - -void CrazyMoves::crazyMoveAd() const -{ - settings.crazyMoveState ++; - - if (settings.crazyMoveState < mMoveProgram.length()) - { - signed char param = mMoveProgram[settings.crazyMoveState++]; - if (param == '?') - { - const char cmd[] = {'l', 'r', 'u', 'd'}; - srand(tick_time); - param = cmd[rand() % 4]; - } - switch (param) - { - case 'd': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - localPlayer->setDirection(BeingDirection::DOWN); - playerHandler->setDirection( - BeingDirection::DOWN); - } - break; - case 'u': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - localPlayer->setDirection(BeingDirection::UP); - playerHandler->setDirection( - BeingDirection::UP); - } - break; - case 'l': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - localPlayer->setDirection(BeingDirection::LEFT); - playerHandler->setDirection( - BeingDirection::LEFT); - } - break; - case 'r': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - localPlayer->setDirection(BeingDirection::RIGHT); - playerHandler->setDirection( - BeingDirection::RIGHT); - } - break; - case 'L': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - uint8_t dir = 0; - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - dir = BeingDirection::LEFT; - break; - case BeingDirection::DOWN: - dir = BeingDirection::RIGHT; - break; - case BeingDirection::LEFT: - dir = BeingDirection::DOWN; - break; - case BeingDirection::RIGHT: - dir = BeingDirection::UP; - break; - default: - break; - } - localPlayer->setDirection(dir); - playerHandler->setDirection(dir); - } - break; - case 'R': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - uint8_t dir = 0; - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - dir = BeingDirection::RIGHT; - break; - case BeingDirection::DOWN: - dir = BeingDirection::LEFT; - break; - case BeingDirection::LEFT: - dir = BeingDirection::UP; - break; - case BeingDirection::RIGHT: - dir = BeingDirection::DOWN; - break; - default: - break; - } - localPlayer->setDirection(dir); - playerHandler->setDirection(dir); - } - break; - case 'b': -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - uint8_t dir = 0; - switch (localPlayer->getDirection()) - { - case BeingDirection::UP: - dir = BeingDirection::DOWN; - break; - case BeingDirection::DOWN: - dir = BeingDirection::UP; - break; - case BeingDirection::LEFT: - dir = BeingDirection::RIGHT; - break; - case BeingDirection::RIGHT: - dir = BeingDirection::LEFT; - break; - default: - break; - } - localPlayer->setDirection(dir); - playerHandler->setDirection(dir); - } - break; - case '0': - dropShortcut->dropFirst(); - break; - case 'a': - dropShortcut->dropItems(); - break; - default: - break; - } - } -} - -void CrazyMoves::crazyMoveAs() -{ - settings.crazyMoveState ++; - if (localPlayer->toggleSit()) - settings.crazyMoveState ++; -} - -void CrazyMoves::crazyMoveAo() const -{ - settings.crazyMoveState ++; - if (settings.crazyMoveState < mMoveProgram.length()) - { - // wear next outfit - if (mMoveProgram[settings.crazyMoveState] == 'n') - { - settings.crazyMoveState ++; - outfitWindow->wearNextOutfit(); - } - // wear previous outfit - else if (mMoveProgram[settings.crazyMoveState] == 'p') - { - settings.crazyMoveState ++; - outfitWindow->wearPreviousOutfit(); - } - } -} - -void CrazyMoves::crazyMoveAe() const -{ - settings.crazyMoveState ++; - const signed char emo = mMoveProgram[settings.crazyMoveState]; - unsigned char emoteId = 0; - if (emo == '?') - { - srand(tick_time); - emoteId = CAST_U8( - 1 + (rand() % EmoteDB::size())); - } - else - { - if (emo >= '0' && emo <= '9') - emoteId = CAST_U8(emo - '0' + 1); - else if (emo >= 'a' && emo <= 'z') - emoteId = CAST_U8(emo - 'a' + 11); - else if (emo >= 'A' && emo <= 'Z') - emoteId = CAST_U8(emo - 'A' + 37); - } - if (mMoveProgram[settings.crazyMoveState - 1] == 'e') - LocalPlayer::emote(emoteId); - else if (PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - petHandler->emote(emoteId); - - settings.crazyMoveState ++; -} - -void CrazyMoves::crazyMoveA() -{ - mMoveProgram = config.getStringValue("crazyMoveProgram"); - - if (localPlayer->getCurrentAction() == BeingAction::MOVE) - return; - - if (mMoveProgram.empty()) - return; - - if (settings.crazyMoveState >= mMoveProgram.length()) - settings.crazyMoveState = 0; - - // move command - if (mMoveProgram[settings.crazyMoveState] == 'm') - { - crazyMoveAm(); - } - // direction command - else if (mMoveProgram[settings.crazyMoveState] == 'd') - { - crazyMoveAd(); - } - // sit command - else if (mMoveProgram[settings.crazyMoveState] == 's') - { - crazyMoveAs(); - } - // wear outfits - else if (mMoveProgram[settings.crazyMoveState] == 'o') - { - crazyMoveAo(); - } - // pause - else if (mMoveProgram[settings.crazyMoveState] == 'w') - { - settings.crazyMoveState ++; - } - // pick up - else if (mMoveProgram[settings.crazyMoveState] == 'p') - { - settings.crazyMoveState ++; - localPlayer->pickUpItems(); - } - // emote - else if (mMoveProgram[settings.crazyMoveState] == 'e' - || mMoveProgram[settings.crazyMoveState] == 'E') - { - crazyMoveAe(); - } - else - { - settings.crazyMoveState ++; - } - - if (settings.crazyMoveState >= mMoveProgram.length()) - settings.crazyMoveState = 0; -} diff --git a/src/being/crazymoves.h b/src/being/crazymoves.h deleted file mode 100644 index 4c812c5f0..000000000 --- a/src/being/crazymoves.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_CRAZYMOVES_H -#define BEING_CRAZYMOVES_H - -#include - -#include "localconsts.h" - -class CrazyMoves final -{ - public: - CrazyMoves(); - A_DELETE_COPY(CrazyMoves) - void crazyMove(); - - protected: - static void crazyMove1(); - static void crazyMove2(); - static void crazyMove3(); - static void crazyMove4(); - static void crazyMove5(); - static void crazyMove6(); - static void crazyMove7(); - static void crazyMove8(); - static void crazyMove9(); - void crazyMoveA(); - void crazyMoveAd() const; - void crazyMoveAe() const; - void crazyMoveAm() const; - void crazyMoveAo() const; - static void crazyMoveAs(); - - std::string mMoveProgram; - - // temporary disable crazy moves in moves - bool mDisableCrazyMove; -}; - -extern CrazyMoves *crazyMoves; - -#endif // BEING_CRAZYMOVES_H diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp deleted file mode 100644 index 041531e86..000000000 --- a/src/being/flooritem.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/flooritem.h" - -#include "configuration.h" - -#include "render/graphics.h" - -#include "gui/gui.h" -#include "gui/userpalette.h" - -#include "gui/fonts/font.h" - -#include "resources/iteminfo.h" - -#include "resources/db/itemdb.h" - -#include "resources/map/map.h" - -#ifdef TMWA_SUPPORT -#include "net/net.h" -#endif // TMWA_SUPPORT -#include "net/serverfeatures.h" - -#include "debug.h" - -extern volatile time_t cur_time; - -FloorItem::FloorItem(const BeingId id, - const int itemId, - const int x, const int y, - const ItemTypeT itemType, - const int amount, - const int refine, - const ItemColor color, - const Identified identified, - const Damaged damaged, - const int *const cards) : - ActorSprite(id), - mCards(), - mItemId(itemId), - mX(x), - mY(y), - mDropTime(cur_time), - mAmount(amount), - mRefine(refine), - mHeightPosDiff(0), - mItemType(itemType), - mPickupCount(0), - mCursor(Cursor::CURSOR_PICKUP), - mColor(color), - mIdentified(identified), - mDamaged(damaged), - mShowMsg(true), - mHighlight(config.getBoolValue("floorItemsHighlight")) -{ - setCards(cards, maxCards); -} - -void FloorItem::postInit(Map *const map, int subX, int subY) -{ - setMap(map); - const ItemInfo &info = ItemDB::get(mItemId); - if (map != nullptr) - { - const int maxX = info.getMaxFloorOffsetX(); - const int maxY = info.getMaxFloorOffsetY(); - - if (!serverFeatures->haveExtendedDropsPosition()) - { - if (subX > maxX) - subX = maxX; - else if (subX < -maxX) - subX = -maxX; - if (subY > maxY) - subY = maxY; - else if (subY < -maxY) - subY = -maxY; - - subX -= 8; - subY -= 8; - } - - mHeightPosDiff = map->getHeightOffset(mX, mY) * 16; - mPixelX = mX * map->getTileWidth() - + subX + mapTileSize / 2; - mPixelY = mY * map->getTileHeight() - + subY + mapTileSize - mHeightPosDiff; - mPos.x = static_cast(mPixelX); - mPos.y = static_cast(mPixelY); - mYDiff = 31 - mHeightPosDiff; - } - else - { - mPixelX = 0; - mPixelY = 0; - mPos.x = 0; - mPos.y = 0; - mYDiff = 31; - } - - mCursor = info.getPickupCursor(); - setupSpriteDisplay(info.getDisplay(), - ForceDisplay_true, - DisplayType::Floor, - info.getDyeIconColorsString(mColor)); -} - -void FloorItem::setCards(const int *const cards, - int sz) -{ - if (sz < 0 || cards == nullptr) - return; - if (sz > maxCards) - sz = maxCards; - for (int f = 0; f < sz; f ++) - mCards[f] = cards[f]; -} - -const ItemInfo &FloorItem::getInfo() const -{ - return ItemDB::get(mItemId); -} - -std::string FloorItem::getName() const -{ - const ItemInfo &info = ItemDB::get(mItemId); -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - return info.getName(); - } -#endif // TMWA_SUPPORT - - return info.getName(mColor); -} - -void FloorItem::draw(Graphics *const graphics, - const int offsetX, const int offsetY) const -{ - if (mMap == nullptr) - return; - - BLOCK_START("FloorItem::draw") - const int x = mX * mMap->getTileWidth() + offsetX; - const int y = mY * mMap->getTileHeight() + offsetY - mHeightPosDiff; - Font *font = nullptr; - - if (mHighlight) - { - const time_t curTime = cur_time; - font = gui->getFont(); - if (mDropTime < curTime) - { - const int dx = mapTileSize; - const int dy = mapTileSize; - - if (curTime > mDropTime + 28 && curTime < mDropTime + 50) - { - graphics->setColor(Color(80, 200, 20, 200)); - graphics->fillRectangle(Rect( - x, y, dx, dy)); - } - else if (curTime > mDropTime + 19 - && curTime < mDropTime + 28) - { - graphics->setColor(Color(200, 80, 20, - 80 + 10 * CAST_S32(curTime - mDropTime - 18))); - graphics->fillRectangle(Rect( - x, y, dx, dy)); - } - else if (curTime > mDropTime && curTime < mDropTime + 20) - { - graphics->setColor(Color(20, 20, 255, - 7 * CAST_S32(curTime - mDropTime))); - graphics->fillRectangle(Rect(x, y, dx, dy)); - } - } - } - - const int px = getActorX() + offsetX; - const int py = getActorY() + offsetY; - CompoundSprite::drawSimple(graphics, px, py); - - if (mHighlight) - { - if (font != nullptr && mAmount > 1) - { - const Color &color = userPalette->getColor( - UserColorId::FLOOR_ITEM_TEXT); - font->drawString(graphics, - color, color, - toString(mAmount), - x, y); - } - } - BLOCK_END("FloorItem::draw") -} - -int FloorItem::getCard(const int index) const -{ - if (index < 0 || index >= maxCards) - return 0; - return mCards[index]; -} diff --git a/src/being/flooritem.h b/src/being/flooritem.h deleted file mode 100644 index 700ce7d15..000000000 --- a/src/being/flooritem.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_FLOORITEM_H -#define BEING_FLOORITEM_H - -#include "const/resources/item/cards.h" - -#include "enums/resources/cursor.h" - -#include "enums/resources/item/itemtype.h" - -#include "enums/simpletypes/damaged.h" -#include "enums/simpletypes/identified.h" -#include "enums/simpletypes/itemcolor.h" - -#include "being/actorsprite.h" - -class ItemInfo; - -/** - * An item lying on the floor. - */ -class FloorItem final : public ActorSprite -{ - public: - /** - * Constructor. - * - * @param id the unique ID of this item instance - * @param itemId the item ID - * @param x the x position in tiles - * @param y the y position in tiles - * @param amount the item amount - * @param color the item color - */ - FloorItem(const BeingId id, - const int itemId, - const int x, const int y, - const ItemTypeT itemType, - const int amount, - const int refine, - const ItemColor color, - const Identified identified, - const Damaged damaged, - const int *const cards); - - A_DELETE_COPY(FloorItem) - - void postInit(Map *const map, int subX, int subY); - - ActorTypeT getType() const noexcept2 override final A_WARN_UNUSED - { return ActorType::FloorItem; } - - void draw(Graphics *const graphics, - const int offsetX, const int offsetY) - const override final A_NONNULL(2); - - /** - * Returns the item ID. - */ - int getItemId() const noexcept2 A_WARN_UNUSED - { return mItemId; } - - /** - * Returns the item info for this floor item. Useful for adding an item - * link for the floor item to chat. - */ - const ItemInfo &getInfo() const A_WARN_UNUSED; - - std::string getName() const A_WARN_UNUSED; - - int getTileX() const override final A_WARN_UNUSED - { return mX; } - - int getTileY() const override final A_WARN_UNUSED - { return mY; } - - void incrementPickup() noexcept2 - { mPickupCount ++; } - - unsigned getPickupCount() const noexcept2 A_WARN_UNUSED - { return mPickupCount; } - - ItemColor getColor() const noexcept2 A_WARN_UNUSED - { return mColor; } - - bool getShowMsg() const noexcept2 A_WARN_UNUSED - { return mShowMsg; } - - void setShowMsg(const bool n) noexcept2 - { mShowMsg = n; } - - void disableHightlight() noexcept2 - { mHighlight = false; } - - CursorT getHoverCursor() const noexcept2 A_WARN_UNUSED - { return mCursor; } - - void setCards(const int *const cards, int sz); - - int getCard(const int index) const; - - int getRefine() const noexcept2 A_WARN_UNUSED - { return mRefine; } - - ItemTypeT getItemType() const noexcept2 A_WARN_UNUSED - { return mItemType; } - - Identified getIdentified() const noexcept2 A_WARN_UNUSED - { return mIdentified; } - - Damaged getDamaged() const noexcept2 A_WARN_UNUSED - { return mDamaged; } - - private: - int mCards[maxCards]; - int mItemId; - int mX, mY; - time_t mDropTime; - int mAmount; - int mRefine; - int mHeightPosDiff; - ItemTypeT mItemType; - unsigned int mPickupCount; - CursorT mCursor; - ItemColor mColor; - Identified mIdentified; - Damaged mDamaged; - bool mShowMsg; - bool mHighlight; -}; - -#endif // BEING_FLOORITEM_H diff --git a/src/being/homunculusinfo.h b/src/being/homunculusinfo.h deleted file mode 100644 index 1488af9e8..000000000 --- a/src/being/homunculusinfo.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_HOMUNCULUSINFO_H -#define BEING_HOMUNCULUSINFO_H - -#include "enums/simpletypes/beingid.h" - -#include - -#include "localconsts.h" - -struct HomunculusInfo final -{ - HomunculusInfo() : - name(), - id(BeingId_zero), - level(0), - range(0), - hungry(0), - intimacy(0), - equip(0) - { } - - A_DELETE_COPY(HomunculusInfo) - - std::string name; - BeingId id; - int level; - int range; - int hungry; - int intimacy; - int equip; -}; - -#endif // BEING_HOMUNCULUSINFO_H diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp deleted file mode 100644 index 1a12a3808..000000000 --- a/src/being/localplayer.cpp +++ /dev/null @@ -1,2816 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/localplayer.h" - -#include "actormanager.h" -#include "configuration.h" -#include "gamemodifiers.h" -#include "guild.h" -#include "party.h" -#include "settings.h" -#include "soundmanager.h" -#include "statuseffect.h" - -#include "being/beingflag.h" -#include "being/crazymoves.h" -#include "being/playerinfo.h" -#include "being/playerrelations.h" - -#include "const/sound.h" - -#include "enums/equipslot.h" - -#include "enums/being/beingdirection.h" - -#include "enums/resources/map/blockmask.h" -#include "enums/resources/map/mapitemtype.h" - -#include "particle/particleengine.h" - -#include "input/keyboardconfig.h" - -#include "gui/gui.h" -#include "gui/userpalette.h" -#include "gui/popupmanager.h" - -#include "gui/windows/chatwindow.h" -#include "gui/windows/ministatuswindow.h" -#include "gui/windows/okdialog.h" -#include "gui/windows/outfitwindow.h" -#include "gui/windows/shopwindow.h" -#include "gui/windows/socialwindow.h" -#include "gui/windows/statuswindow.h" -#include "gui/windows/updaterwindow.h" - -#include "gui/widgets/tabs/chat/whispertab.h" - -#include "listeners/awaylistener.h" - -#include "net/beinghandler.h" -#include "net/chathandler.h" -#include "net/inventoryhandler.h" -#include "net/net.h" -#include "net/packetlimiter.h" -#include "net/playerhandler.h" -#include "net/serverfeatures.h" - -#include "resources/iteminfo.h" - -#include "resources/db/weaponsdb.h" - -#include "resources/item/item.h" - -#include "resources/map/map.h" -#include "resources/map/mapitem.h" -#include "resources/map/speciallayer.h" -#include "resources/map/walklayer.h" - -#include "resources/sprite/animatedsprite.h" - -#include "utils/delete2.h" -#include "utils/foreach.h" -#include "utils/gettext.h" -#include "utils/timer.h" - -#ifdef USE_MUMBLE -#include "mumblemanager.h" -#endif // USE_MUMBLE - -#include - -#include "debug.h" - -static const int16_t awayLimitTimer = 60; -static const int MAX_TICK_VALUE = INT_MAX / 2; - -typedef std::map::const_iterator GuildMapCIter; - -LocalPlayer *localPlayer = nullptr; - -extern OkDialog *weightNotice; -extern time_t weightNoticeTime; - -LocalPlayer::LocalPlayer(const BeingId id, - const BeingTypeId subType) : - Being(id, ActorType::Player), - ActorSpriteListener(), - AttributeListener(), - PlayerDeathListener(), - mMoveState(0), - mLastTargetX(0), - mLastTargetY(0), - mHomes(), - mTarget(nullptr), - mPlayerFollowed(), - mPlayerImitated(), - mNextDestX(0), - mNextDestY(0), - mPickUpTarget(nullptr), - mLastAction(-1), - mStatusEffectIcons(), - mMessages(), - mMessageTime(0), - mAwayListener(new AwayListener), - mAwayDialog(nullptr), - mPingSendTick(0), - mPingTime(0), - mAfkTime(0), - mActivityTime(0), - mNavigateX(0), - mNavigateY(0), - mNavigateId(BeingId_zero), - mCrossX(0), - mCrossY(0), - mOldX(0), - mOldY(0), - mOldTileX(0), - mOldTileY(0), - mNavigatePath(), - mLastHitFrom(), - mWaitFor(), - mAdvertTime(0), - mTestParticle(nullptr), - mTestParticleName(), - mTestParticleTime(0), - mTestParticleHash(0L), - mSyncPlayerMoveDistance(config.getIntValue("syncPlayerMoveDistance")), - mUnfreezeTime(0), - mWalkingDir(0), - mUpdateName(true), - mBlockAdvert(false), - mTargetDeadPlayers(config.getBoolValue("targetDeadPlayers")), - mServerAttack(fromBool(config.getBoolValue("serverAttack"), Keep)), - mVisibleNames(static_cast( - config.getIntValue("visiblenames"))), - mEnableAdvert(config.getBoolValue("enableAdvert")), - mTradebot(config.getBoolValue("tradebot")), - mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")), - mIsServerBuggy(serverConfig.getValueBool("enableBuggyServers", true)), - mSyncPlayerMove(config.getBoolValue("syncPlayerMove")), - mDrawPath(config.getBoolValue("drawPath")), - mAttackMoving(config.getBoolValue("attackMoving")), - mAttackNext(config.getBoolValue("attackNext")), - mShowJobExp(config.getBoolValue("showJobExp")), - mShowServerPos(config.getBoolValue("showserverpos")), - mNextStep(false), - mGoingToTarget(false), - mKeepAttacking(false), - mPathSetByMouse(false), - mWaitPing(false), - mShowNavigePath(false), - mAllowRename(false), - mFreezed(false) -{ - logger->log1("LocalPlayer::LocalPlayer"); - - postInit(subType, nullptr); - mAttackRange = 0; - mLevel = 1; - mAdvanced = true; - mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255); - if (userPalette != nullptr) - mNameColor = &userPalette->getColor(UserColorId::SELF); - else - mNameColor = nullptr; - - PlayerInfo::setStatBase(Attributes::PLAYER_WALK_SPEED, - getWalkSpeed()); - PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); - - loadHomes(); - - config.addListener("showownname", this); - config.addListener("targetDeadPlayers", this); - serverConfig.addListener("enableBuggyServers", this); - config.addListener("syncPlayerMove", this); - config.addListener("syncPlayerMoveDistance", this); - config.addListener("drawPath", this); - config.addListener("serverAttack", this); - config.addListener("attackMoving", this); - config.addListener("attackNext", this); - config.addListener("showJobExp", this); - config.addListener("enableAdvert", this); - config.addListener("tradebot", this); - config.addListener("targetOnlyReachable", this); - config.addListener("showserverpos", this); - config.addListener("visiblenames", this); - setShowName(config.getBoolValue("showownname")); -} - -LocalPlayer::~LocalPlayer() -{ - logger->log1("LocalPlayer::~LocalPlayer"); - - config.removeListeners(this); - serverConfig.removeListener("enableBuggyServers", this); - - navigateClean(); - mCrossX = 0; - mCrossY = 0; - - updateNavigateList(); - - if (mAwayDialog != nullptr) - { - soundManager.volumeRestore(); - delete2(mAwayDialog) - } - delete2(mAwayListener); -} - -void LocalPlayer::logic() -{ - BLOCK_START("LocalPlayer::logic") -#ifdef USE_MUMBLE - if (mumbleManager) - mumbleManager->setPos(mX, mY, mDirection); -#endif // USE_MUMBLE - - // Actions are allowed once per second - if (get_elapsed_time(mLastAction) >= 1000) - mLastAction = -1; - - if (mActivityTime == 0 || mLastAction != -1) - mActivityTime = cur_time; - - if (mUnfreezeTime > 0 && - mUnfreezeTime <= tick_time) - { - mUnfreezeTime = 0; - mFreezed = false; - } - - if ((mAction != BeingAction::MOVE || mNextStep) && !mNavigatePath.empty()) - { - mNextStep = false; - int dist = 5; - if (!mSyncPlayerMove) - dist = 20; - - if (((mNavigateX != 0) || (mNavigateY != 0)) && - ((mCrossX + dist >= mX && mCrossX <= mX + dist - && mCrossY + dist >= mY && mCrossY <= mY + dist) - || ((mCrossX == 0) && (mCrossY == 0)))) - { - const Path::const_iterator i = mNavigatePath.begin(); - if ((*i).x == mX && (*i).y == mY) - mNavigatePath.pop_front(); - else - setDestination((*i).x, (*i).y); - } - } - - // Show XP messages - if (!mMessages.empty()) - { - if (mMessageTime == 0) - { - const MessagePair info = mMessages.front(); - - if ((particleEngine != nullptr) && (gui != nullptr)) - { - particleEngine->addTextRiseFadeOutEffect( - info.first, - mPixelX, - mPixelY - 48, - &userPalette->getColor(info.second), - gui->getInfoParticleFont(), - true); - } - - mMessages.pop_front(); - mMessageTime = 30; - } - mMessageTime--; - } - - if (mTarget != nullptr) - { - if (mTarget->getType() == ActorType::Npc) - { - // NPCs are always in range - mTarget->setTargetType(TargetCursorType::IN_RANGE); - } - else - { - // Find whether target is in range - const int rangeX = CAST_S32( - abs(mTarget->mX - mX)); - const int rangeY = CAST_S32( - abs(mTarget->mY - mY)); - const int attackRange = getAttackRange(); - const TargetCursorTypeT targetType - = rangeX > attackRange || rangeY > attackRange - ? TargetCursorType::NORMAL : TargetCursorType::IN_RANGE; - mTarget->setTargetType(targetType); - - if (!mTarget->isAlive() && (!mTargetDeadPlayers - || mTarget->getType() != ActorType::Player)) - { - stopAttack(true); - } - - if (mKeepAttacking && (mTarget != nullptr)) - attack(mTarget, true); - } - } - - Being::logic(); - BLOCK_END("LocalPlayer::logic") -} - -void LocalPlayer::slowLogic() -{ - BLOCK_START("LocalPlayer::slowLogic") - const time_t time = cur_time; - if ((weightNotice != nullptr) && weightNoticeTime < time) - { - weightNotice->scheduleDelete(); - weightNotice = nullptr; - weightNoticeTime = 0; - } - - if ((serverFeatures != nullptr) && - !serverFeatures->havePlayerStatusUpdate() && - mEnableAdvert && - !mBlockAdvert && - mAdvertTime < cur_time) - { - uint8_t smile = BeingFlag::SPECIAL; - if (mTradebot && - shopWindow != nullptr && - !shopWindow->isShopEmpty()) - { - smile |= BeingFlag::SHOP; - } - - if (settings.awayMode || settings.pseudoAwayMode) - smile |= BeingFlag::AWAY; - - if (mInactive) - smile |= BeingFlag::INACTIVE; - - if (emote(smile)) - mAdvertTime = time + 60; - else - mAdvertTime = time + 30; - } - - if (mTestParticleTime != time && !mTestParticleName.empty()) - { - const unsigned long hash = UpdaterWindow::getFileHash( - mTestParticleName); - if (hash != mTestParticleHash) - { - setTestParticle(mTestParticleName, false); - mTestParticleHash = hash; - } - mTestParticleTime = time; - } - - BLOCK_END("LocalPlayer::slowLogic") -} - -void LocalPlayer::setAction(const BeingActionT &action, - const int attackId) -{ - if (action == BeingAction::DEAD) - { - if (!mLastHitFrom.empty() && - !serverFeatures->haveKillerId()) - { - // TRANSLATORS: chat message after death - debugMsg(strprintf(_("You were killed by %s."), - mLastHitFrom.c_str())); - mLastHitFrom.clear(); - } - setTarget(nullptr); - } - - Being::setAction(action, - attackId); -#ifdef USE_MUMBLE - if (mumbleManager) - mumbleManager->setAction(CAST_S32(action)); -#endif // USE_MUMBLE -} - -void LocalPlayer::setGroupId(const int id) -{ - Being::setGroupId(id); - - if (id > 0) - { - setGM(true); - if (chatWindow != nullptr) - { - chatWindow->loadGMCommands(); - chatWindow->showGMTab(); - } - } - else - { - setGM(false); - } - if (statusWindow != nullptr) - statusWindow->updateLevelLabel(); -} - -void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) -{ - const Party *const party = Party::getParty(1); - if (party != nullptr) - { - PartyMember *const pm = party->getMember(mName); - if (pm != nullptr) - { - pm->setX(mX); - pm->setY(mY); - } - } - - if (mPath.empty()) - { - if (mPickUpTarget != nullptr) - pickUp(mPickUpTarget); - - if (mWalkingDir != 0u) - startWalking(mWalkingDir); - } - else if (mPath.size() == 1) - { - if (mPickUpTarget != nullptr) - pickUp(mPickUpTarget); - } - - if (mGoingToTarget && (mTarget != nullptr) && withinAttackRange(mTarget)) - { - mAction = BeingAction::STAND; - attack(mTarget, true); - mGoingToTarget = false; - mPath.clear(); - return; - } - else if (mGoingToTarget && (mTarget == nullptr)) - { - mGoingToTarget = false; - mPath.clear(); - } - - if (mPath.empty()) - { - if (mNavigatePath.empty() || mAction != BeingAction::MOVE) - setAction(BeingAction::STAND, 0); - else - mNextStep = true; - } - else - { - Being::nextTile(); - } -} - -bool LocalPlayer::pickUp(FloorItem *const item) -{ - if (item == nullptr) - return false; - - if (!PacketLimiter::limitPackets(PacketType::PACKET_PICKUP)) - return false; - - const int dx = item->getTileX() - mX; - const int dy = item->getTileY() - mY; - int dist = 6; - - const unsigned int pickUpType = settings.pickUpType; - if (pickUpType >= 4 && pickUpType <= 6) - dist = 4; - - if (dx * dx + dy * dy < dist) - { - if ((actorManager != nullptr) && actorManager->checkForPickup(item)) - { - PlayerInfo::pickUpItem(item, Sfx_true); - mPickUpTarget = nullptr; - } - } - else if (pickUpType >= 4 && pickUpType <= 6) - { - const Path debugPath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - item->getTileX(), - item->getTileY(), - getBlockWalkMask(), - 0); - if (!debugPath.empty()) - navigateTo(item->getTileX(), item->getTileY()); - else - setDestination(item->getTileX(), item->getTileY()); - - mPickUpTarget = item; - mPickUpTarget->addActorSpriteListener(this); - } - return true; -} - -void LocalPlayer::actorSpriteDestroyed(const ActorSprite &actorSprite) -{ - if (mPickUpTarget == &actorSprite) - mPickUpTarget = nullptr; -} - -Being *LocalPlayer::getTarget() const -{ - return mTarget; -} - -void LocalPlayer::setTarget(Being *const target) -{ - if (target == this && (target != nullptr)) - return; - - if (target == mTarget) - return; - - Being *oldTarget = nullptr; - if (mTarget != nullptr) - { - mTarget->untarget(); - oldTarget = mTarget; - } - - if (mTarget != nullptr) - { - if (mTarget->getType() == ActorType::Monster) - mTarget->setShowName(false); - } - - mTarget = target; - - if (oldTarget != nullptr) - oldTarget->updateName(); - - if (target != nullptr) - { - mLastTargetX = target->mX; - mLastTargetY = target->mY; - target->updateName(); - if (mVisibleNames == VisibleName::ShowOnSelection) - target->setShowName(true); - } - if (oldTarget != nullptr && mVisibleNames == VisibleName::ShowOnSelection) - oldTarget->setShowName(false); - if (target != nullptr && target->getType() == ActorType::Monster) - target->setShowName(true); -} - -Being *LocalPlayer::setNewTarget(const ActorTypeT type, - const AllowSort allowSort) -{ - if (actorManager != nullptr) - { - Being *const target = actorManager->findNearestLivingBeing( - localPlayer, 20, type, allowSort); - - if ((target != nullptr) && target != mTarget) - setTarget(target); - - return target; - } - return nullptr; -} - -void LocalPlayer::setDestination(const int x, const int y) -{ - mActivityTime = cur_time; - - if (settings.attackType == 0 || !mAttackMoving) - mKeepAttacking = false; - - // Only send a new message to the server when destination changes - if (x != mDest.x || y != mDest.y) - { - if (settings.moveType != 1) - { - playerHandler->setDestination(x, y, mDirection); - Being::setDestination(x, y); - } - else - { - uint8_t newDir = 0; - if ((mDirection & BeingDirection::UP) != 0) - newDir |= BeingDirection::DOWN; - if ((mDirection & BeingDirection::LEFT) != 0) - newDir |= BeingDirection::RIGHT; - if ((mDirection & BeingDirection::DOWN) != 0) - newDir |= BeingDirection::UP; - if ((mDirection & BeingDirection::RIGHT) != 0) - newDir |= BeingDirection::LEFT; - - playerHandler->setDestination(x, y, newDir); - -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - setDirection(newDir); - playerHandler->setDirection(newDir); - } - - Being::setDestination(x, y); - playerHandler->setDestination(x, y, mDirection); - } - } -} - -void LocalPlayer::setWalkingDir(const unsigned char dir) -{ - // This function is called by Game::handleInput() - mWalkingDir = dir; - - // If we're not already walking, start walking. - if (mAction != BeingAction::MOVE && (dir != 0u)) - startWalking(dir); -} - -void LocalPlayer::startWalking(const unsigned char dir) -{ - // This function is called by setWalkingDir(), - // but also by nextTile() for TMW-Athena... - if ((mMap == nullptr) || (dir == 0u)) - return; - - mPickUpTarget = nullptr; - if (mAction == BeingAction::MOVE && !mPath.empty()) - { - // Just finish the current action, otherwise we get out of sync - Being::setDestination(mX, mY); - return; - } - - int dx = 0, dy = 0; - if ((dir & BeingDirection::UP) != 0) - dy--; - if ((dir & BeingDirection::DOWN) != 0) - dy++; - if ((dir & BeingDirection::LEFT) != 0) - dx--; - if ((dir & BeingDirection::RIGHT) != 0) - dx++; - - const unsigned char blockWalkMask = getBlockWalkMask(); - // Prevent skipping corners over colliding tiles - if ((dx != 0) && !mMap->getWalk(mX + dx, mY, blockWalkMask)) - dx = 0; - if ((dy != 0) && !mMap->getWalk(mX, mY + dy, blockWalkMask)) - dy = 0; - - // Choose a straight direction when diagonal target is blocked - if (dx != 0 && dy != 0 && !mMap->getWalk(mX + dx, mY + dy, blockWalkMask)) - dx = 0; - - // Walk to where the player can actually go - if ((dx != 0 || dy != 0) && mMap->getWalk(mX + dx, mY + dy, blockWalkMask)) - { - setDestination(mX + dx, mY + dy); - } - else if (dir != mDirection) - { - // If the being can't move, just change direction - -// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - { - playerHandler->setDirection(dir); - setDirection(dir); - } - } -} - -void LocalPlayer::stopWalking(const bool sendToServer) -{ - if (mAction == BeingAction::MOVE && (mWalkingDir != 0u)) - { - mWalkingDir = 0; - mPickUpTarget = nullptr; - setDestination(mPixelX, - mPixelY); - if (sendToServer) - { - playerHandler->setDestination( - mPixelX, - mPixelY, - -1); - } - setAction(BeingAction::STAND, 0); - } - - // No path set anymore, so we reset the path by mouse flag - mPathSetByMouse = false; - - clearPath(); - navigateClean(); -} - -bool LocalPlayer::toggleSit() const -{ - if (!PacketLimiter::limitPackets(PacketType::PACKET_SIT)) - return false; - - BeingActionT newAction; - switch (mAction) - { - case BeingAction::STAND: - case BeingAction::PRESTAND: - case BeingAction::SPAWN: - newAction = BeingAction::SIT; - break; - case BeingAction::SIT: - newAction = BeingAction::STAND; - break; - case BeingAction::MOVE: - case BeingAction::ATTACK: - case BeingAction::DEAD: - case BeingAction::HURT: - case BeingAction::CAST: - default: - return true; - } - - playerHandler->changeAction(newAction); - return true; -} - -bool LocalPlayer::updateSit() const -{ - if (!PacketLimiter::limitPackets(PacketType::PACKET_SIT)) - return false; - - playerHandler->changeAction(mAction); - return true; -} - -bool LocalPlayer::emote(const uint8_t emotion) -{ - if (!PacketLimiter::limitPackets(PacketType::PACKET_EMOTE)) - return false; - - playerHandler->emote(emotion); - return true; -} - -void LocalPlayer::attack(Being *const target, const bool keep, - const bool dontChangeEquipment) -{ - mKeepAttacking = keep; - - if ((target == nullptr) || target->getType() == ActorType::Npc) - return; - - if (mTarget != target) - setTarget(target); - - // Must be standing or sitting or casting to attack - if (mAction != BeingAction::STAND && - mAction != BeingAction::SIT && - mAction != BeingAction::CAST) - { - return; - } - -#ifdef TMWA_SUPPORT - const int dist_x = target->mX - mX; - const int dist_y = target->mY - mY; - - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - if (abs(dist_y) >= abs(dist_x)) - { - if (dist_y > 0) - setDirection(BeingDirection::DOWN); - else - setDirection(BeingDirection::UP); - } - else - { - if (dist_x > 0) - setDirection(BeingDirection::RIGHT); - else - setDirection(BeingDirection::LEFT); - } - } -#endif // TMWA_SUPPORT - - mActionTime = tick_time; - - if (target->getType() != ActorType::Player - || checAttackPermissions(target)) - { - setAction(BeingAction::ATTACK, 0); - - if (!PacketLimiter::limitPackets(PacketType::PACKET_ATTACK)) - return; - - if (!dontChangeEquipment) - changeEquipmentBeforeAttack(target); - - const BeingId targetId = target->getId(); - playerHandler->attack(targetId, mServerAttack); - PlayerInfo::updateAttackAi(targetId, mServerAttack); - } - - if (!keep) - stopAttack(); -} - -void LocalPlayer::stopAttack(const bool keepAttack) -{ - if (!PacketLimiter::limitPackets(PacketType::PACKET_STOPATTACK)) - return; - - if (mServerAttack == Keep_true && mAction == BeingAction::ATTACK) - playerHandler->stopAttack(); - - untarget(); - if (!keepAttack || !mAttackNext) - mKeepAttacking = false; -} - -void LocalPlayer::untarget() -{ - if (mAction == BeingAction::ATTACK) - setAction(BeingAction::STAND, 0); - - if (mTarget != nullptr) - setTarget(nullptr); -} - -void LocalPlayer::pickedUp(const ItemInfo &itemInfo, - const int amount, - const ItemColor color, - const BeingId floorItemId, - const PickupT fail) -{ - if (fail != Pickup::OKAY) - { - if ((actorManager != nullptr) && floorItemId != BeingId_zero) - { - FloorItem *const item = actorManager->findItem(floorItemId); - if (item != nullptr) - { - if (!item->getShowMsg()) - return; - item->setShowMsg(false); - } - } - const char* msg = nullptr; - switch (fail) - { - case Pickup::BAD_ITEM: - // TRANSLATORS: pickup error message - msg = N_("Tried to pick up nonexistent item."); - break; - case Pickup::TOO_HEAVY: - // TRANSLATORS: pickup error message - msg = N_("Item is too heavy."); - break; - case Pickup::TOO_FAR: - // TRANSLATORS: pickup error message - msg = N_("Item is too far away."); - break; - case Pickup::INV_FULL: - // TRANSLATORS: pickup error message - msg = N_("Inventory is full."); - break; - case Pickup::STACK_FULL: - // TRANSLATORS: pickup error message - msg = N_("Stack is too big."); - break; - case Pickup::DROP_STEAL: - // TRANSLATORS: pickup error message - msg = N_("Item belongs to someone else."); - break; - case Pickup::MAX_AMOUNT: - // TRANSLATORS: pickup error message - msg = N_("You can't pickup this amount of items."); - break; - case Pickup::STACK_AMOUNT: - // TRANSLATORS: pickup error message - msg = N_("Your item stack has max amount."); - break; - case Pickup::OKAY: - break; - default: - case Pickup::UNKNOWN: - // TRANSLATORS: pickup error message - msg = N_("Unknown problem picking up item."); - break; - } - if ((localChatTab != nullptr) && config.getBoolValue("showpickupchat")) - localChatTab->chatLog(gettext(msg), ChatMsgType::BY_SERVER); - - if ((mMap != nullptr) && config.getBoolValue("showpickupparticle")) - { - // Show pickup notification - addMessageToQueue(gettext(msg), UserColorId::PICKUP_INFO); - } - } - else - { - std::string str; -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - str = itemInfo.getName(); - } - else -#endif // TMWA_SUPPORT - { - str = itemInfo.getName(color); - } - - if (config.getBoolValue("showpickupchat") && (localChatTab != nullptr)) - { - // TRANSLATORS: %d is number, - // [@@%d|%s@@] - here player can see link to item - localChatTab->chatLog(strprintf(ngettext("You picked up %d " - "[@@%d|%s@@].", "You picked up %d [@@%d|%s@@].", amount), - amount, itemInfo.getId(), str.c_str()), - ChatMsgType::BY_SERVER); - } - - if ((mMap != nullptr) && config.getBoolValue("showpickupparticle")) - { - // Show pickup notification - if (amount > 1) - { - addMessageToQueue(strprintf("%d x %s", amount, - str.c_str()), UserColorId::PICKUP_INFO); - } - else - { - addMessageToQueue(str, UserColorId::PICKUP_INFO); - } - } - } -} - -int LocalPlayer::getAttackRange() const -{ - if (mAttackRange > -1) - { - return mAttackRange; - } - - const Item *const weapon = PlayerInfo::getEquipment( - EquipSlot::FIGHT1_SLOT); - if (weapon != nullptr) - { - const ItemInfo &info = weapon->getInfo(); - return info.getAttackRange(); - } - return 48; // unarmed range -} - -bool LocalPlayer::withinAttackRange(const Being *const target, - const bool fixDistance, - const int addRange) const -{ - if (target == nullptr) - return false; - - int range = getAttackRange() + addRange; - int dx; - int dy; - - if (fixDistance && range == 1) - range = 2; - - dx = CAST_S32(abs(target->mX - mX)); - dy = CAST_S32(abs(target->mY - mY)); - return !(dx > range || dy > range); -} - -void LocalPlayer::setGotoTarget(Being *const target) -{ - if (target == nullptr) - return; - - mPickUpTarget = nullptr; - setTarget(target); - mGoingToTarget = true; - navigateTo(target->mX, - target->mY); -} - -void LocalPlayer::handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId, - const Enable newStatus, - const IsStart start) -{ - Being::handleStatusEffect(effect, - effectId, - newStatus, - start); - - if (effect != nullptr) - { - effect->deliverMessage(); - effect->playSFX(); - - AnimatedSprite *const sprite = effect->getIcon(); - - if (sprite == nullptr) - { - // delete sprite, if necessary - for (size_t i = 0; i < mStatusEffectIcons.size(); ) - { - if (mStatusEffectIcons[i] == effectId) - { - mStatusEffectIcons.erase(mStatusEffectIcons.begin() + i); - if (miniStatusWindow != nullptr) - miniStatusWindow->eraseIcon(CAST_S32(i)); - } - else - { - i++; - } - } - } - else - { - // replace sprite or append - bool found = false; - const size_t sz = mStatusEffectIcons.size(); - for (size_t i = 0; i < sz; i++) - { - if (mStatusEffectIcons[i] == effectId) - { - if (miniStatusWindow != nullptr) - miniStatusWindow->setIcon(CAST_S32(i), sprite); - found = true; - break; - } - } - - if (!found) - { // add new - const int offset = CAST_S32(mStatusEffectIcons.size()); - if (miniStatusWindow != nullptr) - miniStatusWindow->setIcon(offset, sprite); - mStatusEffectIcons.push_back(effectId); - } - } - } -} - -void LocalPlayer::addMessageToQueue(const std::string &message, - const UserColorIdT color) -{ - if (mMessages.size() < 20) - mMessages.push_back(MessagePair(message, color)); -} - -void LocalPlayer::optionChanged(const std::string &value) -{ - if (value == "showownname") - { - setShowName(config.getBoolValue("showownname")); - } - else if (value == "targetDeadPlayers") - { - mTargetDeadPlayers = config.getBoolValue("targetDeadPlayers"); - } - else if (value == "enableBuggyServers") - { - mIsServerBuggy = serverConfig.getBoolValue("enableBuggyServers"); - } - else if (value == "syncPlayerMove") - { - mSyncPlayerMove = config.getBoolValue("syncPlayerMove"); - } - else if (value == "syncPlayerMoveDistance") - { - mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistance"); - } - else if (value == "drawPath") - { - mDrawPath = config.getBoolValue("drawPath"); - } - else if (value == "serverAttack") - { - mServerAttack = fromBool(config.getBoolValue("serverAttack"), Keep); - } - else if (value == "attackMoving") - { - mAttackMoving = config.getBoolValue("attackMoving"); - } - else if (value == "attackNext") - { - mAttackNext = config.getBoolValue("attackNext"); - } - else if (value == "showJobExp") - { - mShowJobExp = config.getBoolValue("showJobExp"); - } - else if (value == "enableAdvert") - { - mEnableAdvert = config.getBoolValue("enableAdvert"); - } - else if (value == "tradebot") - { - mTradebot = config.getBoolValue("tradebot"); - } - else if (value == "targetOnlyReachable") - { - mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); - } - else if (value == "showserverpos") - { - mShowServerPos = config.getBoolValue("showserverpos"); - } - else if (value == "visiblenames") - { - mVisibleNames = static_cast( - config.getIntValue("visiblenames")); - } -} - -void LocalPlayer::addJobMessage(const int change) -{ - if (change != 0 && mMessages.size() < 20) - { - if (!mMessages.empty()) - { - MessagePair pair = mMessages.back(); - // TRANSLATORS: this is normal experience - if (pair.first.find(strprintf(" %s", _("xp"))) == - // TRANSLATORS: this is normal experience - pair.first.size() - strlen(_("xp")) - 1) - { - mMessages.pop_back(); - // TRANSLATORS: this is job experience - pair.first.append(strprintf(", %d %s", change, _("job"))); - mMessages.push_back(pair); - } - else - { - // TRANSLATORS: this is job experience - addMessageToQueue(strprintf("%d %s", change, _("job"))); - } - } - else - { - // TRANSLATORS: this is job experience - addMessageToQueue(strprintf("%d %s", change, _("job"))); - } - } -} - -void LocalPlayer::addXpMessage(const int change) -{ - if (change != 0 && mMessages.size() < 20) - { - // TRANSLATORS: get xp message - addMessageToQueue(strprintf("%d %s", change, _("xp"))); - } -} - -void LocalPlayer::addHomunXpMessage(const int change) -{ - if (change != 0 && mMessages.size() < 20) - { - addMessageToQueue(strprintf("%s %d %s", - // TRANSLATORS: get homunculus xp message - _("Homun"), - change, - // TRANSLATORS: get xp message - _("xp"))); - } -} - -void LocalPlayer::addHpMessage(const int change) -{ - if (change != 0 && mMessages.size() < 20) - { - // TRANSLATORS: get hp message - addMessageToQueue(strprintf("%d %s", change, _("hp"))); - } -} - -void LocalPlayer::addSpMessage(const int change) -{ - if (change != 0 && mMessages.size() < 20) - { - // TRANSLATORS: get hp message - addMessageToQueue(strprintf("%d %s", change, _("mana"))); - } -} - -void LocalPlayer::attributeChanged(const AttributesT id, - const int64_t oldVal, - const int64_t newVal) -{ - PRAGMA45(GCC diagnostic push) - PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") - switch (id) - { - case Attributes::PLAYER_EXP: - { - if (Net::getNetworkType() != ServerType::TMWATHENA) - break; - if (oldVal > newVal) - break; - - const int change = CAST_S32(newVal - oldVal); - addXpMessage(change); - break; - } - case Attributes::PLAYER_BASE_LEVEL: - mLevel = CAST_S32(newVal); - break; - case Attributes::PLAYER_HP: - if (oldVal != 0 && newVal == 0) - PlayerDeathListener::distributeEvent(); - break; - case Attributes::PLAYER_JOB_EXP: - { - if (!mShowJobExp || - Net::getNetworkType() != ServerType::TMWATHENA) - { - return; - } - if (oldVal > newVal || - PlayerInfo::getAttribute( - Attributes::PLAYER_JOB_EXP_NEEDED) == 0) - { - return; - } - const int32_t change = CAST_S32(newVal - oldVal); - addJobMessage(change); - break; - } - default: - break; - } - PRAGMA45(GCC diagnostic pop) -} - -void LocalPlayer::move(const int dX, const int dY) -{ - mPickUpTarget = nullptr; - setDestination(mX + dX, mY + dY); -} - -void LocalPlayer::moveToTarget(int dist) -{ - bool gotPos(false); - Path debugPath; - - size_t limit(0); - - if (dist == -1) - { - dist = settings.moveToTargetType; - if (dist != 0) - { - const bool broken = (Net::getNetworkType() == - ServerType::TMWATHENA); - switch (dist) - { - case 10: - dist = mAttackRange; - if (dist == 1 && broken) - dist = 2; - break; - case 11: - dist = mAttackRange - 1; - if (dist < 1) - dist = 1; - if (dist == 1 && broken) - dist = 2; - break; - default: - break; - } - } - } - - if (mTarget != nullptr) - { - if (mMap != nullptr) - { - debugPath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - mTarget->mX, - mTarget->mY, - getBlockWalkMask(), - 0); - } - - const size_t sz = debugPath.size(); - if (sz < CAST_SIZE(dist)) - return; - limit = CAST_S32(sz) - dist; - gotPos = true; - } - else if ((mNavigateX != 0) || (mNavigateY != 0)) - { - debugPath = mNavigatePath; - limit = dist; - gotPos = true; - } - - if (gotPos) - { - if (dist == 0) - { - if (mTarget != nullptr) - navigateTo(mTarget->mX, mTarget->mY); - } - else - { - Position pos(0, 0); - size_t f = 0; - - for (Path::const_iterator i = debugPath.begin(), - i_fend = debugPath.end(); - i != i_fend && f < limit; ++i, f++) - { - pos = (*i); - } - navigateTo(pos.x, pos.y); - } - } - else if ((mLastTargetX != 0) || (mLastTargetY != 0)) - { - navigateTo(mLastTargetX, mLastTargetY); - } -} - -void LocalPlayer::moveToHome() -{ - mPickUpTarget = nullptr; - if ((mX != mCrossX || mY != mCrossY) && (mCrossX != 0) && (mCrossY != 0)) - { - setDestination(mCrossX, mCrossY); - } - else if (mMap != nullptr) - { - const std::map::const_iterator iter = - mHomes.find(mMap->getProperty("_realfilename")); - - if (iter != mHomes.end()) - { - const Vector pos = mHomes[(*iter).first]; - if (mX == pos.x && mY == pos.y) - { - playerHandler->setDestination( - CAST_S32(pos.x), - CAST_S32(pos.y), - CAST_S32(mDirection)); - } - else - { - navigateTo(CAST_S32(pos.x), CAST_S32(pos.y)); - } - } - } -} - -void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const -{ - if (settings.attackWeaponType == 1 - || (target == nullptr) - || (PlayerInfo::getInventory() == nullptr)) - { - return; - } - - bool allowSword = false; - const int dx = target->mX - mX; - const int dy = target->mY - mY; - const Item *item = nullptr; - - if (dx * dx + dy * dy > 80) - return; - - if (dx * dx + dy * dy < 8) - allowSword = true; - - const Inventory *const inv = PlayerInfo::getInventory(); - if (inv == nullptr) - return; - - // if attack distance for sword - if (allowSword) - { - // searching swords - const WeaponsInfos &swords = WeaponsDB::getSwords(); - FOR_EACH (WeaponsInfosIter, it, swords) - { - item = inv->findItem(*it, ItemColor_zero); - if (item != nullptr) - break; - } - - // no swords - if (item == nullptr) - return; - - // if sword not equiped - if (item->isEquipped() == Equipped_false) - PlayerInfo::equipItem(item, Sfx_true); - - // if need equip shield too - if (settings.attackWeaponType == 3) - { - // searching shield - const WeaponsInfos &shields = WeaponsDB::getShields(); - FOR_EACH (WeaponsInfosIter, it, shields) - { - item = inv->findItem(*it, ItemColor_zero); - if (item != nullptr) - break; - } - if ((item != nullptr) && item->isEquipped() == Equipped_false) - PlayerInfo::equipItem(item, Sfx_true); - } - } - // big distance. allowed only bow - else - { - // searching bow - const WeaponsInfos &bows = WeaponsDB::getBows(); - FOR_EACH (WeaponsInfosIter, it, bows) - { - item = inv->findItem(*it, ItemColor_zero); - if (item != nullptr) - break; - } - - // no bow - if (item == nullptr) - return; - - if (item->isEquipped() == Equipped_false) - PlayerInfo::equipItem(item, Sfx_true); - } -} - -bool LocalPlayer::isReachable(Being *const being, - const int maxCost) -{ - if ((being == nullptr) || (mMap == nullptr)) - return false; - - if (being->getReachable() == Reachable::REACH_NO) - return false; - - if (being->mX == mX && - being->mY == mY) - { - being->setDistance(0); - being->setReachable(Reachable::REACH_YES); - return true; - } - else if (being->mX - 1 <= mX && - being->mX + 1 >= mX && - being->mY - 1 <= mY && - being->mY + 1 >= mY) - { - being->setDistance(1); - being->setReachable(Reachable::REACH_YES); - return true; - } - - const Path debugPath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - being->mX, - being->mY, - getBlockWalkMask(), - maxCost); - - being->setDistance(CAST_S32(debugPath.size())); - if (!debugPath.empty()) - { - being->setReachable(Reachable::REACH_YES); - return true; - } - being->setReachable(Reachable::REACH_NO); - return false; -} - -bool LocalPlayer::isReachable(const int x, const int y, - const bool allowCollision) const -{ - const WalkLayer *const walk = mMap->getWalkLayer(); - if (walk == nullptr) - return false; - int num = walk->getDataAt(x, y); - if (allowCollision && num < 0) - num = -num; - - return walk->getDataAt(mX, mY) == num; -} - -bool LocalPlayer::pickUpItems(int pickUpType) -{ - if (actorManager == nullptr) - return false; - - bool status = false; - int x = mX; - int y = mY; - - // first pick up item on player position - FloorItem *item = - actorManager->findItem(x, y); - if (item != nullptr) - status = pickUp(item); - - if (pickUpType == 0) - pickUpType = settings.pickUpType; - - if (pickUpType == 0) - return status; - - int x1, y1, x2, y2; - switch (pickUpType) - { - case 1: - switch (mDirection) - { - case BeingDirection::UP : --y; break; - case BeingDirection::DOWN : ++y; break; - case BeingDirection::LEFT : --x; break; - case BeingDirection::RIGHT: ++x; break; - default: break; - } - item = actorManager->findItem(x, y); - if (item != nullptr) - status = pickUp(item); - break; - case 2: - switch (mDirection) - { - case BeingDirection::UP: - x1 = x - 1; y1 = y - 1; x2 = x + 1; y2 = y; break; - case BeingDirection::DOWN: - x1 = x - 1; y1 = y; x2 = x + 1; y2 = y + 1; break; - case BeingDirection::LEFT: - x1 = x - 1; y1 = y - 1; x2 = x; y2 = y + 1; break; - case BeingDirection::RIGHT: - x1 = x; y1 = y - 1; x2 = x + 1; y2 = y + 1; break; - default: - x1 = x; x2 = x; y1 = y; y2 = y; break; - } - if (actorManager->pickUpAll(x1, y1, x2, y2)) - status = true; - break; - case 3: - if (actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1)) - status = true; - break; - - case 4: - if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1)) - { - if (actorManager->pickUpNearest(x, y, 4)) - status = true; - } - else - { - status = true; - } - break; - - case 5: - if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1)) - { - if (actorManager->pickUpNearest(x, y, 8)) - status = true; - } - else - { - status = true; - } - break; - - case 6: - if (!actorManager->pickUpAll(x - 1, y - 1, x + 1, y + 1)) - { - if (actorManager->pickUpNearest(x, y, 90)) - status = true; - } - else - { - status = true; - } - break; - - default: - break; - } - return status; -} - - -void LocalPlayer::moveByDirection(const unsigned char dir) -{ - int dx = 0, dy = 0; - if ((dir & BeingDirection::UP) != 0) - dy--; - if ((dir & BeingDirection::DOWN) != 0) - dy++; - if ((dir & BeingDirection::LEFT) != 0) - dx--; - if ((dir & BeingDirection::RIGHT) != 0) - dx++; - move(dx, dy); -} - -void LocalPlayer::specialMove(const unsigned char direction) -{ - if ((direction != 0u) && ((mNavigateX != 0) || (mNavigateY != 0))) - navigateClean(); - - if ((direction != 0u) && (settings.moveType >= 2 - && settings.moveType <= 4)) - { - if (mAction == BeingAction::MOVE) - return; - - unsigned int max; - - if (settings.moveType == 2) - max = 5; - else if (settings.moveType == 4) - max = 1; - else - max = 3; - - if (getMoveState() < max) - { - moveByDirection(direction); - mMoveState ++; - } - else - { - mMoveState = 0; - crazyMoves->crazyMove(); - } - } - else - { - setWalkingDir(direction); - } -} - -#ifdef TMWA_SUPPORT -void LocalPlayer::magicAttack() const -{ - if (Net::getNetworkType() != ServerType::TMWATHENA) - return; - if (chatWindow == nullptr || - !isAlive() || - !playerHandler->canUseMagic()) - { - return; - } - - switch (settings.magicAttackType) - { - // flar W00 - case 0: - tryMagic("#flar", 1, 0, 10); - break; - // chiza W01 - case 1: - tryMagic("#chiza", 1, 0, 9); - break; - // ingrav W10 - case 2: - tryMagic("#ingrav", 2, 2, 20); - break; - // frillyar W11 - case 3: - tryMagic("#frillyar", 2, 2, 25); - break; - // upmarmu W12 - case 4: - tryMagic("#upmarmu", 2, 2, 20); - break; - default: - break; - } -} - -void LocalPlayer::tryMagic(const std::string &spell, const int baseMagic, - const int schoolMagic, const int mana) -{ - if (chatWindow == nullptr) - return; - - if (PlayerInfo::getSkillLevel(340) >= baseMagic - && PlayerInfo::getSkillLevel(342) >= schoolMagic) - { - if (PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= mana) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_CHAT)) - return; - - chatWindow->localChatInput(spell); - } - } -} -#endif // TMWA_SUPPORT - -void LocalPlayer::loadHomes() -{ - std::string buf; - std::stringstream ss(serverConfig.getValue("playerHomes", "")); - - while (ss >> buf) - { - Vector pos; - ss >> pos.x; - ss >> pos.y; - mHomes[buf] = pos; - } -} - -void LocalPlayer::setMap(Map *const map) -{ - BLOCK_START("LocalPlayer::setMap") - if (map != nullptr) - { - if (socialWindow != nullptr) - socialWindow->updateActiveList(); - } - navigateClean(); - mCrossX = 0; - mCrossY = 0; - - Being::setMap(map); - updateNavigateList(); - BLOCK_END("LocalPlayer::setMap") -} - -void LocalPlayer::setHome() -{ - if ((mMap == nullptr) || (socialWindow == nullptr)) - return; - - SpecialLayer *const specialLayer = mMap->getSpecialLayer(); - - if (specialLayer == nullptr) - return; - - const std::string key = mMap->getProperty("_realfilename"); - Vector pos = mHomes[key]; - - if (mAction == BeingAction::SIT) - { - const std::map::const_iterator - iter = mHomes.find(key); - - if (iter != mHomes.end()) - { - socialWindow->removePortal(CAST_S32(pos.x), - CAST_S32(pos.y)); - } - - if (iter != mHomes.end() && mX == CAST_S32(pos.x) - && mY == CAST_S32(pos.y)) - { - mMap->updatePortalTile("", MapItemType::EMPTY, - CAST_S32(pos.x), CAST_S32(pos.y)); - - mHomes.erase(key); - socialWindow->removePortal(CAST_S32(pos.x), - CAST_S32(pos.y)); - } - else - { - if (iter != mHomes.end()) - { - specialLayer->setTile(CAST_S32(pos.x), - CAST_S32(pos.y), MapItemType::EMPTY); - specialLayer->updateCache(); - } - - pos.x = static_cast(mX); - pos.y = static_cast(mY); - mHomes[key] = pos; - mMap->updatePortalTile("home", MapItemType::HOME, - mX, mY); - socialWindow->addPortal(mX, mY); - } - MapItem *const mapItem = specialLayer->getTile(mX, mY); - if (mapItem != nullptr) - { - const int idx = socialWindow->getPortalIndex(mX, mY); - mapItem->setName(KeyboardConfig::getKeyShortString( - OutfitWindow::keyName(idx))); - } - saveHomes(); - } - else - { - MapItem *mapItem = specialLayer->getTile(mX, mY); - int type = 0; - - const std::map::iterator iter = mHomes.find(key); - if (iter != mHomes.end() && mX == pos.x && mY == pos.y) - { - mHomes.erase(key); - saveHomes(); - } - - if ((mapItem == nullptr) || mapItem->getType() == MapItemType::EMPTY) - { - if ((mDirection & BeingDirection::UP) != 0) - type = MapItemType::ARROW_UP; - else if ((mDirection & BeingDirection::LEFT) != 0) - type = MapItemType::ARROW_LEFT; - else if ((mDirection & BeingDirection::DOWN) != 0) - type = MapItemType::ARROW_DOWN; - else if ((mDirection & BeingDirection::RIGHT) != 0) - type = MapItemType::ARROW_RIGHT; - } - else - { - type = MapItemType::EMPTY; - } - mMap->updatePortalTile("", type, mX, mY); - - if (type != MapItemType::EMPTY) - { - socialWindow->addPortal(mX, mY); - mapItem = specialLayer->getTile(mX, mY); - if (mapItem != nullptr) - { - const int idx = socialWindow->getPortalIndex(mX, mY); - mapItem->setName(KeyboardConfig::getKeyShortString( - OutfitWindow::keyName(idx))); - } - } - else - { - specialLayer->setTile(mX, mY, MapItemType::EMPTY); - specialLayer->updateCache(); - socialWindow->removePortal(mX, mY); - } - } -} - -void LocalPlayer::saveHomes() -{ - std::stringstream ss; - - for (std::map::const_iterator iter = mHomes.begin(), - iter_fend = mHomes.end(); - iter != iter_fend; - ++iter) - { - const Vector &pos = (*iter).second; - - if (iter != mHomes.begin()) - ss << " "; - ss << (*iter).first << " " << pos.x << " " << pos.y; - } - - serverConfig.setValue("playerHomes", ss.str()); -} - -void LocalPlayer::pingRequest() -{ - const int time = tick_time; - if (mWaitPing == true && mPingSendTick != 0) - { - if (time >= mPingSendTick && (time - mPingSendTick) > 1000) - return; - } - - mPingSendTick = time; - mWaitPing = true; - beingHandler->requestNameById(getId()); -} - -std::string LocalPlayer::getPingTime() const -{ - std::string str; - if (!mWaitPing) - { - if (mPingTime == 0) - str = "?"; - else - str = toString(CAST_S32(mPingTime)); - } - else - { - time_t time = tick_time; - if (time > mPingSendTick) - time -= mPingSendTick; - else - time += MAX_TICK_VALUE - mPingSendTick; - if (time <= mPingTime) - time = mPingTime; - if (mPingTime != time) - str = strprintf("%d (%d)", CAST_S32(mPingTime), CAST_S32(time)); - else - str = toString(CAST_S32(time)); - } - return str; -} - -void LocalPlayer::pingResponse() -{ - if (mWaitPing == true && mPingSendTick > 0) - { - mWaitPing = false; - const int time = tick_time; - if (time < mPingSendTick) - { - mPingSendTick = 0; - mPingTime = 0; - } - else - { - mPingTime = (time - mPingSendTick) * 10; - } - } -} - -void LocalPlayer::tryPingRequest() -{ - if (mPingSendTick == 0 || tick_time < mPingSendTick - || (tick_time - mPingSendTick) > 200) - { - pingRequest(); - } -} - - -void LocalPlayer::setAway(const std::string &message) const -{ - setAfkMessage(message); - GameModifiers::changeAwayMode(true); - updateStatus(); -} - -void LocalPlayer::setAfkMessage(std::string message) -{ - if (!message.empty()) - { - if (message.size() > 4 && message.substr(0, 4) == "/me ") - { - message = message.substr(4); - config.setValue("afkFormat", 1); - } - else - { - config.setValue("afkFormat", 0); - } - serverConfig.setValue("afkMessage", message); - } -} - -void LocalPlayer::setPseudoAway(const std::string &message) -{ - setAfkMessage(message); - settings.pseudoAwayMode = !settings.pseudoAwayMode; -} - -void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick) -{ - if (settings.awayMode) - { - const time_t time = cur_time; - if (mAfkTime == 0 || time < mAfkTime - || time - mAfkTime > awayLimitTimer) - { - std::string str(serverConfig.getValue("afkMessage", - "I am away from keyboard.")); - if (str.find("'NAME'") != std::string::npos) - replaceAll(str, "'NAME'", nick); - - std::string msg("*AFK*: " + str); - - if (config.getIntValue("afkFormat") == 1) - msg = "*" + msg + "*"; - - if (tab == nullptr) - { - chatHandler->privateMessage(nick, msg); - if (localChatTab != nullptr) - { - localChatTab->chatLog(std::string(mName).append( - " : ").append(msg), - ChatMsgType::ACT_WHISPER, - IgnoreRecord_false); - } - } - else - { - if (tab->getNoAway()) - return; - chatHandler->privateMessage(nick, msg); - tab->chatLog(mName, msg); - } - mAfkTime = time; - } - } -} - -bool LocalPlayer::navigateTo(const int x, const int y) -{ - if (mMap == nullptr) - return false; - - SpecialLayer *const tmpLayer = mMap->getTempLayer(); - if (tmpLayer == nullptr) - return false; - - mShowNavigePath = true; - mOldX = mPixelX; - mOldY = mPixelY; - mOldTileX = mX; - mOldTileY = mY; - mNavigateX = x; - mNavigateY = y; - mNavigateId = BeingId_zero; - - mNavigatePath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - x, - y, - getBlockWalkMask(), - 0); - - if (mDrawPath) - tmpLayer->addRoad(mNavigatePath); - return !mNavigatePath.empty(); -} - -void LocalPlayer::navigateClean() -{ - if (mMap == nullptr) - return; - - mShowNavigePath = false; - mOldX = 0; - mOldY = 0; - mOldTileX = 0; - mOldTileY = 0; - mNavigateX = 0; - mNavigateY = 0; - mNavigateId = BeingId_zero; - - mNavigatePath.clear(); - - SpecialLayer *const tmpLayer = mMap->getTempLayer(); - if (tmpLayer == nullptr) - return; - - tmpLayer->clean(); -} - -void LocalPlayer::updateMusic() const -{ - if (mMap != nullptr) - { - std::string str = mMap->getObjectData(mX, mY, MapItemType::MUSIC); - if (str.empty()) - str = mMap->getMusicFile(); - if (str != soundManager.getCurrentMusicFile()) - { - if (str.empty()) - soundManager.fadeOutMusic(); - else - soundManager.fadeOutAndPlayMusic(str); - } - } -} - -void LocalPlayer::updateCoords() -{ - Being::updateCoords(); - - // probably map not loaded. - if ((mPixelX == 0) || (mPixelY == 0)) - return; - - if (mX != mOldTileX || mY != mOldTileY) - { - if (socialWindow != nullptr) - socialWindow->updatePortals(); - PopupManager::hideBeingPopup(); - updateMusic(); - } - - if ((mMap != nullptr) && (mX != mOldTileX || mY != mOldTileY)) - { - SpecialLayer *const tmpLayer = mMap->getTempLayer(); - if (tmpLayer == nullptr) - return; - - const int x = (mPixelX - mapTileSize / 2) / mapTileSize; - const int y = (mPixelY - mapTileSize) / mapTileSize; - if (mNavigateId != BeingId_zero) - { - if (actorManager == nullptr) - { - navigateClean(); - return; - } - - const Being *const being = actorManager - ->findBeing(mNavigateId); - if (being == nullptr) - { - navigateClean(); - return; - } - mNavigateX = being->mX; - mNavigateY = being->mY; - } - - if (mNavigateX == x && mNavigateY == y) - { - navigateClean(); - return; - } - for (Path::const_iterator i = mNavigatePath.begin(), - i_fend = mNavigatePath.end(); - i != i_fend; - ++i) - { - if ((*i).x == mX && (*i).y == mY) - { - mNavigatePath.pop_front(); - fixPos(); - break; - } - } - if (mDrawPath && mShowNavigePath) - { - tmpLayer->clean(); - tmpLayer->addRoad(mNavigatePath); - } - } - mOldX = mPixelX; - mOldY = mPixelY; - mOldTileX = mX; - mOldTileY = mY; -} - -void LocalPlayer::targetMoved() const -{ -/* - if (mKeepAttacking) - { - if (mTarget && mServerAttack == Keep_true) - { - logger->log("LocalPlayer::targetMoved0"); - if (!PacketLimiter::limitPackets(PacketType::PACKET_ATTACK)) - return; - logger->log("LocalPlayer::targetMoved"); - playerHandler->attack(mTarget->getId(), mServerAttack); - } - } -*/ -} - -int LocalPlayer::getPathLength(const Being *const being) const -{ - if ((mMap == nullptr) || (being == nullptr)) - return 0; - - if (being->mX == mX && being->mY == mY) - return 0; - - if (being->mX - 1 <= mX && - being->mX + 1 >= mX && - being->mY - 1 <= mY && - being->mY + 1 >= mY) - { - return 1; - } - - if (mTargetOnlyReachable) - { - const Path debugPath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - being->mX, - being->mY, - getBlockWalkMask(), - 0); - return CAST_S32(debugPath.size()); - } - - const int dx = CAST_S32(abs(being->mX - mX)); - const int dy = CAST_S32(abs(being->mY - mY)); - if (dx > dy) - return dx; - return dy; -} - -int LocalPlayer::getAttackRange2() const -{ - int range = getAttackRange(); - if (range == 1) - range = 2; - return range; -} - -void LocalPlayer::attack2(Being *const target, const bool keep, - const bool dontChangeEquipment) -{ - if (!dontChangeEquipment && (target != nullptr)) - changeEquipmentBeforeAttack(target); - - const bool broken = (Net::getNetworkType() == ServerType::TMWATHENA); - - // probably need cache getPathLength(target) - if ((target == nullptr || - settings.attackType == 0 || - settings.attackType == 3) || - (withinAttackRange(target, broken, broken ? 1 : 0) && - getPathLength(target) <= getAttackRange2())) - { - attack(target, keep); - if (settings.attackType == 2) - { - if (target == nullptr) - { - if (pickUpItems()) - return; - } - else - { - pickUpItems(3); - } - } - } - else if (mPickUpTarget == nullptr) - { - if (settings.attackType == 2) - { - if (pickUpItems()) - return; - } - setTarget(target); - if (target->getType() != ActorType::Npc) - { - mKeepAttacking = true; - moveToTarget(); - } - } -} - -void LocalPlayer::setFollow(const std::string &player) -{ - mPlayerFollowed = player; - if (!mPlayerFollowed.empty()) - { - // TRANSLATORS: follow command message - std::string msg = strprintf(_("Follow: %s"), player.c_str()); - debugMsg(msg); - } - else - { - // TRANSLATORS: follow command message - debugMsg(_("Follow canceled")); - } -} - -void LocalPlayer::setImitate(const std::string &player) -{ - mPlayerImitated = player; - if (!mPlayerImitated.empty()) - { - // TRANSLATORS: imitate command message - std::string msg = strprintf(_("Imitation: %s"), player.c_str()); - debugMsg(msg); - } - else - { - // TRANSLATORS: imitate command message - debugMsg(_("Imitation canceled")); - } -} - -void LocalPlayer::cancelFollow() -{ - if (!mPlayerFollowed.empty()) - { - // TRANSLATORS: cancel follow message - debugMsg(_("Follow canceled")); - } - if (!mPlayerImitated.empty()) - { - // TRANSLATORS: cancel follow message - debugMsg(_("Imitation canceled")); - } - mPlayerFollowed.clear(); - mPlayerImitated.clear(); -} - -void LocalPlayer::imitateEmote(const Being *const being, - const unsigned char action) const -{ - if (being == nullptr) - return; - - std::string player_imitated = getImitate(); - if (!player_imitated.empty() && being->mName == player_imitated) - emote(action); -} - -void LocalPlayer::imitateAction(const Being *const being, - const BeingActionT &action) -{ - if (being == nullptr) - return; - - if (!mPlayerImitated.empty() && being->mName == mPlayerImitated) - { - setAction(action, 0); - playerHandler->changeAction(action); - } -} - -void LocalPlayer::imitateDirection(const Being *const being, - const unsigned char dir) -{ - if (being == nullptr) - return; - - if (!mPlayerImitated.empty() && being->mName == mPlayerImitated) - { - if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION)) - return; - - if (settings.followMode == 2) - { - uint8_t dir2 = 0; - if ((dir & BeingDirection::LEFT) != 0) - dir2 |= BeingDirection::RIGHT; - else if ((dir & BeingDirection::RIGHT) != 0) - dir2 |= BeingDirection::LEFT; - if ((dir & BeingDirection::UP) != 0) - dir2 |= BeingDirection::DOWN; - else if ((dir & BeingDirection::DOWN) != 0) - dir2 |= BeingDirection::UP; - - setDirection(dir2); - playerHandler->setDirection(dir2); - } - else - { - setDirection(dir); - playerHandler->setDirection(dir); - } - } -} - -void LocalPlayer::imitateOutfit(const Being *const player, - const int sprite) const -{ - if (player == nullptr) - return; - - if (settings.imitationMode == 1 && - !mPlayerImitated.empty() && - player->mName == mPlayerImitated) - { - if (sprite < 0 || sprite >= player->getNumberOfLayers()) - return; - - const AnimatedSprite *const equipmentSprite - = dynamic_cast( - player->mSprites[sprite]); - - if (equipmentSprite != nullptr) - { -// logger->log("have equipmentSprite"); - const Inventory *const inv = PlayerInfo::getInventory(); - if (inv == nullptr) - return; - - const std::string &path = equipmentSprite->getIdPath(); - if (path.empty()) - return; - -// logger->log("idPath: " + path); - const Item *const item = inv->findItemBySprite(path, - player->getGender(), player->getSubType()); - if ((item != nullptr) && item->isEquipped() == Equipped_false) - PlayerInfo::equipItem(item, Sfx_false); - } - else - { -// logger->log("have unequip %d", sprite); - const int equipmentSlot = inventoryHandler - ->convertFromServerSlot(sprite); -// logger->log("equipmentSlot: " + toString(equipmentSlot)); - if (equipmentSlot == inventoryHandler->getProjectileSlot()) - return; - - const Item *const item = PlayerInfo::getEquipment(equipmentSlot); - if (item != nullptr) - { -// logger->log("unequiping"); - PlayerInfo::unequipItem(item, Sfx_false); - } - } - } -} - -void LocalPlayer::followMoveTo(const Being *const being, - const int x, const int y) -{ - if ((being != nullptr) && - !mPlayerFollowed.empty() && - being->mName == mPlayerFollowed) - { - mPickUpTarget = nullptr; - navigateTo(x, y); - } -} - -void LocalPlayer::followMoveTo(const Being *const being, - const int x1, const int y1, - const int x2, const int y2) -{ - if (being == nullptr) - return; - - mPickUpTarget = nullptr; - if (!mPlayerFollowed.empty() && - being->mName == mPlayerFollowed) - { - switch (settings.followMode) - { - case 0: - navigateTo(x1, y1); - setNextDest(x2, y2); - break; - case 1: - if (x1 != x2 || y1 != y2) - { - navigateTo(mX + x2 - x1, mY + y2 - y1); - setNextDest(mX + x2 - x1, mY + y2 - y1); - } - break; - case 2: - if (x1 != x2 || y1 != y2) - { - navigateTo(mX + x1 - x2, mY + y1 - y2); - setNextDest(mX + x1 - x2, mY + y1 - y2); - } - break; - case 3: - if (mTarget == nullptr || - mTarget->mName != mPlayerFollowed) - { - if (actorManager != nullptr) - { - Being *const b = actorManager->findBeingByName( - mPlayerFollowed, ActorType::Player); - setTarget(b); - } - } - moveToTarget(); - setNextDest(x2, y2); - break; - default: - break; - } - } -} - -void LocalPlayer::setNextDest(const int x, const int y) -{ - mNextDestX = x; - mNextDestY = y; -} - -bool LocalPlayer::allowAction() -{ - if (mIsServerBuggy) - { - if (mLastAction != -1) - return false; - mLastAction = tick_time; - } - return true; -} - -void LocalPlayer::fixPos() -{ - if ((mCrossX == 0) && (mCrossY == 0)) - return; - - const int dx = abs(mX - mCrossX); - const int dy = abs(mY - mCrossY); - const int dist = dx > dy ? dx : dy; - const time_t time = cur_time; - const int maxDist = mSyncPlayerMove ? mSyncPlayerMoveDistance : 7; - - if (dist > maxDist) - { - mActivityTime = time; - setTileCoords(mCrossX, mCrossY); -// alternative way to fix, move to real position -// setDestination(mCrossX, mCrossY); - } -} - -void LocalPlayer::setRealPos(const int x, const int y) -{ - if (mMap == nullptr) - return; - - SpecialLayer *const layer = mMap->getTempLayer(); - if (layer != nullptr) - { - bool cacheUpdated(false); - if (((mCrossX != 0) || (mCrossY != 0)) && - (layer->getTile(mCrossX, mCrossY) != nullptr) && - layer->getTile(mCrossX, mCrossY)->getType() == MapItemType::CROSS) - { - layer->setTile(mCrossX, mCrossY, MapItemType::EMPTY); - layer->updateCache(); - cacheUpdated = true; - } - - if (mShowServerPos) - { - const MapItem *const mapItem = layer->getTile(x, y); - - if (mapItem == nullptr || - mapItem->getType() == MapItemType::EMPTY) - { - if (mX != x && mY != y) - { - layer->setTile(x, y, MapItemType::CROSS); - if (cacheUpdated == false) - layer->updateCache(); - } - } - } - - if (mCrossX != x || mCrossY != y) - { - mCrossX = x; - mCrossY = y; - } - } - if (mMap->isCustom()) - mMap->setWalk(x, y); -} -void LocalPlayer::fixAttackTarget() -{ - if ((mMap == nullptr) || (mTarget == nullptr)) - return; - - if (settings.moveToTargetType == 11 || (settings.attackType == 0u) - || !config.getBoolValue("autofixPos")) - { - return; - } - - const Path debugPath = mMap->findPath( - (mPixelX - mapTileSize / 2) / mapTileSize, - (mPixelY - mapTileSize) / mapTileSize, - mTarget->mX, - mTarget->mY, - getBlockWalkMask(), - 0); - - if (!debugPath.empty()) - { - const Path::const_iterator i = debugPath.begin(); - setDestination((*i).x, (*i).y); - } -} - -void LocalPlayer::respawn() -{ - navigateClean(); -} - -int LocalPlayer::getLevel() const -{ - return PlayerInfo::getAttribute(Attributes::PLAYER_BASE_LEVEL); -} - -void LocalPlayer::updateNavigateList() -{ - if (mMap != nullptr) - { - const std::map::const_iterator iter = - mHomes.find(mMap->getProperty("_realfilename")); - - if (iter != mHomes.end()) - { - const Vector &pos = mHomes[(*iter).first]; - if ((pos.x != 0.0f) && (pos.y != 0.0f)) - { - mMap->addPortalTile("home", MapItemType::HOME, - CAST_S32(pos.x), CAST_S32(pos.y)); - } - } - } -} - -void LocalPlayer::failMove(const int x A_UNUSED, - const int y A_UNUSED) -{ -} - -void LocalPlayer::waitFor(const std::string &nick) -{ - mWaitFor = nick; -} - -void LocalPlayer::checkNewName(Being *const being) -{ - if (being == nullptr) - return; - - const std::string &nick = being->mName; - if (being->getType() == ActorType::Player) - { - const Guild *const guild = getGuild(); - if (guild != nullptr) - { - const GuildMember *const gm = guild->getMember(nick); - if (gm != nullptr) - { - const int level = gm->getLevel(); - if (level > 1 && being->getLevel() != level) - { - being->setLevel(level); - being->updateName(); - } - } - } - if (chatWindow != nullptr) - { - WhisperTab *const tab = chatWindow->getWhisperTab(nick); - if (tab != nullptr) - tab->setWhisperTabColors(); - } - } - - if (!mWaitFor.empty() && mWaitFor == nick) - { - // TRANSLATORS: wait player/monster message - debugMsg(strprintf(_("You see %s"), mWaitFor.c_str())); - soundManager.playGuiSound(SOUND_INFO); - mWaitFor.clear(); - } -} - -unsigned char LocalPlayer::getBlockWalkMask() const -{ - // for now blocking all types of collisions - return BlockMask::WALL | - BlockMask::AIR | - BlockMask::WATER | - BlockMask::PLAYERWALL; -} - -void LocalPlayer::removeHome() -{ - if (mMap == nullptr) - return; - - const std::string key = mMap->getProperty("_realfilename"); - const std::map::iterator iter = mHomes.find(key); - - if (iter != mHomes.end()) - mHomes.erase(key); -} - -void LocalPlayer::stopAdvert() -{ - mBlockAdvert = true; -} - -bool LocalPlayer::checAttackPermissions(const Being *const target) -{ - if (target == nullptr) - return false; - - switch (settings.pvpAttackType) - { - case 0: - return true; - case 1: - return !(playerRelations.getRelation(target->mName) - == Relation::FRIEND); - case 2: - return playerRelations.checkBadRelation(target->mName); - default: - case 3: - return false; - } -} - -void LocalPlayer::updateStatus() const -{ - if (serverFeatures->havePlayerStatusUpdate() && mEnableAdvert) - { - uint8_t status = 0; - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - if (mTradebot && - shopWindow != nullptr && - !shopWindow->isShopEmpty()) - { - status |= BeingFlag::SHOP; - } - } - if (settings.awayMode || settings.pseudoAwayMode) - status |= BeingFlag::AWAY; - - if (mInactive) - status |= BeingFlag::INACTIVE; - - playerHandler->updateStatus(status); - } -} - -void LocalPlayer::setTestParticle(const std::string &fileName, - const bool updateHash) -{ - mTestParticleName = fileName; - mTestParticleTime = cur_time; - if (mTestParticle != nullptr) - { - mChildParticleEffects.removeLocally(mTestParticle); - mTestParticle = nullptr; - } - if (!fileName.empty()) - { - mTestParticle = particleEngine->addEffect(fileName, 0, 0, 0); - controlCustomParticle(mTestParticle); - if (updateHash) - mTestParticleHash = UpdaterWindow::getFileHash(mTestParticleName); - } -} - -void LocalPlayer::playerDeath() -{ - if (mAction != BeingAction::DEAD) - { - setAction(BeingAction::DEAD, 0); - recalcSpritesOrder(); - } -} - -bool LocalPlayer::canMove() const -{ - return !mFreezed && - mAction != BeingAction::DEAD && - (serverFeatures->haveMoveWhileSit() || - mAction != BeingAction::SIT); -} - -void LocalPlayer::freezeMoving(const int timeWaitTicks) -{ - if (timeWaitTicks <= 0) - return; - const int nextTime = tick_time + timeWaitTicks; - if (mUnfreezeTime < nextTime) - mUnfreezeTime = nextTime; - if (mUnfreezeTime > 0) - mFreezed = true; -} diff --git a/src/being/localplayer.h b/src/being/localplayer.h deleted file mode 100644 index 897e4dc00..000000000 --- a/src/being/localplayer.h +++ /dev/null @@ -1,533 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_LOCALPLAYER_H -#define BEING_LOCALPLAYER_H - -#include "being/being.h" - -#include "enums/being/pickup.h" -#include "enums/being/visiblename.h" - -#include "enums/simpletypes/allowsort.h" -#include "enums/simpletypes/keep.h" - -#include "listeners/actorspritelistener.h" -#include "listeners/attributelistener.h" -#include "listeners/playerdeathlistener.h" - -#include "localconsts.h" - -class AwayListener; -class ChatTab; -class FloorItem; -class Map; -class OkDialog; - -/** - * The local player character. - */ -class LocalPlayer final : public Being, - public ActorSpriteListener, - public AttributeListener, - public PlayerDeathListener -{ - public: - /** - * Constructor. - */ - explicit LocalPlayer(const BeingId id, - const BeingTypeId subType = BeingTypeId_zero); - - A_DELETE_COPY(LocalPlayer) - - /** - * Destructor. - */ - ~LocalPlayer(); - - void logic() override final; - - void slowLogic(); - - void setAction(const BeingActionT &action, - const int attackId) override final; - - /** - * Compute the next pathnode location when walking using keyboard. - * used by nextTile(). - */ - Position getNextWalkPosition(const unsigned char dir) - const A_WARN_UNUSED; - - /** - * Adds a new tile to the path when walking. - * @note Eathena - * Also, when specified, it picks up an item at the end of a path - * or attack target. - */ - void nextTile() override final - { nextTile(0); } - - void nextTile(unsigned char dir); - - bool pickUp(FloorItem *const item); - - /** - * Called when an ActorSprite has been destroyed. - * @param actorSprite the ActorSprite being destroyed. - */ - void actorSpriteDestroyed(const ActorSprite &actorSprite) - override final; - - /** - * Gets the attack range. - */ - int getAttackRange() const A_WARN_UNUSED; - - int getAttackRange2() const A_WARN_UNUSED; - - void attack(Being *const target = nullptr, const bool keep = false, - const bool dontChangeEquipment = false); - - void attack2(Being *const target = nullptr, const bool keep = false, - const bool dontChangeEquipment = false); - - void setGroupId(const int id) override final; - - void stopAttack(const bool keepAttack = false); - - void untarget(); - - /** - * Returns the current target of the player. Returns 0 if no being is - * currently targeted. - */ - Being *getTarget() const A_WARN_UNUSED; - - /** - * Sets the target being of the player. - */ - void setTarget(Being *const target); - - Being *setNewTarget(const ActorTypeT type, - const AllowSort allowSort); - - /** - * Sets a new destination for this being to walk to. - */ - void setDestination(const int x, const int y); - - /** - * Sets a new direction to keep walking in. - */ - void setWalkingDir(const unsigned char dir); - - /** - * Gets the walking direction - */ - unsigned char getWalkingDir() const noexcept2 A_WARN_UNUSED - { return mWalkingDir; } - - /** - * Sets going to being to attack - */ - void setGotoTarget(Being *const target); - - /** - * Returns whether the target is in range to attack - */ - bool withinAttackRange(const Being *const target, - const bool fixDistance = false, - const int addRange = 0) const A_WARN_UNUSED; - - /** - * Stops the player dead in his tracks - */ - void stopWalking(const bool sendToServer = true); - - bool toggleSit() const; - - bool updateSit() const; - - static bool emote(const uint8_t emotion); - - /** - * Shows item pickup notifications. - */ - void pickedUp(const ItemInfo &itemInfo, - const int amount, - const ItemColor color, - const BeingId floorItemId, - const PickupT fail); - - int getLevel() const override final A_WARN_UNUSED; - - /** Tells that the path has been set by mouse. */ - void pathSetByMouse() - { mPathSetByMouse = true; } - - /** Tells if the path has been set by mouse. */ - bool isPathSetByMouse() const noexcept2 A_WARN_UNUSED - { return mPathSetByMouse; } - - unsigned int getMoveState() const noexcept2 A_WARN_UNUSED - { return mMoveState; } - - void setMoveState(const unsigned int n) noexcept2 - { mMoveState = n; } - - std::string getPingTime() const A_WARN_UNUSED; - - void tryPingRequest(); - -#ifdef TMWA_SUPPORT - void magicAttack() const; -#endif // TMWA_SUPPORT - - void specialMove(const unsigned char direction); - - void moveByDirection(const unsigned char dir); - - bool pickUpItems(int pickUpType = 0); - - void move(const int dX, const int dY); - - void moveToTarget(int dist = -1); - - void moveToHome(); - - bool isReachable(Being *const being, - const int maxCost = 0) A_WARN_UNUSED; - - bool isReachable(const int x, const int y, - const bool allowCollision) const A_WARN_UNUSED; - - void setHome(); - - void pingRequest(); - - void pingResponse(); - - void setAway(const std::string &message) const; - - static void setPseudoAway(const std::string &message); - - void setHalfAway(const bool n) - { mInactive = n; } - - bool getHalfAway() const noexcept2 A_WARN_UNUSED - { return mInactive; } - - void afkRespond(ChatTab *const tab, const std::string &nick); - - static void setAfkMessage(std::string message); - - bool navigateTo(const int x, const int y); - - void navigateClean(); - - void imitateEmote(const Being *const being, - const unsigned char action) const; - - void imitateAction(const Being *const being, - const BeingActionT &action); - - void imitateDirection(const Being *const being, - const unsigned char dir); - - void imitateOutfit(const Being *const player, - const int sprite = -1) const; - - void followMoveTo(const Being *const being, const int x, const int y); - - void followMoveTo(const Being *const being, const int x1, const int y1, - const int x2, const int y2); - - bool allowAction() A_WARN_UNUSED; - - void setRealPos(const int x, const int y); - - bool isServerBuggy() const noexcept2 A_WARN_UNUSED - { return mIsServerBuggy; } - - void fixPos(); - - /** - * Sets the map the being is on - */ - void setMap(Map *const map) override final; - - void addMessageToQueue(const std::string &message, - const UserColorIdT color - = UserColorId::EXP_INFO); - - /** - * Called when a option (set with config.addListener()) is changed - */ - void optionChanged(const std::string &value) override final; - - void playerDeath() override final; - - /** - * set a following player. - */ - void setFollow(const std::string &player); - - /** - * set an imitation player. - */ - void setImitate(const std::string &player); - - /** - * setting the next destination of the following, in case of warp - */ - void setNextDest(const int x, const int y); - - int getNextDestX() const noexcept2 A_WARN_UNUSED - { return mNextDestX; } - - int getNextDestY() const noexcept2 A_WARN_UNUSED - { return mNextDestY; } - - void respawn(); - - const FloorItem *getPickUpTarget() const noexcept2 A_WARN_UNUSED - { return mPickUpTarget; } - - void unSetPickUpTarget() - { mPickUpTarget = nullptr; } - - /** - * Stop following a player. - */ - void cancelFollow(); - - /** - * Get the playername followed by the current player. - */ - const std::string &getFollow() const noexcept2 A_WARN_UNUSED - { return mPlayerFollowed; } - - /** - * Get the playername imitated by the current player. - */ - const std::string &getImitate() const noexcept2 A_WARN_UNUSED - { return mPlayerImitated; } - - /** - * Tells the engine whether to check - * if the Player Name is to be displayed. - */ - void setCheckNameSetting(const bool checked) - { mUpdateName = checked; } - - /** - * Gets if the engine has to check - * if the Player Name is to be displayed. - */ - bool getCheckNameSetting() const noexcept2 A_WARN_UNUSED - { return mUpdateName; } - - void fixAttackTarget(); - - void updateNavigateList(); - - int getPathLength(const Being *const being) const A_WARN_UNUSED; - - void targetMoved() const A_CONST; - - void setLastHitFrom(const std::string &n) - { mLastHitFrom = n; } - - void waitFor(const std::string &nick); - - void checkNewName(Being *const being); - - unsigned char getBlockWalkMask() const override final - A_CONST A_WARN_UNUSED; - - void saveHomes(); - - void removeHome(); - - void stopAdvert(); - - void addXpMessage(const int change); - - void addHomunXpMessage(const int change); - - void addJobMessage(const int change); - - void addHpMessage(const int change); - - void addSpMessage(const int change); - - static bool checAttackPermissions(const Being *const target) - A_WARN_UNUSED; - - void updateStatus() const; - - void setTestParticle(const std::string &fileName, - const bool updateHash = true); - - int getLastAttackX() const override final - { return mTarget != nullptr ? mTarget->mX : mLastAttackX; } - - int getLastAttackY() const override final - { return mTarget != nullptr ? mTarget->mY : mLastAttackY; } - - void attributeChanged(const AttributesT id, - const int64_t oldVal, - const int64_t newVal) override final; - - void updateMusic() const; - - void setAfkTime(const int v) noexcept2 - { mAfkTime = v; } - - void setAwayDialog(OkDialog *const dialog) - { mAwayDialog = dialog; } - - AwayListener *getAwayListener() const noexcept2 A_WARN_UNUSED - { return mAwayListener; } - - void setRename(const bool r) noexcept2 - { mAllowRename = r; } - - bool getRename() const noexcept2 - { return mAllowRename; } - - bool canMove() const; - - void freezeMoving(const int timeWaitTicks); - - void failMove(const int x, - const int y); - - protected: - void updateCoords() override final; - - void handleStatusEffect(const StatusEffect *const effect, - const int32_t effectId, - const Enable newStatus, - const IsStart start) override final; - - void startWalking(const unsigned char dir); - - void changeEquipmentBeforeAttack(const Being *const target) const; - -#ifdef TMWA_SUPPORT - static void tryMagic(const std::string &spell, - const int baseMagic, - const int schoolMagic, - const int mana); -#endif // TMWA_SUPPORT - - void loadHomes(); - - // move state. used if mMoveType == 2 - unsigned int mMoveState; - - int mLastTargetX; - int mLastTargetY; - - std::map mHomes; - - Being *mTarget; - - /** Follow system **/ - std::string mPlayerFollowed; - std::string mPlayerImitated; - int mNextDestX; - int mNextDestY; - - FloorItem *mPickUpTarget; - - int mLastAction; // Time stamp of the last action, -1 if none. - - STD_VECTOR mStatusEffectIcons; - - typedef std::pair MessagePair; - /** Queued messages*/ - std::list mMessages; - int mMessageTime; - AwayListener *mAwayListener; - OkDialog *mAwayDialog; - - int mPingSendTick; - time_t mPingTime; - time_t mAfkTime; - time_t mActivityTime; - int mNavigateX; - int mNavigateY; - BeingId mNavigateId; - int mCrossX; - int mCrossY; - int mOldX; - int mOldY; - int mOldTileX; - int mOldTileY; - Path mNavigatePath; - - std::string mLastHitFrom; - std::string mWaitFor; - time_t mAdvertTime; - Particle *mTestParticle; - std::string mTestParticleName; - time_t mTestParticleTime; - unsigned long mTestParticleHash; - int mSyncPlayerMoveDistance; - int mUnfreezeTime; - unsigned char mWalkingDir; // The direction the player is walking in. - /** Whether or not the name settings have changed */ - bool mUpdateName; - bool mBlockAdvert; - bool mTargetDeadPlayers; - Keep mServerAttack; - VisibleName::Type mVisibleNames; - bool mEnableAdvert; - bool mTradebot; - bool mTargetOnlyReachable; - bool mIsServerBuggy; - bool mSyncPlayerMove; - bool mDrawPath; - bool mAttackMoving; - bool mAttackNext; - bool mShowJobExp; - bool mShowServerPos; - bool mNextStep; - // temporary disable crazy moves in moves - bool mGoingToTarget; - // Whether or not to continue to attack - bool mKeepAttacking; - // Tells if the path was set using mouse - bool mPathSetByMouse; - bool mWaitPing; - bool mShowNavigePath; - bool mAllowRename; - bool mFreezed; -}; - -extern LocalPlayer *localPlayer; - -#endif // BEING_LOCALPLAYER_H diff --git a/src/being/mercenaryinfo.h b/src/being/mercenaryinfo.h deleted file mode 100644 index c25eeef49..000000000 --- a/src/being/mercenaryinfo.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_MERCENARYINFO_H -#define BEING_MERCENARYINFO_H - -#include "enums/simpletypes/beingid.h" -#include - -#include "localconsts.h" - -struct MercenaryInfo final -{ - MercenaryInfo() : - name(), - id(BeingId_zero), - level(0), - range(0) - { } - - A_DELETE_COPY(MercenaryInfo) - - std::string name; - BeingId id; - int level; - int range; -}; - -#endif // BEING_MERCENARYINFO_H diff --git a/src/being/petinfo.h b/src/being/petinfo.h deleted file mode 100644 index 5ede2cfb2..000000000 --- a/src/being/petinfo.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_PETINFO_H -#define BEING_PETINFO_H - -#include "enums/simpletypes/beingid.h" - -#include - -#include "localconsts.h" - -struct PetInfo final -{ - PetInfo() : - name(), - id(BeingId_zero), - level(0), - hungry(0), - intimacy(0), - race(0), - performance(0), - hairStyle(0), - equip(0) - { } - - A_DELETE_COPY(PetInfo) - - std::string name; - BeingId id; - int level; - int hungry; - int intimacy; - int race; - int performance; - int hairStyle; - int equip; -}; - -#endif // BEING_PETINFO_H diff --git a/src/being/playerignorestrategy.h b/src/being/playerignorestrategy.h deleted file mode 100644 index fb5dd5ebb..000000000 --- a/src/being/playerignorestrategy.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_PLAYERIGNORESTRATEGY_H -#define BEING_PLAYERIGNORESTRATEGY_H - -#include - -#include "localconsts.h" - -class Being; - -/** - * Ignore strategy: describes how we should handle ignores. - */ -class PlayerIgnoreStrategy notfinal -{ - public: - std::string mDescription; - std::string mShortName; - - A_DELETE_COPY(PlayerIgnoreStrategy) - - virtual ~PlayerIgnoreStrategy() - { } - - /** - * Handle the ignoring of the indicated action by the indicated player. - */ - virtual void ignore(Being *const being, - const unsigned int flags) const = 0; - protected: - PlayerIgnoreStrategy() : - mDescription(), - mShortName() - { - } -}; -#endif // BEING_PLAYERIGNORESTRATEGY_H diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp deleted file mode 100644 index 0a89bd7e1..000000000 --- a/src/being/playerinfo.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/playerinfo.h" - -#include "configuration.h" -#include "itemsoundmanager.h" - -#include "being/localplayer.h" - -#include "being/homunculusinfo.h" -#include "being/mercenaryinfo.h" -#include "being/petinfo.h" - -#include "gui/windows/inventorywindow.h" -#include "gui/windows/npcdialog.h" - -#include "listeners/statlistener.h" - -#include "net/homunculushandler.h" -#include "net/inventoryhandler.h" -#include "net/mercenaryhandler.h" -#include "net/playerhandler.h" - -#include "resources/item/item.h" - -#include "utils/delete2.h" - -#include "utils/translation/translationmanager.h" - -#include "debug.h" - -namespace PlayerInfo -{ - -PlayerInfoBackend mData; -int mCharId = 0; - -Inventory *mInventory = nullptr; -Inventory *mCartInventory = nullptr; -MercenaryInfo *mMercenary = nullptr; -HomunculusInfo *mHomunculus = nullptr; -PetInfo *mPet = nullptr; -std::string mRoomName; -Equipment *mEquipment = nullptr; -BeingId mPetBeingId = BeingId_zero; -GuildPositionFlags::Type mGuildPositionFlags = GuildPositionFlags::None; -BeingId mElementalId = BeingId_zero; - -Trading mTrading = Trading_false; -bool mVending = false; -int mLevelProgress = 0; -int mServerLanguage = -1; -std::set mProtectedItems; - -// --- Triggers --------------------------------------------------------------- - -void triggerAttr(const AttributesT id, - const int64_t old) -{ - AttributeListener::distributeEvent(id, old, - mData.mAttributes.find(id)->second); -} - -void triggerStat(const AttributesT id, - const int old1, - const int old2) -{ - StatListener::distributeEvent(id, old1, old2); -} - -// --- Attributes ------------------------------------------------------------- - -int64_t getAttribute64(const AttributesT id) -{ - const AtrIntMap::const_iterator it = mData.mAttributes.find(id); - if (it != mData.mAttributes.end()) - return it->second; - return 0; -} - -int32_t getAttribute(const AttributesT id) -{ - const AtrIntMap::const_iterator it = mData.mAttributes.find(id); - if (it != mData.mAttributes.end()) - return CAST_S32(it->second); - return 0; -} - -void setAttribute(const AttributesT id, - const int64_t value, - const Notify notify) -{ - const int64_t old = mData.mAttributes[id]; - mData.mAttributes[id] = value; - if (notify == Notify_true) - triggerAttr(id, old); -} - -int getSkillLevel(const int id) -{ - const IntMap::const_iterator it = mData.mSkills.find(id); - if (it != mData.mSkills.end()) - return it->second; - return 0; -} - -void setSkillLevel(const int id, const int value) -{ - mData.mSkills[id] = value; -} - -// --- Stats ------------------------------------------------------------------ - -int getStatBase(const AttributesT id) -{ - const StatMap::const_iterator it = mData.mStats.find(id); - if (it != mData.mStats.end()) - return it->second.base; - return 0; -} - -void setStatBase(const AttributesT id, const int value, const Notify notify) -{ - const int old = mData.mStats[id].base; - mData.mStats[id].base = value; - if (notify == Notify_true) - triggerStat(id, old, 0); -} - -int getStatMod(const AttributesT id) -{ - const StatMap::const_iterator it = mData.mStats.find(id); - if (it != mData.mStats.end()) - return it->second.mod; - return 0; -} - -void setStatMod(const AttributesT id, const int value, const Notify notify) -{ - const int old = mData.mStats[id].mod; - mData.mStats[id].mod = value; - if (notify == Notify_true) - triggerStat(id, old, 0); -} - -int getStatEffective(const AttributesT id) -{ - const StatMap::const_iterator it = mData.mStats.find(id); - if (it != mData.mStats.end()) - return it->second.base + it->second.mod; - return 0; -} - -const std::pair getStatExperience(const AttributesT id) -{ - const StatMap::const_iterator it = mData.mStats.find(id); - int a, b; - if (it != mData.mStats.end()) - { - a = it->second.exp; - b = it->second.expNeed; - } - else - { - a = 0; - b = 0; - } - return std::pair(a, b); -} - -void setStatExperience(const AttributesT id, - const int have, - const int need, - const Notify notify) -{ - Stat &stat = mData.mStats[id]; - - const int oldExp = stat.exp; - const int oldExpNeed = stat.expNeed; - stat.exp = have; - stat.expNeed = need; - if (notify == Notify_true) - triggerStat(id, oldExp, oldExpNeed); -} - -// --- Inventory / Equipment -------------------------------------------------- - -Inventory *getInventory() -{ - return mInventory; -} - -Inventory *getStorageInventory() -{ - if (inventoryHandler != nullptr) - return inventoryHandler->getStorage(); - return nullptr; -} - -Inventory *getCartInventory() -{ - return mCartInventory; -} - -void clearInventory() -{ - if (mEquipment != nullptr) - mEquipment->clear(); - if (mInventory != nullptr) - mInventory->clear(); -} - -Equipment *getEquipment() -{ - return mEquipment; -} - -const Item *getEquipment(const unsigned int slot) -{ - if (mEquipment != nullptr) - return mEquipment->getEquipment(slot); - return nullptr; -} - -void setEquipmentBackend(Equipment::Backend *const backend) -{ - if (mEquipment != nullptr) - mEquipment->setBackend(backend); -} - -void equipItem(const Item *const item, const Sfx sfx) -{ - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::EQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->equipItem(item); -} - -void unequipItem(const Item *const item, const Sfx sfx) -{ - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::UNEQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->unequipItem(item); -} - -void useItem(const Item *const item, const Sfx sfx) -{ - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::USE); - if (inventoryHandler != nullptr) - inventoryHandler->useItem(item); -} - -void useEquipItem(const Item *const item, - const int16_t useType, - const Sfx sfx) -{ - if (item != nullptr) - { - if (item->getType() == ItemType::Card) - { - if (mProtectedItems.find(item->getId()) == mProtectedItems.end()) - { - if (inventoryHandler != nullptr) - inventoryHandler->useCard(item); - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::USECARD); - } - } - else if (item->isEquipment() == Equipm_true) - { - if (item->isEquipped() == Equipped_true) - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::UNEQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->unequipItem(item); - } - else - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::EQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->equipItem(item); - } - } - else - { - if (mProtectedItems.find(item->getId()) == mProtectedItems.end()) - { - if (inventoryHandler != nullptr) - { - if (useType == 0) - inventoryHandler->useItem(item); - else - inventoryHandler->useItem(item, useType); - } - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::USE); - } - } - } -} - -void useEquipItem2(const Item *const item, - const int16_t useType, - const Sfx sfx) -{ - if (item != nullptr) - { - if (item->isEquipment() == Equipm_false) - { - if (item->isEquipped() == Equipped_true) - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::UNEQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->unequipItem(item); - } - else - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::EQUIP); - if (inventoryHandler != nullptr) - inventoryHandler->equipItem(item); - } - } - else - { - if (mProtectedItems.find(item->getId()) == mProtectedItems.end()) - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::USE); - if (inventoryHandler != nullptr) - { - if (useType == 0) - inventoryHandler->useItem(item); - else - inventoryHandler->useItem(item, useType); - } - } - } - } -} - -void dropItem(const Item *const item, const int amount, const Sfx sfx) -{ - if (item != nullptr && - mProtectedItems.find(item->getId()) == mProtectedItems.end()) - { - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::DROP); - if (inventoryHandler != nullptr) - inventoryHandler->dropItem(item, amount); - } -} - -void pickUpItem(const FloorItem *const item, const Sfx sfx) -{ - if (sfx == Sfx_true) - ItemSoundManager::playSfx(item, ItemSoundEvent::PICKUP); - if (playerHandler != nullptr) - playerHandler->pickUp(item); -} - -// --- Misc ------------------------------------------------------------------- - -void setBackend(const PlayerInfoBackend &backend) -{ - mData = backend; -} - -void setCharId(const int charId) -{ - mCharId = charId; -} - -int getCharId() -{ - return mCharId; -} - -Trading isTrading() -{ - return mTrading; -} - -void setTrading(const Trading trading) -{ - mTrading = trading; -} - -#define updateAttackStat(atk, delay, speed) \ - attackDelay = getStatBase(delay); \ - if (attackDelay != 0) \ - { \ - setStatBase(speed, \ - getStatBase(atk) * 1000 / attackDelay, \ - Notify_false); \ - setStatMod(speed, \ - getStatMod(atk) * 1000 / attackDelay, \ - Notify_true); \ - } \ - else \ - { \ - setStatBase(speed, 0, \ - Notify_false); \ - setStatMod(speed, 0, \ - Notify_true); \ - } - -void updateAttrs() -{ - int attackDelay; - updateAttackStat(Attributes::PLAYER_ATK, - Attributes::PLAYER_ATTACK_DELAY, - Attributes::PLAYER_ATTACK_SPEED) - updateAttackStat(Attributes::HOMUN_ATK, - Attributes::HOMUN_ATTACK_DELAY, - Attributes::HOMUN_ATTACK_SPEED) - updateAttackStat(Attributes::MERC_ATK, - Attributes::MERC_ATTACK_DELAY, - Attributes::MERC_ATTACK_SPEED) -} - -void init() -{ -} - -void deinit() -{ - clearInventory(); - delete2(mMercenary); - mPetBeingId = BeingId_zero; -} - -void loadData() -{ - mProtectedItems.clear(); - splitToIntSet(mProtectedItems, - serverConfig.getStringValue("protectedItems"), ','); -} - -void clear() -{ - mData.mSkills.clear(); - mPetBeingId = BeingId_zero; -} - -bool isTalking() -{ - return NpcDialog::isActive() || InventoryWindow::isStorageActive(); -} - -void gameDestroyed() -{ - delete2(mInventory); - delete2(mEquipment); - delete2(mCartInventory); -} - -void stateChange(const StateT state) -{ - if (state == State::GAME) - { - if (mInventory == nullptr) - { - mInventory = new Inventory(InventoryType::Inventory); - mEquipment = new Equipment; - mCartInventory = new Inventory(InventoryType::Cart); - } - } -} - -static void saveProtectedItems() -{ - std::string str; - std::set::const_iterator it = mProtectedItems.begin(); - std::set::const_iterator it_end = mProtectedItems.end(); - if (it != it_end) - { - str.append(toString(*it)); - ++ it; - } - while (it != it_end) - { - str.append(",").append(toString(*it)); - ++ it; - } - serverConfig.setValue("protectedItems", str); - serverConfig.write(); -} - -void protectItem(const int id) -{ - mProtectedItems.insert(id); - saveProtectedItems(); -} - -void unprotectItem(const int id) -{ - mProtectedItems.erase(id); - saveProtectedItems(); -} - -bool isItemProtected(const int id) -{ - return mProtectedItems.find(id) != mProtectedItems.end(); -} - -void setMercenary(MercenaryInfo *const info) -{ - delete mMercenary; - mMercenary = info; -} - -void setMercenaryBeing(Being *const being) -{ - if (being == nullptr || - mMercenary == nullptr) - { - return; - } - being->setName(mMercenary->name); - being->setOwner(localPlayer); - being->setLevel(mMercenary->level); - being->setAttackRange(mMercenary->range); -} - -void setElemental(const BeingId id) -{ - mElementalId = id; -} - -BeingId getElementalId() -{ - return mElementalId; -} - -MercenaryInfo *getMercenary() -{ - return mMercenary; -} - -void setPet(PetInfo *const info) -{ - delete mPet; - mPet = info; -} - -void setPetBeing(Being *const being) -{ - if (being != nullptr) - mPetBeingId = being->getId(); - else - mPetBeingId = BeingId_zero; - if (being == nullptr || - mPet == nullptr) - { - return; - } - being->setName(mPet->name); - being->setOwner(localPlayer); - being->setLevel(mPet->level); -} - -PetInfo *getPet() -{ - return mPet; -} - -BeingId getPetBeingId() -{ - return mPetBeingId; -} - -void setHomunculus(HomunculusInfo *const info) -{ - delete mHomunculus; - mHomunculus = info; -} - -void setHomunculusBeing(Being *const being) -{ - if (being == nullptr || - mHomunculus == nullptr) - { - return; - } - being->setName(mHomunculus->name); - being->setOwner(localPlayer); -} - -HomunculusInfo *getHomunculus() -{ - return mHomunculus; -} - -BeingId getHomunculusId() -{ - return mHomunculus != nullptr ? mHomunculus->id : BeingId_zero; -} - -BeingId getMercenaryId() -{ - return mMercenary != nullptr ? mMercenary->id : BeingId_zero; -} - -void updateAttackAi(const BeingId targetId, - const Keep keep) -{ - if (mMercenary != nullptr && - mercenaryHandler != nullptr) - { - mercenaryHandler->attack(targetId, keep); - } - if (mHomunculus != nullptr && - homunculusHandler != nullptr) - { - homunculusHandler->attack(targetId, keep); - } -} - -std::string getRoomName() -{ - return mRoomName; -} - -void setRoomName(const std::string &name) -{ - mRoomName = name; -} - -bool isInRoom() -{ - return !mRoomName.empty(); -} - -void setGuildPositionFlags(const GuildPositionFlags::Type pos) -{ - mGuildPositionFlags = pos; -} - -GuildPositionFlags::Type getGuildPositionFlags() -{ - return mGuildPositionFlags; -} - -void enableVending(const bool b) -{ - mVending = b; -} - -bool isVending() -{ - return mVending; -} - -void setServerLanguage(const int lang) -{ - if (lang != mServerLanguage) - { - mServerLanguage = lang; - TranslationManager::loadDictionaryLang(); - } -} - -int getServerLanguage() -{ - return mServerLanguage; -} - -} // namespace PlayerInfo diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h deleted file mode 100644 index 5528a1c3d..000000000 --- a/src/being/playerinfo.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_PLAYERINFO_H -#define BEING_PLAYERINFO_H - -#include "equipment.h" - -#include "enums/guildpositionflags.h" -#include "enums/state.h" - -#include "enums/being/attributes.h" - -#include "enums/simpletypes/beingid.h" -#include "enums/simpletypes/keep.h" -#include "enums/simpletypes/notify.h" -#include "enums/simpletypes/sfx.h" -#include "enums/simpletypes/trading.h" - -#include "utils/intmap.h" - -#include - -/** - * Stat information storage structure. - */ -struct Stat final -{ - A_DEFAULT_COPY(Stat) - - int base; - int mod; - int exp; - int expNeed; -}; - -typedef std::map AtrIntMap; -typedef std::map StatMap; - -/** - * Backend for core player information. - */ -struct PlayerInfoBackend final -{ - PlayerInfoBackend() : - mAttributes(), - mStats(), - mSkills() - { - } - - A_DEFAULT_COPY(PlayerInfoBackend) - - AtrIntMap mAttributes; - StatMap mStats; - IntMap mSkills; -}; - -class Being; -class FloorItem; -class Inventory; -class Item; - -struct HomunculusInfo; -struct MercenaryInfo; -struct PetInfo; - -/** - * A database like namespace which holds global info about the localplayer - * - */ -namespace PlayerInfo -{ -// --- Attributes ------------------------------------------------------------- - - /** - * Returns the value of the given attribute. - */ - int64_t getAttribute64(const AttributesT id) A_WARN_UNUSED; - - int32_t getAttribute(const AttributesT id) A_WARN_UNUSED; - - /** - * Changes the value of the given attribute. - */ - void setAttribute(const AttributesT id, - const int64_t value, - const Notify notify = Notify_true); - - int getSkillLevel(const int id) A_WARN_UNUSED; - - void setSkillLevel(const int id, const int value); - -// --- Stats ------------------------------------------------------------------ - - /** - * Returns the base value of the given stat. - */ - int getStatBase(const AttributesT id) A_WARN_UNUSED; - - /** - * Changes the base value of the given stat. - */ - void setStatBase(const AttributesT id, - const int value, - const Notify notify = Notify_true); - - /** - * Returns the modifier for the given stat. - */ - int getStatMod(const AttributesT id) A_WARN_UNUSED; - - /** - * Changes the modifier for the given stat. - */ - void setStatMod(const AttributesT id, - const int value, - const Notify notify = Notify_true); - - /** - * Returns the current effective value of the given stat. Effective is base - * + mod - */ - int getStatEffective(const AttributesT id) A_WARN_UNUSED; - - /** - * Changes the level of the given stat. - */ - void setStatLevel(AttributesT id, int value, Notify notify = Notify_true); - - /** - * Returns the experience of the given stat. - */ - const std::pair getStatExperience(const AttributesT id) - A_WARN_UNUSED; - - /** - * Changes the experience of the given stat. - */ - void setStatExperience(const AttributesT id, - const int have, - const int need, - const Notify notify = Notify_true); - -// --- Inventory / Equipment -------------------------------------------------- - - /** - * Returns the player's inventory. - */ - Inventory *getInventory() A_WARN_UNUSED; - - Inventory *getStorageInventory() A_WARN_UNUSED; - - Inventory *getCartInventory() A_WARN_UNUSED; - - /** - * Clears the player's inventory and equipment. - */ - void clearInventory(); - - void clear(); - - /** - * Returns the player's equipment. - */ - Equipment *getEquipment() A_WARN_UNUSED; - - /** - * Returns the player's equipment at the given slot. - */ - const Item *getEquipment(const unsigned int slot) A_WARN_UNUSED; - -// --- Misc ------------------------------------------------------------------- - - /** - * Changes the internal PlayerInfoBackend reference; - */ - void setBackend(const PlayerInfoBackend &backend); - - void setCharId(const int charId); - - int getCharId(); - - /** - * Returns true if the player is involved in a trade at the moment, false - * otherwise. - */ - Trading isTrading(); - - /** - * Sets whether the player is currently involved in trade or not. - */ - void setTrading(const Trading trading); - - void updateAttrs(); - - /** - * Initializes some internals. - */ - void init() A_CONST; - - void deinit(); - - void loadData(); - - bool isTalking(); - - void gameDestroyed(); - - void stateChange(const StateT state); - - void triggerAttr(const AttributesT id, - const int64_t old); - - void triggerStat(const AttributesT id, - const int old1, - const int old2); - - void setEquipmentBackend(Equipment::Backend *const backend); - - void equipItem(const Item *const item, const Sfx sfx); - - void unequipItem(const Item *const item, const Sfx sfx); - - void useItem(const Item *const item, const Sfx sfx); - - void useEquipItem(const Item *const item, - const int16_t useType, - const Sfx sfx); - - void useEquipItem2(const Item *const item, - const int16_t useType, - const Sfx sfx); - - void dropItem(const Item *const item, const int amount, const Sfx sfx); - - void pickUpItem(const FloorItem *const item, const Sfx sfx); - - void protectItem(const int id); - - void unprotectItem(const int id); - - bool isItemProtected(const int id); - - MercenaryInfo *getMercenary(); - - void setMercenary(MercenaryInfo *const info); - - void setMercenaryBeing(Being *const being); - - PetInfo *getPet(); - - void setPet(PetInfo *const info); - - void setPetBeing(Being *const being); - - BeingId getPetBeingId(); - - HomunculusInfo *getHomunculus(); - - void setHomunculus(HomunculusInfo *const info); - - void setHomunculusBeing(Being *const being); - - void setElemental(const BeingId id); - - BeingId getHomunculusId(); - - BeingId getMercenaryId(); - - BeingId getElementalId(); - - void updateAttackAi(const BeingId targetId, - const Keep keep); - - std::string getRoomName(); - - void setRoomName(const std::string &name); - - bool isInRoom(); - - void setGuildPositionFlags(const GuildPositionFlags::Type pos); - - GuildPositionFlags::Type getGuildPositionFlags(); - - void enableVending(const bool b); - - bool isVending() A_WARN_UNUSED; - - void setServerLanguage(const int lang); - - int getServerLanguage() A_WARN_UNUSED; -} // namespace PlayerInfo - -#endif // BEING_PLAYERINFO_H diff --git a/src/being/playerrelation.cpp b/src/being/playerrelation.cpp deleted file mode 100644 index 0b4627089..000000000 --- a/src/being/playerrelation.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/playerrelation.h" - -#include "debug.h" - -PlayerRelation::PlayerRelation(const RelationT relation) : - mRelation(relation) -{ -} diff --git a/src/being/playerrelation.h b/src/being/playerrelation.h deleted file mode 100644 index bc96c9bcd..000000000 --- a/src/being/playerrelation.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_PLAYERRELATION_H -#define BEING_PLAYERRELATION_H - -#include "enums/being/relation.h" - -#include "localconsts.h" - -struct PlayerRelation final -{ - static const unsigned int EMOTE = (1U << 0); - static const unsigned int SPEECH_FLOAT = (1U << 1); - static const unsigned int SPEECH_LOG = (1U << 2); - static const unsigned int WHISPER = (1U << 3); - static const unsigned int TRADE = (1U << 4); - static const unsigned int INVISIBLE = (1U << 5); - static const unsigned int BLACKLIST = (1U << 6); - static const unsigned int ENEMY = (1U << 7); - - static const unsigned int RELATIONS_NR = 7; - static const unsigned int RELATION_PERMISSIONS[RELATIONS_NR]; - - static const unsigned int DEFAULT = EMOTE - | SPEECH_FLOAT - | SPEECH_LOG - | WHISPER - | TRADE; - - explicit PlayerRelation(const RelationT relation); - - A_DELETE_COPY(PlayerRelation) - - RelationT mRelation; // bitmask for all of the above -}; - -#endif // BEING_PLAYERRELATION_H diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp deleted file mode 100644 index fe774432b..000000000 --- a/src/being/playerrelations.cpp +++ /dev/null @@ -1,661 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "being/playerrelations.h" - -#include "actormanager.h" -#include "configuration.h" -#include "logger.h" - -#include "being/localplayer.h" -#include "being/playerignorestrategy.h" -#include "being/playerrelation.h" - -#include "utils/dtor.h" -#include "utils/foreach.h" -#include "utils/gettext.h" - -#include "listeners/playerrelationslistener.h" - -#include "debug.h" - -static const unsigned int FIRST_IGNORE_EMOTE = 14; - -typedef std::map PlayerRelations; -typedef PlayerRelations::const_iterator PlayerRelationsCIter; -typedef std::list PlayerRelationListeners; -typedef PlayerRelationListeners::const_iterator PlayerRelationListenersCIter; - -static const char *const PLAYER_IGNORE_STRATEGY_NOP = "nop"; -static const char *const PLAYER_IGNORE_STRATEGY_EMOTE0 = "emote0"; -static const char *const DEFAULT_IGNORE_STRATEGY = - PLAYER_IGNORE_STRATEGY_EMOTE0; - -static const char *const NAME = "name"; -static const char *const RELATION = "relation"; - -static const unsigned int IGNORE_EMOTE_TIME = 100; - -namespace -{ - class SortPlayersFunctor final - { - public: - SortPlayersFunctor() - { } - - A_DEFAULT_COPY(SortPlayersFunctor) - - bool operator() (const std::string &str1, - const std::string &str2) const - { - std::string s1 = str1; - std::string s2 = str2; - toLower(s1); - toLower(s2); - if (s1 == s2) - return str1 < str2; - return s1 < s2; - } - } playersRelSorter; - - // (De)serialisation class - class PlayerConfSerialiser final : - public ConfigurationListManager, std::map *> - { - public: - PlayerConfSerialiser() - { } - - A_DELETE_COPY(PlayerConfSerialiser) - - ConfigurationObject *writeConfigItem( - const std::pair &value, - ConfigurationObject *const cobj) const override final - { - if (cobj == nullptr || - value.second == nullptr) - { - return nullptr; - } - cobj->setValue(NAME, value.first); - cobj->setValue(RELATION, toString( - CAST_S32(value.second->mRelation))); - - return cobj; - } - - std::map * - readConfigItem(const ConfigurationObject *const cobj, - std::map - *const container) const override final - { - if (cobj == nullptr || - container == nullptr) - { - return container; - } - const std::string name = cobj->getValue(NAME, ""); - if (name.empty()) - return container; - - if ((*container)[name] == nullptr) - { - const int v = cobj->getValueInt(RELATION, - CAST_S32(Relation::NEUTRAL)); - - (*container)[name] = new PlayerRelation( - static_cast(v)); - } - // otherwise ignore the duplicate entry - - return container; - } - }; -} // namespace - -static PlayerConfSerialiser player_conf_serialiser; // stateless singleton - -const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = -{ - /* NEUTRAL */ 0, // we always fall back to the defaults anyway - /* FRIEND */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE, - /* DISREGARDED*/ EMOTE | SPEECH_FLOAT, - /* IGNORED */ 0, - /* ERASED */ INVISIBLE, - /* BLACKLISTED */ SPEECH_LOG | WHISPER, - /* ENEMY2 */ EMOTE | SPEECH_FLOAT | SPEECH_LOG | WHISPER | TRADE -}; - -PlayerRelationsManager::PlayerRelationsManager() : - mPersistIgnores(false), - mDefaultPermissions(PlayerRelation::DEFAULT), - mIgnoreStrategy(nullptr), - mRelations(), - mListeners(), - mIgnoreStrategies() -{ -} - -PlayerRelationsManager::~PlayerRelationsManager() -{ - delete_all(mIgnoreStrategies); - - FOR_EACH (PlayerRelationsCIter, it, mRelations) - delete it->second; - mRelations.clear(); -} - -void PlayerRelationsManager::clear() -{ - StringVect *const names = getPlayers(); - FOR_EACHP (StringVectCIter, it, names) - removePlayer(*it); - delete names; -} - -static const char *const PERSIST_IGNORE_LIST = "persistent-player-list"; -static const char *const PLAYER_IGNORE_STRATEGY = "player-ignore-strategy"; -static const char *const DEFAULT_PERMISSIONS = "default-player-permissions"; - -int PlayerRelationsManager::getPlayerIgnoreStrategyIndex( - const std::string &name) -{ - const STD_VECTOR *const strategies - = getPlayerIgnoreStrategies(); - - if (strategies == nullptr) - return -1; - - const size_t sz = strategies->size(); - for (size_t i = 0; i < sz; i++) - { - if ((*strategies)[i]->mShortName == name) - return CAST_S32(i); - } - - return -1; -} - -void PlayerRelationsManager::load() -{ - Configuration *const cfg = &serverConfig; - clear(); - - mPersistIgnores = (cfg->getValue(PERSIST_IGNORE_LIST, 1) != 0); - mDefaultPermissions = CAST_S32(cfg->getValue(DEFAULT_PERMISSIONS, - mDefaultPermissions)); - - const std::string ignore_strategy_name = cfg->getValue( - PLAYER_IGNORE_STRATEGY, DEFAULT_IGNORE_STRATEGY); - const int ignore_strategy_index = getPlayerIgnoreStrategyIndex( - ignore_strategy_name); - - if (ignore_strategy_index >= 0) - { - setPlayerIgnoreStrategy((*getPlayerIgnoreStrategies()) - [ignore_strategy_index]); - } - - cfg->getList, - std::map *> - ("player", &(mRelations), &player_conf_serialiser); -} - - -void PlayerRelationsManager::init() -{ - load(); - - if (!mPersistIgnores) - { - clear(); // Yes, we still keep them around in the config file - // until the next update. - } - - FOR_EACH (PlayerRelationListenersCIter, it, mListeners) - (*it)->updateAll(); -} - -void PlayerRelationsManager::store() const -{ - serverConfig.setList::const_iterator, - std::pair, - std::map *> - ("player", mRelations.begin(), mRelations.end(), - &player_conf_serialiser); - - serverConfig.setValue(DEFAULT_PERMISSIONS, mDefaultPermissions); - serverConfig.setValue(PERSIST_IGNORE_LIST, mPersistIgnores); - serverConfig.setValue(PLAYER_IGNORE_STRATEGY, - mIgnoreStrategy != nullptr ? mIgnoreStrategy->mShortName : - DEFAULT_IGNORE_STRATEGY); - - serverConfig.write(); -} - -void PlayerRelationsManager::signalUpdate(const std::string &name) -{ - FOR_EACH (PlayerRelationListenersCIter, it, mListeners) - (*it)->updatedPlayer(name); - - if (actorManager != nullptr) - { - Being *const being = actorManager->findBeingByName( - name, ActorType::Player); - - if (being != nullptr && - being->getType() == ActorType::Player) - { - being->updateColors(); - } - } -} - -unsigned int PlayerRelationsManager::checkPermissionSilently( - const std::string &player_name, const unsigned int flags) const -{ - const std::map::const_iterator - it = mRelations.find(player_name); - if (it == mRelations.end()) - { - return mDefaultPermissions & flags; - } - - const PlayerRelation *const r = (*it).second; - unsigned int permissions = PlayerRelation::RELATION_PERMISSIONS[ - CAST_S32(r->mRelation)]; - - switch (r->mRelation) - { - case Relation::NEUTRAL: - permissions = mDefaultPermissions; - break; - - case Relation::FRIEND: - permissions |= mDefaultPermissions; // widen - break; - - case Relation::DISREGARDED: - case Relation::IGNORED: - case Relation::ERASED: - case Relation::BLACKLISTED: - case Relation::ENEMY2: - default: - permissions &= mDefaultPermissions; // narrow - break; - } - - return permissions & flags; -} - -bool PlayerRelationsManager::hasPermission(const Being *const being, - const unsigned int flags) const -{ - if (being == nullptr) - return false; - - if (being->getType() == ActorType::Player) - { - return static_cast(hasPermission( - being->getName(), flags)) == flags; - } - return true; -} - -bool PlayerRelationsManager::hasPermission(const std::string &name, - const unsigned int flags) const -{ - if (actorManager == nullptr) - return false; - - const unsigned int rejections = flags - & ~checkPermissionSilently(name, flags); - const bool permitted = (rejections == 0); - - if (!permitted) - { - // execute `ignore' strategy, if possible - if (mIgnoreStrategy != nullptr) - { - Being *const b = actorManager->findBeingByName( - name, ActorType::Player); - - if ((b != nullptr) && b->getType() == ActorType::Player) - mIgnoreStrategy->ignore(b, rejections); - } - } - - return permitted; -} - -void PlayerRelationsManager::setRelation(const std::string &player_name, - const RelationT relation) -{ - if (localPlayer == nullptr || - (relation != Relation::NEUTRAL && - localPlayer->getName() == player_name)) - { - return; - } - - PlayerRelation *const r = mRelations[player_name]; - if (r == nullptr) - mRelations[player_name] = new PlayerRelation(relation); - else - r->mRelation = relation; - - signalUpdate(player_name); - store(); -} - -StringVect *PlayerRelationsManager::getPlayers() const -{ - StringVect *const retval = new StringVect; - - FOR_EACH (PlayerRelationsCIter, it, mRelations) - { - if (it->second != nullptr) - retval->push_back(it->first); - } - - std::sort(retval->begin(), retval->end(), playersRelSorter); - - return retval; -} - -StringVect *PlayerRelationsManager::getPlayersByRelation( - const RelationT rel) const -{ - StringVect *const retval = new StringVect; - - FOR_EACH (PlayerRelationsCIter, it, mRelations) - { - if ((it->second != nullptr) && - it->second->mRelation == rel) - { - retval->push_back(it->first); - } - } - - std::sort(retval->begin(), retval->end(), playersRelSorter); - - return retval; -} - -void PlayerRelationsManager::removePlayer(const std::string &name) -{ - delete mRelations[name]; - mRelations.erase(name); - signalUpdate(name); -} - - -RelationT PlayerRelationsManager::getRelation( - const std::string &name) const -{ - const std::map::const_iterator - it = mRelations.find(name); - if (it != mRelations.end()) - return (*it).second->mRelation; - - return Relation::NEUTRAL; -} - -//////////////////////////////////////// -// defaults - -unsigned int PlayerRelationsManager::getDefault() const -{ - return mDefaultPermissions; -} - -void PlayerRelationsManager::setDefault(const unsigned int permissions) -{ - mDefaultPermissions = permissions; - - store(); - signalUpdate(""); -} - -void PlayerRelationsManager::ignoreTrade(const std::string &name) const -{ - if (name.empty()) - return; - - const RelationT relation = getRelation(name); - - if (relation == Relation::IGNORED || - relation == Relation::DISREGARDED || - relation == Relation::BLACKLISTED || - relation == Relation::ERASED) - { - return; - } - playerRelations.setRelation(name, Relation::BLACKLISTED); -} - -bool PlayerRelationsManager::checkBadRelation(const std::string &name) const -{ - if (name.empty()) - return true; - - const RelationT relation = getRelation(name); - - if (relation == Relation::IGNORED || - relation == Relation::DISREGARDED || - relation == Relation::BLACKLISTED || - relation == Relation::ERASED || - relation == Relation::ENEMY2) - { - return true; - } - return false; -} - -//////////////////////////////////////// -// ignore strategies - - -class PIS_nothing final : public PlayerIgnoreStrategy -{ - public: - PIS_nothing() : - PlayerIgnoreStrategy() - { - // TRANSLATORS: ignore/unignore action - mDescription = _("Completely ignore"); - mShortName = PLAYER_IGNORE_STRATEGY_NOP; - } - - A_DELETE_COPY(PIS_nothing) - - void ignore(Being *const being A_UNUSED, - const unsigned int flags A_UNUSED) const override final - { - } -}; - -class PIS_dotdotdot final : public PlayerIgnoreStrategy -{ - public: - PIS_dotdotdot() : - PlayerIgnoreStrategy() - { - // TRANSLATORS: ignore/unignore action - mDescription = _("Print '...'"); - mShortName = "dotdotdot"; - } - - A_DELETE_COPY(PIS_dotdotdot) - - void ignore(Being *const being, - const unsigned int flags A_UNUSED) const override final - { - if (being == nullptr) - return; - - logger->log("ignoring: " + being->getName()); - being->setSpeech("..."); - } -}; - - -class PIS_blinkname final : public PlayerIgnoreStrategy -{ - public: - PIS_blinkname() : - PlayerIgnoreStrategy() - { - // TRANSLATORS: ignore/unignore action - mDescription = _("Blink name"); - mShortName = "blinkname"; - } - - A_DELETE_COPY(PIS_blinkname) - - void ignore(Being *const being, - const unsigned int flags A_UNUSED) const override final - { - if (being == nullptr) - return; - - logger->log("ignoring: " + being->getName()); - being->flashName(200); - } -}; - -class PIS_emote final : public PlayerIgnoreStrategy -{ - public: - PIS_emote(const uint8_t emote_nr, - const std::string &description, - const std::string &shortname) : - PlayerIgnoreStrategy(), - mEmotion(emote_nr) - { - mDescription = description; - mShortName = shortname; - } - - A_DELETE_COPY(PIS_emote) - - void ignore(Being *const being, - const unsigned int flags A_UNUSED) const override final - { - if (being == nullptr) - return; - - being->setEmote(mEmotion, IGNORE_EMOTE_TIME); - } - uint8_t mEmotion; -}; - -STD_VECTOR * -PlayerRelationsManager::getPlayerIgnoreStrategies() -{ - if (mIgnoreStrategies.empty()) - { - // not initialised yet? - mIgnoreStrategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE, - // TRANSLATORS: ignore strategi - _("Floating '...' bubble"), - PLAYER_IGNORE_STRATEGY_EMOTE0)); - mIgnoreStrategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE + 1, - // TRANSLATORS: ignore strategi - _("Floating bubble"), - "emote1")); - mIgnoreStrategies.push_back(new PIS_nothing); - mIgnoreStrategies.push_back(new PIS_dotdotdot); - mIgnoreStrategies.push_back(new PIS_blinkname); - } - return &mIgnoreStrategies; -} - -bool PlayerRelationsManager::isGoodName(const std::string &name) const -{ - const size_t size = name.size(); - - if (size < 3) - return true; - - const std::map::const_iterator - it = mRelations.find(name); - if (it != mRelations.end()) - return true; - - return checkName(name); -} - -bool PlayerRelationsManager::isGoodName(Being *const being) const -{ - if (being == nullptr) - return false; - if (being->getGoodStatus() != -1) - return being->getGoodStatus() == 1; - - const std::string &name = being->getName(); - const size_t size = name.size(); - - if (size < 3) - return true; - - const std::map::const_iterator - it = mRelations.find(name); - if (it != mRelations.end()) - return true; - - const bool status = checkName(name); - being->setGoodStatus(status ? 1 : 0); - return status; -} - -bool PlayerRelationsManager::checkName(const std::string &name) -{ - const size_t size = name.size(); - const std::string check = config.getStringValue("unsecureChars"); - const 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 playerRelations; diff --git a/src/being/playerrelations.h b/src/being/playerrelations.h deleted file mode 100644 index d1db4a003..000000000 --- a/src/being/playerrelations.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEING_PLAYERRELATIONS_H -#define BEING_PLAYERRELATIONS_H - -#include "utils/stringvector.h" - -#include "enums/being/relation.h" - -#include -#include - -#include "localconsts.h" - -class Being; -class PlayerIgnoreStrategy; -class PlayerRelationsListener; - -struct PlayerRelation; - -/** - * Player relations class, represents any particular relations and/or - * preferences the user of the local client has wrt other players (identified - * by std::string). - */ -class PlayerRelationsManager final -{ - public: - PlayerRelationsManager(); - - A_DELETE_COPY(PlayerRelationsManager) - - ~PlayerRelationsManager(); - - /** - * Initialise player relations manager (load config file etc.) - */ - void init(); - - /** - * Load configuration from our config file, or substitute defaults. - */ - void load(); - - /** - * Save configuration to our config file. - */ - void store() const; - - /** - * Determines whether the player in question is being ignored, filtered by - * the specified flags. - */ - unsigned int checkPermissionSilently(const std::string &player_name, - const unsigned int flags) - const A_WARN_UNUSED; - - /** - * Tests whether the player in question is being ignored for any of the - * actions in the specified flags. If so, trigger appropriate side effects - * if requested by the player. - */ - bool hasPermission(const Being *const being, - const unsigned int flags) const A_WARN_UNUSED; - - bool hasPermission(const std::string &being, - const unsigned int flags) const A_WARN_UNUSED; - - /** - * Updates the relationship with this player. - */ - void setRelation(const std::string &name, - const RelationT relation); - - /** - * Updates the relationship with this player. - */ - RelationT getRelation(const std::string &name) const A_WARN_UNUSED; - - /** - * Deletes the information recorded for a player. - */ - void removePlayer(const std::string &name); - - /** - * Retrieves the default permissions. - */ - unsigned int getDefault() const A_WARN_UNUSED; - - /** - * Sets the default permissions. - */ - void setDefault(const unsigned int permissions); - - /** - * Retrieves all known player ignore strategies. - * - * The player ignore strategies are allocated statically and must - * not be deleted. - */ - STD_VECTOR *getPlayerIgnoreStrategies() - A_WARN_UNUSED; - - /** - * Return the current player ignore strategy. - * - * \return A player ignore strategy, or nullptr - */ - const PlayerIgnoreStrategy *getPlayerIgnoreStrategy() const - noexcept2 - A_WARN_UNUSED - { return mIgnoreStrategy; } - - /** - * Sets the strategy to call when ignoring players. - */ - void setPlayerIgnoreStrategy(PlayerIgnoreStrategy *const strategy) - noexcept2 - { mIgnoreStrategy = strategy; } - - /** - * For a given ignore strategy short name, find the appropriate index - * in the ignore strategies vector. - * - * \param The short name of the ignore strategy to look up - * \return The appropriate index, or -1 - */ - int getPlayerIgnoreStrategyIndex(const std::string &shortname) - A_WARN_UNUSED; - - /** - * Retrieves a sorted vector of all players for which we have any - * relations recorded. - */ - StringVect *getPlayers() const RETURNS_NONNULL A_WARN_UNUSED; - - StringVect *getPlayersByRelation(const RelationT rel) - const A_WARN_UNUSED; - - /** - * Removes all recorded player info. - */ - void clear(); - - /** - * Do we persist our `ignore' setup? - */ - bool getPersistIgnores() const noexcept2 A_WARN_UNUSED - { return mPersistIgnores; } - - void ignoreTrade(const std::string &name) const; - - bool isGoodName(Being *const being) const A_WARN_UNUSED; - - bool isGoodName(const std::string &name) const A_WARN_UNUSED; - - /** - * Change the `ignore persist' flag. - * - * @param value Whether to persist ignores - */ - void setPersistIgnores(const bool value) noexcept2 - { mPersistIgnores = value; } - - void addListener(PlayerRelationsListener *const listener) - { mListeners.push_back(listener); } - - void removeListener(PlayerRelationsListener *const listener) - { mListeners.remove(listener); } - - bool checkBadRelation(const std::string &name) const A_WARN_UNUSED; - - private: - void signalUpdate(const std::string &name); - - bool mPersistIgnores; // If NOT set, we delete the - // ignored data upon reloading - unsigned int mDefaultPermissions; - - static bool checkName(const std::string &name) A_WARN_UNUSED; - - PlayerIgnoreStrategy *mIgnoreStrategy; - std::map mRelations; - std::list mListeners; - STD_VECTOR mIgnoreStrategies; -}; - - -extern PlayerRelationsManager playerRelations; // singleton representation - // of player relations - - -#endif // BEING_PLAYERRELATIONS_H diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp deleted file mode 100644 index afe73342e..000000000 --- a/src/beingequipbackend.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "beingequipbackend.h" - -#include "being/being.h" - -#include "net/inventoryhandler.h" - -#include "resources/item/item.h" - -#include "utils/delete2.h" - -#include "debug.h" - -BeingEquipBackend::BeingEquipBackend(Being *const being) : - Equipment::Backend(), - mEquipment() -{ - memset(mEquipment, 0, sizeof(mEquipment)); - if (being != nullptr) - { - const size_t sz = being->mSprites.size(); - - for (size_t f = 0; f < sz; f ++) - { - const int idx = inventoryHandler-> - convertFromServerSlot(CAST_S32(f)); - const BeingSlot &slot = being->mSlots[f]; - const int id = slot.spriteId; - if (id > 0 && idx >= 0 && idx < EQUIPMENT_SIZE) - { - Item *const item = new Item(id, - ItemType::Unknown, - 1, - 0, - slot.colorId, - Identified_true, - Damaged_false, - Favorite_false, - Equipm_true, - Equipped_true); - const CardsList &cards = slot.cardsId; - if (!cards.isEmpty()) - item->setCards(&cards.cards[0], maxCards); - mEquipment[idx] = item; - } - } - } -} - -BeingEquipBackend::~BeingEquipBackend() -{ - for (int i = 0; i < EQUIPMENT_SIZE; i++) - delete2(mEquipment[i]) -} - -void BeingEquipBackend::clear() -{ - for (int i = 0; i < EQUIPMENT_SIZE; i++) - delete2(mEquipment[i]) -} - -void BeingEquipBackend::setEquipment(const int index, - const Item *const item) -{ - mEquipment[index] = item; -} - -const Item *BeingEquipBackend::getEquipment(const int index) const -{ - if (index < 0 || index >= EQUIPMENT_SIZE) - return nullptr; - return mEquipment[index]; -} diff --git a/src/beingequipbackend.h b/src/beingequipbackend.h deleted file mode 100644 index 6778ac710..000000000 --- a/src/beingequipbackend.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef BEINGEQUIPBACKEND_H -#define BEINGEQUIPBACKEND_H - -#include "equipment.h" - -#include "const/equipment.h" - -#include "localconsts.h" - -class Being; - -class BeingEquipBackend final : public Equipment::Backend -{ - public: - explicit BeingEquipBackend(Being *const being); - - A_DELETE_COPY(BeingEquipBackend) - - ~BeingEquipBackend(); - - const Item *getEquipment(const int index) const override final - A_WARN_UNUSED; - - void clear() override final; - - void setEquipment(const int index, - const Item *const item); - - private: - const Item *mEquipment[EQUIPMENT_SIZE]; -}; - -#endif // BEINGEQUIPBACKEND_H diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp deleted file mode 100644 index d6376f504..000000000 --- a/src/chatlogger.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#include "chatlogger.h" - -#include "configuration.h" - -#include "fs/mkdir.h" - -#include "utils/cast.h" - -#include -#include - -#ifdef WIN32 -#include -#include -#elif defined __APPLE__ -#include -#endif // WIN32 - -#include "debug.h" - -ChatLogger *chatLogger = nullptr; - -ChatLogger::ChatLogger() : - mLogFile(), - mLogDir(), - mBaseLogDir(), - mServerName(), - mLogFileName() -{ -} - -ChatLogger::~ChatLogger() -{ - if (mLogFile.is_open()) - mLogFile.close(); -} - -void ChatLogger::setLogFile(const std::string &logFilename) -{ - if (mLogFile.is_open()) - mLogFile.close(); - - mLogFile.open(logFilename.c_str(), - std::ios_base::app); - mLogFileName = logFilename; - - if (!mLogFile.is_open()) - { - std::cout << "Warning: error while opening " << - logFilename << - " for writing.\n"; - } -} - -void ChatLogger::setLogDir(const std::string &logDir) -{ - mLogDir = logDir; - - if (mLogFile.is_open()) - mLogFile.close(); - - DIR *const dir = opendir(mLogDir.c_str()); - if (dir == nullptr) - mkdir_r(mLogDir.c_str()); - else - closedir(dir); -} - -void ChatLogger::log(std::string str) -{ - const std::string &dateStr = getDir(); - const std::string logFileName = strprintf( - "%s/#General.log", dateStr.c_str()); - if (!mLogFile.is_open() || - logFileName != mLogFileName) - { - setLogDir(dateStr); - setLogFile(logFileName); - } - - str = removeColors(str); - writeTo(mLogFile, str); -} - -void ChatLogger::log(std::string name, - std::string str) -{ - const std::string &dateStr = getDir(); - const std::string logFileName = strprintf("%s/%s.log", - dateStr.c_str(), secureName(name).c_str()); - - if (!mLogFile.is_open() || logFileName != mLogFileName) - { - setLogDir(dateStr); - setLogFile(logFileName); - } - - str = removeColors(str); - writeTo(mLogFile, str); -} - -std::string ChatLogger::getDir() const -{ - std::string date; - - time_t rawtime; - char buffer [81]; - - time(&rawtime); - struct tm *const timeinfo = localtime(&rawtime); - - strftime(buffer, 79, "%Y-%m/%d", timeinfo); - - date = strprintf("%s/%s/%s", - mBaseLogDir.c_str(), - mServerName.c_str(), - buffer); - - return date; -} - -std::string ChatLogger::secureName(std::string &name) -{ - const size_t sz = name.length(); - for (size_t f = 0; f < sz; f ++) - { - const unsigned char ch = name[f]; - if ((ch < '0' || ch > '9') && - (ch < 'a' || ch > 'z') && - (ch < 'A' || ch > 'Z') && - ch != '-' && - ch != '+' && - ch != '=' && - ch != '.' && - ch != ',' && - ch != ')' && - ch != '(' && - ch != '[' && - ch != ']' && - ch != '#') - { - name[f] = '_'; - } - } - return name; -} - -void ChatLogger::writeTo(std::ofstream &file, - const std::string &str) -{ - file << str << std::endl; -} - -void ChatLogger::setServerName(const std::string &serverName) -{ - mServerName = serverName; - if (mServerName.empty()) - mServerName = config.getStringValue("MostUsedServerName0"); - - if (mLogFile.is_open()) - mLogFile.close(); - - secureName(mServerName); - if (!mLogDir.empty()) - { - const std::string name = pathJoin(mLogDir, mServerName); - DIR *const dir = opendir(name.c_str()); - if (dir == nullptr) - mkdir_r(name.c_str()); - else - closedir(dir); - } -} - -void ChatLogger::loadLast(std::string name, - std::list &list, - const unsigned int n) const -{ - std::ifstream logFile; - std::string fileName = strprintf("%s/%s.log", - getDir().c_str(), - secureName(name).c_str()); - - logFile.open(fileName.c_str(), std::ios::in); - - if (!logFile.is_open()) - return; - - char line[710]; - unsigned sz = CAST_U32(list.size()); - while (logFile.getline(line, 700)) - { - list.push_back(line); - sz ++; - if (sz > n) - { - list.pop_front(); - sz --; - } - } - - if (logFile.is_open()) - logFile.close(); -} - -void ChatLogger::clear() -{ - mLogDir.clear(); - mServerName.clear(); - mLogFileName.clear(); -} diff --git a/src/chatlogger.h b/src/chatlogger.h deleted file mode 100644 index 0f9563096..000000000 --- a/src/chatlogger.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009-2010 Andrei Karas - * - * 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 . - */ - -#ifndef CHATLOGGER_H -#define CHATLOGGER_H - -#include -#include - -#include "localconsts.h" - -class ChatLogger final -{ - public: - /** - * Constructor. - */ - ChatLogger(); - - A_DELETE_COPY(ChatLogger) - - /** - * Destructor, closes log file. - */ - ~ChatLogger(); - - /** - * Enters a message in the log. The message will be timestamped. - */ - void log(std::string str); - - void log(std::string name, std::string str); - - void loadLast(std::string name, - std::list &list, - const unsigned int n) const; - - std::string getDir() const A_WARN_UNUSED; - - static std::string secureName(std::string &str); - - void setServerName(const std::string &serverName); - - void setBaseLogDir(const std::string &logDir) - { mBaseLogDir = logDir; } - - void clear(); - - private: - /** - * Sets the file to log to and opens it - */ - void setLogFile(const std::string &logFilename); - - void setLogDir(const std::string &logDir); - - static void writeTo(std::ofstream &file, - const std::string &str); - - std::ofstream mLogFile; - std::string mLogDir; - std::string mBaseLogDir; - std::string mServerName; - std::string mLogFileName; -}; - -extern ChatLogger *chatLogger; - -#endif // CHATLOGGER_H diff --git a/src/client.h b/src/client.h deleted file mode 100644 index e896bb1e5..000000000 --- a/src/client.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CLIENT_H -#define CLIENT_H - -#ifdef DYECMD -#include "progs/dyecmd/client.h" -PROGS_DYECMD_CLIENT_H -#else // DYECMD -#include "progs/manaplus/client.h" -PROGS_MANAPLUS_CLIENT_H -#endif // DYECMD -#endif // CLIENT_H diff --git a/src/commandline.cpp b/src/commandline.cpp deleted file mode 100644 index e1f7ebc20..000000000 --- a/src/commandline.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "commandline.h" - -#include "main.h" -#include "settings.h" - -#include "fs/paths.h" - -#include "utils/cast.h" -#include "utils/gettext.h" -#include "utils/stringutils.h" - -#include -#include -#include - -#include "debug.h" - -static void printHelp() -{ - std::cout << - // TRANSLATORS: command line help - _("manaplus [options] [manaplus-file]") << - std::endl << std::endl << - // TRANSLATORS: command line help - _("[manaplus-file] : The manaplus file is an XML file (.manaplus)") << - std::endl << - // TRANSLATORS: command line help - _(" used to set custom parameters") << - std::endl << - // TRANSLATORS: command line help - _(" to the manaplus client.") << - std::endl << std::endl << - // TRANSLATORS: command line help - _("Options:") << - std::endl << - // TRANSLATORS: command line help - _(" -l --log-file : Log file to use") << std::endl << - // TRANSLATORS: command line help - _(" -a --chat-log-dir : Chat log dir to use") << std::endl << - // TRANSLATORS: command line help - _(" -v --version : Display the version") << std::endl << - // TRANSLATORS: command line help - _(" -h --help : Display this help") << std::endl << - // TRANSLATORS: command line help - _(" -C --config-dir : Configuration directory to use") << - std::endl << - // TRANSLATORS: command line help - _(" -U --username : Login with this username") << - std::endl << - // TRANSLATORS: command line help - _(" -P --password : Login with this password") << - std::endl << - // TRANSLATORS: command line help - _(" -c --character : Login with this character") << - std::endl << - // TRANSLATORS: command line help - _(" -s --server : Login server name or IP") << - std::endl << - // TRANSLATORS: command line help - _(" -y --server-type : Login server type") << - std::endl << - // TRANSLATORS: command line help - _(" -p --port : Login server port") << - std::endl << - // TRANSLATORS: command line help - _(" -H --update-host : Use this update host") << - std::endl << - // TRANSLATORS: command line help - _(" -D --default : Choose default character server and " - "character") << - std::endl << - // TRANSLATORS: command line help - _(" -u --skip-update : Skip the update downloads") << - std::endl << - // TRANSLATORS: command line help - _(" -d --data : Directory to load game data from") << - std::endl << - // TRANSLATORS: command line help - _(" -L --localdata-dir : Directory to use as local " - "data directory") << - std::endl << - // TRANSLATORS: command line help - _(" --screenshot-dir : Directory to store screenshots") << - std::endl << - // TRANSLATORS: command line help - _(" --safemode : Start game in safe mode") << - std::endl << - // TRANSLATORS: command line help - _(" --renderer : Set renderer type") << - std::endl << - // TRANSLATORS: command line help - _(" -T --tests : Start testing drivers and " - "auto configuring") << - std::endl << - // TRANSLATORS: command line help - _(" -V --validate : Start validating client data") << - std::endl -#ifdef USE_OPENGL - << - // TRANSLATORS: command line help - _(" -O --no-opengl : Disable OpenGL for this session") << - std::endl -#endif // USE_OPENGL - ; -} - -static void printVersion() -{ - std::cout << - strprintf("ManaPlus client %s", FULL_VERSION) << - std::endl; -} - -void parseOptions(const int argc, char *const argv[]) -{ - const char *const optstring = "hvud:U:P:Dc:p:y:l:L:C:s:t:T:a:r:e:V"; - - const struct option long_options[] = - { - { "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, 'a' }, - { "version", no_argument, nullptr, 'v' }, - { "log-file", 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' }, - { "renderer", required_argument, nullptr, 'r' }, - { "server-type", required_argument, nullptr, 'y' }, - { "enable-ipc", no_argument, nullptr, 'I' }, - { "hide-cursor", no_argument, nullptr, 'q' }, - { "error", no_argument, nullptr, 'e' }, - { "validate", no_argument, nullptr, 'V' }, - { nullptr, 0, nullptr, 0 } - }; - - Options &options = settings.options; - - while (optind < argc) - { - const int result = getopt_long(argc, - argv, - optstring, - long_options, - nullptr); - - if (result == -1) - break; - - switch (result) - { - case 'C': - options.configDir = optarg; - break; - case 'd': - options.dataPath = optarg; - break; - case 'D': - options.chooseDefault = true; - break; - case '?': // Unknown option - case ':': // Missing argument - case 'h': - options.printHelp = true; - break; - case 'H': - if (checkPath(optarg)) - options.updateHost = optarg; - else - options.updateHost.clear(); - break; - case 'c': - options.character = optarg; - break; - case 'P': - options.password = optarg; - break; - case 's': - options.serverName = optarg; - break; - case 'p': - options.serverPort = CAST_U16(atoi(optarg)); - break; - case 'u': - options.skipUpdate = true; - break; - case 'U': - options.username = optarg; - break; - case 'v': - options.printVersion = true; - break; - case 'L': - options.localDataDir = optarg; - break; - case 'O': - options.noOpenGL = true; - break; - case 'l': - options.logFileName = std::string(optarg); - break; - case 'a': - options.chatLogDir = std::string(optarg); - break; - case 'i': - options.screenshotDir = optarg; - break; - case 'm': - options.safeMode = true; - break; - case 'T': - options.testMode = true; - options.test.clear(); - break; - case 't': - options.testMode = true; - options.test = std::string(optarg); - break; - case 'r': - options.renderer = CAST_S32(atoi(optarg)); - break; - case 'y': - options.serverType = optarg; - break; - case 'I': - options.ipc = true; - break; - case 'q': - options.hideCursor = true; - break; - case 'e': - options.error = true; - break; - case 'V': - options.validate = true; - break; - default: - break; - } - } - - // when there are still options left use the last - // one as branding file - if (optind < argc) - { - options.brandingPath = argv[optind]; - } - - if (settings.options.printHelp) - { - printHelp(); - _exit(0); - } - else if (settings.options.printVersion) - { - printVersion(); - _exit(0); - } -} diff --git a/src/commandline.h b/src/commandline.h deleted file mode 100644 index 774a4ee91..000000000 --- a/src/commandline.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef COMMANDLINE_H -#define COMMANDLINE_H - -#include "localconsts.h" - -void parseOptions(const int argc, char *const argv[]); - -#endif // COMMANDLINE_H diff --git a/src/configmanager.cpp b/src/configmanager.cpp deleted file mode 100644 index 13f917d1e..000000000 --- a/src/configmanager.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "configmanager.h" - -#include "client.h" -#include "configuration.h" -#include "settings.h" - -#include "being/beingspeech.h" - -#include "fs/files.h" -#include "fs/mkdir.h" -#include "fs/paths.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" -#include "utils/gettext.h" - -#include "render/renderers.h" - -#include "debug.h" - -static void setDefaultOption(const char *const name, - const bool def) -{ - const int val = serverConfig.getValue(name, -1); - if (val == -1) - serverConfig.setValue(name, def); -} - -/** - * Initializes the home directory. On UNIX and FreeBSD, ~/.mana is used. On - * Windows and other systems we use the current working directory. - */ -void ConfigManager::initServerConfig(const std::string &serverName) -{ - settings.serverConfigDir = pathJoin(settings.configDir, serverName); - - if (mkdir_r(settings.serverConfigDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), settings.serverConfigDir.c_str())); - } - const std::string configPath = settings.serverConfigDir + "/config.xml"; - FILE *configFile = fopen(configPath.c_str(), "r"); - if (configFile == nullptr) - { - configFile = fopen(configPath.c_str(), "wb"); - logger->log("Creating new server config: " + configPath); - if (configFile != nullptr) - { - fputs("\n", configFile); - fputs("\n", configFile); - fputs("\n", configFile); - } - } - if (configFile != nullptr) - { - fclose(configFile); - serverConfig.init(configPath); - setConfigDefaults(serverConfig); - logger->log("serverConfigPath: " + configPath); - } - else - { - reportAlways("Error creating server config: %s", - configPath.c_str()); - } - - const bool val = Client::isTmw(); - setDefaultOption("enableManaMarketBot", val); - setDefaultOption("enableRemoteCommands", !val); -} - -void ConfigManager::initConfiguration() -{ -#ifdef DEBUG_CONFIG - config.setIsMain(true); -#endif // DEBUG_CONFIG - - // Fill configuration with defaults - config.setValue("hwaccel", false); -#ifdef USE_OPENGL -#if (defined __APPLE__) - config.setValue("opengl", CAST_S32(RENDER_NORMAL_OPENGL)); -#elif (defined ANDROID) - config.setValue("opengl", CAST_S32(RENDER_GLES_OPENGL)); -#elif (defined WIN32) - config.setValue("opengl", CAST_S32(RENDER_SAFE_OPENGL)); -#else // (defined __APPLE__) - - config.setValue("opengl", CAST_S32(RENDER_SOFTWARE)); -#endif // (defined __APPLE__) -#else // USE_OPENGL - - config.setValue("opengl", CAST_S32(RENDER_SOFTWARE)); -#endif // USE_OPENGL - - config.setValue("screen", false); - config.setValue("sound", true); - config.setValue("guialpha", 0.8F); -// config.setValue("remember", true); - config.setValue("sfxVolume", 100); - config.setValue("musicVolume", 60); - config.setValue("fpslimit", 60); - std::string defaultUpdateHost = branding.getValue("defaultUpdateHost", ""); - if (!checkPath(defaultUpdateHost)) - defaultUpdateHost.clear(); - config.setValue("updatehost", defaultUpdateHost); - config.setValue("useScreenshotDirectorySuffix", true); - config.setValue("ChatLogLength", 128); - - std::string configPath; - -#ifndef UNITTESTS - if (settings.options.test.empty()) - configPath = settings.configDir + "/config.xml"; - else - configPath = settings.configDir + "/test.xml"; -#else // UNITTESTS - - configPath = settings.configDir + "/unittestconfig.xml"; -#endif // UNITTESTS - - FILE *configFile = fopen(configPath.c_str(), "r"); - if (configFile == nullptr) - { - configFile = fopen(configPath.c_str(), "wb"); - logger->log1("Creating new config"); - if (configFile != nullptr) - { - fputs("\n", configFile); - fputs("\n", configFile); - fputs("\n", configFile); - } - } - if (configFile == nullptr) - { - reportAlways("Can't create %s. Using defaults.", - configPath.c_str()); - } - else - { - fclose(configFile); - config.init(configPath); - logger->log1("init 3"); - setConfigDefaults(config); - setConfigDefaults(serverConfig); - logger->log("configuration file: " + configPath); - } -} - -void ConfigManager::backupConfig(const std::string &name) -{ - const std::string fileName3 = pathJoin(settings.configDir, name); - StringVect arr; - if (Files::existsLocal(fileName3) == false) - { - logger->log("Config %s not exists, backup skipped.", - name.c_str()); - return; - } - if (Files::loadTextFileLocal(fileName3, arr) == true) - { - if (arr.empty()) - return; - - arr.clear(); - const std::string tmpName = pathJoin(settings.configDir, - name).append(".tmp"); - Files::copyFile(fileName3, tmpName); - if (Files::loadTextFileLocal(tmpName, arr) == false || - arr.empty()) - { - logger->safeError("Error backuping configs. " - "Probably no free space on disk."); - } - arr.clear(); - } - - const std::string confName = pathJoin(settings.configDir, - name).append(".bak"); - const int maxFileIndex = 5; - ::remove((confName + toString(maxFileIndex)).c_str()); - for (int f = maxFileIndex; f > 1; f --) - { - const std::string fileName1 = confName + toString(f - 1); - const std::string fileName2 = confName + toString(f); - Files::renameFile(fileName1, fileName2); - } - const std::string fileName4 = confName + toString(1); - Files::copyFile(fileName3, fileName4); -} - -#ifdef __native_client__ -void ConfigManager::storeSafeParameters() -{ - RenderType tmpOpengl; - - isSafeMode = config.getBoolValue("safemode"); - if (isSafeMode) - logger->log1("Run in safe mode"); - - tmpOpengl = intToRenderType(config.getIntValue("opengl")); - - config.setValue("opengl", CAST_S32(RENDER_SOFTWARE)); - - config.write(); - - if (settings.options.safeMode) - { - isSafeMode = true; - return; - } - - config.setValue("safemode", false); - config.setValue("opengl", CAST_S32(tmpOpengl)); -} -#elif !defined(ANDROID) -void ConfigManager::storeSafeParameters() -{ - bool tmpHwaccel; - RenderType tmpOpengl; - int tmpFpslimit; - int tmpAltFpslimit; - bool tmpSound; - int width; - int height; - std::string font; - std::string bFont; - std::string particleFont; - std::string helpFont; - std::string secureFont; - std::string npcFont; - std::string japanFont; - std::string chinaFont; - bool showBackground; - bool enableMumble; - bool enableMapReduce; - - isSafeMode = config.getBoolValue("safemode"); - if (isSafeMode) - logger->log1("Run in safe mode"); - - tmpOpengl = intToRenderType(config.getIntValue("opengl")); - - width = config.getIntValue("screenwidth"); - height = config.getIntValue("screenheight"); - tmpHwaccel = config.getBoolValue("hwaccel"); - - tmpFpslimit = config.getIntValue("fpslimit"); - tmpAltFpslimit = config.getIntValue("altfpslimit"); - tmpSound = config.getBoolValue("sound"); - - font = config.getStringValue("font"); - bFont = config.getStringValue("boldFont"); - particleFont = config.getStringValue("particleFont"); - helpFont = config.getStringValue("helpFont"); - secureFont = config.getStringValue("secureFont"); - npcFont = config.getStringValue("npcFont"); - japanFont = config.getStringValue("japanFont"); - chinaFont = config.getStringValue("chinaFont"); - - showBackground = config.getBoolValue("showBackground"); - enableMumble = config.getBoolValue("enableMumble"); - enableMapReduce = config.getBoolValue("enableMapReduce"); - - if (!settings.options.safeMode && tmpOpengl == RENDER_SOFTWARE) - { - // if video mode configured reset most settings to safe - config.setValue("hwaccel", false); - config.setValue("altfpslimit", 3); - config.setValue("sound", false); - config.setValue("safemode", true); - config.setValue("screenwidth", 640); - config.setValue("screenheight", 480); - config.setValue("font", "fonts/dejavusans.ttf"); - config.setValue("boldFont", "fonts/dejavusans-bold.ttf"); - config.setValue("particleFont", "fonts/dejavusans.ttf"); - config.setValue("helpFont", "fonts/dejavusansmono.ttf"); - config.setValue("secureFont", "fonts/dejavusansmono.ttf"); - config.setValue("npcFont", "fonts/dejavusans.ttf"); - config.setValue("japanFont", "fonts/mplus-1p-regular.ttf"); - config.setValue("chinaFont", "fonts/wqy-microhei.ttf"); - config.setValue("showBackground", false); - config.setValue("enableMumble", false); - config.setValue("enableMapReduce", false); - } - else - { - // if video mode not configured reset only video mode to safe - config.setValue("screenwidth", 640); - config.setValue("screenheight", 480); - } -#if defined(__APPLE__) - config.setValue("opengl", CAST_S32(RENDER_NORMAL_OPENGL)); -#else // defined(__APPLE__) - - config.setValue("opengl", CAST_S32(RENDER_SOFTWARE)); -#endif // defined(__APPLE__) - - config.write(); - - if (settings.options.safeMode) - { - isSafeMode = true; - return; - } - - config.setValue("safemode", false); - if (tmpOpengl == RENDER_SOFTWARE) - { - config.setValue("hwaccel", tmpHwaccel); - config.setValue("opengl", CAST_S32(tmpOpengl)); - config.setValue("fpslimit", tmpFpslimit); - config.setValue("altfpslimit", tmpAltFpslimit); - config.setValue("sound", tmpSound); - config.setValue("screenwidth", width); - config.setValue("screenheight", height); - config.setValue("font", font); - config.setValue("boldFont", bFont); - config.setValue("particleFont", particleFont); - config.setValue("helpFont", helpFont); - config.setValue("secureFont", secureFont); - config.setValue("npcFont", npcFont); - config.setValue("japanFont", japanFont); - config.setValue("chinaFont", chinaFont); - config.setValue("showBackground", showBackground); - config.setValue("enableMumble", enableMumble); - config.setValue("enableMapReduce", enableMapReduce); - } - else - { - config.setValue("opengl", CAST_S32(tmpOpengl)); - config.setValue("screenwidth", width); - config.setValue("screenheight", height); - } -} -#endif // __native_client__ - -#define unassignKey(key, value) \ - if (config.getStringValue(prefix + key) == value) \ - config.setValue(key, "-1"); - -void ConfigManager::checkConfigVersion() -{ - const int version = config.getIntValue("cfgver"); - if (version < 1) - { - if (config.getIntValue("fontSize") == 11) - config.deleteKey("fontSize"); - if (config.getIntValue("npcfontSize") == 13) - config.deleteKey("npcfontSize"); - } - if (version < 2) - { - if (config.getIntValue("screenButtonsSize") == 1) - config.deleteKey("screenButtonsSize"); - if (config.getIntValue("screenJoystickSize") == 1) - config.deleteKey("screenJoystickSize"); - } - if (version < 3) - { - config.setValue("audioFrequency", 44100); -#ifdef ANDROID - config.setValue("customcursor", false); -#endif // ANDROID - } -#ifdef ANDROID - if (version < 4) - { - config.setValue("showDidYouKnow", false); - } -#endif // ANDROID - - if (version < 5) - { - if (config.getIntValue("speech") == BeingSpeech::TEXT_OVERHEAD) - { - config.setValue("speech", CAST_S32( - BeingSpeech::NO_NAME_IN_BUBBLE)); - } - } - if (version < 6) - config.setValue("blur", false); - - if (version < 7) - config.setValue("download-music", true); - - if (version < 9) - { - config.deleteKey("videodetected"); - config.setValue("moveToTargetType", 10); - } - if (version < 10) - config.setValue("enableLazyScrolling", false); - - if (version < 11) - { -#ifdef USE_SDL2 - const std::string prefix = std::string("sdl2"); -#else // USE_SDL2 - - const std::string prefix = std::string(); -#endif // USE_SDL2 - - unassignKey("keyDirectUp", "k108"); - unassignKey("keyDirectDown", "k59"); - unassignKey("keyDirectLeft", "k107"); - unassignKey("keyDirectRight", "k39"); - } - if (version < 12) - { -#ifdef USE_SDL2 - const std::string prefix = std::string("sdl2"); -#else // USE_SDL2 - - const std::string prefix = std::string(); -#endif // USE_SDL2 - - unassignKey("keyAttack", "k120"); - } - - if (version < 13) - config.setValue("keyWindowBotChecker", -1); - - if (version < 14 && config.getIntValue("syncPlayerMoveDistance") == 2) - config.setValue("syncPlayerMoveDistance", 5); - config.setValue("cfgver", 14); -} - -#undef unassignKey diff --git a/src/configmanager.h b/src/configmanager.h deleted file mode 100644 index 16e72d558..000000000 --- a/src/configmanager.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONFIGMANAGER_H -#define CONFIGMANAGER_H - -#include - -#include "localconsts.h" - -class ConfigManager final -{ - public: - A_DELETE_COPY(ConfigManager) - - static void initConfiguration(); - - static void initServerConfig(const std::string &serverName); - -#ifndef ANDROID - static void storeSafeParameters(); -#endif // ANDROID - - static void backupConfig(const std::string &name); - - static void checkConfigVersion(); -}; - -#endif // CONFIGMANAGER_H diff --git a/src/configuration.cpp b/src/configuration.cpp deleted file mode 100644 index d3c514c67..000000000 --- a/src/configuration.cpp +++ /dev/null @@ -1,969 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "configuration.h" - -#include "variabledata.h" - -#include "fs/files.h" -#include "fs/paths.h" - -#include "fs/virtfs/fs.h" - -#include "listeners/configlistener.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" -#include "utils/foreach.h" -#ifdef DEBUG_CONFIG -#include "utils/stringmap.h" -#endif // DEBUG_CONFIG - -#include "debug.h" - -#ifdef DEBUG_CONFIG -StringIntMap optionsCount; -#define GETLOG() if (logger) {logger->log("config get: " + key); \ - if (mIsMain) optionsCount[key] = 1; } -#else // DEBUG_CONFIG -#define GETLOG() -#endif // DEBUG_CONFIG - -Configuration config; // XML file configuration reader -Configuration serverConfig; // XML file server configuration reader -Configuration features; // XML file features -Configuration branding; // XML branding information reader -Configuration paths; // XML default paths information reader - -const std::string unusedKeys[] = -{ - "BotCheckerWindowSticky", - "afkmessage", - "BotCheckerWindowVisible", - "BotCheckerWindowWinX", - "BotCheckerWindowWinY", - "hideShield", - "AttackRange", - "emoteshortcut0", - "screenshotDirectory2", - "AttackRangeBorder", - "AttackRangeBorderDelay", - "AttackRangeBorderGradient", - "AttackRangeDelay", - "AttackRangeGradient", - "Being", - "BeingDelay", - "BeingGradient", - "BeingPopupSkin", - "BotCheckerWindowSkin", - "BuySellSkin", - "BuySkin", - "ChatSkin", - "CollisionHighlight", - "CollisionHighlightDelay", - "CollisionHighlightGradient", - "ColorCross", - "ColorCrossDelay", - "ColorCrossGradient", - "ColorExperience", - "ColorExperienceGradient", - "ColorPickup", - "ColorPickupGradient", - "DebugSkin", - "DropShortcutSkin", - "EmoteShortcutSkin", - "EquipmentSkin", - "ExpInfo", - "ExpInfoDelay", - "ExpInfoGradient", - "Experience", - "ExperienceGradient", - "GM", - "GMDelay", - "GMGradient", - "Guild", - "GuildDelay", - "GuildGradient", - "GuildSkin", - "HelpSkin", - "Hit CriticalDelay", - "Hit CriticalGradient", - "Hit Monster Player", - "Hit Monster PlayerGradient", - "Hit Player Monster", - "Hit Player MonsterGradient", - "HitCriticalDelay", - "HitCriticalGradient", - "HitLocalPlayerCriticalDelay", - "HitLocalPlayerCriticalGradient", - "HitLocalPlayerMiss", - "HitLocalPlayerMissDelay", - "HitLocalPlayerMissGradient", - "HitLocalPlayerMonster", - "HitLocalPlayerMonsterDelay", - "HitLocalPlayerMonsterGradient", - "HitMonsterPlayer", - "HitMonsterPlayerDelay", - "HitMonsterPlayerGradient", - "HitPlayerMonster", - "HitPlayerMonsterDelay", - "HitPlayerMonsterGradient", - "HomePlace", - "HomePlaceBorder", - "HomePlaceBorderDelay", - "HomePlaceBorderGradient", - "HomePlaceDelay", - "HomePlaceGradient", - "InventorySkin", - "ItemPopupSkin", - "ItemShortcutSkin", - "Kill statsSkin", - "MiniStatusSkin", - "MinimapSkin", - "Miss", - "MissDelay", - "MissGradient", - "Monster", - "MonsterAttackRange", - "MonsterAttackRangeDelay", - "MonsterAttackRangeGradient", - "MonsterDelay", - "MonsterGradient", - "NPC", - "NPCDelay", - "NPCGradient", - "NpcTextSkin", - "OutfitsSkin", - "Particle", - "ParticleDelay", - "ParticleGradient", - "PartyDelay", - "PartyGradient", - "PartySkin", - "Personal ShopSkin", - "Pickup", - "PickupGradient", - "Player", - "PlayerDelay", - "PlayerGradient", - "PopupMenuSkin", - "PortalHighlight", - "PortalHighlightDelay", - "PortalHighlightGradient", - "RecorderSkin", - "RecorderWinX", - "RecorderWinY", - "RoadPoint", - "RoadPointDelay", - "RoadPointGradient", - "Self", - "SelfDelay", - "SelfGradient", - "SellSkin", - "ServerDialogSkin", - "ShopSkin", - "SkillsSkin", - "SocialCreatePopupSkin", - "SocialSkin", - "SpecialsSkin", - "SpeechSkin", - "SpellPopupSkin", - "SpellShortcutSkin", - "StatusPopupSkin", - "StatusSkin", - "StorageSkin", - "TextCommandEditorSkin", - "TextPopupSkin", - "TradeSkin", - "WhoIsOnlineSkin", - "emoteshortcut1", - "emoteshortcut2", - "emoteshortcut3", - "emoteshortcut4", - "emoteshortcut5", - "emoteshortcut6", - "emoteshortcut7", - "emoteshortcut8", - "emoteshortcut9", - "emoteshortcut10", - "emoteshortcut11", - "emoteshortcut12", - "emoteshortcut13", - "fastOpenGL", - "keyAutoCompleteChat", - "keyDeActivateChat", - "keyTargetClosest", - "keyWindowParty", - "mapalpha", - "port", - "shopBuyList", - "shopSellList", - "OutfitAwayIndex", - "playerHomes", - "remember", - "screenshotDirectory", - "" -}; - -void ConfigurationObject::setValue(const std::string &key, - const std::string &value) -{ - mOptions[key] = value; -} - -void ConfigurationObject::deleteKey(const std::string &key) -{ - mOptions.erase(key); -} - -void Configuration::setValue(const std::string &key, - const std::string &value) -{ - ConfigurationObject::setValue(key, value); - mUpdated = true; - - // Notify listeners - const ListenerMapIterator list = mListenerMap.find(key); - if (list != mListenerMap.end()) - { - Listeners listeners = list->second; - FOR_EACH (ListenerIterator, i, listeners) - (*i)->optionChanged(key); - } -} - -void Configuration::incValue(const std::string &key) -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - setValue(key, (iter != mOptions.end()) - ? atoi(iter->second.c_str()) + 1 : 1); -} - -void Configuration::setSilent(const std::string &key, - const std::string &value) -{ - ConfigurationObject::setValue(key, value); -} - -std::string ConfigurationObject::getValue(const std::string &key, - const std::string &deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - return ((iter != mOptions.end()) ? iter->second : deflt); -} - -int ConfigurationObject::getValue(const std::string &key, - const int deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - return (iter != mOptions.end()) ? atoi(iter->second.c_str()) : deflt; -} - -int ConfigurationObject::getValueInt(const std::string &key, - const int deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - return (iter != mOptions.end()) ? atoi(iter->second.c_str()) : deflt; -} - -bool ConfigurationObject::getValueBool(const std::string &key, - const bool deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - if (iter != mOptions.end()) - return atoi(iter->second.c_str()) != 0 ? true : false; - return deflt; -} - -unsigned ConfigurationObject::getValue(const std::string &key, - const unsigned deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - return (iter != mOptions.end()) ? CAST_U32( - atol(iter->second.c_str())) : deflt; -} - -double ConfigurationObject::getValue(const std::string &key, - const double deflt) const -{ - GETLOG(); - const Options::const_iterator iter = mOptions.find(key); - return (iter != mOptions.end()) ? atof(iter->second.c_str()) : deflt; -} - -void ConfigurationObject::deleteList(const std::string &name) -{ - for (ConfigurationList::const_iterator - it = mContainerOptions[name].begin(); - it != mContainerOptions[name].end(); ++it) - { - delete *it; - } - - mContainerOptions[name].clear(); -} - -void ConfigurationObject::clear() -{ - for (std::map::const_iterator - it = mContainerOptions.begin(); - it != mContainerOptions.end(); ++it) - { - deleteList(it->first); - } - mOptions.clear(); - mContainerOptions.clear(); -} - -ConfigurationObject::ConfigurationObject() : - mOptions(), -#ifdef DEBUG_CONFIG - mContainerOptions(), - mLogKeys(false), - mIsMain(false) -#else // DEBUG_CONFIG - - mContainerOptions() -#endif // DEBUG_CONFIG -{ -} - -ConfigurationObject::~ConfigurationObject() -{ - clear(); -} - -Configuration::Configuration() : - ConfigurationObject(), - mListenerMap(), - mConfigPath(), - mDefaultsData(), - mDirectory(), - mFilename(), - mUseResManager(UseVirtFs_false), - mUpdated(false) -{ -#ifdef DEBUG_CONFIG - mLogKeys = false; - mIsMain = false; -#endif // DEBUG_CONFIG -} - -void Configuration::cleanDefaults() -{ - for (DefaultsData::const_iterator iter = mDefaultsData.begin(); - iter != mDefaultsData.end(); - ++iter) - { - delete iter->second; - } - mDefaultsData.clear(); -} - -Configuration::~Configuration() -{ - cleanDefaults(); -} - -void Configuration::unload() -{ - cleanDefaults(); - mConfigPath.clear(); - mDirectory.clear(); - mFilename.clear(); - mUseResManager = UseVirtFs_false; - ConfigurationObject::clear(); -} - -int Configuration::getIntValue(const std::string &key) const -{ - GETLOG(); - int defaultValue = 0; - const Options::const_iterator iter = mOptions.find(key); - if (iter == mOptions.end()) - { - const DefaultsData::const_iterator itdef - = mDefaultsData.find(key); - - if (itdef != mDefaultsData.end() && (itdef->second != nullptr)) - { - const VariableData *const data = itdef->second; - const VariableData::DataType type = static_cast< - VariableData::DataType>(data->getType()); - if (type == VariableData::DATA_INT) - { - defaultValue = (static_cast( - data))->getData(); - } - else if (type == VariableData::DATA_STRING) - { - defaultValue = atoi((static_cast( - data))->getData().c_str()); - } - else if (type == VariableData::DATA_BOOL) - { - if ((static_cast(data))->getData()) - defaultValue = 1; - else - defaultValue = 0; - } - else if (type == VariableData::DATA_FLOAT) - { - defaultValue = CAST_S32( - (static_cast(data))->getData()); - } - } - else - { - reportAlways( - "%s: No integer value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - else - { - defaultValue = atoi(iter->second.c_str()); - } - return defaultValue; -} - -int Configuration::resetIntValue(const std::string &key) -{ - GETLOG(); - int defaultValue = 0; - const DefaultsData::const_iterator itdef = mDefaultsData.find(key); - if (itdef == mDefaultsData.end()) - { - reportAlways("%s: No integer value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - else - { - const VariableData *const data = itdef->second; - if (data != nullptr && - data->getType() == VariableData::DATA_INT) - { - defaultValue = (static_cast( - data))->getData(); - } - else - { - reportAlways("%s: No integer value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - setValue(key, defaultValue); - return defaultValue; -} - -std::string Configuration::getStringValue(const std::string &key) const -{ - GETLOG(); - std::string defaultValue; - const Options::const_iterator iter = mOptions.find(key); - if (iter == mOptions.end()) - { - const DefaultsData::const_iterator - itdef = mDefaultsData.find(key); - - if (itdef != mDefaultsData.end() && - (itdef->second != nullptr)) - { - const VariableData *const data = itdef->second; - const VariableData::DataType type = static_cast< - VariableData::DataType>(data->getType()); - if (type == VariableData::DATA_STRING) - { - defaultValue = (static_cast( - data))->getData(); - } - else if (type == VariableData::DATA_BOOL) - { - if ((static_cast(data))->getData()) - defaultValue = "1"; - else - defaultValue = "0"; - } - else if (type == VariableData::DATA_INT) - { - defaultValue = toString((static_cast( - data))->getData()); - } - else if (type == VariableData::DATA_FLOAT) - { - defaultValue = toString((static_cast( - data))->getData()); - } - } - else - { - reportAlways("%s: No string value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - else - { - defaultValue = iter->second; - } - return defaultValue; -} - - -float Configuration::getFloatValue(const std::string &key) const -{ - GETLOG(); - float defaultValue = 0.0F; - const Options::const_iterator iter = mOptions.find(key); - if (iter == mOptions.end()) - { - const DefaultsData::const_iterator itdef - = mDefaultsData.find(key); - - if (itdef != mDefaultsData.end() && - (itdef->second != nullptr)) - { - const VariableData *const data = itdef->second; - const VariableData::DataType type = static_cast< - VariableData::DataType>(data->getType()); - if (type == VariableData::DATA_FLOAT) - { - defaultValue = static_cast( - (static_cast(data))->getData()); - } - else if (type == VariableData::DATA_STRING) - { - defaultValue = static_cast(atof(( - static_cast( - data))->getData().c_str())); - } - else if (type == VariableData::DATA_BOOL) - { - if ((static_cast(data))->getData()) - defaultValue = 1; - else - defaultValue = 0; - } - else if (type == VariableData::DATA_INT) - { - defaultValue = static_cast(( - static_cast( - data))->getData()); - } - } - else - { - reportAlways("%s: No float value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - else - { - defaultValue = static_cast(atof(iter->second.c_str())); - } - return defaultValue; -} - -bool Configuration::getBoolValue(const std::string &key) const -{ - GETLOG(); - bool defaultValue = false; - const Options::const_iterator iter = mOptions.find(key); - if (iter == mOptions.end()) - { - const DefaultsData::const_iterator itdef - = mDefaultsData.find(key); - - if (itdef != mDefaultsData.end() && - (itdef->second != nullptr)) - { - const VariableData *const data = itdef->second; - const VariableData::DataType type = static_cast< - VariableData::DataType>(data->getType()); - if (type == VariableData::DATA_BOOL) - { - defaultValue = (static_cast( - data))->getData(); - } - else if (type == VariableData::DATA_INT) - { - if ((static_cast(data))->getData() != 0) - defaultValue = true; - else - defaultValue = false; - } - else if (type == VariableData::DATA_STRING) - { - if ((static_cast( - data))->getData() != "0") - { - defaultValue = true; - } - else - { - defaultValue = false; - } - } - if (type == VariableData::DATA_FLOAT) - { - if (CAST_S32((static_cast( - data))->getData()) != 0) - { - defaultValue = true; - } - else - { - defaultValue = false; - } - } - } - else - { - reportAlways( - "%s: No boolean value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - else - { - defaultValue = getBoolFromString(iter->second); - } - - return defaultValue; -} - -bool Configuration::resetBoolValue(const std::string &key) -{ - GETLOG(); - bool defaultValue = false; - const DefaultsData::const_iterator itdef = mDefaultsData.find(key); - - if (itdef == mDefaultsData.end()) - { - reportAlways("%s: No boolean value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - else - { - const VariableData *const data = itdef->second; - if (data != nullptr && - data->getType() == VariableData::DATA_BOOL) - { - defaultValue = (static_cast(data))->getData(); - } - else - { - reportAlways("%s: No boolean value in registry for key %s", - mConfigPath.c_str(), - key.c_str()); - } - } - - setValue(key, defaultValue); - return defaultValue; -} - - -void ConfigurationObject::initFromXML(XmlNodeConstPtrConst parentNode) -{ - clear(); - - if (parentNode == nullptr) - return; - - for_each_xml_child_node(node, parentNode) - { - if (xmlNameEqual(node, "list")) - { - // list option handling - const std::string name = XML::getProperty(node, - "name", std::string()); - - for_each_xml_child_node(subnode, node) - { - if (xmlNameEqual(subnode, name.c_str()) && - xmlTypeEqual(subnode, XML_ELEMENT_NODE)) - { - ConfigurationObject *const cobj = new ConfigurationObject; - cobj->initFromXML(subnode); // recurse - mContainerOptions[name].push_back(cobj); - } - } - } - else if (xmlNameEqual(node, "option")) - { - // single option handling - const std::string name = XML::getProperty(node, - "name", std::string()); - if (!name.empty()) - { - mOptions[name] = XML::getProperty(node, - "value", std::string()); - } - } // otherwise ignore - } -} - -void Configuration::init(const std::string &filename, - const UseVirtFs useResManager, - const SkipError skipError) -{ - cleanDefaults(); - clear(); - mFilename = filename; - mUseResManager = useResManager; - - if (useResManager == UseVirtFs_true) - { - mConfigPath = "virtfs://" + filename; - mDirectory.clear(); - if (VirtFs::exists(filename) == false) - { - logger->log("Warning: No configuration file (%s)", - filename.c_str()); - return; - } - } - else - { - mConfigPath = filename; - logger->log1("init 1"); - mDirectory = getRealPath(getFileDir(filename)); - if (Files::existsLocal(filename) == false) - { - logger->log("Warning: No configuration file (%s)", - filename.c_str()); - return; - } - } - - XML::Document doc(filename, - useResManager, - skipError); - logger->log1("init 2"); - if (doc.rootNode() == nullptr) - { - logger->log("Couldn't open configuration file: %s", filename.c_str()); - return; - } - - XmlNodeConstPtrConst rootNode = doc.rootNode(); - - if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "configuration")) - { - logger->log("Warning: No configuration file (%s)", filename.c_str()); - return; - } - - initFromXML(rootNode); -} - -void Configuration::reInit() -{ - XML::Document doc(mFilename, mUseResManager, SkipError_false); - if (doc.rootNode() == nullptr) - { - logger->log("Couldn't open configuration file: %s", mFilename.c_str()); - return; - } - - XmlNodeConstPtrConst rootNode = doc.rootNode(); - - if ((rootNode == nullptr) || !xmlNameEqual(rootNode, "configuration")) - { - logger->log("Warning: No configuration file (%s)", mFilename.c_str()); - return; - } - - initFromXML(rootNode); -} - -void ConfigurationObject::writeToXML(XmlTextWriterPtr writer) -{ - FOR_EACH (Options::const_iterator, i, mOptions) - { -#ifdef DEBUG_CONFIG - if (mLogKeys) - { - if (optionsCount.find(i->first) == optionsCount.end()) - logger->log("unused configuration option: " + i->first); - } -#endif // DEBUG_CONFIG - - XmlTextWriterStartElement(writer, "option"); - XmlTextWriterWriteAttribute(writer, "name", i->first.c_str()); - XmlTextWriterWriteAttribute(writer, "value", i->second.c_str()); - XmlTextWriterEndElement(writer); - } - - for (std::map::const_iterator - it = mContainerOptions.begin(), it_fend = mContainerOptions.end(); - it != it_fend; ++ it) - { - const char *const name = it->first.c_str(); - - XmlTextWriterStartElement(writer, "list"); - XmlTextWriterWriteAttribute(writer, "name", name); - - // recurse on all elements - FOR_EACH (ConfigurationList::const_iterator, elt_it, it->second) - { - XmlTextWriterStartElement(writer, name); - if (*elt_it != nullptr) - (*elt_it)->writeToXML(writer); - XmlTextWriterEndElement(writer); - } - - XmlTextWriterEndElement(writer); - } -} - -void Configuration::writeUpdated() -{ - if (mUpdated) - write(); -} - -void Configuration::write() -{ - BLOCK_START("Configuration::write") - if (mConfigPath.empty()) - { - BLOCK_END("Configuration::write") - return; - } - - mUpdated = false; - // Do not attempt to write to file that cannot be opened for writing - FILE *const testFile = fopen(mConfigPath.c_str(), "w"); - if (testFile == nullptr) - { - reportAlways("Configuration::write() couldn't open %s for writing", - mConfigPath.c_str()); - BLOCK_END("Configuration::write") - return; - } - fclose(testFile); - - XmlTextWriterPtr writer = XmlNewTextWriterFilename( - mConfigPath.c_str(), 0); - - if (writer == nullptr) - { - logger->log1("Configuration::write() error while creating writer"); - BLOCK_END("Configuration::write") - return; - } - - logger->log1("Configuration::write() writing configuration..."); - - XmlTextWriterSetIndent(writer, 1); - XmlTextWriterStartDocument(writer, nullptr, nullptr, nullptr); -// xmlTextWriterStartDocument(writer, nullptr, "utf8", nullptr); - XmlTextWriterStartRootElement(writer, "configuration"); - - writeToXML(writer); - - XmlTextWriterEndDocument(writer); - XmlSaveTextWriterFilename(writer, - mConfigPath.c_str()); - XmlFreeTextWriter(writer); - BLOCK_END("Configuration::write") -} - -void Configuration::addListener(const std::string &key, - ConfigListener *const listener) -{ - mListenerMap[key].push_front(listener); -} - -void Configuration::removeListener(const std::string &key, - ConfigListener *const listener) -{ - mListenerMap[key].remove(listener); -} - -#ifdef ENABLE_CHECKS -void Configuration::checkListeners(ConfigListener *const listener, - const char *const file, - const unsigned line) -{ - FOR_EACH (ListenerMapIterator, it, mListenerMap) - { - Listeners listeners = it->second; - FOR_EACH (ListenerIterator, it2, listeners) - { - if (*it2 == listener) - { - logger->log("detected not cleaned listener: %p, %s:%u", - static_cast(listener), file, line); - exit(1); - } - } - } -} -#endif // ENABLE_CHECKS - -void Configuration::removeListeners(ConfigListener *const listener) -{ - FOR_EACH (ListenerMapIterator, it, mListenerMap) - (it->second).remove(listener); -} - -void Configuration::removeOldKeys() -{ - if (mOptions.find(unusedKeys[0]) != mOptions.end() || - mOptions.find(unusedKeys[1]) != mOptions.end() || - mOptions.find(unusedKeys[2]) != mOptions.end()) - { - int f = 0; - while (!unusedKeys[f].empty()) - { - deleteKey(unusedKeys[f]); - logger->log("remove unused key: " + unusedKeys[f]); - f ++; - } - for (f = 0; f < 80; f ++) - { - const std::string str = toString(f); - deleteKey("Outfit" + str); - deleteKey("OutfitUnequip" + str); - deleteKey("commandShortcutCmd" + str); - deleteKey("commandShortcutFlags" + str); - deleteKey("commandShortcutSymbol" + str); - deleteKey("drop" + str); - deleteKey("shortcut" + str); - } - } -} diff --git a/src/configuration.h b/src/configuration.h deleted file mode 100644 index dae353143..000000000 --- a/src/configuration.h +++ /dev/null @@ -1,392 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONFIGURATION_H -#define CONFIGURATION_H - -#include "utils/stringutils.h" -#ifdef ENABLE_PUGIXML -#include "utils/xmlwriter.h" -#else -#include "utils/xml.h" -#endif // ENABLE_PUGIXML - -#include "defaults.h" -#include "localconsts.h" - -class ConfigListener; -class ConfigurationObject; - -/** - * Configuration list manager interface; responsible for - * serializing/deserializing configuration choices in containers. - * - * \param T Type of the container elements to serialise - * \param CONT Type of the container we (de)serialise - */ -template -class ConfigurationListManager notfinal -{ - public: - ConfigurationListManager() - { } - - A_DELETE_COPY(ConfigurationListManager) - - /** - * Writes a value into a configuration object - * - * \param value The value to write out - * \param obj The configuation object to write to - * \return obj, or otherwise NULL to indicate that this option should - * be skipped - */ - virtual ConfigurationObject *writeConfigItem(const T &value, - ConfigurationObject - *const obj) const = 0; - - /** - * Reads a value from a configuration object - * - * \param obj The configuration object to read from - * \param container The container to insert the object to - */ - virtual CONT readConfigItem(const ConfigurationObject *const obj, - CONT container) - const A_WARN_UNUSED = 0; - - virtual ~ConfigurationListManager() - { } -}; - -/** - * Configuration object, mapping values to names and possibly containing - * lists of further configuration objects - * - * \ingroup CORE - */ -class ConfigurationObject notfinal -{ - friend class Configuration; - - public: - A_DELETE_COPY(ConfigurationObject) - - virtual ~ConfigurationObject(); - - /** - * Sets an option using a string value. - * - * \param key Option identifier. - * \param value Value. - */ - virtual void setValue(const std::string &key, - const std::string &value); - - void deleteKey(const std::string &key); - - /** - * Gets a value as string. - * - * \param key Option identifier. - * \param deflt Default option if not there or error. - */ - std::string getValue(const std::string &key, - const std::string &deflt) const A_WARN_UNUSED; - - int getValue(const std::string &key, - const int deflt) const A_WARN_UNUSED; - - int getValueInt(const std::string &key, - const int deflt) const A_WARN_UNUSED; - - bool getValueBool(const std::string &key, - const bool deflt) const A_WARN_UNUSED; - - unsigned getValue(const std::string &key, - const unsigned deflt) const A_WARN_UNUSED; - - double getValue(const std::string &key, - const double deflt) const A_WARN_UNUSED; - - /** - * Re-sets all data in the configuration - */ - void clear(); - - /** - * Serialises a container into a list of configuration options - * - * \param name Name of the list the elements should be stored under - * \param begin Iterator start - * \param end Iterator end - * \param manager An object capable of serialising T items - */ - template - void setList(const std::string &name, IT begin, IT end, - ConfigurationListManager *manager) - { - if (!manager) - return; - - ConfigurationObject *nextobj = new ConfigurationObject; - deleteList(name); - ConfigurationList *list = &(mContainerOptions[name]); - - for (IT it = begin; it != end; it++) - { - ConfigurationObject *const wrobj - = manager->writeConfigItem(*it, nextobj); - if (wrobj) - { // wrote something - nextobj = new ConfigurationObject; - list->push_back(wrobj); - } - else - { - nextobj->clear(); // you never know... - } - } - - delete nextobj; - } - - /** - * Serialises a container into a list of configuration options - * - * \param name Name of the list the elements should be read from under - * \param empty Initial (empty) container to write to - * \param manager An object capable of deserialising items into CONT - */ - template - CONT getList(const std::string &name, CONT empty, - ConfigurationListManager *manager) - { - ConfigurationList *const list = &(mContainerOptions[name]); - CONT container = empty; - - if (!manager) - return container; - - for (ConfigurationList::const_iterator it = list->begin(); - it != list->end(); - ++ it) - { - container = manager->readConfigItem(*it, container); - } - - return container; - } - -#ifdef DEBUG_CONFIG - void enableKeyLogging() - { mLogKeys = true; } - - void setIsMain(bool b) - { mIsMain = b; } -#endif // DEBUG_CONFIG - - protected: - ConfigurationObject(); - - virtual void initFromXML(XmlNodeConstPtrConst parentNode); - virtual void writeToXML(XmlTextWriterPtr writer); - - void deleteList(const std::string &name); - - typedef std::map Options; - Options mOptions; - - typedef std::list ConfigurationList; - std::map mContainerOptions; - -#ifdef DEBUG_CONFIG - bool mLogKeys; - bool mIsMain; -#endif // DEBUG_CONFIG -}; - -#define valTest(num) mStatsRe##num - -/** - * Configuration handler for reading (and writing). - * - * \ingroup CORE - */ -class Configuration final : public ConfigurationObject -{ - public: - Configuration(); - - A_DELETE_COPY(Configuration) - - ~Configuration(); - - /** - * Reads config file and parse all options into memory. - * - * @param filename path to config file - * @param useResManager Make use of the resource manager. - */ - void init(const std::string &filename, - const UseVirtFs useResManager = UseVirtFs_false, - const SkipError skipError = SkipError_false); - - void reInit(); - - void unload(); - - DefaultsData &getDefaultValues() - { return mDefaultsData; } - - /** - * Writes the current settings back to the config file. - */ - void write(); - - /** - * Adds a listener to the listen list of the specified config option. - */ - void addListener(const std::string &key, - ConfigListener *const listener); - - /** - * Removes a listener from the listen list of the specified config - * option. - */ - void removeListener(const std::string &key, - ConfigListener *const listener); - - void removeListeners(ConfigListener *const listener); - -#ifdef ENABLE_CHECKS - void checkListeners(ConfigListener *const listener, - const char *const file, - const unsigned line); -#endif // ENABLE_CHECKS - - void setValue(const std::string &key, - const std::string &value) override; - - void incValue(const std::string &key); - - void setSilent(const std::string &key, - const std::string &value); - - inline void setValue(const std::string &key, - const char *const value) - { if (value != nullptr) setValue(key, std::string(value)); } - - inline void setSilent(const std::string &key, - const char *const value) - { if (value != nullptr) setSilent(key, std::string(value)); } - - inline void setValue(const std::string &key, - const float value) - { setValue(key, toString(value)); } - - inline void setValue(const std::string &key, - const double value) - { setValue(key, toString(value)); } - - inline void setValue(const std::string &key, - const int value) - { setValue(key, toString(value)); } - - inline void setValueInt(const std::string &key, - const int value) - { setValue(key, toString(value)); } - - inline void setValue(const std::string &key, - const unsigned value) - { setValue(key, toString(value)); } - - inline void setValue(const std::string &key, - const bool value) - { setValue(key, value ? "1" : "0"); } - - inline void setSilent(const std::string &key, - const bool value) - { setSilent(key, value ? "1" : "0"); } - - int resetIntValue(const std::string &key); - - bool resetBoolValue(const std::string &key); - - const std::string &getConfigPath() const noexcept2 A_WARN_UNUSED - { return mConfigPath; } - - /** - * returns a value corresponding to the given key. - * The default value returned in based on fallbacks registry. - * @see defaults.h - */ - int getIntValue(const std::string &key) const A_WARN_UNUSED_NON_TESTS; - - float getFloatValue(const std::string &key) const - A_WARN_UNUSED_NON_TESTS; - - std::string getStringValue(const std::string &key) const - A_WARN_UNUSED_NON_TESTS; - - bool getBoolValue(const std::string &key) const - A_WARN_UNUSED_NON_TESTS; - - std::string getDirectory() const noexcept2 A_WARN_UNUSED - { return mDirectory; } - - void removeOldKeys(); - - std::string getFileName() const noexcept2 A_WARN_UNUSED - { return mFilename; } - - void writeUpdated(); - - /** - * Clean up the default values member. - */ - void cleanDefaults(); - - private: - typedef std::list Listeners; - typedef Listeners::iterator ListenerIterator; - typedef std::map ListenerMap; - typedef ListenerMap::iterator ListenerMapIterator; - ListenerMap mListenerMap; - - // Location of config file - std::string mConfigPath; - /// Defaults of value for a given key - DefaultsData mDefaultsData; - std::string mDirectory; - std::string mFilename; - UseVirtFs mUseResManager; - bool mUpdated; -}; - -extern Configuration branding; -extern Configuration config; -extern Configuration serverConfig; -extern Configuration paths; -extern Configuration features; - -#endif // CONFIGURATION_H diff --git a/src/const/emoteshortcut.h b/src/const/emoteshortcut.h deleted file mode 100644 index cf0ca44ee..000000000 --- a/src/const/emoteshortcut.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_EMOTESHORTCUT_H -#define CONST_EMOTESHORTCUT_H - -static const int SHORTCUT_EMOTES = 48; - -#endif // CONST_EMOTESHORTCUT_H diff --git a/src/const/equipment.h b/src/const/equipment.h deleted file mode 100644 index 284157e97..000000000 --- a/src/const/equipment.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_EQUIPMENT_H -#define CONST_EQUIPMENT_H - -#include "localconsts.h" - -static const int EQUIPMENT_SIZE = 27; - -#endif // CONST_EQUIPMENT_H diff --git a/src/const/gui/chat.h b/src/const/gui/chat.h deleted file mode 100644 index a39516e13..000000000 --- a/src/const/gui/chat.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_GUI_CHAT_H -#define CONST_GUI_CHAT_H - -#include - -const std::string GENERAL_CHANNEL; -const std::string GM_CHANNEL = "#gm"; -const std::string TRADE_CHANNEL = "#trade"; - -#endif // CONST_GUI_CHAT_H diff --git a/src/const/gui/pages.h b/src/const/gui/pages.h deleted file mode 100644 index 218518bdd..000000000 --- a/src/const/gui/pages.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_GUI_PAGES_H -#define CONST_GUI_PAGES_H - -#include "localconsts.h" - -const int SETUP_PAGES = 10; - -#endif // CONST_GUI_PAGES_H diff --git a/src/const/gui/theme.h b/src/const/gui/theme.h deleted file mode 100644 index 0ec96bf78..000000000 --- a/src/const/gui/theme.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 The Legend of Mazzeroth Development Team - * Copyright (C) 2009 Aethyra Development Team - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_GUI_THEME_H -#define CONST_GUI_THEME_H - -#include "localconsts.h" - -const int THEME_PALETTES = 5; - -#endif // CONST_GUI_THEME_H diff --git a/src/const/itemshortcut.h b/src/const/itemshortcut.h deleted file mode 100644 index 002181657..000000000 --- a/src/const/itemshortcut.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_ITEMSHORTCUT_H -#define CONST_ITEMSHORTCUT_H - -#include "localconsts.h" - -const unsigned int SHORTCUT_ITEMS = 20; -const unsigned int SHORTCUT_TABS = 5; -const size_t SHORTCUT_AUTO_TAB = 4; - -#endif // CONST_ITEMSHORTCUT_H diff --git a/src/const/net/inventory.h b/src/const/net/inventory.h deleted file mode 100644 index a3729bb4c..000000000 --- a/src/const/net/inventory.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_NET_INVENTORY_H -#define CONST_NET_INVENTORY_H - -static const int INVENTORY_OFFSET = 2; -static const int STORAGE_OFFSET = 1; - -#endif // CONST_NET_INVENTORY_H diff --git a/src/const/net/maxpacketversion.h b/src/const/net/maxpacketversion.h deleted file mode 100644 index efc38463a..000000000 --- a/src/const/net/maxpacketversion.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef CONST_NET_MAXPACKETVERSION_H -#define CONST_NET_MAXPACKETVERSION_H - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) -#include -#else // defined(__GXX_EXPERIMENTAL_CXX0X__) -#include -#endif // defined(__GXX_EXPERIMENTAL_CXX0X__) - -static const uint32_t maxPacketVersion = 20170517; - -#endif // CONST_NET_MAXPACKETVERSION_H diff --git a/src/const/net/net.h b/src/const/net/net.h deleted file mode 100644 index f4797e5c9..000000000 --- a/src/const/net/net.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef CONST_NET_NET_H -#define CONST_NET_NET_H - -#if defined(__GXX_EXPERIMENTAL_CXX0X__) -#include -#else // defined(__GXX_EXPERIMENTAL_CXX0X__) -#include -#endif // defined(__GXX_EXPERIMENTAL_CXX0X__) - -#ifdef TMWA_SUPPORT -static const uint16_t DEFAULT_PORT = 6901; -#else // TMWA_SUPPORT - -static const uint16_t DEFAULT_PORT = 6900; -#endif // TMWA_SUPPORT -#endif // CONST_NET_NET_H diff --git a/src/const/net/nostat.h b/src/const/net/nostat.h deleted file mode 100644 index 721db244c..000000000 --- a/src/const/net/nostat.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_NET_NOSTAT_H -#define CONST_NET_NOSTAT_H - -#include - -static const int NoStat = INT_MAX; - -#endif // CONST_NET_NOSTAT_H diff --git a/src/const/net/skill.h b/src/const/net/skill.h deleted file mode 100644 index da1f685d6..000000000 --- a/src/const/net/skill.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_NET_SKILL_H -#define CONST_NET_SKILL_H - -#include "localconsts.h" - -/** job dependend identifiers (?) */ -static const unsigned int SKILL_BASIC = 0x0001; -static const unsigned int SKILL_WARP = 0x001b; -static const unsigned int SKILL_STEAL = 0x0032; -static const unsigned int SKILL_ENVENOM = 0x0034; - -/** basic skills identifiers */ -static const unsigned int BSKILL_TRADE = 0x0000; -static const unsigned int BSKILL_EMOTE = 0x0001; -static const unsigned int BSKILL_SIT = 0x0002; -static const unsigned int BSKILL_CREATECHAT = 0x0003; -static const unsigned int BSKILL_JOINPARTY = 0x0004; -static const unsigned int BSKILL_SHOUT = 0x0005; - -/** reasons why action failed */ -static const unsigned int RFAIL_SKILLDEP = 0x00; -static const unsigned int RFAIL_INSUFSP = 0x01; -static const unsigned int RFAIL_INSUFHP = 0x02; -static const unsigned int RFAIL_NOMEMO = 0x03; -static const unsigned int RFAIL_SKILLDELAY = 0x04; -static const unsigned int RFAIL_ZENY = 0x05; -static const unsigned int RFAIL_WEAPON = 0x06; -static const unsigned int RFAIL_REDGEM = 0x07; -static const unsigned int RFAIL_BLUEGEM = 0x08; -static const unsigned int RFAIL_OVERWEIGHT = 0x09; - -/** should always be zero if failed */ -static const unsigned int SKILL_FAILED = 0x00; - -#endif // CONST_NET_SKILL_H diff --git a/src/const/render/graphics.h b/src/const/render/graphics.h deleted file mode 100644 index 29e4864fe..000000000 --- a/src/const/render/graphics.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RENDER_GRAPHICS_H -#define CONST_RENDER_GRAPHICS_H - -#include "localconsts.h" - -static const int defaultScreenWidth = 800; -static const int defaultScreenHeight = 600; - -#endif // CONST_RENDER_GRAPHICS_H diff --git a/src/const/resources/currency.h b/src/const/resources/currency.h deleted file mode 100644 index e5f6cfccf..000000000 --- a/src/const/resources/currency.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_SKILL_H -#define CONST_RESOURCES_SKILL_H - -#include - -const std::string DEFAULT_CURRENCY = "default"; - -#endif // CONST_RESOURCES_SKILL_H diff --git a/src/const/resources/item/cards.h b/src/const/resources/item/cards.h deleted file mode 100644 index bcd999433..000000000 --- a/src/const/resources/item/cards.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_ITEM_CARDS_H -#define CONST_RESOURCES_ITEM_CARDS_H - -#define maxCards 4 -#define maxMailCards 4 - -#define CARD0_FORGE 0x00FF -#define CARD0_CREATE 0x00FE -#define CARD0_PET static_cast(0xFF00) - -#endif // CONST_RESOURCES_ITEM_CARDS_H diff --git a/src/const/resources/item/itemoptions.h b/src/const/resources/item/itemoptions.h deleted file mode 100644 index 3c028ea64..000000000 --- a/src/const/resources/item/itemoptions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_ITEM_ITEMOPTIONS_H -#define CONST_RESOURCES_ITEM_ITEMOPTIONS_H - -#define maxItemOptions 5 - -#endif // CONST_RESOURCES_ITEM_ITEMOPTIONS_H diff --git a/src/const/resources/map/map.h b/src/const/resources/map/map.h deleted file mode 100644 index 25727acfd..000000000 --- a/src/const/resources/map/map.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_MAP_MAP_H -#define CONST_RESOURCES_MAP_MAP_H - -static const int mapTileSize = 32; - -#endif // CONST_RESOURCES_MAP_MAP_H diff --git a/src/const/resources/skill.h b/src/const/resources/skill.h deleted file mode 100644 index 68ec3a56c..000000000 --- a/src/const/resources/skill.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_SKILL_H -#define CONST_RESOURCES_SKILL_H - -const int SKILL_MIN_ID = 200000; -const unsigned int SKILL_VAR_MIN_ID = 1000000; - -#endif // CONST_RESOURCES_SKILL_H diff --git a/src/const/resources/spriteaction.h b/src/const/resources/spriteaction.h deleted file mode 100644 index da865d3df..000000000 --- a/src/const/resources/spriteaction.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_RESOURCES_SPRITEACTION_H -#define CONST_RESOURCES_SPRITEACTION_H - -#include - -/* - * Remember those are the main action. - * Action subtypes, e.g.: "attack_bow" are to be passed by items.xml after - * an ACTION_ATTACK call. - * Which special to be use to to be passed with the USE_SPECIAL call. - * Running, walking, ... is a sub-type of moving. - * ... - * Please don't add hard-coded subtypes here! - */ -namespace SpriteAction -{ - static const std::string DEFAULT("stand"); - static const std::string STAND("stand"); - static const std::string SIT("sit"); - static const std::string SITTOP("sittop"); - static const std::string DEAD("dead"); - static const std::string MOVE("walk"); - static const std::string ATTACK("attack"); - static const std::string SPAWN("spawn"); - static const std::string CAST("cast"); - - static const std::string FLY("fly"); - static const std::string SWIM("swim"); - static const std::string RIDE("ride"); - static const std::string STANDSKY("standsky"); - static const std::string STANDWATER("standwater"); - static const std::string STANDRIDE("standride"); - static const std::string SITSKY("sitsky"); - static const std::string SITWATER("sitwater"); - static const std::string SITRIDE("sitride"); - static const std::string ATTACKSKY("attacksky"); - static const std::string ATTACKWATER("attackwater"); - static const std::string ATTACKRIDE("attackride"); - static const std::string CASTSKY("castsky"); - static const std::string CASTWATER("castwater"); - static const std::string CASTRIDE("castride"); - static const std::string SPAWNSKY("spawnsky"); - static const std::string SPAWNWATER("spawnwater"); - static const std::string SPAWNRIDE("spawnride"); - static const std::string DEADSKY("deadsky"); - static const std::string DEADWATER("deadwater"); - static const std::string DEADRIDE("deadride"); - - static const std::string INVALID; -} // namespace SpriteAction - -#endif // CONST_RESOURCES_SPRITEACTION_H diff --git a/src/const/sound.h b/src/const/sound.h deleted file mode 100644 index ccb96b523..000000000 --- a/src/const/sound.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_SOUND_H -#define CONST_SOUND_H - -#include - -static const std::string SOUND_INFO = "soundinfo"; -static const std::string SOUND_ERROR = "sounderror"; -static const std::string SOUND_REQUEST = "soundrequest"; -static const std::string SOUND_TRADE = "soundtrade"; -static const std::string SOUND_WHISPER = "soundwhisper"; -static const std::string SOUND_HIGHLIGHT = "soundhighlight"; -static const std::string SOUND_GLOBAL = "soundglobal"; -static const std::string SOUND_GUILD = "soundguild"; -static const std::string SOUND_SHOW_WINDOW = "soundshowwindow"; -static const std::string SOUND_HIDE_WINDOW = "soundhidewindow"; - -#endif // CONST_SOUND_H diff --git a/src/const/spells.h b/src/const/spells.h deleted file mode 100644 index 96eea8f92..000000000 --- a/src/const/spells.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_SPELLS_H -#define CONST_SPELLS_H - -#include "localconsts.h" - -const int SPELL_MIN_ID = 100000; -const unsigned int SPELL_SHORTCUT_ITEMS = 49; -const unsigned int SPELL_SHORTCUT_TABS = 5; -const unsigned int SPELLS_SIZE = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; - -#endif // CONST_SPELLS_H diff --git a/src/const/utils/timer.h b/src/const/utils/timer.h deleted file mode 100644 index a4873ffeb..000000000 --- a/src/const/utils/timer.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_UTILS_TIMER_H -#define CONST_UTILS_TIMER_H - -#include "localconsts.h" - -/** - * Set the milliseconds value of a tick time. - */ -static const int MILLISECONDS_IN_A_TICK = 10; - -#endif // CONST_UTILS_TIMER_H diff --git a/src/const/utils/utf8.h b/src/const/utils/utf8.h deleted file mode 100644 index d7042f958..000000000 --- a/src/const/utils/utf8.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef CONST_UTILS_UTF8_H -#define CONST_UTILS_UTF8_H - -#include "localconsts.h" - -static const size_t UTF8_MAX_SIZE = 10; - -#endif // CONST_UTILS_UTF8_H diff --git a/src/debug.h b/src/debug.h deleted file mode 100644 index 307766806..000000000 --- a/src/debug.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "localconsts.h" - -// #define DEBUG_JOYSTICK 1 - -#ifdef ENABLE_MEM_DEBUG - -// #define _DEBUG_NEW_EMULATE_MALLOC 1 -#include "debug/nvwa/debug_new.h" - -#endif // ENABLE_MEM_DEBUG - -#ifdef DEBUG_SDL_SURFACES - -#define MIMG_LoadPNG_RW(src) FakeIMG_LoadPNG_RW(src, __FILE__, __LINE__) -#define MIMG_LoadJPG_RW(src) FakeIMG_LoadJPG_RW(src, __FILE__, __LINE__) -#define MSDL_FreeSurface(s) FakeSDL_FreeSurface(s, __FILE__, __LINE__) -#define MSDL_CreateRGBSurface(flags, w, h, d, r, g, b, a) \ - FakeSDL_CreateRGBSurface(flags, w, h, d, r, g, b, a, __FILE__, __LINE__) -#define MSDL_ConvertSurface(src, fmt, flags) \ - FakeSDL_ConvertSurface(src, fmt, flags, __FILE__, __LINE__) -#define MTTF_RenderUTF8_Blended(font, text, fg) \ - FakeTTF_RenderUTF8_Blended(font, text, fg, __FILE__, __LINE__) -#define MIMG_Load(file) FakeIMG_Load(file, __FILE__, __LINE__) -#define MSDL_DisplayFormatAlpha(surface) \ - FakeSDL_DisplayFormatAlpha(surface, __FILE__, __LINE__) -#define MSDL_DisplayFormat(surface) \ - FakeSDL_DisplayFormat(surface, __FILE__, __LINE__) - -#else // ENABLE_SDL_DEBUG - -#define MIMG_LoadPNG_RW(src) IMG_LoadPNG_RW(src) -#define MIMG_LoadJPG_RW(src) IMG_LoadJPG_RW(src) -#define MSDL_FreeSurface(surface) SDL_FreeSurface(surface) -#define MSDL_CreateRGBSurface(flags, w, h, d, r, g, b, a) \ - SDL_CreateRGBSurface(flags, w, h, d, r, g, b, a) -#define MSDL_ConvertSurface(src, fmt, flags) \ - SDL_ConvertSurface(src, fmt, flags) -#define MTTF_RenderUTF8_Blended(font, text, fg) \ - TTF_RenderUTF8_Blended(font, text, fg) -#define MIMG_Load(file) IMG_Load(file) -#define MSDL_DisplayFormatAlpha(surface) SDL_DisplayFormatAlpha(surface) -#define MSDL_DisplayFormat(surface) SDL_DisplayFormat(surface) - -#endif // ENABLE_SDL_DEBUG diff --git a/src/debug/mse/LICENSE_1_0.txt b/src/debug/mse/LICENSE_1_0.txt deleted file mode 100644 index 664c26753..000000000 --- a/src/debug/mse/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/src/debug/mse/msemsevector.h b/src/debug/mse/msemsevector.h deleted file mode 100644 index e0046ca5c..000000000 --- a/src/debug/mse/msemsevector.h +++ /dev/null @@ -1,2432 +0,0 @@ - -// Copyright (c) 2015 Noah Lopez -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MSEMSEVECTOR_H -#define MSEMSEVECTOR_H - -/*compiler specific defines*/ -#ifdef _MSC_VER -#if (1700 > _MSC_VER) -#define MSVC2010_COMPATIBLE 1 -#endif /*(1700 > _MSC_VER)*/ -#if (1900 > _MSC_VER) -#define MSVC2013_COMPATIBLE 1 -#endif /*(1900 > _MSC_VER)*/ -#else /*_MSC_VER*/ -#if (defined(__GNUC__) || defined(__GNUG__)) -#define GPP_COMPATIBLE 1 -#if ((5 > __GNUC__) && (!defined(__clang__))) -#define GPP4P8_COMPATIBLE 1 -#endif /*((5 > __GNUC__) && (!defined(__clang__)))*/ -#endif -#endif /*_MSC_VER*/ - -//define MSE_MSEVECTOR_USE_MSE_PRIMITIVES 1 -#ifdef MSE_MSEVECTOR_USE_MSE_PRIMITIVES -#include "debug/mse/mseprimitives.h" -#endif // MSE_MSEVECTOR_USE_MSE_PRIMITIVES - -#include -#include -#include -#include -#include -#include // ULONG_MAX -#include - -#ifdef MSE_CUSTOM_THROW_DEFINITION -#include -#define MSE_THROW(x) MSE_CUSTOM_THROW_DEFINITION(x) -#else // MSE_CUSTOM_THROW_DEFINITION -#define MSE_THROW(x) throw(x) -#endif // MSE_CUSTOM_THROW_DEFINITION - -namespace mse { - -#ifdef MSE_MSEVECTOR_USE_MSE_PRIMITIVES - typedef mse::CSize_t msev_size_t; - typedef mse::CInt msev_int; - typedef bool msev_bool; // no added safety benefit to using mse::CBool in this case - #define msev_as_a_size_t as_a_size_t -#else // MSE_MSEVECTOR_USE_MSE_PRIMITIVES -#if SIZE_MAX <= ULONG_MAX -#define MSE_MSEVECTOR_BASE_INTEGER_TYPE long int -#else // SIZE_MAX <= ULONG_MAX -#define MSE_MSEVECTOR_BASE_INTEGER_TYPE long long int -#endif // SIZE_MAX <= ULONG_MAX - - typedef size_t msev_size_t; - typedef MSE_MSEVECTOR_BASE_INTEGER_TYPE msev_int; - typedef bool msev_bool; - typedef size_t msev_as_a_size_t; -#endif // MSE_MSEVECTOR_USE_MSE_PRIMITIVES - - - class msevector_range_error : public std::range_error { public: - using std::range_error::range_error; - }; - class msevector_null_dereference_error : public std::logic_error { public: - using std::logic_error::logic_error; - }; - - /* msev_pointer behaves similar to native pointers. It's a bit safer in that it initializes to - nullptr by default and checks for attempted dereference of null pointers. */ - template - class msev_pointer { - public: - msev_pointer() : m_ptr(nullptr) {} - msev_pointer(_Ty* ptr) : m_ptr(ptr) {} - msev_pointer(const msev_pointer<_Ty>& src) : m_ptr(src.m_ptr) {} - - _Ty& operator*() const { -#ifndef MSE_DISABLE_MSEAR_POINTER_CHECKS - if (nullptr == m_ptr) { MSE_THROW(msevector_null_dereference_error("attempt to dereference null pointer - mse::msev_pointer")); } -#endif /*MSE_DISABLE_MSEAR_POINTER_CHECKS*/ - return (*m_ptr); - } - _Ty* operator->() const { -#ifndef MSE_DISABLE_MSEAR_POINTER_CHECKS - if (nullptr == m_ptr) { MSE_THROW(msevector_null_dereference_error("attempt to dereference null pointer - mse::msev_pointer")); } -#endif /*MSE_DISABLE_MSEAR_POINTER_CHECKS*/ - return m_ptr; - } - msev_pointer<_Ty>& operator=(_Ty* ptr) { - m_ptr = ptr; - return (*this); - } - bool operator==(const msev_pointer _Right_cref) const { return (_Right_cref.m_ptr == m_ptr); } - bool operator!=(const msev_pointer _Right_cref) const { return (!((*this) == _Right_cref)); } - bool operator==(const _Ty* _Right_cref) const { return (_Right_cref == m_ptr); } - bool operator!=(const _Ty* _Right_cref) const { return (!((*this) == _Right_cref)); } - - bool operator!() const { return (!m_ptr); } - operator bool() const { return (m_ptr != nullptr); } - - operator _Ty*() const { return m_ptr; } - - _Ty* m_ptr; - }; - -#ifndef _XSTD -#define _XSTD ::std:: -#endif /*_XSTD*/ - - template - struct integral_constant - { // convenient template for integral constant types - static const _Ty value = _Val; - - typedef _Ty value_type; - typedef integral_constant<_Ty, _Val> type; - - operator value_type() const - { // return stored value - return (value); - } - }; - - template - struct _mse_Is_iterator - : public integral_constant::value> - { // tests for reasonable iterator candidate - }; - template - using _mse_RequireInputIter = typename std::enable_if< - std::is_convertible::iterator_category, std::input_iterator_tag>::value - //_mse_Is_iterator<_InIter>::value - >::type; - - /* Note that, at the moment, msevector inherits publicly from std::vector. This is not intended to be a permanent - characteristic of msevector and any reference to, or interpretation of, an msevector as an std::vector is (and has - always been) depricated. msevector endeavors to support the subset of the std::vector interface that is compatible - with the security/safety goals of msevector. (The remaining part of the std::vector interface may be supported, as a - user option, for compatibility.) - In particular, keep in mind that std::vector does not have a virtual destructor, so deallocating an msevector as an - std::vector would result in memory leaks. */ - template > - class msevector : public std::vector<_Ty, _A> { - public: - typedef std::vector<_Ty, _A> base_class; - typedef msevector<_Ty, _A> _Myt; - - typedef typename base_class::value_type value_type; - //typedef typename base_class::size_type size_type; - typedef msev_size_t size_type; - //typedef typename base_class::difference_type difference_type; - typedef msev_int difference_type; - typedef typename base_class::pointer pointer; - typedef typename base_class::const_pointer const_pointer; - typedef typename base_class::reference reference; - typedef typename base_class::const_reference const_reference; - - explicit msevector(const _A& _Al = _A()) - : base_class(_Al), m_mmitset(*this) { - /*m_debug_size = size();*/ - } - explicit msevector(size_type _N) - : base_class(msev_as_a_size_t(_N)), m_mmitset(*this) { - /*m_debug_size = size();*/ - } - explicit msevector(size_type _N, const _Ty& _V, const _A& _Al = _A()) - : base_class(msev_as_a_size_t(_N), _V, _Al), m_mmitset(*this) { - /*m_debug_size = size();*/ - } - msevector(base_class&& _X) : base_class(std::move(_X)), m_mmitset(*this) { /*m_debug_size = size();*/ } - msevector(const base_class& _X) : base_class(_X), m_mmitset(*this) { /*m_debug_size = size();*/ } - msevector(_Myt&& _X) : base_class(std::move(_X)), m_mmitset(*this) { /*m_debug_size = size();*/ } - msevector(const _Myt& _X) : base_class(_X), m_mmitset(*this) { /*m_debug_size = size();*/ } - typedef typename base_class::const_iterator _It; - /* Note that safety cannot be guaranteed when using these constructors that take unsafe typename base_class::iterator and/or pointer parameters. */ - msevector(_It _F, _It _L, const _A& _Al = _A()) : base_class(_F, _L, _Al), m_mmitset(*this) { /*m_debug_size = size();*/ } - msevector(const _Ty* _F, const _Ty* _L, const _A& _Al = _A()) : base_class(_F, _L, _Al), m_mmitset(*this) { /*m_debug_size = size();*/ } - template::value, void>::type - , class = _mse_RequireInputIter<_Iter> > - msevector(_Iter _First, _Iter _Last) : base_class(_First, _Last), m_mmitset(*this) { /*m_debug_size = size();*/ } - template::value, void>::type - , class = _mse_RequireInputIter<_Iter> > - //msevector(_Iter _First, _Iter _Last, const typename base_class::_Alloc& _Al) : base_class(_First, _Last, _Al), m_mmitset(*this) { /*m_debug_size = size();*/ } - msevector(_Iter _First, _Iter _Last, const _A& _Al) : base_class(_First, _Last, _Al), m_mmitset(*this) { /*m_debug_size = size();*/ } - _Myt& operator=(const base_class& _X) { - base_class::operator =(_X); - /*m_debug_size = size();*/ - m_mmitset.reset(); - return (*this); - } - _Myt& operator=(_Myt&& _X) { - operator=(std::move(static_cast(_X))); - m_mmitset.reset(); - return (*this); - } - _Myt& operator=(const _Myt& _X) { - operator=(static_cast(_X)); - m_mmitset.reset(); - return (*this); - } - void reserve(size_type _Count) - { // determine new minimum length of allocated storage - auto original_capacity = msev_size_t((*this).capacity()); - - base_class::reserve(msev_as_a_size_t(_Count)); - - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - void shrink_to_fit() { // reduce capacity - auto original_capacity = msev_size_t((*this).capacity()); - - base_class::shrink_to_fit(); - - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - void resize(size_type _N, const _Ty& _X = _Ty()) { - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - bool shrinking = (_N < original_size); - - base_class::resize(msev_as_a_size_t(_N), _X); - /*m_debug_size = size();*/ - - if (shrinking) { - m_mmitset.invalidate_inclusive_range(_N, msev_size_t(original_size - 1)); - } - m_mmitset.shift_inclusive_range(original_size, original_size, msev_size_t(_N) - original_size); /*shift the end markers*/ - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - typename base_class::const_reference operator[](size_type _P) const { - return (*this).at(msev_as_a_size_t(_P)); - } - typename base_class::reference operator[](size_type _P) { - return (*this).at(msev_as_a_size_t(_P)); - } - typename base_class::reference front() { // return first element of mutable sequence - if (0 == (*this).size()) { MSE_THROW(msevector_range_error("front() on empty - typename base_class::reference front() - msevector")); } - return base_class::front(); - } - typename base_class::const_reference front() const { // return first element of nonmutable sequence - if (0 == (*this).size()) { MSE_THROW(msevector_range_error("front() on empty - typename base_class::const_reference front() - msevector")); } - return base_class::front(); - } - typename base_class::reference back() { // return last element of mutable sequence - if (0 == (*this).size()) { MSE_THROW(msevector_range_error("back() on empty - typename base_class::reference back() - msevector")); } - return base_class::back(); - } - typename base_class::const_reference back() const { // return last element of nonmutable sequence - if (0 == (*this).size()) { MSE_THROW(msevector_range_error("back() on empty - typename base_class::const_reference back() - msevector")); } - return base_class::back(); - } - void push_back(_Ty&& _X) { - if (m_mmitset.is_empty()) { - base_class::push_back(std::move(_X)); - } - else { - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - base_class::push_back(std::move(_X)); - /*m_debug_size = size();*/ - - assert((original_size + 1) == msev_size_t((*this).size())); - m_mmitset.shift_inclusive_range(original_size, original_size, 1); /*shift the end markers*/ - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - } - void push_back(const _Ty& _X) { - if (m_mmitset.is_empty()) { - base_class::push_back(_X); - } - else { - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - base_class::push_back(_X); - /*m_debug_size = size();*/ - - assert((original_size + 1) == msev_size_t((*this).size())); - m_mmitset.shift_inclusive_range(original_size, original_size, 1); /*shift the end markers*/ - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - } - void pop_back() { - if (m_mmitset.is_empty()) { - base_class::pop_back(); - } - else { - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - if (0 == original_size) { MSE_THROW(msevector_range_error("pop_back() on empty - void pop_back() - msevector")); } - base_class::pop_back(); - /*m_debug_size = size();*/ - - assert((original_size - 1) == msev_size_t((*this).size())); - m_mmitset.invalidate_inclusive_range(msev_size_t(original_size - 1), msev_size_t(original_size - 1)); - m_mmitset.shift_inclusive_range(original_size, original_size, -1); /*shift the end markers*/ - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - } - void assign(_It _F, _It _L) { - base_class::assign(_F, _L); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } - template - void assign(_Iter _First, _Iter _Last) { // assign [_First, _Last) - base_class::assign(_First, _Last); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } - void assign(size_type _N, const _Ty& _X = _Ty()) { - base_class::assign(msev_as_a_size_t(_N), _X); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } - typename base_class::iterator insert(typename base_class::const_iterator _P, _Ty&& _X) { - return (emplace(_P, std::move(_X))); - } - typename base_class::iterator insert(typename base_class::const_iterator _P, const _Ty& _X = _Ty()) { - if (m_mmitset.is_empty()) { - typename base_class::iterator retval = base_class::insert(_P, _X); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _P); - msev_size_t d = msev_size_t(di); - if ((0 > di) || (msev_size_t((*this).size()) < di)) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - typename base_class::iterator retval = base_class::insert(_P, _X); - /*m_debug_size = size();*/ - - assert((original_size + 1) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - m_mmitset.shift_inclusive_range(d, original_size, 1); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - -#if !(defined(GPP4P8_COMPATIBLE)) - typename base_class::iterator insert(typename base_class::const_iterator _P, size_type _M, const _Ty& _X) { - if (m_mmitset.is_empty()) { - typename base_class::iterator retval = base_class::insert(_P, msev_as_a_size_t(_M), _X); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _P); - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - typename base_class::iterator retval = base_class::insert(_P, msev_as_a_size_t(_M), _X); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - m_mmitset.shift_inclusive_range(d, original_size, msev_int(_M)); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - typename base_class::iterator insert(typename base_class::const_iterator _Where, _Iter _First, _Iter _Last) { // insert [_First, _Last) at _Where - if (m_mmitset.is_empty()) { - auto retval = base_class::insert(_Where, _First, _Last); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _Where); - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto _M = msev_int(std::distance(_First, _Last)); - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - //if (0 > _M) { MSE_THROW(msevector_range_error("invalid argument - typename base_class::iterator insert() - msevector")); } - auto retval = base_class::insert(_Where, _First, _Last); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - m_mmitset.shift_inclusive_range(d, original_size, _M); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - - /*typename base_class::iterator*/ - void - /* g++4.8 seems to be using the c++98 version of this insert function instead of the c++11 version. */ - insert(typename base_class::/*const_*/iterator _P, size_t _M, const _Ty& _X) { - msev_int di = std::distance(base_class::/*c*/begin(), _P); - msev_size_t d = msev_size_t(di); - if ((0 > di) || (msev_size_t((*this).size()) < di)) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - /*typename base_class::iterator retval =*/ - base_class::insert(_P, _M, _X); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - /*assert(di == std::distance(base_class::begin(), retval));*/ - m_mmitset.shift_inclusive_range(d, original_size, _M); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - /*return retval;*/ - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, void>::type - , class = _mse_RequireInputIter<_Iter> > void - insert(typename base_class::/*const_*/iterator _Where, _Iter _First, _Iter _Last) { // insert [_First, _Last) at _Where - msev_int di = std::distance(base_class::/*c*/begin(), _Where); - msev_size_t d = msev_size_t(di); - if ((0 > di) || (msev_size_t((*this).size()) < di)) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto _M = msev_int(std::distance(_First, _Last)); - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - //if (0 > _M) { MSE_THROW(msevector_range_error("invalid argument - typename base_class::iterator insert() - msevector")); } - /*auto retval =*/ - base_class::insert(_Where, _First, _Last); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - /*assert(di == std::distance(base_class::begin(), retval));*/ - m_mmitset.shift_inclusive_range(d, original_size, _M); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - /*return retval;*/ - } -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - - template - void emplace_back(_Valty&& ..._Val) - { // insert by moving into element at end - if (m_mmitset.is_empty()) { - base_class::emplace_back(std::forward<_Valty>(_Val)...); - /*m_debug_size = size();*/ - } - else { - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - base_class::emplace_back(std::forward<_Valty>(_Val)...); - /*m_debug_size = size();*/ - - assert((original_size + 1) == msev_size_t((*this).size())); - m_mmitset.shift_inclusive_range(original_size, original_size, 1); /*shift the end markers*/ - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - } - } - template -#if !(defined(GPP4P8_COMPATIBLE)) - typename base_class::iterator emplace(typename base_class::const_iterator _Where, _Valty&& ..._Val) - { // insert by moving _Val at _Where -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - typename base_class::iterator emplace(typename base_class::/*const_*/iterator _Where, _Valty&& ..._Val) - { // insert by moving _Val at _Where -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - - if (m_mmitset.is_empty()) { - auto retval = base_class::emplace(_Where, std::forward<_Valty>(_Val)...); - /*m_debug_size = size();*/ - return retval; - } - else { - -#if !(defined(GPP4P8_COMPATIBLE)) - msev_int di = std::distance(base_class::cbegin(), _Where); -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - msev_int di = std::distance(base_class::/*c*/begin(), _Where); -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator emplace() - msevector")); } - - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - auto retval = base_class::emplace(_Where, std::forward<_Valty>(_Val)...); - /*m_debug_size = size();*/ - - assert((original_size + 1) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - m_mmitset.shift_inclusive_range(d, original_size, 1); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - typename base_class::iterator erase(typename base_class::const_iterator _P) { - if (m_mmitset.is_empty()) { - typename base_class::iterator retval = base_class::erase(_P); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _P); - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator erase() - msevector")); } - - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - if (base_class::end() == _P) { MSE_THROW(msevector_range_error("invalid argument - typename base_class::iterator erase(typename base_class::const_iterator _P) - msevector")); } - typename base_class::iterator retval = base_class::erase(_P); - /*m_debug_size = size();*/ - - assert((original_size - 1) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - { - m_mmitset.invalidate_inclusive_range(d, d); - m_mmitset.shift_inclusive_range(msev_size_t(d + 1), original_size, -1); - } - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - typename base_class::iterator erase(typename base_class::const_iterator _F, typename base_class::const_iterator _L) { - if (m_mmitset.is_empty()) { - typename base_class::iterator retval = base_class::erase(_F, _L); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _F); - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator erase() - msevector")); } - msev_int di2 = std::distance(base_class::cbegin(), _L); - msev_size_t d2 = msev_size_t(di2); - if ((0 > di2) || ((*this).size() < msev_size_t(di2))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator erase() - msevector")); } - - auto _M = msev_int(std::distance(_F, _L)); - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - if ((base_class::end() == _F)/* || (0 > _M)*/) { MSE_THROW(msevector_range_error("invalid argument - typename base_class::iterator erase(typename base_class::iterator _F, typename base_class::iterator _L) - msevector")); } - typename base_class::iterator retval = base_class::erase(_F, _L); - /*m_debug_size = size();*/ - - assert((original_size - _M) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - { - if (1 <= _M) { - m_mmitset.invalidate_inclusive_range(d, msev_size_t(d + _M - 1)); - } - m_mmitset.shift_inclusive_range(msev_size_t(d + _M), original_size, -_M); - } - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } - void clear() { - base_class::clear(); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } - void swap(base_class& _X) { - base_class::swap(_X); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } - void swap(_Myt& _X) { - swap(static_cast(_X)); - m_mmitset.reset(); - } - - msevector(_XSTD initializer_list _Ilist, - const _A& _Al = _A()) - : base_class(_Ilist, _Al), m_mmitset(*this) { // construct from initializer_list - /*m_debug_size = size();*/ - } - _Myt& operator=(_XSTD initializer_list _Ilist) { // assign initializer_list - operator=(static_cast(_Ilist)); - m_mmitset.reset(); - return (*this); - } - void assign(_XSTD initializer_list _Ilist) { // assign initializer_list - base_class::assign(_Ilist); - /*m_debug_size = size();*/ - m_mmitset.reset(); - } -#if defined(GPP4P8_COMPATIBLE) - /* g++4.8 seems to be (incorrectly) using the c++98 version of this insert function instead of the c++11 version. */ - /*typename base_class::iterator*/void insert(typename base_class::/*const_*/iterator _Where, _XSTD initializer_list _Ilist) { // insert initializer_list - msev_int di = std::distance(base_class::/*c*/begin(), _Where); - msev_size_t d = msev_size_t(di); - if ((0 > di) || (msev_size_t((*this).size()) < di)) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto _M = _Ilist.size(); - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - /*auto retval = */base_class::insert(_Where, _Ilist); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - /*assert(di == std::distance(base_class::begin(), retval));*/ - m_mmitset.shift_inclusive_range(d, original_size, _M); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - /*return retval;*/ - } -#else /*defined(GPP4P8_COMPATIBLE)*/ - typename base_class::iterator insert(typename base_class::const_iterator _Where, _XSTD initializer_list _Ilist) { // insert initializer_list - if (m_mmitset.is_empty()) { - auto retval = base_class::insert(_Where, _Ilist); - /*m_debug_size = size();*/ - return retval; - } - else { - msev_int di = std::distance(base_class::cbegin(), _Where); - msev_size_t d = msev_size_t(di); - if ((0 > di) || ((*this).size() < msev_size_t(di))) { MSE_THROW(msevector_range_error("index out of range - typename base_class::iterator insert() - msevector")); } - - auto _M = _Ilist.size(); - auto original_size = msev_size_t((*this).size()); - auto original_capacity = msev_size_t((*this).capacity()); - - auto retval = base_class::insert(_Where, _Ilist); - /*m_debug_size = size();*/ - - assert((original_size + _M) == msev_size_t((*this).size())); - assert(di == std::distance(base_class::begin(), retval)); - m_mmitset.shift_inclusive_range(d, original_size, msev_int(_M)); - auto new_capacity = msev_size_t((*this).capacity()); - bool realloc_occured = (new_capacity != original_capacity); - if (realloc_occured) { - m_mmitset.sync_iterators_to_index(); - } - return retval; - } - } -#endif /*defined(GPP4P8_COMPATIBLE)*/ - - //size_t m_debug_size; - - class random_access_const_iterator_base : public std::iterator {}; - class random_access_iterator_base : public std::iterator {}; - - /* mm_const_iterator_type acts much like a list iterator. */ - class mm_const_iterator_type : public random_access_const_iterator_base { - public: - typedef typename base_class::const_iterator::iterator_category iterator_category; - typedef typename base_class::const_iterator::value_type value_type; - //typedef typename base_class::const_iterator::difference_type difference_type; - typedef msev_int difference_type; - typedef difference_type distance_type; // retained - typedef typename base_class::const_iterator::pointer pointer; - typedef typename base_class::const_iterator::pointer const_pointer; - typedef typename base_class::const_iterator::reference reference; - typedef typename base_class::const_reference const_reference; - - void reset() { set_to_end_marker(); } - bool points_to_an_item() const { - if (m_points_to_an_item) { assert((1 <= m_owner_cptr->size()) && (m_index < m_owner_cptr->size())); return true; } - else { assert(!((1 <= m_owner_cptr->size()) && (m_index < m_owner_cptr->size()))); return false; } - } - bool points_to_end_marker() const { - if (false == points_to_an_item()) { assert(m_index == m_owner_cptr->size()); return true; } - else { return false; } - } - bool points_to_beginning() const { - if (0 == m_index) { return true; } - else { return false; } - } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return points_to_an_item(); } //his is - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return has_next_item_or_end_marker(); } - bool has_previous() const { return (!points_to_beginning()); } - void set_to_beginning() { - m_index = 0; - if (1 <= m_owner_cptr->size()) { - m_points_to_an_item = true; - } - else { assert(false == m_points_to_an_item); } - } - void set_to_end_marker() { - m_index = m_owner_cptr->size(); - m_points_to_an_item = false; - } - void set_to_next() { - if (points_to_an_item()) { - m_index += 1; - if (m_owner_cptr->size() <= m_index) { - (*this).m_points_to_an_item = false; - if (m_owner_cptr->size() < m_index) { assert(false); reset(); } - } - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid const_item_pointer - void set_to_next() - mm_const_iterator_type - msevector")); - } - } - void set_to_previous() { - if (has_previous()) { - m_index -= 1; - (*this).m_points_to_an_item = true; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid const_item_pointer - void set_to_previous() - mm_const_iterator_type - msevector")); - } - } - mm_const_iterator_type& operator ++() { (*this).set_to_next(); return (*this); } - mm_const_iterator_type operator++(int) { mm_const_iterator_type _Tmp = *this; ++*this; return (_Tmp); } - mm_const_iterator_type& operator --() { (*this).set_to_previous(); return (*this); } - mm_const_iterator_type operator--(int) { mm_const_iterator_type _Tmp = *this; --*this; return (_Tmp); } - void advance(difference_type n) { - auto new_index = msev_int(m_index) + n; - if ((0 > new_index) || (m_owner_cptr->size() < msev_size_t(new_index))) { - MSE_THROW(msevector_range_error("index out of range - void advance(difference_type n) - mm_const_iterator_type - msevector")); - } - else { - m_index = msev_size_t(new_index); - if (m_owner_cptr->size() <= m_index) { - (*this).m_points_to_an_item = false; - } - else { - (*this).m_points_to_an_item = true; - } - } - } - void regress(difference_type n) { advance(-n); } - mm_const_iterator_type& operator +=(difference_type n) { (*this).advance(n); return (*this); } - mm_const_iterator_type& operator -=(difference_type n) { (*this).regress(n); return (*this); } - mm_const_iterator_type operator+(difference_type n) const { - mm_const_iterator_type retval(*this); - retval = (*this); - retval.advance(n); - return retval; - } - mm_const_iterator_type operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const mm_const_iterator_type &rhs) const { - if ((rhs.m_owner_cptr) != ((*this).m_owner_cptr)) { MSE_THROW(msevector_range_error("invalid argument - difference_type operator-(const mm_const_iterator_type &rhs) const - msevector::mm_const_iterator_type")); } - auto retval = difference_type((*this).m_index) - difference_type(rhs.m_index); - assert(difference_type(m_owner_cptr->size()) >= retval); - return retval; - } - const_reference operator*() const { - return m_owner_cptr->at(msev_as_a_size_t(m_index)); - } - const_reference item() const { return operator*(); } - const_reference previous_item() const { - return m_owner_cptr->at(msev_as_a_size_t(m_index - 1)); - } - const_pointer operator->() const { - return &(m_owner_cptr->at(msev_as_a_size_t(m_index))); - } - const_reference operator[](difference_type _Off) const { return (*m_owner_cptr).at(msev_as_a_size_t(difference_type(m_index) + _Off)); } - /* - mm_const_iterator_type& operator=(const typename base_class::const_iterator& _Right_cref) - { - msev_int d = std::distance(m_owner_cptr->cbegin(), _Right_cref); - if ((0 <= d) && (m_owner_cptr->size() >= d)) { - if (m_owner_cptr->size() == d) { - assert(m_owner_cptr->cend() == _Right_cref); - m_points_to_an_item = false; - } else { - m_points_to_an_item = true; - } - m_index = msev_size_t(d); - base_class::const_iterator::operator=(_Right_cref); - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - mm_const_iterator_type& operator=(const typename base_class::const_iterator& _Right_cref) - mm_const_iterator_type - msevector")); - } - return (*this); - } - */ - mm_const_iterator_type& operator=(const mm_const_iterator_type& _Right_cref) - { - if (((*this).m_owner_cptr) == (_Right_cref.m_owner_cptr)) { - assert((*this).m_owner_cptr->size() >= _Right_cref.m_index); - (*this).m_points_to_an_item = _Right_cref.m_points_to_an_item; - (*this).m_index = _Right_cref.m_index; - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - mm_const_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - mm_const_iterator_type - msevector")); - } - return (*this); - } - bool operator==(const mm_const_iterator_type& _Right_cref) const { - if (((*this).m_owner_cptr) != (_Right_cref.m_owner_cptr)) { MSE_THROW(msevector_range_error("invalid argument - mm_const_iterator_type& operator==(const mm_const_iterator_type& _Right) - mm_const_iterator_type - msevector")); } - return (_Right_cref.m_index == m_index); - } - bool operator!=(const mm_const_iterator_type& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const mm_const_iterator_type& _Right) const { - if (((*this).m_owner_cptr) != (_Right.m_owner_cptr)) { MSE_THROW(msevector_range_error("invalid argument - mm_const_iterator_type& operator<(const mm_const_iterator_type& _Right) - mm_const_iterator_type - msevector")); } - return (m_index < _Right.m_index); - } - bool operator<=(const mm_const_iterator_type& _Right) const { return (((*this) < _Right) || (_Right == (*this))); } - bool operator>(const mm_const_iterator_type& _Right) const { return (!((*this) <= _Right)); } - bool operator>=(const mm_const_iterator_type& _Right) const { return (!((*this) < _Right)); } - void set_to_const_item_pointer(const mm_const_iterator_type& _Right_cref) { - (*this) = _Right_cref; - } - void invalidate_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - (*this).reset(); - } - } - void shift_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last, msev_int shift) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - auto new_index = (*this).m_index + shift; - if ((0 > new_index) || (m_owner_cptr->size() < new_index)) { - MSE_THROW(msevector_range_error("void shift_inclusive_range() - mm_const_iterator_type - msevector")); - } - else { - (*this).m_index = msev_size_t(new_index); - (*this).sync_const_iterator_to_index(); - } - } - } - msev_size_t position() const { - return m_index; - } - operator typename base_class::const_iterator() const { - typename base_class::const_iterator retval = (*m_owner_cptr).cbegin(); - retval += msev_as_a_size_t(m_index); - return retval; - } - - /* We actually want to make this constructor private, but doing so seems to break std::make_shared. */ - mm_const_iterator_type(const _Myt& owner_cref) : m_owner_cptr(&owner_cref) { set_to_beginning(); } - private: - mm_const_iterator_type(const mm_const_iterator_type& src_cref) : m_owner_cptr(src_cref.m_owner_cptr) { (*this) = src_cref; } - void sync_const_iterator_to_index() { - assert(m_owner_cptr->size() >= (*this).m_index); - } - msev_bool m_points_to_an_item = false; - msev_size_t m_index = 0; - const _Myt* m_owner_cptr = nullptr; - friend class mm_iterator_set_type; - friend class /*_Myt*/msevector<_Ty, _A>; - friend class mm_iterator_type; - }; - /* mm_iterator_type acts much like a list iterator. */ - class mm_iterator_type : random_access_iterator_base { - public: - typedef typename base_class::iterator::iterator_category iterator_category; - typedef typename base_class::iterator::value_type value_type; - //typedef typename base_class::iterator::difference_type difference_type; - typedef msev_int difference_type; - typedef difference_type distance_type; // retained - typedef typename base_class::iterator::pointer pointer; - typedef typename base_class::iterator::reference reference; - - void reset() { set_to_end_marker(); } - bool points_to_an_item() const { - if (m_points_to_an_item) { assert((1 <= m_owner_ptr->size()) && (m_index < m_owner_ptr->size())); return true; } - else { assert(!((1 <= m_owner_ptr->size()) && (m_index < m_owner_ptr->size()))); return false; } - } - bool points_to_end_marker() const { - if (false == points_to_an_item()) { assert(m_index == m_owner_ptr->size()); return true; } - else { return false; } - } - bool points_to_beginning() const { - if (0 == m_index) { return true; } - else { return false; } - } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return points_to_an_item(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return has_next_item_or_end_marker(); } - bool has_previous() const { return (!points_to_beginning()); } - void set_to_beginning() { - m_index = 0; - if (1 <= m_owner_ptr->size()) { - m_points_to_an_item = true; - } - else { assert(false == m_points_to_an_item); } - } - void set_to_end_marker() { - m_index = m_owner_ptr->size(); - m_points_to_an_item = false; - } - void set_to_next() { - if (points_to_an_item()) { - m_index += 1; - if (m_owner_ptr->size() <= m_index) { - (*this).m_points_to_an_item = false; - if (m_owner_ptr->size() < m_index) { assert(false); reset(); } - } - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid item_pointer - void set_to_next() - mm_const_iterator_type - msevector")); - } - } - void set_to_previous() { - if (has_previous()) { - m_index -= 1; - (*this).m_points_to_an_item = true; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid item_pointer - void set_to_previous() - mm_iterator_type - msevector")); - } - } - mm_iterator_type& operator ++() { (*this).set_to_next(); return (*this); } - mm_iterator_type operator++(int) { mm_iterator_type _Tmp = *this; ++*this; return (_Tmp); } - mm_iterator_type& operator --() { (*this).set_to_previous(); return (*this); } - mm_iterator_type operator--(int) { mm_iterator_type _Tmp = *this; --*this; return (_Tmp); } - void advance(difference_type n) { - auto new_index = msev_int(m_index) + n; - if ((0 > new_index) || (m_owner_ptr->size() < msev_size_t(new_index))) { - MSE_THROW(msevector_range_error("index out of range - void advance(difference_type n) - mm_iterator_type - msevector")); - } - else { - m_index = msev_size_t(new_index); - if (m_owner_ptr->size() <= m_index) { - (*this).m_points_to_an_item = false; - } - else { - (*this).m_points_to_an_item = true; - } - } - } - void regress(int n) { advance(-n); } - mm_iterator_type& operator +=(difference_type n) { (*this).advance(n); return (*this); } - mm_iterator_type& operator -=(difference_type n) { (*this).regress(n); return (*this); } - mm_iterator_type operator+(difference_type n) const { - mm_iterator_type retval(*this); - retval = (*this); - retval.advance(n); - return retval; - } - mm_iterator_type operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const mm_iterator_type& rhs) const { - if ((rhs.m_owner_ptr) != ((*this).m_owner_ptr)) { MSE_THROW(msevector_range_error("invalid argument - difference_type operator-(const mm_iterator_type& rhs) const - msevector::mm_iterator_type")); } - auto retval = difference_type((*this).m_index) - difference_type(rhs.m_index); - assert(difference_type(m_owner_ptr->size()) >= retval); - return retval; - } - reference operator*() const { - return m_owner_ptr->at(msev_as_a_size_t(m_index)); - } - reference item() const { return operator*(); } - reference previous_item() const { - return m_owner_ptr->at(msev_as_a_size_t(m_index - 1)); - } - pointer operator->() const { - return &(m_owner_ptr->at(msev_as_a_size_t(m_index))); - } - reference operator[](difference_type _Off) const { return (*m_owner_ptr).at(msev_as_a_size_t(difference_type(m_index) + _Off)); } - /* - mm_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - { - msev_int d = std::distance(m_owner_ptr->begin(), _Right_cref); - if ((0 <= d) && (m_owner_ptr->size() >= d)) { - if (m_owner_ptr->size() == d) { - assert(m_owner_ptr->end() == _Right_cref); - m_points_to_an_item = false; - } else { - m_points_to_an_item = true; - } - m_index = msev_size_t(d); - base_class::iterator::operator=(_Right_cref); - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - mm_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - mm_const_iterator_type - msevector")); - } - return (*this); - } - */ - mm_iterator_type& operator=(const mm_iterator_type& _Right_cref) - { - if (((*this).m_owner_ptr) == (_Right_cref.m_owner_ptr)) { - assert((*this).m_owner_ptr->size() >= _Right_cref.m_index); - (*this).m_points_to_an_item = _Right_cref.m_points_to_an_item; - (*this).m_index = _Right_cref.m_index; - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - mm_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - mm_const_iterator_type - msevector")); - } - return (*this); - } - bool operator==(const mm_iterator_type& _Right_cref) const { - if (((*this).m_owner_ptr) != (_Right_cref.m_owner_ptr)) { MSE_THROW(msevector_range_error("invalid argument - mm_iterator_type& operator==(const typename base_class::iterator& _Right) - mm_iterator_type - msevector")); } - return (_Right_cref.m_index == m_index); - } - bool operator!=(const mm_iterator_type& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const mm_iterator_type& _Right) const { - if (((*this).m_owner_ptr) != (_Right.m_owner_ptr)) { MSE_THROW(msevector_range_error("invalid argument - mm_iterator_type& operator<(const typename base_class::iterator& _Right) - mm_iterator_type - msevector")); } - return (m_index < _Right.m_index); - } - bool operator<=(const mm_iterator_type& _Right) const { return (((*this) < _Right) || (_Right == (*this))); } - bool operator>(const mm_iterator_type& _Right) const { return (!((*this) <= _Right)); } - bool operator>=(const mm_iterator_type& _Right) const { return (!((*this) < _Right)); } - void set_to_item_pointer(const mm_iterator_type& _Right_cref) { - (*this) = _Right_cref; - } - void invalidate_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - (*this).reset(); - } - } - void shift_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last, msev_int shift) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - auto new_index = (*this).m_index + shift; - if ((0 > new_index) || (m_owner_ptr->size() < new_index)) { - MSE_THROW(msevector_range_error("void shift_inclusive_range() - mm_iterator_type - msevector")); - } - else { - (*this).m_index = msev_size_t(new_index); - (*this).sync_iterator_to_index(); - } - } - } - msev_size_t position() const { - return m_index; - } - operator mm_const_iterator_type() const { - mm_const_iterator_type retval(*m_owner_ptr); - retval.set_to_beginning(); - retval.advance(msev_int(m_index)); - return retval; - } - /* We actually want to make this constructor private, but doing so seems to break std::make_shared. */ - mm_iterator_type(_Myt& owner_ref) : m_owner_ptr(&owner_ref) { set_to_beginning(); } - private: - mm_iterator_type(const mm_iterator_type& src_cref) : m_owner_ptr(src_cref.m_owner_ptr) { (*this) = src_cref; } - void sync_iterator_to_index() { - assert(m_owner_ptr->size() >= (*this).m_index); - } - msev_bool m_points_to_an_item = false; - msev_size_t m_index = 0; - _Myt* m_owner_ptr = nullptr; - friend class mm_iterator_set_type; - friend class /*_Myt*/msevector<_Ty, _A>; - }; - - private: - typedef std::size_t CHashKey1; - class mm_const_iterator_handle_type { - public: - mm_const_iterator_handle_type(const CHashKey1& key_cref, const std::shared_ptr& shptr_cref) : m_shptr(shptr_cref), m_key(key_cref) {} - private: - std::shared_ptr m_shptr; - CHashKey1 m_key; - friend class /*_Myt*/msevector<_Ty, _A>; - friend class mm_iterator_set_type; - }; - class mm_iterator_handle_type { - public: - mm_iterator_handle_type(const CHashKey1& key_cref, const std::shared_ptr& shptr_ref) : m_shptr(shptr_ref), m_key(key_cref) {} - private: - std::shared_ptr m_shptr; - CHashKey1 m_key; - friend class /*_Myt*/msevector<_Ty, _A>; - friend class mm_iterator_set_type; - }; - - class mm_iterator_set_type { - public: - class CMMConstIterators : public std::unordered_map> {}; - class CMMIterators : public std::unordered_map> {}; - - class assignable_CMMConstIterators_value_type : public std::pair> { - public: - assignable_CMMConstIterators_value_type() {} - assignable_CMMConstIterators_value_type(const typename CMMConstIterators::value_type& src) : std::pair>(src.first, src.second) {} - assignable_CMMConstIterators_value_type& operator=(const typename CMMConstIterators::value_type& rhs) { (*this).first = rhs.first; (*this).second = rhs.second; return (*this); } - operator typename CMMConstIterators::value_type() const { return CMMConstIterators::value_type((*this).first, (*this).second); } - }; - class assignable_CMMIterators_value_type : public std::pair> { - public: - assignable_CMMIterators_value_type() {} - assignable_CMMIterators_value_type(const typename CMMIterators::value_type& src) : std::pair>(src.first, src.second) {} - assignable_CMMIterators_value_type& operator=(const typename CMMIterators::value_type& rhs) { (*this).first = rhs.first; (*this).second = rhs.second; return (*this); } - operator typename CMMIterators::value_type() const { return CMMIterators::value_type((*this).first, (*this).second); } - }; - - ~mm_iterator_set_type() { - if (!mm_const_fast_mode1()) { - delete m_aux_mm_const_iterator_shptrs_ptr; - } - if (!mm_fast_mode1()) { - delete m_aux_mm_iterator_shptrs_ptr; - } - } - - void apply_to_all_mm_const_iterator_shptrs(const std::function&)>& func_obj_ref) { - if (!mm_const_fast_mode1()) { - for (auto it = (*m_aux_mm_const_iterator_shptrs_ptr).begin(); (*m_aux_mm_const_iterator_shptrs_ptr).end() != it; it++) { - func_obj_ref((*it).second); - } - } - else { - for (int i = 0; i < m_fm1_num_mm_const_iterators; i += 1) { - func_obj_ref(m_fm1_key_mm_const_it_array[i].second); - } - } - } - void apply_to_all_mm_iterator_shptrs(const std::function&)>& func_obj_ref) { - if (!mm_fast_mode1()) { - for (auto it = (*m_aux_mm_iterator_shptrs_ptr).begin(); (*m_aux_mm_iterator_shptrs_ptr).end() != it; it++) { - func_obj_ref((*it).second); - } - } - else { - for (int i = 0; i < m_fm1_num_mm_iterators; i += 1) { - func_obj_ref(m_fm1_key_mm_it_array[i].second); - } - } - } - mm_iterator_set_type(_Myt& owner_ref) : m_next_available_key(0), m_owner_ptr(&owner_ref) {} - void reset() { - /* We can use "static" here because the lambda function does not capture any parameters. */ - static const std::function&)> cit_func_obj = [](std::shared_ptr& a) { a->reset(); }; - apply_to_all_mm_const_iterator_shptrs(cit_func_obj); - static const std::function&)> it_func_obj = [](std::shared_ptr& a) { a->reset(); }; - apply_to_all_mm_iterator_shptrs(it_func_obj); - } - void sync_iterators_to_index() { - /* No longer used. Relic from when mm_iterator_type contained a "native" iterator. */ - /* We can use "static" here because the lambda function does not capture any parameters. */ - /* - static const std::function&)> cit_func_obj = [](std::shared_ptr& a) { a->sync_const_iterator_to_index(); }; - apply_to_all_mm_const_iterator_shptrs(cit_func_obj); - static const std::function&)> it_func_obj = [](std::shared_ptr& a) { a->sync_iterator_to_index(); }; - apply_to_all_mm_iterator_shptrs(it_func_obj); - */ - } - void invalidate_inclusive_range(msev_size_t start_index, msev_size_t end_index) { - const std::function&)> cit_func_obj = [start_index, end_index](std::shared_ptr& a) { a->invalidate_inclusive_range(start_index, end_index); }; - apply_to_all_mm_const_iterator_shptrs(cit_func_obj); - const std::function&)> it_func_obj = [start_index, end_index](std::shared_ptr& a) { a->invalidate_inclusive_range(start_index, end_index); }; - apply_to_all_mm_iterator_shptrs(it_func_obj); - } - void shift_inclusive_range(msev_size_t start_index, msev_size_t end_index, msev_int shift) { - const std::function&)> cit_func_obj = [start_index, end_index, shift](std::shared_ptr& a) { a->shift_inclusive_range(start_index, end_index, shift); }; - apply_to_all_mm_const_iterator_shptrs(cit_func_obj); - const std::function&)> it_func_obj = [start_index, end_index, shift](std::shared_ptr& a) { a->shift_inclusive_range(start_index, end_index, shift); }; - apply_to_all_mm_iterator_shptrs(it_func_obj); - } - bool is_empty() const { - if (mm_const_fast_mode1()) { - if (1 <= m_fm1_num_mm_const_iterators) { - return false; - } - } - else { - if (1 <= m_aux_mm_const_iterator_shptrs_ptr->size()) { - return false; - } - } - if (mm_fast_mode1()) { - if (1 <= m_fm1_num_mm_iterators) { - return false; - } - } - else { - if (1 <= m_aux_mm_iterator_shptrs_ptr->size()) { - return false; - } - } - return true; - } - - mm_const_iterator_handle_type allocate_new_const_item_pointer() { - //auto shptr = std::shared_ptr(new mm_const_iterator_type(*m_owner_ptr)); - auto shptr = std::make_shared(*m_owner_ptr); - auto key = m_next_available_key; m_next_available_key++; - mm_const_iterator_handle_type retval(key, shptr); - typename CMMConstIterators::value_type new_item(key, shptr); - if (!mm_const_fast_mode1()) { - (*m_aux_mm_const_iterator_shptrs_ptr).insert(new_item); - } else { - if (sc_fm1_max_mm_iterators == m_fm1_num_mm_const_iterators) { - /* Too many items. Initiate and switch to slow mode. */ - /* Initialize slow storage. */ - m_aux_mm_const_iterator_shptrs_ptr = new CMMConstIterators(); - /* First copy the items from fast storage to slow storage. */ - for (int i = 0; i < sc_fm1_max_mm_iterators; i += 1) { - (*m_aux_mm_const_iterator_shptrs_ptr).insert(m_fm1_key_mm_const_it_array[i]); - } - /* Add the new items to slow storage. */ - (*m_aux_mm_const_iterator_shptrs_ptr).insert(new_item); - } - else { - m_fm1_key_mm_const_it_array[m_fm1_num_mm_const_iterators] = new_item; - m_fm1_num_mm_const_iterators += 1; - } - } - return retval; - } - void release_const_item_pointer(mm_const_iterator_handle_type handle) { - if (!mm_const_fast_mode1()) { - auto it = (*m_aux_mm_const_iterator_shptrs_ptr).find(handle.m_key); - if ((*m_aux_mm_const_iterator_shptrs_ptr).end() != it) { - (*m_aux_mm_const_iterator_shptrs_ptr).erase(it); - } - else { - /* Do we need to throw here? */ - MSE_THROW(msevector_range_error("invalid handle - void release_aux_mm_const_iterator(mm_const_iterator_handle_type handle) - msevector::mm_iterator_set_type")); - } - } - else { - int found_index = -1; - for (int i = 0; i < m_fm1_num_mm_const_iterators; i += 1) { - if (handle.m_key == m_fm1_key_mm_const_it_array[i].first) { - found_index = i; - break; - } - } - if (0 <= found_index) { - m_fm1_num_mm_const_iterators -= 1; - assert(0 <= m_fm1_num_mm_const_iterators); - for (int j = found_index; j < m_fm1_num_mm_const_iterators; j += 1) { - m_fm1_key_mm_const_it_array[j] = m_fm1_key_mm_const_it_array[j + 1]; - } - } - else { - /* Do we need to throw here? */ - MSE_THROW(msevector_range_error("invalid handle - void release_aux_mm_const_iterator(mm_const_iterator_handle_type handle) - msevector::mm_iterator_set_type")); - } - } - } - - mm_iterator_handle_type allocate_new_item_pointer() { - //auto shptr = std::shared_ptr(new mm_iterator_type(*m_owner_ptr)); - auto shptr = std::make_shared(*m_owner_ptr); - auto key = m_next_available_key; m_next_available_key++; - mm_iterator_handle_type retval(key, shptr); - typename CMMIterators::value_type new_item(key, shptr); - if (!mm_fast_mode1()) { - (*m_aux_mm_iterator_shptrs_ptr).insert(new_item); - } - else { - if (sc_fm1_max_mm_iterators == m_fm1_num_mm_iterators) { - /* Too many items. Initiate and switch to slow mode. */ - /* Initialize slow storage. */ - m_aux_mm_iterator_shptrs_ptr = new CMMIterators(); - /* First copy the items from fast storage to slow storage. */ - for (int i = 0; i < sc_fm1_max_mm_iterators; i += 1) { - (*m_aux_mm_iterator_shptrs_ptr).insert(m_fm1_key_mm_it_array[i]); - } - /* Add the new items to slow storage. */ - (*m_aux_mm_iterator_shptrs_ptr).insert(new_item); - } - else { - m_fm1_key_mm_it_array[m_fm1_num_mm_iterators] = new_item; - m_fm1_num_mm_iterators += 1; - } - } - return retval; - } - void release_item_pointer(mm_iterator_handle_type handle) { - if (!mm_fast_mode1()) { - auto it = (*m_aux_mm_iterator_shptrs_ptr).find(handle.m_key); - if ((*m_aux_mm_iterator_shptrs_ptr).end() != it) { - (*m_aux_mm_iterator_shptrs_ptr).erase(it); - } - else { - /* Do we need to throw here? */ - MSE_THROW(msevector_range_error("invalid handle - void release_aux_mm_iterator(mm_iterator_handle_type handle) - msevector::mm_iterator_set_type")); - } - } - else { - int found_index = -1; - for (int i = 0; i < m_fm1_num_mm_iterators; i += 1) { - if (handle.m_key == m_fm1_key_mm_it_array[i].first) { - found_index = i; - break; - } - } - if (0 <= found_index) { - m_fm1_num_mm_iterators -= 1; - assert(0 <= m_fm1_num_mm_iterators); - for (int j = found_index; j < m_fm1_num_mm_iterators; j += 1) { - m_fm1_key_mm_it_array[j] = m_fm1_key_mm_it_array[j + 1]; - } - } - else { - /* Do we need to throw here? */ - MSE_THROW(msevector_range_error("invalid handle - void release_aux_mm_iterator(mm_iterator_handle_type handle) - msevector::mm_iterator_set_type")); - } - } - } - void release_all_item_pointers() { - if (!mm_fast_mode1()) { - (*m_aux_mm_iterator_shptrs_ptr).clear(); - } - else { - for (int i = 0; i < m_fm1_num_mm_iterators; i += 1) { - m_fm1_key_mm_it_array[i] = assignable_CMMIterators_value_type(); - } - m_fm1_num_mm_iterators = 0; - } - } - mm_const_iterator_type &const_item_pointer(mm_const_iterator_handle_type handle) const { - return (*(handle.m_shptr)); - } - mm_iterator_type &item_pointer(mm_iterator_handle_type handle) { - return (*(handle.m_shptr)); - } - - private: - void release_all_const_item_pointers() { - if (!mm_const_fast_mode1()) { - (*m_aux_mm_const_iterator_shptrs_ptr).clear(); - } - else { - for (int i = 0; i < m_fm1_num_mm_const_iterators; i += 1) { - m_fm1_key_mm_const_it_array[i] = assignable_CMMConstIterators_value_type(); - } - m_fm1_num_mm_const_iterators = 0; - } - } - - mm_iterator_set_type& operator=(const mm_iterator_set_type& src_cref) { - /* This is a special type of class. The state (i.e. member values) of an object of this class is specific to (and only - valid for) the particular instance of the object (or the object of which it is a member). So the correct state of a new - copy of this type of object is not a copy of the state, but rather the state of a new object (which is just the default - initialization state). */ - (*this).reset(); - return (*this); - } - mm_iterator_set_type& operator=(mm_iterator_set_type&& src) { /* see above */ (*this).reset(); return (*this); } - mm_iterator_set_type(const mm_iterator_set_type& src) { /* see above */ } - mm_iterator_set_type(const mm_iterator_set_type&& src) { /* see above */ } - - CHashKey1 m_next_available_key = 0; - - static const int sc_fm1_max_mm_iterators = 6/*arbitrary*/; - - bool mm_const_fast_mode1() const { return (nullptr == m_aux_mm_const_iterator_shptrs_ptr); } - int m_fm1_num_mm_const_iterators = 0; - assignable_CMMConstIterators_value_type m_fm1_key_mm_const_it_array[sc_fm1_max_mm_iterators]; - CMMConstIterators* m_aux_mm_const_iterator_shptrs_ptr = nullptr; - - bool mm_fast_mode1() const { return (nullptr == m_aux_mm_iterator_shptrs_ptr); } - int m_fm1_num_mm_iterators = 0; - assignable_CMMIterators_value_type m_fm1_key_mm_it_array[sc_fm1_max_mm_iterators]; - CMMIterators* m_aux_mm_iterator_shptrs_ptr = nullptr; - - _Myt* m_owner_ptr = nullptr; - - friend class /*_Myt*/msevector<_Ty, _A>; - }; - mutable mm_iterator_set_type m_mmitset; - - public: - mm_const_iterator_type &const_item_pointer(mm_const_iterator_handle_type handle) const { - return m_mmitset.const_item_pointer(handle); - } - mm_iterator_type &item_pointer(mm_iterator_handle_type handle) { - return m_mmitset.item_pointer(handle); - } - - private: - mm_const_iterator_handle_type allocate_new_const_item_pointer() const { return m_mmitset.allocate_new_const_item_pointer(); } - void release_const_item_pointer(mm_const_iterator_handle_type handle) const { m_mmitset.release_const_item_pointer(handle); } - void release_all_const_item_pointers() const { m_mmitset.release_all_const_item_pointers(); } - mm_iterator_handle_type allocate_new_item_pointer() const { return m_mmitset.allocate_new_item_pointer(); } - void release_item_pointer(mm_iterator_handle_type handle) const { m_mmitset.release_item_pointer(handle); } - void release_all_item_pointers() const { m_mmitset.release_all_item_pointers(); } - - public: - class cipointer : public random_access_const_iterator_base { - public: - typedef typename mm_const_iterator_type::iterator_category iterator_category; - typedef typename mm_const_iterator_type::value_type value_type; - typedef typename mm_const_iterator_type::difference_type difference_type; - typedef difference_type distance_type; // retained - typedef typename mm_const_iterator_type::pointer pointer; - typedef typename mm_const_iterator_type::const_pointer const_pointer; - typedef typename mm_const_iterator_type::reference reference; - typedef typename mm_const_iterator_type::const_reference const_reference; - - cipointer(const _Myt& owner_cref) : m_owner_cptr(&owner_cref) { - mm_const_iterator_handle_type handle = m_owner_cptr->allocate_new_const_item_pointer(); - m_handle_shptr = std::make_shared(handle); - } - cipointer(const cipointer& src_cref) : m_owner_cptr(src_cref.m_owner_cptr) { - mm_const_iterator_handle_type handle = m_owner_cptr->allocate_new_const_item_pointer(); - m_handle_shptr = std::make_shared(handle); - const_item_pointer() = src_cref.const_item_pointer(); - } - ~cipointer() { - m_owner_cptr->release_const_item_pointer(*m_handle_shptr); - } - mm_const_iterator_type& const_item_pointer() const { return m_owner_cptr->const_item_pointer(*m_handle_shptr); } - mm_const_iterator_type& cip() const { return const_item_pointer(); } - //const mm_const_iterator_handle_type& handle() const { return (*m_handle_shptr); } - - void reset() { const_item_pointer().reset(); } - bool points_to_an_item() const { return const_item_pointer().points_to_an_item(); } - bool points_to_end_marker() const { return const_item_pointer().points_to_end_marker(); } - bool points_to_beginning() const { return const_item_pointer().points_to_beginning(); } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return const_item_pointer().has_next_item_or_end_marker(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return const_item_pointer().has_next(); } - bool has_previous() const { return const_item_pointer().has_previous(); } - void set_to_beginning() { const_item_pointer().set_to_beginning(); } - void set_to_end_marker() { const_item_pointer().set_to_end_marker(); } - void set_to_next() { const_item_pointer().set_to_next(); } - void set_to_previous() { const_item_pointer().set_to_previous(); } - cipointer& operator ++() { const_item_pointer().operator ++(); return (*this); } - cipointer operator++(int) { cipointer _Tmp = *this; ++*this; return (_Tmp); } - cipointer& operator --() { const_item_pointer().operator --(); return (*this); } - cipointer operator--(int) { cipointer _Tmp = *this; --*this; return (_Tmp); } - void advance(difference_type n) { const_item_pointer().advance(n); } - void regress(difference_type n) { const_item_pointer().regress(n); } - cipointer& operator +=(difference_type n) { const_item_pointer().operator +=(n); return (*this); } - cipointer& operator -=(difference_type n) { const_item_pointer().operator -=(n); return (*this); } - cipointer operator+(difference_type n) const { auto retval = (*this); retval += n; return retval; } - cipointer operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const cipointer& _Right_cref) const { return const_item_pointer() - (_Right_cref.const_item_pointer()); } - const_reference operator*() const { return const_item_pointer().operator*(); } - const_reference item() const { return operator*(); } - const_reference previous_item() const { return const_item_pointer().previous_item(); } - const_pointer operator->() const { return const_item_pointer().operator->(); } - const_reference operator[](difference_type _Off) const { return const_item_pointer()[_Off]; } - cipointer& operator=(const cipointer& _Right_cref) { const_item_pointer().operator=(_Right_cref.const_item_pointer()); return (*this); } - bool operator==(const cipointer& _Right_cref) const { return const_item_pointer().operator==(_Right_cref.const_item_pointer()); } - bool operator!=(const cipointer& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const cipointer& _Right) const { return (const_item_pointer() < _Right.const_item_pointer()); } - bool operator<=(const cipointer& _Right) const { return (const_item_pointer() <= _Right.const_item_pointer()); } - bool operator>(const cipointer& _Right) const { return (const_item_pointer() > _Right.const_item_pointer()); } - bool operator>=(const cipointer& _Right) const { return (const_item_pointer() >= _Right.const_item_pointer()); } - void set_to_const_item_pointer(const cipointer& _Right_cref) { const_item_pointer().set_to_const_item_pointer(_Right_cref.const_item_pointer()); } - msev_size_t position() const { return const_item_pointer().position(); } - private: - const _Myt* m_owner_cptr = nullptr; - std::shared_ptr m_handle_shptr; - friend class /*_Myt*/msevector<_Ty, _A>; - }; - class ipointer : public random_access_iterator_base { - public: - typedef typename mm_iterator_type::iterator_category iterator_category; - typedef typename mm_iterator_type::value_type value_type; - typedef typename mm_iterator_type::difference_type difference_type; - typedef difference_type distance_type; // retained - typedef typename mm_iterator_type::pointer pointer; - typedef typename mm_iterator_type::reference reference; - - ipointer(_Myt& owner_ref) : m_owner_ptr(&owner_ref) { - mm_iterator_handle_type handle = m_owner_ptr->allocate_new_item_pointer(); - m_handle_shptr = std::make_shared(handle); - } - ipointer(const ipointer& src_cref) : m_owner_ptr(src_cref.m_owner_ptr) { - mm_iterator_handle_type handle = m_owner_ptr->allocate_new_item_pointer(); - m_handle_shptr = std::make_shared(handle); - item_pointer() = src_cref.item_pointer(); - } - ~ipointer() { - m_owner_ptr->release_item_pointer(*m_handle_shptr); - } - mm_iterator_type& item_pointer() const { return m_owner_ptr->item_pointer(*m_handle_shptr); } - mm_iterator_type& ip() const { return item_pointer(); } - //const mm_iterator_handle_type& handle() const { return (*m_handle_shptr); } - operator cipointer() const { - cipointer retval(*m_owner_ptr); - retval.const_item_pointer().set_to_beginning(); - retval.const_item_pointer().advance(msev_int(item_pointer().position())); - return retval; - } - - void reset() { item_pointer().reset(); } - bool points_to_an_item() const { return item_pointer().points_to_an_item(); } - bool points_to_end_marker() const { return item_pointer().points_to_end_marker(); } - bool points_to_beginning() const { return item_pointer().points_to_beginning(); } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return item_pointer().has_next_item_or_end_marker(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return item_pointer().has_next(); } - bool has_previous() const { return item_pointer().has_previous(); } - void set_to_beginning() { item_pointer().set_to_beginning(); } - void set_to_end_marker() { item_pointer().set_to_end_marker(); } - void set_to_next() { item_pointer().set_to_next(); } - void set_to_previous() { item_pointer().set_to_previous(); } - ipointer& operator ++() { item_pointer().operator ++(); return (*this); } - ipointer operator++(int) { ipointer _Tmp = *this; ++*this; return (_Tmp); } - ipointer& operator --() { item_pointer().operator --(); return (*this); } - ipointer operator--(int) { ipointer _Tmp = *this; --*this; return (_Tmp); } - void advance(difference_type n) { item_pointer().advance(n); } - void regress(difference_type n) { item_pointer().regress(n); } - ipointer& operator +=(difference_type n) { item_pointer().operator +=(n); return (*this); } - ipointer& operator -=(difference_type n) { item_pointer().operator -=(n); return (*this); } - ipointer operator+(difference_type n) const { auto retval = (*this); retval += n; return retval; } - ipointer operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const ipointer& _Right_cref) const { return item_pointer() - (_Right_cref.item_pointer()); } - reference operator*() const { return item_pointer().operator*(); } - reference item() const { return operator*(); } - reference previous_item() const { return item_pointer().previous_item(); } - pointer operator->() const { return item_pointer().operator->(); } - reference operator[](difference_type _Off) const { return item_pointer()[_Off]; } - ipointer& operator=(const ipointer& _Right_cref) { item_pointer().operator=(_Right_cref.item_pointer()); return (*this); } - bool operator==(const ipointer& _Right_cref) const { return item_pointer().operator==(_Right_cref.item_pointer()); } - bool operator!=(const ipointer& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const ipointer& _Right) const { return (item_pointer() < _Right.item_pointer()); } - bool operator<=(const ipointer& _Right) const { return (item_pointer() <= _Right.item_pointer()); } - bool operator>(const ipointer& _Right) const { return (item_pointer() > _Right.item_pointer()); } - bool operator>=(const ipointer& _Right) const { return (item_pointer() >= _Right.item_pointer()); } - void set_to_item_pointer(const ipointer& _Right_cref) { item_pointer().set_to_item_pointer(_Right_cref.item_pointer()); } - msev_size_t position() const { return item_pointer().position(); } - private: - _Myt* m_owner_ptr = nullptr; - std::shared_ptr m_handle_shptr; - friend class /*_Myt*/msevector<_Ty, _A>; - }; - - ipointer ibegin() { // return ipointer for beginning of mutable sequence - ipointer retval(*this); - retval.set_to_beginning(); - return retval; - } - cipointer ibegin() const { // return ipointer for beginning of nonmutable sequence - cipointer retval(*this); - retval.set_to_beginning(); - return retval; - } - ipointer iend() { // return ipointer for end of mutable sequence - ipointer retval(*this); - retval.set_to_end_marker(); - return retval; - } - cipointer iend() const { // return ipointer for end of nonmutable sequence - cipointer retval(*this); - retval.set_to_end_marker(); - return retval; - } - cipointer cibegin() const { // return ipointer for beginning of nonmutable sequence - cipointer retval(*this); - retval.set_to_beginning(); - return retval; - } - cipointer ciend() const { // return ipointer for end of nonmutable sequence - cipointer retval(*this); - retval.set_to_end_marker(); - return retval; - } - - msevector(const cipointer &start, const cipointer &end, const _A& _Al = _A()) - : base_class(_Al), m_mmitset(*this) { - /*m_debug_size = size();*/ - assign(start, end); - } - void assign(const mm_const_iterator_type &start, const mm_const_iterator_type &end) { - if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void assign(const mm_const_iterator_type &start, const mm_const_iterator_type &end) - msevector")); } - if (start > end) { MSE_THROW(msevector_range_error("invalid arguments - void assign(const mm_const_iterator_type &start, const mm_const_iterator_type &end) - msevector")); } - typename base_class::const_iterator _F = start; - typename base_class::const_iterator _L = end; - (*this).assign(_F, _L); - } - void assign_inclusive(const mm_const_iterator_type &first, const mm_const_iterator_type &last) { - auto end = last; - end++; // this should include some checks - (*this).assign(first, end); - } - void assign(const cipointer &start, const cipointer &end) { - assign(start.const_item_pointer(), end.const_item_pointer()); - } - void assign_inclusive(const cipointer &first, const cipointer &last) { - assign_inclusive(first.const_item_pointer(), last.const_item_pointer()); - } - void insert_before(const mm_const_iterator_type &pos, size_type _M, const _Ty& _X) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - typename base_class::const_iterator _P = pos; - (*this).insert(_P, _M, _X); - } - void insert_before(const mm_const_iterator_type &pos, _Ty&& _X) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - typename base_class::const_iterator _P = pos; - (*this).insert(_P, 1, std::move(_X)); - } - void insert_before(const mm_const_iterator_type &pos, const _Ty& _X = _Ty()) { (*this).insert(pos, 1, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - void insert_before(const mm_const_iterator_type &pos, const _Iter &start, const _Iter &end) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - //if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before(const mm_const_iterator_type &pos, const mm_const_iterator_type &start, const mm_const_iterator_type &end) - msevector")); } - typename base_class::const_iterator _P = pos; - (*this).insert(_P, start, end); - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - void insert_before_inclusive(const mm_const_iterator_type &pos, const _Iter &first, const _Iter &last) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - if (first.m_owner_cptr != last.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before_inclusive(const mm_const_iterator_type &pos, const mm_const_iterator_type &first, const mm_const_iterator_type &last) - msevector")); } - if (!(last.points_to_item())) { MSE_THROW(msevector_range_error("invalid argument - void insert_before_inclusive(const mm_const_iterator_type &pos, const mm_const_iterator_type &first, const mm_const_iterator_type &last) - msevector")); } - typename base_class::const_iterator _P = pos; - auto _L = last; - _L++; - (*this).insert(_P, first, _L); - } - void insert_before(const mm_const_iterator_type &pos, _XSTD initializer_list _Ilist) { // insert initializer_list - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - typename base_class::const_iterator _P = pos; - (*this).insert(_P, _Ilist); - } - ipointer insert_before(const cipointer &pos, size_type _M, const _Ty& _X) { - msev_size_t original_pos = pos.position(); - insert_before(pos.const_item_pointer(), _M, _X); - ipointer retval(*this); retval.advance(msev_int(original_pos)); - return retval; - } - ipointer insert_before(const cipointer &pos, _Ty&& _X) { - msev_size_t original_pos = pos.position(); - insert_before(pos.const_item_pointer(), std::move(_X)); - ipointer retval(*this); retval.advance(msev_int(original_pos)); - return retval; - } - ipointer insert_before(const cipointer &pos, const _Ty& _X = _Ty()) { return insert_before(pos, 1, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ipointer insert_before(const cipointer &pos, const _Iter &start, const _Iter &end) { - msev_size_t original_pos = pos.position(); - insert_before(pos.const_item_pointer(), start, end); - ipointer retval(*this); retval.advance(msev_int(original_pos)); - return retval; - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ipointer insert_before_inclusive(const cipointer &pos, const _Iter &first, const _Iter &last) { - auto end = last; end++; - return insert_before(pos, first, end); - } - ipointer insert_before(const cipointer &pos, _XSTD initializer_list _Ilist) { // insert initializer_list - msev_size_t original_pos = pos.position(); - (*this).insert_before(pos.const_item_pointer(), _Ilist); - ipointer retval(*this); retval.advance(msev_int(original_pos)); - return retval; - } - void insert_before(msev_size_t pos, _Ty&& _X) { - typename base_class::const_iterator _P = (*this).begin() + msev_as_a_size_t(pos); - (*this).insert(_P, std::move(_X)); - } - void insert_before(msev_size_t pos, const _Ty& _X = _Ty()) { - typename base_class::const_iterator _P = (*this).begin() + msev_as_a_size_t(pos); - (*this).insert(_P, _X); - } - void insert_before(msev_size_t pos, size_t _M, const _Ty& _X) { - typename base_class::const_iterator _P = (*this).begin() + msev_as_a_size_t(pos); - (*this).insert(_P, _M, _X); - } - void insert_before(msev_size_t pos, _XSTD initializer_list _Ilist) { // insert initializer_list - typename base_class::const_iterator _P = (*this).begin() + msev_as_a_size_t(pos); - (*this).insert(_P, _Ilist); - } - /* These insert() functions are just aliases for their corresponding insert_before() functions. */ - ipointer insert(const cipointer &pos, size_type _M, const _Ty& _X) { return insert_before(pos, _M, _X); } - ipointer insert(const cipointer &pos, _Ty&& _X) { return insert_before(pos, std::move(_X)); } - ipointer insert(const cipointer &pos, const _Ty& _X = _Ty()) { return insert_before(pos, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ipointer insert(const cipointer &pos, const _Iter &start, const _Iter &end) { return insert_before(pos, start, end); } - ipointer insert(const cipointer &pos, _XSTD initializer_list _Ilist) { return insert_before(pos, _Ilist); } - template -#if !(defined(GPP4P8_COMPATIBLE)) - void emplace(const mm_const_iterator_type &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - void emplace(const mm_iterator_type &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void emplace() - msevector")); } - typename base_class::const_iterator _P = pos; - auto retval = base_class::emplace(_P, std::forward<_Valty>(_Val)...); - } - template -#if !(defined(GPP4P8_COMPATIBLE)) - ipointer emplace(const cipointer &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - ipointer emplace(const ipointer &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - msev_size_t original_pos = pos.position(); - (*this).emplace(pos.const_item_pointer(), std::forward<_Valty>(_Val)...); - ipointer retval(*this); retval.advance(msev_int(original_pos)); - return retval; - } - void erase(const mm_const_iterator_type &pos) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - typename base_class::const_iterator _P = pos; - (*this).erase(_P); - } - void erase(const mm_const_iterator_type &start, const mm_const_iterator_type &end) { - if (start.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - if (end.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - typename base_class::const_iterator _F = start; - typename base_class::const_iterator _L = end; - (*this).erase(_F, _L); - } - void erase_inclusive(const mm_const_iterator_type &first, const mm_const_iterator_type &last) { - if (first.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase_inclusive() - msevector")); } - if (last.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase_inclusive() - msevector")); } - if (!(last.points_to_item())) { MSE_THROW(msevector_range_error("invalid argument - void erase_inclusive() - msevector")); } - typename base_class::const_iterator _F = first; - typename base_class::const_iterator _L = last; - _L++; - (*this).erase(_F, _L); - } - ipointer erase(const cipointer &pos) { - auto retval_pos = pos; - retval_pos.set_to_next(); - erase(pos.const_item_pointer()); - ipointer retval = (*this).ibegin(); - retval.advance(msev_int(retval_pos.position())); - return retval; - } - ipointer erase(const cipointer &start, const cipointer &end) { - auto retval_pos = end; - retval_pos.set_to_next(); - erase(start.const_item_pointer(), end.const_item_pointer()); - ipointer retval = (*this).ibegin(); - retval.advance(msev_int(retval_pos.position())); - return retval; - } - ipointer erase_inclusive(const cipointer &first, const cipointer &last) { - auto end = last; end.set_to_next(); - return erase(first, end); - } - void erase_previous_item(const mm_const_iterator_type &pos) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase_previous_item() - msevector")); } - if (!(pos.has_previous())) { MSE_THROW(msevector_range_error("invalid arguments - void erase_previous_item() - msevector")); } - typename base_class::const_iterator _P = pos; - _P--; - (*this).erase(_P); - } - ipointer erase_previous_item(const cipointer &pos) { - erase_previous_item(pos.const_item_pointer()); - ipointer retval = (*this).ibegin(); - retval.advance(pos.position()); - return retval; - } - - - /* ss_const_iterator_type is a bounds checked iterator. */ - class ss_const_iterator_type : public random_access_const_iterator_base { - public: - typedef typename base_class::const_iterator::iterator_category iterator_category; - typedef typename base_class::const_iterator::value_type value_type; - //typedef typename base_class::const_iterator::difference_type difference_type; - typedef typename _Myt::difference_type difference_type; - typedef difference_type distance_type; // retained - typedef typename base_class::const_iterator::pointer pointer; - typedef typename base_class::const_pointer const_pointer; - typedef typename base_class::const_iterator::reference reference; - typedef typename base_class::const_reference const_reference; - - ss_const_iterator_type() {} - void assert_valid_index() const { - if (m_owner_cptr->size() < m_index) { MSE_THROW(msevector_range_error("invalid index - void assert_valid_index() const - ss_const_iterator_type - msevector")); } - } - void reset() { set_to_end_marker(); } - bool points_to_an_item() const { - if (m_owner_cptr->size() > m_index) { return true; } - else { - if (m_index == m_owner_cptr->size()) { return false; } - else { MSE_THROW(msevector_range_error("attempt to use invalid ss_const_iterator_type - bool points_to_an_item() const - ss_const_iterator_type - msevector")); } - } - } - bool points_to_end_marker() const { - if (false == points_to_an_item()) { - assert(m_index == m_owner_cptr->size()); - return true; - } - else { return false; } - } - bool points_to_beginning() const { - if (0 == m_index) { return true; } - else { return false; } - } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return points_to_an_item(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return has_next_item_or_end_marker(); } - bool has_previous() const { - if (m_owner_cptr->size() < m_index) { - MSE_THROW(msevector_range_error("attempt to use invalid ss_const_iterator_type - bool has_previous() const - ss_const_iterator_type - msevector")); - } - else if (1 <= m_index) { - return true; - } - else { - return false; - } - } - void set_to_beginning() { - m_index = 0; - } - void set_to_end_marker() { - m_index = m_owner_cptr->size(); - } - void set_to_next() { - if (points_to_an_item()) { - m_index += 1; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid const_item_pointer - void set_to_next() - ss_const_iterator_type - msevector")); - } - } - void set_to_previous() { - if (has_previous()) { - m_index -= 1; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid const_item_pointer - void set_to_previous() - ss_const_iterator_type - msevector")); - } - } - ss_const_iterator_type& operator ++() { (*this).set_to_next(); return (*this); } - ss_const_iterator_type operator++(int) { ss_const_iterator_type _Tmp = *this; (*this).set_to_next(); return (_Tmp); } - ss_const_iterator_type& operator --() { (*this).set_to_previous(); return (*this); } - ss_const_iterator_type operator--(int) { ss_const_iterator_type _Tmp = *this; (*this).set_to_previous(); return (_Tmp); } - void advance(difference_type n) { - auto new_index = msev_int(m_index) + n; - if ((0 > new_index) || (m_owner_cptr->size() < msev_size_t(new_index))) { - MSE_THROW(msevector_range_error("index out of range - void advance(difference_type n) - ss_const_iterator_type - msevector")); - } - else { - m_index = msev_size_t(new_index); - } - } - void regress(difference_type n) { advance(-n); } - ss_const_iterator_type& operator +=(difference_type n) { (*this).advance(n); return (*this); } - ss_const_iterator_type& operator -=(difference_type n) { (*this).regress(n); return (*this); } - ss_const_iterator_type operator+(difference_type n) const { - ss_const_iterator_type retval; retval.m_owner_cptr = m_owner_cptr; - retval = (*this); - retval.advance(n); - return retval; - } - ss_const_iterator_type operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const ss_const_iterator_type &rhs) const { - if (rhs.m_owner_cptr != (*this).m_owner_cptr) { MSE_THROW(msevector_range_error("invalid argument - difference_type operator-(const ss_const_iterator_type &rhs) const - msevector::ss_const_iterator_type")); } - auto retval = difference_type((*this).m_index) - difference_type(rhs.m_index); - assert(difference_type((*m_owner_cptr).size()) >= retval); - return retval; - } - const_reference operator*() const { - return (*m_owner_cptr).at(msev_as_a_size_t((*this).m_index)); - } - const_reference item() const { return operator*(); } - const_reference previous_item() const { - return m_owner_cptr->at(msev_as_a_size_t(m_index - 1)); - } - const_pointer operator->() const { - return &((*m_owner_cptr).at(msev_as_a_size_t((*this).m_index))); - } - const_reference operator[](difference_type _Off) const { return (*m_owner_cptr).at(msev_as_a_size_t(difference_type(m_index) + _Off)); } - /* - ss_const_iterator_type& operator=(const typename base_class::const_iterator& _Right_cref) - { - msev_int d = std::distance(m_owner_cptr->cbegin(), _Right_cref); - if ((0 <= d) && (m_owner_cptr->size() >= d)) { - if (m_owner_cptr->size() == d) { - assert(m_owner_cptr->cend() == _Right_cref); - } - m_index = msev_size_t(d); - base_class::const_iterator::operator=(_Right_cref); - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - ss_const_iterator_type& operator=(const typename base_class::const_iterator& _Right_cref) - ss_const_iterator_type - msevector")); - } - return (*this); - } - */ - ss_const_iterator_type& operator=(const ss_const_iterator_type& _Right_cref) { - ((*this).m_owner_cptr) = _Right_cref.m_owner_cptr; - (*this).m_index = _Right_cref.m_index; - return (*this); - } - bool operator==(const ss_const_iterator_type& _Right_cref) const { - if (this->m_owner_cptr != _Right_cref.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid argument - ss_const_iterator_type& operator==(const ss_const_iterator_type& _Right) - ss_const_iterator_type - msevector")); } - return (_Right_cref.m_index == m_index); - } - bool operator!=(const ss_const_iterator_type& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const ss_const_iterator_type& _Right) const { - if (this->m_owner_cptr != _Right.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid argument - ss_const_iterator_type& operator<(const ss_const_iterator_type& _Right) - ss_const_iterator_type - msevector")); } - return (m_index < _Right.m_index); - } - bool operator<=(const ss_const_iterator_type& _Right) const { return (((*this) < _Right) || (_Right == (*this))); } - bool operator>(const ss_const_iterator_type& _Right) const { return (!((*this) <= _Right)); } - bool operator>=(const ss_const_iterator_type& _Right) const { return (!((*this) < _Right)); } - void set_to_const_item_pointer(const ss_const_iterator_type& _Right_cref) { - (*this) = _Right_cref; - } - void invalidate_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - (*this).reset(); - } - } - void shift_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last, msev_int shift) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - auto new_index = (*this).m_index + shift; - if ((0 > new_index) || (m_owner_cptr->size() < new_index)) { - MSE_THROW(msevector_range_error("void shift_inclusive_range() - ss_const_iterator_type - msevector")); - } - else { - (*this).m_index = msev_size_t(new_index); - (*this).sync_const_iterator_to_index(); - } - } - } - msev_size_t position() const { - return m_index; - } - operator typename base_class::const_iterator() const { - typename base_class::const_iterator retval = (*m_owner_cptr).cbegin(); - retval += msev_as_a_size_t(m_index); - return retval; - } - private: - void sync_const_iterator_to_index() { - assert(m_owner_cptr->size() >= (*this).m_index); - //base_class::const_iterator::operator=(m_owner_cptr->cbegin()); - //base_class::const_iterator::operator+=(msev_as_a_size_t(m_index)); - } - msev_size_t m_index = 0; - msev_pointer m_owner_cptr = nullptr; - friend class /*_Myt*/msevector<_Ty, _A>; - }; - /* ss_iterator_type is a bounds checked iterator. */ - class ss_iterator_type : public random_access_iterator_base { - public: - typedef typename base_class::iterator::iterator_category iterator_category; - typedef typename base_class::iterator::value_type value_type; - //typedef typename base_class::iterator::difference_type difference_type; - typedef typename _Myt::difference_type difference_type; - typedef difference_type distance_type; // retained - typedef typename base_class::iterator::pointer pointer; - typedef typename base_class::iterator::reference reference; - - ss_iterator_type() {} - void reset() { set_to_end_marker(); } - bool points_to_an_item() const { - if (m_owner_ptr->size() > m_index) { return true; } - else { - if (m_index == m_owner_ptr->size()) { return false; } - else { MSE_THROW(msevector_range_error("attempt to use invalid ss_iterator_type - bool points_to_an_item() const - ss_iterator_type - msevector")); } - } - } - bool points_to_end_marker() const { - if (false == points_to_an_item()) { - assert(m_index == m_owner_ptr->size()); - return true; - } - else { return false; } - } - bool points_to_beginning() const { - if (0 == m_index) { return true; } - else { return false; } - } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return points_to_an_item(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return has_next_item_or_end_marker(); } - bool has_previous() const { - if (m_owner_ptr->size() < m_index) { - MSE_THROW(msevector_range_error("attempt to use invalid ss_iterator_type - bool has_previous() const - ss_iterator_type - msevector")); - } else if (1 <= m_index) { - return true; - } - else { - return false; - } - } - void set_to_beginning() { - m_index = 0; - } - void set_to_end_marker() { - m_index = m_owner_ptr->size(); - } - void set_to_next() { - if (points_to_an_item()) { - m_index += 1; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid item_pointer - void set_to_next() - ss_const_iterator_type - msevector")); - } - } - void set_to_previous() { - if (has_previous()) { - m_index -= 1; - } - else { - MSE_THROW(msevector_range_error("attempt to use invalid item_pointer - void set_to_previous() - ss_iterator_type - msevector")); - } - } - ss_iterator_type& operator ++() { (*this).set_to_next(); return (*this); } - ss_iterator_type operator++(int) { ss_iterator_type _Tmp = *this; (*this).set_to_next(); return (_Tmp); } - ss_iterator_type& operator --() { (*this).set_to_previous(); return (*this); } - ss_iterator_type operator--(int) { ss_iterator_type _Tmp = *this; (*this).set_to_previous(); return (_Tmp); } - void advance(difference_type n) { - auto new_index = msev_int(m_index) + n; - if ((0 > new_index) || (m_owner_ptr->size() < msev_size_t(new_index))) { - MSE_THROW(msevector_range_error("index out of range - void advance(difference_type n) - ss_iterator_type - msevector")); - } - else { - m_index = msev_size_t(new_index); - } - } - void regress(difference_type n) { advance(-n); } - ss_iterator_type& operator +=(difference_type n) { (*this).advance(n); return (*this); } - ss_iterator_type& operator -=(difference_type n) { (*this).regress(n); return (*this); } - ss_iterator_type operator+(difference_type n) const { - ss_iterator_type retval; retval.m_owner_ptr = m_owner_ptr; - retval = (*this); - retval.advance(n); - return retval; - } - ss_iterator_type operator-(difference_type n) const { return ((*this) + (-n)); } - difference_type operator-(const ss_iterator_type& rhs) const { - if (rhs.m_owner_ptr != (*this).m_owner_ptr) { MSE_THROW(msevector_range_error("invalid argument - difference_type operator-(const ss_iterator_type& rhs) const - msevector::ss_iterator_type")); } - auto retval = difference_type((*this).m_index) - difference_type(rhs.m_index); - assert(int((*m_owner_ptr).size()) >= retval); - return retval; - } - reference operator*() const { - return (*m_owner_ptr).at(msev_as_a_size_t((*this).m_index)); - } - reference item() const { return operator*(); } - reference previous_item() const { - return m_owner_ptr->at(msev_as_a_size_t(m_index - 1)); - } - pointer operator->() const { - return &((*m_owner_ptr).at(msev_as_a_size_t((*this).m_index))); - } - reference operator[](difference_type _Off) const { return (*m_owner_ptr).at(msev_as_a_size_t(difference_type(m_index) + _Off)); } - /* - ss_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - { - msev_int d = std::distance(m_owner_ptr->begin(), _Right_cref); - if ((0 <= d) && (m_owner_ptr->size() >= d)) { - if (m_owner_ptr->size() == d) { - assert(m_owner_ptr->end() == _Right_cref); - } - m_index = msev_size_t(d); - base_class::iterator::operator=(_Right_cref); - } - else { - MSE_THROW(msevector_range_error("doesn't seem to be a valid assignment value - ss_iterator_type& operator=(const typename base_class::iterator& _Right_cref) - ss_const_iterator_type - msevector")); - } - return (*this); - } - */ - ss_iterator_type& operator=(const ss_iterator_type& _Right_cref) { - ((*this).m_owner_ptr) = _Right_cref.m_owner_ptr; - (*this).m_index = _Right_cref.m_index; - return (*this); - } - bool operator==(const ss_iterator_type& _Right_cref) const { - if (this->m_owner_ptr != _Right_cref.m_owner_ptr) { MSE_THROW(msevector_range_error("invalid argument - ss_iterator_type& operator==(const ss_iterator_type& _Right) - ss_iterator_type - msevector")); } - return (_Right_cref.m_index == m_index); - } - bool operator!=(const ss_iterator_type& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const ss_iterator_type& _Right) const { - if (this->m_owner_ptr != _Right.m_owner_ptr) { MSE_THROW(msevector_range_error("invalid argument - ss_iterator_type& operator<(const ss_iterator_type& _Right) - ss_iterator_type - msevector")); } - return (m_index < _Right.m_index); - } - bool operator<=(const ss_iterator_type& _Right) const { return (((*this) < _Right) || (_Right == (*this))); } - bool operator>(const ss_iterator_type& _Right) const { return (!((*this) <= _Right)); } - bool operator>=(const ss_iterator_type& _Right) const { return (!((*this) < _Right)); } - void set_to_item_pointer(const ss_iterator_type& _Right_cref) { - (*this) = _Right_cref; - } - void invalidate_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - (*this).reset(); - } - } - void shift_inclusive_range(msev_size_t index_of_first, msev_size_t index_of_last, msev_int shift) { - if ((index_of_first <= (*this).m_index) && (index_of_last >= (*this).m_index)) { - auto new_index = (*this).m_index + shift; - if ((0 > new_index) || (m_owner_ptr->size() < new_index)) { - MSE_THROW(msevector_range_error("void shift_inclusive_range() - ss_iterator_type - msevector")); - } - else { - (*this).m_index = msev_size_t(new_index); - (*this).sync_iterator_to_index(); - } - } - } - msev_size_t position() const { - return m_index; - } - operator ss_const_iterator_type() const { - ss_const_iterator_type retval; - if (nullptr != m_owner_ptr) { - retval = m_owner_ptr->ss_cbegin(); - retval.advance(msev_int(m_index)); - } - return retval; - } - operator typename base_class::iterator() const { - typename base_class::iterator retval = (*m_owner_ptr).begin(); - retval += msev_as_a_size_t(m_index); - return retval; - } - - private: - void sync_iterator_to_index() { - assert(m_owner_ptr->size() >= (*this).m_index); - //base_class::iterator::operator=(m_owner_ptr->begin()); - //base_class::iterator::operator+=(msev_as_a_size_t(m_index)); - } - msev_size_t m_index = 0; - msev_pointer<_Myt> m_owner_ptr = nullptr; - friend class /*_Myt*/msevector<_Ty, _A>; - }; - typedef std::reverse_iterator ss_reverse_iterator_type; - typedef std::reverse_iterator ss_const_reverse_iterator_type; - - ss_iterator_type ss_begin() - { // return base_class::iterator for beginning of mutable sequence - ss_iterator_type retval; retval.m_owner_ptr = this; - retval.set_to_beginning(); - return retval; - } - - ss_const_iterator_type ss_begin() const - { // return base_class::iterator for beginning of nonmutable sequence - ss_const_iterator_type retval; retval.m_owner_cptr = this; - retval.set_to_beginning(); - return retval; - } - - ss_iterator_type ss_end() - { // return base_class::iterator for end of mutable sequence - ss_iterator_type retval; retval.m_owner_ptr = this; - retval.set_to_end_marker(); - return retval; - } - - ss_const_iterator_type ss_end() const - { // return base_class::iterator for end of nonmutable sequence - ss_const_iterator_type retval; retval.m_owner_cptr = this; - retval.set_to_end_marker(); - return retval; - } - - ss_const_iterator_type ss_cbegin() const - { // return base_class::iterator for beginning of nonmutable sequence - ss_const_iterator_type retval; retval.m_owner_cptr = this; - retval.set_to_beginning(); - return retval; - } - - ss_const_iterator_type ss_cend() const - { // return base_class::iterator for end of nonmutable sequence - ss_const_iterator_type retval; retval.m_owner_cptr = this; - retval.set_to_end_marker(); - return retval; - } - - ss_const_reverse_iterator_type ss_crbegin() const - { // return base_class::iterator for beginning of reversed nonmutable sequence - return (ss_rbegin()); - } - - ss_const_reverse_iterator_type ss_crend() const - { // return base_class::iterator for end of reversed nonmutable sequence - return (ss_rend()); - } - - ss_reverse_iterator_type ss_rbegin() - { // return base_class::iterator for beginning of reversed mutable sequence - return (reverse_iterator(ss_end())); - } - - ss_const_reverse_iterator_type ss_rbegin() const - { // return base_class::iterator for beginning of reversed nonmutable sequence - return (const_reverse_iterator(ss_end())); - } - - ss_reverse_iterator_type ss_rend() - { // return base_class::iterator for end of reversed mutable sequence - return (reverse_iterator(ss_begin())); - } - - ss_const_reverse_iterator_type ss_rend() const - { // return base_class::iterator for end of reversed nonmutable sequence - return (const_reverse_iterator(ss_begin())); - } - - msevector(const ss_const_iterator_type &start, const ss_const_iterator_type &end, const _A& _Al = _A()) - : base_class(_Al), m_mmitset(*this) { - /*m_debug_size = size();*/ - assign(start, end); - } - void assign(const ss_const_iterator_type &start, const ss_const_iterator_type &end) { - if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void assign(const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - if (start > end) { MSE_THROW(msevector_range_error("invalid arguments - void assign(const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - typename base_class::const_iterator _F = start; - typename base_class::const_iterator _L = end; - (*this).assign(_F, _L); - } - void assign_inclusive(const ss_const_iterator_type &first, const ss_const_iterator_type &last) { - auto end = last; - end++; // this should include some checks - (*this).assign(first, end); - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, size_type _M, const _Ty& _X) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid argument - void insert_before() - msevector")); } - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).insert(_P, _M, _X); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, _Ty&& _X) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid argument - void insert_before() - msevector")); } - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).insert(_P, std::move(_X)); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, const _Ty& _X = _Ty()) { return (*this).insert(pos, 1, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ss_iterator_type insert_before(const ss_const_iterator_type &pos, const _Iter &start, const _Iter &end) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid argument - ss_iterator_type insert_before() - msevector")); } - //if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before(const ss_const_iterator_type &pos, const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).insert(_P, start, end); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, const ss_const_iterator_type& start, const ss_const_iterator_type &end) { - if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before(const ss_const_iterator_type &pos, const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - end.assert_valid_index(); - if (start > end) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before(const ss_const_iterator_type &pos, const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - typename base_class::const_iterator _S = start; - typename base_class::const_iterator _E = end; - return (*this).insert_before(pos, _S, _E); - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, const _Ty* start, const _Ty* end) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - ss_iterator_type insert_before() - msevector")); } - //if (start.m_owner_cptr != end.m_owner_cptr) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before(const ss_const_iterator_type &pos, const ss_const_iterator_type &start, const ss_const_iterator_type &end) - msevector")); } - if (start > end) { MSE_THROW(msevector_range_error("invalid arguments - ss_iterator_type insert_before() - msevector")); } - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).insert(_P, start, end); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ss_iterator_type insert_before_inclusive(const ss_iterator_type &pos, const _Iter &first, const _Iter &last) { - auto end = last; - end++; // this may include some checks - return (*this).insert_before(pos, first, end); - } - ss_iterator_type insert_before(const ss_const_iterator_type &pos, _XSTD initializer_list _Ilist) { // insert initializer_list - if (pos.m_owner_ptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void insert_before() - msevector")); } - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).insert(_P, _Ilist); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - /* These insert() functions are just aliases for their corresponding insert_before() functions. */ - ss_iterator_type insert(const ss_const_iterator_type &pos, size_type _M, const _Ty& _X) { return insert_before(pos, _M, _X); } - ss_iterator_type insert(const ss_const_iterator_type &pos, _Ty&& _X) { return insert_before(pos, std::move(_X)); } - ss_iterator_type insert(const ss_const_iterator_type &pos, const _Ty& _X = _Ty()) { return insert_before(pos, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - ss_iterator_type insert(const ss_const_iterator_type &pos, const _Iter &start, const _Iter &end) { return insert_before(pos, start, end); } - ss_iterator_type insert(const ss_const_iterator_type &pos, const _Ty* start, const _Ty* &end) { return insert_before(pos, start, end); } - ss_iterator_type insert(const ss_const_iterator_type &pos, _XSTD initializer_list _Ilist) { return insert_before(pos, _Ilist); } - template -#if !(defined(GPP4P8_COMPATIBLE)) - ss_iterator_type emplace(const ss_const_iterator_type &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void emplace() - msevector")); } -#else /*!(defined(GPP4P8_COMPATIBLE))*/ - ipointer emplace(const ipointer &pos, _Valty&& ..._Val) - { // insert by moving _Val at pos - if (pos.m_owner_ptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void emplace() - msevector")); } -#endif /*!(defined(GPP4P8_COMPATIBLE))*/ - pos.assert_valid_index(); - msev_size_t original_pos = pos.position(); - typename base_class::const_iterator _P = pos; - (*this).emplace(_P, std::forward<_Valty>(_Val)...); - ss_iterator_type retval = ss_begin(); - retval.advance(msev_int(original_pos)); - return retval; - } - ss_iterator_type erase(const ss_const_iterator_type &pos) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - if (!pos.points_to_an_item()) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - auto pos_index = pos.position(); - - typename base_class::const_iterator _P = pos; - (*this).erase(_P); - - ss_iterator_type retval = (*this).ss_begin(); - retval.advance(typename ss_const_iterator_type::difference_type(pos_index)); - return retval; - } - ss_iterator_type erase(const ss_const_iterator_type &start, const ss_const_iterator_type &end) { - if (start.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - if (end.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - if (start.position() > end.position()) { MSE_THROW(msevector_range_error("invalid arguments - void erase() - msevector")); } - auto pos_index = start.position(); - - typename base_class::const_iterator _F = start; - typename base_class::const_iterator _L = end; - (*this).erase(_F, _L); - - ss_iterator_type retval = (*this).ss_begin(); - retval.advance(typename ss_const_iterator_type::difference_type(pos_index)); - return retval; - } - ss_iterator_type erase_inclusive(const ss_const_iterator_type &first, const ss_const_iterator_type &last) { - auto end = last; end.set_to_next(); - return erase(first, end); - } - void erase_previous_item(const ss_const_iterator_type &pos) { - if (pos.m_owner_cptr != this) { MSE_THROW(msevector_range_error("invalid arguments - void erase_previous_item() - msevector")); } - if (!(pos.has_previous())) { MSE_THROW(msevector_range_error("invalid arguments - void erase_previous_item() - msevector")); } - typename base_class::const_iterator _P = pos; - _P--; - (*this).erase(_P); - } - }; - -} - -#undef MSE_THROW - -#endif /*ndef MSEMSEVECTOR_H*/ diff --git a/src/debug/mse/msemstdvector.h b/src/debug/mse/msemstdvector.h deleted file mode 100644 index fa7d848bc..000000000 --- a/src/debug/mse/msemstdvector.h +++ /dev/null @@ -1,413 +0,0 @@ - -// Copyright (c) 2015 Noah Lopez -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MSEMSTDVECTOR_H -#define MSEMSTDVECTOR_H - -#include "debug/mse/msemsevector.h" - -#ifdef MSE_SAFER_SUBSTITUTES_DISABLED -#define MSE_MSTDVECTOR_DISABLED -#endif /*MSE_SAFER_SUBSTITUTES_DISABLED*/ - -namespace mse { - - namespace mstd { - -#ifdef MSE_MSTDVECTOR_DISABLED - template > using vector = std::vector<_Ty, _A>; - -#else /*MSE_MSTDVECTOR_DISABLED*/ - -#ifndef _NOEXCEPT -#define _NOEXCEPT -#endif /*_NOEXCEPT*/ - - template > - class vector { - public: - typedef mse::mstd::vector<_Ty, _A> _Myt; - typedef mse::msevector<_Ty, _A> _MV; - - typedef typename _MV::allocator_type allocator_type; - typedef typename _MV::value_type value_type; - typedef typename _MV::size_type size_type; - typedef typename _MV::difference_type difference_type; - typedef typename _MV::pointer pointer; - typedef typename _MV::const_pointer const_pointer; - typedef typename _MV::reference reference; - typedef typename _MV::const_reference const_reference; - - const _MV& msevector() const { return (*m_shptr); } - _MV& msevector() { return (*m_shptr); } - operator const _MV() const { return msevector(); } - operator _MV() { return msevector(); } - - explicit vector(const _A& _Al = _A()) : m_shptr(std::make_shared<_MV>(_Al)) {} - explicit vector(size_type _N) : m_shptr(std::make_shared<_MV>(_N)) {} - explicit vector(size_type _N, const _Ty& _V, const _A& _Al = _A()) : m_shptr(std::make_shared<_MV>(_N, _V, _Al)) {} - vector(_Myt&& _X) : m_shptr(std::make_shared<_MV>(std::move(_X.msevector()))) {} - vector(const _Myt& _X) : m_shptr(std::make_shared<_MV>(_X.msevector())) {} - vector(_MV&& _X) : m_shptr(std::make_shared<_MV>(std::move(_X))) {} - vector(const _MV& _X) : m_shptr(std::make_shared<_MV>(_X)) {} - vector(std::vector<_Ty>&& _X) : m_shptr(std::make_shared<_MV>(std::move(_X))) {} - vector(const std::vector<_Ty>& _X) : m_shptr(std::make_shared<_MV>(_X)) {} - typedef typename _MV::const_iterator _It; - vector(_It _F, _It _L, const _A& _Al = _A()) : m_shptr(std::make_shared<_MV>(_F, _L, _Al)) {} - vector(const _Ty* _F, const _Ty* _L, const _A& _Al = _A()) : m_shptr(std::make_shared<_MV>(_F, _L, _Al)) {} - template::value, void>::type> - vector(_Iter _First, _Iter _Last) : m_shptr(std::make_shared<_MV>(_First, _Last)) {} - template::value, void>::type> - vector(_Iter _First, _Iter _Last, const _A& _Al) : m_shptr(std::make_shared<_MV>(_First, _Last, _Al)) {} - - _Myt& operator=(_MV&& _X) { m_shptr->operator=(std::move(_X)); return (*this); } - _Myt& operator=(const _MV& _X) { m_shptr->operator=(_X); return (*this); } - _Myt& operator=(_Myt&& _X) { m_shptr->operator=(std::move(_X.msevector())); return (*this); } - _Myt& operator=(const _Myt& _X) { m_shptr->operator=(_X.msevector()); return (*this); } - void reserve(size_type _Count) { m_shptr->reserve(_Count); } - void resize(size_type _N, const _Ty& _X = _Ty()) { m_shptr->resize(_N, _X); } - typename _MV::const_reference operator[](size_type _P) const { return m_shptr->operator[](_P); } - typename _MV::reference operator[](size_type _P) { return m_shptr->operator[](_P); } - void push_back(_Ty&& _X) { m_shptr->push_back(std::move(_X)); } - void push_back(const _Ty& _X) { m_shptr->push_back(_X); } - void pop_back() { m_shptr->pop_back(); } - void assign(_It _F, _It _L) { m_shptr->assign(_F, _L); } - void assign(size_type _N, const _Ty& _X = _Ty()) { m_shptr->assign(_N, _X); } - template - void emplace_back(_Valty&& ..._Val) { m_shptr->emplace_back(std::forward<_Valty>(_Val)...); } - void clear() { m_shptr->clear(); } - void swap(_MV& _X) { m_shptr->swap(_X); } - void swap(_Myt& _X) { m_shptr->swap(_X.msevector()); } - - vector(_XSTD initializer_list _Ilist, const _A& _Al = _A()) : m_shptr(std::make_shared<_MV>(_Ilist, _Al)) {} - _Myt& operator=(_XSTD initializer_list _Ilist) { m_shptr->operator=(_Ilist); return (*this); } - void assign(_XSTD initializer_list _Ilist) { m_shptr->assign(_Ilist); } - - size_type capacity() const _NOEXCEPT{ return m_shptr->capacity(); } - void shrink_to_fit() { m_shptr->shrink_to_fit(); } - size_type size() const _NOEXCEPT{ return m_shptr->size(); } - size_type max_size() const _NOEXCEPT{ return m_shptr->max_size(); } - bool empty() const _NOEXCEPT{ return m_shptr->empty(); } - _A get_allocator() const _NOEXCEPT{ return m_shptr->get_allocator(); } - typename _MV::const_reference at(size_type _Pos) const { return m_shptr->at(_Pos); } - typename _MV::reference at(size_type _Pos) { return m_shptr->at(_Pos); } - typename _MV::reference front() { return m_shptr->front(); } - typename _MV::const_reference front() const { return m_shptr->front(); } - typename _MV::reference back() { return m_shptr->back(); } - typename _MV::const_reference back() const { return m_shptr->back(); } - - /* Try to avoid using these whenever possible. */ - value_type *data() _NOEXCEPT { - return m_shptr->data(); - } - const value_type *data() const _NOEXCEPT { - return m_shptr->data(); - } - - - class const_iterator : public _MV::random_access_const_iterator_base { - public: - typedef typename _MV::ss_const_iterator_type::iterator_category iterator_category; - typedef typename _MV::ss_const_iterator_type::value_type value_type; - typedef typename _MV::ss_const_iterator_type::difference_type difference_type; - typedef typename _MV::difference_type distance_type; // retained - typedef typename _MV::ss_const_iterator_type::pointer pointer; - typedef typename _MV::ss_const_iterator_type::reference reference; - - const_iterator() {} - const_iterator(const const_iterator& src_cref) : m_msevector_cshptr(src_cref.m_msevector_cshptr) { - (*this) = src_cref; - } - ~const_iterator() {} - const typename _MV::ss_const_iterator_type& msevector_ss_const_iterator_type() const { return m_ss_const_iterator; } - typename _MV::ss_const_iterator_type& msevector_ss_const_iterator_type() { return m_ss_const_iterator; } - const typename _MV::ss_const_iterator_type& mvssci() const { return msevector_ss_const_iterator_type(); } - typename _MV::ss_const_iterator_type& mvssci() { return msevector_ss_const_iterator_type(); } - - void reset() { msevector_ss_const_iterator_type().reset(); } - bool points_to_an_item() const { return msevector_ss_const_iterator_type().points_to_an_item(); } - bool points_to_end_marker() const { return msevector_ss_const_iterator_type().points_to_end_marker(); } - bool points_to_beginning() const { return msevector_ss_const_iterator_type().points_to_beginning(); } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return msevector_ss_const_iterator_type().has_next_item_or_end_marker(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return msevector_ss_const_iterator_type().has_next(); } - bool has_previous() const { return msevector_ss_const_iterator_type().has_previous(); } - void set_to_beginning() { msevector_ss_const_iterator_type().set_to_beginning(); } - void set_to_end_marker() { msevector_ss_const_iterator_type().set_to_end_marker(); } - void set_to_next() { msevector_ss_const_iterator_type().set_to_next(); } - void set_to_previous() { msevector_ss_const_iterator_type().set_to_previous(); } - const_iterator& operator ++() { msevector_ss_const_iterator_type().operator ++(); return (*this); } - const_iterator operator++(int) { const_iterator _Tmp = *this; ++*this; return (_Tmp); } - const_iterator& operator --() { msevector_ss_const_iterator_type().operator --(); return (*this); } - const_iterator operator--(int) { const_iterator _Tmp = *this; --*this; return (_Tmp); } - void advance(typename _MV::difference_type n) { msevector_ss_const_iterator_type().advance(n); } - void regress(typename _MV::difference_type n) { msevector_ss_const_iterator_type().regress(n); } - const_iterator& operator +=(difference_type n) { msevector_ss_const_iterator_type().operator +=(n); return (*this); } - const_iterator& operator -=(difference_type n) { msevector_ss_const_iterator_type().operator -=(n); return (*this); } - const_iterator operator+(difference_type n) const { auto retval = (*this); retval += n; return retval; } - const_iterator operator-(difference_type n) const { return ((*this) + (-n)); } - typename _MV::difference_type operator-(const const_iterator& _Right_cref) const { return msevector_ss_const_iterator_type() - (_Right_cref.msevector_ss_const_iterator_type()); } - typename _MV::const_reference operator*() const { return msevector_ss_const_iterator_type().operator*(); } - typename _MV::const_reference item() const { return operator*(); } - typename _MV::const_reference previous_item() const { return msevector_ss_const_iterator_type().previous_item(); } - typename _MV::const_pointer operator->() const { return msevector_ss_const_iterator_type().operator->(); } - typename _MV::const_reference operator[](typename _MV::difference_type _Off) const { return (*(*this + _Off)); } - bool operator==(const const_iterator& _Right_cref) const { return msevector_ss_const_iterator_type().operator==(_Right_cref.msevector_ss_const_iterator_type()); } - bool operator!=(const const_iterator& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const const_iterator& _Right) const { return (msevector_ss_const_iterator_type() < _Right.msevector_ss_const_iterator_type()); } - bool operator<=(const const_iterator& _Right) const { return (msevector_ss_const_iterator_type() <= _Right.msevector_ss_const_iterator_type()); } - bool operator>(const const_iterator& _Right) const { return (msevector_ss_const_iterator_type() > _Right.msevector_ss_const_iterator_type()); } - bool operator>=(const const_iterator& _Right) const { return (msevector_ss_const_iterator_type() >= _Right.msevector_ss_const_iterator_type()); } - void set_to_const_item_pointer(const const_iterator& _Right_cref) { msevector_ss_const_iterator_type().set_to_const_item_pointer(_Right_cref.msevector_ss_const_iterator_type()); } - msev_size_t position() const { return msevector_ss_const_iterator_type().position(); } - private: - const_iterator(std::shared_ptr<_MV> msevector_shptr) : m_msevector_cshptr(msevector_shptr) { - m_ss_const_iterator = msevector_shptr->ss_cbegin(); - } - std::shared_ptr m_msevector_cshptr; - /* m_ss_const_iterator needs to be declared after m_msevector_cshptr so that it's destructor will be called first. */ - typename _MV::ss_const_iterator_type m_ss_const_iterator; - friend class /*_Myt*/vector<_Ty, _A>; - friend class iterator; - }; - class iterator : public _MV::random_access_iterator_base { - public: - typedef typename _MV::ss_iterator_type::iterator_category iterator_category; - typedef typename _MV::ss_iterator_type::value_type value_type; - typedef typename _MV::ss_iterator_type::difference_type difference_type; - typedef typename _MV::difference_type distance_type; // retained - typedef typename _MV::ss_iterator_type::pointer pointer; - typedef typename _MV::ss_iterator_type::reference reference; - - iterator() {} - iterator(const iterator& src_cref) : m_msevector_shptr(src_cref.m_msevector_shptr) { - (*this) = src_cref; - } - ~iterator() {} - const typename _MV::ss_iterator_type& msevector_ss_iterator_type() const { return m_ss_iterator; } - typename _MV::ss_iterator_type& msevector_ss_iterator_type() { return m_ss_iterator; } - const typename _MV::ss_iterator_type& mvssi() const { return msevector_ss_iterator_type(); } - typename _MV::ss_iterator_type& mvssi() { return msevector_ss_iterator_type(); } - operator const_iterator() const { - const_iterator retval(m_msevector_shptr); - if (m_msevector_shptr) { - retval.msevector_ss_const_iterator_type().set_to_beginning(); - retval.msevector_ss_const_iterator_type().advance(msev_int(msevector_ss_iterator_type().position())); - } - return retval; - } - - void reset() { msevector_ss_iterator_type().reset(); } - bool points_to_an_item() const { return msevector_ss_iterator_type().points_to_an_item(); } - bool points_to_end_marker() const { return msevector_ss_iterator_type().points_to_end_marker(); } - bool points_to_beginning() const { return msevector_ss_iterator_type().points_to_beginning(); } - /* has_next_item_or_end_marker() is just an alias for points_to_an_item(). */ - bool has_next_item_or_end_marker() const { return msevector_ss_iterator_type().has_next_item_or_end_marker(); } - /* has_next() is just an alias for points_to_an_item() that's familiar to java programmers. */ - bool has_next() const { return msevector_ss_iterator_type().has_next(); } - bool has_previous() const { return msevector_ss_iterator_type().has_previous(); } - void set_to_beginning() { msevector_ss_iterator_type().set_to_beginning(); } - void set_to_end_marker() { msevector_ss_iterator_type().set_to_end_marker(); } - void set_to_next() { msevector_ss_iterator_type().set_to_next(); } - void set_to_previous() { msevector_ss_iterator_type().set_to_previous(); } - iterator& operator ++() { msevector_ss_iterator_type().operator ++(); return (*this); } - iterator operator++(int) { iterator _Tmp = *this; ++*this; return (_Tmp); } - iterator& operator --() { msevector_ss_iterator_type().operator --(); return (*this); } - iterator operator--(int) { iterator _Tmp = *this; --*this; return (_Tmp); } - void advance(typename _MV::difference_type n) { msevector_ss_iterator_type().advance(n); } - void regress(typename _MV::difference_type n) { msevector_ss_iterator_type().regress(n); } - iterator& operator +=(difference_type n) { msevector_ss_iterator_type().operator +=(n); return (*this); } - iterator& operator -=(difference_type n) { msevector_ss_iterator_type().operator -=(n); return (*this); } - iterator operator+(difference_type n) const { auto retval = (*this); retval += n; return retval; } - iterator operator-(difference_type n) const { return ((*this) + (-n)); } - typename _MV::difference_type operator-(const iterator& _Right_cref) const { return msevector_ss_iterator_type() - (_Right_cref.msevector_ss_iterator_type()); } - typename _MV::reference operator*() const { return msevector_ss_iterator_type().operator*(); } - typename _MV::reference item() const { return operator*(); } - typename _MV::reference previous_item() const { return msevector_ss_iterator_type().previous_item(); } - typename _MV::pointer operator->() const { return msevector_ss_iterator_type().operator->(); } - typename _MV::reference operator[](typename _MV::difference_type _Off) const { return (*(*this + _Off)); } - bool operator==(const iterator& _Right_cref) const { return msevector_ss_iterator_type().operator==(_Right_cref.msevector_ss_iterator_type()); } - bool operator!=(const iterator& _Right_cref) const { return (!(_Right_cref == (*this))); } - bool operator<(const iterator& _Right) const { return (msevector_ss_iterator_type() < _Right.msevector_ss_iterator_type()); } - bool operator<=(const iterator& _Right) const { return (msevector_ss_iterator_type() <= _Right.msevector_ss_iterator_type()); } - bool operator>(const iterator& _Right) const { return (msevector_ss_iterator_type() > _Right.msevector_ss_iterator_type()); } - bool operator>=(const iterator& _Right) const { return (msevector_ss_iterator_type() >= _Right.msevector_ss_iterator_type()); } - void set_to_item_pointer(const iterator& _Right_cref) { msevector_ss_iterator_type().set_to_item_pointer(_Right_cref.msevector_ss_iterator_type()); } - msev_size_t position() const { return msevector_ss_iterator_type().position(); } - private: - std::shared_ptr<_MV> m_msevector_shptr; - /* m_ss_iterator needs to be declared after m_msevector_shptr so that it's destructor will be called first. */ - typename _MV::ss_iterator_type m_ss_iterator; - friend class /*_Myt*/vector<_Ty, _A>; - }; - - iterator begin() { // return iterator for beginning of mutable sequence - iterator retval; retval.m_msevector_shptr = this->m_shptr; - (retval.m_ss_iterator) = m_shptr->ss_begin(); - return retval; - } - const_iterator begin() const { // return iterator for beginning of nonmutable sequence - const_iterator retval; retval.m_msevector_cshptr = this->m_shptr; - (retval.m_ss_const_iterator) = m_shptr->ss_begin(); - return retval; - } - iterator end() { // return iterator for end of mutable sequence - iterator retval; retval.m_msevector_shptr = this->m_shptr; - (retval.m_ss_iterator) = m_shptr->ss_end(); - return retval; - } - const_iterator end() const { // return iterator for end of nonmutable sequence - const_iterator retval; retval.m_msevector_cshptr = this->m_shptr; - (retval.m_ss_const_iterator) = m_shptr->ss_end(); - return retval; - } - const_iterator cbegin() const { // return iterator for beginning of nonmutable sequence - const_iterator retval; retval.m_msevector_cshptr = this->m_shptr; - (retval.m_ss_const_iterator) = m_shptr->ss_cbegin(); - return retval; - } - const_iterator cend() const { // return iterator for end of nonmutable sequence - const_iterator retval; retval.m_msevector_cshptr = this->m_shptr; - (retval.m_ss_const_iterator) = m_shptr->ss_cend(); - return retval; - } - - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - reverse_iterator rbegin() { // return iterator for beginning of reversed mutable sequence - return (reverse_iterator(end())); - } - const_reverse_iterator rbegin() const { // return iterator for beginning of reversed nonmutable sequence - return (const_reverse_iterator(end())); - } - reverse_iterator rend() { // return iterator for end of reversed mutable sequence - return (reverse_iterator(begin())); - } - const_reverse_iterator rend() const { // return iterator for end of reversed nonmutable sequence - return (const_reverse_iterator(begin())); - } - const_reverse_iterator crbegin() const { // return iterator for beginning of reversed nonmutable sequence - return (rbegin()); - } - const_reverse_iterator crend() const { // return iterator for end of reversed nonmutable sequence - return (rend()); - } - - - vector(const const_iterator &start, const const_iterator &end, const _A& _Al = _A()) - : m_shptr(std::make_shared<_MV>(start.msevector_ss_const_iterator_type(), end.msevector_ss_const_iterator_type(), _Al)) {} - void assign(const const_iterator &start, const const_iterator &end) { - m_shptr->assign(start.msevector_ss_const_iterator_type(), end.msevector_ss_const_iterator_type()); - } - void assign_inclusive(const const_iterator &first, const const_iterator &last) { - m_shptr->assign_inclusive(first.msevector_ss_const_iterator_type(), last.msevector_ss_const_iterator_type()); - } - iterator insert_before(const const_iterator &pos, size_type _M, const _Ty& _X) { - auto res = m_shptr->insert_before(pos.msevector_ss_const_iterator_type(), _M, _X); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - iterator insert_before(const const_iterator &pos, _Ty&& _X) { - auto res = m_shptr->insert_before(pos.msevector_ss_const_iterator_type(), std::move(_X)); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - iterator insert_before(const const_iterator &pos, const _Ty& _X = _Ty()) { return insert_before(pos, 1, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - iterator insert_before(const const_iterator &pos, const _Iter &start, const _Iter &end) { - auto res = m_shptr->insert_before(pos.msevector_ss_const_iterator_type(), start, end); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - iterator insert_before_inclusive(const const_iterator &pos, const _Iter &first, const _Iter &last) { - auto end = last; end++; - return insert_before(pos, first, end); - } - iterator insert_before(const const_iterator &pos, _XSTD initializer_list _Ilist) { // insert initializer_list - auto res = m_shptr->insert_before(pos.msevector_ss_const_iterator_type(), _Ilist); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - void insert_before(msev_size_t pos, const _Ty& _X = _Ty()) { - m_shptr->insert_before(pos, _X); - } - void insert_before(msev_size_t pos, size_type _M, const _Ty& _X) { - m_shptr->insert_before(pos, _M, _X); - } - void insert_before(msev_size_t pos, _XSTD initializer_list _Ilist) { // insert initializer_list - m_shptr->insert_before(pos, _Ilist); - } - /* These insert() functions are just aliases for their corresponding insert_before() functions. */ - iterator insert(const const_iterator &pos, size_type _M, const _Ty& _X) { return insert_before(pos, _M, _X); } - iterator insert(const const_iterator &pos, _Ty&& _X) { return insert_before(pos, std::move(_X)); } - iterator insert(const const_iterator &pos, const _Ty& _X = _Ty()) { return insert_before(pos, _X); } - templatetypename std::enable_if<_mse_Is_iterator<_Iter>::value, typename base_class::iterator>::type - , class = _mse_RequireInputIter<_Iter> > - iterator insert(const const_iterator &pos, const _Iter &start, const _Iter &end) { return insert_before(pos, start, end); } - iterator insert(const const_iterator &pos, const _Ty* start, const _Ty* end) { return insert_before(pos, start, end); } - iterator insert(const const_iterator &pos, _XSTD initializer_list _Ilist) { return insert_before(pos, _Ilist); } - template - iterator emplace(const const_iterator &pos, _Valty&& ..._Val) { - auto res = m_shptr->emplace(pos.msevector_ss_const_iterator_type(), std::forward<_Valty>(_Val)...); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - iterator erase(const const_iterator &pos) { - auto res = m_shptr->erase(pos.msevector_ss_const_iterator_type()); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - iterator erase(const const_iterator &start, const const_iterator &end) { - auto res = m_shptr->erase(start.msevector_ss_const_iterator_type(), end.msevector_ss_const_iterator_type()); - iterator retval = begin(); retval.msevector_ss_iterator_type() = res; - return retval; - } - iterator erase_inclusive(const const_iterator &first, const const_iterator &last) { - auto end = last; end.set_to_next(); - return erase_inclusive(first, end); - } - bool operator==(const _Myt& _Right) const { // test for vector equality - return ((*(_Right.m_shptr)) == (*m_shptr)); - } - bool operator<(const _Myt& _Right) const { // test if _Left < _Right for vectors - return ((*m_shptr) < (*(_Right.m_shptr))); - } - - private: - std::shared_ptr<_MV> m_shptr; - }; - - template inline bool operator!=(const vector<_Ty, _Alloc>& _Left, - const vector<_Ty, _Alloc>& _Right) { // test for vector inequality - return (!(_Left == _Right)); - } - - template inline bool operator>(const vector<_Ty, _Alloc>& _Left, - const vector<_Ty, _Alloc>& _Right) { // test if _Left > _Right for vectors - return (_Right < _Left); - } - - template inline bool operator<=(const vector<_Ty, _Alloc>& _Left, - const vector<_Ty, _Alloc>& _Right) { // test if _Left <= _Right for vectors - return (!(_Right < _Left)); - } - - template inline bool operator>=(const vector<_Ty, _Alloc>& _Left, - const vector<_Ty, _Alloc>& _Right) { // test if _Left >= _Right for vectors - return (!(_Left < _Right)); - } -#endif /*MSE_MSTDVECTOR_DISABLED*/ - } -} -#endif /*ndef MSEMSTDVECTOR_H*/ diff --git a/src/debug/mse/mseprimitives.h b/src/debug/mse/mseprimitives.h deleted file mode 100644 index 951577834..000000000 --- a/src/debug/mse/mseprimitives.h +++ /dev/null @@ -1,872 +0,0 @@ - -// Copyright (c) 2015 Noah Lopez -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MSEPRIMITIVES_H -#define MSEPRIMITIVES_H - -#include -#include // ULONG_MAX -#include // std::numeric_limits -#include // primitives_range_error - -/*compiler specific defines*/ -#ifdef _MSC_VER -#if (1700 > _MSC_VER) -#define MSVC2010_COMPATIBLE 1 -#endif /*(1700 > _MSC_VER)*/ -#if (1900 > _MSC_VER) -#define MSVC2013_COMPATIBLE 1 -#endif /*(1900 > _MSC_VER)*/ -#if (2000 > _MSC_VER) -#define MSVC2015_COMPATIBLE 1 -#endif /*(1900 > _MSC_VER)*/ -#else /*_MSC_VER*/ -#if (defined(__GNUC__) || defined(__GNUG__)) -#define GPP_COMPATIBLE 1 -#if ((5 > __GNUC__) && (!defined(__clang__))) -#define GPP4P8_COMPATIBLE 1 -#endif /*((5 > __GNUC__) && (!defined(__clang__)))*/ -#endif /*(defined(__GNUC__) || defined(__GNUG__))*/ -#endif /*_MSC_VER*/ - -#ifdef MSE_SAFER_SUBSTITUTES_DISABLED -#define MSE_PRIMITIVES_DISABLED -#endif /*MSE_SAFER_SUBSTITUTES_DISABLED*/ - -#if defined(MSVC2013_COMPATIBLE) || defined(MSVC2010_COMPATIBLE) -#define MSE_CONSTEXPR -#else // defined(MSVC2013_COMPATIBLE) || defined(MSVC2010_COMPATIBLE) -#define MSE_CONSTEXPR constexpr -#endif // defined(MSVC2013_COMPATIBLE) || defined(MSVC2010_COMPATIBLE) - -#ifdef MSVC2015_COMPATIBLE -#ifndef MSE_FORCE_PRIMITIVE_ASSIGN_RANGE_CHECK_ENABLED -/* msvc2015's incomplete support for "constexpr" means that range checks that should be done at compile time would -be done at run time, at significant cost. So by default we disable range checks upon assignment. */ -#define MSE_PRIMITIVE_ASSIGN_RANGE_CHECK_DISABLED 1 -#endif // !MSE_FORCE_PRIMITIVE_ASSIGN_RANGE_CHECK_ENABLED -#endif // MSVC2015_COMPATIBLE - - -#ifdef MSE_CUSTOM_THROW_DEFINITION -#include -#define MSE_THROW(x) MSE_CUSTOM_THROW_DEFINITION(x) -#else // MSE_CUSTOM_THROW_DEFINITION -#define MSE_THROW(x) throw(x) -#endif // MSE_CUSTOM_THROW_DEFINITION - - -#ifndef MSE_CINT_BASE_INTEGER_TYPE -#if SIZE_MAX <= ULONG_MAX -#define MSE_CINT_BASE_INTEGER_TYPE long int -#else // SIZE_MAX <= ULONG_MAX -#define MSE_CINT_BASE_INTEGER_TYPE long long int -#endif // SIZE_MAX <= ULONG_MAX -#endif // !MSE_CINT_BASE_INTEGER_TYPE - - -namespace mse { - - class primitives_range_error : public std::range_error { - public: - using std::range_error::range_error; - }; - - /* When the mse primitive replacements are "disabled" they lose their default initialization and may cause problems for - code that relies on it. */ -#ifdef MSE_PRIMITIVES_DISABLED - typedef bool CBool; - typedef MSE_CINT_BASE_INTEGER_TYPE CInt; - typedef size_t CSize_t; - static size_t as_a_size_t(CSize_t n) { return (n); } -#else /*MSE_PRIMITIVES_DISABLED*/ - -#ifndef NDEBUG -#ifndef MSE_SUPPRESS_CHECK_USE_BEFORE_SET -#define MSE_CHECK_USE_BEFORE_SET -#endif // !MSE_SUPPRESS_CHECK_USE_BEFORE_SET -#endif // !NDEBUG - - /* This class is just meant to act like the "bool" type, except that it has a default intialization value (false). */ - class CBool { - public: - // Constructs zero. - CBool() : m_val(false) {} - - // Copy constructor - CBool(const CBool &x) : m_val(x.m_val) { note_value_assignment(); }; - - // Assignment operator - CBool& operator=(const CBool &x) { note_value_assignment(); m_val = x.m_val; return (*this); } - - // Constructors from primitive boolean types - CBool(bool x) { note_value_assignment(); m_val = x; } - - // Casts to primitive boolean types - operator bool() const { assert_initialized(); return m_val; } - - CBool& operator |=(const CBool &x) { assert_initialized(); m_val |= x.m_val; return (*this); } - CBool& operator &=(const CBool &x) { assert_initialized(); m_val &= x.m_val; return (*this); } - CBool& operator ^=(const CBool &x) { assert_initialized(); m_val ^= x.m_val; return (*this); } - - bool m_val; - -#ifdef MSE_CHECK_USE_BEFORE_SET - void note_value_assignment() { m_initialized = true; } - void assert_initialized() const { assert(m_initialized); } - bool m_initialized = false; -#else // MSE_CHECK_USE_BEFORE_SET - void note_value_assignment() {} - void assert_initialized() const {} -#endif // MSE_CHECK_USE_BEFORE_SET - }; - - - template - MSE_CONSTEXPR static bool sg_can_exceed_upper_bound() { - return ( - ((std::numeric_limits<_TSource>::is_signed == std::numeric_limits<_TDestination>::is_signed) - && (std::numeric_limits<_TSource>::digits > std::numeric_limits<_TDestination>::digits)) - || ((std::numeric_limits<_TSource>::is_signed != std::numeric_limits<_TDestination>::is_signed) - && ((std::numeric_limits<_TSource>::is_signed && (std::numeric_limits<_TSource>::digits > (1 + std::numeric_limits<_TDestination>::digits))) - || ((!std::numeric_limits<_TSource>::is_signed) && ((1 + std::numeric_limits<_TSource>::digits) > std::numeric_limits<_TDestination>::digits)) - ) - ) - ); - } - template - MSE_CONSTEXPR static bool sg_can_exceed_lower_bound() { - return ( - (std::numeric_limits<_TSource>::is_signed && (!std::numeric_limits<_TDestination>::is_signed)) - || (std::numeric_limits<_TSource>::is_signed && (std::numeric_limits<_TSource>::digits > std::numeric_limits<_TDestination>::digits)) - ); - } - - template - void g_assign_check_range(const _TSource &x) { -#ifndef MSE_PRIMITIVE_ASSIGN_RANGE_CHECK_DISABLED - /* This probably needs to be cleaned up. But at the moment this should be mostly compile time complexity. And - as is it avoids "signed/unsigned" mismatch warnings. */ - MSE_CONSTEXPR const bool rhs_can_exceed_upper_bound = sg_can_exceed_upper_bound<_TDestination, _TSource>(); - MSE_CONSTEXPR const bool rhs_can_exceed_lower_bound = sg_can_exceed_lower_bound<_TDestination, _TSource>(); - MSE_CONSTEXPR const bool can_exceed_bounds = rhs_can_exceed_upper_bound || rhs_can_exceed_lower_bound; - if (can_exceed_bounds) { - if (rhs_can_exceed_upper_bound) { - if (x > _TSource(std::numeric_limits<_TDestination>::max())) { - MSE_THROW(primitives_range_error("range error - value to be assigned is out of range of the target (integer) type")); - } - } - if (rhs_can_exceed_lower_bound) { - /* We're assuming that std::numeric_limits<>::lowest() will never be greater than zero. */ - if (0 > x) { - if (0 == std::numeric_limits<_TDestination>::lowest()) { - MSE_THROW(primitives_range_error("range error - value to be assigned is out of range of the target (integer) type")); - } - else if (x < _TSource(std::numeric_limits<_TDestination>::lowest())) { - MSE_THROW(primitives_range_error("range error - value to be assigned is out of range of the target (integer) type")); - } - } - } - } -#endif // !MSE_PRIMITIVE_ASSIGN_RANGE_CHECK_DISABLED - } - - /* The CInt and CSize_t classes are meant to substitute for standard "int" and "size_t" types. The differences between - the standard types and these classes are that the classes have a default intialization value (zero), and the - classes, as much as possible, try to prevent the problematic behaviour of (possibly negative) signed integers - being cast (inadvertently) to the unsigned size_t type. For example, the expression (0 > (int)5 - (size_t)7) evaluates - (unintuitively) to false, whereas the expression (0 > (CInt)5 - (CSize_t)7) evaluates to true. Also, the classes do - some range checking. For example, the code "CSize_t s = -2;" will throw an exception. */ - template - class TIntBase1 { - public: - // Constructs zero. - TIntBase1() : m_val(0) {} - - // Copy constructor - TIntBase1(const TIntBase1 &x) : m_val(x.m_val) { note_value_assignment(); }; - - // Constructors from primitive integer types - explicit TIntBase1(_Ty x) { note_value_assignment(); m_val = x; } - - template - void assign_check_range(const _Tz &x) { - note_value_assignment(); - g_assign_check_range<_Ty, _Tz>(x); - } - - _Ty m_val; - -#ifdef MSE_CHECK_USE_BEFORE_SET - void note_value_assignment() { m_initialized = true; } - void assert_initialized() const { assert(m_initialized); } - bool m_initialized = false; -#else // MSE_CHECK_USE_BEFORE_SET - void note_value_assignment() {} - void assert_initialized() const {} -#endif // MSE_CHECK_USE_BEFORE_SET - }; - - class CInt : public TIntBase1 { - public: - typedef MSE_CINT_BASE_INTEGER_TYPE _Ty; - typedef TIntBase1<_Ty> _Myt; - - // Constructs zero. - CInt() : _Myt() {} - - // Copy constructor - CInt(const CInt &x) : _Myt(x) {}; - CInt(const _Myt &x) : _Myt(x) {}; - - // Assignment operator - CInt& operator=(const CInt &x) { (*this).note_value_assignment(); m_val = x.m_val; return (*this); } - //CInt& operator=(const _Ty &x) { (*this).note_value_assignment(); m_val = x; return (*this); } - - CInt& operator=(long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CInt& operator=(long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CInt& operator=(int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CInt& operator=(short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CInt& operator=(char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CInt& operator=(size_t x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CInt& operator=(CSize_t x) { assign_check_range(x.as_a_size_t()); m_val = x.as_a_size_t(); return (*this); } - /* We would have liked to have assignment operators for the unsigned primitive integer types, but one of them could - potentially clash with the size_t assignment operator. */ - //CInt& operator=(unsigned long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CInt& operator=(unsigned long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CInt& operator=(unsigned int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CInt& operator=(unsigned short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CInt& operator=(unsigned char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - - // Constructors from primitive integer types - //CInt(_Ty x) { m_val = x; } - CInt(long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - CInt(long x) { assign_check_range< long>(x); m_val = static_cast<_Ty>(x); } - CInt(int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - CInt(short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - CInt(char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - CInt(size_t x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //CInt(CSize_t x) { assign_check_range(x.as_a_size_t()); m_val = x.as_a_size_t(); } - /* We would have liked to have constructors for the unsigned primitive integer types, but one of them could - potentially clash with the size_t constructor. */ - //CInt(unsigned long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //CInt(unsigned long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //CInt(unsigned int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //CInt(unsigned short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //CInt(unsigned char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - - // Casts to primitive integer types - operator _Ty() const { (*this).assert_initialized(); return m_val; } - - CInt operator ~() const { (*this).assert_initialized(); return CInt(~m_val); } - CInt& operator |=(const CInt &x) { (*this).assert_initialized(); m_val |= x.m_val; return (*this); } - CInt& operator &=(const CInt &x) { (*this).assert_initialized(); m_val &= x.m_val; return (*this); } - CInt& operator ^=(const CInt &x) { (*this).assert_initialized(); m_val ^= x.m_val; return (*this); } - - CInt operator -() const { (*this).assert_initialized(); return CInt(-m_val); } - CInt& operator +=(const CInt &x) { (*this).assert_initialized(); m_val += x.m_val; return (*this); } - CInt& operator -=(const CInt &x) { (*this).assert_initialized(); m_val -= x.m_val; return (*this); } - CInt& operator *=(const CInt &x) { (*this).assert_initialized(); m_val *= x.m_val; return (*this); } - CInt& operator /=(const CInt &x) { (*this).assert_initialized(); m_val /= x.m_val; return (*this); } - CInt& operator %=(const CInt &x) { (*this).assert_initialized(); m_val %= x.m_val; return (*this); } - CInt& operator >>=(const CInt &x) { (*this).assert_initialized(); m_val >>= x.m_val; return (*this); } - CInt& operator <<=(const CInt &x) { (*this).assert_initialized(); m_val <<= x.m_val; return (*this); } - - CInt operator +(const CInt &x) const { (*this).assert_initialized(); return CInt(m_val + x.m_val); } - CInt operator +(long long x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(long x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(int x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(short x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(char x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(size_t x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - //CInt operator +(CSize_t x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - - CInt operator -(const CInt &x) const { (*this).assert_initialized(); return CInt(m_val - x.m_val); } - CInt operator -(long long x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(long x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(int x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(short x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(char x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(size_t x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - //CInt operator -(CSize_t x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - - CInt operator *(const CInt &x) const { (*this).assert_initialized(); return CInt(m_val * x.m_val); } - CInt operator *(long long x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(long x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(int x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(short x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(char x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(size_t x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - //CInt operator *(CSize_t x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - - CInt operator /(const CInt &x) const { (*this).assert_initialized(); return CInt(m_val / x.m_val); } - CInt operator /(long long x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(long x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(int x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(short x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(char x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(size_t x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - //CInt operator /(CSize_t x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - - bool operator <(const CInt &x) const { (*this).assert_initialized(); return (m_val < x.m_val); } - bool operator <(long long x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(long x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(int x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(short x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(char x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(size_t x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - //bool operator <(CSize_t x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - - bool operator >(const CInt &x) const { (*this).assert_initialized(); return (m_val > x.m_val); } - bool operator >(long long x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(long x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(int x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(short x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(char x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(size_t x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - //bool operator >(CSize_t x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - - bool operator <=(const CInt &x) const { (*this).assert_initialized(); return (m_val <= x.m_val); } - bool operator <=(long long x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(long x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(int x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(short x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(char x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(size_t x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - //bool operator <=(CSize_t x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - - bool operator >=(const CInt &x) const { (*this).assert_initialized(); return (m_val >= x.m_val); } - bool operator >=(long long x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(long x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(int x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(short x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(char x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(size_t x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - //bool operator >=(CSize_t x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - - bool operator ==(const CInt &x) const { (*this).assert_initialized(); return (m_val == x.m_val); } - bool operator ==(long long x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(long x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(int x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(short x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(char x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(size_t x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - //bool operator ==(CSize_t x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - - bool operator !=(const CInt &x) const { (*this).assert_initialized(); return (m_val != x.m_val); } - bool operator !=(long long x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(long x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(int x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(short x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(char x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(size_t x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - //bool operator !=(CSize_t x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - - // INCREMENT/DECREMENT OPERATORS - CInt& operator ++() { (*this).assert_initialized(); m_val++; return (*this); } - CInt operator ++(int) { - (*this).assert_initialized(); - CInt tmp(*this); // copy - operator++(); // pre-increment - return tmp; // return old value - } - CInt& operator --() { - (*this).assert_initialized(); - if (0 <= std::numeric_limits<_Ty>::lowest()) { - (*this).assert_initialized(); - (*this) = (*this) - 1; return (*this); - } - else { - (*this).assert_initialized(); - m_val--; return (*this); - } - } - CInt operator --(int) { - (*this).assert_initialized(); - CInt tmp(*this); // copy - operator--(); // pre-decrement - return tmp; // return old value - } - - //_Ty m_val; - }; -} - -namespace std { -#ifndef _THROW0 -#define _THROW0() -#endif // !_THROW0 -#ifndef _STCONS -#define _STCONS(ty, name, val) static constexpr ty name = static_cast(val) -#endif // !_STCONS - - template<> class numeric_limits { // limits for type int - public: - typedef MSE_CINT_BASE_INTEGER_TYPE _Ty; - - static constexpr _Ty(min)() _THROW0() - { // return minimum value - return numeric_limits::min(); - } - static constexpr _Ty(max)() _THROW0() - { // return maximum value - return numeric_limits::max(); - } - static constexpr _Ty lowest() _THROW0() - { // return most negative value - return numeric_limits::lowest(); - } - static constexpr _Ty epsilon() _THROW0() - { // return smallest effective increment from 1.0 - return numeric_limits::epsilon(); - } - static constexpr _Ty round_error() _THROW0() - { // return largest rounding error - return numeric_limits::round_error(); - } - static constexpr _Ty denorm_min() _THROW0() - { // return minimum denormalized value - return numeric_limits::denorm_min(); - } - static constexpr _Ty infinity() _THROW0() - { // return positive infinity - return numeric_limits::infinity(); - } - static constexpr _Ty quiet_NaN() _THROW0() - { // return non-signaling NaN - return numeric_limits::quiet_NaN(); - } - static constexpr _Ty signaling_NaN() _THROW0() - { // return signaling NaN - return numeric_limits::signaling_NaN(); - } - _STCONS(float_denorm_style, has_denorm, numeric_limits::has_denorm); - _STCONS(bool, has_denorm_loss, numeric_limits::has_denorm_loss); - _STCONS(bool, has_infinity, numeric_limits::has_infinity); - _STCONS(bool, has_quiet_NaN, numeric_limits::has_quiet_NaN); - _STCONS(bool, has_signaling_NaN, numeric_limits::has_signaling_NaN); - _STCONS(bool, is_bounded, numeric_limits::is_bounded); - _STCONS(bool, is_exact, numeric_limits::is_exact); - _STCONS(bool, is_iec559, numeric_limits::is_iec559); - _STCONS(bool, is_integer, numeric_limits::is_integer); - _STCONS(bool, is_modulo, numeric_limits::is_modulo); - _STCONS(bool, is_signed, numeric_limits::is_signed); - _STCONS(bool, is_specialized, numeric_limits::is_specialized); - _STCONS(bool, tinyness_before, numeric_limits::tinyness_before); - _STCONS(bool, traps, numeric_limits::traps); - _STCONS(float_round_style, round_style, numeric_limits::round_style); - _STCONS(int, digits, numeric_limits::digits); - _STCONS(int, digits10, numeric_limits::digits10); - _STCONS(int, max_digits10, numeric_limits::max_digits10); - _STCONS(int, max_exponent, numeric_limits::max_exponent); - _STCONS(int, max_exponent10, numeric_limits::max_exponent10); - _STCONS(int, min_exponent, numeric_limits::min_exponent); - _STCONS(int, min_exponent10, numeric_limits::min_exponent10); - _STCONS(int, radix, numeric_limits::radix); - }; -} - -namespace mse { - class CSize_t; - static size_t as_a_size_t(CSize_t n); - - /* Note that CSize_t does not have a default conversion to size_t. This is by design. Use the as_a_size_t() member - function to get a size_t when necessary. */ - class CSize_t : public TIntBase1 { - public: - typedef size_t _Ty; - typedef int _T_signed_primitive_integer_type; - typedef TIntBase1<_Ty> _Myt; - - // Constructs zero. - CSize_t() : _Myt() {} - - // Copy constructor - CSize_t(const CSize_t &x) : _Myt(x) {}; - CSize_t(const _Myt &x) : _Myt(x) {}; - - // Assignment operator - CSize_t& operator=(const CSize_t &x) { m_val = x.m_val; return (*this); } - //CSize_t& operator=(const _Ty &x) { m_val = x; return (*this); } - - CSize_t& operator=(long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(size_t x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - CSize_t& operator=(CInt x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - /* We would have liked to have assignment operators for the unsigned primitive integer types, but one of them could - potentially clash with the size_t assignment operator. */ - //CSize_t& operator=(unsigned long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CSize_t& operator=(unsigned long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CSize_t& operator=(unsigned int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CSize_t& operator=(unsigned short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - //CSize_t& operator=(unsigned char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); return (*this); } - - // Constructors from primitive integer types - //explicit CSize_t(_Ty x) { m_val = x; } - explicit CSize_t(long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - explicit CSize_t(long x) { assign_check_range< long>(x); m_val = static_cast<_Ty>(x); } - explicit CSize_t(int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - explicit CSize_t(short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - explicit CSize_t(char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - CSize_t(size_t x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - /*explicit */CSize_t(CInt x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - /* We would have liked to have constructors for the unsigned primitive integer types, but one of them could - potentially clash with the size_t constructor. */ - //explicit CSize_t(unsigned long long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //explicit CSize_t(unsigned long x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //explicit CSize_t(unsigned int x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //explicit CSize_t(unsigned short x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - //explicit CSize_t(unsigned char x) { assign_check_range(x); m_val = static_cast<_Ty>(x); } - - // Casts to primitive integer types - operator CInt() const { (*this).assert_initialized(); return CInt(m_val); } -#ifndef MSVC2010_COMPATIBLE - explicit operator size_t() const { (*this).assert_initialized(); return (m_val); } -#endif /*MSVC2010_COMPATIBLE*/ - //size_t as_a_size_t() const { (*this).assert_initialized(); return m_val; } - - CSize_t operator ~() const { (*this).assert_initialized(); return (~m_val); } - CSize_t& operator |=(const CSize_t &x) { (*this).assert_initialized(); m_val |= x.m_val; return (*this); } - CSize_t& operator &=(const CSize_t &x) { (*this).assert_initialized(); m_val &= x.m_val; return (*this); } - CSize_t& operator ^=(const CSize_t &x) { (*this).assert_initialized(); m_val ^= x.m_val; return (*this); } - - CInt operator -() const { (*this).assert_initialized(); /* Should unsigned types even support this opperator? */ - return (-(CInt(m_val))); - } - CSize_t& operator +=(const CSize_t &x) { (*this).assert_initialized(); m_val += x.m_val; return (*this); } - CSize_t& operator -=(const CSize_t &x) { - (*this).assert_initialized(); - //assert(0 <= std::numeric_limits<_Ty>::lowest()); - if (x.m_val > m_val) { - MSE_THROW(primitives_range_error("range error - value to be assigned is out of range of the target (integer) type")); - } - m_val -= x.m_val; return (*this); - } - CSize_t& operator *=(const CSize_t &x) { (*this).assert_initialized(); m_val *= x.m_val; return (*this); } - CSize_t& operator /=(const CSize_t &x) { (*this).assert_initialized(); m_val /= x.m_val; return (*this); } - CSize_t& operator %=(const CSize_t &x) { (*this).assert_initialized(); m_val %= x.m_val; return (*this); } - CSize_t& operator >>=(const CSize_t &x) { (*this).assert_initialized(); m_val >>= x.m_val; return (*this); } - CSize_t& operator <<=(const CSize_t &x) { (*this).assert_initialized(); m_val <<= x.m_val; return (*this); } - - CSize_t operator +(const CSize_t &x) const { (*this).assert_initialized(); return (m_val + x.m_val); } - CInt operator +(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) + x); } - CInt operator +(long long x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(long x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(int x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(short x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CInt operator +(char x) const { (*this).assert_initialized(); return ((*this) + CInt(x)); } - CSize_t operator +(size_t x) const { (*this).assert_initialized(); return ((*this) + CSize_t(x)); } - - CInt operator -(const CSize_t &x) const { (*this).assert_initialized(); return (CInt(m_val) - CInt(x.m_val)); } - CInt operator -(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) - x); } - CInt operator -(long long x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(long x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(int x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(short x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(char x) const { (*this).assert_initialized(); return ((*this) - CInt(x)); } - CInt operator -(size_t x) const { (*this).assert_initialized(); return ((*this) - CSize_t(x)); } - - CSize_t operator *(const CSize_t &x) const { (*this).assert_initialized(); return (m_val * x.m_val); } - CInt operator *(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) * x); } - CInt operator *(long long x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(long x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(int x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(short x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CInt operator *(char x) const { (*this).assert_initialized(); return ((*this) * CInt(x)); } - CSize_t operator *(size_t x) const { (*this).assert_initialized(); return ((*this) * CSize_t(x)); } - - CSize_t operator /(const CSize_t &x) const { (*this).assert_initialized(); return (m_val / x.m_val); } - CInt operator /(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) / x); } - CInt operator /(long long x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(long x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(int x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(short x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CInt operator /(char x) const { (*this).assert_initialized(); return ((*this) / CInt(x)); } - CSize_t operator /(size_t x) const { (*this).assert_initialized(); return ((*this) / CSize_t(x)); } - - bool operator <(const CSize_t &x) const { (*this).assert_initialized(); return (m_val < x.m_val); } - bool operator <(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) < x); } - bool operator <(long long x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(long x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(int x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(short x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(char x) const { (*this).assert_initialized(); return ((*this) < CInt(x)); } - bool operator <(size_t x) const { (*this).assert_initialized(); return ((*this) < CSize_t(x)); } - - bool operator >(const CSize_t &x) const { (*this).assert_initialized(); return (m_val > x.m_val); } - bool operator >(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) > x); } - bool operator >(long long x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(long x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(int x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(short x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(char x) const { (*this).assert_initialized(); return ((*this) > CInt(x)); } - bool operator >(size_t x) const { (*this).assert_initialized(); return ((*this) > CSize_t(x)); } - - bool operator <=(const CSize_t &x) const { (*this).assert_initialized(); return (m_val <= x.m_val); } - bool operator <=(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) <= x); } - bool operator <=(long long x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(long x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(int x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(short x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(char x) const { (*this).assert_initialized(); return ((*this) <= CInt(x)); } - bool operator <=(size_t x) const { (*this).assert_initialized(); return ((*this) <= CSize_t(x)); } - - bool operator >=(const CSize_t &x) const { (*this).assert_initialized(); return (m_val >= x.m_val); } - bool operator >=(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) >= x); } - bool operator >=(long long x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(long x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(int x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(short x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(char x) const { (*this).assert_initialized(); return ((*this) >= CInt(x)); } - bool operator >=(size_t x) const { (*this).assert_initialized(); return ((*this) >= CSize_t(x)); } - - bool operator ==(const CSize_t &x) const { (*this).assert_initialized(); return (m_val == x.m_val); } - bool operator ==(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) == x); } - bool operator ==(long long x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(long x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(int x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(short x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(char x) const { (*this).assert_initialized(); return ((*this) == CInt(x)); } - bool operator ==(size_t x) const { (*this).assert_initialized(); return ((*this) == CSize_t(x)); } - - bool operator !=(const CSize_t &x) const { (*this).assert_initialized(); return (m_val != x.m_val); } - bool operator !=(const CInt &x) const { (*this).assert_initialized(); return (CInt(m_val) != x); } - bool operator !=(long long x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(long x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(int x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(short x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(char x) const { (*this).assert_initialized(); return ((*this) != CInt(x)); } - bool operator !=(size_t x) const { (*this).assert_initialized(); return ((*this) != CSize_t(x)); } - - // INCREMENT/DECREMENT OPERATORS - CSize_t& operator ++() { (*this).assert_initialized(); m_val++; return (*this); } - CSize_t operator ++(int) { (*this).assert_initialized(); - CSize_t tmp(*this); // copy - operator++(); // pre-increment - return tmp; // return old value - } - CSize_t& operator --() { (*this).assert_initialized(); - if (0 <= std::numeric_limits<_Ty>::lowest()) { (*this).assert_initialized(); - (*this) = (*this) - 1; return (*this); - } - else { (*this).assert_initialized(); - m_val--; return (*this); - } - } - CSize_t operator --(int) { (*this).assert_initialized(); - CSize_t tmp(*this); // copy - operator--(); // pre-decrement - return tmp; // return old value - } - - //_Ty m_val; - - friend size_t as_a_size_t(CSize_t n); - }; - size_t as_a_size_t(CSize_t n) { n.assert_initialized(); return n.m_val; } -} - -namespace std { -#ifndef _THROW0 -#define _THROW0() -#endif // !_THROW0 -#ifndef _STCONS -#define _STCONS(ty, name, val) static constexpr ty name = (ty)(val) -#endif // !_STCONS - - template<> class numeric_limits { // limits for type int - public: - typedef size_t _Ty; - - static constexpr _Ty(min)() _THROW0() - { // return minimum value - return numeric_limits::min(); - } - static constexpr _Ty(max)() _THROW0() - { // return maximum value - return numeric_limits::max(); - } - static constexpr _Ty lowest() _THROW0() - { // return most negative value - return numeric_limits::lowest(); - } - static constexpr _Ty epsilon() _THROW0() - { // return smallest effective increment from 1.0 - return numeric_limits::epsilon(); - } - static constexpr _Ty round_error() _THROW0() - { // return largest rounding error - return numeric_limits::round_error(); - } - static constexpr _Ty denorm_min() _THROW0() - { // return minimum denormalized value - return numeric_limits::denorm_min(); - } - static constexpr _Ty infinity() _THROW0() - { // return positive infinity - return numeric_limits::infinity(); - } - static constexpr _Ty quiet_NaN() _THROW0() - { // return non-signaling NaN - return numeric_limits::quiet_NaN(); - } - static constexpr _Ty signaling_NaN() _THROW0() - { // return signaling NaN - return numeric_limits::signaling_NaN(); - } - _STCONS(float_denorm_style, has_denorm, numeric_limits::has_denorm); - _STCONS(bool, has_denorm_loss, numeric_limits::has_denorm_loss); - _STCONS(bool, has_infinity, numeric_limits::has_infinity); - _STCONS(bool, has_quiet_NaN, numeric_limits::has_quiet_NaN); - _STCONS(bool, has_signaling_NaN, numeric_limits::has_signaling_NaN); - _STCONS(bool, is_bounded, numeric_limits::is_bounded); - _STCONS(bool, is_exact, numeric_limits::is_exact); - _STCONS(bool, is_iec559, numeric_limits::is_iec559); - _STCONS(bool, is_integer, numeric_limits::is_integer); - _STCONS(bool, is_modulo, numeric_limits::is_modulo); - _STCONS(bool, is_signed, numeric_limits::is_signed); - _STCONS(bool, is_specialized, numeric_limits::is_specialized); - _STCONS(bool, tinyness_before, numeric_limits::tinyness_before); - _STCONS(bool, traps, numeric_limits::traps); - _STCONS(float_round_style, round_style, numeric_limits::round_style); - _STCONS(int, digits, numeric_limits::digits); - _STCONS(int, digits10, numeric_limits::digits10); - _STCONS(int, max_digits10, numeric_limits::max_digits10); - _STCONS(int, max_exponent, numeric_limits::max_exponent); - _STCONS(int, max_exponent10, numeric_limits::max_exponent10); - _STCONS(int, min_exponent, numeric_limits::min_exponent); - _STCONS(int, min_exponent10, numeric_limits::min_exponent10); - _STCONS(int, radix, numeric_limits::radix); - }; -} - -namespace mse { - - inline CInt operator+(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); rhs.assert_initialized(); return CSize_t(lhs) + rhs; } - inline CSize_t operator+(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) + rhs; } - inline CInt operator+(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) + rhs; } - inline CInt operator+(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) + as_a_size_t(rhs); } - inline CInt operator+(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs + as_a_size_t(rhs); } - inline CInt operator-(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) - rhs; } - inline CInt operator-(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) - rhs; } - inline CInt operator-(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) - rhs; } - inline CInt operator-(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) - as_a_size_t(rhs); } - inline CInt operator-(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs - as_a_size_t(rhs); } - inline CInt operator*(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) * rhs; } - inline CSize_t operator*(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) * rhs; } - inline CInt operator*(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) * rhs; } - inline CInt operator*(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) * as_a_size_t(rhs); } - inline CInt operator*(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs * as_a_size_t(rhs); } - inline CInt operator/(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) / rhs; } - inline CSize_t operator/(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) / rhs; } - inline CInt operator/(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) / rhs; } - inline CInt operator/(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) / as_a_size_t(rhs); } - inline CInt operator/(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs / as_a_size_t(rhs); } - - inline bool operator<(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) < rhs; } - inline bool operator<(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) < rhs; } - inline bool operator<(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) < rhs; } - inline bool operator<(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) < as_a_size_t(rhs); } - inline bool operator<(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) < rhs; } - inline bool operator<(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) < as_a_size_t(rhs); } - inline bool operator<(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs < as_a_size_t(rhs); } - inline bool operator>(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) > rhs; } - inline bool operator>(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) > rhs; } - inline bool operator>(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) > rhs; } - inline bool operator>(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) > as_a_size_t(rhs); } - inline bool operator>(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) > rhs; } - inline bool operator>(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) > as_a_size_t(rhs); } - inline bool operator>(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs > as_a_size_t(rhs); } - inline bool operator<=(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) <= rhs; } - inline bool operator<=(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) <= rhs; } - inline bool operator<=(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) <= rhs; } - inline bool operator<=(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) <= as_a_size_t(rhs); } - inline bool operator<=(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) <= rhs; } - inline bool operator<=(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) <= as_a_size_t(rhs); } - inline bool operator<=(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs <= as_a_size_t(rhs); } - inline bool operator>=(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) >= rhs; } - inline bool operator>=(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) >= rhs; } - inline bool operator>=(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) >= rhs; } - inline bool operator>=(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) >= as_a_size_t(rhs); } - inline bool operator>=(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) >= rhs; } - inline bool operator>=(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) >= as_a_size_t(rhs); } - inline bool operator>=(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs >= as_a_size_t(rhs); } - inline bool operator==(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) == rhs; } - inline bool operator==(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) == rhs; } - inline bool operator==(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) == rhs; } - inline bool operator==(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) == as_a_size_t(rhs); } - inline bool operator==(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) == rhs; } - inline bool operator==(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) == as_a_size_t(rhs); } - inline bool operator==(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs == as_a_size_t(rhs); } - inline bool operator!=(size_t lhs, const CInt &rhs) { rhs.assert_initialized(); return CSize_t(lhs) != rhs; } - inline bool operator!=(size_t lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CSize_t(lhs) != rhs; } - inline bool operator!=(int lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) != rhs; } - inline bool operator!=(int lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) != as_a_size_t(rhs); } - inline bool operator!=(long long lhs, const CInt &rhs) { rhs.assert_initialized(); return CInt(lhs) != rhs; } - inline bool operator!=(long long lhs, const CSize_t &rhs) { rhs.assert_initialized(); return CInt(lhs) != as_a_size_t(rhs); } - inline bool operator!=(const CInt &lhs, const CSize_t &rhs) { rhs.assert_initialized(); return lhs != as_a_size_t(rhs); } -#endif /*MSE_PRIMITIVES_DISABLED*/ - - static void s_type_test1() { -#ifdef MSE_SELF_TESTS - CInt i1(3); - CInt i2 = 5; - CInt i3; - i3 = 7; - CInt i4 = i1 + i2; - i4 = i1 + 17; - i4 = 19 + i1; - i4 += i2; - i4 -= 23; - i4++; - CBool b1 = (i1 < i2); - b1 = (i1 < 17); - b1 = (19 < i1); - b1 = (i1 == i2); - b1 = (i1 == 17); - b1 = (19 == i1); - - CSize_t szt1(3); - CSize_t szt2 = 5; - CSize_t szt3; - szt3 = 7; - CSize_t szt4 = szt1 + szt2; - szt4 = szt1 + 17; - szt4 = 19 + szt1; - CInt i11 = 19 + szt1; - szt4 += szt2; - szt4 -= 23; - szt4++; -#ifndef MSVC2010_COMPATIBLE - size_t szt5 = size_t(szt4); -#endif /*MSVC2010_COMPATIBLE*/ - bool b3 = (szt1 < szt2); - b3 = (szt1 < 17); - b3 = (19 < szt1); - CBool b2 = (19 < szt1); - b3 = (szt1 == szt2); - b3 = (szt1 == 17); - b3 = (19 == szt1); - CBool b4 = (b1 < b2); - b4 = (b1 == b2); - b4 = (b1 > b3); - b4 = (b3 >= b1); - b4 = (b3 == b1); - b4 = (b1 && b2); - b4 = (b1 || b3); - b4 = (b3 && b1); - b4 |= b1; - b4 &= b3; -#endif // MSE_SELF_TESTS - } -} - -#undef MSE_THROW - -#endif /*ndef MSEPRIMITIVES_H*/ diff --git a/src/debug/mse/source.txt b/src/debug/mse/source.txt deleted file mode 100644 index 00dc79b25..000000000 --- a/src/debug/mse/source.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/duneroadrunner/SaferCPlusPlus diff --git a/src/debug/nvwa/_nvwa.h b/src/debug/nvwa/_nvwa.h deleted file mode 100644 index 096893c59..000000000 --- a/src/debug/nvwa/_nvwa.h +++ /dev/null @@ -1,112 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2013-2015 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file _nvwa.h - * - * Common definitions for preprocessing. - * - * @date 2015-10-28 - */ - -#ifndef NVWA_NVWA_H -#define NVWA_NVWA_H - -/** - * @namespace nvwa - * Namespace of the nvwa project. Most functions and global variables - * are defined in this namespace. - */ - -#ifndef NVWA_USE_NAMESPACE -#ifdef __cplusplus -#define NVWA_USE_NAMESPACE 1 -#else -#define NVWA_USE_NAMESPACE 0 -#endif // __cplusplus -#endif // NVWA_USE_NAMESPACE - -#if NVWA_USE_NAMESPACE -#define NVWA_NAMESPACE_BEGIN namespace nvwa { -#define NVWA_NAMESPACE_END } -#define NVWA nvwa -#else // NVWA_USE_NAMESPACE -#define NVWA_NAMESPACE_BEGIN -#define NVWA_NAMESPACE_END -#define NVWA -#endif // NVWA_USE_NAMESPACE - -#ifndef NVWA_APPLE -#if defined(__APPLE__) && defined(__MACH__) -#define NVWA_APPLE 1 -#else -#define NVWA_APPLE 0 -#endif -#endif // NVWA_APPLE - -#ifndef NVWA_CYGWIN -#if defined(__CYGWIN__) -#define NVWA_CYGWIN 1 -#else -#define NVWA_CYGWIN 0 -#endif -#endif // NVWA_CYGWIN - -#ifndef NVWA_LINUX -#if defined(__linux__) || defined(__linux) -#define NVWA_LINUX 1 -#else -#define NVWA_LINUX 0 -#endif -#endif // NVWA_LINUX - -#ifndef NVWA_UNIX -#if defined(__unix__) || defined(__unix) || NVWA_APPLE -#define NVWA_UNIX 1 -#else -#define NVWA_UNIX 0 -#endif -#endif // NVWA_UNIX - -#ifndef NVWA_WIN32 -#if defined(_WIN32) -#define NVWA_WIN32 1 -#else -#define NVWA_WIN32 0 -#endif -#endif // NVWA_WIN32 - -#ifndef NVWA_WINDOWS -#if NVWA_CYGWIN || NVWA_WIN32 -#define NVWA_WINDOWS 1 -#else -#define NVWA_WINDOWS 0 -#endif -#endif // NVWA_WINDOWS - -#endif // NVWA_NVWA_H diff --git a/src/debug/nvwa/c++11.h b/src/debug/nvwa/c++11.h deleted file mode 100644 index 8d8e2d8af..000000000 --- a/src/debug/nvwa/c++11.h +++ /dev/null @@ -1,340 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2013-2017 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file c++11.h - * - * C++11 feature detection macros and workarounds. - * - * @date 2017-04-03 - */ - -#ifndef NVWA_CXX11_H -#define NVWA_CXX11_H - -// Only Clang provides these macros; they need to be defined as follows -// to get a valid expression in preprocessing by other compilers. -#ifndef __has_extension -#define __has_extension(x) 0 -#endif -#ifndef __has_feature -#define __has_feature(x) 0 -#endif -#ifndef __has_include -#define __has_include(x) 0 -#endif - -// Detect whether C++11 mode is on (for GCC and Clang). MSVC does not -// have a special C++11 mode, so it is always on for Visual C++ 2010 and -// later. -#if __cplusplus >= 201103L || \ - defined(__GXX_EXPERIMENTAL_CXX0X__) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) -#define NVWA_CXX11_MODE 1 -#else -#define NVWA_CXX11_MODE 0 -#endif - - -/* Feature checks */ - -#if !defined(HAVE_CXX11_ATOMIC) -#if NVWA_CXX11_MODE && \ - ((__has_include() && !defined(__MINGW32__)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (((defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405) || \ - defined(__clang__)) && \ - (!defined(__MINGW32__) || defined(_POSIX_THREADS)))) -// Note: MinGW GCC, unless built with POSIX threads (as in -// MinGW-builds), does not support atomics as of 4.8. -#define HAVE_CXX11_ATOMIC 1 -#else -#define HAVE_CXX11_ATOMIC 0 -#endif -#endif - -#if !defined(HAVE_CXX11_AUTO_TYPE) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_auto_type) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 404)) -#define HAVE_CXX11_AUTO_TYPE 1 -#else -#define HAVE_CXX11_AUTO_TYPE 0 -#endif -#endif - -#if !defined(HAVE_CXX11_DELETED_FUNCTION) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_deleted_functions) || \ - (defined(_MSC_VER) && _MSC_VER >= 1800) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 404)) -#define HAVE_CXX11_DELETED_FUNCTION 1 -#else -#define HAVE_CXX11_DELETED_FUNCTION 0 -#endif -#endif - -#if !defined(HAVE_CXX11_EXPLICIT_CONVERSION) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_explicit_conversions) || \ - (defined(_MSC_VER) && _MSC_VER >= 1900) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405)) -#define HAVE_CXX11_EXPLICIT_CONVERSION 1 -#else -#define HAVE_CXX11_EXPLICIT_CONVERSION 0 -#endif -#endif - -#if !defined(HAVE_CXX11_FINAL) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_override_control) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 407)) -#define HAVE_CXX11_FINAL 1 -#else -#define HAVE_CXX11_FINAL 0 -#endif -#endif - -#if !defined(HAVE_CXX11_FUTURE) -#if NVWA_CXX11_MODE && \ - ((__has_include() && !defined(__MINGW32__)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (((defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405) || \ - defined(__clang__)) && \ - (!defined(__MINGW32__) || defined(_POSIX_THREADS)))) -// Note: MinGW GCC, unless built with POSIX threads (as in -// MinGW-builds), does not support futures as of 4.8. -#define HAVE_CXX11_FUTURE 1 -#else -#define HAVE_CXX11_FUTURE 0 -#endif -#endif - -#if !defined(HAVE_CXX11_GENERALIZED_INITIALIZER) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_generalized_initializers) || \ - (defined(_MSC_VER) && _MSC_VER >= 1800) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 404)) -#define HAVE_CXX11_GENERALIZED_INITIALIZER 1 -#else -#define HAVE_CXX11_GENERALIZED_INITIALIZER 0 -#endif -#endif - -#if !defined(HAVE_CXX11_LAMBDA) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_lambdas) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405)) -#define HAVE_CXX11_LAMBDA 1 -#else -#define HAVE_CXX11_LAMBDA 0 -#endif -#endif - -#if !defined(HAVE_CXX11_MUTEX) -#if NVWA_CXX11_MODE && \ - ((__has_include() && !defined(__MINGW32__)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (((defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 403) || \ - defined(__clang__)) && \ - (!defined(__MINGW32__) || defined(_POSIX_THREADS)))) -// Note: MinGW GCC, unless built with POSIX threads (as in -// MinGW-builds), does not support std::mutex as of 4.8. -#define HAVE_CXX11_MUTEX 1 -#else -#define HAVE_CXX11_MUTEX 0 -#endif -#endif - -#if !defined(HAVE_CXX11_NOEXCEPT) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_noexcept) || \ - (defined(_MSC_VER) && _MSC_VER >= 1900) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 406)) -#define HAVE_CXX11_NOEXCEPT 1 -#else -#define HAVE_CXX11_NOEXCEPT 0 -#endif -#endif - -#if !defined(HAVE_CXX11_NULLPTR) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_nullptr) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 406)) -#define HAVE_CXX11_NULLPTR 1 -#else -#define HAVE_CXX11_NULLPTR 0 -#endif -#endif - -#if !defined(HAVE_CXX11_OVERRIDE) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_override_control) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 407)) -#define HAVE_CXX11_OVERRIDE 1 -#else -#define HAVE_CXX11_OVERRIDE 0 -#endif -#endif - -#if !defined(HAVE_CXX11_RANGE_FOR) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_range_for) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 406)) -#define HAVE_CXX11_RANGE_FOR 1 -#else -#define HAVE_CXX11_RANGE_FOR 0 -#endif -#endif - -#if !defined(HAVE_CXX11_RVALUE_REFERENCE) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_rvalue_references) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405)) -#define HAVE_CXX11_RVALUE_REFERENCE 1 -#else -#define HAVE_CXX11_RVALUE_REFERENCE 0 -#endif -#endif - -#if !defined(HAVE_CXX11_STATIC_ASSERT) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_static_assert) || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 403)) -#define HAVE_CXX11_STATIC_ASSERT 1 -#else -#define HAVE_CXX11_STATIC_ASSERT 0 -#endif -#endif - -#if !defined(HAVE_CXX11_THREAD) -#if NVWA_CXX11_MODE && \ - ((__has_include() && !defined(__MINGW32__)) || \ - (defined(_MSC_VER) && _MSC_VER >= 1700) || \ - (((defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 404) || \ - defined(__clang__)) && \ - (!defined(__MINGW32__) || defined(_POSIX_THREADS)))) -// Note: MinGW GCC, unless built with POSIX threads (as in -// MinGW-builds), does not support std::thread as of 4.8. -#define HAVE_CXX11_THREAD 1 -#else -#define HAVE_CXX11_THREAD 0 -#endif -#endif - -#if !defined(HAVE_CXX11_THREAD_LOCAL) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_thread_local) || \ - (defined(_MSC_VER) && _MSC_VER >= 1900) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 408)) -#define HAVE_CXX11_THREAD_LOCAL 1 -#else -#define HAVE_CXX11_THREAD_LOCAL 0 -#endif -#endif - -#if !defined(HAVE_CXX11_TYPE_TRAITS) -#if NVWA_CXX11_MODE && \ - (__has_include() || \ - (defined(_MSC_VER) && _MSC_VER >= 1600) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 403)) -#define HAVE_CXX11_TYPE_TRAITS 1 -#else -#define HAVE_CXX11_TYPE_TRAITS 0 -#endif -#endif - -#if !defined(HAVE_CXX11_UNICODE_LITERAL) -#if NVWA_CXX11_MODE && \ - (__has_feature(cxx_unicode_literals) || \ - (defined(_MSC_VER) && _MSC_VER >= 1900) || \ - (defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ >= 405)) -#define HAVE_CXX11_UNICODE_LITERAL 1 -#else -#define HAVE_CXX11_UNICODE_LITERAL 0 -#endif -#endif - - -/* Workarounds */ - -#if HAVE_CXX11_DELETED_FUNCTION -#define _DELETED = delete -#else -#define _DELETED -#endif - -#if HAVE_CXX11_FINAL -#define _FINAL final -#else -#define _FINAL -#endif - -#if HAVE_CXX11_OVERRIDE -#define _OVERRIDE override -#else -#define _OVERRIDE -#endif - -#if HAVE_CXX11_NOEXCEPT -#define _NOEXCEPT noexcept -#define _NOEXCEPT_(x) noexcept(x) -#else -#ifdef _MSC_VER -#define _NOEXCEPT throw () -#else -#define _NOEXCEPT throw() -#endif -#define _NOEXCEPT_(x) -#endif - -#if HAVE_CXX11_NULLPTR -#define _NULLPTR nullptr -#else -#define _NULLPTR NULL -#endif - -#if HAVE_CXX11_THREAD_LOCAL -#define _THREAD_LOCAL thread_local -#else -#ifdef _MSC_VER -#define _THREAD_LOCAL __declspec(thread) -#else -#define _THREAD_LOCAL __thread -#endif -#endif - -#endif // NVWA_CXX11_H diff --git a/src/debug/nvwa/debug_new.cpp b/src/debug/nvwa/debug_new.cpp deleted file mode 100644 index 77ef8f17e..000000000 --- a/src/debug/nvwa/debug_new.cpp +++ /dev/null @@ -1,1197 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2016 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file debug_new.cpp - * - * Implementation of debug versions of new and delete to check leakage. - * - * @date 2016-10-14 - */ - -#include "localconsts.h" - -PRAGMACLANG6GCC(GCC diagnostic push) -PRAGMACLANG6GCC(GCC diagnostic ignored "-Wold-style-cast") - -PRAGMA45(GCC diagnostic push) -PRAGMA45(GCC diagnostic ignored "-Wcast-qual") - -#include // std::bad_alloc/nothrow_t -#include // assert -#include // fprintf/stderr -#include // abort -#include // strcpy/strncpy/sprintf -#include "debug/nvwa/_nvwa.h" // NVWA macros - -#if NVWA_UNIX -#include // alloca -#endif -#if NVWA_WIN32 -#include // alloca -#endif - -#if NVWA_LINUX || NVWA_APPLE -#include // backtrace -#endif - -#if NVWA_WINDOWS -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include // CaptureStackBackTrace -#endif - -#include "debug/nvwa/c++11.h" // _NOEXCEPT/_NULLPTR -#include "debug/nvwa/fast_mutex.h" // nvwa::fast_mutex -#include "debug/nvwa/static_assert.h" // STATIC_ASSERT - -#undef _DEBUG_NEW_EMULATE_MALLOC -#undef _DEBUG_NEW_REDEFINE_NEW -/** - * Macro to indicate whether redefinition of \c new is wanted. Here it - * is defined to \c 0 to disable the redefinition of \c new. - */ -#define _DEBUG_NEW_REDEFINE_NEW 0 -#include "debug/nvwa/debug_new.h" - -#if !_FAST_MUTEX_CHECK_INITIALIZATION && !defined(_NOTHREADS) -#error "_FAST_MUTEX_CHECK_INITIALIZATION not set: check_leaks may not work" -#endif - -/** - * @def _DEBUG_NEW_ALIGNMENT - * - * The alignment requirement of allocated memory blocks. It must be a - * power of two. - */ -#ifndef _DEBUG_NEW_ALIGNMENT -#define _DEBUG_NEW_ALIGNMENT 16 -#endif - -/** - * @def _DEBUG_NEW_CALLER_ADDRESS - * - * The expression to return the caller address. nvwa#print_position will - * later on use this address to print the position information of memory - * operation points. - */ -#ifndef _DEBUG_NEW_CALLER_ADDRESS -#ifdef __GNUC__ -#define _DEBUG_NEW_CALLER_ADDRESS __builtin_return_address(0) -#else -#define _DEBUG_NEW_CALLER_ADDRESS _NULLPTR -#endif -#endif - -/** - * @def _DEBUG_NEW_ERROR_ACTION - * - * The action to take when an error occurs. The default behaviour is to - * call \e abort, unless \c _DEBUG_NEW_ERROR_CRASH is defined, in which - * case a segmentation fault will be triggered instead (which can be - * useful on platforms like Windows that do not generate a core dump - * when \e abort is called). - */ -#ifndef _DEBUG_NEW_ERROR_ACTION -#ifndef _DEBUG_NEW_ERROR_CRASH -#define _DEBUG_NEW_ERROR_ACTION abort() -#else -#define _DEBUG_NEW_ERROR_ACTION do { *((char*)0) = 0; abort(); } while (0) -#endif -#endif - -/** - * @def _DEBUG_NEW_FILENAME_LEN - * - * The length of file name stored if greater than zero. If it is zero, - * only a const char pointer will be stored. Currently the default - * value is non-zero (thus to copy the file name) on non-Windows - * platforms, because I once found that the exit leakage check could not - * access the address of the file name on Linux (in my case, a core dump - * occurred when check_leaks tried to access the file name in a shared - * library after a \c SIGINT). This value makes the size of - * new_ptr_list_t \c 64 on non-Windows 32-bit platforms (w/o stack - * backtrace). - */ -#ifndef _DEBUG_NEW_FILENAME_LEN -#if NVWA_WINDOWS -#define _DEBUG_NEW_FILENAME_LEN 0 -#else -#define _DEBUG_NEW_FILENAME_LEN 44 -#endif -#endif - -/** - * @def _DEBUG_NEW_PROGNAME - * - * The program (executable) name to be set at compile time. It is - * better to assign the full program path to nvwa#new_progname in \e main - * (at run time) than to use this (compile-time) macro, but this macro - * serves well as a quick hack. Note also that double quotation marks - * need to be used around the program name, i.e., one should specify a - * command-line option like -D_DEBUG_NEW_PROGNAME=\\"a.out\" - * in \e bash, or -D_DEBUG_NEW_PROGNAME=\\"a.exe\" in the - * Windows command prompt. - */ -#ifndef _DEBUG_NEW_PROGNAME -#define _DEBUG_NEW_PROGNAME _NULLPTR -#endif - -/** - * @def _DEBUG_NEW_REMEMBER_STACK_TRACE - * - * Macro to indicate whether stack traces of allocations should be - * included in NVWA allocation information and be printed while leaks - * are reported. Useful to pinpoint leaks caused by strdup and other - * custom allocation functions. It is also very helpful in filtering - * out false positives caused by internal STL/C runtime operations. It - * is off by default because it is quite memory heavy. Set it to \c 1 - * to make all allocations have stack trace attached, or set to \c 2 to - * make only allocations that lack calling source code information (file - * and line) have the stack trace attached. - */ -#ifndef _DEBUG_NEW_REMEMBER_STACK_TRACE -#define _DEBUG_NEW_REMEMBER_STACK_TRACE 0 -#endif - -/** - * @def _DEBUG_NEW_STD_OPER_NEW - * - * Macro to indicate whether the standard-conformant behaviour of - * operator new is wanted. It is on by default now, but - * the user may set it to \c 0 to revert to the old behaviour. - */ -#ifndef _DEBUG_NEW_STD_OPER_NEW -#define _DEBUG_NEW_STD_OPER_NEW 1 -#endif - -/** - * @def _DEBUG_NEW_TAILCHECK - * - * Macro to indicate whether a writing-past-end check will be performed. - * Define it to a positive integer as the number of padding bytes at the - * end of a memory block for checking. - */ -#ifndef _DEBUG_NEW_TAILCHECK -#define _DEBUG_NEW_TAILCHECK 0 -#endif - -/** - * @def _DEBUG_NEW_TAILCHECK_CHAR - * - * Value of the padding bytes at the end of a memory block. - */ -//#ifndef _DEBUG_NEW_TAILCHECK_CHAR -//#define _DEBUG_NEW_TAILCHECK_CHAR 0xCC -//#endif - -/** - * @def _DEBUG_NEW_USE_ADDR2LINE - * - * Whether to use \e addr2line to convert a caller address to file/line - * information. Defining it to a non-zero value will enable the - * conversion (automatically done if GCC is detected). Defining it to - * zero will disable the conversion. - */ -#ifndef _DEBUG_NEW_USE_ADDR2LINE -#ifdef __GNUC__ -#define _DEBUG_NEW_USE_ADDR2LINE 1 -#else -#define _DEBUG_NEW_USE_ADDR2LINE 0 -#endif -#endif - -#ifdef _MSC_VER -#pragma warning(disable: 4074) // #pragma init_seg(compiler) used -#pragma warning(disable: 4290) // C++ exception specification ignored -#if _MSC_VER >= 1400 // Visual Studio 2005 or later -#pragma warning(disable: 4996) // Use the `unsafe' strncpy -#endif -#pragma init_seg(compiler) -#endif - -/** - * Gets the aligned value of memory block size. - */ -#define ALIGN(s) \ - (((s) + _DEBUG_NEW_ALIGNMENT - 1) & ~(_DEBUG_NEW_ALIGNMENT - 1)) - -NVWA_NAMESPACE_BEGIN - -/** - * The platform memory alignment. The current value works well in - * platforms I have tested: Windows XP, Windows 7 x64, and Mac OS X - * Leopard. It may be smaller than the real alignment, but must be - * bigger than \c sizeof(size_t) for it work. nvwa#debug_new_recorder - * uses it to detect misaligned pointer returned by `new - * NonPODType[size]'. - */ -const size_t PLATFORM_MEM_ALIGNMENT = sizeof(size_t) * 2; - -/** - * Structure to store the position information where \c new occurs. - */ -struct new_ptr_list_t -{ - new_ptr_list_t* next; ///< Pointer to the next memory block - new_ptr_list_t* prev; ///< Pointer to the previous memory block - size_t size; ///< Size of the memory block - union - { -#if _DEBUG_NEW_FILENAME_LEN == 0 - const char* file; ///< Pointer to the file name of the caller -#else - char file[_DEBUG_NEW_FILENAME_LEN]; ///< File name of the caller -#endif - void* addr; ///< Address of the caller to \e new - }; - unsigned line :31; ///< Line number of the caller; or \c 0 - unsigned is_array:1; ///< Non-zero iff new[] is used -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - void** stacktrace; ///< Pointer to stack trace information -#endif - unsigned magic; ///< Magic number for error detection -}; - -/** - * Definition of the constant magic number used for error detection. - */ -static const unsigned DEBUG_NEW_MAGIC = 0x4442474E; - -/** - * The extra memory allocated by operator new. - */ -static const int ALIGNED_LIST_ITEM_SIZE = ALIGN(sizeof(new_ptr_list_t)); - -/** - * List of all new'd pointers. - */ -static new_ptr_list_t new_ptr_list = { - &new_ptr_list, - &new_ptr_list, - 0, - { -#if _DEBUG_NEW_FILENAME_LEN == 0 - _NULLPTR -#else - "" -#endif - }, - 0, - 0, -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - _NULLPTR, -#endif - DEBUG_NEW_MAGIC -}; - -/** - * The mutex guard to protect simultaneous access to the pointer list. - */ -static fast_mutex new_ptr_lock; - -/** - * The mutex guard to protect simultaneous output to #new_output_fp. - */ -static fast_mutex new_output_lock; - -/** - * Total memory allocated in bytes. - */ -static size_t total_mem_alloc = 0; - -/** - * Flag to control whether nvwa#check_leaks will be automatically called - * on program exit. - */ -bool new_autocheck_flag = true; - -/** - * Flag to control whether verbose messages are output. - */ -bool new_verbose_flag = false; - -/** - * Pointer to the output stream. The default output is \e stderr, and - * one may change it to a user stream if needed (say, #new_verbose_flag - * is \c true and there are a lot of (de)allocations). - */ -FILE* new_output_fp = stderr; - -/** - * Pointer to the program name. Its initial value is the macro - * #_DEBUG_NEW_PROGNAME. You should try to assign the program path to - * it early in your application. Assigning argv[0] to it - * in \e main is one way. If you use \e bash or \e ksh (or similar), - * the following statement is probably what you want: - * `new_progname = getenv("_");'. - */ -const char* new_progname = _DEBUG_NEW_PROGNAME; - -/** - * Pointer to the callback used to print the stack backtrace in case of - * a memory problem. A null value causes the default stack trace - * printing routine to be used. - */ -stacktrace_print_callback_t stacktrace_print_callback = _NULLPTR; - -/** - * Pointer to the callback used to filter out false positives from leak - * reports. A null value means the lack of filtering. - */ -leak_whitelist_callback_t leak_whitelist_callback = _NULLPTR; - -#if _DEBUG_NEW_USE_ADDR2LINE -/** - * Tries printing the position information from an instruction address. - * This is the version that uses \e addr2line. - * - * @param addr the instruction address to convert and print - * @return \c true if the address is converted successfully (and - * the result is printed); \c false if no useful - * information is got (and nothing is printed) - */ -static bool print_position_from_addr(const void* addr) -{ - static const void* last_addr = _NULLPTR; - static char last_info[256] = ""; - if (addr == last_addr) - { - if (last_info[0] == '\0') - return false; - fprintf(new_output_fp, "%s", last_info); - return true; - } - if (new_progname) - { -#if NVWA_APPLE - const char addr2line_cmd[] = "atos -o "; -#else - const char addr2line_cmd[] = "addr2line -e "; -#endif - -#if NVWA_WINDOWS - const int exeext_len = 4; -#else - const int exeext_len = 0; -#endif - -#if NVWA_UNIX && !NVWA_CYGWIN - const char ignore_err[] = " 2>/dev/null"; -#elif NVWA_CYGWIN || \ - (NVWA_WIN32 && defined(WINVER) && WINVER >= 0x0500) - const char ignore_err[] = " 2>nul"; -#else - const char ignore_err[] = ""; -#endif - char* cmd = (char*)alloca(strlen(new_progname) - + exeext_len - + sizeof addr2line_cmd - 1 - + sizeof ignore_err - 1 - + sizeof(void*) * 2 - + 4 /* SP + "0x" + null */); - strcpy(cmd, addr2line_cmd); - strcpy(cmd + sizeof addr2line_cmd - 1, new_progname); - size_t len = strlen(cmd); -#if NVWA_WINDOWS - if (len <= 4 - || (strcmp(cmd + len - 4, ".exe") != 0 && - strcmp(cmd + len - 4, ".EXE") != 0)) - { - strcpy(cmd + len, ".exe"); - len += 4; - } -#endif - sprintf(cmd + len, " %p%s", addr, ignore_err); - FILE* fp = popen(cmd, "r"); - if (fp) - { - char buffer[sizeof last_info] = ""; - len = 0; - if (fgets(buffer, sizeof buffer, fp)) - { - len = strlen(buffer); - if (buffer[len - 1] == '\n') - buffer[--len] = '\0'; - } - int res = pclose(fp); - // Display the file/line information only if the command - // is executed successfully and the output points to a - // valid position, but the result will be cached if only - // the command is executed successfully. - if (res == 0 && len > 0) - { - last_addr = addr; - if (buffer[len - 1] == '0' && buffer[len - 2] == ':') - last_info[0] = '\0'; - else - { - fprintf(new_output_fp, "%s", buffer); - strcpy(last_info, buffer); - return true; - } - } - } - } - return false; -} -#else -/** - * Tries printing the position information from an instruction address. - * This is the stub version that does nothing at all. - * - * @return \c false always - */ -static bool print_position_from_addr(const void*) -{ - return false; -} -#endif // _DEBUG_NEW_USE_ADDR2LINE - -/** - * Prints the position information of a memory operation point. When \c - * _DEBUG_NEW_USE_ADDR2LINE is defined to a non-zero value, this - * function will try to convert a given caller address to file/line - * information with \e addr2line. - * - * @param ptr source file name if \e line is non-zero; caller address - * otherwise - * @param line source line number if non-zero; indication that \e ptr - * is the caller address otherwise - */ -static void print_position(const void* ptr, int line) -{ - if (line != 0) // Is file/line information present? - { - fprintf(new_output_fp, "%s:%d", (const char*)ptr, line); - } - else if (ptr != _NULLPTR) // Is caller address present? - { - if (!print_position_from_addr(ptr)) // Fail to get source position? - fprintf(new_output_fp, "%p", ptr); - } - else // No information is present - { - fprintf(new_output_fp, ""); - } -} - -#if _DEBUG_NEW_REMEMBER_STACK_TRACE -/** - * Prints the stack backtrace. - * - * When nvwa#stacktrace_print_callback is not null, it is used for - * printing the stacktrace items. Default implementation of call stack - * printing is very spartan—only stack frame pointers are - * printed—but even that output is still useful. Just do address - * lookup in LLDB etc. - * - * @param stacktrace pointer to the stack trace array - */ -static void print_stacktrace(void** stacktrace) -{ - if (stacktrace_print_callback == _NULLPTR) - { - fprintf(new_output_fp, "Stack backtrace:\n"); - for (size_t i = 0; stacktrace[i] != _NULLPTR; ++i) - fprintf(new_output_fp, "%p\n", stacktrace[i]); - } - else - { - stacktrace_print_callback(new_output_fp, stacktrace); - } -} -#endif - -/** - * Checks whether a leak should be ignored. Its runtime performance - * depends on the callback nvwa#leak_whitelist_callback. - * - * @param ptr pointer to a new_ptr_list_t struct - * @return \c true if the leak should be whitelisted; \c false - * otherwise - */ -static bool is_leak_whitelisted(new_ptr_list_t* ptr) -{ - if (leak_whitelist_callback == _NULLPTR) - return false; - - char const* file = ptr->line != 0 ? ptr->file : _NULLPTR; - int line = ptr->line; - void* addr = ptr->line == 0 ? ptr->addr : _NULLPTR; -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - void** stacktrace = ptr->stacktrace; -#else - void** stacktrace = _NULLPTR; -#endif - - return leak_whitelist_callback(file, line, addr, stacktrace); -} - -#if _DEBUG_NEW_TAILCHECK -/** - * Checks whether the padding bytes at the end of a memory block is - * tampered with. - * - * @param ptr pointer to a new_ptr_list_t struct - * @return \c true if the padding bytes are untouched; \c false - * otherwise - */ -static bool check_tail(new_ptr_list_t* ptr) -{ - const unsigned char* const tail_ptr = (unsigned char*)ptr + - ALIGNED_LIST_ITEM_SIZE + ptr->size; - for (int i = 0; i < _DEBUG_NEW_TAILCHECK; ++i) - if (tail_ptr[i] != _DEBUG_NEW_TAILCHECK_CHAR) - return false; - return true; -} -#endif - -/** - * Allocates memory and initializes control data. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @param is_array boolean value whether this is an array operation - * @return pointer to the user-requested memory area; null if - * memory allocation is not successful - */ -static void* alloc_mem(size_t size, const char* file, int line, bool is_array) -{ - assert(line >= 0); -#if _DEBUG_NEW_TYPE == 1 - STATIC_ASSERT(_DEBUG_NEW_ALIGNMENT >= PLATFORM_MEM_ALIGNMENT, - Alignment_too_small); -#endif - STATIC_ASSERT((_DEBUG_NEW_ALIGNMENT & (_DEBUG_NEW_ALIGNMENT - 1)) == 0, - Alignment_must_be_power_of_two); - STATIC_ASSERT(_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length); - size_t s = size + ALIGNED_LIST_ITEM_SIZE + _DEBUG_NEW_TAILCHECK; - new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s); - if (ptr == _NULLPTR) - { -#if _DEBUG_NEW_STD_OPER_NEW - return _NULLPTR; -#else - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "Out of memory when allocating %lu bytes\n", - (unsigned long)size); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; -#endif - } - void* usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; -#if _DEBUG_NEW_FILENAME_LEN == 0 - ptr->file = file; -#else - if (line) - strncpy(ptr->file, file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; - else - ptr->addr = (void*)file; -#endif - ptr->line = line; -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - ptr->stacktrace = _NULLPTR; - -#if _DEBUG_NEW_REMEMBER_STACK_TRACE == 2 - if (line == 0) -#endif - { - void* buffer [255]; - size_t buffer_length = sizeof(buffer) / sizeof(*buffer); - -#if NVWA_UNIX - int stacktrace_length = backtrace(buffer, int(buffer_length)); -#endif - -#if NVWA_WINDOWS - USHORT stacktrace_length = CaptureStackBackTrace( - 0, DWORD(buffer_length), buffer, _NULLPTR); -#endif - - size_t stacktrace_size = stacktrace_length * sizeof(void*); - ptr->stacktrace = (void**)malloc(stacktrace_size + sizeof(void*)); - - if (ptr->stacktrace != _NULLPTR) - { - memcpy(ptr->stacktrace, buffer, stacktrace_size); - ptr->stacktrace[stacktrace_length] = _NULLPTR; - } - } -#endif - ptr->is_array = is_array; - ptr->size = size; - ptr->magic = DEBUG_NEW_MAGIC; - { - fast_mutex_autolock lock(new_ptr_lock); - ptr->prev = new_ptr_list.prev; - ptr->next = &new_ptr_list; - new_ptr_list.prev->next = ptr; - new_ptr_list.prev = ptr; - } -#if _DEBUG_NEW_TAILCHECK - memset((char*)usr_ptr + size, _DEBUG_NEW_TAILCHECK_CHAR, - _DEBUG_NEW_TAILCHECK); -#endif - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "new%s: allocated %p (size %lu, ", - is_array ? "[]" : "", - usr_ptr, (unsigned long)size); - if (line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, ")\n"); - } - total_mem_alloc += size; - return usr_ptr; -} - -/** - * Frees memory and adjusts pointers. - * - * @param usr_ptr pointer to the previously allocated memory - * @param addr pointer to the caller - * @param is_array flag indicating whether it is invoked by a - * delete[] call - */ -static void free_pointer(void* usr_ptr, void* addr, bool is_array) -{ - if (usr_ptr == _NULLPTR) - return; - new_ptr_list_t* ptr = - (new_ptr_list_t*)((char*)usr_ptr - ALIGNED_LIST_ITEM_SIZE); - if (ptr->magic != DEBUG_NEW_MAGIC) - { - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, "delete%s: invalid pointer %p (", - is_array ? "[]" : "", usr_ptr); - print_position(addr, 0); - fprintf(new_output_fp, ")\n"); - } - check_mem_corruption(); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } - if (is_array != ptr->is_array) - { - const char* msg; - if (is_array) - msg = "delete[] after new"; - else - msg = "delete after new[]"; - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "%s: pointer %p (size %lu)\n\tat ", - msg, - (char*)ptr + ALIGNED_LIST_ITEM_SIZE, - (unsigned long)ptr->size); - print_position(addr, 0); - fprintf(new_output_fp, "\n\toriginally allocated at "); - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, "\n"); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } -#if _DEBUG_NEW_TAILCHECK - if (!check_tail(ptr)) - { - check_mem_corruption(); - fflush(new_output_fp); - _DEBUG_NEW_ERROR_ACTION; - } -#endif - { - fast_mutex_autolock lock(new_ptr_lock); - total_mem_alloc -= ptr->size; - ptr->magic = 0; - ptr->prev->next = ptr->next; - ptr->next->prev = ptr->prev; - } - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "delete%s: freed %p (size %lu, %lu bytes still allocated)\n", - is_array ? "[]" : "", - (char*)ptr + ALIGNED_LIST_ITEM_SIZE, - (unsigned long)ptr->size, (unsigned long)total_mem_alloc); - } -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - free(ptr->stacktrace); -#endif - free(ptr); - return; -} - -/** - * Checks for memory leaks. - * - * @return zero if no leakage is found; the number of leaks otherwise - */ -int check_leaks() -{ - int leak_cnt = 0; - int whitelisted_leak_cnt = 0; - fast_mutex_autolock lock_ptr(new_ptr_lock); - fast_mutex_autolock lock_output(new_output_lock); - new_ptr_list_t* ptr = new_ptr_list.next; - - while (ptr != &new_ptr_list) - { - const char* const usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; - if (ptr->magic != DEBUG_NEW_MAGIC) - { - fprintf(new_output_fp, - "warning: heap data corrupt near %p\n", - usr_ptr); - } -#if _DEBUG_NEW_TAILCHECK - if (!check_tail(ptr)) - { - fprintf(new_output_fp, - "warning: overwritten past end of object at %p\n", - usr_ptr); - } -#endif - - if (is_leak_whitelisted(ptr)) - { - ++whitelisted_leak_cnt; - } - else - { - fprintf(new_output_fp, - "Leaked object at %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); - - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - - fprintf(new_output_fp, ")\n"); - -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - if (ptr->stacktrace != _NULLPTR) - print_stacktrace(ptr->stacktrace); -#endif - } - - ptr = ptr->next; - ++leak_cnt; - } - if (new_verbose_flag || leak_cnt) - { - if (whitelisted_leak_cnt > 0) - { - fprintf(new_output_fp, "*** %d leaks found (%d whitelisted)\n", - leak_cnt, whitelisted_leak_cnt); - } - else - { - fprintf(new_output_fp, "*** %d leaks found\n", leak_cnt); - } - } - - return leak_cnt; -} - -/** - * Checks for heap corruption. - * - * @return zero if no problem is found; the number of found memory - * corruptions otherwise - */ -int check_mem_corruption() -{ - int corrupt_cnt = 0; - fast_mutex_autolock lock_ptr(new_ptr_lock); - fast_mutex_autolock lock_output(new_output_lock); - fprintf(new_output_fp, "*** Checking for memory corruption: START\n"); - for (new_ptr_list_t* ptr = new_ptr_list.next; - ptr != &new_ptr_list; - ptr = ptr->next) - { - const char* const usr_ptr = (char*)ptr + ALIGNED_LIST_ITEM_SIZE; - if (ptr->magic == DEBUG_NEW_MAGIC -#if _DEBUG_NEW_TAILCHECK - && check_tail(ptr) -#endif - ) - continue; -#if _DEBUG_NEW_TAILCHECK - if (ptr->magic != DEBUG_NEW_MAGIC) - { -#endif - fprintf(new_output_fp, - "Heap data corrupt near %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); -#if _DEBUG_NEW_TAILCHECK - } - else - { - fprintf(new_output_fp, - "Overwritten past end of object at %p (size %lu, ", - usr_ptr, - (unsigned long)ptr->size); - } -#endif - if (ptr->line != 0) - print_position(ptr->file, ptr->line); - else - print_position(ptr->addr, ptr->line); - fprintf(new_output_fp, ")\n"); - -#if _DEBUG_NEW_REMEMBER_STACK_TRACE - if (ptr->stacktrace != _NULLPTR) - print_stacktrace(ptr->stacktrace); -#endif - - ++corrupt_cnt; - } - fprintf(new_output_fp, "*** Checking for memory corruption: %d FOUND\n", - corrupt_cnt); - return corrupt_cnt; -} - -/** - * Processes the allocated memory and inserts file/line informatin. - * It will only be done when it can ensure the memory is allocated by - * one of our operator new variants. - * - * @param usr_ptr pointer returned by a new-expression - */ -void debug_new_recorder::_M_process(void* usr_ptr) -{ - if (usr_ptr == _NULLPTR) - return; - - // In an expression `new NonPODType[size]', the pointer returned is - // not the pointer returned by operator new[], but offset by size_t - // to leave room for the size. It needs to be compensated here. - size_t offset = (char*)usr_ptr - (char*)_NULLPTR; - if (offset % PLATFORM_MEM_ALIGNMENT != 0) { - offset -= sizeof(size_t); - if (offset % PLATFORM_MEM_ALIGNMENT != 0) { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "warning: memory unaligned; skipping processing (%s:%d)\n", - _M_file, _M_line); - return; - } - usr_ptr = (char*)usr_ptr - sizeof(size_t); - } - - new_ptr_list_t* ptr = - (new_ptr_list_t*)((char*)usr_ptr - ALIGNED_LIST_ITEM_SIZE); - if (ptr->magic != DEBUG_NEW_MAGIC || ptr->line != 0) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "warning: debug_new used with placement new (%s:%d)\n", - _M_file, _M_line); - return; - } - if (new_verbose_flag) { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: pointer %p allocated from %s:%d\n", - usr_ptr, _M_file, _M_line); - } -#if _DEBUG_NEW_FILENAME_LEN == 0 - ptr->file = _M_file; -#else - strncpy(ptr->file, _M_file, _DEBUG_NEW_FILENAME_LEN - 1) - [_DEBUG_NEW_FILENAME_LEN - 1] = '\0'; -#endif - ptr->line = _M_line; -#if _DEBUG_NEW_REMEMBER_STACK_TRACE == 2 - free(ptr->stacktrace); - ptr->stacktrace = _NULLPTR; -#endif -} - -/** - * Count of source files that use debug_new. - */ -int debug_new_counter::_S_count = 0; - -/** - * Constructor to increment the count. - */ -debug_new_counter::debug_new_counter() -{ - ++_S_count; -} - -/** - * Destructor to decrement the count. When the count is zero, - * nvwa#check_leaks will be called. - */ -debug_new_counter::~debug_new_counter() -{ - if (--_S_count == 0 && new_autocheck_flag) - if (check_leaks()) - { - new_verbose_flag = true; -#if defined(__GNUC__) && __GNUC__ == 3 - if (!getenv("GLIBCPP_FORCE_NEW") && !getenv("GLIBCXX_FORCE_NEW")) - fprintf(new_output_fp, -"*** WARNING: GCC 3 is detected, please make sure the environment\n" -" variable GLIBCPP_FORCE_NEW (GCC 3.2 and 3.3) or GLIBCXX_FORCE_NEW\n" -" (GCC 3.4) is defined. Check the README file for details.\n"); -#endif - } -} - -NVWA_NAMESPACE_END - -#if NVWA_USE_NAMESPACE -using namespace nvwa; -#endif // NVWA_USE_NAMESPACE - -/** - * Allocates memory with file/line information. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @return pointer to the memory allocated; or null if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new(size_t size, const char* file, int line) -{ - void* ptr = alloc_mem(size, file, line, false); -#if _DEBUG_NEW_STD_OPER_NEW - if (ptr) - return ptr; - else - throw std::bad_alloc(); -#else - return ptr; -#endif -} - -/** - * Allocates array memory with file/line information. - * - * @param size size of the required memory block - * @param file null-terminated string of the file name - * @param line line number - * @return pointer to the memory allocated; or null if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new[](size_t size, const char* file, int line) -{ - void* ptr = alloc_mem(size, file, line, true); -#if _DEBUG_NEW_STD_OPER_NEW - if (ptr) - return ptr; - else - throw std::bad_alloc(); -#else - return ptr; -#endif -} - -/** - * Allocates memory without file/line information. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or null if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new(size_t size) -{ - return operator new(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Allocates array memory without file/line information. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or null if memory is - * insufficient (#_DEBUG_NEW_STD_OPER_NEW is 0) - * @throw bad_alloc memory is insufficient (#_DEBUG_NEW_STD_OPER_NEW is 1) - */ -void* operator new[](size_t size) -{ - return operator new[](size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Allocates memory with no-throw guarantee. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or null if memory is - * insufficient - */ -void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT -{ - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, false); -} - -/** - * Allocates array memory with no-throw guarantee. - * - * @param size size of the required memory block - * @return pointer to the memory allocated; or null if memory is - * insufficient - */ -void* operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT -{ - return alloc_mem(size, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0, true); -} - -/** - * Deallocates memory. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete(void* ptr) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, false); -} - -/** - * Deallocates array memory. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete[](void* ptr) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, true); -} - -#if __cplusplus >= 201402L -// GCC under C++14 wants these definitions - -void operator delete(void* ptr, size_t) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, false); -} - -void operator delete[](void* ptr, size_t) _NOEXCEPT -{ - free_pointer(ptr, _DEBUG_NEW_CALLER_ADDRESS, true); -} -#endif - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - * @param file null-terminated string of the file name - * @param line line number - * - * @see http://www.csci.csusb.edu/dick/c++std/cd2/expr.html#expr.new - * @see http://wyw.dcweb.cn/leakage.htm - */ -void operator delete(void* ptr, const char* file, int line) _NOEXCEPT -{ - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: exception thrown on initializing object at %p (", - ptr); - print_position(file, line); - fprintf(new_output_fp, ")\n"); - } - operator delete(ptr); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - * @param file null-terminated string of the file name - * @param line line number - */ -void operator delete[](void* ptr, const char* file, int line) _NOEXCEPT -{ - if (new_verbose_flag) - { - fast_mutex_autolock lock(new_output_lock); - fprintf(new_output_fp, - "info: exception thrown on initializing objects at %p (", - ptr); - print_position(file, line); - fprintf(new_output_fp, ")\n"); - } - operator delete[](ptr); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - operator delete(ptr, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -/** - * Placement deallocation function. For details, please check Section - * 5.3.4 of the C++ 1998 or 2011 Standard. - * - * @param ptr pointer to the previously allocated memory - */ -void operator delete[](void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - operator delete[](ptr, (char*)_DEBUG_NEW_CALLER_ADDRESS, 0); -} - -// This is to make Doxygen happy -#undef _DEBUG_NEW_REMEMBER_STACK_TRACE -//#define _DEBUG_NEW_REMEMBER_STACK_TRACE 0 - -PRAGMA45(GCC diagnostic pop) -PRAGMACLANG6GCC(GCC diagnostic pop) diff --git a/src/debug/nvwa/debug_new.h b/src/debug/nvwa/debug_new.h deleted file mode 100644 index 50b168c2e..000000000 --- a/src/debug/nvwa/debug_new.h +++ /dev/null @@ -1,207 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2015 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file debug_new.h - * - * Header file for checking leaks caused by unmatched new/delete. - * - * @date 2015-10-25 - */ - -#ifndef NVWA_DEBUG_NEW_H -#define NVWA_DEBUG_NEW_H - -#include // size_t/std::bad_alloc -#include // FILE -#include "debug/nvwa/_nvwa.h" // NVWA_NAMESPACE_* -#include "debug/nvwa/c++11.h" // _NOEXCEPT - -/* Special allocation/deallocation functions in the global scope */ -void* operator new(size_t size, const char* file, int line); -void* operator new[](size_t size, const char* file, int line); -void operator delete(void* ptr, const char* file, int line) _NOEXCEPT; -void operator delete[](void* ptr, const char* file, int line) _NOEXCEPT; - -NVWA_NAMESPACE_BEGIN - -/** - * @def _DEBUG_NEW_REDEFINE_NEW - * - * Macro to indicate whether redefinition of \c new is wanted. If one - * wants to define one's own operator new, or to call - * operator new directly, it should be defined to \c 0 to - * alter the default behaviour. Unless, of course, one is willing to - * take the trouble to write something like: - * @code - * # ifdef new - * # define _NEW_REDEFINED - * # undef new - * # endif - * - * // Code that uses new is here - * - * # ifdef _NEW_REDEFINED - * # ifdef DEBUG_NEW - * # define new DEBUG_NEW - * # endif - * # undef _NEW_REDEFINED - * # endif - * @endcode - */ -#ifndef _DEBUG_NEW_REDEFINE_NEW -#define _DEBUG_NEW_REDEFINE_NEW 1 -#endif - -/** - * @def _DEBUG_NEW_TYPE - * - * Macro to indicate which variant of #DEBUG_NEW is wanted. The - * default value \c 1 allows the use of placement new (like - * %new(std::nothrow)), but the verbose output (when - * nvwa#new_verbose_flag is \c true) looks worse than some older - * versions (no file/line information for allocations). Define it - * to \c 2 to revert to the old behaviour that records file and line - * information directly on the call to operator new. - */ -#ifndef _DEBUG_NEW_TYPE -#define _DEBUG_NEW_TYPE 1 -#endif - -/** - * Callback type for stack trace printing. - * - * @param fp pointer to the output stream - * @param stacktrace pointer to the stack trace array (null-terminated) - */ -typedef void (*stacktrace_print_callback_t)(FILE* fp, void** stacktrace); - -/** - * Callback type for the leak whitelist function. \a file, \a address, - * and \a backtrace might be null depending on library configuration, - * platform, and amount of runtime information available. \a line can - * be 0 when line number info is not available at runtime. - * - * @param file null-terminated string of the file name - * @param line line number - * @param addr address of code where leakage happens - * @param stacktrace pointer to the stack trace array (null-terminated) - * @return \c true if the leak should be whitelisted; - * \c false otherwise - */ -typedef bool (*leak_whitelist_callback_t)(char const* file, int line, - void* addr, void** stacktrace); - -/* Prototypes */ -int check_leaks(); -int check_mem_corruption(); - -/* Control variables */ -extern bool new_autocheck_flag; // default to true: call check_leaks() on exit -extern bool new_verbose_flag; // default to false: no verbose information -extern FILE* new_output_fp; // default to stderr: output to console -extern const char* new_progname;// default to null; should be assigned argv[0] -extern stacktrace_print_callback_t stacktrace_print_callback;// default to null -extern leak_whitelist_callback_t leak_whitelist_callback; // default to null - -/** - * @def DEBUG_NEW - * - * Macro to catch file/line information on allocation. If - * #_DEBUG_NEW_REDEFINE_NEW is \c 0, one can use this macro directly; - * otherwise \c new will be defined to it, and one must use \c new - * instead. - */ -# if _DEBUG_NEW_TYPE == 1 -# define DEBUG_NEW NVWA::debug_new_recorder(__FILE__, __LINE__) ->* new -# else -# define DEBUG_NEW new(__FILE__, __LINE__) -# endif - -# if _DEBUG_NEW_REDEFINE_NEW -# define new DEBUG_NEW -# endif -# ifdef _DEBUG_NEW_EMULATE_MALLOC -# include -# ifdef new -# define malloc(s) ((void*)(new char[s])) -# else -# define malloc(s) ((void*)(DEBUG_NEW char[s])) -# endif -# define free(p) delete[] (char*)(p) -# endif - -/** - * Recorder class to remember the call context. - * - * The idea comes from Greg Herlihy's post in comp.lang.c++.moderated. - */ -class debug_new_recorder -{ - const char* _M_file; - const int _M_line; - void _M_process(void* ptr); -public: - /** - * Constructor to remember the call context. The information will - * be used in debug_new_recorder::operator->*. - */ - debug_new_recorder(const char* file, int line) - : _M_file(file), _M_line(line) {} - /** - * Operator to write the context information to memory. - * operator->* is chosen because it has the right - * precedence, it is rarely used, and it looks good: so people can - * tell the special usage more quickly. - */ - template _Tp* operator->*(_Tp* ptr) - { _M_process(ptr); return ptr; } -private: - debug_new_recorder(const debug_new_recorder&); - debug_new_recorder& operator=(const debug_new_recorder&); -}; - -/** - * Counter class for on-exit leakage check. - * - * This technique is learnt from The C++ Programming Language by - * Bjarne Stroustup. - */ -class debug_new_counter -{ - static int _S_count; -public: - debug_new_counter(); - ~debug_new_counter(); -}; -/** Counting object for each file including debug_new.h. */ -static debug_new_counter __debug_new_count; - -NVWA_NAMESPACE_END - -#endif // NVWA_DEBUG_NEW_H diff --git a/src/debug/nvwa/fast_mutex.h b/src/debug/nvwa/fast_mutex.h deleted file mode 100644 index faccc4893..000000000 --- a/src/debug/nvwa/fast_mutex.h +++ /dev/null @@ -1,427 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2015 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file fast_mutex.h - * - * A fast mutex implementation for POSIX, Win32, and modern C++. - * - * @date 2015-05-19 - */ - -#ifndef NVWA_FAST_MUTEX_H -#define NVWA_FAST_MUTEX_H - -#include "debug/nvwa/_nvwa.h" // NVWA_NAMESPACE_* -#include "debug/nvwa/c++11.h" // HAVE_CXX11_MUTEX - -# if !defined(_NOTHREADS) -# if !defined(NVWA_USE_CXX11_MUTEX) && HAVE_CXX11_MUTEX != 0 && \ - !defined(_WIN32THREADS) && !defined(NVWA_WIN32THREADS) && \ - !defined(NVWA_PTHREADS) && !defined(NVWA_NOTHREADS) && \ - defined(_WIN32) && defined(_MT) && \ - (!defined(_MSC_VER) || defined(_DLL)) -// Prefer using std::mutex on Windows to avoid the namespace -// pollution caused by . However, MSVC has a re-entry -// issue with its std::mutex implementation, and std::mutex should -// not be used unless /MD or /MDd is used. For more information, -// check out: -// -// https://connect.microsoft.com/VisualStudio/feedback/details/776596/std-mutex-not-a-constexpr-with-mtd-compiler-flag -// http://stackoverflow.com/questions/14319344/stdmutex-lock-hangs-when-overriding-the-new-operator -// -# define NVWA_USE_CXX11_MUTEX 1 -# endif - -# if !defined(_WIN32THREADS) && \ - (defined(_WIN32) && defined(_MT)) -// Automatically use _WIN32THREADS when specifying -MT/-MD in MSVC, -// or -mthreads in MinGW GCC. -# define _WIN32THREADS -# elif !defined(_PTHREADS) && \ - defined(_REENTRANT) -// Automatically use _PTHREADS when specifying -pthread in GCC or Clang. -# define _PTHREADS -# endif -# endif - -# ifndef NVWA_USE_CXX11_MUTEX -# if HAVE_CXX11_MUTEX != 0 && \ - !defined(_NOTHREADS) && !defined(NVWA_NOTHREADS) && \ - !defined(_PTHREADS) && !defined(NVWA_PTHREADS) && \ - !defined(_WIN32THREADS) && !defined(NVWA_WIN32THREADS) -# define NVWA_USE_CXX11_MUTEX 1 -# else -# define NVWA_USE_CXX11_MUTEX 0 -# endif -# endif - -# if !defined(_PTHREADS) && !defined(_WIN32THREADS) && \ - !defined(_NOTHREADS) && NVWA_USE_CXX11_MUTEX == 0 -# define _NOTHREADS -# endif - -# if defined(_NOTHREADS) -# if defined(_PTHREADS) || defined(_WIN32THREADS) || \ - NVWA_USE_CXX11_MUTEX != 0 -# undef _NOTHREADS -# error "Cannot define multi-threaded mode with -D_NOTHREADS" -# endif -# endif - -# if defined(__MINGW32__) && defined(_WIN32THREADS) && !defined(_MT) -# error "Be sure to specify -mthreads with -D_WIN32THREADS" -# endif - -// With all the heuristics above, things may still go wrong, maybe even -// due to a specific inclusion order. So they may be overridden by -// manually defining the NVWA_* macros below. -# if NVWA_USE_CXX11_MUTEX == 0 && \ - !defined(NVWA_WIN32THREADS) && \ - !defined(NVWA_PTHREADS) && \ - !defined(NVWA_NOTHREADS) -// _WIN32THREADS takes precedence, as some C++ libraries have _PTHREADS -// defined even on Win32 platforms. -# if defined(_WIN32THREADS) -# define NVWA_WIN32THREADS -# elif defined(_PTHREADS) -# define NVWA_PTHREADS -# else -# define NVWA_NOTHREADS -# endif -# endif - -# ifndef _FAST_MUTEX_CHECK_INITIALIZATION -/** - * Macro to control whether to check for initialization status for each - * lock/unlock operation. Defining it to a non-zero value will enable - * the check, so that the construction/destruction of a static object - * using a static fast_mutex not yet constructed or already destroyed - * will work (with lock/unlock operations ignored). Defining it to zero - * will disable to check. - */ -# define _FAST_MUTEX_CHECK_INITIALIZATION 1 -# endif - -# ifdef _DEBUG -# include -# include -/** Macro for fast_mutex assertions. Real version (for debug mode). */ -# define _FAST_MUTEX_ASSERT(_Expr, _Msg) \ - if (!(_Expr)) { \ - fprintf(stderr, "fast_mutex::%s\n", _Msg); \ - abort(); \ - } -# else -/** Macro for fast_mutex assertions. Fake version (for release mode). */ -# define _FAST_MUTEX_ASSERT(_Expr, _Msg) \ - ((void)0) -# endif - -# if NVWA_USE_CXX11_MUTEX != 0 -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (C++11) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * using the C++11 mutex. - */ - class fast_mutex - { - std::mutex _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - _M_mtx_impl.lock(); -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - _M_mtx_impl.unlock(); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# elif defined(NVWA_PTHREADS) -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (POSIX threads) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * for POSIX threads. - */ - class fast_mutex - { - pthread_mutex_t _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - ::pthread_mutex_init(&_M_mtx_impl, _NULLPTR); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - ::pthread_mutex_destroy(&_M_mtx_impl); - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - ::pthread_mutex_lock(&_M_mtx_impl); -# ifdef _DEBUG - // The following assertion should _always_ be true for a - // real `fast' pthread_mutex. However, this assertion can - // help sometimes, when people forget to use `-lpthread' and - // glibc provides an empty implementation. Having this - // assertion is also more consistent. - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - ::pthread_mutex_unlock(&_M_mtx_impl); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# elif defined(NVWA_WIN32THREADS) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif /* WIN32_LEAN_AND_MEAN */ -# include -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is truly volatile since - * it is in a multi-threaded (Win32 threads) environment. - */ -# define __VOLATILE volatile - /** - * Class for non-reentrant fast mutexes. This is the implementation - * for Win32 threads. - */ - class fast_mutex - { - CRITICAL_SECTION _M_mtx_impl; -# if _FAST_MUTEX_CHECK_INITIALIZATION - bool _M_initialized; -# endif -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - ::InitializeCriticalSection(&_M_mtx_impl); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = true; -# endif - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); -# if _FAST_MUTEX_CHECK_INITIALIZATION - _M_initialized = false; -# endif - ::DeleteCriticalSection(&_M_mtx_impl); - } - void lock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif - ::EnterCriticalSection(&_M_mtx_impl); -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# if _FAST_MUTEX_CHECK_INITIALIZATION - if (!_M_initialized) - return; -# endif -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - ::LeaveCriticalSection(&_M_mtx_impl); - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# elif defined(NVWA_NOTHREADS) -NVWA_NAMESPACE_BEGIN -/** - * Macro alias to `volatile' semantics. Here it is not truly volatile - * since it is in a single-threaded environment. - */ -# define __VOLATILE - /** - * Class for non-reentrant fast mutexes. This is the null - * implementation for single-threaded environments. - */ - class fast_mutex - { -# ifdef _DEBUG - bool _M_locked; -# endif - public: - fast_mutex() -# ifdef _DEBUG - : _M_locked(false) -# endif - { - } - ~fast_mutex() - { - _FAST_MUTEX_ASSERT(!_M_locked, "~fast_mutex(): still locked"); - } - void lock() - { -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(!_M_locked, "lock(): already locked"); - _M_locked = true; -# endif - } - void unlock() - { -# ifdef _DEBUG - _FAST_MUTEX_ASSERT(_M_locked, "unlock(): not locked"); - _M_locked = false; -# endif - } - private: - fast_mutex(const fast_mutex&); - fast_mutex& operator=(const fast_mutex&); - }; -NVWA_NAMESPACE_END -# endif // Definition of class fast_mutex - -NVWA_NAMESPACE_BEGIN -/** RAII lock class for fast_mutex. */ -class fast_mutex_autolock -{ - fast_mutex& _M_mtx; -public: - explicit fast_mutex_autolock(fast_mutex& mtx) : _M_mtx(mtx) - { - _M_mtx.lock(); - } - ~fast_mutex_autolock() - { - _M_mtx.unlock(); - } -private: - fast_mutex_autolock(const fast_mutex_autolock&); - fast_mutex_autolock& operator=(const fast_mutex_autolock&); -}; -NVWA_NAMESPACE_END - -#endif // NVWA_FAST_MUTEX_H diff --git a/src/debug/nvwa/source.txt b/src/debug/nvwa/source.txt deleted file mode 100644 index 93a15332c..000000000 --- a/src/debug/nvwa/source.txt +++ /dev/null @@ -1 +0,0 @@ -https://github.com/adah1972/nvwa diff --git a/src/debug/nvwa/static_assert.h b/src/debug/nvwa/static_assert.h deleted file mode 100644 index 877ef0f97..000000000 --- a/src/debug/nvwa/static_assert.h +++ /dev/null @@ -1,62 +0,0 @@ -// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -// vim:tabstop=4:shiftwidth=4:expandtab: - -/* - * Copyright (C) 2004-2013 Wu Yongwei - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any - * damages arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute - * it freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must - * not claim that you wrote the original software. If you use this - * software in a product, an acknowledgement in the product - * documentation would be appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source - * distribution. - * - * This file is part of Stones of Nvwa: - * http://sourceforge.net/projects/nvwa - * - */ - -/** - * @file static_assert.h - * - * Template class to check validity duing compile time (adapted from Loki). - * - * @date 2013-09-07 - */ - -#ifndef STATIC_ASSERT - -#include "debug/nvwa/c++11.h" - -#if HAVE_CXX11_STATIC_ASSERT - -#define STATIC_ASSERT(_Expr, _Msg) static_assert(_Expr, #_Msg) - -#else - -namespace nvwa { - -template struct compile_time_error; -template <> struct compile_time_error {}; - -#define STATIC_ASSERT(_Expr, _Msg) \ - { \ - nvwa::compile_time_error<((_Expr) != 0)> ERROR_##_Msg; \ - (void)ERROR_##_Msg; \ - } - -} - -#endif // HAVE_CXX11_STATIC_ASSERT - -#endif // STATIC_ASSERT diff --git a/src/debug/readme.txt b/src/debug/readme.txt deleted file mode 100644 index bee507459..000000000 --- a/src/debug/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -mse and nvwa libraries not used by default. -For enable it, see configure flags. diff --git a/src/defaults.cpp b/src/defaults.cpp deleted file mode 100644 index 1dae4ed29..000000000 --- a/src/defaults.cpp +++ /dev/null @@ -1,742 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "defaults.h" - -#include "configuration.h" -#include "graphicsmanager.h" -#include "variabledata.h" - -#include "being/beingspeech.h" - -#include "const/render/graphics.h" - -#include "enums/screendensity.h" - -#include "enums/being/badgedrawtype.h" -#include "enums/being/visiblename.h" -#include "enums/being/visiblenamepos.h" - -#include "enums/input/inputaction.h" - -#include "enums/particle/particlephysics.h" - -#include "render/graphics.h" - -#include "const/net/net.h" - -#ifndef USE_SDL2 -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) -#endif // USE_SDL2 - -#include "debug.h" - -VariableData* createData(const int defData) -{ - return new IntData(defData); -} - -VariableData* createData(const double defData) -{ - return new FloatData(defData); -} - -VariableData* createData(const float defData) -{ - return new FloatData(defData); -} - -VariableData* createData(const std::string &defData) -{ - return new StringData(defData); -} - -VariableData* createData(const char *const defData) -{ - return new StringData(defData); -} - -VariableData* createData(const bool defData) -{ - return new BoolData(defData); -} - -#define AddDEF(key, value) \ - configData.insert(std::pair \ - (key, createData(value))); - -void setConfigDefaults(Configuration &cfg) -{ - logger->log("Set config default values to configuration %s", - cfg.getFileName().c_str()); - cfg.cleanDefaults(); - DefaultsData &configData = cfg.getDefaultValues(); - AddDEF("OverlayDetail", 2); - AddDEF("speechBubbleAlpha", 1.0F); - AddDEF("MostUsedServerName0", "server.themanaworld.org"); - AddDEF("visiblenames", VisibleName::Show); - AddDEF("visiblenamespos", VisibleNamePos::Bottom); - AddDEF("speech", CAST_S32(BeingSpeech::NO_NAME_IN_BUBBLE)); - AddDEF("showgender", true); - AddDEF("showlevel", false); - AddDEF("showMonstersTakedDamage", true); - AddDEF("highlightAttackRange", false); - AddDEF("highlightMapPortals", true); - AddDEF("highlightMonsterAttackRange", false); - AddDEF("chatMaxCharLimit", 512); - AddDEF("lowTraffic", true); - AddDEF("invertMoveDirection", 0); - AddDEF("crazyMoveType", 1); - AddDEF("attackWeaponType", 1); - AddDEF("quickDropCounter", 1); - AddDEF("pickUpType", 5); - AddDEF("magicAttackType", 0); - AddDEF("attackType", 2); - AddDEF("targetingType", 0); - AddDEF("followMode", 0); - AddDEF("imitationMode", 0); - AddDEF("syncPlayerMove", true); - AddDEF("syncPlayerMoveDistance", 5); - AddDEF("drawPath", false); - AddDEF("moveToTargetType", 10); - AddDEF("crazyMoveProgram", "mumrsonmdmlon"); - AddDEF("disableGameModifiers", true); - AddDEF("targetDeadPlayers", false); - AddDEF("afkMessage", "I am away from keyboard."); - AddDEF("afkFormat", 0); - AddDEF("particleMaxCount", 3000); - AddDEF("particleFastPhysics", CAST_S32(ParticlePhysics::Normal)); - AddDEF("particleEmitterSkip", 1); - AddDEF("particleeffects", true); - AddDEF("mapparticleeffects", true); - AddDEF("opengl", 0); -#ifdef ANDROID - AddDEF("screenwidth", 0); - AddDEF("screenheight", 0); - AddDEF("showScreenJoystick", true); - AddDEF("showScreenButtons", true); - AddDEF("showBeingPopup", false); - AddDEF("mouseDirectionMove", true); - AddDEF("showScreenKeyboard", true); - AddDEF("fpslimit", 100); - AddDEF("showChatColorsList", false); - AddDEF("customcursor", false); - AddDEF("showDidYouKnow", false); - AddDEF("longmouseclick", true); -#else // ANDROID - - AddDEF("screenwidth", defaultScreenWidth); - AddDEF("screenheight", defaultScreenHeight); - AddDEF("showScreenJoystick", false); - AddDEF("showScreenButtons", false); - AddDEF("showBeingPopup", true); - AddDEF("mouseDirectionMove", false); - AddDEF("showScreenKeyboard", false); - AddDEF("fpslimit", 60); - AddDEF("showChatColorsList", true); - AddDEF("customcursor", true); - AddDEF("showDidYouKnow", true); - AddDEF("longmouseclick", false); -#endif // ANDROID - - AddDEF("theme", "jewelry"); - AddDEF("showEmotesButton", true); - AddDEF("screen", false); - AddDEF("hwaccel", false); - AddDEF("sound", false); - AddDEF("sfxVolume", 100); - AddDEF("musicVolume", 60); - AddDEF("remember", false); - AddDEF("username", ""); - AddDEF("lastCharacter", ""); - AddDEF("altfpslimit", 5); - AddDEF("updatehost", ""); - AddDEF("screenshotDirectory3", ""); - AddDEF("useScreenshotDirectorySuffix", true); - AddDEF("screenshotDirectorySuffix", ""); - AddDEF("EnableSync", false); - AddDEF("joystickEnabled", false); - AddDEF("upTolerance", 100); - AddDEF("downTolerance", 100); - AddDEF("leftTolerance", 100); - AddDEF("rightTolerance", 100); - AddDEF("logNpcInGui", true); - AddDEF("download-music", true); - AddDEF("guialpha", 0.8F); - AddDEF("ChatLogLength", 0); - AddDEF("enableChatLog", true); - AddDEF("whispertab", true); - AddDEF("showownname", true); - AddDEF("showpickupparticle", true); - AddDEF("showpickupchat", true); - AddDEF("ReturnToggles", false); - AddDEF("ScrollLaziness", 16); - AddDEF("ScrollRadius", 0); - AddDEF("ScrollCenterOffsetX", 0); - AddDEF("ScrollCenterOffsetY", 0); - AddDEF("enableMumble", false); - AddDEF("playBattleSound", true); - AddDEF("playGuiSound", true); - AddDEF("playMusic", true); - AddDEF("packetcounters", true); - AddDEF("safemode", false); - AddDEF("font", "fonts/dejavusans.ttf"); - AddDEF("boldFont", "fonts/dejavusans-bold.ttf"); - AddDEF("particleFont", "fonts/dejavusans.ttf"); - AddDEF("helpFont", "fonts/dejavusansmono.ttf"); - AddDEF("secureFont", "fonts/dejavusansmono.ttf"); - AddDEF("japanFont", "fonts/mplus-1p-regular.ttf"); - AddDEF("chinaFont", "fonts/wqy-microhei.ttf"); - AddDEF("npcFont", "fonts/dejavusans.ttf"); - AddDEF("showBackground", true); - AddDEF("enableTradeTab", true); - AddDEF("cyclePlayers", true); - AddDEF("cycleMonsters", true); - AddDEF("cycleNPC", true); - AddDEF("floorItemsHighlight", true); - AddDEF("enableBotCheker", true); - AddDEF("removeColors", true); - AddDEF("showMagicInDebug", true); - AddDEF("allowCommandsInChatTabs", true); - AddDEF("serverMsgInDebug", true); - AddDEF("hideShopMessages", true); - AddDEF("showChatHistory", true); - AddDEF("chatMaxLinesLimit", 40); - AddDEF("chatColor", 0); - AddDEF("showJob", true); - AddDEF("updateOnlineList", true); - AddDEF("targetOnlyReachable", true); - AddDEF("errorsInDebug", true); - AddDEF("tradebot", true); - AddDEF("debugLog", false); - AddDEF("unimplimentedLog", false); - AddDEF("drawHotKeys", true); - AddDEF("serverAttack", true); - AddDEF("autofixPos", false); - AddDEF("alphaCache", true); - AddDEF("attackMoving", true); - AddDEF("attackNext", false); - AddDEF("quickStats", true); - AddDEF("warpParticle", false); - AddDEF("autoShop", false); - AddDEF("enableBattleTab", false); - AddDEF("showBattleEvents", false); - AddDEF("showMobHP", true); - AddDEF("showOwnHP", true); - AddDEF("usePersistentIP", true); - AddDEF("showJobExp", true); - AddDEF("showExtMinimaps", false); - AddDEF("hideChatInput", true); - AddDEF("enableAttackFilter", true); - AddDEF("enablePickupFilter", true); - AddDEF("securetrades", true); - AddDEF("unsecureChars", "IO0@#$"); - AddDEF("currentTip", 0); - AddDEF("useLocalTime", false); - AddDEF("enableAdvert", true); - AddDEF("enableMapReduce", true); - AddDEF("showPlayersStatus", true); - AddDEF("beingopacity", false); - AddDEF("adjustPerfomance", true); - AddDEF("enableAlphaFix", false); - AddDEF("disableAdvBeingCaching", true); - AddDEF("disableBeingCaching", false); - AddDEF("enableReorderSprites", true); - AddDEF("showip", false); - AddDEF("seflMouseHeal", true); - AddDEF("enableLazyScrolling", false); - AddDEF("extMouseTargeting", true); - AddDEF("showMVP", false); - AddDEF("pvpAttackType", 0); - AddDEF("lang", ""); - AddDEF("selectedJoystick", 0); - AddDEF("useInactiveJoystick", false); - AddDEF("testInfo", ""); - AddDEF("enableresize", true); - AddDEF("noframe", false); - AddDEF("groupFriends", true); - AddDEF("grabinput", false); - AddDEF("usefbo", false); - AddDEF("gamma", 1); - AddDEF("vsync", 0); - AddDEF("enableBuggyServers", true); - AddDEF("soundwhisper", "newmessage"); - AddDEF("soundhighlight", "reminder"); - AddDEF("soundglobal", "email"); - AddDEF("sounderror", "error"); - AddDEF("soundtrade", "start"); - AddDEF("soundinfo", "notify"); - AddDEF("soundrequest", "attention"); - AddDEF("soundguild", "newmessage"); - AddDEF("soundshowwindow", "page"); - AddDEF("soundhidewindow", "book"); - AddDEF("autohideButtons", true); - AddDEF("autohideChat", false); - AddDEF("downloadProxy", ""); - AddDEF("downloadProxyType", 0); - AddDEF("downloadProxyTunnel", false); - AddDEF("blur", false); -#if defined(WIN32) || defined(__APPLE__) - AddDEF("centerwindow", true); -#else // defined(WIN32) || defined(__APPLE__) - - AddDEF("centerwindow", false); -#endif // defined(WIN32) || defined(__APPLE__) - - AddDEF("audioFrequency", 44100); - AddDEF("audioChannels", 2); -#ifdef USE_SDL2 - AddDEF("repeateDelay", 500); - AddDEF("repeateInterval", 30); - AddDEF("repeateInterval2", 500); -#else // USE_SDL2 - - AddDEF("repeateDelay", SDL_DEFAULT_REPEAT_DELAY); - AddDEF("repeateInterval", SDL_DEFAULT_REPEAT_INTERVAL); - AddDEF("repeateInterval2", SDL_DEFAULT_REPEAT_DELAY); -#endif // USE_SDL2 - - AddDEF("compresstextures", 0); - AddDEF("rectangulartextures", false); - AddDEF("networksleep", 0); - AddDEF("newtextures", true); - AddDEF("videodetected", false); - AddDEF("hideErased", false); - AddDEF("enableDelayedAnimations", true); - AddDEF("enableCompoundSpriteDelay", true); -#ifdef ANDROID - AddDEF("useAtlases", false); -#else // ANDROID - - AddDEF("useAtlases", true); -#endif // ANDROID - - AddDEF("useTextureSampler", false); - AddDEF("ministatussaved", 0); - AddDEF("allowscreensaver", false); - AddDEF("debugOpenGL", 0); - AddDEF("protectChatFocus", true); -#if defined(__APPLE__) - AddDEF("enableGamma", false); -#else // defined(__APPLE__) - - AddDEF("enableGamma", true); -#endif // defined(__APPLE__) - - AddDEF("logInput", false); - AddDEF("highlightWords", ""); - AddDEF("globalsFilter", "Sagatha"); - AddDEF("selfMouseHeal", true); - AddDEF("serverslistupdate", ""); - AddDEF("fadeoutmusic", true); - AddDEF("screenActionKeyboard", CAST_S32( - InputAction::SHOW_KEYBOARD)); - AddDEF("screenActionButton0", CAST_S32(InputAction::TALK)); - AddDEF("screenActionButton1", CAST_S32( - InputAction::TARGET_ATTACK)); - AddDEF("screenActionButton2", CAST_S32(InputAction::PICKUP)); - AddDEF("screenActionButton3", CAST_S32(InputAction::STOP_SIT)); - AddDEF("screenActionButton4", CAST_S32(InputAction::TARGET_NPC)); - AddDEF("screenActionButton5", CAST_S32( - InputAction::WINDOW_STATUS)); - AddDEF("screenActionButton6", CAST_S32( - InputAction::WINDOW_INVENTORY)); - AddDEF("screenActionButton7", CAST_S32(InputAction::WINDOW_SKILL)); - AddDEF("screenActionButton8", CAST_S32( - InputAction::WINDOW_SOCIAL)); - AddDEF("screenActionButton9", CAST_S32(InputAction::WINDOW_DEBUG)); - AddDEF("screenActionButton10", CAST_S32( - InputAction::CHANGE_TRADE)); - AddDEF("screenActionButton11", CAST_S32(InputAction::DIRECT_DOWN)); - AddDEF("screenButtonsFormat", 0); - AddDEF("autoresizeminimaps", false); - AddDEF("showGuildOnline", false); - AddDEF("showPartyOnline", false); - AddDEF("enableGmTab", true); - AddDEF("gamecount", 0); - AddDEF("rated", false); - AddDEF("weightMsg", true); - AddDEF("enableLangTab", true); - AddDEF("showAllLang", false); - AddDEF("moveNames", false); - AddDEF("uselonglivesprites", false); - AddDEF("uselonglivesounds", true); - AddDEF("screenDensity", 0); - AddDEF("cfgver", 14); - AddDEF("enableDebugLog", false); - AddDEF("doubleClick", true); - AddDEF("useDiagonalSpeed", true); - AddDEF("protectedItems", ""); - AddDEF("inventorySortOrder", 0); - AddDEF("storageSortOrder", 0); - AddDEF("cartSortOrder", 0); - AddDEF("buySortOrder", 0); - AddDEF("showmotd", false); - AddDEF("playMapAnimations", true); - AddDEF("usepets", true); - AddDEF("scale", 1); - AddDEF("addwatermark", true); - AddDEF("hidesupport", false); - AddDEF("showserverpos", false); - AddDEF("textureSize", "1024,1024,1024,1024,1024,1024"); - AddDEF("ignorelogpackets", ""); - AddDEF("disableLoggingInGame", false); - AddDEF("sellShopName", "unnamed"); - AddDEF("showBadges", BadgeDrawType::Top); - AddDEF("tradescreenshot", false); - AddDEF("skillAutotarget", true); - AddDEF("logPlayerActions", false); - AddDEF("enableGuiOpacity", true); - AddDEF("enableTradeFilter", true); - AddDEF("enableIdCollecting", false); - AddDEF("checkOpenGLVersion", true); - AddDEF("openglContext", false); - AddDEF("allowMoveByMouse", true); - AddDEF("enableDSA", true); - AddDEF("blockAltTab", true); - AddDEF("sdlLogLevel", 0); - AddDEF("allowHighDPI", false); - AddDEF("sdlDriver", ""); - AddDEF("parallelAudioChannels", 16); -} - -void setConfigDefaults2(Configuration &cfg) -{ - logger->log("Add config default values to configuration %s", - cfg.getFileName().c_str()); - DefaultsData &configData = cfg.getDefaultValues(); - const int density = graphicsManager.getDensity(); - int size = 12; - int buttonSize = 1; - switch (density) - { - case DENSITY_LOW: - case DENSITY_MEDIUM: - buttonSize = 1; - break; - case DENSITY_TV: - size = 14; - buttonSize = 1; - break; - case DENSITY_HIGH: - size = 16; - buttonSize = 2; - break; - case DENSITY_XHIGH: - size = 18; - buttonSize = 3; - break; - case DENSITY_XXHIGH: - size = 20; - buttonSize = 3; - break; - default: - break; - } - AddDEF("fontSize", size); - AddDEF("npcfontSize", size + 1); - if (mainGraphics->getHeight() < 480) - { - AddDEF("screenButtonsSize", 0); - AddDEF("screenJoystickSize", 0); - } - else - { - AddDEF("screenButtonsSize", buttonSize); - AddDEF("screenJoystickSize", buttonSize); - } -} - -void setBrandingDefaults(Configuration &cfg) -{ - logger->log("Set branding default values to configuration %s", - cfg.getFileName().c_str()); - cfg.cleanDefaults(); - DefaultsData &configData = cfg.getDefaultValues(); - AddDEF("wallpapersPath", ""); - AddDEF("wallpapersFile", ""); - AddDEF("appName", "ManaPlus"); - AddDEF("appIcon", "icons/manaplus"); - AddDEF("loginMusic", "keprohm.ogg"); - AddDEF("defaultServer", ""); - AddDEF("defaultPort", DEFAULT_PORT); - AddDEF("defaultServerType", "tmwathena"); - AddDEF("onlineServerList", - "http://manaplus.org/serverlist.xml"); - AddDEF("onlineServerList2", - "http://www.manaplus.org/serverlist.xml"); - AddDEF("onlineServerFile", "serverlistplus.xml"); - AddDEF("appShort", "mana"); - AddDEF("screenshots", "ManaPlus"); - AddDEF("defaultUpdateHost", ""); - AddDEF("helpPath", ""); - AddDEF("tagsPath", ""); - AddDEF("theme", ""); - AddDEF("font", "fonts/dejavusans.ttf"); - AddDEF("boldFont", "fonts/dejavusans-bold.ttf"); - AddDEF("particleFont", "fonts/dejavusans.ttf"); - AddDEF("helpFont", "fonts/dejavusansmono.ttf"); - AddDEF("secureFont", "fonts/dejavusansmono.ttf"); - AddDEF("npcFont", "fonts/dejavusans.ttf"); - AddDEF("japanFont", "fonts/mplus-1p-regular.ttf"); - AddDEF("chinaFont", "fonts/wqy-microhei.ttf"); - - AddDEF("guiPath", "graphics/gui/"); - AddDEF("guiThemePath", "themes/"); - AddDEF("fontsPath", "fonts/"); - - AddDEF("systemsounds", "sfx/system/"); - - AddDEF("wallpaperFile", ""); - AddDEF("dataPath", ""); - - AddDEF("androidDownloadUrl", "https://play.google.com/store/apps/details" - "?id=org.evolonline.beta.manaplus"); - AddDEF("androidDownloadText", "Google Play"); - AddDEF("otherDownloadUrl", "http://manaplus.org/"); - AddDEF("otherDownloadText", "http://manaplus.org/"); - AddDEF("windowsDownloadUrl", "http://download.manaplus.org/" - "manaplus/download/manaplus-win32.exe"); - AddDEF("windowsDownloadText", "download here"); - AddDEF("updateMirror1", "http://manaplus.org/update/"); - AddDEF("updateMirror2", "http://www.manaplus.org/update/"); - AddDEF("updateMirror3", "http://www2.manaplus.org/update/"); - AddDEF("updateMirror4", "http://www3.manaplus.org/update/"); - AddDEF("updateMirror5", ""); - AddDEF("updateMirror6", ""); - AddDEF("updateMirror7", ""); -} - -void setPathsDefaults(Configuration &cfg) -{ - logger->log("Set path default values to configuration %s", - cfg.getFileName().c_str()); - cfg.cleanDefaults(); - DefaultsData &configData = cfg.getDefaultValues(); - AddDEF("itemIcons", "graphics/items/"); - AddDEF("unknownItemFile", "unknown-item.png"); - AddDEF("sprites", "graphics/sprites/"); - AddDEF("spriteErrorFile", "error.xml"); - AddDEF("guiIcons", "graphics/guiicons/"); - AddDEF("shaders", "graphics/shaders/"); - AddDEF("help", "help/"); - AddDEF("tags", "help/idx/"); - AddDEF("badges", "graphics/badges/"); - - AddDEF("simpleVertexShader", "simple_vertex.glsl"); - AddDEF("simpleFragmentShader", "simple_frag.glsl"); - AddDEF("gles2VertexShader", "gles2_vertex.glsl"); - AddDEF("gles2FragmentShader", "gles2_frag.glsl"); - - AddDEF("particles", "graphics/particles/"); - AddDEF("portalEffectFile", "warparea.particle.xml"); - AddDEF("effectId", -1); - AddDEF("hitEffectId", 26); - AddDEF("missEffectId", -1); - AddDEF("criticalHitEffectId", 28); - AddDEF("afkEffectId", -1); - AddDEF("newQuestEffectId", -1); - AddDEF("completeQuestEffectId", -1); - AddDEF("skillLevelUpEffectId", -1); - AddDEF("skillRemoveEffectId", -1); - AddDEF("skillSrcEffectId", -1); - AddDEF("skillDstEffectId", -1); - AddDEF("skillCastingSrcEffectId", -1); - AddDEF("skillCastingDstEffectId", -1); - AddDEF("skillCastingGroundEffectId", -1); - AddDEF("skillHitEffectId", -1); - AddDEF("skillMissEffectId", -1); - - AddDEF("spiritEffectId", -1); - - AddDEF("minimaps", "graphics/minimaps/"); - AddDEF("maps", "maps/"); - AddDEF("sfx", "sfx/"); - AddDEF("music", "music/"); - - AddDEF("wallpapers", "graphics/images/"); - AddDEF("wallpaperFile", "login_wallpaper.png"); - - AddDEF("statusEffectsFile", "status-effects.xml"); - AddDEF("statusEffectsPatchFile", "status-effects_patch.xml"); - AddDEF("statusEffectsPatchDir", "status-effects.d"); - AddDEF("effectsFile", "effects.xml"); - AddDEF("effectsPatchFile", "effects_patch.xml"); - AddDEF("effectsPatchDir", "effects.d"); - AddDEF("unitsFile", "units.xml"); - AddDEF("unitsPatchFile", "units_patch.xml"); - AddDEF("unitsPatchDir", "units.d"); - AddDEF("featuresFile", "features.xml"); - AddDEF("questsFile", "quests.xml"); - AddDEF("questsPatchFile", "quests_patch.xml"); - AddDEF("questsPatchDir", "quests.d"); - AddDEF("skillsFile", "skills.xml"); - AddDEF("skillsPatchFile", "skills_patch.xml"); - AddDEF("skillsPatchDir", "skills.d"); - AddDEF("skillsFile2", "ea-skills.xml"); - AddDEF("equipmentWindowFile", "equipmentwindow.xml"); - AddDEF("emotesFile", "emotes.xml"); - AddDEF("emotesPatchFile", "emotes_patch.xml"); - AddDEF("emotesPatchDir", "emotes.d"); - AddDEF("hairColorFile", "hair.xml"); - AddDEF("hairColorPatchFile", "hair_patch.xml"); - AddDEF("hairColorPatchDir", "hair.d"); - AddDEF("horsesFile", "horses.xml"); - AddDEF("horsesPatchFile", "horses_patch.xml"); - AddDEF("horsesPatchDir", "horses.d"); - AddDEF("itemColorsFile", "itemcolors.xml"); - AddDEF("itemColorsPatchFile", "itemcolors_patch.xml"); - AddDEF("itemColorsPatchDir", "itemcolors.d"); - AddDEF("charCreationFile", "charcreation.xml"); - AddDEF("soundsFile", "sounds.xml"); - AddDEF("soundsPatchFile", "sounds_patch.xml"); - AddDEF("soundsPatchDir", "sounds.d"); - AddDEF("itemsFile", "items.xml"); - AddDEF("itemsPatchFile", "items_patch.xml"); - AddDEF("itemsPatchDir", "items.d"); - AddDEF("itemFieldsFile", "itemfields.xml"); - AddDEF("itemFieldsPatchFile", "itemfields_patch.xml"); - AddDEF("itemFieldsPatchDir", "itemfields.d"); - AddDEF("itemOptionsFile", "itemoptions.xml"); - AddDEF("itemOptionsPatchFile", "itemoptions_patch.xml"); - AddDEF("itemOptionsPatchDir", "itemoptions.d"); - AddDEF("avatarsFile", "avatars.xml"); - AddDEF("avatarsPatchFile", "avatars_patch.xml"); - AddDEF("avatarsPatchDir", "avatars.d"); - AddDEF("modsFile", "mods.xml"); - AddDEF("modsPatchFile", "mods_patch.xml"); - AddDEF("modsPatchDir", "mods.d"); - AddDEF("npcsFile", "npcs.xml"); - AddDEF("npcsPatchFile", "npcs_patch.xml"); - AddDEF("npcsPatchDir", "npcs.d"); - AddDEF("petsFile", "pets.xml"); - AddDEF("petsPatchFile", "pets_patch.xml"); - AddDEF("petsPatchDir", "pets.d"); - AddDEF("monstersFile", "monsters.xml"); - AddDEF("monstersPatchFile", "monsters_patch.xml"); - AddDEF("monstersPatchDir", "monsters.d"); - AddDEF("mercenariesFile", "mercenaries.xml"); - AddDEF("mercenariesPatchFile", "mercenaries_patch.xml"); - AddDEF("mercenariesPatchDir", "mercenaries.d"); - AddDEF("homunculusesFile", "homunculuses.xml"); - AddDEF("homunculusesPatchFile", "homunculuses_patch.xml"); - AddDEF("homunculusesPatchDir", "homunculuses.d"); - AddDEF("skillUnitsFile", "skillunits.xml"); - AddDEF("skillUnitsPatchFile", "skillunits_patch.xml"); - AddDEF("skillUnitsPatchDir", "skillunits.d"); - AddDEF("elementalsFile", "elementals.xml"); - AddDEF("elementalsPatchFile", "elementals_patch.xml"); - AddDEF("elementalsPatchDir", "elementals.d"); - AddDEF("mapsRemapFile", "maps/remap.xml"); - AddDEF("mapsRemapPatchFile", "maps/remap_patch.xml"); - AddDEF("mapsRemapPatchDir", "maps/remap.d"); - AddDEF("mapsFile", "maps.xml"); - AddDEF("mapsPatchFile", "maps_patch.xml"); - AddDEF("mapsPatchDir", "maps.d"); - AddDEF("npcDialogsFile", "npcdialogs.xml"); - AddDEF("npcDialogsPatchFile", "npcdialogs_patch.xml"); - AddDEF("npcDialogsPatchDir", "npcdialogs.d"); - AddDEF("deadMessagesFile", "deadmessages.xml"); - AddDEF("deadMessagesPatchFile", "deadmessages_patch.xml"); - AddDEF("deadMessagesPatchDir", "deadmessages.d"); - AddDEF("defaultCommandsFile", "defaultcommands.xml"); - AddDEF("defaultCommandsPatchFile", "defaultcommands_patch.xml"); - AddDEF("defaultCommandsPatchDir", "defaultcommands.d"); - AddDEF("badgesFile", "badges.xml"); - AddDEF("badgesPatchFile", "badges_patch.xml"); - AddDEF("badgesPatchDir", "badges.d"); - AddDEF("languagesFile", "languages.xml"); - AddDEF("languagesPatchFile", "languages_patch.xml"); - AddDEF("languagesPatchDir", "languages.d"); - AddDEF("textsFile", "texts.xml"); - AddDEF("textsPatchFile", "texts_patch.xml"); - AddDEF("textsPatchDir", "texts.d"); - AddDEF("networkFile", "network.xml"); - AddDEF("networkPatchFile", "network_patch.xml"); - AddDEF("networkPatchDir", "network.d"); - AddDEF("statFile", "stats.xml"); - AddDEF("statPatchFile", "stats_patch.xml"); - AddDEF("statPatchDir", "stats.d"); - AddDEF("groupsFile", "groups.xml"); - AddDEF("groupsPatchFile", "groups_patch.xml"); - AddDEF("groupsPatchDir", "groups.d"); - AddDEF("equipmentSlotsFile", "equipmentslots.xml"); - AddDEF("weaponsFile", "weapons.xml"); - AddDEF("poisonEffectName", "poison"); - AddDEF("cartEffectName", "cart"); - AddDEF("ridingEffectName", "riding"); - AddDEF("trickDeadEffectName", "trick dead"); - AddDEF("postDelayName", "post delay"); - AddDEF("gmTabMinimalLevel", "2"); - AddDEF("team1badge", "team1.xml"); - AddDEF("team2badge", "team2.xml"); - AddDEF("team3badge", "team3.xml"); - AddDEF("gmbadge", "gm.xml"); - AddDEF("shopbadge", "shop.xml"); - AddDEF("inactivebadge", "inactive.xml"); - AddDEF("awaybadge", "away.xml"); - AddDEF("cutInsDir", "graphics/cutins"); - AddDEF("gmCommandSymbol", "@"); - AddDEF("gmCharCommandSymbol", "#"); - AddDEF("linkCommandSymbol", "="); - AddDEF("emptyAtlasName", "ignored"); - AddDEF("skillCastingAnimation", ""); - AddDEF("languageIcons", "graphics/badges/flags"); - AddDEF("palettesDir", ""); - AddDEF("defaultPaletteFile", "palette.gpl"); - AddDEF("unknownSkillIcon", "graphics/sprites/error.png"); - AddDEF("attackSkillIcon", "graphics/sprites/error.png"); - AddDEF("groundSkillIcon", "graphics/sprites/error.png"); - AddDEF("selfSkillIcon", "graphics/sprites/error.png"); - AddDEF("unusedSkillIcon", "graphics/sprites/error.png"); - AddDEF("supportSkillIcon", "graphics/sprites/error.png"); - AddDEF("trapSkillIcon", "graphics/sprites/error.png"); - AddDEF("missingSkillIcon", "graphics/sprites/error.png"); - AddDEF("unknownSkillsAutoTab", true); - - AddDEF("overweightPercent", 50); - AddDEF("playerNameOffset", 64); - AddDEF("playerBadgeAtRightOffset", 32); - -#ifdef TMWA_SUPPORT - AddDEF("gmDefaultLevel", 60); -#endif // TMWA_SUPPORT - - AddDEF("enableNewMailSystem", true); -} - -void setFeaturesDefaults(Configuration &cfg) -{ - logger->log("Set features default values to configuration %s", - cfg.getFileName().c_str()); - cfg.cleanDefaults(); - DefaultsData &configData = cfg.getDefaultValues(); - AddDEF("languageTab", false); - AddDEF("allowFollow", true); - AddDEF("fixDeadAnimation", true); - AddDEF("forceAccountGender", -1); - AddDEF("forceCharGender", -1); -} - -#undef AddDEF diff --git a/src/defaults.h b/src/defaults.h deleted file mode 100644 index f38c13ee1..000000000 --- a/src/defaults.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef DEFAULTS_H -#define DEFAULTS_H - -#include -#include - -#include "localconsts.h" - -class Configuration; -class VariableData; - -typedef std::map DefaultsData; - -VariableData* createData(const int defData) A_WARN_UNUSED; -VariableData* createData(const double defData) A_WARN_UNUSED; -VariableData* createData(const float defData) A_WARN_UNUSED; -VariableData* createData(const std::string &defData) A_WARN_UNUSED; -VariableData* createData(const char *const defData) A_WARN_UNUSED; -VariableData* createData(const bool defData) A_WARN_UNUSED; -void setConfigDefaults(Configuration &cfg); -void setConfigDefaults2(Configuration &cfg); -void setBrandingDefaults(Configuration &cfg); -void setPathsDefaults(Configuration &cfg); -void setFeaturesDefaults(Configuration &cfg); - -#endif // DEFAULTS_H diff --git a/src/dirs.cpp b/src/dirs.cpp deleted file mode 100644 index 004e1fdb4..000000000 --- a/src/dirs.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "dirs.h" - -#include "client.h" -#include "configuration.h" -#include "logger.h" -#include "main.h" -#include "settings.h" - -#include "fs/mkdir.h" -#include "fs/paths.h" - -#include "fs/virtfs/fs.h" - -#include "utils/base64.h" -#if defined(__native_client__) || (defined(ANDROID) && defined(USE_SDL2)) -#include "fs/files.h" -#endif // defined(__native_client__) || (defined(ANDROID) && - // defined(USE_SDL2)) - -#include "utils/cast.h" -#include "utils/gettext.h" - -#ifdef ANDROID -#ifdef USE_SDL2 -#include "main.h" - -#include "render/graphics.h" -#endif // USE_SDL2 -#endif // ANDROID - -#ifdef __APPLE__ -#include -#endif // __APPLE__ - -#ifdef WIN32 -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) -#include "fs/specialfolder.h" -#undef ERROR -#endif // WIN32 - -#include - -#include - -#include "debug.h" - -#if defined __native_client__ -#define _nacl_dir std::string("/persistent/manaplus") -#endif // defined __native_client__ - -#ifdef ANDROID -#ifdef USE_SDL2 - -int loadingProgressCounter = 1; - -static void updateProgress(int cnt) -{ - const int progress = cnt + loadingProgressCounter; - const int h = mainGraphics->mHeight; - mainGraphics->setColor(Color(255, 255, 255)); - const int maxSize = mainGraphics->mWidth - 100; - const int width = maxSize * progress / 50; - mainGraphics->fillRectangle(Rect(50, h - 100, width, 50)); - mainGraphics->updateScreen(); -} - -void Dirs::setProgress() -{ - loadingProgressCounter++; - updateProgress(loadingProgressCounter); -} - -static void resetProgress() -{ - loadingProgressCounter = 0; - updateProgress(loadingProgressCounter); -} - -void extractAssets() -{ - if (!getenv("APPDIR")) - { - logger->log("error: APPDIR is not set!"); - return; - } - const std::string fileName = pathJoin(getenv("APPDIR"), - "data.zip"); - logger->log("Extracting asset into: " + fileName); - uint8_t *buf = new uint8_t[1000000]; - - FILE *const file = fopen(fileName.c_str(), "w"); - for (int f = 0; f < 100; f ++) - { - std::string part = strprintf("manaplus-data.zip%u%u", - CAST_U32(f / 10), - CAST_U32(f % 10)); - logger->log("testing asset: " + part); - SDL_RWops *const rw = SDL_RWFromFile(part.c_str(), "r"); - if (rw) - { - const int size = SDL_RWsize(rw); - int size2 = SDL_RWread(rw, buf, 1, size); - logger->log("asset size: %d", size2); - fwrite(buf, 1, size2, file); - SDL_RWclose(rw); - Dirs::setProgress(); - } - else - { - break; - } - } - fclose(file); - - const std::string fileName2 = pathJoin(getenv("APPDIR"), - "locale.zip"); - FILE *const file2 = fopen(fileName2.c_str(), "w"); - SDL_RWops *const rw = SDL_RWFromFile("manaplus-locale.zip", "r"); - if (rw) - { - const int size = SDL_RWsize(rw); - int size2 = SDL_RWread(rw, buf, 1, size); - fwrite(buf, 1, size2, file2); - SDL_RWclose(rw); - Dirs::setProgress(); - } - fclose(file2); - - delete [] buf; -} - -#endif // USE_SDL2 -#endif // ANDROID - -void Dirs::updateDataPath() -{ - if (settings.options.dataPath.empty() - && !branding.getStringValue("dataPath").empty()) - { - if (isRealPath(branding.getStringValue("dataPath"))) - { - settings.options.dataPath = branding.getStringValue("dataPath"); - } - else - { - settings.options.dataPath = pathJoin(branding.getDirectory(), - branding.getStringValue("dataPath")); - } - settings.options.skipUpdate = true; - } -} - -void Dirs::extractDataDir() -{ -#if defined(ANDROID) && defined(USE_SDL2) - Files::setCopyCallBack(&updateProgress); - resetProgress(); - extractAssets(); - - const std::string zipName = pathJoin(getenv("APPDIR"), "data.zip"); - const std::string dirName = pathJoin(getenv("APPDIR"), "data"); - VirtFs::mountZip2(zipName, - "data", - Append_false); - VirtFs::mountZip2(zipName, - "data/perserver/default", - Append_false); - Files::extractLocale(); -#endif // defined(ANDROID) && defined(USE_SDL2) -} - -void Dirs::mountDataDir() -{ - VirtFs::mountDirSilent(PKG_DATADIR "data/perserver/default", - Append_false); - VirtFs::mountDirSilent("data/perserver/default", - Append_false); - -#if defined __APPLE__ - CFBundleRef mainBundle = CFBundleGetMainBundle(); - CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); - char path[PATH_MAX]; - if (!CFURLGetFileSystemRepresentation(resourcesURL, - TRUE, - reinterpret_cast(path), - PATH_MAX)) - { - fprintf(stderr, "Can't find Resources directory\n"); - } - CFRelease(resourcesURL); - std::string path2 = pathJoin(path, "data"); - VirtFs::mountDir(pathJoin(path2, "perserver/default"), Append_false); - VirtFs::mountDir(path2, Append_false); -// possible this need for support run client from dmg images. -// mPackageDir = path; -#endif // defined __APPLE__ - - VirtFs::mountDirSilent(PKG_DATADIR "data", Append_false); - setPackageDir(PKG_DATADIR "data"); - VirtFs::mountDirSilent("data", Append_false); - -#ifdef ANDROID -#ifdef USE_SDL2 - if (getenv("APPDIR")) - { - const std::string appDir = getenv("APPDIR"); - VirtFs::mountDir(appDir + "/data", Append_false); - VirtFs::mountDir(appDir + "/data/perserver/default", - Append_false); - } -#endif // USE_SDL2 -#endif // ANDROID - -#if defined __native_client__ - VirtFs::mountZip("/http/data.zip", Append_false); - VirtFs::mountZip2("/http/data.zip", - "perserver/default", - Append_false); -#endif // defined __native_client__ - -#ifndef WIN32 - // Add branding/data to VirtFS search path - if (!settings.options.brandingPath.empty()) - { - std::string path = settings.options.brandingPath; - - // Strip blah.manaplus from the path - const int loc = CAST_S32(path.find_last_of('/')); - - if (loc > 0) - { - VirtFs::mountDir(path.substr( - 0, loc + 1).append("data"), - Append_false); - } - } -#endif // WIN32 -} - -void Dirs::initRootDir() -{ - settings.rootDir = VirtFs::getBaseDir(); - const std::string portableName = settings.rootDir + "portable.xml"; - struct stat statbuf; - - if (stat(portableName.c_str(), &statbuf) == 0 && - S_ISREG(statbuf.st_mode)) - { - std::string dir; - Configuration portable; - portable.init(portableName); - - if (settings.options.brandingPath.empty()) - { - branding.init(portableName); - setBrandingDefaults(branding); - } - - logger->log("Portable file: %s", portableName.c_str()); - - if (settings.options.localDataDir.empty()) - { - dir = portable.getValue("dataDir", ""); - if (!dir.empty()) - { - settings.options.localDataDir = settings.rootDir + dir; - logger->log("Portable data dir: %s", - settings.options.localDataDir.c_str()); - } - } - - if (settings.options.configDir.empty()) - { - dir = portable.getValue("configDir", ""); - if (!dir.empty()) - { - settings.options.configDir = settings.rootDir + dir; - logger->log("Portable config dir: %s", - settings.options.configDir.c_str()); - } - } - - if (settings.options.screenshotDir.empty()) - { - dir = portable.getValue("screenshotDir", ""); - if (!dir.empty()) - { - settings.options.screenshotDir = settings.rootDir + dir; - logger->log("Portable screenshot dir: %s", - settings.options.screenshotDir.c_str()); - } - } - } -} - -/** - * Initializes the home directory. On UNIX and FreeBSD, ~/.mana is used. On - * Windows and other systems we use the current working directory. - */ -void Dirs::initHomeDir() -{ - initLocalDataDir(); - initTempDir(); - initConfigDir(); -} - -void Dirs::initLocalDataDir() -{ - settings.localDataDir = settings.options.localDataDir; - - if (settings.localDataDir.empty()) - { -#ifdef __APPLE__ - // Use Application Directory instead of .mana - settings.localDataDir = pathJoin(VirtFs::getUserDir(), - "Library/Application Support", - branding.getValue("appName", "ManaPlus")); -#elif defined __HAIKU__ - settings.localDataDir = pathJoin(VirtFs::getUserDir(), - "config/data/Mana"); -#elif defined WIN32 - settings.localDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); - if (settings.localDataDir.empty()) - settings.localDataDir = VirtFs::getUserDir(); - settings.localDataDir = pathJoin(settings.localDataDir, - "Mana"); -#elif defined __ANDROID__ - settings.localDataDir = pathJoin(getSdStoragePath(), - branding.getValue("appShort", "ManaPlus"), - "local"); -#elif defined __native_client__ - settings.localDataDir = pathJoin(_nacl_dir, "local"); -#else // __APPLE__ - - settings.localDataDir = pathJoin(VirtFs::getUserDir(), - ".local/share/mana"); -#endif // __APPLE__ - } - - if (mkdir_r(settings.localDataDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), settings.localDataDir.c_str())); - } -#ifdef USE_PROFILER - Perfomance::init(pathJoin(settings.localDataDir, "profiler.log")); -#endif // USE_PROFILER -} - -void Dirs::initTempDir() -{ - settings.tempDir = pathJoin(settings.localDataDir, "temp"); - - if (mkdir_r(settings.tempDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), settings.tempDir.c_str())); - } -// ResourceManager::deleteFilesInDirectory(settings.tempDir); -} - -void Dirs::initConfigDir() -{ - settings.configDir = settings.options.configDir; - - if (settings.configDir.empty()) - { -#ifdef __APPLE__ - settings.configDir = pathJoin(settings.localDataDir, - branding.getValue("appShort", "mana")); -#elif defined __HAIKU__ - settings.configDir = pathJoin(VirtFs::getUserDir(), - "config/settings/Mana", - branding.getValue("appName", "ManaPlus")); -#elif defined WIN32 - settings.configDir = getSpecialFolderLocation(CSIDL_APPDATA); - if (settings.configDir.empty()) - { - settings.configDir = settings.localDataDir; - } - else - { - settings.configDir = pathJoin(settings.configDir, - "mana", - branding.getValue("appShort", "mana")); - } -#elif defined __ANDROID__ - settings.configDir = pathJoin(getSdStoragePath(), - branding.getValue("appShort", "ManaPlus"), - "config"); -#elif defined __native_client__ - settings.configDir = pathJoin(_nacl_dir, "config"); -#else // __APPLE__ - - settings.configDir = pathJoin(VirtFs::getUserDir(), - ".config/mana", - branding.getValue("appShort", "mana")); -#endif // __APPLE__ - - logger->log("Generating config dir: " + settings.configDir); - } - - if (mkdir_r(settings.configDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created! " - "Exiting."), settings.configDir.c_str())); - } -} - -/** - * Parse the update host and determine the updates directory - * Then verify that the directory exists (creating if needed). - */ -void Dirs::initUpdatesDir() -{ - std::stringstream updates; - - // If updatesHost is currently empty, fill it from config file - if (settings.updateHost.empty()) - settings.updateHost = config.getStringValue("updatehost"); - if (!checkPath(settings.updateHost)) - return; - - // Don't go out of range int he next check - if (settings.updateHost.length() < 2) - { - if (settings.updatesDir.empty()) - settings.updatesDir = pathJoin("updates", settings.serverName); - return; - } - - const size_t sz = settings.updateHost.size(); - // Remove any trailing slash at the end of the update host - if (settings.updateHost.at(sz - 1) == '/') - settings.updateHost.resize(sz - 1); - - // Parse out any "http://" or "https://", and set the updates directory - const size_t pos = settings.updateHost.find("://"); - if (pos != std::string::npos) - { - if (pos + 3 < settings.updateHost.length() - && !settings.updateHost.empty()) - { - updates << "updates/" << settings.updateHost.substr(pos + 3); - settings.updatesDir = updates.str(); - } - else - { - logger->log("Error: Invalid update host: %s", - settings.updateHost.c_str()); - // TRANSLATORS: update server initialisation error - errorMessage = strprintf(_("Invalid update host: %s."), - settings.updateHost.c_str()); - client->setState(State::ERROR); - } - } - else - { - logger->log1("Warning: no protocol was specified for the update host"); - updates << "updates/" << settings.updateHost; - settings.updatesDir = updates.str(); - } - -#ifdef WIN32 - if (settings.updatesDir.find(":") != std::string::npos) - replaceAll(settings.updatesDir, ":", "_"); -#endif // WIN32 - - const std::string updateDir("/" + settings.updatesDir); - - // Verify that the updates directory exists. Create if necessary. - if (!VirtFs::isDirectory(updateDir)) - { - if (!VirtFs::mkdir(updateDir)) - { -#if defined WIN32 - std::string newDir = pathJoin(settings.localDataDir, - settings.updatesDir); - if (!CreateDirectory(newDir.c_str(), nullptr) && - GetLastError() != ERROR_ALREADY_EXISTS) - { - logger->log("Error: %s can't be made, but doesn't exist!", - newDir.c_str()); - // TRANSLATORS: update server initialisation error - errorMessage = _("Error creating updates directory!"); - client->setState(State::ERROR); - } -#else // defined WIN32 - - logger->log("Error: %s/%s can't be made, but doesn't exist!", - settings.localDataDir.c_str(), - settings.updatesDir.c_str()); - // TRANSLATORS: update server initialisation error - errorMessage = _("Error creating updates directory!"); - client->setState(State::ERROR); -#endif // defined WIN32 - } - } - const std::string updateLocal = pathJoin(updateDir, "local"); - const std::string updateFix = pathJoin(updateDir, "fix"); - if (!VirtFs::isDirectory(updateLocal)) - VirtFs::mkdir(updateLocal); - if (!VirtFs::isDirectory(updateFix)) - VirtFs::mkdir(updateFix); -} - -void Dirs::initScreenshotDir() -{ - if (!settings.options.screenshotDir.empty()) - { - settings.screenshotDir = settings.options.screenshotDir; - if (mkdir_r(settings.screenshotDir.c_str()) != 0) - { - logger->log(strprintf( - // TRANSLATORS: directory creation error - _("Error: %s doesn't exist and can't be created! " - "Exiting."), settings.screenshotDir.c_str())); - } - } - else if (settings.screenshotDir.empty()) - { -#ifdef __native_client__ - settings.screenshotDir = pathJoin(_nacl_dir, "screenshots/"); -#else // __native_client__ - settings.screenshotDir = decodeBase64String( - config.getStringValue("screenshotDirectory3")); - if (settings.screenshotDir.empty()) - { -#ifdef __ANDROID__ - settings.screenshotDir = getSdStoragePath() - + std::string("/images"); - - if (mkdir_r(settings.screenshotDir.c_str())) - { - logger->log(strprintf( - // TRANSLATORS: directory creation error - _("Error: %s doesn't exist and can't be created! " - "Exiting."), settings.screenshotDir.c_str())); - } -#else // ANDROID - settings.screenshotDir = getPicturesDir(); -#endif // ANDROID - if (config.getBoolValue("useScreenshotDirectorySuffix")) - { - const std::string configScreenshotSuffix = - branding.getValue("screenshots", "ManaPlus"); - - if (!configScreenshotSuffix.empty()) - { - settings.screenshotDir = pathJoin(settings.screenshotDir, - configScreenshotSuffix); - } - } - config.setValue("screenshotDirectory3", - encodeBase64String(settings.screenshotDir)); - } -#endif // __native_client__ - } - logger->log("screenshotDirectory: " + settings.screenshotDir); -} - -void Dirs::initUsersDir() -{ - settings.usersDir = settings.serverConfigDir + "/users/"; - if (mkdir_r(settings.usersDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created!"), - settings.usersDir.c_str())); - } - - settings.npcsDir = settings.serverConfigDir + "/npcs/"; - if (mkdir_r(settings.npcsDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created!"), - settings.npcsDir.c_str())); - } - - settings.usersIdDir = settings.serverConfigDir + "/usersid/"; - if (mkdir_r(settings.usersIdDir.c_str()) != 0) - { - // TRANSLATORS: directory creation error - logger->error(strprintf(_("%s doesn't exist and can't be created!"), - settings.usersIdDir.c_str())); - } -} diff --git a/src/dirs.h b/src/dirs.h deleted file mode 100644 index aa43f34d0..000000000 --- a/src/dirs.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef DIRS_H -#define DIRS_H - -#include "localconsts.h" - -class Dirs final -{ - public: - A_DELETE_COPY(Dirs) - - static void initUsersDir(); - - static void updateDataPath(); - -#if defined(ANDROID) && defined(USE_SDL2) - static void extractDataDir(); -#else // defined(ANDROID) && defined(USE_SDL2) - - static void extractDataDir() A_CONST; -#endif // defined(ANDROID) && defined(USE_SDL2) - - static void mountDataDir(); - - static void initRootDir(); - - static void initHomeDir(); - - static void initLocalDataDir(); - - static void initTempDir(); - - static void initConfigDir(); - - static void initUpdatesDir(); - - static void initScreenshotDir(); - -#ifdef ANDROID -#ifdef USE_SDL2 - static void setProgress(); -#endif // USE_SDL2 -#endif // ANDROID -}; - -#endif // DIRS_H diff --git a/src/dragdrop.h b/src/dragdrop.h deleted file mode 100644 index 76d0c35ce..000000000 --- a/src/dragdrop.h +++ /dev/null @@ -1,266 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef DRAGDROP_H -#define DRAGDROP_H - -#include "resources/item/item.h" - -#include "itemsoundmanager.h" -#include "textcommand.h" - -#include "enums/dragdropsource.h" - -#include "resources/image/image.h" - -#include "resources/skill/skilldata.h" -#include "resources/skill/skillinfo.h" - -#include "localconsts.h" - -class DragDrop final -{ - public: - DragDrop(Item *const item, - const DragDropSourceT source) : - mItemImage(item != nullptr ? item->getImage() : nullptr), - mText(), - mItemData(), - mSource(source), - mItem(item != nullptr ? item->getId() : 0), - mSelItem(0), - mTag(-1), - mItemColor(item != nullptr ? item->getColor() : ItemColor_one), - mSelItemColor(ItemColor_one) - { - if (mItemImage != nullptr) - mItemImage->incRef(); - } - - A_DELETE_COPY(DragDrop) - - ~DragDrop() - { - if (mItemImage != nullptr) - mItemImage->decRef(); - } - - int getItem() const - { return mItem; } - - ItemColor getItemColor() const - { return mItemColor; } - - void setItemColor(const ItemColor color) - { mItemColor = color; } - - Image *getItemImage() - { return mItemImage; } - - void setItemData(const std::string &data) - { mItemData = data; } - - std::string getItemData() - { return mItemData; } - - DragDropSourceT getSource() const - { return mSource; } - - void dragItem(const Item *const item, - const DragDropSourceT source, - const int tag = 0) - { - if (mItemImage != nullptr) - mItemImage->decRef(); - - mItemData.clear(); - mText.clear(); - if (item != nullptr) - { - mItem = item->getId(); - mItemColor = item->getColor(); - mItemImage = item->getImage(); - if (mItemImage != nullptr) - mItemImage->incRef(); - mSource = source; - mTag = tag; - ItemSoundManager::playSfx(item, ItemSoundEvent::TAKE); - } - else - { - mItem = 0; - mItemColor = ItemColor_one; - mItemImage = nullptr; - mSource = DragDropSource::Empty; - mTag = -1; - } - } - - void dragCommand(const TextCommand *const command, - const DragDropSourceT source, - const int tag = 0) - { - if (mItemImage != nullptr) - mItemImage->decRef(); - mItem = 0; - mItemColor = ItemColor_one; - mItemData.clear(); - - if (command != nullptr) - { - mText = command->getSymbol(); - mItemImage = command->getImage(); - if (mItemImage != nullptr) - { - mItemImage->incRef(); - } - else if (mText.empty()) - { - mSource = source; - mTag = -1; - return; - } - mItem = command->getId(); - } - else - { - mText.clear(); - mItemImage = nullptr; - } - mSource = source; - mTag = tag; - } - - void dragSkill(const SkillInfo *const info, - const DragDropSourceT source, - const int tag = 0) - { - if (mItemImage != nullptr) - mItemImage->decRef(); - mItem = 0; - mItemColor = ItemColor_zero; - mText.clear(); - mItemImage = nullptr; - mSource = DragDropSource::Empty; - mTag = -1; - mItemData.clear(); - if (info != nullptr) - { - const SkillData *const data = info->data; - if (data != nullptr) - { - mText = data->name; - mItemImage = data->icon; - if (mItemImage != nullptr) - mItemImage->incRef(); - mSource = source; - mTag = tag; - } - mItem = info->id; - mItemColor = fromInt(info->customSelectedLevel, - ItemColor); - } - } - - void clear() - { - if (mItemImage != nullptr) - mItemImage->decRef(); - mItem = 0; - mItemColor = ItemColor_one; - mItemImage = nullptr; - mSource = DragDropSource::Empty; - mText.clear(); - mItemData.clear(); - mTag = -1; - } - - bool isEmpty() const - { return mSource == DragDropSource::Empty; } - - void select(const Item *const item) - { - if (item != nullptr) - { - mSelItem = item->getId(); - mSelItemColor = item->getColor(); - } - else - { - mSelItem = 0; - mSelItemColor = ItemColor_one; - } - } - - void deselect() - { - mSelItem = 0; - mSelItemColor = ItemColor_one; - } - - int getSelected() const - { return mSelItem; } - - ItemColor getSelectedColor() const - { return mSelItemColor; } - - bool isSelected() const - { return mSelItem > 0; } - - void clearItem(const Item *const item A_UNUSED) - { - } - - const std::string &getText() const - { return mText; } - - int getTag() const - { return mTag; } - - void setItem(const int item) - { mItem = item; } - - bool isSourceItemContainer() const - { - return mSource == DragDropSource::Inventory - || mSource == DragDropSource::Storage - || mSource == DragDropSource::Cart - || mSource == DragDropSource::Craft - || mSource == DragDropSource::Trade - || mSource == DragDropSource::Outfit - || mSource == DragDropSource::Ground - || mSource == DragDropSource::Drop; - } - - private: - Image *mItemImage; - std::string mText; - std::string mItemData; - DragDropSourceT mSource; - int mItem; - int mSelItem; - int mTag; - ItemColor mItemColor; - ItemColor mSelItemColor; -}; - -extern DragDrop dragDrop; - -#endif // DRAGDROP_H diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp deleted file mode 100644 index 79886293f..000000000 --- a/src/effectmanager.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Fate - * Copyright (C) 2008 Chuck Miller - * Copyright (C) 2011-2017 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 . - */ - -#include "effectmanager.h" - -#include "configuration.h" -#include "soundmanager.h" - -#include "being/being.h" - -#include "utils/checkutils.h" - -#include "particle/particle.h" - -#include "resources/beingcommon.h" - -#include "debug.h" - -EffectManager *effectManager = nullptr; - -EffectManager::EffectManager() : - mEffects(), - mTimers() -{ - logger->log1("Effects are now loading"); - loadXmlFile(paths.getStringValue("effectsFile"), SkipError_false); - loadXmlFile(paths.getStringValue("effectsPatchFile"), SkipError_true); - loadXmlDir("effectsPatchDir", loadXmlFile); -} - -void EffectManager::loadXmlFile(const std::string &fileName, - const SkipError skipError) -{ - XML::Document doc(fileName, UseVirtFs_true, skipError); - XmlNodeConstPtrConst root = doc.rootNode(); - - if ((root == nullptr) || - !xmlNameEqual(root, "being-effects")) - { - logger->log("Error loading being effects file: " + fileName); - return; - } - - for_each_xml_child_node(node, root) - { - if (xmlNameEqual(node, "include")) - { - const std::string name = XML::getProperty(node, "name", ""); - if (!name.empty()) - loadXmlFile(name, skipError); - continue; - } - else if (xmlNameEqual(node, "effect")) - { - mEffects.push_back(EffectDescription( - XML::getProperty(node, "id", -1), - XML::getProperty(node, "particle", ""), - XML::getProperty(node, "audio", ""), - XML::getProperty(node, "sprite", ""))); - } - } -} - -EffectManager::~EffectManager() -{ -} - -bool EffectManager::triggerDirection(const int id, - Being *const being, - const SpriteDirection::Type &direction) -{ - int rotation; - switch (direction) - { - case SpriteDirection::DOWN: - case SpriteDirection::DOWNRIGHT: - case SpriteDirection::DOWNLEFT: - case SpriteDirection::DEFAULT: - case SpriteDirection::INVALID: - default: - rotation = 0; - break; - case SpriteDirection::LEFT: - rotation = 90; - break; - case SpriteDirection::UP: - case SpriteDirection::UPRIGHT: - case SpriteDirection::UPLEFT: - rotation = 180; - break; - case SpriteDirection::RIGHT: - rotation = 270; - break; - } - - return trigger(id, being, rotation); -} - -bool EffectManager::trigger(const int id, - Being *const being, - const int rotation) -{ - if ((being == nullptr) || (particleEngine == nullptr) || id == -1) - return false; - - BLOCK_START("EffectManager::trigger") - bool rValue = false; - FOR_EACH (STD_VECTOR::const_iterator, i, mEffects) - { - const EffectDescription &effect = *i; - if (effect.id == id) - { - rValue = true; - if (!effect.gfx.empty()) - { - Particle *const selfFX = particleEngine->addEffect( - effect.gfx, 0, 0, rotation); - being->controlAutoParticle(selfFX); - } - if (!effect.sfx.empty()) - soundManager.playSfx(effect.sfx); - if (!effect.sprite.empty()) - being->addEffect(effect.sprite); - return rValue; - } - } - reportAlways("Missing effect %d", id); - BLOCK_END("EffectManager::trigger") - return rValue; -} - -Particle *EffectManager::triggerReturn(const int id, - Being *const being, - const int rotation) -{ - if ((being == nullptr) || (particleEngine == nullptr) || id == -1) - return nullptr; - - Particle *rValue = nullptr; - FOR_EACH (STD_VECTOR::const_iterator, i, mEffects) - { - const EffectDescription &effect = *i; - if (effect.id == id) - { - if (!effect.gfx.empty()) - { - rValue = particleEngine->addEffect( - effect.gfx, 0, 0, rotation); - being->controlCustomParticle(rValue); - } - if (!effect.sfx.empty()) - soundManager.playSfx(effect.sfx); - if (!effect.sprite.empty()) - being->addEffect(effect.sprite); - return rValue; - } - } - reportAlways("Missing effect %d", id); - return rValue; -} - -bool EffectManager::trigger(const int id, - const int x, const int y, - const time_t endTime, - const int rotation) -{ - if ((particleEngine == nullptr) || id == -1) - return false; - - bool rValue = false; - FOR_EACH (STD_VECTOR::const_iterator, i, mEffects) - { - const EffectDescription &effect = *i; - if (effect.id == id) - { - rValue = true; - if (!effect.gfx.empty()) - { - Particle *const particle = particleEngine->addEffect( - effect.gfx, - x, y, - rotation); - if (particle != nullptr) - mTimers.push_back(ParticleTimer(particle, endTime)); - } - if (!effect.sfx.empty()) - soundManager.playSfx(effect.sfx); - return rValue; - } - } - reportAlways("Missing effect %d", id); - return rValue; -} - -void EffectManager::triggerDefault(int effectId, - Being *const being, - const int defaultEffectId) -{ - if (effectId == -1) - effectId = defaultEffectId; - if (effectId == -1) - return; - trigger(effectId, being); -} - -void EffectManager::triggerDefault(int effectId, - const int x, - const int y, - const time_t endTime, - const int defaultEffectId) -{ - if (effectId == -1) - effectId = defaultEffectId; - if (effectId == -1) - return; - trigger(effectId, x, y, endTime); -} - -void EffectManager::logic() -{ - const time_t time = cur_time; - bool found(true); - while (found) - { - found = false; - FOR_EACH (std::list::iterator, it, mTimers) - { - const ParticleTimer &timer = *it; - if (timer.endTime < time) - { - found = true; - Particle *const particle = timer.particle; - if (particle != nullptr) - particle->kill(); - mTimers.erase(it); - break; - } - } - } -} - -void EffectManager::clear() -{ - FOR_EACH (std::list::iterator, it, mTimers) - { - Particle *const particle = (*it).particle; - if (particle != nullptr) - particle->kill(); - } - mTimers.clear(); -} diff --git a/src/effectmanager.h b/src/effectmanager.h deleted file mode 100644 index 5882e6933..000000000 --- a/src/effectmanager.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Fate - * Copyright (C) 2008 Chuck Miller - * Copyright (C) 2011-2017 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 . - */ - -#ifndef EFFECTMANAGER_H -#define EFFECTMANAGER_H - -#include "enums/resources/spritedirection.h" - -#include "enums/simpletypes/skiperror.h" - -#include "utils/vector.h" - -#include "particle/particletimer.h" - -#include "resources/effectdescription.h" - -#include - -#include "localconsts.h" - -class Being; -class Particle; - -class EffectManager final -{ - public: - EffectManager(); - - A_DELETE_COPY(EffectManager) - - ~EffectManager(); - - void loadXmlFile(const std::string &fileName, - const SkipError skipError); - - /** - * Triggers a effect with the id, at - * the specified being. - */ - bool trigger(const int id, - Being *const being, - const int rotation = 0); - - bool triggerDirection(const int id, - Being *const being, - const SpriteDirection::Type &direction); - - Particle *triggerReturn(const int id, - Being *const being, - const int rotation = 0); - - /** - * Triggers a effect with the id, at - * the specified x and y coordinate. - */ - bool trigger(const int id, - const int x, const int y, - const time_t endTime, - const int rotation = 0); - - void triggerDefault(int effectId, - Being *const being, - const int defaultEffectId); - - void triggerDefault(int effectId, - const int x, - const int y, - const time_t endTime, - const int defaultEffectId); - - void logic(); - - void clear(); - - private: - STD_VECTOR mEffects; - std::list mTimers; -}; - -extern EffectManager *effectManager; - -#endif // EFFECTMANAGER_H diff --git a/src/enums/being/actortype.h b/src/enums/being/actortype.h deleted file mode 100644 index f820902be..000000000 --- a/src/enums/being/actortype.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_ACTORTYPE_H -#define ENUMS_BEING_ACTORTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ActorType) -{ - Unknown = 0, - Player, - Npc, - Monster, - FloorItem, - Portal, - Avatar, - Pet, - Mercenary, - Homunculus, - SkillUnit, - Elemental -} -enumEnd(ActorType); - -#endif // ENUMS_BEING_ACTORTYPE_H diff --git a/src/enums/being/attacktype.h b/src/enums/being/attacktype.h deleted file mode 100644 index ad07f531a..000000000 --- a/src/enums/being/attacktype.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_ATTACKTYPE_H -#define ENUMS_BEING_ATTACKTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(AttackType) -{ - HIT = 0, - PICKUP = 1, - SIT = 2, - STAND = 3, - REFLECT = 4, - SPLASH = 5, - SKILL = 6, - REPEATE = 7, - MULTI = 8, - MULTI_REFLECT = 9, - CRITICAL = 10, - FLEE = 11, - TOUCH_SKILL = 12, - MISS = 0xffff, // pseudo value for miss attacks - SKILLMISS // pseudo value for skill miss attacks -} -enumEnd(AttackType); - -#endif // ENUMS_BEING_ATTACKTYPE_H diff --git a/src/enums/being/attributes.h b/src/enums/being/attributes.h deleted file mode 100644 index bb9432137..000000000 --- a/src/enums/being/attributes.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_ATTRIBUTES_H -#define ENUMS_BEING_ATTRIBUTES_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Attributes) -{ - // player attributes - PLAYER_BASE_LEVEL = 0, - PLAYER_HP, - PLAYER_MAX_HP, - PLAYER_MP, - PLAYER_MAX_MP, - PLAYER_EXP, - PLAYER_EXP_NEEDED, - MONEY, - TOTAL_WEIGHT, - MAX_WEIGHT, - PLAYER_JOB_LEVEL = 10, - PLAYER_STR = 13, - PLAYER_AGI = 14, - PLAYER_VIT = 15, - PLAYER_INT = 16, - PLAYER_DEX = 17, - PLAYER_LUK = 18, - PLAYER_SKILL_POINTS, - PLAYER_CHAR_POINTS, - PLAYER_CORR_POINTS, - PLAYER_ATTACK_DELAY = 100, - PLAYER_ATTACK_RANGE = 101, - PLAYER_WALK_SPEED = 102, - PLAYER_ATTACK_SPEED = 103, - PLAYER_KARMA, - PLAYER_MANNER, - PLAYER_CRIT, - PLAYER_FLEE, - PLAYER_HIT, - PLAYER_MDEF, - PLAYER_MATK, - PLAYER_DEF, - PLAYER_ATK, - CART_TOTAL_WEIGHT = 1000, - CART_MAX_WEIGHT, - PLAYER_JOB_EXP, - PLAYER_JOB_EXP_NEEDED, - - // homunculus attributes - HOMUN_LEVEL, - HOMUN_HP, - HOMUN_MAX_HP, - HOMUN_MP, - HOMUN_MAX_MP, - HOMUN_EXP, - HOMUN_EXP_NEEDED, - HOMUN_SKILL_POINTS, - HOMUN_ATTACK_DELAY, - HOMUN_ATTACK_RANGE, - HOMUN_ATTACK_SPEED, - HOMUN_CRIT, - HOMUN_FLEE, - HOMUN_HIT, - HOMUN_MDEF, - HOMUN_MATK, - HOMUN_DEF, - HOMUN_ATK, - - // mercenary attributes - MERC_LEVEL, - MERC_HP, - MERC_MAX_HP, - MERC_MP, - MERC_MAX_MP, - MERC_ATTACK_DELAY, - MERC_ATTACK_RANGE, - MERC_ATTACK_SPEED, - MERC_CRIT, - MERC_FLEE, - MERC_HIT, - MERC_MDEF, - MERC_MATK, - MERC_DEF, - MERC_ATK, - MERC_EXPIRE, - MERC_FAITH, - MERC_CALLS, - MERC_KILLS, - - // elemental attributes - ELEMENTAL_HP, - ELEMENTAL_MAX_HP, - ELEMENTAL_MP, - ELEMENTAL_MAX_MP, - - MAX_ATTRIBUTE -} -enumEnd(Attributes); - -#endif // ENUMS_BEING_ATTRIBUTES_H diff --git a/src/enums/being/attributesstrings.cpp b/src/enums/being/attributesstrings.cpp deleted file mode 100644 index b9cd6659a..000000000 --- a/src/enums/being/attributesstrings.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "enums/being/attributesstrings.h" - -#include "enums/simpletypes/stringdefines.h" - -#include - -#include "debug.h" - -namespace AttributesEnum -{ - stringEnumStart(AttributesT) - // player attributes - strEnumDef2(Attributes, PLAYER_BASE_LEVEL, "PLAYER_LEVEL") - strEnumDef(Attributes, PLAYER_HP) - strEnumDef(Attributes, PLAYER_MAX_HP) - strEnumDef(Attributes, PLAYER_MP) - strEnumDef(Attributes, PLAYER_MAX_MP) - strEnumDef(Attributes, PLAYER_EXP) - strEnumDef(Attributes, PLAYER_EXP_NEEDED) - strEnumDef(Attributes, MONEY) - strEnumDef(Attributes, TOTAL_WEIGHT) - strEnumDef(Attributes, MAX_WEIGHT) - strEnumDef2(Attributes, PLAYER_JOB_LEVEL, "PLAYER_JOB") - strEnumDef(Attributes, PLAYER_JOB_EXP) - strEnumDef(Attributes, PLAYER_JOB_EXP_NEEDED) - strEnumDef(Attributes, PLAYER_STR) - strEnumDef(Attributes, PLAYER_AGI) - strEnumDef(Attributes, PLAYER_VIT) - strEnumDef(Attributes, PLAYER_INT) - strEnumDef(Attributes, PLAYER_DEX) - strEnumDef(Attributes, PLAYER_LUK) - strEnumDef(Attributes, PLAYER_SKILL_POINTS) - strEnumDef(Attributes, PLAYER_CHAR_POINTS) - strEnumDef(Attributes, PLAYER_CORR_POINTS) - strEnumDef(Attributes, PLAYER_ATTACK_DELAY) - strEnumDef(Attributes, PLAYER_ATTACK_RANGE) - strEnumDef(Attributes, PLAYER_WALK_SPEED) - strEnumDef(Attributes, PLAYER_ATTACK_SPEED) - strEnumDef(Attributes, PLAYER_KARMA) - strEnumDef(Attributes, PLAYER_MANNER) - strEnumDef(Attributes, PLAYER_CRIT) - strEnumDef(Attributes, PLAYER_FLEE) - strEnumDef(Attributes, PLAYER_HIT) - strEnumDef(Attributes, PLAYER_MDEF) - strEnumDef(Attributes, PLAYER_MATK) - strEnumDef(Attributes, PLAYER_DEF) - strEnumDef(Attributes, PLAYER_ATK) - strEnumDef(Attributes, CART_TOTAL_WEIGHT) - strEnumDef(Attributes, CART_MAX_WEIGHT) - - // homunculus attributes - strEnumDef(Attributes, HOMUN_LEVEL) - strEnumDef(Attributes, HOMUN_HP) - strEnumDef(Attributes, HOMUN_MAX_HP) - strEnumDef(Attributes, HOMUN_MP) - strEnumDef(Attributes, HOMUN_MAX_MP) - strEnumDef(Attributes, HOMUN_EXP) - strEnumDef(Attributes, HOMUN_EXP_NEEDED) - strEnumDef(Attributes, HOMUN_SKILL_POINTS) - strEnumDef(Attributes, HOMUN_ATTACK_DELAY) - strEnumDef(Attributes, HOMUN_ATTACK_RANGE) - strEnumDef(Attributes, HOMUN_ATTACK_SPEED) - strEnumDef(Attributes, HOMUN_CRIT) - strEnumDef(Attributes, HOMUN_FLEE) - strEnumDef(Attributes, HOMUN_HIT) - strEnumDef(Attributes, HOMUN_MDEF) - strEnumDef(Attributes, HOMUN_MATK) - strEnumDef(Attributes, HOMUN_DEF) - strEnumDef(Attributes, HOMUN_ATK) - - // mercenary attributes - strEnumDef(Attributes, MERC_LEVEL) - strEnumDef(Attributes, MERC_HP) - strEnumDef(Attributes, MERC_MAX_HP) - strEnumDef(Attributes, MERC_MP) - strEnumDef(Attributes, MERC_MAX_MP) - strEnumDef(Attributes, MERC_ATTACK_DELAY) - strEnumDef(Attributes, MERC_ATTACK_RANGE) - strEnumDef(Attributes, MERC_ATTACK_SPEED) - strEnumDef(Attributes, MERC_CRIT) - strEnumDef(Attributes, MERC_FLEE) - strEnumDef(Attributes, MERC_HIT) - strEnumDef(Attributes, MERC_MDEF) - strEnumDef(Attributes, MERC_MATK) - strEnumDef(Attributes, MERC_DEF) - strEnumDef(Attributes, MERC_ATK) - strEnumDef(Attributes, MERC_EXPIRE) - strEnumDef(Attributes, MERC_FAITH) - strEnumDef(Attributes, MERC_CALLS) - strEnumDef(Attributes, MERC_KILLS) - - // elemental attributes - strEnumDef(Attributes, ELEMENTAL_HP) - strEnumDef(Attributes, ELEMENTAL_MAX_HP) - strEnumDef(Attributes, ELEMENTAL_MP) - strEnumDef(Attributes, ELEMENTAL_MAX_MP) - stringEnumEnd -} // namespace AttributesEnum diff --git a/src/enums/being/attributesstrings.h b/src/enums/being/attributesstrings.h deleted file mode 100644 index 501e76dcf..000000000 --- a/src/enums/being/attributesstrings.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_ATTRIBUTESSTRINGS_H -#define ENUMS_BEING_ATTRIBUTESSTRINGS_H - -#include "enums/being/attributes.h" - -#include "enums/simpletypes/stringdefines2.h" - -#include - -namespace AttributesEnum -{ - stringEnumDef(AttributesT) -} // namespace AttributesEnum - -#endif // ENUMS_BEING_ATTRIBUTESSTRINGS_H diff --git a/src/enums/being/badgedrawtype.h b/src/enums/being/badgedrawtype.h deleted file mode 100644 index 50804c20c..000000000 --- a/src/enums/being/badgedrawtype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_BADGEDRAWTYPE_H -#define ENUMS_BEING_BADGEDRAWTYPE_H - -namespace BadgeDrawType -{ - enum Type - { - Hide = 0, - Top = 1, - Right = 2, - Bottom = 3 - }; -} // namespace BadgeDrawType - -#endif // ENUMS_BEING_BADGEDRAWTYPE_H diff --git a/src/enums/being/badgeindex.h b/src/enums/being/badgeindex.h deleted file mode 100644 index 2b70382f5..000000000 --- a/src/enums/being/badgeindex.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_BADGEINDEX_H -#define ENUMS_BEING_BADGEINDEX_H - -#include "enums/simpletypes/enumdefines.h" - -enum2Start(BadgeIndex) -{ - Lang = 0, - Away = 1, - Inactive = 2, - Team = 3, - Shop = 4, - Gm = 5, - Guild = 6, - Party = 7, - Name = 8, - - BadgeIndexSize -} -enum2End(BadgeIndex); - -#endif // ENUMS_BEING_BADGEINDEX_H diff --git a/src/enums/being/beingaction.h b/src/enums/being/beingaction.h deleted file mode 100644 index 3703db1a2..000000000 --- a/src/enums/being/beingaction.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_BEINGACTION_H -#define ENUMS_BEING_BEINGACTION_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(BeingAction) -{ - STAND = 0, - MOVE = 1, - ATTACK = 2, - CAST = 3, - SIT = 4, - DEAD = 5, - HURT = 6, - SPAWN = 7, - PRESTAND -} -enumEnd(BeingAction); - -#endif // ENUMS_BEING_BEINGACTION_H diff --git a/src/enums/being/beingdirection.h b/src/enums/being/beingdirection.h deleted file mode 100644 index 7f9311ec8..000000000 --- a/src/enums/being/beingdirection.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_BEINGDIRECTION_H -#define ENUMS_BEING_BEINGDIRECTION_H - -namespace BeingDirection -{ - /** - * Directions, to be used as bitmask values - */ - enum Type - { - DOWN = 1, - LEFT = 2, - UP = 4, - RIGHT = 8 - }; -} // namespace BeingDirection - -#endif // ENUMS_BEING_BEINGDIRECTION_H diff --git a/src/enums/being/cookingtype.h b/src/enums/being/cookingtype.h deleted file mode 100644 index 376187365..000000000 --- a/src/enums/being/cookingtype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_COOKINGTYPE_H -#define ENUMS_BEING_COOKINGTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(CookingType) -{ - Cooking = 1, - Arrow = 2, - Elemental = 3, - MixCooking = 4, - MakeBomb = 5, - Pharmacy = 6 -} -enumEnd(CookingType); - -#endif // ENUMS_BEING_COOKINGTYPE_H diff --git a/src/enums/being/gender.h b/src/enums/being/gender.h deleted file mode 100644 index be1ad09f7..000000000 --- a/src/enums/being/gender.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_GENDER_H -#define ENUMS_BEING_GENDER_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Gender) -{ - MALE = 0, - FEMALE = 1, - UNSPECIFIED = 2, - OTHER = 3 -} -enumEnd(Gender); - -#endif // ENUMS_BEING_GENDER_H diff --git a/src/enums/being/pickup.h b/src/enums/being/pickup.h deleted file mode 100644 index 96030161d..000000000 --- a/src/enums/being/pickup.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_PICKUP_H -#define ENUMS_BEING_PICKUP_H - -#include "enums/simpletypes/enumdefines.h" - -#include "localconsts.h" - -enumStart(Pickup) -{ - OKAY = 0, - UNKNOWN, - BAD_ITEM, - TOO_HEAVY, - TOO_FAR, - INV_FULL, - STACK_FULL, - DROP_STEAL, - MAX_AMOUNT, - STACK_AMOUNT -} -enumEnd(Pickup); - -#endif // ENUMS_BEING_PICKUP_H diff --git a/src/enums/being/rank.h b/src/enums/being/rank.h deleted file mode 100644 index 05edf3053..000000000 --- a/src/enums/being/rank.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_RANK_H -#define ENUMS_BEING_RANK_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Rank) -{ - Blacksmith = 0, - Alchemist = 1, - Taekwon = 2, - Pk = 3 -} -enumEnd(Rank); - -#endif // ENUMS_BEING_RANK_H diff --git a/src/enums/being/reachable.h b/src/enums/being/reachable.h deleted file mode 100644 index 4176ca555..000000000 --- a/src/enums/being/reachable.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_REACHABLE_H -#define ENUMS_BEING_REACHABLE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Reachable) -{ - REACH_UNKNOWN = 0, - REACH_YES = 1, - REACH_NO = 2 -} -enumEnd(Reachable); - -#endif // ENUMS_BEING_REACHABLE_H diff --git a/src/enums/being/relation.h b/src/enums/being/relation.h deleted file mode 100644 index 547ed930c..000000000 --- a/src/enums/being/relation.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_RELATION_H -#define ENUMS_BEING_RELATION_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Relation) -{ - NEUTRAL = 0, - FRIEND = 1, - DISREGARDED = 2, - IGNORED = 3, - ERASED = 4, - BLACKLISTED = 5, - ENEMY2 = 6 -} -enumEnd(Relation); - -#endif // ENUMS_BEING_RELATION_H diff --git a/src/enums/being/targetcursorsize.h b/src/enums/being/targetcursorsize.h deleted file mode 100644 index 81f8f5936..000000000 --- a/src/enums/being/targetcursorsize.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_TARGETCURSORSIZE_H -#define ENUMS_BEING_TARGETCURSORSIZE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(TargetCursorSize) -{ - SMALL = 0, - MEDIUM, - LARGE, - NUM_TC -} -enumEnd(TargetCursorSize); - -#endif // ENUMS_BEING_TARGETCURSORSIZE_H diff --git a/src/enums/being/targetcursortype.h b/src/enums/being/targetcursortype.h deleted file mode 100644 index 3bec32307..000000000 --- a/src/enums/being/targetcursortype.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_TARGETCURSORTYPE_H -#define ENUMS_BEING_TARGETCURSORTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(TargetCursorType) -{ - NONE = -1, - NORMAL = 0, - IN_RANGE, - NUM_TCT -} -enumEnd(TargetCursorType); - -#endif // ENUMS_BEING_TARGETCURSORTYPE_H diff --git a/src/enums/being/visiblename.h b/src/enums/being/visiblename.h deleted file mode 100644 index ec7ec3271..000000000 --- a/src/enums/being/visiblename.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_VISIBLENAME_H -#define ENUMS_BEING_VISIBLENAME_H - -namespace VisibleName -{ - enum Type - { - Hide = 0, - Show = 1, - ShowOnSelection = 2 - }; -} // namespace VisibleName - -#endif // ENUMS_BEING_VISIBLENAME_H diff --git a/src/enums/being/visiblenamepos.h b/src/enums/being/visiblenamepos.h deleted file mode 100644 index 884c4eebe..000000000 --- a/src/enums/being/visiblenamepos.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_BEING_VISIBLENAMEPOS_H -#define ENUMS_BEING_VISIBLENAMEPOS_H - -namespace VisibleNamePos -{ - enum Type - { - Top = 0, - Bottom = 1 - }; -} // namespace VisibleNamePos - -#endif // ENUMS_BEING_VISIBLENAMEPOS_H diff --git a/src/enums/commandtarget.h b/src/enums/commandtarget.h deleted file mode 100644 index bf0fb5c45..000000000 --- a/src/enums/commandtarget.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_COMMANDTARGET_H -#define ENUMS_COMMANDTARGET_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(CommandTarget) -{ - NoTarget = 0, - AllowTarget = 1, - NeedTarget = 2 -} -enumEnd(CommandTarget); - -#endif // ENUMS_COMMANDTARGET_H diff --git a/src/enums/cutin.h b/src/enums/cutin.h deleted file mode 100644 index 6cd5d3ce9..000000000 --- a/src/enums/cutin.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_CUTIN_H -#define ENUMS_CUTIN_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(CutIn) -{ - BottomLeft = 0, - BottomCenter = 1, - BottomRight = 2, - Movable = 3, - MovableClose = 4 -} -enumEnd(CutIn); - -#endif // ENUMS_CUTIN_H diff --git a/src/enums/dragdropsource.h b/src/enums/dragdropsource.h deleted file mode 100644 index 98c4cef7e..000000000 --- a/src/enums/dragdropsource.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef ENUMS_DRAGDROPSOURCE_H -#define ENUMS_DRAGDROPSOURCE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(DragDropSource) -{ - Empty = 0, - Inventory, - Storage, - Trade, - Outfit, - Spells, - Skills, - Ground, - Drop, - Shortcuts, - Npc, - Equipment, - Cart, - MailEdit, - MailView, - Craft, - ShopBuy, - ShopSell -} -enumEnd(DragDropSource); - -#endif // ENUMS_DRAGDROPSOURCE_H diff --git a/src/enums/emotetype.h b/src/enums/emotetype.h deleted file mode 100644 index 6ea47a35e..000000000 --- a/src/enums/emotetype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_EMOTETYPE_H -#define ENUMS_EMOTETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(EmoteType) -{ - Player = 0, - Homunculus, - Mercenary, - Pet -} -enumEnd(EmoteType); - -#endif // ENUMS_EMOTETYPE_H diff --git a/src/enums/equipslot.h b/src/enums/equipslot.h deleted file mode 100644 index 077e0e470..000000000 --- a/src/enums/equipslot.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_EQUIPSLOT_H -#define ENUMS_EQUIPSLOT_H - -#include "localconsts.h" - -namespace EquipSlot -{ - enum Type - { - TORSO_SLOT = 0, - GLOVES_SLOT = 1, - HEAD_SLOT = 2, - LEGS_SLOT = 3, - FEET_SLOT = 4, - RING1_SLOT = 5, - RING2_SLOT = 6, - NECK_SLOT = 7, - FIGHT1_SLOT = 8, - FIGHT2_SLOT = 9, - PROJECTILE_SLOT = 10, - EVOL_RING1_SLOT = 11, - EVOL_RING2_SLOT = 12, - COSTUME_ROBE_SLOT = 13, - MISSING1_SLOT = 14, - MISSING2_SLOT = 15, - SHADOW_ARMOR_SLOT = 16, - SHADOW_WEAPON_SLOT = 17, - SHADOW_SHIELD_SLOT = 18, - SHADOW_SHOES_SLOT = 19, - SHADOW_ACCESSORY1_SLOT = 20, - SHADOW_ACCESSORY2_SLOT = 21, - VECTOREND - }; -} // namespace EquipSlot - -#endif // ENUMS_EQUIPSLOT_H diff --git a/src/enums/events/keyeventtype.h b/src/enums/events/keyeventtype.h deleted file mode 100644 index 416866333..000000000 --- a/src/enums/events/keyeventtype.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_EVENTS_KEYEVENTTYPE_H -#define ENUMS_EVENTS_KEYEVENTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(KeyEventType) -{ - PRESSED = 0, - RELEASED -} -enumEnd(KeyEventType); - -#endif // ENUMS_EVENTS_KEYEVENTTYPE_H diff --git a/src/enums/events/mousebutton.h b/src/enums/events/mousebutton.h deleted file mode 100644 index a60f88f43..000000000 --- a/src/enums/events/mousebutton.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_EVENTS_MOUSEBUTTON_H -#define ENUMS_EVENTS_MOUSEBUTTON_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MouseButton) -{ - WHEEL = -1, - EMPTY = 0, - LEFT, - RIGHT, - MIDDLE -} -enumEnd(MouseButton); - -#endif // ENUMS_EVENTS_MOUSEBUTTON_H diff --git a/src/enums/events/mouseeventtype.h b/src/enums/events/mouseeventtype.h deleted file mode 100644 index b0db0a863..000000000 --- a/src/enums/events/mouseeventtype.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_EVENTS_MOUSEEVENTTYPE_H -#define ENUMS_EVENTS_MOUSEEVENTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MouseEventType) -{ - MOVED = 0, - PRESSED, - RELEASED, - WHEEL_MOVED_DOWN, - WHEEL_MOVED_UP, - CLICKED, - ENTERED, - EXITED, - DRAGGED, - RELEASED2 = 100 -} -enumEnd(MouseEventType); - -#endif // ENUMS_EVENTS_MOUSEEVENTTYPE_H diff --git a/src/enums/fs/fsentrytype.h b/src/enums/fs/fsentrytype.h deleted file mode 100644 index 35b97164b..000000000 --- a/src/enums/fs/fsentrytype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_FS_FSENTRYTYPE_H -#define ENUMS_FS_FSENTRYTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(FsEntryType) -{ - Dir = 0, - Zip = 1 -} -enumEnd(FsEntryType); - -#endif // ENUMS_FS_FSENTRYTYPE_H diff --git a/src/enums/gui/chatmsgtype.h b/src/enums/gui/chatmsgtype.h deleted file mode 100644 index 968935d0f..000000000 --- a/src/enums/gui/chatmsgtype.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_CHATMSGTYPE_H -#define ENUMS_GUI_CHATMSGTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ChatMsgType) -{ - BY_GM = 0, - BY_PLAYER, - BY_OTHER, - BY_SERVER, - BY_CHANNEL, - ACT_WHISPER, // getting whispered at - ACT_IS, // equivalent to "/me" on IRC - BY_LOGGER, - BY_UNKNOWN = -1 -} -enumEnd(ChatMsgType); - -#endif // ENUMS_GUI_CHATMSGTYPE_H diff --git a/src/enums/gui/chattabtype.h b/src/enums/gui/chattabtype.h deleted file mode 100644 index f37a98db6..000000000 --- a/src/enums/gui/chattabtype.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_CHATTABTYPE_H -#define ENUMS_GUI_CHATTABTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#ifdef INPUT -#undef INPUT -#endif // INPUT - -PRAGMAMINGW(GCC diagnostic push) -PRAGMAMINGW(GCC diagnostic ignored "-Wshadow") - -enumStart(ChatTabType) -{ - UNKNOWN = 0, - INPUT, - WHISPER, - PARTY, - GUILD, - DEBUG, - TRADE, - BATTLE, - LANG, - GM, - CHANNEL -} -enumEnd(ChatTabType); - -PRAGMAMINGW(GCC diagnostic pop) - -#endif // ENUMS_GUI_CHATTABTYPE_H diff --git a/src/enums/gui/colorname.h b/src/enums/gui/colorname.h deleted file mode 100644 index 3e45fcb66..000000000 --- a/src/enums/gui/colorname.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * 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 . - */ - -#ifndef ENUMS_GUI_COLORNAME_H -#define ENUMS_GUI_COLORNAME_H - -namespace ColorName -{ - enum Type - { - RED = 0, - BLACK, - GREEN, - BLUE, - ORANGE, - YELLOW, - PINK, - PURPLE, - GRAY, - BROWN, - COLORS_MAX - }; -} // namespace ColorName - -#endif // ENUMS_GUI_COLORNAME_H diff --git a/src/enums/gui/dialogtype.h b/src/enums/gui/dialogtype.h deleted file mode 100644 index eede88ddf..000000000 --- a/src/enums/gui/dialogtype.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_DIALOGTYPE_H -#define ENUMS_GUI_DIALOGTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#undef ERROR - -enumStart(DialogType) -{ - OK = 0, - ERROR, - SILENCE -} -enumEnd(DialogType); - -#endif // ENUMS_GUI_DIALOGTYPE_H diff --git a/src/enums/gui/gradienttype.h b/src/enums/gui/gradienttype.h deleted file mode 100644 index 963813558..000000000 --- a/src/enums/gui/gradienttype.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Douglas Boffey - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_GRADIENTTYPE_H -#define ENUMS_GUI_GRADIENTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(GradientType) -{ - STATIC = 0, - PULSE, - SPECTRUM, - RAINBOW, - LABEL -} -enumEnd(GradientType); - -#endif // ENUMS_GUI_GRADIENTTYPE_H diff --git a/src/enums/gui/itemamountwindowusage.h b/src/enums/gui/itemamountwindowusage.h deleted file mode 100644 index aac1be73b..000000000 --- a/src/enums/gui/itemamountwindowusage.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_ITEMAMOUNTWINDOWUSAGE_H -#define ENUMS_GUI_ITEMAMOUNTWINDOWUSAGE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ItemAmountWindowUsage) -{ - TradeAdd = 0, - ItemDrop, - StoreAdd, - StoreRemove, - CartAdd, - CartRemove, - ItemSplit, - ShopBuyAdd, - ShopSellAdd, - CraftAdd, - MailAdd -} -enumEnd(ItemAmountWindowUsage); - -#endif // ENUMS_GUI_ITEMAMOUNTWINDOWUSAGE_H diff --git a/src/enums/gui/layouttype.h b/src/enums/gui/layouttype.h deleted file mode 100644 index 65e07cb05..000000000 --- a/src/enums/gui/layouttype.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2007-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_WIDGETS_LAYOUTTYPE_H -#define ENUMS_GUI_WIDGETS_LAYOUTTYPE_H - -#include "localconsts.h" - -namespace LayoutType -{ - /** - * When the minimum size of the layout is less than the available size, - * the remaining pixels are equally split amongst the FILL items. - */ - enum Type - { - DEF = -42, /**< Default value, behaves like AUTO_ADD. */ - SET = -43, /**< Uses the share as the new size. */ - ADD = -44 /**< Adds the share to the current size. */ - }; -} // namespace LayoutType - -#endif // ENUMS_GUI_WIDGETS_LAYOUTTYPE_H diff --git a/src/enums/gui/linkhighlightmode.h b/src/enums/gui/linkhighlightmode.h deleted file mode 100644 index 04e14c947..000000000 --- a/src/enums/gui/linkhighlightmode.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * 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 . - */ - -#ifndef ENUMS_GUI_LINKHIGHLIGHTMODE_H -#define ENUMS_GUI_LINKHIGHLIGHTMODE_H - -#include "localconsts.h" - -namespace LinkHighlightMode -{ - /** - * Highlight modes for links. - * This can be used for a bitmask. - */ - enum Type - { - UNDERLINE = 1, - BACKGROUND = 2 - }; -} // namespace LinkHighlightMode - -#endif // ENUMS_GUI_LINKHIGHLIGHTMODE_H diff --git a/src/enums/gui/npcactionstate.h b/src/enums/gui/npcactionstate.h deleted file mode 100644 index d541b3013..000000000 --- a/src/enums/gui/npcactionstate.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_NPCACTIONSTATE_H -#define ENUMS_GUI_NPCACTIONSTATE_H - -#include "enums/simpletypes/enumdefines.h" - -#ifdef INPUT -#undef INPUT -#endif // INPUT - -PRAGMAMINGW(GCC diagnostic push) -PRAGMAMINGW(GCC diagnostic ignored "-Wshadow") - -enumStart(NpcActionState) -{ - WAIT = 0, - NEXT, - INPUT, - CLOSE -} -enumEnd(NpcActionState); - -PRAGMAMINGW(GCC diagnostic pop) - -#endif // ENUMS_GUI_NPCACTIONSTATE_H diff --git a/src/enums/gui/npcinputstate.h b/src/enums/gui/npcinputstate.h deleted file mode 100644 index eea8ff14f..000000000 --- a/src/enums/gui/npcinputstate.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_NPCINPUTSTATE_H -#define ENUMS_GUI_NPCINPUTSTATE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(NpcInputState) -{ - NONE = 0, - LIST, - STRING, - INTEGER, - ITEM, - ITEM_INDEX, - ITEM_CRAFT -} -enumEnd(NpcInputState); - -#endif // ENUMS_GUI_NPCINPUTSTATE_H diff --git a/src/enums/gui/orientation.h b/src/enums/gui/orientation.h deleted file mode 100644 index 5a816f5e6..000000000 --- a/src/enums/gui/orientation.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_GUI_ORIENTATION_H -#define ENUMS_GUI_ORIENTATION_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Orientation) -{ - HORIZONTAL = 0, - VERTICAL -} -enumEnd(Orientation); - -#endif // ENUMS_GUI_ORIENTATION_H diff --git a/src/enums/gui/progresscolorid.h b/src/enums/gui/progresscolorid.h deleted file mode 100644 index 0929b37c8..000000000 --- a/src/enums/gui/progresscolorid.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 The Legend of Mazzeroth Development Team - * Copyright (C) 2009 Aethyra Development Team - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_PROGRESSCOLORID_H -#define ENUMS_GUI_PROGRESSCOLORID_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ProgressColorId) -{ - PROG_HP = 0, - PROG_HP_POISON, - PROG_MP, - PROG_NO_MP, - PROG_EXP, - PROG_INVY_SLOTS, - PROG_WEIGHT, - PROG_JOB, - PROG_UPDATE, - PROG_MONEY, - PROG_ARROWS, - PROG_STATUS, - THEME_PROG_END -} -enumEnd(ProgressColorId); - -#endif // ENUMS_GUI_PROGRESSCOLORID_H diff --git a/src/enums/gui/serverdialogdonwloadstatus.h b/src/enums/gui/serverdialogdonwloadstatus.h deleted file mode 100644 index c6eebbd07..000000000 --- a/src/enums/gui/serverdialogdonwloadstatus.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H -#define ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ServerDialogDownloadStatus) -{ - UNKNOWN = 0, - ERROR, - PREPARING, - IDLE, - IN_PROGRESS, - COMPLETE, - OVER -} -enumEnd(ServerDialogDownloadStatus); - -#endif // ENUMS_GUI_SERVERDIALOGDOWNLOADSTATUS_H diff --git a/src/enums/gui/shoplistboxtype.h b/src/enums/gui/shoplistboxtype.h deleted file mode 100644 index 9be128d65..000000000 --- a/src/enums/gui/shoplistboxtype.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_SHOPLISTBOXTYPE_H -#define ENUMS_GUI_SHOPLISTBOXTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ShopListBoxType) -{ - Unknown = 0, - BuyShop = 1, - SellShop = 2 -} -enumEnd(ShopListBoxType); - -#endif // ENUMS_GUI_SHOPLISTBOXTYPE_H diff --git a/src/enums/gui/slidergrid.h b/src/enums/gui/slidergrid.h deleted file mode 100644 index 790fa5878..000000000 --- a/src/enums/gui/slidergrid.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_GUI_SLIDERGRID_H -#define ENUMS_GUI_SLIDERGRID_H - -namespace SliderGrid -{ - enum Type - { - HSTART = 0, - HMID, - HEND, - HGRIP, - VSTART, - VMID, - VEND, - VGRIP, - SLIDER_MAX - }; -} // namespace SliderGrid - -#endif // ENUMS_GUI_SLIDERGRID_H diff --git a/src/enums/gui/themecolorid.h b/src/enums/gui/themecolorid.h deleted file mode 100644 index d4ab954a9..000000000 --- a/src/enums/gui/themecolorid.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 The Legend of Mazzeroth Development Team - * Copyright (C) 2009 Aethyra Development Team - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_THEMECOLORID_H -#define ENUMS_GUI_THEMECOLORID_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ThemeColorId) -{ - BROWSERBOX = 0, - BROWSERBOX_OUTLINE, - SELFNICK, - SELFNICK_OUTLINE, - TEXT, - TEXT_OUTLINE, - CARET, - SHADOW, - OUTLINE, - BORDER, - PROGRESS_BAR, - PROGRESS_BAR_OUTLINE, - BUTTON, - BUTTON_OUTLINE, - BUTTON_DISABLED, - BUTTON_DISABLED_OUTLINE, - BUTTON_HIGHLIGHTED, - BUTTON_HIGHLIGHTED_OUTLINE, - BUTTON_PRESSED, - BUTTON_PRESSED_OUTLINE, - CHECKBOX, - CHECKBOX_OUTLINE, - DROPDOWN, - DROPDOWN_OUTLINE, - LABEL, - LABEL_OUTLINE, - LISTBOX, - LISTBOX_OUTLINE, - LISTBOX_SELECTED, - LISTBOX_SELECTED_OUTLINE, - RADIOBUTTON, - RADIOBUTTON_OUTLINE, - POPUP, - POPUP_OUTLINE, - TAB, - TAB_OUTLINE, - TAB_HIGHLIGHTED, - TAB_HIGHLIGHTED_OUTLINE, - TAB_SELECTED, - TAB_SELECTED_OUTLINE, - TEXTBOX, - TEXTFIELD, - TEXTFIELD_OUTLINE, - WINDOW, - WINDOW_OUTLINE, - BATTLE_CHAT_TAB, - BATTLE_CHAT_TAB_OUTLINE, - CHANNEL_CHAT_TAB, - CHANNEL_CHAT_TAB_OUTLINE, - PARTY_CHAT_TAB, - PARTY_CHAT_TAB_OUTLINE, - PARTY_SOCIAL_TAB, - PARTY_SOCIAL_TAB_OUTLINE, - GUILD_CHAT_TAB, - GUILD_CHAT_TAB_OUTLINE, - GUILD_SOCIAL_TAB, - GUILD_SOCIAL_TAB_OUTLINE, - GM_CHAT_TAB, - GM_CHAT_TAB_OUTLINE, - BATTLE_CHAT_TAB_HIGHLIGHTED, - BATTLE_CHAT_TAB_HIGHLIGHTED_OUTLINE, - CHANNEL_CHAT_TAB_HIGHLIGHTED, - CHANNEL_CHAT_TAB_HIGHLIGHTED_OUTLINE, - PARTY_CHAT_TAB_HIGHLIGHTED, - PARTY_CHAT_TAB_HIGHLIGHTED_OUTLINE, - PARTY_SOCIAL_TAB_HIGHLIGHTED, - PARTY_SOCIAL_TAB_HIGHLIGHTED_OUTLINE, - GUILD_CHAT_TAB_HIGHLIGHTED, - GUILD_CHAT_TAB_HIGHLIGHTED_OUTLINE, - GUILD_SOCIAL_TAB_HIGHLIGHTED, - GUILD_SOCIAL_TAB_HIGHLIGHTED_OUTLINE, - GM_CHAT_TAB_HIGHLIGHTED, - GM_CHAT_TAB_HIGHLIGHTED_OUTLINE, - BATTLE_CHAT_TAB_SELECTED, - BATTLE_CHAT_TAB_SELECTED_OUTLINE, - CHANNEL_CHAT_TAB_SELECTED, - CHANNEL_CHAT_TAB_SELECTED_OUTLINE, - PARTY_CHAT_TAB_SELECTED, - PARTY_CHAT_TAB_SELECTED_OUTLINE, - PARTY_SOCIAL_TAB_SELECTED, - PARTY_SOCIAL_TAB_SELECTED_OUTLINE, - GUILD_CHAT_TAB_SELECTED, - GUILD_CHAT_TAB_SELECTED_OUTLINE, - GUILD_SOCIAL_TAB_SELECTED, - GUILD_SOCIAL_TAB_SELECTED_OUTLINE, - GM_CHAT_TAB_SELECTED, - GM_CHAT_TAB_SELECTED_OUTLINE, - BACKGROUND, - BACKGROUND_GRAY, - SCROLLBAR_GRAY, - DROPDOWN_SHADOW, - HIGHLIGHT, - HIGHLIGHT_OUTLINE, - TAB_FLASH, - TAB_FLASH_OUTLINE, - TAB_PLAYER_FLASH, - TAB_PLAYER_FLASH_OUTLINE, - SHOP_WARNING, - ITEM_EQUIPPED, - ITEM_EQUIPPED_OUTLINE, - ITEM_NOT_EQUIPPED, - ITEM_NOT_EQUIPPED_OUTLINE, - CHAT, - CHAT_OUTLINE, - GM, - GM_OUTLINE, - GLOBAL, - GLOBAL_OUTLINE, - PLAYER, - PLAYER_OUTLINE, - WHISPER_TAB, - WHISPER_TAB_OUTLINE, - WHISPER_TAB_OFFLINE, - WHISPER_TAB_OFFLINE_OUTLINE, - WHISPER_TAB_HIGHLIGHTED, - WHISPER_TAB_HIGHLIGHTED_OUTLINE, - WHISPER_TAB_OFFLINE_HIGHLIGHTED, - WHISPER_TAB_OFFLINE_HIGHLIGHTED_OUTLINE, - WHISPER_TAB_SELECTED, - WHISPER_TAB_SELECTED_OUTLINE, - WHISPER_TAB_OFFLINE_SELECTED, - WHISPER_TAB_OFFLINE_SELECTED_OUTLINE, - IS, - IS_OUTLINE, - SERVER, - SERVER_OUTLINE, - LOGGER, - LOGGER_OUTLINE, - HYPERLINK, - HYPERLINK_OUTLINE, - UNKNOWN_ITEM, - UNKNOWN_ITEM_OUTLINE, - GENERIC, - GENERIC_OUTLINE, - HEAD, - HEAD_OUTLINE, - USABLE, - USABLE_OUTLINE, - TORSO, - TORSO_OUTLINE, - ONEHAND, - ONEHAND_OUTLINE, - LEGS, - LEGS_OUTLINE, - FEET, - FEET_OUTLINE, - TWOHAND, - TWOHAND_OUTLINE, - SHIELD, - SHIELD_OUTLINE, - RING, - RING_OUTLINE, - NECKLACE, - NECKLACE_OUTLINE, - ARMS, - ARMS_OUTLINE, - AMMO, - AMMO_OUTLINE, - SERVER_VERSION_NOT_SUPPORTED, - SERVER_VERSION_NOT_SUPPORTED_OUTLINE, - WARNING, - WARNING_OUTLINE, - CHARM, - CHARM_OUTLINE, - CARD, - CARD_OUTLINE, - PLAYER_ADVANCED, - PLAYER_ADVANCED_OUTLINE, - BUBBLE_NAME, - BUBBLE_NAME_OUTLINE, - BUBBLE_TEXT, - BUBBLE_TEXT_OUTLINE, - BLACK, - BLACK_OUTLINE, - RED, - RED_OUTLINE, - GREEN, - GREEN_OUTLINE, - BLUE, - BLUE_OUTLINE, - ORANGE, - ORANGE_OUTLINE, - YELLOW, - YELLOW_OUTLINE, - PINK, - PINK_OUTLINE, - PURPLE, - PURPLE_OUTLINE, - GRAY, - GRAY_OUTLINE, - BROWN, - BROWN_OUTLINE, - STATUSBAR_ON, - STATUSBAR_OFF, - TABLE_BACKGROUND, - SLOTS_BAR, - SLOTS_BAR_OUTLINE, - HP_BAR, - HP_BAR_OUTLINE, - MP_BAR, - MP_BAR_OUTLINE, - NO_MP_BAR, - NO_MP_BAR_OUTLINE, - XP_BAR, - XP_BAR_OUTLINE, - WEIGHT_BAR, - WEIGHT_BAR_OUTLINE, - MONEY_BAR, - MONEY_BAR_OUTLINE, - ARROWS_BAR, - ARROWS_BAR_OUTLINE, - STATUS_BAR, - STATUS_BAR_OUTLINE, - JOB_BAR, - JOB_BAR_OUTLINE, - OLDCHAT, - OLDCHAT_OUTLINE, - AWAYCHAT, - AWAYCHAT_OUTLINE, - SKILL_COOLDOWN, - TEXT_DISABLED, - TEXT_DISABLED_OUTLINE, - THEME_COLORS_END -} -enumEnd(ThemeColorId); - -#endif // ENUMS_GUI_THEMECOLORID_H diff --git a/src/enums/gui/updatedownloadstatus.h b/src/enums/gui/updatedownloadstatus.h deleted file mode 100644 index 7209cc66e..000000000 --- a/src/enums/gui/updatedownloadstatus.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_GUI_UPDATEDOWNLOADSTATUS_H -#define ENUMS_GUI_UPDATEDOWNLOADSTATUS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(UpdateDownloadStatus) -{ - UPDATE_ERROR = 0, - UPDATE_IDLE, - UPDATE_LIST, - UPDATE_COMPLETE, - UPDATE_NEWS, - UPDATE_RESOURCES, - UPDATE_PATCH, - UPDATE_LIST2, - UPDATE_RESOURCES2 -} -enumEnd(UpdateDownloadStatus); - -#endif // ENUMS_GUI_UPDATEDOWNLOADSTATUS_H diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h deleted file mode 100644 index bb3feab0f..000000000 --- a/src/enums/gui/usercolorid.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Douglas Boffey - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUI_USERCOLORID_H -#define ENUMS_GUI_USERCOLORID_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(UserColorId) -{ - NO_COLOR = -1, - LABEL_BEING = 0, - BEING, - FRIEND, - DISREGARDED, - IGNORED, - ERASED, - ENEMY, - PC, - SELF, - GM, - NPC, - MONSTER, - PET, - MERCENARY, - HOMUNCULUS, - SKILLUNIT, - PARTY, - GUILD, - TEAM1, - TEAM2, - TEAM3, - LABEL_PARTICLES, - PARTICLE, - PICKUP_INFO, - EXP_INFO, - LABEL_HP, - PLAYER_HP, - PLAYER_HP2, - MONSTER_HP, - MONSTER_HP2, - HOMUN_HP, - HOMUN_HP2, - MERC_HP, - MERC_HP2, - ELEMENTAL_HP, - ELEMENTAL_HP2, - LABEL_HITS, - HIT_PLAYER_MONSTER, - HIT_MONSTER_PLAYER, - HIT_PLAYER_PLAYER, - HIT_CRITICAL, - HIT_LOCAL_PLAYER_MONSTER, - HIT_LOCAL_PLAYER_CRITICAL, - HIT_LOCAL_PLAYER_MISS, - MISS, - LABEL_TILES, - PORTAL_HIGHLIGHT, - COLLISION_HIGHLIGHT, - AIR_COLLISION_HIGHLIGHT, - WATER_COLLISION_HIGHLIGHT, - MONSTER_COLLISION_HIGHLIGHT, - GROUNDTOP_COLLISION_HIGHLIGHT, - WALKABLE_HIGHLIGHT, - NET, - LABEL_RANGES, - ATTACK_RANGE, - ATTACK_RANGE_BORDER, - MONSTER_ATTACK_RANGE, - SKILL_ATTACK_RANGE, - LABEL_OTHER, - FLOOR_ITEM_TEXT, - HOME_PLACE, - HOME_PLACE_BORDER, - ROAD_POINT, - USER_COLOR_LAST -} -enumEnd(UserColorId); - -#endif // ENUMS_GUI_USERCOLORID_H diff --git a/src/enums/guildpositionflags.h b/src/enums/guildpositionflags.h deleted file mode 100644 index 180545103..000000000 --- a/src/enums/guildpositionflags.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_GUILDPOSITIONFLAGS_H -#define ENUMS_GUILDPOSITIONFLAGS_H - -class Guild; - -namespace GuildPositionFlags -{ - enum Type - { - None = 0x00, - Invite = 0x01, - Expel = 0x10 - }; -} // namespace GuildPositionFlags - -#endif // ENUMS_GUILDPOSITIONFLAGS_H diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h deleted file mode 100644 index dc09b8f3a..000000000 --- a/src/enums/input/inputaction.h +++ /dev/null @@ -1,716 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2007 Joshua Langley - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_INPUT_INPUTACTION_H -#define ENUMS_INPUT_INPUTACTION_H - -#include "enums/simpletypes/enumdefines.h" - -#ifdef WIN32 -#undef ERROR -#undef IGNORE -#endif // WIN32 - -/** - * All the key functions. - * KEY_NO_VALUE is used in initialization, and should be unchanged. - * KEY_TOTAL should always be last (used as a conditional in loops). - * The key assignment view gets arranged according to the order of - * these values. - */ -enumStart(InputAction) -{ - UNDEFINED_VALUE = -2, - NO_VALUE = -1, - MOVE_UP, - MOVE_DOWN, - MOVE_LEFT, - MOVE_RIGHT, - ATTACK, - TARGET_ATTACK, - MOVE_TO_TARGET, - CHANGE_MOVE_TO_TARGET, - MOVE_TO_HOME, - SET_HOME, - MOVE_TO_POINT, - TALK, - STOP_ATTACK, - UNTARGET, - TARGET_MONSTER, - TARGET_NPC, - TARGET_PLAYER, - PICKUP, - CHANGE_PICKUP_TYPE, - HIDE_WINDOWS, - SIT, - SCREENSHOT, - CHANGE_TRADE, - PATHFIND, - OK, - QUIT, - SHORTCUTS_KEY, - SHORTCUT_1, - SHORTCUT_2, - SHORTCUT_3, - SHORTCUT_4, - SHORTCUT_5, - SHORTCUT_6, - SHORTCUT_7, - SHORTCUT_8, - SHORTCUT_9, - SHORTCUT_10, - SHORTCUT_11, - SHORTCUT_12, - SHORTCUT_13, - SHORTCUT_14, - SHORTCUT_15, - SHORTCUT_16, - SHORTCUT_17, - SHORTCUT_18, - SHORTCUT_19, - SHORTCUT_20, - WINDOW_HELP, - WINDOW_STATUS, - WINDOW_INVENTORY, - WINDOW_EQUIPMENT, - WINDOW_SKILL, - WINDOW_MINIMAP, - WINDOW_CHAT, - WINDOW_SHORTCUT, - WINDOW_SETUP, - WINDOW_DEBUG, - WINDOW_SOCIAL, - WINDOW_EMOTE_SHORTCUT, - WINDOW_OUTFIT, - WINDOW_SHOP, - WINDOW_DROP, - WINDOW_KILLS, - WINDOW_SPELLS, - UNUSED1, - WINDOW_ONLINE, - WINDOW_DIDYOUKNOW, - WINDOW_QUESTS, - PREV_SOCIAL_TAB, - NEXT_SOCIAL_TAB, - EMOTE, - EMOTE_1, - EMOTE_2, - EMOTE_3, - EMOTE_4, - EMOTE_5, - EMOTE_6, - EMOTE_7, - EMOTE_8, - EMOTE_9, - EMOTE_10, - EMOTE_11, - EMOTE_12, - EMOTE_13, - EMOTE_14, - EMOTE_15, - EMOTE_16, - EMOTE_17, - EMOTE_18, - EMOTE_19, - EMOTE_20, - EMOTE_21, - EMOTE_22, - EMOTE_23, - EMOTE_24, - EMOTE_25, - EMOTE_26, - EMOTE_27, - EMOTE_28, - EMOTE_29, - EMOTE_30, - EMOTE_31, - EMOTE_32, - EMOTE_33, - EMOTE_34, - EMOTE_35, - EMOTE_36, - EMOTE_37, - EMOTE_38, - EMOTE_39, - EMOTE_40, - EMOTE_41, - EMOTE_42, - EMOTE_43, - EMOTE_44, - EMOTE_45, - EMOTE_46, - EMOTE_47, - EMOTE_48, - WEAR_OUTFIT, - COPY_OUTFIT, - COPY_EQUIPED_OUTFIT, - OUTFIT_1, - OUTFIT_2, - OUTFIT_3, - OUTFIT_4, - OUTFIT_5, - OUTFIT_6, - OUTFIT_7, - OUTFIT_8, - OUTFIT_9, - OUTFIT_10, - OUTFIT_11, - OUTFIT_12, - OUTFIT_13, - OUTFIT_14, - OUTFIT_15, - OUTFIT_16, - OUTFIT_17, - OUTFIT_18, - OUTFIT_19, - OUTFIT_20, - OUTFIT_21, - OUTFIT_22, - OUTFIT_23, - OUTFIT_24, - OUTFIT_25, - OUTFIT_26, - OUTFIT_27, - OUTFIT_28, - OUTFIT_29, - OUTFIT_30, - OUTFIT_31, - OUTFIT_32, - OUTFIT_33, - OUTFIT_34, - OUTFIT_35, - OUTFIT_36, - OUTFIT_37, - OUTFIT_38, - OUTFIT_39, - OUTFIT_40, - OUTFIT_41, - OUTFIT_42, - OUTFIT_43, - OUTFIT_44, - OUTFIT_45, - OUTFIT_46, - OUTFIT_47, - OUTFIT_48, - MOVE_TO_POINT_1, - MOVE_TO_POINT_2, - MOVE_TO_POINT_3, - MOVE_TO_POINT_4, - MOVE_TO_POINT_5, - MOVE_TO_POINT_6, - MOVE_TO_POINT_7, - MOVE_TO_POINT_8, - MOVE_TO_POINT_9, - MOVE_TO_POINT_10, - MOVE_TO_POINT_11, - MOVE_TO_POINT_12, - MOVE_TO_POINT_13, - MOVE_TO_POINT_14, - MOVE_TO_POINT_15, - MOVE_TO_POINT_16, - MOVE_TO_POINT_17, - MOVE_TO_POINT_18, - MOVE_TO_POINT_19, - MOVE_TO_POINT_20, - MOVE_TO_POINT_21, - MOVE_TO_POINT_22, - MOVE_TO_POINT_23, - MOVE_TO_POINT_24, - MOVE_TO_POINT_25, - MOVE_TO_POINT_26, - MOVE_TO_POINT_27, - MOVE_TO_POINT_28, - MOVE_TO_POINT_29, - MOVE_TO_POINT_30, - MOVE_TO_POINT_31, - MOVE_TO_POINT_32, - MOVE_TO_POINT_33, - MOVE_TO_POINT_34, - MOVE_TO_POINT_35, - MOVE_TO_POINT_36, - MOVE_TO_POINT_37, - MOVE_TO_POINT_38, - MOVE_TO_POINT_39, - MOVE_TO_POINT_40, - MOVE_TO_POINT_41, - MOVE_TO_POINT_42, - MOVE_TO_POINT_43, - MOVE_TO_POINT_44, - MOVE_TO_POINT_45, - MOVE_TO_POINT_46, - MOVE_TO_POINT_47, - MOVE_TO_POINT_48, - TOGGLE_CHAT, - SCROLL_CHAT_UP, - SCROLL_CHAT_DOWN, - PREV_CHAT_TAB, - NEXT_CHAT_TAB, - CLOSE_CHAT_TAB, - CHAT_PREV_HISTORY, - CHAT_NEXT_HISTORY, - IGNORE_INPUT_1, - IGNORE_INPUT_2, - DIRECT_UP, - DIRECT_DOWN, - DIRECT_LEFT, - DIRECT_RIGHT, - CRAZY_MOVES, - CHANGE_CRAZY_MOVES_TYPE, - QUICK_DROP, - QUICK_DROPN, - SWITCH_QUICK_DROP, - MAGIC_INMA1, - MAGIC_ITENPLZ, - MAGIC_ATTACK, - SWITCH_MAGIC_ATTACK, - SWITCH_PVP_ATTACK, - INVERT_DIRECTION, - CHANGE_ATTACK_WEAPON_TYPE, - CHANGE_ATTACK_TYPE, - CHANGE_FOLLOW_MODE, - CHANGE_IMITATION_MODE, - DISABLE_GAME_MODIFIERS, - CHANGE_AUDIO, - AWAY, - RIGHT_CLICK, - CAMERA, - RESERVED1, - GUI_UP, - GUI_DOWN, - GUI_LEFT, - GUI_RIGHT, - GUI_SELECT, - GUI_SELECT2, - GUI_CANCEL, - GUI_HOME, - GUI_END, - GUI_DELETE, - GUI_BACKSPACE, - GUI_TAB, - GUI_PAGE_UP, - GUI_PAGE_DOWN, - GUI_INSERT, - GUI_MOD, - SAFE_VIDEO, - STOP_SIT, - SHOW_KEYBOARD, - SHOW_WINDOWS, - CHAT_MOD, - MOVE_FORWARD, - GUI_CTRL, - GUI_B, - GUI_C, - GUI_D, - GUI_E, - GUI_F, - GUI_H, - GUI_K, - GUI_U, - GUI_V, - GUI_W, - PREV_SHORTCUTS_TAB, - NEXT_SHORTCUTS_TAB, - PREV_COMMANDS_TAB, - NEXT_COMMANDS_TAB, - OPEN_TRADE, - GUI_F1, - GUI_F2, - GUI_F3, - GUI_F4, - GUI_F5, - GUI_F6, - GUI_F7, - GUI_F8, - GUI_F9, - GUI_F10, - GUI_F11, - GUI_F12, - WINDOW_ABOUT, - WINDOW_UPDATER, - TARGET_CLOSEST_MONSTER, - CLOSE_ALL_CHAT_TABS, - IGNORE_ALL_WHISPERS, - CHAT_ANNOUNCE, - IPC_TOGGLE, - WHERE, - WHO, - WHISPER, - QUERY, - CLEAR_CHAT_TAB, - IGNORE, - UNIGNORE, - FRIEND, - DISREGARD, - NEUTRAL, - BLACKLIST, - ENEMY, - ERASE, - CLEAN_GRAPHICS, - CLEAN_FONTS, - CREATE_PARTY, - CREATE_GUILD, - PARTY, - ME, - TOGGLE, - PRESENT, - PRINT_ALL, - MOVE, - TARGET, - ATTACK_HUMAN, - COMMAMD_OUTFIT, - COMMAMD_EMOTE, - COMMAND_EMOTE_PET, - AWAY_MESSAGE, - PSEUDO_AWAY, - FOLLOW, - NAVIGATE, - IMITATION, - SEND_MAIL, - TRADE, - PRICE_LOAD, - PRICE_SAVE, - CACHE_INFO, - DISCONNECT, - UNDRESS, - DIRS, - INFO, - WAIT, - UPTIME, - ADD_PRIORITY_ATTACK, - ADD_ATTACK, - REMOVE_ATTACK, - ADD_IGNORE_ATTACK, - DUMP, - SERVER_IGNORE_ALL, - SERVER_UNIGNORE_ALL, - SET_DROP, - ERROR, - DUMP_GRAPHICS, - DUMP_ENVIRONMENT, - DUMP_TESTS, - DUMP_OGL, - DUMP_GL, - DUMP_MODS, - URL, - OPEN_URL, - EXECUTE, - TEST_SDL_FONT, - ENABLE_HIGHLIGHT, - DISABLE_HIGHLIGHT, - DONT_REMOVE_NAME, - REMOVE_NAME, - DISABLE_AWAY, - ENABLE_AWAY, - TEST_PARTICLE, - CREATE_ITEMS, - TALK_RAW, - TALK_PET, - UPLOAD_CONFIG, - UPLOAD_SERVER_CONFIG, - UPLOAD_LOG, - GM, - HACK, - DEBUG_SPAWN, - PET_EMOTE, - PET_EMOTE_1, - PET_EMOTE_2, - PET_EMOTE_3, - PET_EMOTE_4, - PET_EMOTE_5, - PET_EMOTE_6, - PET_EMOTE_7, - PET_EMOTE_8, - PET_EMOTE_9, - PET_EMOTE_10, - PET_EMOTE_11, - PET_EMOTE_12, - PET_EMOTE_13, - PET_EMOTE_14, - PET_EMOTE_15, - PET_EMOTE_16, - PET_EMOTE_17, - PET_EMOTE_18, - PET_EMOTE_19, - PET_EMOTE_20, - PET_EMOTE_21, - PET_EMOTE_22, - PET_EMOTE_23, - PET_EMOTE_24, - PET_EMOTE_25, - PET_EMOTE_26, - PET_EMOTE_27, - PET_EMOTE_28, - PET_EMOTE_29, - PET_EMOTE_30, - PET_EMOTE_31, - PET_EMOTE_32, - PET_EMOTE_33, - PET_EMOTE_34, - PET_EMOTE_35, - PET_EMOTE_36, - PET_EMOTE_37, - PET_EMOTE_38, - PET_EMOTE_39, - PET_EMOTE_40, - PET_EMOTE_41, - PET_EMOTE_42, - PET_EMOTE_43, - PET_EMOTE_44, - PET_EMOTE_45, - PET_EMOTE_46, - PET_EMOTE_47, - PET_EMOTE_48, - CATCH_PET, - IGNORE_WHISPER, - UNIGNORE_WHISPER, - MERCENARY_FIRE, - TARGET_MERCENARY, - TARGET_PET, - PET_SET_NAME, - HOMUNCULUS_SET_NAME, - HOMUNCULUS_FIRE, - WINDOW_BANK, - PREV_INV_TAB, - NEXT_INV_TAB, - CONTEXT_MENU, - BUY, - SELL, - WHISPER2, - GUILD, - NUKE, - USE, - CHAT_ADD, - WHISPER_TEXT, - NAVIGATE_TO, - CAMERA_MOVE, - DROP_ITEM, - DROP_ITEM_ALL, - DROP_INV, - DROP_INV_ALL, - USE_INV, - INV_TO_STORAGE, - TRADE_ADD, - STORAGE_TO_INV, - ITEM_PROTECT, - ITEM_UNPROTECT, - KICK_PARTY, - ADD_TEXT, - KICK, - LEAVE_PARTY, - WARP, - CLEAR_CHAT, - PET_MOVE_UP, - PET_MOVE_DOWN, - PET_MOVE_LEFT, - PET_MOVE_RIGHT, - PET_DIRECT_UP, - PET_DIRECT_DOWN, - PET_DIRECT_LEFT, - PET_DIRECT_RIGHT, - PET_AI_START, - PET_AI_STOP, - CHAT_GENERAL_TAB, - CHAT_DEBUG_TAB, - CHAT_BATTLE_TAB, - CHAT_TRADE_TAB, - CHAT_LANG_TAB, - CHAT_GM_TAB, - CHAT_PARTY_TAB, - CHAT_GUILD_TAB, - DROP_CLEAR, - WINDOW_CART, - HEAL_MOST_DAMAGED, - PET_MOVE, - HOMUN_TALK, - HOMUN_SMILE, - HOMUN_EMOTE, - HOMUN_EMOTE_1, - HOMUN_EMOTE_2, - HOMUN_EMOTE_3, - HOMUN_EMOTE_4, - HOMUN_EMOTE_5, - HOMUN_EMOTE_6, - HOMUN_EMOTE_7, - HOMUN_EMOTE_8, - HOMUN_EMOTE_9, - HOMUN_EMOTE_10, - HOMUN_EMOTE_11, - HOMUN_EMOTE_12, - HOMUN_EMOTE_13, - HOMUN_EMOTE_14, - HOMUN_EMOTE_15, - HOMUN_EMOTE_16, - HOMUN_EMOTE_17, - HOMUN_EMOTE_18, - HOMUN_EMOTE_19, - HOMUN_EMOTE_20, - HOMUN_EMOTE_21, - HOMUN_EMOTE_22, - HOMUN_EMOTE_23, - HOMUN_EMOTE_24, - HOMUN_EMOTE_25, - HOMUN_EMOTE_26, - HOMUN_EMOTE_27, - HOMUN_EMOTE_28, - HOMUN_EMOTE_29, - HOMUN_EMOTE_30, - HOMUN_EMOTE_31, - HOMUN_EMOTE_32, - HOMUN_EMOTE_33, - HOMUN_EMOTE_34, - HOMUN_EMOTE_35, - HOMUN_EMOTE_36, - HOMUN_EMOTE_37, - HOMUN_EMOTE_38, - HOMUN_EMOTE_39, - HOMUN_EMOTE_40, - HOMUN_EMOTE_41, - HOMUN_EMOTE_42, - HOMUN_EMOTE_43, - HOMUN_EMOTE_44, - HOMUN_EMOTE_45, - HOMUN_EMOTE_46, - HOMUN_EMOTE_47, - HOMUN_EMOTE_48, - KICK_GUILD, - HAT, - CREATE_PUBLIC_ROOM, - JOIN_ROOM, - LEAVE_ROOM, - WINDOW_QUICK_SETTINGS, - WINDOW_MAIL, - CONF_SET, - SERVER_CONF_SET, - CONG_GET, - SERVER_CONG_GET, - CHANGE_TARGETING_TYPE, - TEST_INFO, - SLIDE, - SELECT_SKILL_LEVEL, - SKILL, - CRAFT_1, - CRAFT_2, - CRAFT_3, - CRAFT_4, - CRAFT_5, - CRAFT_6, - CRAFT_7, - CRAFT_8, - CRAFT_9, - CRAFT, - CHAT_CLIPBOARD, - NPC_CLIPBOARD, - ADD_PICKUP, - REMOVE_PICKUP, - IGNORE_PICKUP, - RESET_MODIFIERS, - BAR_TO_CHAT, - SEEN, - TARGET_SKILL_UNIT, - MONSTER_INFO, - ITEM_INFO, - WHO_DROPS, - MOB_SEARCH, - MOB_SPAWN_SEARCH, - PLAYER_GM_COMMANDS, - PLAYER_CHAR_GM_COMMANDS, - COMMAND_SHOW_LEVEL, - COMMAND_SHOW_STATS, - COMMAND_SHOW_STORAGE, - COMMAND_SHOW_CART, - COMMAND_SHOW_INVENTORY, - LOCATE_PLAYER, - COMMAND_SHOW_ACCOUNT_INFO, - COMMAND_SPAWN, - COMMAND_SPAWN_SLAVE, - COMMAND_SPAWN_CLONE, - COMMAND_SPAWN_SLAVE_CLONE, - COMMAND_SPAWN_EVIL_CLONE, - COMMAND_SAVE_POSITION, - COMMAND_LOAD_POSITION, - COMMAND_RANDOM_WARP, - COMMAND_GOTO_NPC, - COMMAND_KILLER, - COMMAND_KILLABLE, - COMMAND_HEAL, - COMMAND_ALIVE, - COMMAND_DISGUISE, - COMMAND_IMMORTAL, - COMMAND_HIDE, - COMMAND_NUKE, - COMMAND_KILL, - COMMAND_JAIL, - COMMAND_UNJAIL, - COMMAND_NPC_MOVE, - COMMAND_NPC_HIDE, - COMMAND_NPC_SHOW, - COMMAND_CHANGE_PARTY_LEADER, - COMMAND_PARTY_RECALL, - COMMAND_BREAK_GUILD, - COMMAND_GUILD_RECALL, - MAIL_TO, - ADOPT_CHILD, - DUMP_MEMORY_USAGE, - SET_EMOTE_TYPE, - CAMERA_RESTORE, - SHOW_SKILL_LEVELS, - SHOW_SKILL_TYPE, - SELECT_SKILL_TYPE, - SHOW_SKILL_OFFSET_X, - SHOW_SKILL_OFFSET_Y, - SET_SKILL_OFFSET_X, - SET_SKILL_OFFSET_Y, - LEAVE_GUILD, - GUILD_NOTICE, - PARTY_ITEM_SHARE, - PARTY_EXP_SHARE, - PARTY_AUTO_ITEM_SHARE, - CREATE_ITEM, - COPY_OUTFIT_TO_CHAT, - COMMAND_TRANSLATE, - COMMAND_SEND_GUI_KEY, - MOVE_ATTACK_UP, - MOVE_ATTACK_DOWN, - MOVE_PRIORITY_ATTACK_UP, - MOVE_PRIORITY_ATTACK_DOWN, - SHOW_ITEMS, - COMMAND_SEND_MOUSE_KEY, - COMMAND_SEND_CHARS, - CLEAR_OUTFIT, - CLIPBOARD_COPY, - COMMAND_GOTO_PC, - COMMAND_RECALL_PC, - COMMAND_IP_CHECK, - WINDOW_SERVER_INFO, - MERCENARY_TO_MASTER, - HOMUNCULUS_TO_MASTER, - HOMUNCULUS_FEED, - PET_FEED, - PET_DROP_LOOT, - PET_RETURN_TO_EGG, - PET_UNEQUIP, - ADD_SKILL_SHORTCUT, - TOTAL -} -enumEnd(InputAction); - -#endif // ENUMS_INPUT_INPUTACTION_H diff --git a/src/enums/input/inputcondition.h b/src/enums/input/inputcondition.h deleted file mode 100644 index a53aec86c..000000000 --- a/src/enums/input/inputcondition.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_INPUT_INPUTCONDITION_H -#define ENUMS_INPUT_INPUTCONDITION_H - -namespace InputCondition -{ - enum Type - { - DEFAULT = 1, // default condition - ENABLED = 2, // keyboard must be enabled - NOINPUT = 4, // input items must be unfocused - NOAWAY = 8, // player not in away mode - NOSETUP = 16, // setup window is hidde - VALIDSPEED = 32, // valid speed - NOMODAL = 64, // modal windows inactive - NONPCINPUT = 128, // npc input field inactive - EMODS = 256, // game modifiers enabled - NOTARGET = 512, // no target/untarget keys - // pressed - NOFOLLOW = 1024, // follow mode disabled - INGAME = 2048, // game must be started - NOBUYSELL = 4096, // no active buy or sell dialogs - NONPCDIALOG = 8192, // no active npc dialog or - // dialog almost closed - NOTALKING = 16384, // player have no opened - // dialogs what prevent moving - ALIVE = 32768, // player alive - NOVENDING = 65536, // vending disabled - NOROOM = 131072, // not joined room - NOBLOCK = 262144, // no blocked move (trick dead) - KEY_DOWN = 524288, // key press allowed - KEY_UP = 1048576, // key release allowed - SHORTCUT = 2 + 4 + 16 + 512 + 2048, // flags for shortcut keys - SHORTCUT0 = 2 + 4 + 16 + 512, // flags for shortcut keys - GAME = 2 + 4 + 8 + 16 + 64 + 2048, // main game key - GAME2 = 2 + 8 + 16 + 64 + 2048, - ARROWKEYS = 2 + 4 + 8 + 16 + 64 + 2048 + 4096 + - 16384 + 65536 + 131072 + 262144 - }; -} // namespace InputCondition - -#endif // ENUMS_INPUT_INPUTCONDITION_H diff --git a/src/enums/input/inputgroup.h b/src/enums/input/inputgroup.h deleted file mode 100644 index 5fc3c93af..000000000 --- a/src/enums/input/inputgroup.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2007 Joshua Langley - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_INPUT_INPUTGROUP_H -#define ENUMS_INPUT_INPUTGROUP_H - -#include "localconsts.h" - -namespace Input -{ - enum InputGroup - { - GRP_DEFAULT = 1, // default game key - GRP_CHAT = 2, // chat key - GRP_EMOTION = 4, // emotions key - GRP_OUTFIT = 8, // outfit key - GRP_GUI = 16, // gui key - GRP_MOVETOPOINT = 32, // move to point key - GRP_GUICHAN = 64, // for guichan based controls - GRP_REPEAT = 128, // repeat emulation keys - GRP_PET_EMOTION = 256, // pet emotions key - GRP_HOMUN_EMOTION = 512 // homunculus/mercenary emotetions key - }; -} // namespace Input - -#endif // ENUMS_INPUT_INPUTGROUP_H diff --git a/src/enums/input/inputtype.h b/src/enums/input/inputtype.h deleted file mode 100644 index 865d5581a..000000000 --- a/src/enums/input/inputtype.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_INPUT_INPUTTYPE_H -#define ENUMS_INPUT_INPUTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -// hack to avoid conflicts with windows headers. -#ifdef KEYBOARD -#undef KEYBOARD -#endif // KEYBOARD -#ifdef MOUSE -#undef MOUSE -#endif // MOUSE - -enumStart(InputType) -{ - UNKNOWN = 0, - KEYBOARD = 1, - MOUSE = 2, - JOYSTICK = 3 -} -enumEnd(InputType); - -#endif // ENUMS_INPUT_INPUTTYPE_H diff --git a/src/enums/input/keyboardfocus.h b/src/enums/input/keyboardfocus.h deleted file mode 100644 index 9b80f7f20..000000000 --- a/src/enums/input/keyboardfocus.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_INPUT_KEYBOARDFOCUS_H -#define ENUMS_INPUT_KEYBOARDFOCUS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(KeyboardFocus) -{ - Unfocused = 0, - Focused = 1, - Focused2 = 2 -} -enumEnd(KeyboardFocus); - -#endif // ENUMS_INPUT_KEYBOARDFOCUS_H diff --git a/src/enums/input/keyvalue.h b/src/enums/input/keyvalue.h deleted file mode 100644 index 9b83e9666..000000000 --- a/src/enums/input/keyvalue.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ENUMS_INPUT_KEYVALUE_H -#define ENUMS_INPUT_KEYVALUE_H - -#include "localconsts.h" - -// windows.h defines DELETE which breaks this file as we have a constant named -// DELETE, hence we undefine DELETE if it is defined and hope people don't use -// that windows define with Guichan. -#if defined (_WIN32) && defined(DELETE) -#undef DELETE -#endif // defined (_WIN32) && defined(DELETE) - -namespace KeyValue -{ - enum - { - SPACE = ' ', - TAB = '\t', - ENTER = '\n', - // Negative values, to avoid conflicts with higher character codes. - LEFT_ALT = -1000, - RIGHT_ALT = -999, - LEFT_SHIFT = -998, - RIGHT_SHIFT = -997, - LEFT_CONTROL = -996, - RIGHT_CONTROL = -995, - LEFT_META = -994, - RIGHT_META = -993, - LEFT_SUPER = -992, - RIGHT_SUPER = -991, - INSERT = -990, - HOME = -989, - PAGE_UP = -988, - DELETE_ = -987, - END = -986, - PAGE_DOWN = -985, - ESCAPE = -984, - CAPS_LOCK = -983, - BACKSPACE = -982, - F1 = -981, - F2 = -980, - F3 = -979, - F4 = -978, - F5 = -977, - F6 = -978, - F7 = -977, - F8 = -976, - F9 = -975, - F10 = -974, - F11 = -973, - F12 = -972, - F13 = -971, - F14 = -970, - F15 = -969, - PRINT_SCREEN = -968, - SCROLL_LOCK = -967, - PAUSE = -966, - NUM_LOCK = -965, - ALT_GR = -964, - LEFT = -963, - RIGHT = -962, - UP = -961, - DOWN = -960, - TEXTINPUT = -959 - }; -} // namespace KeyValue - -#endif // ENUMS_INPUT_KEYVALUE_H diff --git a/src/enums/inventorytype.h b/src/enums/inventorytype.h deleted file mode 100644 index 91d473f78..000000000 --- a/src/enums/inventorytype.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_INVENTORYTYPE_H -#define ENUMS_INVENTORYTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(InventoryType) -{ - Inventory = 0, - Storage, - Trade, - Npc, - Cart, - Vending, - MailEdit, - MailView, - Craft, - TypeEnd -} -enumEnd(InventoryType); - -#endif // ENUMS_INVENTORYTYPE_H diff --git a/src/enums/magicschool.h b/src/enums/magicschool.h deleted file mode 100644 index 6c1f92c7b..000000000 --- a/src/enums/magicschool.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_MAGICSCHOOL_H -#define ENUMS_MAGICSCHOOL_H - -#ifdef TMWA_SUPPORT - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MagicSchool) -{ - SkillMagic = 340, - SkillMagicLife = 341, - SkillMagicWar = 342, - SkillMagicTransmute = 343, - SkillMagicNature = 344, - SkillMagicAstral = 345 -} -enumEnd(MagicSchool); - -#endif // TMWA_SUPPORT -#endif // ENUMS_MAGICSCHOOL_H diff --git a/src/enums/net/auctionsearchtype.h b/src/enums/net/auctionsearchtype.h deleted file mode 100644 index a21e0226e..000000000 --- a/src/enums/net/auctionsearchtype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_NET_AUCTIONSEARCHTYPE_H -#define ENUMS_NET_AUCTIONSEARCHTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(AuctionSearchType) -{ - Armor = 0, - Weapon = 1, - Card = 2, - Misc = 3, - Name = 4, - AuctionId = 5 -} -enumEnd(AuctionSearchType); - -#endif // ENUMS_NET_AUCTIONSEARCHTYPE_H diff --git a/src/enums/net/battlegroundtype.h b/src/enums/net/battlegroundtype.h deleted file mode 100644 index de7f91fa9..000000000 --- a/src/enums/net/battlegroundtype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2014-2017 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 . - */ - -#ifndef ENUMS_NET_BATTLEGROUNDTYPE_H -#define ENUMS_NET_BATTLEGROUNDTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(BattleGroundType) -{ - Invalid = 0, - Individual = 1, - Party = 2, - Guild = 4 -} -enumEnd(BattleGroundType); - -#endif // ENUMS_NET_BATTLEGROUNDTYPE_H diff --git a/src/enums/net/beingtype.h b/src/enums/net/beingtype.h deleted file mode 100644 index cc1f39889..000000000 --- a/src/enums/net/beingtype.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2014-2017 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 . - */ - -#ifndef ENUMS_NET_BEINGTYPE_H -#define ENUMS_NET_BEINGTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(BeingType) -{ - PC = 0, - NPC = 1, - ITEM = 2, - SKILL = 3, - CHAT = 4, - MONSTER = 5, - NPC_EVENT = 6, - PET = 7, - HOMUN = 8, - MERSOL = 9, - ELEMENTAL = 10 -} -enumEnd(BeingType); - -#endif // ENUMS_NET_BEINGTYPE_H diff --git a/src/enums/net/deleteitemreason.h b/src/enums/net/deleteitemreason.h deleted file mode 100644 index fcab0cb95..000000000 --- a/src/enums/net/deleteitemreason.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_NET_DELETEITEMREASON_H -#define ENUMS_NET_DELETEITEMREASON_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(DeleteItemReason) -{ - Normal = 0, - SkillUse = 1, - FailRefine = 2, - MaterialChange = 3, - ToStorage = 4, - ToCart = 5, - Sold = 6, - Analysis = 7 -} -enumEnd(DeleteItemReason); - -#endif // ENUMS_NET_DELETEITEMREASON_H diff --git a/src/enums/net/downloadstatus.h b/src/enums/net/downloadstatus.h deleted file mode 100644 index 511997dd3..000000000 --- a/src/enums/net/downloadstatus.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_DOWNLOADSTATUS_H -#define ENUMS_NET_DOWNLOADSTATUS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(DownloadStatus) -{ - Cancelled = -3, - ThreadError = -2, - Error = -1, - Starting = 0, - Idle = 1, - Complete = 2 -} -enumEnd(DownloadStatus); - -#endif // ENUMS_NET_DOWNLOADSTATUS_H diff --git a/src/enums/net/mailmessagetype.h b/src/enums/net/mailmessagetype.h deleted file mode 100644 index 8679c31ee..000000000 --- a/src/enums/net/mailmessagetype.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_MAILMESSAGETYPE_H -#define ENUMS_NET_MAILMESSAGETYPE_H - -#include "localconsts.h" - -namespace MailMessageType -{ - enum Type - { - Text = 0, - Money = 2, - Item = 4, - Npc = 8 - }; -} // namespace MailMessageType - -#endif // ENUMS_NET_MAILMESSAGETYPE_H diff --git a/src/enums/net/mailopentype.h b/src/enums/net/mailopentype.h deleted file mode 100644 index ad62a0252..000000000 --- a/src/enums/net/mailopentype.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2014-2017 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 . - */ - -#ifndef NET_EATHENA_MAILOPENTYPE_H -#define NET_EATHENA_MAILOPENTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStartT(MailOpenType, int8_t) -{ - Mail = 0, - Account = 1, - Return = 2 -} -enumEnd(MailOpenType); - -#endif // NET_EATHENA_MAILOPENTYPE_H diff --git a/src/enums/net/menutype.h b/src/enums/net/menutype.h deleted file mode 100644 index 2c4106c05..000000000 --- a/src/enums/net/menutype.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2014-2017 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 . - */ - -#ifndef NET_EATHENA_MENUTYPE_H -#define NET_EATHENA_MENUTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MenuType) -{ - Unknown = 0, - Analysis, - AutoSpell, - AutoShadowSpell, - ChangeMaterial, - CreateConvert, - Eggs, - Feel, - Identify, - MagicDecoy, - MakingArrows, - PoisoningWeapon, - ReadingSpellBook, - RepairWespon, - Teleport, - Warp, - WeaponeRefine -} -enumEnd(MenuType); - -#endif // NET_EATHENA_MENUTYPE_H diff --git a/src/enums/net/npcaction.h b/src/enums/net/npcaction.h deleted file mode 100644 index c000ad17a..000000000 --- a/src/enums/net/npcaction.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_NPCACTION_H -#define ENUMS_NET_NPCACTION_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(NpcAction) -{ - Next = 0, - Close = 1, - Other = 2 -} -enumEnd(NpcAction); - -#endif // ENUMS_NET_NPCACTION_H diff --git a/src/enums/net/packettype.h b/src/enums/net/packettype.h deleted file mode 100644 index 793bee477..000000000 --- a/src/enums/net/packettype.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_PACKETTYPE_H -#define ENUMS_NET_PACKETTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(PacketType) -{ - PACKET_CHAT = 0, - PACKET_PICKUP = 1, - PACKET_DROP = 2, - PACKET_NPC_NEXT = 3, - PACKET_NPC_TALK = 4, - PACKET_NPC_INPUT = 5, - PACKET_EMOTE = 6, - PACKET_SIT = 7, - PACKET_DIRECTION = 8, - PACKET_ATTACK = 9, - PACKET_STOPATTACK = 10, - PACKET_ONLINELIST = 11, - PACKET_WHISPER = 12, - PACKET_SIZE -} -enumEnd(PacketType); - -#endif // ENUMS_NET_PACKETTYPE_H diff --git a/src/enums/net/partyshare.h b/src/enums/net/partyshare.h deleted file mode 100644 index c98027e6f..000000000 --- a/src/enums/net/partyshare.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_PARTYSHARE_H -#define ENUMS_NET_PARTYSHARE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(PartyShare) -{ - UNKNOWN = -1, - NO, - YES, - NOT_POSSIBLE = 2 -} -enumEnd(PartyShare); - -#endif // ENUMS_NET_PARTYSHARE_H diff --git a/src/enums/net/serverfreetype.h b/src/enums/net/serverfreetype.h deleted file mode 100644 index 0819f10f1..000000000 --- a/src/enums/net/serverfreetype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_SERVERFREETYPE_H -#define ENUMS_NET_SERVERFREETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ServerFreeType) -{ - Unknown = 0, - NotSet = 1, - Free = 2, - NonFree = 3 -} -enumEnd(ServerFreeType); - -#endif // ENUMS_NET_SERVERFREETYPE_H diff --git a/src/enums/net/servertype.h b/src/enums/net/servertype.h deleted file mode 100644 index d369ac7b1..000000000 --- a/src/enums/net/servertype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_SERVERTYPE_H -#define ENUMS_NET_SERVERTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ServerType) -{ - UNKNOWN = 0, - TMWATHENA, - EATHENA, - EVOL2 -} -enumEnd(ServerType); - -#endif // ENUMS_NET_SERVERTYPE_H diff --git a/src/enums/net/storesearchtype.h b/src/enums/net/storesearchtype.h deleted file mode 100644 index e7e0ba210..000000000 --- a/src/enums/net/storesearchtype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_NET_STORESEARCHTYPE_H -#define ENUMS_NET_STORESEARCHTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(StoreSearchType) -{ - Vending = 0, - BuingStore = 1 -} -enumEnd(StoreSearchType); - -#endif // ENUMS_NET_STORESEARCHTYPE_H diff --git a/src/enums/net/updatetype.h b/src/enums/net/updatetype.h deleted file mode 100644 index a6aa4918e..000000000 --- a/src/enums/net/updatetype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_NET_UPDATETYPE_H -#define ENUMS_NET_UPDATETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(UpdateType) -{ - Normal = 0, - Close = 1, - Skip = 2, - Custom = 4 -} -enumEnd(UpdateType); - -#endif // ENUMS_NET_UPDATETYPE_H diff --git a/src/enums/particle/alivestatus.h b/src/enums/particle/alivestatus.h deleted file mode 100644 index 93b2cdd71..000000000 --- a/src/enums/particle/alivestatus.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2006-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_PARTICLE_ALIVESTATUS_H -#define ENUMS_PARTICLE_ALIVESTATUS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(AliveStatus) -{ - ALIVE = 0, - DEAD_TIMEOUT = 1, - DEAD_FLOOR = 2, - DEAD_SKY = 4, - DEAD_IMPACT = 8, - DEAD_OTHER = 16, - DEAD_LONG_AGO = 128 -} -enumEnd(AliveStatus); - -#endif // ENUMS_PARTICLE_ALIVESTATUS_H diff --git a/src/enums/particle/particlechangefunc.h b/src/enums/particle/particlechangefunc.h deleted file mode 100644 index 9a0502d8c..000000000 --- a/src/enums/particle/particlechangefunc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2006-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_PARTICLE_PARTICLECHANGEFUNC_H -#define ENUMS_PARTICLE_PARTICLECHANGEFUNC_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ParticleChangeFunc) -{ - FUNC_NONE = 0, - FUNC_SINE, - FUNC_SAW, - FUNC_TRIANGLE, - FUNC_SQUARE -} -enumEnd(ParticleChangeFunc); - -#endif // ENUMS_PARTICLE_PARTICLECHANGEFUNC_H diff --git a/src/enums/particle/particlephysics.h b/src/enums/particle/particlephysics.h deleted file mode 100644 index 961bc15d4..000000000 --- a/src/enums/particle/particlephysics.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_PARTICLE_PARTICLEPHYSICS_H -#define ENUMS_PARTICLE_PARTICLEPHYSICS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ParticlePhysics) -{ - Best = 0, - Normal = 1, - Fast = 2 -} -enumEnd(ParticlePhysics); - -#endif // ENUMS_PARTICLE_PARTICLEPHYSICS_H diff --git a/src/enums/particle/particletype.h b/src/enums/particle/particletype.h deleted file mode 100644 index 03ed9334e..000000000 --- a/src/enums/particle/particletype.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_PARTICLE_PARTICLETYPE_H -#define ENUMS_PARTICLE_PARTICLETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ParticleType) -{ - Normal = 0, - Animation = 1, - Image = 2, - Rotational = 3, - Text = 4 -} -enumEnd(ParticleType); - -#endif // ENUMS_PARTICLE_PARTICLETYPE_H diff --git a/src/enums/render/blitmode.h b/src/enums/render/blitmode.h deleted file mode 100644 index 362d17053..000000000 --- a/src/enums/render/blitmode.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RENDER_BLITMODE_H -#define ENUMS_RENDER_BLITMODE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(BlitMode) -{ - BLIT_NORMAL = 0, - BLIT_GFX -} -enumEnd(BlitMode); - -#endif // ENUMS_RENDER_BLITMODE_H diff --git a/src/enums/render/rendertype.h b/src/enums/render/rendertype.h deleted file mode 100644 index 579fe3d09..000000000 --- a/src/enums/render/rendertype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef ENUMS_RENDER_RENDERTYPE_H -#define ENUMS_RENDER_RENDERTYPE_H - -enum RenderType -{ - RENDER_SOFTWARE = 0, - RENDER_NORMAL_OPENGL = 1, - RENDER_SAFE_OPENGL = 2, - RENDER_GLES_OPENGL = 3, - RENDER_SDL2_DEFAULT = 4, - RENDER_MODERN_OPENGL = 5, - RENDER_GLES2_OPENGL = 6, - RENDER_NULL = 7, - RENDER_LAST -}; - -#endif // ENUMS_RENDER_RENDERTYPE_H diff --git a/src/enums/resources/cursor.h b/src/enums/resources/cursor.h deleted file mode 100644 index eda0907af..000000000 --- a/src/enums/resources/cursor.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_CURSOR_H -#define ENUMS_RESOURCES_CURSOR_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(Cursor) -{ - CURSOR_POINTER = 0, - CURSOR_RESIZE_ACROSS, - CURSOR_RESIZE_DOWN, - CURSOR_RESIZE_DOWN_LEFT, - CURSOR_RESIZE_DOWN_RIGHT, - CURSOR_FIGHT, - CURSOR_PICKUP, - CURSOR_TALK, - CURSOR_ACTION, - CURSOR_LEFT, - CURSOR_UP, - CURSOR_RIGHT, - CURSOR_DOWN, - CURSOR_TOTAL -} -enumEnd(Cursor); - -#endif // ENUMS_RESOURCES_CURSOR_H diff --git a/src/enums/resources/displaytype.h b/src/enums/resources/displaytype.h deleted file mode 100644 index a5aff2244..000000000 --- a/src/enums/resources/displaytype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_DISPLAYTYPE_H -#define ENUMS_RESOURCES_DISPLAYTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(DisplayType) -{ - Item = 0, - Floor = 1 -} -enumEnd(DisplayType); - -#endif // ENUMS_RESOURCES_DISPLAYTYPE_H diff --git a/src/enums/resources/frametype.h b/src/enums/resources/frametype.h deleted file mode 100644 index 9fafa2073..000000000 --- a/src/enums/resources/frametype.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_FRAMETYPE_H -#define ENUMS_RESOURCES_FRAMETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#include "localconsts.h" - -enumStart(FrameType) -{ - ANIMATION = 0, - JUMP, - GOTO, - LABEL, - PAUSE -} -enumEnd(FrameType); - -#endif // ENUMS_RESOURCES_FRAMETYPE_H diff --git a/src/enums/resources/imageposition.h b/src/enums/resources/imageposition.h deleted file mode 100644 index 88b7fae69..000000000 --- a/src/enums/resources/imageposition.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_IMAGEPOSITION_H -#define ENUMS_RESOURCES_IMAGEPOSITION_H - -#include "localconsts.h" - -/** - * 9 images defining a rectangle. 4 corners, 4 sides and a middle area. The - * topology is as follows: - * - *
- *  !-----!-----------------!-----!
- *  !  0  !        1        !  2  !
- *  !-----!-----------------!-----!
- *  !  3  !        4        !  5  !
- *  !-----!-----------------!-----!
- *  !  6  !        7        !  8  !
- *  !-----!-----------------!-----!
- * 
- * - * Sections 0, 2, 6 and 8 will remain as is. 1, 3, 4, 5 and 7 will be - * repeated to fit the size of the widget. - */ -namespace ImagePosition -{ - enum Type - { - UPPER_LEFT = 0, - UPPER_CENTER = 1, - UPPER_RIGHT = 2, - LEFT = 3, - CENTER = 4, - RIGHT = 5, - LOWER_LEFT = 6, - LOWER_CENTER = 7, - LOWER_RIGHT = 8 - }; -} // namespace ImagePosition - -#endif // ENUMS_RESOURCES_IMAGEPOSITION_H diff --git a/src/enums/resources/imagetype.h b/src/enums/resources/imagetype.h deleted file mode 100644 index 145debd7b..000000000 --- a/src/enums/resources/imagetype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_IMAGETYPE_H -#define ENUMS_RESOURCES_IMAGETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ImageType) -{ - Image = 0, - SubImage = 1 -} -enumEnd(ImageType); - -#endif // ENUMS_RESOURCES_IMAGETYPE_H diff --git a/src/enums/resources/item/itemdbtype.h b/src/enums/resources/item/itemdbtype.h deleted file mode 100644 index da35c921e..000000000 --- a/src/enums/resources/item/itemdbtype.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_ITEM_ITEMDBTYPE_H -#define ENUMS_RESOURCES_ITEM_ITEMDBTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ItemDbType) -{ - UNUSABLE = 0, - USABLE, - EQUIPMENT_ONE_HAND_WEAPON, - EQUIPMENT_TWO_HANDS_WEAPON, - EQUIPMENT_TORSO, - EQUIPMENT_ARMS, // 5 - CARD, - EQUIPMENT_HEAD, - EQUIPMENT_LEGS, - EQUIPMENT_SHIELD, - EQUIPMENT_RING, - EQUIPMENT_NECKLACE, // 10 - EQUIPMENT_FEET, - EQUIPMENT_AMMO, - EQUIPMENT_CHARM, - SPRITE_RACE, - SPRITE_HAIR // 15 -} -enumEnd(ItemDbType); - -#endif // ENUMS_RESOURCES_ITEM_ITEMDBTYPE_H diff --git a/src/enums/resources/item/itemsoundevent.h b/src/enums/resources/item/itemsoundevent.h deleted file mode 100644 index 636159835..000000000 --- a/src/enums/resources/item/itemsoundevent.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_ITEM_ITEMSOUNDEVENT_H -#define ENUMS_RESOURCES_ITEM_ITEMSOUNDEVENT_H - -namespace ItemSoundEvent -{ - enum Type - { - HIT = 0, - MISS, - HURT, - DIE, - MOVE, - SIT, - SITTOP, - SPAWN, - DROP, - PICKUP, - TAKE, // take from container - PUT, // put into container - EQUIP, - UNEQUIP, - USE, - USECARD - }; -} // namespace ItemSoundEvent - -#endif // ENUMS_RESOURCES_ITEM_ITEMSOUNDEVENT_H diff --git a/src/enums/resources/item/itemtype.h b/src/enums/resources/item/itemtype.h deleted file mode 100644 index be71e613a..000000000 --- a/src/enums/resources/item/itemtype.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_ITEM_ITEMTYPE_H -#define ENUMS_RESOURCES_ITEM_ITEMTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(ItemType) -{ - Healing = 0, - Unknown = 1, - Usable = 2, - Etc = 3, - Weapon = 4, - Armor = 5, - Card = 6, - PetEgg = 7, - PetArmor = 8, - Unknown2 = 9, - Ammon = 10, - DelayConsume = 11, - Cash = 18 -} -enumEnd(ItemType); - -#endif // ENUMS_RESOURCES_ITEM_ITEMTYPE_H diff --git a/src/enums/resources/mailqueuetype.h b/src/enums/resources/mailqueuetype.h deleted file mode 100644 index bb953f37e..000000000 --- a/src/enums/resources/mailqueuetype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAILQUEUETYPE_H -#define ENUMS_RESOURCES_MAILQUEUETYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MailQueueType) -{ - Unknown = 0, - SendMail = 1, - EditMail = 2, - ValidateTo = 3 -} -enumEnd(MailQueueType); - -#endif // ENUMS_RESOURCES_MAILQUEUETYPE_H diff --git a/src/enums/resources/map/blockmask.h b/src/enums/resources/map/blockmask.h deleted file mode 100644 index 09559bfbf..000000000 --- a/src/enums/resources/map/blockmask.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_BLOCKMASK_H -#define ENUMS_RESOURCES_MAP_BLOCKMASK_H - -namespace BlockMask -{ - enum BlockMask - { - WALL = 0x80, // 1000 0000 - AIR = 0x04, // 0000 0100 - WATER = 0x08, // 0000 1000 - GROUND = 0x10, // 0001 0000 - GROUNDTOP = 0x20, // 0010 0000 - PLAYERWALL = 0x40, // 0100 0000 - MONSTERWALL = 0x02 // 0000 0010 - }; -} // namespace BlockMask - -#endif // ENUMS_RESOURCES_MAP_BLOCKMASK_H diff --git a/src/enums/resources/map/blocktype.h b/src/enums/resources/map/blocktype.h deleted file mode 100644 index 83fe65637..000000000 --- a/src/enums/resources/map/blocktype.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_BLOCKTYPE_H -#define ENUMS_RESOURCES_MAP_BLOCKTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(BlockType) -{ - NONE = -1, - GROUND = 0, - WALL = 1, - AIR = 2, - WATER = 3, - GROUNDTOP = 4, - PLAYERWALL = 5, - MONSTERWALL = 6, - NB_BLOCKTYPES -} -enumEnd(BlockType); - -#endif // ENUMS_RESOURCES_MAP_BLOCKTYPE_H diff --git a/src/enums/resources/map/collisiontype.h b/src/enums/resources/map/collisiontype.h deleted file mode 100644 index 6ce50f2f8..000000000 --- a/src/enums/resources/map/collisiontype.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_COLLISIONTYPE_H -#define ENUMS_RESOURCES_MAP_COLLISIONTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(CollisionType) -{ - COLLISION_EMPTY = 0, // no collision - COLLISION_WALL = 1, // full collison - COLLISION_AIR = 2, // air units can walk - COLLISION_WATER = 3, // water units can walk - COLLISION_GROUNDTOP = 4, // no collision (chair, bed, etc) - COLLISION_PLAYER_WALL = 5, // full collision for player - COLLISION_MONSTER_WALL = 6, // full collision for monster - COLLISION_MAX = 7 // count index -} -enumEnd(CollisionType); - -#endif // ENUMS_RESOURCES_MAP_COLLISIONTYPE_H diff --git a/src/enums/resources/map/mapitemtype.h b/src/enums/resources/map/mapitemtype.h deleted file mode 100644 index 5d9b1734a..000000000 --- a/src/enums/resources/map/mapitemtype.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_MAPITEMTYPE_H -#define ENUMS_RESOURCES_MAP_MAPITEMTYPE_H - -namespace MapItemType -{ - enum Type - { - EMPTY = 0, - HOME = 1, - ROAD = 2, - CROSS = 3, - ARROW_UP = 4, - ARROW_DOWN = 5, - ARROW_LEFT = 6, - ARROW_RIGHT = 7, - PORTAL = 8, - MUSIC = 9, - ATTACK = 10, - PRIORITY = 11, - IGNORE_ = 12, - PICKUP = 13, - NOPICKUP = 14, - SEPARATOR = 15 - }; -} // namespace MapItemType - -#endif // ENUMS_RESOURCES_MAP_MAPITEMTYPE_H diff --git a/src/enums/resources/map/maplayerposition.h b/src/enums/resources/map/maplayerposition.h deleted file mode 100644 index c1b89657f..000000000 --- a/src/enums/resources/map/maplayerposition.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_MAPLAYERPOSITION_H -#define ENUMS_RESOURCES_MAP_MAPLAYERPOSITION_H - -#include "enums/simpletypes/enumdefines.h" - -#include "localconsts.h" - -enumStart(MapLayerPosition) -{ - FOREGROUND_LAYERS = 0, - BACKGROUND_LAYERS -} -enumEnd(MapLayerPosition); - -#endif // ENUMS_RESOURCES_MAP_MAPLAYERPOSITION_H diff --git a/src/enums/resources/map/maplayertype.h b/src/enums/resources/map/maplayertype.h deleted file mode 100644 index 1c2edbbd6..000000000 --- a/src/enums/resources/map/maplayertype.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H -#define ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#include "localconsts.h" - -enumStart(MapLayerType) -{ - TILES = 0, - COLLISION, - HEIGHTS, - ACTIONS -} -enumEnd(MapLayerType); - -#endif // ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H diff --git a/src/enums/resources/map/maptype.h b/src/enums/resources/map/maptype.h deleted file mode 100644 index f9c095ffe..000000000 --- a/src/enums/resources/map/maptype.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_MAP_MAPTYPE_H -#define ENUMS_RESOURCES_MAP_MAPTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(MapType) -{ - NORMAL = 0, - DEBUGTYPE = 1, - SPECIAL = 2, - SPECIAL2 = 3, - SPECIAL3 = 4, - SPECIAL4 = 5, - BLACKWHITE = 6 -} -enumEnd(MapType); - -#endif // ENUMS_RESOURCES_MAP_MAPTYPE_H diff --git a/src/enums/resources/notifyflags.h b/src/enums/resources/notifyflags.h deleted file mode 100644 index 50dedf459..000000000 --- a/src/enums/resources/notifyflags.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_NOTIFYFLAGS_H -#define ENUMS_RESOURCES_NOTIFYFLAGS_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(NotifyFlags) -{ - EMPTY = 0, - INT, - STRING, - GUILD, - GUILD_STRING, - PARTY, - PARTY_STRING, - SPEECH -} -enumEnd(NotifyFlags); - -#endif // ENUMS_RESOURCES_NOTIFYFLAGS_H diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h deleted file mode 100644 index 1c2dee843..000000000 --- a/src/enums/resources/notifytypes.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_NOTIFYTYPES_H -#define ENUMS_RESOURCES_NOTIFYTYPES_H - -#include "localconsts.h" - -namespace NotifyTypes -{ - enum Type - { - NONE = 0, - BUY_DONE, - BUY_FAILED, - BUY_FAILED_NO_MONEY, - BUY_FAILED_OVERWEIGHT, - BUY_FAILED_TOO_MANY_ITEMS, - SELL_LIST_EMPTY, - SOLD, - SELL_FAILED, - SELL_TRADE_FAILED, - SELL_UNSELLABLE_FAILED, - ONLINE_USERS, - GUILD_CREATED, - GUILD_ALREADY, - GUILD_EMPERIUM_CHECK_FAILED, - GUILD_ERROR, - GUILD_LEFT, - GUILD_INVITE_FAILED, - GUILD_INVITE_REJECTED, - GUILD_INVITE_JOINED, - GUILD_INVITE_FULL, - GUILD_INVITE_ERROR, - GUILD_USER_LEFT, - GUILD_KICKED, - GUILD_USER_KICKED, - USE_FAILED, - EQUIP_FAILED, - EQUIP_FAILED_LEVEL, - UNEQUIP_FAILED, - PARTY_CREATE_FAILED, - PARTY_CREATED, - PARTY_LEFT, - PARTY_LEFT_DENY, - PARTY_KICKED, - PARTY_KICK_DENY, - PARTY_USER_JOINED, - PARTY_INVITE_ALREADY_MEMBER, - PARTY_INVITE_REFUSED, - PARTY_INVITE_DONE, - PARTY_INVITE_PARTY_FULL, - PARTY_INVITE_ERROR, - PARTY_EXP_SHARE_ON, - PARTY_EXP_SHARE_OFF, - PARTY_EXP_SHARE_ERROR, - PARTY_ITEM_SHARE_ON, - PARTY_ITEM_SHARE_OFF, - PARTY_ITEM_SHARE_ERROR, - PARTY_USER_LEFT, - PARTY_USER_LEFT_DENY, - PARTY_USER_KICKED, - PARTY_USER_KICK_DENY, - PARTY_UNKNOWN_USER_MSG, - PARTY_USER_NOT_IN_PARTY, - MONEY_GET, - MONEY_SPENT, - SKILL_RAISE_ERROR, - ARROWS_EQUIP_NEEDED, - TRADE_FAIL_FAR_AWAY, - TRADE_FAIL_CHAR_NOT_EXISTS, - TRADE_CANCELLED_ERROR, - TRADE_CANCELLED_NAME, - TRADE_CANCELLED_BUSY, - TRADE_ERROR_UNKNOWN, - TRADE_ADD_PARTNER_OVER_WEIGHT, - TRADE_ADD_PARTNER_NO_SLOTS, - TRADE_ADD_UNTRADABLE_ITEM, - TRADE_ADD_ERROR, - TRADE_CANCELLED, - TRADE_COMPLETE, - KICK_FAIL, - KICK_SUCCEED, - MVP_PLAYER, - WHISPERS_IGNORED, - WHISPERS_IGNORE_FAILED, - WHISPERS_UNIGNORED, - WHISPERS_UNIGNORE_FAILED, - SKILL_FAIL_MESSAGE, - PVP_OFF_GVG_OFF, - PVP_ON, - GVG_ON, - PVP_ON_GVG_ON, - PVP_UNKNOWN, - PARTY_INVITE_PARTY_SAME_ACCOUNT, - PARTY_INVITE_PARTY_BLOCKED_INVITE, - PARTY_INVITE_PARTY_NOT_ONLINE, - PET_CATCH_FAILED, - PET_CATCH_SUCCESS, - PET_CATCH_UNKNOWN, - MERCENARY_EXPIRED, - MERCENARY_KILLED, - MERCENARY_FIRED, - MERCENARY_RUN, - MERCENARY_UNKNOWN, - HOMUNCULUS_FEED_OK, - HOMUNCULUS_FEED_FAIL, - CARD_INSERT_FAILED, - CARD_INSERT_SUCCESS, - BANK_DEPOSIT_FAILED, - BANK_WITHDRAW_FAILED, - BUYING_STORE_CREATE_FAILED, - BUYING_STORE_CREATE_FAILED_WEIGHT, - BUYING_STORE_CREATE_EMPTY, - BUYING_STORE_SELL_FAILED_MONEY_LIMIT, - BUYING_STORE_SELL_FAILED_EMPTY, - BUYING_STORE_SELL_FAILED, - BUYING_STORE_SELLER_SELL_FAILED_DEAL, - BUYING_STORE_SELLER_SELL_FAILED_AMOUNT, - BUYING_STORE_SELLER_SELL_FAILED_BALANCE, - BUYING_STORE_SELLER_SELL_FAILED, - SEARCH_STORE_FAILED, - SEARCH_STORE_FAILED_NO_STORES, - SEARCH_STORE_FAILED_MANY_RESULTS, - SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE, - SEARCH_STORE_FAILED_CANT_SEARCH_YET, - SEARCH_STORE_FAILED_NO_INFORMATION, - PET_FEED_OK, - PET_FEED_ERROR, - MANNER_CHANGED, - MANNER_POSITIVE_POINTS, - MANNER_NEGATIVE_POINTS, - ROOM_LIMIT_EXCEEDED, - ROOM_ALREADY_EXISTS, - ROOM_JOINED, - ROOM_LEAVE, - ROOM_KICKED, - ROOM_ROLE_OWNER, - ROOM_ERROR_FULL, - ROOM_ERROR_WRONG_PASSWORD, - ROOM_ERROR_KICKED, - ROOM_ERROR_ZENY, - ROOM_ERROR_LOW_LEVEL, - ROOM_ERROR_HIGH_LEVEL, - ROOM_ERROR_RACE, - USE_ITEM_WAIT, - MAIL_SEND_OK, - MAIL_SEND_ERROR, - MAIL_ATTACH_ITEM_ERROR, - MAIL_ATTACH_MONEY_ERROR, - MAIL_RETURN_ERROR, - MAIL_RETURN_OK, - MAIL_DELETE_ERROR, - MAIL_DELETE_OK, - MAIL_GET_ATTACH_OK, - MAIL_GET_ATTACH_ERROR, - MAIL_GET_ATTACH_TOO_MANY_ITEMS, - NEW_MAIL, - MAP_TYPE_BATTLEFIELD, - RENTAL_TIME_LEFT, - RENTAL_TIME_EXPIRED, - REFINE_SUCCESS, - REFINE_FAILURE, - REFINE_DOWNGRADE, - REFINE_UNKNOWN, - CART_ADD_WEIGHT_ERROR, - CART_ADD_COUNT_ERROR, - BOUND_ITEM, - SKILL_END_ALL_NEGATIVE_STATUS, - SKILL_IMMUNITY_TO_ALL_STATUSES, - SKILL_MAX_HP, - SKILL_MAX_SP, - SKILL_ALL_STATUS_PLUS_20, - SKILL_ENCHANT_WEAPON_HOLY, - SKILL_ENCHANT_ARMOR_HOLY, - SKILL_DEF_PLUS_25, - SKILL_ATTACK_PLUS_100, - SKILL_FLEE_PLUS_50, - SKILL_FULL_STRIP_FAILED, - SKILL_MESSAGE_UNKNOWN, - IGNORE_PLAYER_SUCCESS, - IGNORE_PLAYER_FAILURE, - IGNORE_PLAYER_TOO_MANY, - IGNORE_PLAYER_UNKNOWN, - UNIGNORE_PLAYER_SUCCESS, - UNIGNORE_PLAYER_FAILURE, - UNIGNORE_PLAYER_UNKNOWN, - IGNORE_PLAYER_TYPE_UNKNOWN, - PET_CATCH_PROCESS, - DELETE_ITEM_NORMAL, - DELETE_ITEM_SKILL_USE, - DELETE_ITEM_FAIL_REFINE, - DELETE_ITEM_MATERIAL_CHANGE, - DELETE_ITEM_TO_STORAGE, - DELETE_ITEM_TO_CART, - DELETE_ITEM_SOLD, - DELETE_ITEM_ANALYSIS, - DELETE_ITEM_UNKNOWN, - DELETE_ITEM_DROPPED, - BEING_REMOVE_DIED, - BEING_REMOVE_LOGGED_OUT, - BEING_REMOVE_WARPED, - BEING_REMOVE_TRICK_DEAD, - BEING_REMOVE_UNKNOWN, - DIVORCED, - CALLED_PARTNER, - CALLING_PARTNER, - ADOPT_CHILD_ERROR_HAVE_BABY, - ADOPT_CHILD_ERROR_LEVEL, - ADOPT_CHILD_ERROR_BABY_MARRIED, - SKILL_MEMO_SAVED, - SKILL_MEMO_ERROR_LEVEL, - SKILL_MEMO_ERROR_SKILL, - BUY_TRADE_FAILED, - VENDING_SOLD_ITEM, - BUY_FAILED_NPC_NOT_FOUND, - BUY_FAILED_SYSTEM_ERROR, - BUY_FAILED_WRONG_ITEM, - MAIL_NAME_VALIDATION_ERROR, - MAIL_ATTACH_ITEM_WEIGHT_ERROR, - MAIL_ATTACH_ITEM_FATAL_ERROR, - MAIL_ATTACH_ITEM_NO_SPACE, - MAIL_ATTACH_ITEM_NOT_TRADEABLE, - MAIL_ATTACH_ITEM_UNKNOWN_ERROR, - MAIL_REMOVE_ITEM_ERROR, - MAIL_SEND_FATAL_ERROR, - MAIL_SEND_COUNT_ERROR, - MAIL_SEND_ITEM_ERROR, - MAIL_SEND_RECEIVER_ERROR, - MAIL_GET_ATTACH_FULL_ERROR, - MAIL_GET_MONEY_OK, - MAIL_GET_MONEY_ERROR, - MAIL_GET_MONEY_LIMIT_ERROR, - - TYPE_END - }; -} // namespace NotifyTypes -#endif // ENUMS_RESOURCES_NOTIFYTYPES_H diff --git a/src/enums/resources/questtype.h b/src/enums/resources/questtype.h deleted file mode 100644 index 2140d040a..000000000 --- a/src/enums/resources/questtype.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_QUESTTYPE_H -#define ENUMS_RESOURCES_QUESTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(QuestType) -{ - TEXT = 0, - NAME = 1, - REWARD = 2, - GIVER = 3, - COORDINATES = 4, - NPC = 5 -} -enumEnd(QuestType); - -#endif // ENUMS_RESOURCES_QUESTTYPE_H diff --git a/src/enums/resources/servercommandenable.h b/src/enums/resources/servercommandenable.h deleted file mode 100644 index 4541eea75..000000000 --- a/src/enums/resources/servercommandenable.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SERVERCOMMANDENABLE_H -#define ENUMS_RESOURCES_SERVERCOMMANDENABLE_H - -#include "localconsts.h" - -namespace ServerCommandEnable -{ - enum Type - { - No = 0, - Self = 1, - Other = 2, - Both = 3 - }; -} // namespace ServerCommandEnable - -#endif // ENUMS_RESOURCES_SERVERCOMMANDENABLE_H diff --git a/src/enums/resources/servercommandtype.h b/src/enums/resources/servercommandtype.h deleted file mode 100644 index 2b20c296f..000000000 --- a/src/enums/resources/servercommandtype.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SERVERCOMMANDTYPE_H -#define ENUMS_RESOURCES_SERVERCOMMANDTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#define servercommandFirst(name) name = 0, -#define servercommand(name) name, -#define servercommand2(name1, name2) name1, - -enumStart(ServerCommandType) -{ -#include "resources/servercommands.inc" - Max -} -enumEnd(ServerCommandType); - -#undef servercommandFirst -#undef servercommand -#undef servercommand2 - -SERVERCOMMANDS_VOID -#undef SERVERCOMMANDS_VOID - -#endif // ENUMS_RESOURCES_SERVERCOMMANDTYPE_H diff --git a/src/enums/resources/serverpermissiontype.h b/src/enums/resources/serverpermissiontype.h deleted file mode 100644 index 2de362ce9..000000000 --- a/src/enums/resources/serverpermissiontype.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SERVERPERMISSIONTYPE_H -#define ENUMS_RESOURCES_SERVERPERMISSIONTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -#define serverpermissionFirst(name) name = 0, -#define serverpermission(name) name, - -enumStart(ServerPermissionType) -{ -#include "resources/serverpermissions.inc" - Max -} -enumEnd(ServerPermissionType); - -#undef serverpermissionFirst -#undef serverpermission - -SERVERPERMISSION_VOID -#undef SERVERPERMISSION_VOID -#endif // ENUMS_RESOURCES_SERVERPERMISSIONTYPE_H diff --git a/src/enums/resources/skill/casttype.h b/src/enums/resources/skill/casttype.h deleted file mode 100644 index b73cd138d..000000000 --- a/src/enums/resources/skill/casttype.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_CASTTYPE_H -#define ENUMS_RESOURCES_CASTTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(CastType) -{ - Default = 0, - Target = 1, - Position = 2, - Self = 3 -} -enumEnd(CastType); - -#endif // ENUMS_RESOURCES_CASTTYPE_H diff --git a/src/enums/resources/skill/skillowner.h b/src/enums/resources/skill/skillowner.h deleted file mode 100644 index 01938bb30..000000000 --- a/src/enums/resources/skill/skillowner.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SKILL_SKILLOWNER_H -#define ENUMS_RESOURCES_SKILL_SKILLOWNER_H - -namespace SkillOwner -{ - enum Type - { - Player = 0, - Mercenary = 1, - Homunculus = 2, - Guild = 3 - }; -} // namespace SkillOwner - -#endif // ENUMS_RESOURCES_SKILL_SKILLOWNER_H diff --git a/src/enums/resources/skill/skillsettype.h b/src/enums/resources/skill/skillsettype.h deleted file mode 100644 index d574f6cbe..000000000 --- a/src/enums/resources/skill/skillsettype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H -#define ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(SkillSetType) -{ - VerticalList = 0, - Rectangle = 1 -} -enumEnd(SkillSetType); - -#endif // ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H diff --git a/src/enums/resources/skill/skilltype.h b/src/enums/resources/skill/skilltype.h deleted file mode 100644 index 3818adec6..000000000 --- a/src/enums/resources/skill/skilltype.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SKILL_SKILLTYPE_H -#define ENUMS_RESOURCES_SKILL_SKILLTYPE_H - -// aka inf -namespace SkillType -{ - enum SkillType - { - Unknown = 0, - Attack = 1, - Ground = 2, - Self = 4, - Unused = 8, - Support = 16, - TargetTrap = 32 - }; -} // namespace SkillType - -#endif // ENUMS_RESOURCES_SKILL_SKILLTYPE_H diff --git a/src/enums/resources/skill/skilltype2.h b/src/enums/resources/skill/skilltype2.h deleted file mode 100644 index 07f392b48..000000000 --- a/src/enums/resources/skill/skilltype2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SKILL_SKILLTYPE2_H -#define ENUMS_RESOURCES_SKILL_SKILLTYPE2_H - -// aka inf2 -namespace SkillType2 -{ - enum SkillType2 - { - Unknown = 0, - Quest = 1, - Npc = 2, - Wedding = 4, - Spirit = 8, - Guild = 16, - SongDance = 32, - Ensemble = 64, - Trap = 128, - TargetSelf = 256, - NoTargetSelf = 512, - PartyOnly = 1024, - GuildOnly = 2048, - NoEnemy = 4096, - NoLandProtector = 8192, - Chorus = 16384, - FreeCastNormal = 32768, - FreeCastReduced = 65536, - FreeCastAny = 98304 - }; -} // namespace SkillType2 - -#endif // ENUMS_RESOURCES_SKILL_SKILLTYPE2_H diff --git a/src/enums/resources/spritedirection.h b/src/enums/resources/spritedirection.h deleted file mode 100644 index 935c05bd6..000000000 --- a/src/enums/resources/spritedirection.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_RESOURCES_SPRITEDIRECTION_H -#define ENUMS_RESOURCES_SPRITEDIRECTION_H - -namespace SpriteDirection -{ - enum Type - { - DEFAULT = 0, - UP = 1, - DOWN = 2, - LEFT = 3, - RIGHT = 4, - UPLEFT = 5, - UPRIGHT = 6, - DOWNLEFT = 7, - DOWNRIGHT = 8, - INVALID - }; -} // namespace SpriteDirection - -#endif // ENUMS_RESOURCES_SPRITEDIRECTION_H diff --git a/src/enums/screendensity.h b/src/enums/screendensity.h deleted file mode 100644 index 42e8f277d..000000000 --- a/src/enums/screendensity.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef ENUMS_SCREENDENSITY_H -#define ENUMS_SCREENDENSITY_H - -enum ScreenDensity -{ - DENSITY_UNKNOWN = -1, - DENSITY_LOW = 0, - DENSITY_MEDIUM = 1, - DENSITY_TV = 2, - DENSITY_HIGH = 3, - DENSITY_XHIGH = 4, - DENSITY_XXHIGH = 5 -}; - -#endif // ENUMS_SCREENDENSITY_H diff --git a/src/enums/simpletypes/advanced.h b/src/enums/simpletypes/advanced.h deleted file mode 100644 index 65533c1a9..000000000 --- a/src/enums/simpletypes/advanced.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ADVANCED_H -#define ENUMS_SIMPLETYPES_ADVANCED_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Advanced); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ADVANCED_H diff --git a/src/enums/simpletypes/allowquit.h b/src/enums/simpletypes/allowquit.h deleted file mode 100644 index c18b87461..000000000 --- a/src/enums/simpletypes/allowquit.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ALLOWQUIT_H -#define ENUMS_SIMPLETYPES_ALLOWQUIT_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(AllowQuit); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ALLOWQUIT_H diff --git a/src/enums/simpletypes/allowsort.h b/src/enums/simpletypes/allowsort.h deleted file mode 100644 index b6785c364..000000000 --- a/src/enums/simpletypes/allowsort.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ALLOWSORT_H -#define ENUMS_SIMPLETYPES_ALLOWSORT_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(AllowSort); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ALLOWSORT_H diff --git a/src/enums/simpletypes/allplayers.h b/src/enums/simpletypes/allplayers.h deleted file mode 100644 index 343018808..000000000 --- a/src/enums/simpletypes/allplayers.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ALLPLAYERS_H -#define ENUMS_SIMPLETYPES_ALLPLAYERS_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(AllPlayers); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ALLPLAYERS_H diff --git a/src/enums/simpletypes/append.h b/src/enums/simpletypes/append.h deleted file mode 100644 index 14c078d07..000000000 --- a/src/enums/simpletypes/append.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_APPEND_H -#define ENUMS_SIMPLETYPES_APPEND_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Append); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_APPEND_H diff --git a/src/enums/simpletypes/autorelease.h b/src/enums/simpletypes/autorelease.h deleted file mode 100644 index aabb53fdd..000000000 --- a/src/enums/simpletypes/autorelease.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_AUTORELEASE_H -#define ENUMS_SIMPLETYPES_AUTORELEASE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(AutoRelease); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_AUTORELEASE_H diff --git a/src/enums/simpletypes/autotarget.h b/src/enums/simpletypes/autotarget.h deleted file mode 100644 index f1e4c8f9b..000000000 --- a/src/enums/simpletypes/autotarget.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_AUTOTARGET_H -#define ENUMS_SIMPLETYPES_AUTOTARGET_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(AutoTarget); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_AUTOTARGET_H diff --git a/src/enums/simpletypes/beingid.h b/src/enums/simpletypes/beingid.h deleted file mode 100644 index 5fda30b8f..000000000 --- a/src/enums/simpletypes/beingid.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_BEINGID_H -#define ENUMS_SIMPLETYPES_BEINGID_H - -#include "enums/simpletypes/intdefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defIntEnum(BeingId, int); -defIntEnumNeg(BeingId); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_BEINGID_H diff --git a/src/enums/simpletypes/beingtypeid.h b/src/enums/simpletypes/beingtypeid.h deleted file mode 100644 index 1294048c0..000000000 --- a/src/enums/simpletypes/beingtypeid.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_BEINGTYPEID_H -#define ENUMS_SIMPLETYPES_BEINGTYPEID_H - -#include "enums/simpletypes/intdefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defIntEnum(BeingTypeId, int); -defIntEnumNeg(BeingTypeId); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_BEINGTYPEID_H diff --git a/src/enums/simpletypes/booldefines.h b/src/enums/simpletypes/booldefines.h deleted file mode 100644 index 52aa81fd5..000000000 --- a/src/enums/simpletypes/booldefines.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_BOOLDEFINES_H -#define ENUMS_SIMPLETYPES_BOOLDEFINES_H - -#include "localconsts.h" - - - -#ifdef ADVGCC - -#define defBoolEnum(name) \ - enum class name : bool \ - { \ - MFalse = false, \ - MTrue = true \ - }; \ - const name name##_true = name::MTrue; \ - const name name##_false = name::MFalse \ - -#define fromBool(val, name) \ - (val) ? name::MTrue : name::MFalse - -#else // ADVGCC - -#define defBoolEnum(name) \ - const bool name##_true = true; \ - const bool name##_false = false; \ - typedef bool name -#define fromBool(val, name) \ - (val) ? true : false - -#endif // ADVGCC - -#endif // ENUMS_SIMPLETYPES_BOOLDEFINES_H diff --git a/src/enums/simpletypes/damaged.h b/src/enums/simpletypes/damaged.h deleted file mode 100644 index 2cda3d2a0..000000000 --- a/src/enums/simpletypes/damaged.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_DAMAGED_H -#define ENUMS_SIMPLETYPES_DAMAGED_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Damaged); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_DAMAGED_H diff --git a/src/enums/simpletypes/donotalign.h b/src/enums/simpletypes/donotalign.h deleted file mode 100644 index fd0030de0..000000000 --- a/src/enums/simpletypes/donotalign.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_DONOTALIGN_H -#define ENUMS_SIMPLETYPES_DONOTALIGN_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(DoNotAlign); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_DONOTALIGN_H diff --git a/src/enums/simpletypes/enable.h b/src/enums/simpletypes/enable.h deleted file mode 100644 index 47e70bae5..000000000 --- a/src/enums/simpletypes/enable.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ENABLE_H -#define ENUMS_SIMPLETYPES_ENABLE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Enable); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ENABLE_H diff --git a/src/enums/simpletypes/enumdefines.h b/src/enums/simpletypes/enumdefines.h deleted file mode 100644 index a1b5401ff..000000000 --- a/src/enums/simpletypes/enumdefines.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ENUMDEFINES_H -#define ENUMS_SIMPLETYPES_ENUMDEFINES_H - -#include "localconsts.h" - -#ifdef ADVGCC - -#define enumStart(name) enum class name -#define enumStartT(name, type) enum class name : type -#define enumEnd(name) ; \ - typedef name name##T - -#else // ADVGCC - -#define enumStart(name) \ - namespace name \ - { \ - enum T - -#define enumStartT(name, type) \ - namespace name \ - { \ - enum T - -#define enumEnd(name) \ - ;\ - } \ - typedef name::T name##T - -#endif // ADVGCC - -#define enum2Start(name) \ - namespace name \ - { \ - enum T - -#define enum2End(name) \ - ;\ - } \ - typedef name::T name##T - -#endif // ENUMS_SIMPLETYPES_ENUMDEFINES_H diff --git a/src/enums/simpletypes/equipm.h b/src/enums/simpletypes/equipm.h deleted file mode 100644 index fcdd503d1..000000000 --- a/src/enums/simpletypes/equipm.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_EQUIPM_H -#define ENUMS_SIMPLETYPES_EQUIPM_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Equipm); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_EQUIPM_H diff --git a/src/enums/simpletypes/equipped.h b/src/enums/simpletypes/equipped.h deleted file mode 100644 index 7aea246d6..000000000 --- a/src/enums/simpletypes/equipped.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_EQUIPPED_H -#define ENUMS_SIMPLETYPES_EQUIPPED_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Equipped); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_EQUIPPED_H diff --git a/src/enums/simpletypes/favorite.h b/src/enums/simpletypes/favorite.h deleted file mode 100644 index 8748461f7..000000000 --- a/src/enums/simpletypes/favorite.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_FAVORITE_H -#define ENUMS_SIMPLETYPES_FAVORITE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Favorite); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_FAVORITE_H diff --git a/src/enums/simpletypes/forcedisplay.h b/src/enums/simpletypes/forcedisplay.h deleted file mode 100644 index be3943b04..000000000 --- a/src/enums/simpletypes/forcedisplay.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_FORCEDISPLAY_H -#define ENUMS_SIMPLETYPES_FORCEDISPLAY_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(ForceDisplay); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_FORCEDISPLAY_H diff --git a/src/enums/simpletypes/forcequantity.h b/src/enums/simpletypes/forcequantity.h deleted file mode 100644 index 7363c7070..000000000 --- a/src/enums/simpletypes/forcequantity.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_FORCEQUANTITY_H -#define ENUMS_SIMPLETYPES_FORCEQUANTITY_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(ForceQuantity); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_FORCEQUANTITY_H diff --git a/src/enums/simpletypes/identified.h b/src/enums/simpletypes/identified.h deleted file mode 100644 index 6067655bf..000000000 --- a/src/enums/simpletypes/identified.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_IDENTIFIED_H -#define ENUMS_SIMPLETYPES_IDENTIFIED_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Identified); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_IDENTIFIED_H diff --git a/src/enums/simpletypes/ignorerecord.h b/src/enums/simpletypes/ignorerecord.h deleted file mode 100644 index b781116d4..000000000 --- a/src/enums/simpletypes/ignorerecord.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_IGNORERECORD_H -#define ENUMS_SIMPLETYPES_IGNORERECORD_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(IgnoreRecord); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_IGNORERECORD_H diff --git a/src/enums/simpletypes/intdefines.h b/src/enums/simpletypes/intdefines.h deleted file mode 100644 index 2bae4b02c..000000000 --- a/src/enums/simpletypes/intdefines.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_INTDEFINES_H -#define ENUMS_SIMPLETYPES_INTDEFINES_H - -#include "localconsts.h" - -#ifdef ADVGCC - -#define defIntEnum(name, type) \ - enum class name : type \ - { \ - }; \ - const name name##_zero = static_cast(0); \ - const name name##_one = static_cast(1) - -#define fromInt(val, name) static_cast(val) -#define toInt(val, name) static_cast(val) -#define defIntEnumNeg(name) const name name##_negOne = static_cast(-1) - -#else // ADVGCC - -#define defIntEnum(name, type) \ - typedef type name; \ - const name name##_zero = 0; \ - const name name##_one = 1 -#define fromInt(val, name) static_cast(val) -#define toInt(val, name) (val) -#define defIntEnumNeg(name) const name name##_negOne = -1 - -#endif // ADVGCC - -#endif // ENUMS_SIMPLETYPES_INTDEFINES_H diff --git a/src/enums/simpletypes/issell.h b/src/enums/simpletypes/issell.h deleted file mode 100644 index ba4c9a9cc..000000000 --- a/src/enums/simpletypes/issell.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ISSELL_H -#define ENUMS_SIMPLETYPES_ISSELL_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(IsSell); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ISSELL_H diff --git a/src/enums/simpletypes/isstart.h b/src/enums/simpletypes/isstart.h deleted file mode 100644 index 7b133173d..000000000 --- a/src/enums/simpletypes/isstart.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ISSTART_H -#define ENUMS_SIMPLETYPES_ISSTART_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(IsStart); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ISSTART_H diff --git a/src/enums/simpletypes/itemcolor.h b/src/enums/simpletypes/itemcolor.h deleted file mode 100644 index d47d30fb1..000000000 --- a/src/enums/simpletypes/itemcolor.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ITEMCOLOR_H -#define ENUMS_SIMPLETYPES_ITEMCOLOR_H - -#include "enums/simpletypes/intdefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defIntEnum(ItemColor, uint16_t); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ITEMCOLOR_H diff --git a/src/enums/simpletypes/keep.h b/src/enums/simpletypes/keep.h deleted file mode 100644 index 6be7a9800..000000000 --- a/src/enums/simpletypes/keep.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_KEEP_H -#define ENUMS_SIMPLETYPES_KEEP_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Keep); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_KEEP_H diff --git a/src/enums/simpletypes/losefocusontab.h b/src/enums/simpletypes/losefocusontab.h deleted file mode 100644 index 5068631a0..000000000 --- a/src/enums/simpletypes/losefocusontab.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H -#define ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(LoseFocusOnTab); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_LOSEFOCUSONTAB_H diff --git a/src/enums/simpletypes/mainconfig.h b/src/enums/simpletypes/mainconfig.h deleted file mode 100644 index 03ef60113..000000000 --- a/src/enums/simpletypes/mainconfig.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_MAINCONFIG_H -#define ENUMS_SIMPLETYPES_MAINCONFIG_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(MainConfig); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_MAINCONFIG_H diff --git a/src/enums/simpletypes/modal.h b/src/enums/simpletypes/modal.h deleted file mode 100644 index 04026ac85..000000000 --- a/src/enums/simpletypes/modal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_MODAL_H -#define ENUMS_SIMPLETYPES_MODAL_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Modal); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_MODAL_H diff --git a/src/enums/simpletypes/modifiable.h b/src/enums/simpletypes/modifiable.h deleted file mode 100644 index 9ec47f1b7..000000000 --- a/src/enums/simpletypes/modifiable.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_MODIFIABLE_H -#define ENUMS_SIMPLETYPES_MODIFIABLE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Modifiable); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_MODIFIABLE_H diff --git a/src/enums/simpletypes/move.h b/src/enums/simpletypes/move.h deleted file mode 100644 index 32044e94b..000000000 --- a/src/enums/simpletypes/move.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_MOVE_H -#define ENUMS_SIMPLETYPES_MOVE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Move); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_MOVE_H diff --git a/src/enums/simpletypes/notify.h b/src/enums/simpletypes/notify.h deleted file mode 100644 index 8244bb297..000000000 --- a/src/enums/simpletypes/notify.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_NOTIFY_H -#define ENUMS_SIMPLETYPES_NOTIFY_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Notify); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_NOTIFY_H diff --git a/src/enums/simpletypes/npcnames.h b/src/enums/simpletypes/npcnames.h deleted file mode 100644 index 0135a131a..000000000 --- a/src/enums/simpletypes/npcnames.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_NPCNAMES_H -#define ENUMS_SIMPLETYPES_NPCNAMES_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(NpcNames); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_NPCNAMES_H diff --git a/src/enums/simpletypes/online.h b/src/enums/simpletypes/online.h deleted file mode 100644 index 9c182c1a5..000000000 --- a/src/enums/simpletypes/online.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ONLINE_H -#define ENUMS_SIMPLETYPES_ONLINE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Online); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ONLINE_H diff --git a/src/enums/simpletypes/onthefly.h b/src/enums/simpletypes/onthefly.h deleted file mode 100644 index 9fff4b144..000000000 --- a/src/enums/simpletypes/onthefly.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_ONTHEFLY_H -#define ENUMS_SIMPLETYPES_ONTHEFLY_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(OnTheFly); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_ONTHEFLY_H diff --git a/src/enums/simpletypes/opaque.h b/src/enums/simpletypes/opaque.h deleted file mode 100644 index 1df5d3796..000000000 --- a/src/enums/simpletypes/opaque.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_OPAQUE_H -#define ENUMS_SIMPLETYPES_OPAQUE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Opaque); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_OPAQUE_H diff --git a/src/enums/simpletypes/protected.h b/src/enums/simpletypes/protected.h deleted file mode 100644 index d14db96c8..000000000 --- a/src/enums/simpletypes/protected.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_PROTECTED_H -#define ENUMS_SIMPLETYPES_PROTECTED_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Protected); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_PROTECTED_H diff --git a/src/enums/simpletypes/separator.h b/src/enums/simpletypes/separator.h deleted file mode 100644 index 2969d03e9..000000000 --- a/src/enums/simpletypes/separator.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SEPARATOR_H -#define ENUMS_SIMPLETYPES_SEPARATOR_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Separator); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SEPARATOR_H diff --git a/src/enums/simpletypes/sfx.h b/src/enums/simpletypes/sfx.h deleted file mode 100644 index c46fb67b8..000000000 --- a/src/enums/simpletypes/sfx.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SFX_H -#define ENUMS_SIMPLETYPES_SFX_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Sfx); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SFX_H diff --git a/src/enums/simpletypes/showcenter.h b/src/enums/simpletypes/showcenter.h deleted file mode 100644 index bbf5206eb..000000000 --- a/src/enums/simpletypes/showcenter.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SHOWCENTER_H -#define ENUMS_SIMPLETYPES_SHOWCENTER_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(ShowCenter); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SHOWCENTER_H diff --git a/src/enums/simpletypes/showemptyrows.h b/src/enums/simpletypes/showemptyrows.h deleted file mode 100644 index 98feb22ae..000000000 --- a/src/enums/simpletypes/showemptyrows.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SHOWEMPTYROWS_H -#define ENUMS_SIMPLETYPES_SHOWEMPTYROWS_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(ShowEmptyRows); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SHOWEMPTYROWS_H diff --git a/src/enums/simpletypes/skiperror.h b/src/enums/simpletypes/skiperror.h deleted file mode 100644 index bf281582d..000000000 --- a/src/enums/simpletypes/skiperror.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SKIPERROR_H -#define ENUMS_SIMPLETYPES_SKIPERROR_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(SkipError); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SKIPERROR_H diff --git a/src/enums/simpletypes/speech.h b/src/enums/simpletypes/speech.h deleted file mode 100644 index 3ee3bee93..000000000 --- a/src/enums/simpletypes/speech.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_SPEECH_H -#define ENUMS_SIMPLETYPES_SPEECH_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Speech); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_SPEECH_H diff --git a/src/enums/simpletypes/stringdefines.h b/src/enums/simpletypes/stringdefines.h deleted file mode 100644 index 6cdebf7c0..000000000 --- a/src/enums/simpletypes/stringdefines.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_STRINGDEFINES_H -#define ENUMS_SIMPLETYPES_STRINGDEFINES_H - -#include "localconsts.h" - -#define stringEnumStart(type) \ - std::map mStringsArray; \ - bool find(const std::string &key) \ - { \ - return mStringsArray.find(key) != mStringsArray.end(); \ - } \ - type get(const std::string &key) \ - { \ - return mStringsArray[key]; \ - } \ - void init() \ - { \ - mStringsArray.clear(); - -#define strEnumDef(prefix, name) \ - mStringsArray[#name] = prefix::name; \ - -#define strEnumDef2(prefix, name, str) \ - mStringsArray[#name] = prefix::name; \ - mStringsArray[str] = prefix::name; - -#define stringEnumEnd \ - } - - -#endif // ENUMS_SIMPLETYPES_STRINGDEFINES_H diff --git a/src/enums/simpletypes/stringdefines2.h b/src/enums/simpletypes/stringdefines2.h deleted file mode 100644 index f518ea799..000000000 --- a/src/enums/simpletypes/stringdefines2.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_STRINGDEFINES2_H -#define ENUMS_SIMPLETYPES_STRINGDEFINES2_H - -#include "localconsts.h" - -#define stringEnumDef(type) \ - bool find(const std::string &key); \ - type get(const std::string &key); \ - void init(); - -#endif // ENUMS_SIMPLETYPES_STRINGDEFINES2_H diff --git a/src/enums/simpletypes/trading.h b/src/enums/simpletypes/trading.h deleted file mode 100644 index dffdc49be..000000000 --- a/src/enums/simpletypes/trading.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_TRADING_H -#define ENUMS_SIMPLETYPES_TRADING_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Trading); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_TRADING_H diff --git a/src/enums/simpletypes/tryremovecolors.h b/src/enums/simpletypes/tryremovecolors.h deleted file mode 100644 index 4721cc9be..000000000 --- a/src/enums/simpletypes/tryremovecolors.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_TRYREMOVECOLORS_H -#define ENUMS_SIMPLETYPES_TRYREMOVECOLORS_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(TryRemoveColors); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_TRYREMOVECOLORS_H diff --git a/src/enums/simpletypes/useargs.h b/src/enums/simpletypes/useargs.h deleted file mode 100644 index ddd05dd8d..000000000 --- a/src/enums/simpletypes/useargs.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_USEARGS_H -#define ENUMS_SIMPLETYPES_USEARGS_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(UseArgs); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_USEARGS_H diff --git a/src/enums/simpletypes/usebase64.h b/src/enums/simpletypes/usebase64.h deleted file mode 100644 index b6fecf7e0..000000000 --- a/src/enums/simpletypes/usebase64.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_USEBASE64_H -#define ENUMS_SIMPLETYPES_USEBASE64_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(UseBase64); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_USEBASE64_H diff --git a/src/enums/simpletypes/usevirtfs.h b/src/enums/simpletypes/usevirtfs.h deleted file mode 100644 index f76e3e55b..000000000 --- a/src/enums/simpletypes/usevirtfs.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_USERESMAN_H -#define ENUMS_SIMPLETYPES_USERESMAN_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(UseVirtFs); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_USERESMAN_H diff --git a/src/enums/simpletypes/visible.h b/src/enums/simpletypes/visible.h deleted file mode 100644 index c21809711..000000000 --- a/src/enums/simpletypes/visible.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef ENUMS_SIMPLETYPES_VISIBLE_H -#define ENUMS_SIMPLETYPES_VISIBLE_H - -#include "enums/simpletypes/booldefines.h" - -PRAGMA6(GCC diagnostic push) -PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") - -defBoolEnum(Visible); - -PRAGMA6(GCC diagnostic pop) - -#endif // ENUMS_SIMPLETYPES_VISIBLE_H diff --git a/src/enums/state.h b/src/enums/state.h deleted file mode 100644 index b261ea226..000000000 --- a/src/enums/state.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_STATE_H -#define ENUMS_STATE_H - -#include "enums/simpletypes/enumdefines.h" - -#ifdef WIN32 -#undef ERROR -#endif // WIN32 - -enumStart(State) -{ - ERROR = -1, - START = 0, - CHOOSE_SERVER, - CONNECT_SERVER, - PRE_LOGIN, - LOGIN, - LOGIN_ATTEMPT, - WORLD_SELECT, // 5 - WORLD_SELECT_ATTEMPT, - UPDATE, - LOAD_DATA, - GET_CHARACTERS, - CHAR_SELECT, // 10 - CONNECT_GAME, - GAME, - CHANGE_MAP, // Switch map-server/gameserver - LOGIN_ERROR, - ACCOUNTCHANGE_ERROR, // 15 - REGISTER_PREP, - REGISTER, - REGISTER_ATTEMPT, - CHANGEPASSWORD, - CHANGEPASSWORD_ATTEMPT, // 20 - CHANGEPASSWORD_SUCCESS, - CHANGEEMAIL, - CHANGEEMAIL_ATTEMPT, - CHANGEEMAIL_SUCCESS, - SWITCH_SERVER, - SWITCH_LOGIN, - SWITCH_CHARACTER, // 30 - LOGOUT_ATTEMPT, - WAIT, - EXIT, - FORCE_QUIT, - AUTORECONNECT_SERVER = 1000 -} -enumEnd(State); - -#endif // ENUMS_STATE_H diff --git a/src/enums/textcommandtype.h b/src/enums/textcommandtype.h deleted file mode 100644 index 669a87e4a..000000000 --- a/src/enums/textcommandtype.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef ENUMS_TEXTCOMMANDTYPE_H -#define ENUMS_TEXTCOMMANDTYPE_H - -#include "enums/simpletypes/enumdefines.h" - -enumStart(TextCommandType) -{ - Magic = 0, - Text = 1 -} -enumEnd(TextCommandType); - -#endif // ENUMS_TEXTCOMMANDTYPE_H diff --git a/src/equipment.h b/src/equipment.h deleted file mode 100644 index eb0235a47..000000000 --- a/src/equipment.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef EQUIPMENT_H -#define EQUIPMENT_H - -#include "localconsts.h" - -class Item; - -class Equipment final -{ - public: - /** - * Constructor. - */ - Equipment() : - mBackend(nullptr) - { } - - A_DELETE_COPY(Equipment) - - /** - * Destructor. - */ - ~Equipment() - { mBackend = nullptr; } - - class Backend notfinal - { - public: - Backend() - { } - - A_DELETE_COPY(Backend) - - virtual const Item *getEquipment(const int index) - const A_WARN_UNUSED = 0; - - virtual void clear() = 0; - - virtual ~Backend() - { } - }; - - /** - * Get equipment at the given slot. - */ - const Item *getEquipment(const int index) const A_WARN_UNUSED - { - return mBackend != nullptr ? - mBackend->getEquipment(index) : nullptr; - } - - /** - * Clears equipment. - */ - void clear() - { if (mBackend != nullptr) mBackend->clear(); } - - /** - * Set equipment at the given slot. - */ - void setEquipment(int index, int id, int quantity = 0); - - void setBackend(Backend *const backend) - { mBackend = backend; } - - const Backend *getBackend() const noexcept2 A_WARN_UNUSED - { return mBackend; } - - private: - Backend *mBackend; -}; - -#endif // EQUIPMENT_H diff --git a/src/events/actionevent.h b/src/events/actionevent.h deleted file mode 100644 index 11655fa03..000000000 --- a/src/events/actionevent.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_ACTIONEVENT_H -#define EVENTS_ACTIONEVENT_H - -#include "events/event.h" - -#include - -#include "localconsts.h" - -class Widget; - -/** - * Represents an action event. An action event is an event - * that can be fired by a widget whenever an action has occured. - * What exactly an action is is up to the widget that fires - * the action event. An example is a Button which fires an action - * event as soon as the Button is clicked, another example is - * TextField which fires an action event as soon as the enter - * key is pressed. - * - * Any object can listen for actions from widgets by implementing - * the ActionListener interface. - * - * If you have implement a widget of your own it's a good idea to - * let the widget fire action events whenever you feel an action - * has occured so action listeners of the widget can be informed - * of the state of the widget. - * - * @see Widget::addActionListener, Widget::removeActionListener, - * Widget::distributeActionEvent - * @author Olof Naessén - */ -class ActionEvent final : public Event -{ - public: - /** - * Constructor. - * - * @param source The source widget of the event. - * @param id An identifier of the event. - */ - ActionEvent(Widget *const source, const std::string &id) : - Event(source), - mId(id) - { - } - - A_DELETE_COPY(ActionEvent) - - /** - * Destructor. - */ - virtual ~ActionEvent() - { } - - /** - * Gets the identifier of the event. An identifier can - * be used to distinguish from two actions from the same - * widget or to let many widgets fire the same widgets - * that should be treated equally. - * - * @return The identifier of the event. - */ - const std::string &getId() const noexcept2 A_WARN_UNUSED - { return mId; } - - protected: - /** - * Holds the identifier of the event. - */ - std::string mId; -}; - -#endif // EVENTS_ACTIONEVENT_H diff --git a/src/events/event.h b/src/events/event.h deleted file mode 100644 index 78a7b7ada..000000000 --- a/src/events/event.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_EVENT_H -#define EVENTS_EVENT_H - -#include "localconsts.h" - -class Widget; - -/** - * Base class for all events. All events in Guichan should - * inherit from this class. - * - * @author Olof Naessén - */ -class Event notfinal -{ - public: - /** - * Constructor. - * - * @param source The source widget of the event. - */ - explicit Event(Widget *const source) : - mSource(source) - { } - - A_DELETE_COPY(Event) - - /** - * Destructor. - */ - virtual ~Event() - { } - - /** - * Gets the source widget of the event. The function - * is used to tell which widget fired an event. - * - * @return The source widget of the event. - */ - Widget* getSource() const noexcept2 A_WARN_UNUSED - { return mSource; } - - protected: - /** - * Holds the source widget of the event. - */ - Widget* mSource; -}; - -#endif // EVENTS_EVENT_H diff --git a/src/events/inputevent.h b/src/events/inputevent.h deleted file mode 100644 index 68600143b..000000000 --- a/src/events/inputevent.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef EVENTS_INPUTEVENT_H -#define EVENTS_INPUTEVENT_H - -#include "enums/input/inputaction.h" - -#include "utils/vector.h" - -#include -#include - -#include "localconsts.h" - -class ChatTab; - -typedef STD_VECTOR KeysVector; -typedef KeysVector::iterator KeysVectorIter; -typedef KeysVector::const_iterator KeysVectorCIter; - -typedef std::map KeyToActionMap; -typedef KeyToActionMap::iterator KeyToActionMapIter; - -typedef std::map KeyToIdMap; -typedef KeyToIdMap::iterator KeyToIdMapIter; - -typedef std::map KeyTimeMap; -typedef KeyTimeMap::iterator KeyTimeMapIter; - -struct InputEvent final -{ - InputEvent(const InputActionT action0, - const int mask0) : - args(), - tab(nullptr), - action(action0), - mask(mask0) - { } - - InputEvent(const std::string &args0, - ChatTab *const tab0, - const int mask0) : - args(args0), - tab(tab0), - action(InputAction::NO_VALUE), - mask(mask0) - { } - - A_DELETE_COPY(InputEvent) - - const std::string args; - ChatTab *const tab; - const InputActionT action; - const int mask; -}; - -#endif // EVENTS_INPUTEVENT_H diff --git a/src/events/inputguievent.h b/src/events/inputguievent.h deleted file mode 100644 index 2a702db91..000000000 --- a/src/events/inputguievent.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_INPUTGUIEVENT_H -#define EVENTS_INPUTGUIEVENT_H - -#include "events/event.h" - -/** - * Base class for all events concerning input. - * - * @author Olof Naessén - */ -class InputGuiEvent: public Event -{ - public: - /** - * Constructor. - * - * @param source The source widget of the event. - */ - explicit InputGuiEvent(Widget *const source) : - Event(source), - mIsConsumed(false) - { } - - /** - * Marks the event as consumed. Input event listeners may discard - * consumed input or act on consumed input. An example of a widget - * that discards consumed input is the ScrollArea widget that - * discards consumed mouse wheel events so the ScrollArea will not - * scroll if for instance a Slider's value inside the ScrollArea was - * changed with the mouse wheel. - * - * @see isConsumed - */ - void consume() - { mIsConsumed = true; } - - /** - * Checks if the input event is consumed. - * - * @return True if the input event is consumed, - * false otherwise. - * @see consume - */ - bool isConsumed() const noexcept2 A_WARN_UNUSED - { return mIsConsumed; } - - protected: - /** - * True if the input event is consumed, - * false otherwise. - */ - bool mIsConsumed; -}; - -#endif // EVENTS_INPUTGUIEVENT_H diff --git a/src/events/keyevent.h b/src/events/keyevent.h deleted file mode 100644 index 191bc1849..000000000 --- a/src/events/keyevent.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_KEYEVENT_H -#define EVENTS_KEYEVENT_H - -#include "enums/events/keyeventtype.h" - -#include "enums/input/inputaction.h" - -#include "events/inputguievent.h" - -#include "input/key.h" - -#ifdef USE_SDL2 -#include -#endif // USE_SDL2 - -class Widget; - -/** - * Represents a key event. - */ -class KeyEvent: public InputGuiEvent -{ - public: - /** - * Constructor. - * - * @param source The source widget of the event. - * @param type The type of the event. A value from KeyEventType. - * false otherwise. - * @param key The key of the event. - */ - KeyEvent(Widget *const source, - KeyEventTypeT type, - const InputActionT actionId, - const Key &key) : - InputGuiEvent(source), - mKey(key), -#ifdef USE_SDL2 - mText(), -#endif // USE_SDL2 - mType(type), - mActionId(actionId) - { } - - /** - * Destructor. - */ - virtual ~KeyEvent() - { } - - /** - * Gets the type of the event. - * - * @return The type of the event. - */ - KeyEventTypeT getType() const noexcept2 A_WARN_UNUSED - { return mType; } - - /** - * Gets the key of the event. - * - * @return The key of the event. - */ - const Key &getKey() const noexcept2 A_WARN_UNUSED - { return mKey; } - - InputActionT getActionId() const noexcept2 A_WARN_UNUSED - { return mActionId; } - -#ifdef USE_SDL2 - void setText(const std::string &text) - { mText = text; } - - std::string getText() const - { return mText; } -#endif // USE_SDL2 - - protected: - /** - * Holds the key of the key event. - */ - Key mKey; - -#ifdef USE_SDL2 - std::string mText; -#endif // USE_SDL2 - - /** - * Holds the type of the key event. - */ - KeyEventTypeT mType; - - InputActionT mActionId; -}; - -#endif // EVENTS_KEYEVENT_H diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h deleted file mode 100644 index 3a3a70f0a..000000000 --- a/src/events/mouseevent.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_MOUSEEVENT_H -#define EVENTS_MOUSEEVENT_H - -#include "events/inputguievent.h" - -#include "enums/events/mousebutton.h" -#include "enums/events/mouseeventtype.h" - -class Widget; - -/** - * Represents a mouse event. - * - * @author Olof Naessén - */ -class MouseEvent: public InputGuiEvent -{ - public: - /** - * Constructor. - * - * @param source The source widget of the mouse event. - * @param type The type of the mouse event. - * @param button The button of the mouse event. - * @param x The x coordinate of the event relative to the source widget. - * @param y The y coordinate of the event relative the source widget. - * @param clickCount The number of clicks generated with the same button. - * It's set to zero if another button is used. - */ - MouseEvent(Widget *const source, - const MouseEventTypeT type, - const MouseButtonT button, - const int x, - const int y, - const int clickCount) : - InputGuiEvent(source), - mType(type), - mButton(button), - mX(x), - mY(y), - mClickCount(clickCount) - { - } - - /** - * Gets the button of the mouse event. - * - * @return The button of the mouse event. - */ - MouseButtonT getButton() const noexcept2 A_WARN_UNUSED - { return mButton; } - - /** - * Gets the x coordinate of the mouse event. - * The coordinate relative to widget the mouse listener - * receiving the events have registered to. - * - * @return The x coordinate of the mouse event. - * @see Widget::addMouseListener, Widget::removeMouseListener - */ - int getX() const noexcept2 A_WARN_UNUSED - { return mX; } - - /** - * Gets the y coordinate of the mouse event. - * The coordinate relative to widget the mouse listener - * receiving the events have registered to. - * - * @return The y coordinate of the mouse event. - * @see Widget::addMouseListener, Widget::removeMouseListener - */ - int getY() const noexcept2 A_WARN_UNUSED - { return mY; } - - /** - * Gets the number of clicks generated with the same button. - * It's set to zero if another button is used. - * - * @return The number of clicks generated with the same button. - */ - int getClickCount() const noexcept2 A_WARN_UNUSED - { return mClickCount; } - - /** - * Gets the type of the event. - * - * @return The type of the event. - */ - MouseEventTypeT getType() const noexcept2 A_WARN_UNUSED - { return mType; } - - void setX(int n) - { mX = n; } - - void setY(int n) - { mY = n; } - - protected: - /** - * Holds the type of the mouse event. - */ - MouseEventTypeT mType; - - /** - * Holds the button of the mouse event. - */ - MouseButtonT mButton; - - /** - * Holds the x-coordinate of the mouse event. - */ - int mX; - - /** - * Holds the y-coordinate of the mouse event. - */ - int mY; - - /** - * The number of clicks generated with the same button. - * It's set to zero if another button is used. - */ - int mClickCount; - - /** - * Gui is a friend of this class in order to be able to manipulate - * the protected member variables of this class and at the same time - * keep the MouseEvent class as const as possible. Gui needs to - * update the x och y coordinates for the coordinates to be relative - * to widget the mouse listener receiving the events have registered - * to. - */ - friend class Gui; -}; - -#endif // EVENTS_MOUSEEVENT_H diff --git a/src/events/selectionevent.h b/src/events/selectionevent.h deleted file mode 100644 index 02682af07..000000000 --- a/src/events/selectionevent.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef EVENTS_SELECTIONEVENT_H -#define EVENTS_SELECTIONEVENT_H - -#include "events/event.h" - -#include "localconsts.h" - -class Widget; - -/** - * Represents a selection event. - * - * @author Olof Naessén - */ -class SelectionEvent final: public Event -{ - public: - /** - * Constructor. - * - * @param source source The widget of the selection event. - */ - explicit SelectionEvent(Widget *const source) : - Event(source) - { } - - A_DELETE_COPY(SelectionEvent) - - /** - * Destructor. - */ - virtual ~SelectionEvent() - { } -}; - -#endif // EVENTS_SELECTIONEVENT_H diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp deleted file mode 100644 index f1acd698c..000000000 --- a/src/eventsmanager.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "eventsmanager.h" - -#include "configuration.h" -#include "client.h" -#ifndef DYECMD -#include "game.h" -#endif // DYECMD -#ifdef USE_MUMBLE -#include "mumblemanager.h" -#endif // USE_MUMBLE -#include "sdlshared.h" -#include "settings.h" - -#include "gui/windowmanager.h" - -#include "being/localplayer.h" - -#include "input/inputmanager.h" - -#ifdef USE_SDL2 -#include "render/graphics.h" -#else // USE_SDL2 -#include "logger.h" -#endif // USE_SDL2 - -#include "utils/process.h" -#include "utils/sdlhelper.h" -#ifdef USE_X11 -#include "utils/x11logger.h" -#endif // USE_X11 - -#include "debug.h" - -EventsManager eventsManager; - -EventsManager::EventsManager() : - ConfigListener(), - mLogInput(false) -{ -} - -EventsManager::~EventsManager() -{ - CHECKLISTENERS -} - -void EventsManager::init() -{ - mLogInput = config.getBoolValue("logInput"); - config.addListener("logInput", this); -} - -void EventsManager::enableEvents() -{ - // disable unused SDL events -#ifndef USE_SDL2 - SDL_EventState(SDL_VIDEOEXPOSE, SDL_IGNORE); -#endif // USE_SDL2 - - SDL_EventState(SDL_SYSWMEVENT, mLogInput ? SDL_ENABLE : SDL_IGNORE); - SDL_EventState(SDL_USEREVENT, SDL_IGNORE); -} - -void EventsManager::shutdown() -{ - config.removeListeners(this); -} - -bool EventsManager::handleCommonEvents(const SDL_Event &event) const -{ - BLOCK_START("EventsManager::handleCommonEvents") - if (mLogInput) - logEvent(event); - - switch (event.type) - { - case SDL_QUIT: - client->setState(State::EXIT); - logger->log1("force exit"); - BLOCK_END("EventsManager::handleCommonEvents") - return true; -#ifdef USE_SDL2 - case SDL_WINDOWEVENT: - handleSDL2WindowEvent(event); - BLOCK_END("EventsManager::handleCommonEvents") - return true; -#else // USE_SDL2 - case SDL_VIDEORESIZE: - WindowManager::resizeVideo(event.resize.w, - event.resize.h, - false); - BLOCK_END("EventsManager::handleCommonEvents") - return true; - case SDL_ACTIVEEVENT: - handleActive(event); - BLOCK_END("EventsManager::handleCommonEvents") - return true; -#ifdef ANDROID - case SDL_KEYBOARDSHOW: - WindowManager::updateScreenKeyboard(event.user.code); - BLOCK_END("EventsManager::handleCommonEvents") - return true; - case SDL_ACCELEROMETER: - break; -#endif // ANDROID -#endif // USE_SDL2 - default: - break; - } - - if (inputManager.handleEvent(event)) - { - BLOCK_END("EventsManager::handleCommonEvents") - return true; - } - - BLOCK_END("EventsManager::handleCommonEvents") - return false; -} - -bool EventsManager::handleEvents() const -{ - BLOCK_START("EventsManager::handleEvents") -#ifndef DYECMD - if (Game::instance() != nullptr) - { - // Let the game handle the events while it is active - Game::instance()->handleInput(); - } - else -#endif // DYECMD - { - SDL_Event event; - // Handle SDL events - while (SDL::PollEvent(&event)) - { - if (!handleCommonEvents(event)) - { - switch (event.type) - { -#ifdef ANDROID -#ifndef USE_SDL2 - case SDL_ACTIVEEVENT: - if ((event.active.state & SDL_APPACTIVE) - && !event.active.gain) - { - client->setState(State::EXIT); - logger->log1("exit on lost focus"); - } - break; - -#endif // USE_SDL2 -#endif // ANDROID - default: - break; - } - } - -#ifdef USE_MUMBLE - if (localPlayer && mumbleManager) - { - mumbleManager->setPos(localPlayer->getTileX(), - localPlayer->getTileY(), localPlayer->getDirection()); - } -#endif // USE_MUMBLE - } - if (client->getState() == State::EXIT) - { - BLOCK_END("EventsManager::handleEvents") - return true; - } - } - BLOCK_END("EventsManager::handleEvents") - return false; -} - -void EventsManager::handleGameEvents() const -{ - BLOCK_START("EventsManager::handleGameEvents") -#ifndef DYECMD - Game *const game = Game::instance(); - - // Events - SDL_Event event; - while (SDL::PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) - game->updateHistory(event); - game->checkKeys(); - - if (handleCommonEvents(event)) - break; - } // End while -#endif // DYECMD - - BLOCK_END("EventsManager::handleGameEvents") -} - -void EventsManager::optionChanged(const std::string &name) -{ - if (name == "logInput") - mLogInput = config.getBoolValue("logInput"); -} - -void EventsManager::logEvent(const SDL_Event &event) -{ - switch (event.type) - { -#ifdef USE_SDL2 -#define winEventLog(name, name2) \ - case name: \ - str = name2; \ - break - - case SDL_MOUSEMOTION: - logger->log("event: SDL_MOUSEMOTION: %u, %d,%d, %d,%d", - event.motion.state, - event.motion.x, - event.motion.y, - event.motion.xrel, - event.motion.yrel); - break; - case SDL_FINGERDOWN: - { - const SDL_TouchFingerEvent &touch = event.tfinger; - const int w = mainGraphics->mWidth; - const int h = mainGraphics->mHeight; - logger->log("event: SDL_FINGERDOWN: %u,%u (%f,%f) (%f,%f) %f", - CAST_U32(touch.touchId), - CAST_U32(touch.fingerId), - touch.x * w, touch.y * w, - touch.dx * w, touch.dy * h, - touch.pressure); - break; - } - case SDL_FINGERUP: - { - const SDL_TouchFingerEvent &touch = event.tfinger; - const int w = mainGraphics->mWidth; - const int h = mainGraphics->mHeight; - logger->log("event: SDL_FINGERUP: %u,%u (%f,%f) (%f,%f) %f", - CAST_U32(touch.touchId), - CAST_U32(touch.fingerId), - touch.x * w, touch.y * w, - touch.dx * w, touch.dy * h, - touch.pressure); - break; - } - case SDL_FINGERMOTION: - { - const SDL_TouchFingerEvent &touch = event.tfinger; - const int w = mainGraphics->mWidth; - const int h = mainGraphics->mHeight; - logger->log("event: SDL_FINGERMOTION: %u,%u (%f,%f) (%f,%f) %f", - CAST_U32(touch.touchId), - CAST_U32(touch.fingerId), - touch.x * w, touch.y * h, - touch.dx * w, touch.dy * h, - touch.pressure); - break; - } - case SDL_MULTIGESTURE: - { - const SDL_MultiGestureEvent &gesture = event.mgesture; - const int w = mainGraphics->mWidth; - const int h = mainGraphics->mHeight; - logger->log("event: SDL_MULTIGESTURE: %u %f,%f (%f,%f) %d", - CAST_U32(gesture.touchId), - gesture.dTheta, gesture.dDist, - gesture.x * w, gesture.y * h, - CAST_S32(gesture.numFingers)); - break; - } - case SDL_KEYDOWN: - logger->log("event: SDL_KEYDOWN: %s(%d) %s(%d) %d,%d,%u", - SDL_GetScancodeName(event.key.keysym.scancode), - event.key.keysym.scancode, - SDL_GetKeyName(event.key.keysym.sym), - event.key.keysym.sym, - event.key.state, - event.key.repeat, - CAST_U32(event.key.keysym.mod)); - break; - case SDL_KEYUP: - logger->log("event: SDL_KEYUP: %s(%d) %s(%d) %d,%d,%u", - SDL_GetScancodeName(event.key.keysym.scancode), - event.key.keysym.scancode, - SDL_GetKeyName(event.key.keysym.sym), - event.key.keysym.sym, - event.key.state, - event.key.repeat, - CAST_U32(event.key.keysym.mod)); - break; - case SDL_WINDOWEVENT: - { - const int data1 = event.window.data1; - const int data2 = event.window.data2; - std::string str; - switch (event.window.event) - { - winEventLog(SDL_WINDOWEVENT_NONE, "SDL_WINDOWEVENT_NONE"); - winEventLog(SDL_WINDOWEVENT_SHOWN, "SDL_WINDOWEVENT_SHOWN"); - winEventLog(SDL_WINDOWEVENT_HIDDEN, "SDL_WINDOWEVENT_HIDDEN"); - winEventLog(SDL_WINDOWEVENT_EXPOSED, - "SDL_WINDOWEVENT_EXPOSED"); - winEventLog(SDL_WINDOWEVENT_MOVED, "SDL_WINDOWEVENT_MOVED"); - winEventLog(SDL_WINDOWEVENT_RESIZED, - "SDL_WINDOWEVENT_RESIZED"); - winEventLog(SDL_WINDOWEVENT_SIZE_CHANGED, - "SDL_WINDOWEVENT_SIZE_CHANGED"); - winEventLog(SDL_WINDOWEVENT_MINIMIZED, - "SDL_WINDOWEVENT_MINIMIZED"); - winEventLog(SDL_WINDOWEVENT_MAXIMIZED, - "SDL_WINDOWEVENT_MAXIMIZED"); - winEventLog(SDL_WINDOWEVENT_RESTORED, - "SDL_WINDOWEVENT_RESTORED"); - winEventLog(SDL_WINDOWEVENT_ENTER, "SDL_WINDOWEVENT_ENTER"); - winEventLog(SDL_WINDOWEVENT_LEAVE, "SDL_WINDOWEVENT_LEAVE"); - winEventLog(SDL_WINDOWEVENT_FOCUS_GAINED, - "SDL_WINDOWEVENT_FOCUS_GAINED"); - winEventLog(SDL_WINDOWEVENT_FOCUS_LOST, - "SDL_WINDOWEVENT_FOCUS_LOST"); - winEventLog(SDL_WINDOWEVENT_CLOSE, "SDL_WINDOWEVENT_CLOSE"); -#if SDL_VERSION_ATLEAST(2, 0, 5) - winEventLog(SDL_WINDOWEVENT_TAKE_FOCUS, - "SDL_WINDOWEVENT_TAKE_FOCUS"); - winEventLog(SDL_WINDOWEVENT_HIT_TEST, - "SDL_WINDOWEVENT_HIT_TEST"); -#endif // SDL_VERSION_ATLEAST(2, 0, 5) - default: - str = strprintf("unknown: %d", - event.window.event); - break; - } - logger->log("event: SDL_WINDOWEVENT: %s: %d,%d", - str.c_str(), data1, data2); - break; - } - case SDL_TEXTINPUT: - { - const char *const text = event.text.text; - logger->log("event: SDL_TEXTINPUT: %s", text); - const size_t sz = strlen(event.text.text); - for (size_t f = 0; f < sz; f ++) - logger->log("dec: %d", text[f]); - break; - } - case SDL_APP_TERMINATING: - logger->log("SDL_APP_TERMINATING"); - break; - case SDL_APP_LOWMEMORY: - logger->log("SDL_APP_LOWMEMORY"); - break; - case SDL_APP_WILLENTERBACKGROUND: - logger->log("SDL_APP_WILLENTERBACKGROUND"); - break; - case SDL_APP_WILLENTERFOREGROUND: - logger->log("SDL_APP_WILLENTERFOREGROUND"); - break; - case SDL_APP_DIDENTERFOREGROUND: - logger->log("SDL_APP_DIDENTERFOREGROUND"); - break; - case SDL_APP_DIDENTERBACKGROUND: - logger->log("SDL_APP_DIDENTERBACKGROUND"); - break; - case SDL_MOUSEWHEEL: -#if SDL_VERSION_ATLEAST(2, 0, 4) - logger->log("event: SDL_MOUSEWHEEL: %u,%u, %d,%d, %u", - event.wheel.windowID, - event.wheel.which, - event.wheel.x, - event.wheel.y, - event.wheel.direction); -#else // SDL_VERSION_ATLEAST(2, 0, 4) - - logger->log("event: SDL_MOUSEWHEEL: %u,%u, %d,%d", - event.wheel.windowID, - event.wheel.which, - event.wheel.x, - event.wheel.y); -#endif // SDL_VERSION_ATLEAST(2, 0, 4) - break; -#if SDL_VERSION_ATLEAST(2, 0, 4) - case SDL_AUDIODEVICEADDED: - logger->log("event: SDL_AUDIODEVICEADDED: %u,%u", - event.adevice.which, - event.adevice.iscapture); - break; - case SDL_KEYMAPCHANGED: - logger->log("event: SDL_KEYMAPCHANGED"); - break; -#endif // SDL_VERSION_ATLEAST(2, 0, 4) - case SDL_MOUSEBUTTONDOWN: - logger->log("event: SDL_MOUSEBUTTONDOWN: %u,%u,%u, %d,%d", - event.button.which, - CAST_U32(event.button.button), - CAST_U32(event.button.state), - event.button.x, - event.button.y); - break; - case SDL_MOUSEBUTTONUP: - logger->log("event: SDL_MOUSEBUTTONUP: %u,%u,%u, %d,%d", - event.button.which, - CAST_U32(event.button.button), - CAST_U32(event.button.state), - event.button.x, - event.button.y); - break; - case SDL_JOYDEVICEADDED: - logger->log("event: SDL_JOYDEVICEADDED: %d", - event.jdevice.which); - break; - case SDL_JOYDEVICEREMOVED: - logger->log("event: SDL_JOYDEVICEREMOVED: %d", - event.jdevice.which); - break; -#else // USE_SDL2 - - case SDL_MOUSEMOTION: - logger->log("event: SDL_MOUSEMOTION: %u,%d,%d", - event.motion.state, event.motion.x, event.motion.y); - break; - case SDL_KEYDOWN: - logger->log("event: SDL_KEYDOWN: %s(%d),%d,%d,%d", - SDL_GetKeyName(event.key.keysym.sym), - event.key.keysym.sym, - event.key.keysym.scancode, - event.key.state, - event.key.keysym.unicode); - break; - case SDL_KEYUP: - logger->log("event: SDL_KEYUP: %s(%d),%d,%d,%d", - SDL_GetKeyName(event.key.keysym.sym), - event.key.keysym.sym, - event.key.keysym.scancode, - event.key.state, - event.key.keysym.unicode); - break; - case SDL_VIDEORESIZE: - logger->log("event: SDL_VIDEORESIZE"); - break; - case SDL_VIDEOEXPOSE: - logger->log("event: SDL_VIDEOEXPOSE"); - break; - case SDL_ACTIVEEVENT: - logger->log("event: SDL_ACTIVEEVENT: %d %d", - event.active.state, event.active.gain); - break; - case SDL_MOUSEBUTTONDOWN: - logger->log("event: SDL_MOUSEBUTTONDOWN: %d,%d, %d,%d", - event.button.button, - event.button.state, - event.button.x, - event.button.y); - break; - case SDL_MOUSEBUTTONUP: - logger->log("event: SDL_MOUSEBUTTONUP: %d,%d,%d,%d", - event.button.button, - event.button.state, - event.button.x, - event.button.y); - break; -#endif // USE_SDL2 - - case SDL_JOYAXISMOTION: - logger->log("event: SDL_JOYAXISMOTION: %d,%d,%d", - event.jaxis.which, event.jaxis.axis, event.jaxis.value); - break; - case SDL_JOYBALLMOTION: - logger->log("event: SDL_JOYBALLMOTION: %d,%d,%d,%d", - event.jball.which, event.jball.ball, - event.jball.xrel, event.jball.yrel); - break; - case SDL_JOYHATMOTION: - logger->log("event: SDL_JOYHATMOTION: %d,%d,%d", event.jhat.which, - event.jhat.hat, event.jhat.value); - break; - case SDL_JOYBUTTONDOWN: - logger->log("event: SDL_JOYBUTTONDOWN: %d,%d,%d", - event.jbutton.which, event.jbutton.button, - event.jbutton.state); - break; - case SDL_JOYBUTTONUP: - logger->log("event: SDL_JOYBUTTONUP: %d,%d,%d", - event.jbutton.which, event.jbutton.button, - event.jbutton.state); - break; - case SDL_QUIT: - logger->log("event: SDL_QUIT"); - break; - case SDL_SYSWMEVENT: - { -#ifdef USE_X11 - const bool res = X11Logger::logEvent(event); - if (res == false) - logger->assertLog("event: SDL_SYSWMEVENT: not supported:"); -#else // USE_X11 - - logger->assertLog("event: SDL_SYSWMEVENT: not supported:"); -#endif // USE_X11 - - break; - } - case SDL_USEREVENT: - logger->log("event: SDL_USEREVENT: %d", - event.user.code); - break; -#ifdef ANDROID -#ifndef USE_SDL2 - case SDL_ACCELEROMETER: - logger->log("event: SDL_ACCELEROMETER"); - break; -#endif // USE_SDL2 -#endif // ANDROID - - default: - logger->assertLog("event: other: %u", - CAST_U32(event.type)); - break; - }; -} - -#ifdef USE_SDL2 -void EventsManager::handleSDL2WindowEvent(const SDL_Event &event) -{ -#ifndef DYECMD - int fpsLimit = 0; -#endif // DYECMD - - const int eventType = event.window.event; - const bool inGame = (client->getState() == State::GAME); - switch (eventType) - { - case SDL_WINDOWEVENT_RESIZED: - WindowManager::resizeVideo(event.window.data1, - event.window.data2, - false); - break; - case SDL_WINDOWEVENT_ENTER: - settings.mouseFocused = true; - break; - case SDL_WINDOWEVENT_LEAVE: - settings.mouseFocused = false; - break; - case SDL_WINDOWEVENT_FOCUS_GAINED: - settings.inputFocused = KeyboardFocus::Focused; - break; -#if SDL_VERSION_ATLEAST(2, 0, 5) - case SDL_WINDOWEVENT_TAKE_FOCUS: - settings.inputFocused = KeyboardFocus::Focused2; - break; -#endif // SDL_VERSION_ATLEAST(2, 0, 5) - - case SDL_WINDOWEVENT_FOCUS_LOST: - settings.inputFocused = KeyboardFocus::Unfocused; - break; - case SDL_WINDOWEVENT_MINIMIZED: - WindowManager::setIsMinimized(true); -#ifndef DYECMD - fpsLimit = config.getIntValue("altfpslimit"); - if (localPlayer) - localPlayer->setHalfAway(true); -#endif // DYECMD - - setPriority(false); - break; - case SDL_WINDOWEVENT_RESTORED: - case SDL_WINDOWEVENT_MAXIMIZED: - WindowManager::setIsMinimized(false); -#ifndef DYECMD - fpsLimit = config.getIntValue("fpslimit"); - if (localPlayer) - localPlayer->setHalfAway(false); -#endif // DYECMD - - setPriority(true); - break; - default: - break; - } - - if (!inGame) - return; - -#ifndef DYECMD - if (eventType == SDL_WINDOWEVENT_MINIMIZED - || eventType == SDL_WINDOWEVENT_RESTORED - || eventType == SDL_WINDOWEVENT_MAXIMIZED) - { - if (localPlayer) - { - localPlayer->updateStatus(); - localPlayer->updateName(); - } - Game::instance()->updateFrameRate(fpsLimit); - } -#endif // DYECMD -} -#else // USE_SDL2 - -void EventsManager::handleActive(const SDL_Event &event) -{ -#ifndef DYECMD - int fpsLimit = 0; - const bool inGame = (client->getState() == State::GAME); -#endif // DYECMD - - if ((event.active.state & SDL_APPACTIVE) != 0) - { - if (event.active.gain != 0u) - { // window restore - WindowManager::setIsMinimized(false); -#ifndef DYECMD - if (localPlayer != nullptr) - { - if (!settings.awayMode) - fpsLimit = config.getIntValue("fpslimit"); - localPlayer->setHalfAway(false); - } -#endif // DYECMD - - setPriority(true); - } - else - { // window minimization -#ifdef ANDROID - client->setState(State::EXIT); -#else // ANDROID - WindowManager::setIsMinimized(true); -#ifndef DYECMD - if (localPlayer != nullptr && !settings.awayMode) - { - fpsLimit = config.getIntValue("altfpslimit"); - localPlayer->setHalfAway(true); - } -#endif // DYECMD - - setPriority(false); -#endif // ANDROID - } -#ifndef DYECMD - if (inGame && (localPlayer != nullptr)) - localPlayer->updateStatus(); -#endif // DYECMD - } -#ifndef DYECMD - if (inGame && (localPlayer != nullptr)) - localPlayer->updateName(); -#endif // DYECMD - - if ((event.active.state & SDL_APPINPUTFOCUS) != 0) - { - settings.inputFocused = (event.active.gain != 0u) ? - KeyboardFocus::Focused : KeyboardFocus::Unfocused; - } - if ((event.active.state & SDL_APPMOUSEFOCUS) != 0) - settings.mouseFocused = (event.active.gain != 0u); -#ifndef DYECMD - if (inGame) - Game::instance()->updateFrameRate(fpsLimit); -#endif // DYECMD -} -#endif // USE_SDL2 diff --git a/src/eventsmanager.h b/src/eventsmanager.h deleted file mode 100644 index 725040ca4..000000000 --- a/src/eventsmanager.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef EVENTSMANAGER_H -#define EVENTSMANAGER_H - -#include "listeners/configlistener.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "localconsts.h" - -class EventsManager final : public ConfigListener -{ - public: - EventsManager(); - - A_DELETE_COPY(EventsManager) - - virtual ~EventsManager(); - - void init(); - - void enableEvents(); - - void shutdown(); - - bool handleEvents() const; - - bool handleCommonEvents(const SDL_Event &event) const; - - void handleGameEvents() const; - -#ifdef USE_SDL2 - static void handleSDL2WindowEvent(const SDL_Event &event); -#else // USE_SDL2 - - static void handleActive(const SDL_Event &event); -#endif // USE_SDL2 - - void optionChanged(const std::string &name) override final; - - static void logEvent(const SDL_Event &event); - - protected: - bool mLogInput; -}; - -extern EventsManager eventsManager; - -#endif // EVENTSMANAGER_H diff --git a/src/filefilter.txt b/src/filefilter.txt deleted file mode 100644 index 37988ae54..000000000 --- a/src/filefilter.txt +++ /dev/null @@ -1,21 +0,0 @@ -~ RULE_3_1_A_do_not_start_filename_with_underbar -~ RULE_3_2_CD_do_not_use_special_characters_in_filename -~ RULE_3_2_H_do_not_use_uppercase_for_c_filename -~ RULE_4_1_A_B_use_space_for_indentation -~ RULE_4_1_B_indent_each_enum_item_in_enum_block -~ RULE_4_1_B_locate_each_enum_item_in_seperate_line -~ RULE_4_1_C_align_long_function_parameter_list -~ RULE_4_1_E_align_conditions -~ RULE_4_2_A_A_space_around_operator -~ RULE_4_2_A_B_space_around_word -~ RULE_4_4_A_do_not_write_over_80_columns_per_line -~ RULE_4_5_A_brace_for_namespace_should_be_located_in_seperate_line -~ RULE_4_5_A_braces_for_type_definition_should_be_located_in_seperate_line -~ RULE_4_5_A_indent_blocks_inside_of_function -~ RULE_4_5_A_matching_braces_inside_of_function_should_be_located_same_column -~ RULE_6_1_A_do_not_omit_function_parameter_names -~ RULE_6_4_B_initialize_first_item_of_enum -~ RULE_7_2_B_do_not_use_goto_statement -~ RULE_8_1_A_provide_file_info_comment -~ RULE_9_1_A_do_not_use_hardcorded_include_path - diff --git a/src/filefilter_more.txt b/src/filefilter_more.txt deleted file mode 100644 index f0f37e03a..000000000 --- a/src/filefilter_more.txt +++ /dev/null @@ -1,12 +0,0 @@ -~ RULE_6_2_A_do_not_use_system_dependent_type -~ RULE_3_2_F_use_representitive_classname_for_cpp_filename -~ RULE_6_5_B_do_not_use_macro_for_constants -~ RULE_A_3_avoid_too_deep_blocks -~ RULE_6_1_G_write_less_than_200_lines_for_function - -~ RULE_5_2_C_provide_doxygen_class_comment_on_class_def -~ RULE_5_2_C_provide_doxygen_namespace_comment_on_namespace_def -~ RULE_5_2_C_provide_doxygen_struct_comment_on_struct_def -~ RULE_5_3_A_provide_doxygen_function_comment_on_function_in_header -~ RULE_5_3_A_provide_doxygen_function_comment_on_function_in_impl -~ RULE_6_1_E_do_not_use_more_than_5_paramters_in_function diff --git a/src/fs/files.cpp b/src/fs/files.cpp deleted file mode 100644 index d5c600fb9..000000000 --- a/src/fs/files.cpp +++ /dev/null @@ -1,319 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/files.h" - -#include "fs/mkdir.h" -#if defined(ANDROID) || defined(__native_client__) -#include "fs/paths.h" - -#include "fs/virtfs/fs.h" -#include "fs/virtfs/tools.h" -#include "fs/virtfs/list.h" -#endif // defined(ANDROID) || defined(__native_client__) - -#if defined(ANDROID) || defined(__native_client__) -#include "utils/foreach.h" -#endif // defined(ANDROID) || defined(__native_client__) - -#include "utils/checkutils.h" -#include "utils/stringutils.h" - -#include -#include - -#include "debug.h" - -extern const char *dirSeparator; - -#ifdef ANDROID -void Files::extractLocale() -{ - // in future need also remove all locales in local dir - - const std::string fileName2 = pathJoin(getenv("APPDIR"), "locale.zip"); - VirtFs::mountZip(fileName2, Append_false); - - const std::string localDir = std::string(getenv("APPDIR")); - VirtFs::List *const rootDirs = VirtFs::enumerateFiles("locale"); - FOR_EACH (StringVectCIter, i, rootDirs->names) - { - const std::string dir = pathJoin("locale", *i); - if (VirtFs::isDirectory(dir)) - { - const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo"; - if (VirtFs::exists((moFile))) - { - const std::string localFile = pathJoin(localDir, moFile); - const std::string localDir2 = pathJoin(localDir, - dir, - "LC_MESSAGES"); - mkdir_r(localDir2.c_str()); - copyVirtFsFile(moFile, localFile); - } - } - } - VirtFs::freeList(rootDirs); - VirtFs::unmountZip(fileName2); - remove(fileName2.c_str()); -} -#endif // ANDROID - -#if defined(ANDROID) || defined(__native_client__) - -namespace -{ -#ifdef ANDROID - int mFilesCount = 0; -#endif // ANDROID - - Files::CopyFileCallbackPtr mCallbackPtr = nullptr; -} // namespace - -void Files::setCopyCallBack(Files::CopyFileCallbackPtr callback) -{ - mCallbackPtr = callback; -} - -void Files::copyVirtFsFile(const std::string &restrict inFile, - const std::string &restrict outFile) -{ - int size = 0; - const char *const buf = VirtFs::loadFile(inFile, size); - FILE *const file = fopen(outFile.c_str(), "w"); - fwrite(buf, 1, size, file); - fclose(file); - delete [] buf; -#ifdef ANDROID - if (mCallbackPtr) - { - mCallbackPtr(mFilesCount); - mFilesCount ++; - } -#endif // ANDROID -} - -void Files::copyVirtFsDir(const std::string &restrict inDir, - const std::string &restrict outDir) -{ - mkdir_r(outDir.c_str()); - VirtFs::List *const files = VirtFs::enumerateFiles(inDir); - FOR_EACH (StringVectCIter, i, files->names) - { - const std::string file = pathJoin(inDir, *i); - const std::string outDir2 = pathJoin(outDir, *i); - if (VirtFs::isDirectory(file)) - copyVirtFsDir(file, outDir2); - else - copyVirtFsFile(file, outDir2); - } - VirtFs::freeList(files); -} - -#endif // ANDROID __native_client__ - -int Files::renameFile(const std::string &restrict srcName, - const std::string &restrict dstName) -{ -#if defined __native_client__ - FILE *srcFile = fopen(srcName.c_str(), "rb"); - if (srcFile == nullptr) - return -1; - FILE *dstFile = fopen(dstName.c_str(), "w+b"); - if (dstFile == nullptr) - { - fclose(srcFile); - return -1; - } - - const int chunkSize = 500000; - char *buf = new char[chunkSize]; - size_t sz = 0; - while ((sz = fread(buf, 1, chunkSize, srcFile))) - { - if (fwrite(buf, 1, sz, dstFile) != sz) - { - delete [] buf; - fclose(srcFile); - fclose(dstFile); - ::remove(dstName.c_str()); - return -1; - } - } - - delete [] buf; - fclose(srcFile); - fclose(dstFile); - if (!::remove(srcName.c_str())) - return 0; - - return -1; -#else // defined __native_client__ - - return ::rename(srcName.c_str(), dstName.c_str()); -#endif // defined __native_client__ -} - -int Files::copyFile(const std::string &restrict srcName, - const std::string &restrict dstName) -{ - FILE *srcFile = fopen(srcName.c_str(), "rb"); - if (srcFile == nullptr) - return -1; - FILE *dstFile = fopen(dstName.c_str(), "w+b"); - if (dstFile == nullptr) - { - fclose(srcFile); - return -1; - } - - const int chunkSize = 512000; - char *buf = new char[chunkSize]; - size_t sz = 0; - while ((sz = fread(buf, 1, chunkSize, srcFile)) != 0u) - { - if (fwrite(buf, 1, sz, dstFile) != sz) - { - delete [] buf; - fclose(srcFile); - fclose(dstFile); - return -1; - } - } - - delete [] buf; - fclose(srcFile); - fclose(dstFile); - return 0; -} - -bool Files::existsLocal(const std::string &path) -{ - struct stat statbuf; -#ifdef WIN32 - // in windows path\file.ext\ by default detected as exists - // if file.ext is not directory, need return false - const bool res = (stat(path.c_str(), &statbuf) == 0); - if (res == false) - return false; - if ((findLast(path, "/") == true || findLast(path, "\\") == true) && - S_ISDIR(statbuf.st_mode) == 0) - { - return false; - } - return true; -#else // WIN32 - return stat(path.c_str(), &statbuf) == 0; -#endif // WIN32 -} - -bool Files::loadTextFileLocal(const std::string &fileName, - StringVect &lines) -{ - std::ifstream file; - char line[501]; - - file.open(fileName.c_str(), std::ios::in); - - if (!file.is_open()) - { - reportAlways("Couldn't load text file: %s", - fileName.c_str()); - return false; - } - - while (file.getline(line, 500)) - lines.push_back(line); - - return true; -} - -void Files::saveTextFile(const std::string &path, - const std::string &restrict name, - const std::string &restrict text) -{ - if (mkdir_r(path.c_str()) == 0) - { - std::ofstream file; - std::string fileName = pathJoin(path, name); - file.open(fileName.c_str(), std::ios::out); - if (file.is_open()) - { - file << text << std::endl; - } - else - { - reportAlways("Error opening file for writing: %s", - fileName.c_str()); - } - file.close(); - } -} - -void Files::deleteFilesInDirectory(std::string path) -{ - path = pathJoin(path, dirSeparator); - const struct dirent *next_file = nullptr; - DIR *const dir = opendir(path.c_str()); - - if (dir != nullptr) - { - while ((next_file = readdir(dir)) != nullptr) - { - const std::string file = next_file->d_name; - if (file != "." && file != "..") - remove((path + file).c_str()); - } - closedir(dir); - } -} - -void Files::enumFiles(StringVect &files, - std::string path, - const bool skipSymlinks A_WIN_UNUSED) -{ - if (findLast(path, dirSeparator) == false) - path += dirSeparator; - DIR *const dir = opendir(path.c_str()); - - if (dir != nullptr) - { - const struct dirent *next_file = nullptr; - while ((next_file = readdir(dir)) != nullptr) - { - const std::string file = next_file->d_name; - if (file == "." || file == "..") - continue; -#ifndef WIN32 - if (skipSymlinks == true) - { - struct stat statbuf; - if (lstat(path.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0) - { - continue; - } - } -#endif // WIN32 - files.push_back(file); - } - closedir(dir); - } -} diff --git a/src/fs/files.h b/src/fs/files.h deleted file mode 100644 index 146a85ff1..000000000 --- a/src/fs/files.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_FILES_H -#define UTILS_FILES_H - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace Files -{ -#ifdef ANDROID - void extractLocale(); -#endif // ANDROID - -#if defined(ANDROID) || defined(__native_client__) - typedef void (*CopyFileCallbackPtr) (int cnt); - - void setCopyCallBack(CopyFileCallbackPtr callback); - - void copyVirtFsFile(const std::string &restrict inFile, - const std::string &restrict outFile); - - void copyVirtFsDir(const std::string &restrict inDir, - const std::string &restrict outDir); - -#endif // ANDROID __native_client__ - - int renameFile(const std::string &restrict pFrom, - const std::string &restrict pTo); - - int copyFile(const std::string &restrict pFrom, - const std::string &restrict pTo); - - bool existsLocal(const std::string &path); - - bool loadTextFileLocal(const std::string &fileName, - StringVect &lines); - - void saveTextFile(const std::string &path, - const std::string &restrict name, - const std::string &restrict text); - - void deleteFilesInDirectory(std::string path); - - void enumFiles(StringVect &files, - std::string path, - const bool skipSymlinks); -} // namespace Files - -#endif // UTILS_FILES_H diff --git a/src/fs/mkdir.cpp b/src/fs/mkdir.cpp deleted file mode 100644 index 341f138da..000000000 --- a/src/fs/mkdir.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "fs/mkdir.h" - -#include "utils/cast.h" - -#if defined WIN32 -#include -#include -#endif // defined WIN32 - -#include - -#include "debug.h" - -#if defined WIN32 -int mkdir_r(const char *const pathname) -{ - if (!pathname) - return -1; - - char tmp[PATH_MAX]; - char tmp2[PATH_MAX]; - char *p; - - if (strlen(pathname) >= PATH_MAX - 2) - return -1; - - strncpy(tmp, pathname, sizeof(tmp) - 1); - tmp[PATH_MAX - 1] = '\0'; - - const int len = CAST_S32(strlen(tmp)); - - if (len < 1 || len >= INT_MAX) - return -1; - - // terminate the pathname with '/' - if (tmp[len - 1] != '/') - { - tmp[len] = '/'; - tmp[len + 1] = '\0'; - } - - for (p = tmp; *p; p++) - { - if (*p == '/' || *p == '\\') - { - *p = '\0'; - // ignore a slash at the beginning of a path - if (tmp[0] == 0) - { - *p = '/'; - continue; - } - - strcpy(tmp2, tmp); - char *p2 = tmp2 + strlen(tmp2) - 1; - if (*p2 == '/' || *p2 == '\\') - *p2 = 0; - // check if the name already exists, but not as directory - struct stat statbuf; - if (!stat(tmp2, &statbuf)) - { - if (S_ISDIR(statbuf.st_mode)) - { - *p = '/'; - continue; - } - else - return -1; - } - - if (!CreateDirectory(tmp2, nullptr)) - { - // hack, hack. just assume that x: might be a drive - // letter, and try again - if (!(strlen(tmp2) == 2 && !strcmp(tmp2 + 1, ":"))) - return -1; - } - - *p = '/'; - } - } - return 0; -} -#else // WIN32 - -/// Create a directory, making leading components first if necessary -int mkdir_r(const char *const pathname) -{ - if (pathname == nullptr) - return -1; - - const size_t len = CAST_SIZE(strlen(pathname)); - char *tmp = new char[len + 2]; - char *p = nullptr; - - strcpy(tmp, pathname); - - // terminate the pathname with '/' - if (tmp[len - 1] != '/') - { - tmp[len] = '/'; - tmp[len + 1] = '\0'; - } - - for (p = tmp; *p != 0; p++) - { - if (*p == '/') - { - *p = '\0'; - // ignore a slash at the beginning of a path - if (tmp[0] == 0) - { - *p = '/'; - continue; - } - - // check if the name already exists, but not as directory - struct stat statbuf; - if (stat(tmp, &statbuf) == 0) - { - if (S_ISDIR(statbuf.st_mode)) - { - *p = '/'; - continue; - } - else - { - delete []tmp; - return -1; - } - } - - if (mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) - { - delete []tmp; - return -1; - } - - *p = '/'; - } - } - delete []tmp; - return 0; -} -#endif // WIN32 diff --git a/src/fs/mkdir.h b/src/fs/mkdir.h deleted file mode 100644 index a662daca3..000000000 --- a/src/fs/mkdir.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef UTILS_MKDIR_H -#define UTILS_MKDIR_H - -int mkdir_r(const char *const pathname); - -#endif // UTILS_MKDIR_H diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp deleted file mode 100644 index 5698ffa7d..000000000 --- a/src/fs/paths.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifdef _MSC_VER -# include "msvc/config.h" -#elif defined(HAVE_CONFIG_H) -#include "config.h" -#endif // _MSC_VER - -#include "fs/paths.h" - -#include "fs/virtfs/fs.h" - -#include "utils/checkutils.h" -#include "utils/stringutils.h" - -#ifdef USE_X11 -#include "fs/files.h" - -#include "utils/foreach.h" -#endif // USE_X11 - -#ifdef __native_client__ -#include -#define realpath(N, R) strcpy(R, N) -#endif // __native_client__ - -#ifdef WIN32 -#include "fs/specialfolder.h" -#define realpath(N, R) _fullpath((R), (N), _MAX_PATH) -#elif defined __OpenBSD__ -#include -#elif defined __native_client__ -#include -#endif // WIN32 - -#ifndef WIN32 -#include -#include -#include -#endif // WIN32 - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#ifdef ANDROID -#ifdef USE_SDL2 -#include -#endif // USE_SDL2 -#endif // ANDROID -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -namespace -{ - std::string mPackageDir; -} // namespace - -std::string getRealPath(const std::string &str) -{ -#if defined(__OpenBSD__) || defined(__ANDROID__) || defined(__native_client__) - char *realPath = reinterpret_cast(calloc(PATH_MAX, sizeof(char))); - if (!realPath) - return ""; - realpath(str.c_str(), realPath); -#else // defined(__OpenBSD__) || defined(__ANDROID__) || - // defined(__native_client__) - - char *realPath = realpath(str.c_str(), nullptr); - if (realPath == nullptr) - return ""; -#endif // defined(__OpenBSD__) || defined(__ANDROID__) || - // defined(__native_client__) - - std::string path = realPath; - free(realPath); - return path; -} - -bool isRealPath(const std::string &str) -{ - return str == getRealPath(str); -} - -bool checkPath(const 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; -} - -void prepareFsPath(std::string &path) -{ -#ifdef DEBUGFS - std::string path2 = path; -#endif - sanitizePath(path); -// can be enabled for debugging -#ifdef DEBUGFS - if (path != path2) - { - reportAlways("Path can be improved: '%s' -> '%s'", - path2.c_str(), - path.c_str()); - } -#endif -} - -std::string &fixDirSeparators(std::string &str) -{ -#ifdef WIN32 - return replaceAll(str, "/", "\\"); -#else - return str; -#endif -} - -std::string removeLast(const std::string &str) -{ - size_t pos2 = str.rfind('/'); - const size_t pos3 = str.rfind('\\'); - if (pos3 != std::string::npos) - { - if (pos2 == std::string::npos || pos3 > pos2) - pos2 = pos3; - } - if (pos2 != std::string::npos) - return str.substr(0, pos2); - return str; -} - -#ifdef WIN32 -std::string getSelfName() -{ - return "manaplus.exe"; -} - -#elif defined(__APPLE__) -std::string getSelfName() -{ - return "manaplus.exe"; -} - -#elif defined __linux__ || defined __linux - -std::string getSelfName() -{ - char buf[257]; - const ssize_t sz = readlink("/proc/self/exe", buf, 256); - if (sz > 0 && sz < 256) - { - buf[sz] = 0; - return buf; - } - return ""; -} - -#else // WIN32 - -std::string getSelfName() -{ - return ""; -} - -#endif // WIN32 - -std::string getPicturesDir() -{ -#ifdef WIN32 - std::string dir = getSpecialFolderLocation(CSIDL_MYPICTURES); - if (dir.empty()) - dir = getSpecialFolderLocation(CSIDL_DESKTOP); - return dir; -#elif defined USE_X11 - char *xdg = getenv("XDG_CONFIG_HOME"); - std::string file; - if (!xdg) - { - file = pathJoin(VirtFs::getUserDir(), - ".config/user-dirs.dirs"); - } - else - { - file = pathJoin(xdg, "user-dirs.dirs"); - } - - if (Files::existsLocal(file)) - { - StringVect arr; - Files::loadTextFileLocal(file, arr); - FOR_EACH (StringVectCIter, it, arr) - { - std::string str = *it; - if (findCutFirst(str, "XDG_PICTURES_DIR=\"")) - { - str = str.substr(0, str.size() - 1); - // use hack to replace $HOME var. - // if in string other vars, fallback to default path - replaceAll(str, "$HOME/", VirtFs::getUserDir()); - str = getRealPath(str); - if (str.empty()) - str = pathJoin(VirtFs::getUserDir(), "Desktop"); - return str; - } - } - } -#endif // WIN32 - - return pathJoin(VirtFs::getUserDir(), "Desktop"); -} - -std::string getHomePath() -{ -#if defined(UNITTESTS) && defined(UNITESTSDIR) - std::string dir = UNITESTSDIR; - if (findLast(dir, std::string(dirSeparator)) == false) - dir += dirSeparator; - return dir; -#else // defined(UNITTESTS) && defined(UNITESTSDIR) -#ifdef WIN32 - return getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); -#else - const char *path = getenv("HOME"); - if (path == nullptr) - { - const uid_t uid = getuid(); - const struct passwd *const pw = getpwuid(uid); - if (pw != nullptr && - pw->pw_dir != nullptr) - { - path = pw->pw_dir; - } - if (path == nullptr) - return dirSeparator; - } - std::string dir = path; - if (findLast(dir, std::string(dirSeparator)) == false) - dir += dirSeparator; - return dir; -#endif // WIN32 -#endif // defined(UNITTESTS) && defined(UNITESTSDIR) -} - -#ifdef ANDROID -std::string getSdStoragePath() -{ - return getenv("DATADIR2"); -} -#endif // ANDROID - -std::string getPackageDir() -{ - return mPackageDir; -} - -void setPackageDir(const std::string &dir) -{ - mPackageDir = dir; -} diff --git a/src/fs/paths.h b/src/fs/paths.h deleted file mode 100644 index be431f9c3..000000000 --- a/src/fs/paths.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef UTILS_PATHS_H -#define UTILS_PATHS_H - -#include - -#include "localconsts.h" - -std::string getRealPath(const std::string &str) A_WARN_UNUSED; - -bool isRealPath(const std::string &str) A_WARN_UNUSED; - -bool checkPath(const std::string &path) A_WARN_UNUSED; - -void prepareFsPath(std::string &path); - -std::string &fixDirSeparators(std::string &str); - -std::string removeLast(const std::string &str) A_WARN_UNUSED; - -std::string getSelfName() A_WARN_UNUSED; - -std::string getPicturesDir() A_WARN_UNUSED; - -#ifdef ANDROID -std::string getSdStoragePath() A_WARN_UNUSED; -#endif // ANDROID - -std::string getPackageDir() A_WARN_UNUSED; - -void setPackageDir(const std::string &dir); - -std::string getHomePath(); - -#endif // UTILS_PATHS_H diff --git a/src/fs/specialfolder.cpp b/src/fs/specialfolder.cpp deleted file mode 100644 index ee27dab4b..000000000 --- a/src/fs/specialfolder.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifdef WIN32 -#include "fs/specialfolder.h" -#include - -#include "debug.h" - -/* - * Retrieve the pathname of special folders on win32, or an empty string - * on error / if the folder does not exist. - * See http://msdn.microsoft.com/en-us/library/bb762494(VS.85).aspx for - * a list of folder ids - */ -std::string getSpecialFolderLocation(const int folderId) -{ - std::string ret; - LPITEMIDLIST pItemIdList; - LPMALLOC pMalloc; - char szPath[_MAX_PATH]; - - // get the item ID list for folderId - HRESULT hr = SHGetSpecialFolderLocation(nullptr, folderId, &pItemIdList); - if (hr != S_OK) - return ret; - - // convert the ID list into a file system path - if (SHGetPathFromIDList(pItemIdList, szPath) == FALSE) - return ret; - - // get the IMalloc pointer and free all resources we used - hr = SHGetMalloc(&pMalloc); - pMalloc->Free(pItemIdList); - pMalloc->Release(); - - ret = szPath; - return ret; -} - -#endif // WIN32 diff --git a/src/fs/specialfolder.h b/src/fs/specialfolder.h deleted file mode 100644 index f2cc93c9b..000000000 --- a/src/fs/specialfolder.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef UTILS_SPECIALFOLDER_H -#define UTILS_SPECIALFOLDER_H - -#ifdef WIN32 -#include -#include - -#include "localconsts.h" -std::string getSpecialFolderLocation(const int folderId) A_WARN_UNUSED; -#endif // WIN32 - -#endif // UTILS_SPECIALFOLDER_H diff --git a/src/fs/virtfs/direntry.cpp b/src/fs/virtfs/direntry.cpp deleted file mode 100644 index c178d4c88..000000000 --- a/src/fs/virtfs/direntry.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/direntry.h" - -#include "debug.h" - -namespace VirtFs -{ - -DirEntry::DirEntry(const std::string &userDir0, - const std::string &rootDir, - const std::string &subDir0, - const std::string &rootSubDir0, - FsFuncs *restrict const funcs0) : - FsEntry(FsEntryType::Dir, funcs0), - userDir(userDir0), - rootSubDir(rootSubDir0) -{ - root = rootDir; - subDir = subDir0; -} - -DirEntry::~DirEntry() -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/direntry.h b/src/fs/virtfs/direntry.h deleted file mode 100644 index 18e700a6a..000000000 --- a/src/fs/virtfs/direntry.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTDIRENTRY_H -#define UTILS_VIRTDIRENTRY_H - -#include "fs/virtfs/fsentry.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct DirEntry final : public FsEntry -{ - DirEntry(const std::string &userDir0, - const std::string &rootDir, - const std::string &subDir0, - const std::string &rootSubDir0, - FsFuncs *restrict const funcs0); - - A_DELETE_COPY(DirEntry) - - virtual ~DirEntry(); - - std::string userDir; - std::string rootSubDir; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTDIRENTRY_H diff --git a/src/fs/virtfs/file.cpp b/src/fs/virtfs/file.cpp deleted file mode 100644 index fb7fcee11..000000000 --- a/src/fs/virtfs/file.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/file.h" - -#include "debug.h" - -namespace VirtFs -{ - -File::File(const FsFuncs *restrict const funcs0, - const uint8_t *restrict const buf, - const size_t sz) : - funcs(funcs0), - mBuf(buf), - mPos(0U), - mSize(sz), - mFd(FILEHDEFAULT) -{ -} - -File::File(const FsFuncs *restrict const funcs0, - FILEHTYPE fd) : - funcs(funcs0), - mBuf(nullptr), - mPos(0U), - mSize(0U), - mFd(fd) -{ -} - -File::~File() -{ - if (mFd != FILEHDEFAULT) - FILECLOSE(mFd); - delete [] mBuf; -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/file.h b/src/fs/virtfs/file.h deleted file mode 100644 index c564bade4..000000000 --- a/src/fs/virtfs/file.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTFILE_H -#define UTILS_VIRTFILE_H - -#include "localconsts.h" - -#include "fs/virtfs/fileapi.h" - -namespace VirtFs -{ - -struct FsFuncs; - -struct File final -{ - File(const FsFuncs *restrict const funcs0, - const uint8_t *restrict const buf, - const size_t sz); - - File(const FsFuncs *restrict const funcs0, - FILEHTYPE fd); - - A_DELETE_COPY(File) - - ~File(); - - const FsFuncs *funcs; - - // zipfs fields - const uint8_t *mBuf; - - // zipfs fields - size_t mPos; - size_t mSize; - - // dirfs fields - FILEHTYPE mFd; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTFILE_H diff --git a/src/fs/virtfs/fileapi.h b/src/fs/virtfs/fileapi.h deleted file mode 100644 index 14e7b8204..000000000 --- a/src/fs/virtfs/fileapi.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTFS_FILEAPI_H -#define UTILS_VIRTFS_FILEAPI_H - -#include "localconsts.h" - -#ifdef USE_FILE_FOPEN -#define FILEHTYPE FILE *const -#define FILEMTYPE char * -#define FILEHDEFAULT nullptr -#define FILEOPEN(path, mode) fopen(path, mode) -#define FILECLOSE fclose -#define FILESEEK fseek -#define FILEOPEN_FLAG_READ "rb" -#define FILEOPEN_FLAG_WRITE "wb" -#define FILEOPEN_FLAG_APPEND "ab" -#else // USE_FILE_FOPEN -#define FILEHTYPE const int -#define FILEMTYPE int -#define FILEHDEFAULT -1 -#define FILEOPEN(path, mode) open(path, mode, S_IRUSR | S_IWUSR) -#define FILECLOSE close -#define FILESEEK lseek -#define FILEOPEN_FLAG_READ O_RDONLY -#define FILEOPEN_FLAG_WRITE O_WRONLY | O_CREAT | O_TRUNC -#define FILEOPEN_FLAG_APPEND O_WRONLY | O_CREAT | O_APPEND -#endif // USE_FILE_FOPEN - -#endif // UTILS_VIRTFS_FILEAPI_H diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp deleted file mode 100644 index 2ec75ac05..000000000 --- a/src/fs/virtfs/fs.cpp +++ /dev/null @@ -1,880 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/fs.h" - -#include "fs/files.h" -#include "fs/paths.h" - -#include "fs/virtfs/direntry.h" -#include "fs/virtfs/file.h" -#include "fs/virtfs/fsdir.h" -#include "fs/virtfs/fsfuncs.h" -#include "fs/virtfs/fszip.h" -#include "fs/virtfs/list.h" -#include "fs/virtfs/zipentry.h" -#include "fs/virtfs/zipreader.h" - -#include "utils/checkutils.h" -#include "utils/foreach.h" -#include "utils/stdmove.h" -#include "utils/stringutils.h" - -#include "debug.h" - -const char *dirSeparator = nullptr; - -#ifdef UNITTESTS -#define reportNonTests logger->log -#else // UNITTESTS -#define reportNonTests reportAlways -#endif // UNITTESTS - -namespace VirtFs -{ - namespace - { - STD_VECTOR mEntries; - } // namespace - - void init(const std::string &restrict name) - { - updateDirSeparator(); - FsDir::init(name); - FsZip::init(); - } - - void updateDirSeparator() - { -#ifdef WIN32 - dirSeparator = "\\"; -#else // WIN32 - dirSeparator = "/"; -#endif // WIN32 - } - - const char *getDirSeparator() - { - return dirSeparator; - } - - const char *getBaseDir() - { - return FsDir::getBaseDir(); - } - - const char *getUserDir() - { - return FsDir::getUserDir(); - } - - STD_VECTOR &getEntries() - { - return mEntries; - } - - FsEntry *searchByRootInternal(const std::string &restrict root, - const std::string &restrict subDir) - { - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - const FsEntry *const entry = *it; - if (entry->root == root && - entry->subDir == subDir) - { - return *it; - } - } - return nullptr; - } - - FsEntry *searchByTypeInternal(const std::string &restrict root, - const FsEntryTypeT type) - { - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - const FsEntry *const entry = *it; - if (entry->root == root && - entry->type == type) - { - return *it; - } - } - return nullptr; - } - - bool exists(std::string name) - { - prepareFsPath(name); - if (checkPath(name) == false) - { - reportAlways("FsDir::exists invalid path: %s", - name.c_str()); - return false; - } - - std::string rootDir = name; - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - if (entry->funcs->exists(entry, name, rootDir) == true) - return true; - } - return false; - } - - List *enumerateFiles(std::string dirName) - { - List *const list = new List; - prepareFsPath(dirName); - if (checkPath(dirName) == false) - { - reportAlways("VirtFs::enumerateFiles invalid path: %s", - dirName.c_str()); - return list; - } - - std::string rootDir = STD_MOVE(dirName); - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - StringVect &names = list->names; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - entry->funcs->enumerate(entry, rootDir, names); - } - - return list; - } - - void getFiles(std::string dirName, - StringVect &list) - { - prepareFsPath(dirName); - if (checkPath(dirName) == false) - { - reportAlways("VirtFs::enumerateFiles invalid path: %s", - dirName.c_str()); - return; - } - - std::string rootDir = STD_MOVE(dirName); - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - entry->funcs->getFiles(entry, rootDir, list); - } - } - - void getFilesWithDir(std::string dirName, - StringVect &list) - { - prepareFsPath(dirName); - if (checkPath(dirName) == false) - { - reportAlways("VirtFs::enumerateFiles invalid path: %s", - dirName.c_str()); - return; - } - - std::string rootDir = STD_MOVE(dirName); - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - entry->funcs->getFilesWithDir(entry, rootDir, list); - } - } - - - void getDirs(std::string dirName, - StringVect &list) - { - prepareFsPath(dirName); - if (checkPath(dirName) == false) - { - reportAlways("VirtFs::enumerateFiles invalid path: %s", - dirName.c_str()); - return; - } - - std::string rootDir = STD_MOVE(dirName); - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - entry->funcs->getDirs(entry, rootDir, list); - } - } - - bool isDirectory(std::string name) - { - prepareFsPath(name); - if (checkPath(name) == false) - { - reportAlways("VirtFs::isDirectory invalid path: %s", - name.c_str()); - return false; - } - std::string dirName = STD_MOVE(name); - if (findLast(dirName, std::string(dirSeparator)) == false) - dirName += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - bool isDirFlag(false); - if (entry->funcs->isDirectory(entry, dirName, isDirFlag) == true) - { - return isDirFlag; - } - } - return false; - } - - bool isSymbolicLink(const std::string &restrict name) - { - return FsDir::isSymbolicLink(name); - } - - void freeList(List *restrict const handle) - { - delete handle; - } - - File *openRead(std::string filename) - { - prepareFsPath(filename); - if (checkPath(filename) == false) - { - reportAlways("VirtFs::openRead invalid path: %s", - filename.c_str()); - return nullptr; - } - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - File *const file = entry->funcs->openRead(entry, filename); - if (file != nullptr) - return file; - } - return nullptr; - } - - File *openWrite(std::string filename) - { - prepareFsPath(filename); - if (checkPath(filename) == false) - { - reportAlways("VirtFs::openWrite invalid path: %s", - filename.c_str()); - return nullptr; - } - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - File *const file = entry->funcs->openWrite(entry, filename); - if (file != nullptr) - return file; - } - return nullptr; - } - - File *openAppend(std::string filename) - { - prepareFsPath(filename); - if (checkPath(filename) == false) - { - reportAlways("VirtFs::openAppend invalid path: %s", - filename.c_str()); - return nullptr; - } - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - File *const file = entry->funcs->openAppend(entry, filename); - if (file != nullptr) - return file; - } - return nullptr; - } - - bool setWriteDir(const std::string &restrict newDir) - { - return FsDir::setWriteDir(newDir); - } - - void addEntry(FsEntry *const entry, - const Append append) - { - if (append == Append_true) - mEntries.push_back(entry); - else - mEntries.insert(mEntries.begin(), entry); - } - - bool mountDirInternal(const std::string &restrict newDir, - std::string subDir, - const Append append) - { - if (newDir.find(".zip") != std::string::npos) - { - reportAlways("Called FsDir::mount with zip archive"); - return false; - } - std::string rootDir = newDir; - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - if (subDir == dirSeparator) - { - subDir.clear(); - } - else if (!subDir.empty() && - findLast(subDir, std::string(dirSeparator)) == false) - { - subDir += dirSeparator; - } - const FsEntry *const entry = searchByRootInternal(rootDir, subDir); - if (entry != nullptr) - { - reportAlways("VirtFs::mount already exists: %s", - newDir.c_str()); - return false; - } - if (subDir.empty()) - { - logger->log("Add virtual directory: " + newDir); - } - else - { - logger->log("Add virtual directory: %s with dir %s", - newDir.c_str(), - subDir.c_str()); - } - - addEntry(new DirEntry(newDir, - rootDir, - subDir, - rootDir + subDir, - FsDir::getFuncs()), - append); - return true; - } - - bool mountDir(std::string newDir, - const Append append) - { - prepareFsPath(newDir); - if (Files::existsLocal(newDir) == false) - { - reportNonTests("VirtFs::mount directory not exists: %s", - newDir.c_str()); - return false; - } - return mountDirInternal(newDir, dirSeparator, append); - } - - bool mountDir2(std::string newDir, - std::string subDir, - const Append append) - { - prepareFsPath(newDir); - prepareFsPath(subDir); - if (Files::existsLocal(newDir) == false) - { - reportNonTests("VirtFs::mount directory not exists: %s", - newDir.c_str()); - return false; - } - return mountDirInternal(newDir, subDir, append); - } - - bool mountDirSilent(std::string newDir, - const Append append) - { - prepareFsPath(newDir); - if (Files::existsLocal(newDir) == false) - { - logger->log("VirtFs::mount directory not exists: %s", - newDir.c_str()); - return false; - } - return mountDirInternal(newDir, std::string(), append); - } - - bool mountDirSilent2(std::string newDir, - std::string subDir, - const Append append) - { - prepareFsPath(newDir); - prepareFsPath(subDir); - if (Files::existsLocal(newDir) == false) - { - logger->log("VirtFs::mount directory not exists: %s", - newDir.c_str()); - return false; - } - return mountDirInternal(newDir, subDir, append); - } - -#ifdef UNITTESTS - bool mountDirSilentTest(std::string newDir, - const Append append) - { - prepareFsPath(newDir); - if (Files::existsLocal(newDir) == false) - { - logger->log("VirtFs::mount directory not exists: %s", - newDir.c_str()); - } - return mountDirInternal(newDir, std::string(), append); - } - - bool mountDirSilentTest2(std::string newDir, - std::string subDir, - const Append append) - { - prepareFsPath(newDir); - prepareFsPath(subDir); - if (Files::existsLocal(newDir) == false) - { - logger->log("VirtFs::mount directory not exists: %s", - newDir.c_str()); - } - return mountDirInternal(newDir, subDir, append); - } -#endif // UNITTESTS - - bool unmountDirInternal(std::string oldDir, - std::string subDir) - { - if (findLast(oldDir, std::string(dirSeparator)) == false) - oldDir += dirSeparator; - if (subDir == dirSeparator) - { - subDir.clear(); - } - else if (!subDir.empty() && - findLast(subDir, std::string(dirSeparator)) == false) - { - subDir += dirSeparator; - } - FOR_EACH (STD_VECTOR::iterator, it, mEntries) - { - FsEntry *const entry = *it; - if (entry->root == oldDir && - entry->type == FsEntryType::Dir && - entry->subDir == subDir) - { - DirEntry *const dirEntry = static_cast( - entry); - if (subDir.empty()) - { - logger->log("Remove virtual directory: " + oldDir); - } - else - { - logger->log("Remove virtual directory: %s with dir %s", - oldDir.c_str(), - subDir.c_str()); - } - mEntries.erase(it); - delete dirEntry; - return true; - } - } - return false; - } - - bool unmountDir(std::string oldDir) - { - prepareFsPath(oldDir); - if (oldDir.find(".zip") != std::string::npos) - { - reportAlways("Called unmount with zip archive"); - return false; - } - if (unmountDirInternal(oldDir, std::string()) == false) - { - reportAlways("VirtFs::unmountDir not exists: %s", - oldDir.c_str()); - return false; - } - return true; - } - - bool unmountDir2(std::string oldDir, - std::string subDir) - { - prepareFsPath(oldDir); - if (oldDir.find(".zip") != std::string::npos) - { - reportAlways("Called unmount with zip archive"); - return false; - } - prepareFsPath(subDir); - if (unmountDirInternal(oldDir, subDir) == false) - { - reportAlways("VirtFs::unmountDir not exists: %s", - oldDir.c_str()); - return false; - } - return true; - } - - bool unmountDirSilent(std::string oldDir) - { - prepareFsPath(oldDir); - if (oldDir.find(".zip") != std::string::npos) - { - reportAlways("Called unmount with zip archive"); - return false; - } - if (unmountDirInternal(oldDir, std::string()) == false) - { - logger->log("VirtFs::unmountDir not exists: %s", - oldDir.c_str()); - return false; - } - return true; - } - - bool unmountDirSilent2(std::string oldDir, - std::string subDir) - { - prepareFsPath(oldDir); - if (oldDir.find(".zip") != std::string::npos) - { - reportAlways("Called unmount with zip archive"); - return false; - } - prepareFsPath(subDir); - if (unmountDirInternal(oldDir, subDir) == false) - { - logger->log("VirtFs::unmountDir not exists: %s", - oldDir.c_str()); - return false; - } - return true; - } - - bool mountZip(std::string newDir, - const Append append) - { - prepareFsPath(newDir); - if (Files::existsLocal(newDir) == false) - { - reportNonTests("FsZip::mount file not exists: %s", - newDir.c_str()); - return false; - } - if (findLast(newDir, ".zip") == false) - { - reportAlways("Called VirtFs::mount without " - "zip archive"); - return false; - } - if (searchByRootInternal(newDir, std::string()) != nullptr) - { - reportAlways("FsZip::mount already exists: %s", - newDir.c_str()); - return false; - } - ZipEntry *const entry = new ZipEntry(newDir, - std::string(), - FsZip::getFuncs()); - if (ZipReader::readArchiveInfo(entry) == false) - { - delete entry; - return false; - } - - logger->log("Add virtual zip: " + newDir); - addEntry(entry, append); - return true; - } - - bool mountZip2(std::string newDir, - std::string subDir, - const Append append) - { - prepareFsPath(newDir); - if (Files::existsLocal(newDir) == false) - { - reportNonTests("FsZip::mount file not exists: %s", - newDir.c_str()); - return false; - } - if (findLast(newDir, ".zip") == false) - { - reportAlways("Called VirtFs::mount without " - "zip archive"); - return false; - } - prepareFsPath(subDir); - if (subDir == dirSeparator) - { - subDir.clear(); - } - else if (!subDir.empty() && - findLast(subDir, std::string(dirSeparator)) == false) - { - subDir += dirSeparator; - } - if (searchByRootInternal(newDir, subDir) != nullptr) - { - reportAlways("FsZip::mount already exists: %s", - newDir.c_str()); - return false; - } - ZipEntry *const entry = new ZipEntry(newDir, - subDir, - FsZip::getFuncs()); - if (ZipReader::readArchiveInfo(entry) == false) - { - delete entry; - return false; - } - - logger->log("Add virtual zip: %s with dir %s", - newDir.c_str(), - subDir.c_str()); - addEntry(entry, append); - return true; - } - - bool unmountZip(std::string oldDir) - { - prepareFsPath(oldDir); - if (findLast(oldDir, ".zip") == false) - { - reportAlways("Called unmount without zip archive"); - return false; - } - FOR_EACH (STD_VECTOR::iterator, it, mEntries) - { - FsEntry *const entry = *it; - if (entry->root == oldDir && - entry->type == FsEntryType::Zip && - entry->subDir.empty()) - { - ZipEntry *const zipEntry = static_cast( - entry); - logger->log("Remove virtual zip: " + oldDir); - mEntries.erase(it); - delete zipEntry; - return true; - } - } - - reportAlways("VirtFs::unmountZip not exists: %s", - oldDir.c_str()); - return false; - } - - bool unmountZip2(std::string oldDir, - std::string subDir) - { - prepareFsPath(oldDir); - if (findLast(oldDir, ".zip") == false) - { - reportAlways("Called unmount without zip archive"); - return false; - } - prepareFsPath(subDir); - if (subDir == dirSeparator) - { - subDir.clear(); - } - else if (!subDir.empty() && - findLast(subDir, std::string(dirSeparator)) == false) - { - subDir += dirSeparator; - } - FOR_EACH (STD_VECTOR::iterator, it, mEntries) - { - FsEntry *const entry = *it; - if (entry->root == oldDir && - entry->type == FsEntryType::Zip && - entry->subDir == subDir) - { - ZipEntry *const zipEntry = static_cast( - entry); - logger->log("Remove virtual zip: %s with dir %s", - oldDir.c_str(), - subDir.c_str()); - mEntries.erase(it); - delete zipEntry; - return true; - } - } - - reportAlways("VirtFs::unmountZip not exists: %s", - oldDir.c_str()); - return false; - } - - std::string getRealDir(std::string fileName) - { - prepareFsPath(fileName); - if (checkPath(fileName) == false) - { - reportAlways("FsDir::getRealDir invalid path: %s", - fileName.c_str()); - return std::string(); - } - - std::string rootDir = fileName; - if (findLast(rootDir, std::string(dirSeparator)) == false) - rootDir += dirSeparator; - - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - std::string realDir; - if (entry->funcs->getRealDir(entry, - fileName, - rootDir, - realDir) == true) - { - return realDir; - } - } - return std::string(); - } - - bool mkdir(const std::string &restrict dirname) - { - return FsDir::mkdir(dirname); - } - - bool remove(const std::string &restrict filename) - { - return FsDir::remove(filename); - } - - bool deinit() - { - FsDir::deinit(); - FsZip::deinit(); - FOR_EACH (STD_VECTOR::iterator, it, mEntries) - { - FsEntry *const entry = *it; - if (entry->type == FsEntryType::Dir) - delete static_cast(entry); - else if (entry->type == FsEntryType::Zip) - delete static_cast(entry); - else - delete entry; - } - mEntries.clear(); - return true; - } - - void permitLinks(const bool val) - { - FsDir::permitLinks(val); - } - - int close(File *restrict const file) - { - if (file == nullptr) - return 0; - return file->funcs->close(file); - } - - int64_t read(File *restrict const file, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount) - { - return file->funcs->read(file, - buffer, - objSize, - objCount); - } - - int64_t write(File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount) - { - return file->funcs->write(file, - buffer, - objSize, - objCount); - } - - int64_t fileLength(File *restrict const file) - { - return file->funcs->fileLength(file); - } - - int64_t tell(File *restrict const file) - { - return file->funcs->tell(file); - } - - int seek(File *restrict const file, - const uint64_t pos) - { - return file->funcs->seek(file, - pos); - } - - int eof(File *restrict const file) - { - return file->funcs->eof(file); - } - - const char *loadFile(std::string filename, - int &restrict fileSize) - { - prepareFsPath(filename); - if (checkPath(filename) == false) - { - reportAlways("VirtFs::loadFile invalid path: %s", - filename.c_str()); - return nullptr; - } - FOR_EACH (STD_VECTOR::const_iterator, it, mEntries) - { - FsEntry *const entry = *it; - const char *const buf = entry->funcs->loadFile(entry, - filename, - fileSize); - if (buf != nullptr) - return buf; - } - return nullptr; - } - -} // namespace VirtFs diff --git a/src/fs/virtfs/fs.h b/src/fs/virtfs/fs.h deleted file mode 100644 index 326a88d90..000000000 --- a/src/fs/virtfs/fs.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef FS_VIRTFS_H -#define FS_VIRTFS_H - -#include "enums/fs/fsentrytype.h" - -#include "enums/simpletypes/append.h" - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - struct File; - struct FsEntry; - struct List; - - void init(const std::string &restrict name); - void updateDirSeparator(); - const char *getDirSeparator(); - const char *getBaseDir(); - const char *getUserDir(); - bool exists(std::string name); - List *enumerateFiles(std::string dir) RETURNS_NONNULL; - bool isDirectory(std::string name); - bool isSymbolicLink(const std::string &restrict name); - void freeList(List *restrict const handle); - File *openRead(std::string filename); - File *openWrite(std::string filename); - File *openAppend(std::string filename); - bool setWriteDir(const std::string &restrict newDir); - bool mountDir(std::string newDir, - const Append append); - bool mountDir2(std::string newDir, - std::string subDir, - const Append append); - bool mountDirSilent(std::string newDir, - const Append append); - bool mountDirSilent2(std::string newDir, - std::string subDir, - const Append append); - bool unmountDir(std::string oldDir); - bool unmountDir2(std::string oldDir, - std::string subDir); - bool unmountDirSilent(std::string oldDir); - bool unmountDirSilent2(std::string oldDir, - std::string subDir); - bool mountZip(std::string newDir, - const Append append); - bool mountZip2(std::string newDir, - std::string subDir, - const Append append); - bool unmountZip(std::string oldDir); - bool unmountZip2(std::string oldDir, - std::string subDir); - std::string getRealDir(std::string filename); - bool mkdir(const std::string &restrict dirName); - bool remove(const std::string &restrict filename); - bool deinit(); - void permitLinks(const bool val); - int64_t read(File *restrict const handle, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int64_t write(File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int close(File *restrict const file); - int64_t fileLength(File *restrict const file); - int64_t tell(File *restrict const file); - int seek(File *restrict const file, - const uint64_t pos); - int eof(File *restrict const file); - - bool mountDirInternal(const std::string &restrict newDir, - std::string subDir, - const Append append); - bool unmountDirInternal(std::string oldDir, - std::string subDir); - STD_VECTOR &getEntries(); - FsEntry *searchByRootInternal(const std::string &restrict root, - const std::string &restrict subDir); - FsEntry *searchByTypeInternal(const std::string &restrict root, - const FsEntryTypeT type); - void addEntry(FsEntry *const entry, - const Append append); -#ifdef UNITTESTS - bool mountDirSilentTest(std::string newDir, - const Append append); - bool mountDirSilentTest2(std::string newDir, - std::string subDir, - const Append append); -#endif // UNITTESTS - const char *loadFile(std::string filename, - int &restrict fileSize); - void getFiles(std::string dirName, - StringVect &list); - void getFilesWithDir(std::string dirName, - StringVect &list); - void getDirs(std::string dirName, - StringVect &list); -} // namespace VirtFs - -extern const char *dirSeparator; - -#endif // FS_VIRTFS_H diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp deleted file mode 100644 index f32cbba4b..000000000 --- a/src/fs/virtfs/fsdir.cpp +++ /dev/null @@ -1,686 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/fsdir.h" - -#include "fs/files.h" -#include "fs/mkdir.h" -#include "fs/paths.h" - -#include "fs/virtfs/direntry.h" -#include "fs/virtfs/file.h" -#include "fs/virtfs/fsdirrwops.h" -#include "fs/virtfs/fsfuncs.h" -#include "fs/virtfs/list.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" -#include "utils/foreach.h" -#include "utils/stdmove.h" -#include "utils/stringutils.h" - -#include -#include - -#include -#include - -#include "debug.h" - -extern const char *dirSeparator; - -namespace VirtFs -{ - -namespace -{ - std::string mWriteDir; - std::string mBaseDir; - std::string mUserDir; - bool mPermitLinks = false; - FsFuncs funcs; -} // namespace - -namespace FsDir -{ - File *openInternal(FsEntry *restrict const entry, - const std::string &filename, - const FILEMTYPE mode) - { - const std::string path = static_cast(entry)->rootSubDir + - filename; - if (Files::existsLocal(path) == false) - return nullptr; - FILEHTYPE fd = FILEOPEN(path.c_str(), - mode); - if (fd == FILEHDEFAULT) - { - reportAlways("VirtFs::open file open error: %s", - filename.c_str()); - return nullptr; - } - return new File(&funcs, fd); - } - - File *openRead(FsEntry *restrict const entry, - std::string filename) - { - return openInternal(entry, filename, FILEOPEN_FLAG_READ); - } - - File *openWrite(FsEntry *restrict const entry, - const std::string &filename) - { - return openInternal(entry, filename, FILEOPEN_FLAG_WRITE); - } - - File *openAppend(FsEntry *restrict const entry, - const std::string &filename) - { - return openInternal(entry, filename, FILEOPEN_FLAG_APPEND); - } - - void deinit() - { - } - -#if defined(__native_client__) - void init(const std::string &restrict name A_UNUSED) - { - mBaseDir = "/"; -#elif defined(ANDROID) - void init(const std::string &restrict name A_UNUSED) - { - mBaseDir = getRealPath("."); -#else // defined(__native_client__) - - void init(const std::string &restrict name) - { - mBaseDir = getRealPath(getFileDir(name)); -#endif // defined(__native_client__) - - prepareFsPath(mBaseDir); - mUserDir = getHomePath(); - prepareFsPath(mUserDir); - initFuncs(&funcs); - } - - void initFuncs(FsFuncs *restrict const ptr) - { - ptr->close = &FsDir::close; - ptr->read = &FsDir::read; - ptr->write = &FsDir::write; - ptr->fileLength = &FsDir::fileLength; - ptr->tell = &FsDir::tell; - ptr->seek = &FsDir::seek; - ptr->eof = &FsDir::eof; - ptr->exists = &FsDir::exists; - ptr->getRealDir = &FsDir::getRealDir; - ptr->enumerate = &FsDir::enumerate; - ptr->isDirectory = &FsDir::isDirectory; - ptr->openRead = &FsDir::openRead; - ptr->openWrite = &FsDir::openWrite; - ptr->openAppend = &FsDir::openAppend; - ptr->loadFile = &FsDir::loadFile; - ptr->getFiles = &FsDir::getFiles; - ptr->getFilesWithDir = &FsDir::getFilesWithDir; - ptr->getDirs = &FsDir::getDirs; - ptr->rwops_seek = &FsDir::rwops_seek; - ptr->rwops_read = &FsDir::rwops_read; - ptr->rwops_write = &FsDir::rwops_write; - ptr->rwops_close = &FsDir::rwops_close; -#ifdef USE_SDL2 - ptr->rwops_size = &FsDir::rwops_size; -#endif // USE_SDL2 - } - - FsFuncs *getFuncs() - { - return &funcs; - } - - const char *getBaseDir() - { - return mBaseDir.c_str(); - } - - const char *getUserDir() - { - return mUserDir.c_str(); - } - - bool getRealDir(FsEntry *restrict const entry, - std::string filename, - std::string dirName A_UNUSED, - std::string &realDir) - { - const DirEntry *const dirEntry = static_cast(entry); - if (Files::existsLocal(dirEntry->rootSubDir + filename)) - { - realDir = dirEntry->userDir; - return true; - } - return false; - } - - bool exists(FsEntry *restrict const entry, - std::string fileName, - std::string dirName A_UNUSED) - { - return Files::existsLocal(static_cast(entry)->rootSubDir + - fileName); - } - - void enumerate(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - const std::string path = static_cast(entry)->rootSubDir + - dirName; - const struct dirent *next_file = nullptr; - DIR *const dir = opendir(path.c_str()); - if (dir != nullptr) - { - while ((next_file = readdir(dir)) != nullptr) - { - const std::string file = next_file->d_name; - if (file == "." || file == "..") - continue; -#ifndef WIN32 - if (mPermitLinks == false) - { - struct stat statbuf; - if (lstat(path.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0) - { - continue; - } - } -#endif // WIN32 - - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == file) - { - found = true; - break; - } - } - if (found == false) - names.push_back(file); - } - closedir(dir); - } - } - - bool isDirectory(FsEntry *restrict const entry, - std::string dirName, - bool &isDirFlag) - { - std::string path = static_cast(entry)->rootSubDir + dirName; - - struct stat statbuf; - if (stat(path.c_str(), &statbuf) == 0) - { - isDirFlag = (S_ISDIR(statbuf.st_mode) != 0); - return true; - } - return false; - } - - bool isSymbolicLink(std::string name) - { - prepareFsPath(name); - if (checkPath(name) == false) - { - reportAlways("FsDir::isSymbolicLink invalid path: %s", - name.c_str()); - return false; - } -#ifndef WIN32 - if (mPermitLinks == false) - return false; - - struct stat statbuf; - return lstat(name.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0; -#else - return false; -#endif // WIN32 - } - - void freeList(List *restrict const handle) - { - delete handle; - } - - bool setWriteDir(std::string newDir) - { - prepareFsPath(newDir); - mWriteDir = STD_MOVE(newDir); - if (findLast(mWriteDir, std::string(dirSeparator)) == false) - mWriteDir += dirSeparator; - return true; - } - - bool mkdir(std::string dirname) - { - prepareFsPath(dirname); - if (mWriteDir.empty()) - { - reportAlways("FsDir::mkdir write dir is empty"); - return false; - } - return mkdir_r((mWriteDir + dirname).c_str()) != -1; - } - - bool remove(std::string filename) - { - prepareFsPath(filename); - if (mWriteDir.empty()) - { - reportAlways("FsDir::remove write dir is empty"); - return false; - } - return ::remove((mWriteDir + filename).c_str()) != 0; - } - - void permitLinks(const bool val) - { - mPermitLinks = val; - } - - int close(File *restrict const file) - { - if (file == nullptr) - return 0; - delete file; - return 1; - } - - int64_t read(File *restrict const file, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount) - { - if (file == nullptr) - return 0; - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::read file not opened."); - return 0; - } -#ifdef USE_FILE_FOPEN - return fread(buffer, objSize, objCount, fd); -#else // USE_FILE_FOPEN - int max = objSize * objCount; - int cnt = ::read(fd, buffer, max); - if (cnt <= 0) - return cnt; - return cnt / objSize; -#endif // USE_FILE_FOPEN - } - - int64_t write(File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount) - { - if (file == nullptr) - return 0; - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::write file not opened."); - return 0; - } -#ifdef USE_FILE_FOPEN - return fwrite(buffer, objSize, objCount, fd); -#else // USE_FILE_FOPEN - int max = objSize * objCount; - int cnt = ::write(fd, buffer, max); - if (cnt <= 0) - return cnt; - return cnt / objSize; -#endif // USE_FILE_FOPEN - } - - int64_t fileLength(File *restrict const file) - { - if (file == nullptr) - return -1; - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::fileLength file not opened."); - return 0; - } -#ifdef USE_FILE_FOPEN - const long pos = ftell(fd); - if (pos < 0) - { - reportAlways("FsDir::fileLength ftell error."); - return -1; - } - fseek(fd, 0, SEEK_END); - const long sz = ftell(fd); - fseek(fd, pos, SEEK_SET); - return sz; -#else // USE_FILE_FOPEN - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - return -1; - } - return static_cast(statbuf.st_size); -#endif // USE_FILE_FOPEN - } - - int64_t tell(File *restrict const file) - { - if (file == nullptr) - return -1; - - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::tell file not opened."); - return 0; - } -#ifdef USE_FILE_FOPEN - return ftell(fd); -#else // USE_FILE_FOPEN - return lseek(fd, 0, SEEK_CUR); -#endif // USE_FILE_FOPEN - } - - int seek(File *restrict const file, - const uint64_t pos) - { - if (file == nullptr) - return 0; - - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::seek file not opened."); - return 0; - } - const int64_t res = FILESEEK(fd, pos, SEEK_SET); - if (res == -1) - return 0; - return 1; - } - - int eof(File *restrict const file) - { - if (file == nullptr) - return -1; - - FILEHTYPE fd = file->mFd; - if (fd == FILEHDEFAULT) - { - reportAlways("FsDir::eof file not opened."); - return 0; - } -#ifdef USE_FILE_FOPEN - const int flag = feof(fd); - if (flag != 0) - return 1; - const int64_t pos = ftell(fd); - const int64_t len = fileLength(file); -#else // USE_FILE_FOPEN - const int64_t pos = lseek(fd, 0, SEEK_CUR); - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - return -1; - } - const int64_t len = static_cast(statbuf.st_size); -#endif // USE_FILE_FOPEN - return static_cast(pos < 0 || len < 0 || pos >= len); - } - - const char *loadFile(FsEntry *restrict const entry, - std::string filename, - int &restrict fileSize) - { - const DirEntry *const dirEntry = static_cast(entry); - const std::string path = dirEntry->rootSubDir + filename; - if (Files::existsLocal(path) == false) - return nullptr; - FILEHTYPE fd = FILEOPEN(path.c_str(), - FILEOPEN_FLAG_READ); - if (fd == FILEHDEFAULT) - { - reportAlways("VirtFs::loadFile file open error: %s", - filename.c_str()); - return nullptr; - } - - logger->log("Loaded %s/%s", - dirEntry->userDir.c_str(), - filename.c_str()); - -#ifdef USE_FILE_FOPEN - fseek(fd, 0, SEEK_END); - const long sz = ftell(fd); - if (sz < 0) - { - reportAlways("FsDir::fileLength ftell error."); - if (fd != FILEHDEFAULT) - FILECLOSE(fd); - return nullptr; - } - fseek(fd, 0, SEEK_SET); - fileSize = static_cast(sz); -#else // USE_FILE_FOPEN - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - if (fd != FILEHDEFAULT) - FILECLOSE(fd); - return nullptr; - } - fileSize = static_cast(statbuf.st_size); -#endif // USE_FILE_FOPEN - - // Allocate memory and load the file - char *restrict const buffer = new char[CAST_SIZE(fileSize)]; - if (fileSize > 0) - buffer[fileSize - 1] = 0; - -#ifdef USE_FILE_FOPEN - const int cnt = CAST_S32(fread(buffer, 1, fileSize, fd)); -#else // USE_FILE_FOPEN - const int cnt = ::read(fd, buffer, fileSize); -#endif // USE_FILE_FOPEN - - if (cnt <= 0) - { - delete [] buffer; - if (fd != FILEHDEFAULT) - FILECLOSE(fd); - return nullptr; - } - - if (fd != FILEHDEFAULT) - FILECLOSE(fd); - - return buffer; - } - - void getFiles(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - const std::string path = static_cast(entry)->rootSubDir + - dirName; - const struct dirent *next_file = nullptr; - DIR *const dir = opendir(path.c_str()); - if (dir != nullptr) - { - while ((next_file = readdir(dir)) != nullptr) - { - struct stat statbuf; - const std::string file = next_file->d_name; - if (file == "." || file == "..") - continue; -#ifndef WIN32 - if (mPermitLinks == false) - { - if (lstat(path.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0) - { - continue; - } - } -#endif // WIN32 - - const std::string filePath = pathJoin(path, file); - if (stat(filePath.c_str(), &statbuf) == 0) - { - if (S_ISDIR(statbuf.st_mode) != 0) - continue; - } - - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == file) - { - found = true; - break; - } - } - if (found == false) - names.push_back(file); - } - closedir(dir); - } - } - - void getFilesWithDir(FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names) - { - const std::string path = static_cast(entry)->rootSubDir + - dirName; - const struct dirent *next_file = nullptr; - DIR *const dir = opendir(path.c_str()); - if (dir != nullptr) - { - while ((next_file = readdir(dir)) != nullptr) - { - struct stat statbuf; - const std::string file = next_file->d_name; - if (file == "." || file == "..") - continue; -#ifndef WIN32 - if (mPermitLinks == false) - { - if (lstat(path.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0) - { - continue; - } - } -#endif // WIN32 - - const std::string filePath = pathJoin(path, file); - if (stat(filePath.c_str(), &statbuf) == 0) - { - if (S_ISDIR(statbuf.st_mode) != 0) - continue; - } - - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == file) - { - found = true; - break; - } - } - if (found == false) - names.push_back(pathJoin(dirName, file)); - } - closedir(dir); - } - } - - void getDirs(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - const std::string path = static_cast(entry)->rootSubDir + - dirName; - const struct dirent *next_file = nullptr; - DIR *const dir = opendir(path.c_str()); - if (dir != nullptr) - { - while ((next_file = readdir(dir)) != nullptr) - { - struct stat statbuf; - const std::string file = next_file->d_name; - if (file == "." || file == "..") - continue; -#ifndef WIN32 - if (mPermitLinks == false) - { - if (lstat(path.c_str(), &statbuf) == 0 && - S_ISLNK(statbuf.st_mode) != 0) - { - continue; - } - } -#endif // WIN32 - - const std::string filePath = pathJoin(path, file); - if (stat(filePath.c_str(), &statbuf) == 0) - { - if (S_ISDIR(statbuf.st_mode) == 0) - continue; - } - - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == file) - { - found = true; - break; - } - } - if (found == false) - names.push_back(file); - } - closedir(dir); - } - } -} // namespace FsDir - -} // namespace VirtFs diff --git a/src/fs/virtfs/fsdir.h b/src/fs/virtfs/fsdir.h deleted file mode 100644 index 0c19fee2f..000000000 --- a/src/fs/virtfs/fsdir.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFSDIR_H -#define UTILS_VIRTFSDIR_H - -#include "fs/virtfs/fileapi.h" - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct File; -struct FsEntry; -struct FsFuncs; -struct List; - -namespace FsDir -{ - File *openInternal(FsEntry *restrict const entry, - const std::string &filename, - const FILEMTYPE mode); - File *openRead(FsEntry *restrict const entry, - std::string filename); - File *openWrite(FsEntry *restrict const entry, - const std::string &filename); - File *openAppend(FsEntry *restrict const entry, - const std::string &filename); - const char *getBaseDir(); - const char *getUserDir(); - FsFuncs *getFuncs(); - void init(const std::string &restrict name); - void initFuncs(FsFuncs *restrict const ptr); - void deinit(); - bool exists(FsEntry *restrict const entry, - std::string fileName, - std::string dirName); - void enumerate(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void getFiles(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void getFilesWithDir(FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void getDirs(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - bool isDirectory(FsEntry *restrict const entry, - std::string dirName, - bool &isDirFlag); - bool isSymbolicLink(std::string name); - void freeList(List *restrict const handle); - bool setWriteDir(std::string newDir); - bool getRealDir(FsEntry *restrict const entry, - std::string filename, - std::string dirName, - std::string &realDir); - bool mkdir(std::string dirName); - bool remove(std::string filename); - void permitLinks(const bool val); - int64_t read(File *restrict const handle, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int64_t write(File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int close(File *restrict const file); - int64_t fileLength(File *restrict const file); - int64_t tell(File *restrict const file); - int seek(File *restrict const file, - const uint64_t pos); - int eof(File *restrict const file); - const char *loadFile(FsEntry *restrict const entry, - std::string fileName, - int &restrict fileSize); -} // namespace FsDir - -} // namespace VirtFs - -#endif // UTILS_VIRTFSDIR_H diff --git a/src/fs/virtfs/fsdirrwops.cpp b/src/fs/virtfs/fsdirrwops.cpp deleted file mode 100644 index 47497a9d3..000000000 --- a/src/fs/virtfs/fsdirrwops.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/fsdirrwops.h" - -#include "fs/virtfs/file.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -namespace VirtFs -{ - -namespace FsDir -{ - RWOPSINT rwops_seek(SDL_RWops *const rw, - const RWOPSINT offset, - const int whence) - { - if (rw == nullptr) - return -1; - File *const handle = static_cast( - rw->hidden.unknown.data1); - FILEHTYPE fd = handle->mFd; - RWOPSINT pos = 0; - - if (whence == SEEK_SET) - { - pos = offset; - } - else if (whence == SEEK_CUR) - { -#ifdef USE_FILE_FOPEN - const int64_t current = ftell(fd); -#else // USE_FILE_FOPEN - const int64_t current = lseek(fd, 0, SEEK_CUR); -#endif // USE_FILE_FOPEN - - if (current == -1) - { - logger->assertLog( - "VirtFs::rwops_seek: Can't find position in file."); - return -1; - } - - pos = CAST_S32(current); - if (static_cast(pos) != current) - { - logger->assertLog("VirtFs::rwops_seek: " - "Can't fit current file position in an int!"); - return -1; - } - - if (offset == 0) /* this is a "tell" call. We're done. */ - return pos; - - pos += offset; - } - else if (whence == SEEK_END) - { - int64_t len = 0; -#ifdef USE_FILE_FOPEN - const long curpos = ftell(fd); - if (curpos < 0) - { - reportAlways("FsDir::fileLength ftell error."); - return -1; - } - fseek(fd, 0, SEEK_END); - len = ftell(fd); -// fseek(fd, curpos, SEEK_SET); -#else // USE_FILE_FOPEN - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - len = -1; - } - else - { - len = static_cast(statbuf.st_size); - } -#endif // USE_FILE_FOPEN - - if (len == -1) - { -#ifdef USE_FILE_FOPEN - if (fseek(fd, curpos, SEEK_SET) < 0) - { - reportAlways("FsDir::fileLength fseek error."); - } -#endif // USE_FILE_FOPEN - logger->assertLog( - "VirtFs::rwops_seek:Can't find end of file."); - return -1; - } - - pos = static_cast(len); - if (static_cast(pos) != len) - { -#ifdef USE_FILE_FOPEN - fseek(fd, curpos, SEEK_SET); -#endif // USE_FILE_FOPEN - logger->assertLog("VirtFs::rwops_seek: " - "Can't fit end-of-file position in an int!"); - return -1; - } - - pos += offset; - } - else - { - logger->assertLog( - "VirtFs::rwops_seek: Invalid 'whence' parameter."); - return -1; - } - - if (pos < 0) - { - logger->assertLog("VirtFs::rwops_seek: " - "Attempt to seek past start of file."); - return -1; - } - - const int64_t res = FILESEEK(fd, pos, SEEK_SET); - if (res == -1) - { - logger->assertLog("VirtFs::rwops_seek: seek error."); - return -1; - } - - return pos; - } - - RWOPSSIZE rwops_read(SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum) - { - if (rw == nullptr) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - FILEHTYPE fd = handle->mFd; - -#ifdef USE_FILE_FOPEN - const int64_t rc = fread(ptr, size, maxnum, fd); -#else // USE_FILE_FOPEN - int max = size * maxnum; - int cnt = ::read(fd, ptr, max); - if (cnt <= 0) - return cnt; - const int64_t rc = cnt / size; -#endif // USE_FILE_FOPEN - -#ifndef USE_FILE_FOPEN - if (rc != static_cast(maxnum)) - { - const int64_t pos = lseek(fd, 0, SEEK_CUR); - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - return CAST_S32(rc); - } - } -#endif // USE_FILE_FOPEN - return CAST_S32(rc); - } - - RWOPSSIZE rwops_write(SDL_RWops *const rw, - const void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum) - { - if (rw == nullptr) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - FILEHTYPE fd = handle->mFd; - -#ifdef USE_FILE_FOPEN - const int64_t rc = fwrite(ptr, size, maxnum, fd); -#else // USE_FILE_FOPEN - int max = size * maxnum; - int cnt = ::write(fd, ptr, max); - if (cnt <= 0) - return cnt; - const int64_t rc = cnt / size; -#endif // USE_FILE_FOPEN - -#ifndef USE_FILE_FOPEN - if (rc != static_cast(maxnum)) - { - const int64_t pos = lseek(fd, 0, SEEK_CUR); - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - return CAST_S32(rc); - } - } -#endif // USE_FILE_FOPEN - - return CAST_S32(rc); - } - - int rwops_close(SDL_RWops *const rw) - { - if (rw == nullptr) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - delete handle; - SDL_FreeRW(rw); - return 0; - } - -#ifdef USE_SDL2 - RWOPSINT rwops_size(SDL_RWops *const rw) - { - File *const handle = static_cast( - rw->hidden.unknown.data1); - FILEHTYPE fd = handle->mFd; -#ifdef USE_FILE_FOPEN - const long pos = ftell(fd); - fseek(fd, 0, SEEK_END); - const long sz = ftell(fd); - fseek(fd, pos, SEEK_SET); - return sz; -#else // USE_FILE_FOPEN - struct stat statbuf; - if (fstat(fd, &statbuf) == -1) - { - reportAlways("FsDir::fileLength error."); - return -1; - } - return static_cast(statbuf.st_size); -#endif // USE_FILE_FOPEN - } -#endif // USE_SDL2 - -} // namespace FsDir - -} // namespace VirtFs diff --git a/src/fs/virtfs/fsdirrwops.h b/src/fs/virtfs/fsdirrwops.h deleted file mode 100644 index 1f20d97df..000000000 --- a/src/fs/virtfs/fsdirrwops.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFS_VIRTFSDIRRWOPS_H -#define UTILS_VIRTFS_VIRTFSDIRRWOPS_H - -#include "fs/virtfs/rwopstypes.h" - -struct SDL_RWops; - -#include "localconsts.h" - -namespace VirtFs -{ - -namespace FsDir -{ - RWOPSINT rwops_seek(SDL_RWops *const rw, - const RWOPSINT offset, - const int whence); - RWOPSSIZE rwops_read(SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum); - RWOPSSIZE rwops_write(SDL_RWops *const rw, - const void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum); - int rwops_close(SDL_RWops *const rw); -#ifdef USE_SDL2 - RWOPSINT rwops_size(SDL_RWops *const rw); -#endif // USE_SDL2 - -} // namespace FsDir - -} // namespace VirtFs - -#endif // UTILS_VIRTFS_VIRTFSDIRRWOPS_H diff --git a/src/fs/virtfs/fsentry.cpp b/src/fs/virtfs/fsentry.cpp deleted file mode 100644 index 7078fdbc4..000000000 --- a/src/fs/virtfs/fsentry.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/fsentry.h" - -#include "debug.h" - -namespace VirtFs -{ - -FsEntry::FsEntry(const FsEntryTypeT &type0, - FsFuncs *restrict const funcs0) : - root(), - subDir(), - type(type0), - funcs(funcs0) -{ -} - -FsEntry::~FsEntry() -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/fsentry.h b/src/fs/virtfs/fsentry.h deleted file mode 100644 index 09ca136b0..000000000 --- a/src/fs/virtfs/fsentry.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTFSENTRY_H -#define UTILS_VIRTFSENTRY_H - -#include "enums/fs/fsentrytype.h" - -#include - -#include "localconsts.h" - -namespace VirtFs -{ - -struct FsFuncs; - -struct FsEntry notfinal -{ - FsEntry(const FsEntryTypeT &type0, - FsFuncs *restrict const funcs); - - A_DELETE_COPY(FsEntry) - - virtual ~FsEntry(); - - std::string root; - - std::string subDir; - - FsEntryTypeT type; - - FsFuncs *funcs; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTFSENTRY_H diff --git a/src/fs/virtfs/fsfuncs.h b/src/fs/virtfs/fsfuncs.h deleted file mode 100644 index 49d10e12f..000000000 --- a/src/fs/virtfs/fsfuncs.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFSFUNCS_H -#define UTILS_VIRTFSFUNCS_H - -#include "fs/virtfs/rwopstypes.h" - -#include "utils/stringvector.h" - -#include "localconsts.h" - -struct SDL_RWops; - -namespace VirtFs -{ - -struct File; -struct FsEntry; - -struct FsFuncs final -{ - FsFuncs() : - close(nullptr), - read(nullptr), - write(nullptr), - fileLength(nullptr), - tell(nullptr), - seek(nullptr), - exists(nullptr), - getRealDir(nullptr), - enumerate(nullptr), - getFiles(nullptr), - getFilesWithDir(nullptr), - getDirs(nullptr), - isDirectory(nullptr), - openRead(nullptr), - openWrite(nullptr), - openAppend(nullptr), - eof(nullptr), - loadFile(nullptr), - rwops_seek(nullptr), - rwops_read(nullptr), - rwops_write(nullptr), -#ifdef USE_SDL2 - rwops_size(nullptr), -#endif // USE_SDL2 - rwops_close(nullptr) - { - } - - A_DELETE_COPY(FsFuncs) - - int (*close) (File *restrict const file); - int64_t (*read) (File *restrict const file, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int64_t (*write) (File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int64_t (*fileLength) (File *restrict const file); - int64_t (*tell) (File *restrict const file); - int (*seek) (File *restrict const file, - const uint64_t pos); - bool (*exists) (FsEntry *restrict const entry, - std::string filename, - std::string dirName); - bool (*getRealDir) (FsEntry *restrict const entry, - std::string filename, - std::string dirName, - std::string &realDir); - void (*enumerate) (FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void (*getFiles) (FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void (*getFilesWithDir) (FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void (*getDirs) (FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - bool (*isDirectory) (FsEntry *restrict const entry, - std::string dirName, - bool &isDirFlag); - File *(*openRead) (FsEntry *restrict const entry, - std::string filename); - File *(*openWrite) (FsEntry *restrict const entry, - const std::string &filename); - File *(*openAppend) (FsEntry *restrict const entry, - const std::string &filename); - int (*eof) (File *restrict const file); - const char *(*loadFile) (FsEntry *restrict const entry, - std::string fileName, - int &restrict fileSize); - - RWOPSINT (*rwops_seek) (SDL_RWops *const rw, - const RWOPSINT offset, - const int whence); - RWOPSSIZE (*rwops_read) (SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum); - RWOPSSIZE (*rwops_write) (SDL_RWops *const rw, - const void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE num); -#ifdef USE_SDL2 - RWOPSINT (*rwops_size) (SDL_RWops *const rw); -#endif // USE_SDL2 - int (*rwops_close) (SDL_RWops *const rw); -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTFSFUNCS_H diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp deleted file mode 100644 index fcb726173..000000000 --- a/src/fs/virtfs/fszip.cpp +++ /dev/null @@ -1,705 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/fszip.h" - -#include "fs/virtfs/file.h" -#include "fs/virtfs/fsfuncs.h" -#include "fs/virtfs/fsziprwops.h" -#include "fs/virtfs/list.h" -#include "fs/virtfs/zipentry.h" -#include "fs/virtfs/zipreader.h" -#include "fs/virtfs/ziplocalheader.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" -#include "utils/foreach.h" -#include "utils/stringutils.h" - -#include "debug.h" - -extern const char *dirSeparator; - -namespace -{ - VirtFs::FsFuncs funcs; -} // namespace - -namespace VirtFs -{ - -namespace FsZip -{ - FsFuncs *getFuncs() - { - return &funcs; - } - - void deinit() - { - } - - void init() - { - initFuncs(&funcs); - } - - void initFuncs(FsFuncs *restrict const ptr) - { - ptr->close = &FsZip::close; - ptr->read = &FsZip::read; - ptr->write = &FsZip::write; - ptr->fileLength = &FsZip::fileLength; - ptr->tell = &FsZip::tell; - ptr->seek = &FsZip::seek; - ptr->eof = &FsZip::eof; - ptr->exists = &FsZip::exists; - ptr->getRealDir = &FsZip::getRealDir; - ptr->enumerate = &FsZip::enumerate; - ptr->isDirectory = &FsZip::isDirectory; - ptr->openRead = &FsZip::openRead; - ptr->openWrite = &FsZip::openWrite; - ptr->openAppend = &FsZip::openAppend; - ptr->loadFile = &FsZip::loadFile; - ptr->getFiles = &FsZip::getFiles; - ptr->getFilesWithDir = &FsZip::getFilesWithDir; - ptr->getDirs = &FsZip::getDirs; - ptr->rwops_seek = &FsZip::rwops_seek; - ptr->rwops_read = &FsZip::rwops_read; - ptr->rwops_write = &FsZip::rwops_write; - ptr->rwops_close = &FsZip::rwops_close; -#ifdef USE_SDL2 - ptr->rwops_size = &FsZip::rwops_size; -#endif // USE_SDL2 - } - - bool getRealDir(FsEntry *restrict const entry, - std::string filename, - std::string dirName, - std::string &realDir) - { - ZipEntry *const zipEntry = static_cast(entry); - std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - { - filename = pathJoin(subDir, filename); - dirName = pathJoin(subDir, dirName); - } - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - if ((*it2)->fileName == filename) - { - realDir = entry->root; - return true; - } - } - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mDirs) - { - if (*it2 == dirName) - { - realDir = entry->root; - return true; - } - } - return false; - } - - bool exists(FsEntry *restrict const entry, - std::string filename, - std::string dirName) - { - ZipEntry *const zipEntry = static_cast(entry); - std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - { - filename = pathJoin(subDir, filename); - dirName = pathJoin(subDir, dirName); - } - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - if ((*it2)->fileName == filename) - return true; - } - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mDirs) - { - if (*it2 == dirName) - return true; - } - return false; - } - - void enumerate(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - ZipEntry *const zipEntry = static_cast(entry); - const std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - dirName = pathJoin(subDir, dirName); - if (dirName == dirSeparator) - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - names.push_back(fileName); - } - } - else - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - if (findCutFirst(fileName, dirName) == true) - { - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - names.push_back(fileName); - } - } - } - } - - void getFiles(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - ZipEntry *const zipEntry = static_cast(entry); - const std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - dirName = pathJoin(subDir, dirName); - if (dirName == dirSeparator) - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirName, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == false) - dirName2 += dirSeparator; - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == false) - names.push_back(fileName); - } - } - } - else - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - if (findCutFirst(fileName, dirName) == true) - { - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirName, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == - false) - { - dirName2 += dirSeparator; - } - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == false) - names.push_back(fileName); - } - } - } - } - } - - void getFilesWithDir(FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names) - { - ZipEntry *const zipEntry = static_cast(entry); - const std::string subDir = zipEntry->subDir; - std::string dirNameFull; - if (!subDir.empty()) - dirNameFull = pathJoin(subDir, dirName); - else - dirNameFull = dirName; - if (dirNameFull == dirSeparator) - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirNameFull, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == false) - dirName2 += dirSeparator; - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == false) - names.push_back(pathJoin(dirName, fileName)); - } - } - } - else - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - if (findCutFirst(fileName, dirNameFull) == true) - { - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirNameFull, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == - false) - { - dirName2 += dirSeparator; - } - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == false) - names.push_back(pathJoin(dirName, fileName)); - } - } - } - } - } - - void getDirs(FsEntry *restrict const entry, - std::string dirName, - StringVect &names) - { - ZipEntry *const zipEntry = static_cast(entry); - const std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - dirName = pathJoin(subDir, dirName); - if (dirName == dirSeparator) - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirName, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == false) - dirName2 += dirSeparator; - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == true) - names.push_back(fileName); - } - } - } - else - { - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - ZipLocalHeader *const header = *it2; - std::string fileName = header->fileName; - if (findCutFirst(fileName, dirName) == true) - { - // skip subdirs from enumeration - const size_t idx = fileName.find(dirSeparator); - if (idx != std::string::npos) - fileName.erase(idx); - bool found(false); - FOR_EACH (StringVectCIter, itn, names) - { - if (*itn == fileName) - { - found = true; - break; - } - } - if (found == false) - { - std::string dirName2 = pathJoin(dirName, fileName); - if (findLast(dirName2, std::string(dirSeparator)) == - false) - { - dirName2 += dirSeparator; - } - FOR_EACH (STD_VECTOR::const_iterator, - it, - zipEntry->mDirs) - { - if (*it == dirName2) - { - found = true; - break; - } - } - if (found == true) - names.push_back(fileName); - } - } - } - } - } - - bool isDirectory(FsEntry *restrict const entry, - std::string dirName, - bool &isDirFlag) - { - ZipEntry *const zipEntry = static_cast(entry); - std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - dirName = pathJoin(subDir, dirName); - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mDirs) - { - if (*it2 == dirName) - { - isDirFlag = true; - return true; - } - } - return false; - } - - void freeList(List *restrict const handle) - { - delete handle; - } - - File *openRead(FsEntry *restrict const entry, - std::string filename) - { - ZipEntry *const zipEntry = static_cast(entry); - std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - filename = pathJoin(subDir, filename); - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - const ZipLocalHeader *restrict const header = *it2; - if (header->fileName == filename) - { - const uint8_t *restrict const buf = - ZipReader::readFile(header); - if (buf == nullptr) - return nullptr; - return new File(&funcs, - buf, - header->uncompressSize); - } - } - return nullptr; - } - - File *openWrite(FsEntry *restrict const entry A_UNUSED, - const std::string &filename A_UNUSED) - { - reportAlways("VirtFs::openWrite for zip not implemented."); - return nullptr; - } - - File *openAppend(FsEntry *restrict const entry A_UNUSED, - const std::string &filename A_UNUSED) - { - reportAlways("VirtFs::openAppend for zip not implemented."); - return nullptr; - } - - int close(File *restrict const file) - { - if (file == nullptr) - return 0; - delete file; - return 1; - } - - int64_t read(File *restrict const file, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount) - { - if (file == nullptr || - objSize == 0 || - objCount == 0) - { - return 0; - } - if (buffer == nullptr) - { - reportAlways("FsZip::read buffer is null"); - return 0; - } - const size_t pos = file->mPos; - const size_t sz = file->mSize; - // if outside of buffer, return - if (pos >= sz) - return 0; - // pointer to start for buffer ready to read - const uint8_t *restrict const memPtr = file->mBuf + pos; - // left buffer size from pos to end - const uint32_t memSize = CAST_U32(sz - pos); - // number of objects possible to read - uint32_t memCount = memSize / objSize; - if (memCount == 0) - return 0; - // limit number of possible objects to read to objCount - if (memCount > objCount) - memCount = objCount; - // number of bytes to read from buffer - const size_t memEnd = memCount * objSize; - memcpy(buffer, memPtr, memEnd); - file->mPos += memEnd; - return memCount; - } - - int64_t write(File *restrict const file A_UNUSED, - const void *restrict const buffer A_UNUSED, - const uint32_t objSize A_UNUSED, - const uint32_t objCount A_UNUSED) - { - return 0; - } - - int64_t fileLength(File *restrict const file) - { - if (file == nullptr) - return -1; - - return file->mSize; - } - - int64_t tell(File *restrict const file) - { - if (file == nullptr) - return -1; - - return file->mPos; - } - - int seek(File *restrict const file, - const uint64_t pos) - { - if (file == nullptr) - return 0; - - if (pos > file->mSize) - return 0; - file->mPos = pos; - return 1; - } - - int eof(File *restrict const file) - { - if (file == nullptr) - return -1; - - return static_cast(file->mPos >= file->mSize); - } - - const char *loadFile(FsEntry *restrict const entry, - std::string filename, - int &restrict fileSize) - { - ZipEntry *const zipEntry = static_cast(entry); - const std::string subDir = zipEntry->subDir; - if (!subDir.empty()) - filename = pathJoin(subDir, filename); - FOR_EACH (STD_VECTOR::const_iterator, - it2, - zipEntry->mHeaders) - { - const ZipLocalHeader *restrict const header = *it2; - if (header->fileName == filename) - { - const uint8_t *restrict const buf = - ZipReader::readFile(header); - if (buf == nullptr) - return nullptr; - - logger->log("Loaded %s/%s", - entry->root.c_str(), - filename.c_str()); - - fileSize = header->uncompressSize; - return reinterpret_cast(buf); - } - } - return nullptr; - } -} // namespace FsZip - -} // namespace VirtFs diff --git a/src/fs/virtfs/fszip.h b/src/fs/virtfs/fszip.h deleted file mode 100644 index 92cfd0ab6..000000000 --- a/src/fs/virtfs/fszip.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFSZIP_H -#define UTILS_VIRTFSZIP_H - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct File; -struct List; -struct FsFuncs; -struct FsEntry; - -namespace FsZip -{ - FsFuncs *getFuncs(); - void init(); - void initFuncs(FsFuncs *restrict const ptr); - void deinit(); - bool exists(FsEntry *restrict const entry, - std::string filename, - std::string dirName); - void enumerate(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void getFiles(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - void getFilesWithDir(FsEntry *restrict const entry, - const std::string &dirName, - StringVect &names); - void getDirs(FsEntry *restrict const entry, - std::string dirName, - StringVect &names); - bool isDirectory(FsEntry *restrict const entry, - std::string dirName, - bool &isDirFlag); - void freeList(List *restrict const handle); - File *openRead(FsEntry *restrict const entry, - std::string filename); - File *openWrite(FsEntry *restrict const entry, - const std::string &filename); - File *openAppend(FsEntry *restrict const entry, - const std::string &filename); - File *openReadInternal(const std::string &filename); - bool getRealDir(FsEntry *restrict const entry, - std::string filename, - std::string dirName, - std::string &realDir); - int64_t read(File *restrict const handle, - void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int64_t write(File *restrict const file, - const void *restrict const buffer, - const uint32_t objSize, - const uint32_t objCount); - int close(File *restrict const file); - int64_t fileLength(File *restrict const file); - int64_t tell(File *restrict const file); - int seek(File *restrict const file, - const uint64_t pos); - int eof(File *restrict const file); - const char *loadFile(FsEntry *restrict const entry, - std::string fileName, - int &restrict fileSize); -} // namespace FsZip - -} // namespace VirtFs - -#endif // UTILS_VIRTFSZIP_H diff --git a/src/fs/virtfs/fsziprwops.cpp b/src/fs/virtfs/fsziprwops.cpp deleted file mode 100644 index e9f72c469..000000000 --- a/src/fs/virtfs/fsziprwops.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/fsziprwops.h" - -#include "logger.h" - -#include "fs/virtfs/file.h" -#include "fs/virtfs/fsfuncs.h" - -#include "utils/cast.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -namespace VirtFs -{ - -namespace FsZip -{ - RWOPSINT rwops_seek(SDL_RWops *const rw, - const RWOPSINT offset, - const int whence) - { - if (rw == nullptr) - return -1; - File *const handle = static_cast( - rw->hidden.unknown.data1); - size_t mPos = handle->mPos; - size_t mSize = handle->mSize; - - RWOPSINT pos = 0; - - if (whence == SEEK_SET) - { - pos = offset; - } - else if (whence == SEEK_CUR) - { - const int64_t current = mPos; - if (current == -1) - { - logger->assertLog( - "VirtFs::rwops_seek: Can't find position in file."); - return -1; - } - - pos = CAST_S32(current); - if (static_cast(pos) != current) - { - logger->assertLog("VirtFs::rwops_seek: " - "Can't fit current file position in an int!"); - return -1; - } - - if (offset == 0) /* this is a "tell" call. We're done. */ - return pos; - - pos += offset; - } - else if (whence == SEEK_END) - { - pos = static_cast(mSize + offset); - } - else - { - logger->assertLog( - "VirtFs::rwops_seek: Invalid 'whence' parameter."); - return -1; - } - - if (pos < 0) - { - logger->assertLog("VirtFs::rwops_seek: " - "Attempt to seek past start of file."); - return -1; - } - - handle->mPos = pos; - - if (pos > static_cast(mSize)) - { - logger->assertLog("VirtFs::rwops_seek: seek error."); - return -1; - } - - return pos; - } - - RWOPSSIZE rwops_read(SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum) - { - if (rw == nullptr) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - - const int64_t rc = handle->funcs->read(handle, - ptr, - CAST_U32(size), - CAST_U32(maxnum)); - return CAST_S32(rc); - } - - RWOPSSIZE rwops_write(SDL_RWops *const rw A_UNUSED, - const void *const ptr A_UNUSED, - const RWOPSSIZE size A_UNUSED, - const RWOPSSIZE num A_UNUSED) - { - return 0; - } - - int rwops_close(SDL_RWops *const rw) - { - if (rw == nullptr) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - delete handle; - SDL_FreeRW(rw); - return 0; - } - -#ifdef USE_SDL2 - RWOPSINT rwops_size(SDL_RWops *const rw) - { - if (!rw) - return 0; - File *const handle = static_cast( - rw->hidden.unknown.data1); - return handle->mSize; - } -#endif // USE_SDL2 - -} // namespace FsZip - -} // namespace VirtFs diff --git a/src/fs/virtfs/fsziprwops.h b/src/fs/virtfs/fsziprwops.h deleted file mode 100644 index 508b2213c..000000000 --- a/src/fs/virtfs/fsziprwops.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFS_VIRTFSZIPRWOPS_H -#define UTILS_VIRTFS_VIRTFSZIPRWOPS_H - -#include "fs/virtfs/rwopstypes.h" - -#include "localconsts.h" - -struct SDL_RWops; - -namespace VirtFs -{ - -namespace FsZip -{ - RWOPSINT rwops_seek(SDL_RWops *const rw, - const RWOPSINT offset, - const int whence); - RWOPSSIZE rwops_read(SDL_RWops *const rw, - void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE maxnum); - RWOPSSIZE rwops_write(SDL_RWops *const rw, - const void *const ptr, - const RWOPSSIZE size, - const RWOPSSIZE num); - int rwops_close(SDL_RWops *const rw); -#ifdef USE_SDL2 - RWOPSINT rwops_size(SDL_RWops *const rw); -#endif // USE_SDL2 - -} // namespace FsZip - -} // namespace VirtFs - -#endif // UTILS_VIRTFS_VIRTFSZIPRWOPS_H diff --git a/src/fs/virtfs/list.cpp b/src/fs/virtfs/list.cpp deleted file mode 100644 index 2f0a23d66..000000000 --- a/src/fs/virtfs/list.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/list.h" - -#include "debug.h" - -namespace VirtFs -{ - -List::List() : - names() -{ -} - -List::~List() -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/list.h b/src/fs/virtfs/list.h deleted file mode 100644 index 9dcb9e269..000000000 --- a/src/fs/virtfs/list.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTLIST_H -#define UTILS_VIRTLIST_H - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct List final -{ - List(); - - A_DELETE_COPY(List) - - ~List(); - - StringVect names; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTLIST_H diff --git a/src/fs/virtfs/rwops.cpp b/src/fs/virtfs/rwops.cpp deleted file mode 100644 index e6a7a5914..000000000 --- a/src/fs/virtfs/rwops.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -/* - * 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-2017 The ManaPlus Developers - */ - -#include "fs/virtfs/rwops.h" - -#include "logger.h" - -#include "fs/virtfs/file.h" -#include "fs/virtfs/fs.h" -#include "fs/virtfs/fsfuncs.h" - -#include "utils/fuzzer.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -namespace VirtFs -{ - -SDL_RWops *create_rwops(File *const file) -{ - SDL_RWops *retval = nullptr; - - if (file == nullptr) - { - logger->assertLog("VirtFs::rwops_seek: create rwops error."); - } - else - { - retval = SDL_AllocRW(); - if (retval != nullptr) - { -#ifdef USE_SDL2 - retval->size = file->funcs->rwops_size; -#endif // USE_SDL2 - - retval->seek = file->funcs->rwops_seek; - retval->read = file->funcs->rwops_read; - retval->write = file->funcs->rwops_write; - retval->close = file->funcs->rwops_close; - retval->hidden.unknown.data1 = file; - } /* if */ - } /* else */ - - return retval; -} /* VirtFs::create_rwops */ - -#ifdef __APPLE__ -static bool checkFilePath(const std::string &restrict fname) -{ - if (fname.empty()) - return false; - if (!exists(fname) || isDirectory(fname)) - return false; - return true; -} -#endif // __APPLE__ - -SDL_RWops *rwopsOpenRead(const std::string &restrict fname) -{ - BLOCK_START("RWopsopenRead") -#ifdef __APPLE__ - if (!checkFilePath(fname)) - return nullptr; -#endif // __APPLE__ -#ifdef USE_FUZZER - if (Fuzzer::conditionTerminate(fname)) - return nullptr; -#endif // USE_FUZZER -#ifdef USE_PROFILER - - SDL_RWops *const ret = create_rwops(openRead(fname)); - - BLOCK_END("RWopsopenRead") - return ret; -#else // USE_PROFILER - - return create_rwops(openRead(fname)); -#endif // USE_PROFILER -} /* RWopsopenRead */ - -SDL_RWops *rwopsOpenWrite(const std::string &restrict fname) -{ -#ifdef __APPLE__ - if (!checkFilePath(fname)) - return nullptr; -#endif // __APPLE__ - - return create_rwops(openWrite(fname)); -} /* RWopsopenWrite */ - -SDL_RWops *rwopsOpenAppend(const std::string &restrict fname) -{ -#ifdef __APPLE__ - if (!checkFilePath(fname)) - return nullptr; -#endif // __APPLE__ - - return create_rwops(openAppend(fname)); -} /* RWopsopenAppend */ - -} // namespace VirtFs - -/* end of virtfsrwops.c ... */ diff --git a/src/fs/virtfs/rwops.h b/src/fs/virtfs/rwops.h deleted file mode 100644 index 7be265ad2..000000000 --- a/src/fs/virtfs/rwops.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -/* - * 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-2017 The ManaPlus Developers - */ - -#ifndef SRC_FS_VIRTFSRWOPS_H -#define SRC_FS_VIRTFSRWOPS_H - -#include "localconsts.h" - -#include - -struct SDL_RWops; - -namespace VirtFs -{ - struct File; - - SDL_RWops *create_rwops(File *const file); - - SDL_RWops *rwopsOpenRead(const std::string &restrict fname); - SDL_RWops *rwopsOpenWrite(const std::string &restrict fname) A_WARN_UNUSED; - SDL_RWops *rwopsOpenAppend(const std::string &restrict fname) - A_WARN_UNUSED; -} // namespace VirtFs - -#endif // SRC_FS_VIRTFSRWOPS_H diff --git a/src/fs/virtfs/rwopstypes.h b/src/fs/virtfs/rwopstypes.h deleted file mode 100644 index 36a87e5a4..000000000 --- a/src/fs/virtfs/rwopstypes.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef SRC_FS_VIRTFS_RWOPSTYPES_H -#define SRC_FS_VIRTFS_RWOPSTYPES_H - -#include "localconsts.h" - -#ifdef USE_SDL2 -#define RWOPSINT int64_t -#define RWOPSSIZE size_t -#else // USE_SDL2 -#define RWOPSINT int32_t -#define RWOPSSIZE int -#endif // USE_SDL2 - -#endif // SRC_FS_VIRTFS_RWOPSTYPES_H diff --git a/src/fs/virtfs/tools.cpp b/src/fs/virtfs/tools.cpp deleted file mode 100644 index 64153fc52..000000000 --- a/src/fs/virtfs/tools.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#include "fs/virtfs/tools.h" - -#include "logger.h" - -#include "fs/paths.h" - -#include "fs/virtfs/fs.h" -#include "fs/virtfs/list.h" - -#include "utils/foreach.h" -#include "utils/stringutils.h" - -#include -#include - -#include "debug.h" - -namespace VirtFs -{ - void searchAndAddArchives(const std::string &restrict path, - const std::string &restrict ext, - const Append append) - { - List *const list = VirtFs::enumerateFiles(path); - FOR_EACH (StringVectCIter, i, list->names) - { - const std::string str = *i; - const size_t len = str.size(); - - if (len > ext.length() && - ext == str.substr(len - ext.length())) - { - const std::string file = path + str; - const std::string realPath = VirtFs::getRealDir(file); - VirtFs::mountZip(pathJoin(realPath, file), append); - } - } - VirtFs::freeList(list); - } - - void searchAndRemoveArchives(const std::string &restrict path, - const std::string &restrict ext) - { - List *const list = VirtFs::enumerateFiles(path); - FOR_EACH (StringVectCIter, i, list->names) - { - const std::string str = *i; - const size_t len = str.size(); - if (len > ext.length() && - ext == str.substr(len - ext.length())) - { - const std::string file = path + str; - const std::string realPath = VirtFs::getRealDir(file); - VirtFs::unmountZip(pathJoin(realPath, file)); - } - } - VirtFs::freeList(list); - } - - void getFilesInDir(const std::string &dir, - StringVect &list, - const std::string &ext) - { - const std::string &path = dir; - StringVect tempList; - VirtFs::getFilesWithDir(path, tempList); - FOR_EACH (StringVectCIter, it, tempList) - { - const std::string &str = *it; - if (findLast(str, ext)) - list.push_back(str); - } - std::sort(list.begin(), list.end()); - } - - std::string getPath(const std::string &file) - { - // get the real path to the file - const std::string tmp = VirtFs::getRealDir(file); - std::string path; - - // if the file is not in the search path, then its empty - if (!tmp.empty()) - { - path = pathJoin(tmp, file); -#if defined __native_client__ - std::string dataZip = "/http/data.zip/"; - if (path.substr(0, dataZip.length()) == dataZip) - path = path.replace(0, dataZip.length(), "/http/data/"); -#endif // defined __native_client__ - } - else - { - // if not found in search path return the default path - path = pathJoin(getPackageDir(), file); - } - - return path; - } - - std::string loadTextFileString(const std::string &fileName) - { - int contentsLength; - const char *fileContents = VirtFs::loadFile(fileName, contentsLength); - - if (fileContents == nullptr) - { - logger->log("Couldn't load text file: %s", fileName.c_str()); - return std::string(); - } - const std::string str = std::string(fileContents, contentsLength); - delete [] fileContents; - return str; - } - - bool loadTextFile(const std::string &fileName, - StringVect &lines) - { - int contentsLength; - const char *fileContents = VirtFs::loadFile(fileName, contentsLength); - - if (fileContents == nullptr) - { - logger->log("Couldn't load text file: %s", fileName.c_str()); - return false; - } - - std::istringstream iss(std::string(fileContents, contentsLength)); - std::string line; - - while (getline(iss, line)) - lines.push_back(line); - - delete [] fileContents; - return true; - } -} // namespace VirtFs diff --git a/src/fs/virtfs/tools.h b/src/fs/virtfs/tools.h deleted file mode 100644 index f00a976bb..000000000 --- a/src/fs/virtfs/tools.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2013-2017 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 . - */ - -#ifndef UTILS_VIRTFSTOOLS_H -#define UTILS_VIRTFSTOOLS_H - -#include "enums/simpletypes/append.h" - -#include "utils/stringvector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - void searchAndAddArchives(const std::string &restrict path, - const std::string &restrict ext, - const Append append); - void searchAndRemoveArchives(const std::string &restrict path, - const std::string &restrict ext); - void getFilesInDir(const std::string &dir, - StringVect &list, - const std::string &ext); - std::string getPath(const std::string &file); - bool loadTextFile(const std::string &fileName, - StringVect &lines); - std::string loadTextFileString(const std::string &fileName); -} // namespace VirtFs - -#endif // UTILS_VIRTFSTOOLS_H diff --git a/src/fs/virtfs/zipentry.cpp b/src/fs/virtfs/zipentry.cpp deleted file mode 100644 index d8440833b..000000000 --- a/src/fs/virtfs/zipentry.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/zipentry.h" - -#include "fs/virtfs/ziplocalheader.h" - -#include "utils/dtor.h" - -#include "debug.h" - -namespace VirtFs -{ - -ZipEntry::ZipEntry(const std::string &restrict archiveName, - const std::string &subDir0, - FsFuncs *restrict const funcs0) : - FsEntry(FsEntryType::Zip, funcs0), - mHeaders(), - mDirs() -{ - root = archiveName; - subDir = subDir0; -} - -ZipEntry::~ZipEntry() -{ - delete_all(mHeaders); -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/zipentry.h b/src/fs/virtfs/zipentry.h deleted file mode 100644 index eaf77889d..000000000 --- a/src/fs/virtfs/zipentry.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_VIRTZIPENTRY_H -#define UTILS_VIRTZIPENTRY_H - -#include "fs/virtfs/fsentry.h" - -#include "utils/vector.h" - -#include "localconsts.h" - -namespace VirtFs -{ - -struct ZipLocalHeader; - -struct ZipEntry final : public FsEntry -{ - ZipEntry(const std::string &restrict archiveName, - const std::string &subDir0, - FsFuncs *restrict const funcs); - - A_DELETE_COPY(ZipEntry) - - virtual ~ZipEntry(); - - STD_VECTOR mHeaders; - STD_VECTOR mDirs; -}; - -} // namespace VirtFs - -#endif // UTILS_VIRTZIPENTRY_H diff --git a/src/fs/virtfs/ziplocalheader.cpp b/src/fs/virtfs/ziplocalheader.cpp deleted file mode 100644 index 437140d07..000000000 --- a/src/fs/virtfs/ziplocalheader.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/ziplocalheader.h" - -#include "localconsts.h" - -#include "debug.h" - -namespace VirtFs -{ - -ZipLocalHeader::ZipLocalHeader() : - fileName(), - zipEntry(nullptr), - dataOffset(0U), - compressSize(0U), - uncompressSize(0U), - compressed(false) -{ -} - -} // namespace VirtFs diff --git a/src/fs/virtfs/ziplocalheader.h b/src/fs/virtfs/ziplocalheader.h deleted file mode 100644 index 88bfc2458..000000000 --- a/src/fs/virtfs/ziplocalheader.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_ZIPLOCALHEADER_H -#define UTILS_ZIPLOCALHEADER_H - -#include "localconsts.h" - -#include - -namespace VirtFs -{ - -struct ZipEntry; - -struct ZipLocalHeader final -{ - ZipLocalHeader(); - - A_DELETE_COPY(ZipLocalHeader) - - std::string fileName; - ZipEntry *zipEntry; - uint32_t dataOffset; - uint32_t compressSize; - uint32_t uncompressSize; - bool compressed; -}; - -} // namespace VirtFs - -#endif // UTILS_ZIPLOCALHEADER_H diff --git a/src/fs/virtfs/zipreader.cpp b/src/fs/virtfs/zipreader.cpp deleted file mode 100644 index 2d473bec7..000000000 --- a/src/fs/virtfs/zipreader.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#include "fs/virtfs/zipreader.h" - -#include "fs/paths.h" - -#include "fs/virtfs/zipentry.h" -#include "fs/virtfs/ziplocalheader.h" - -#include "utils/cast.h" -#include "utils/checkutils.h" -#include "utils/delete2.h" -#include "utils/stringutils.h" - -#include -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -#ifndef SDL_BIG_ENDIAN -#error missing SDL_endian.h -#endif // SDL_BYTEORDER - -// #define DEBUG_ZIP - -extern const char *dirSeparator; - -#define readVal(val, sz, msg) \ - cnt = fread(static_cast(val), 1, sz, arcFile); \ - if (cnt != sz) \ - { \ - reportAlways("Error reading " msg " in file %s", \ - archiveName.c_str()); \ - delete2(header); \ - delete [] buf; \ - fclose(arcFile); \ - return false; \ - } - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN -#define swapVal16(val) val = __builtin_bswap16(val); -#define swapVal32(val) val = __builtin_bswap32(val); -#else // SDL_BYTEORDER == SDL_BIG_ENDIAN -#define swapVal16(val) -#define swapVal32(val) -#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - -namespace VirtFs -{ - -namespace ZipReader -{ - bool readArchiveInfo(ZipEntry *const entry) - { - if (entry == nullptr) - { - reportAlways("Entry is null."); - return false; - } - const std::string archiveName = entry->root; - STD_VECTOR &restrict headers = entry->mHeaders; - STD_VECTOR &restrict dirs = entry->mDirs; - FILE *restrict const arcFile = fopen(archiveName.c_str(), - "rb"); - if (arcFile == nullptr) - { - reportAlways("Can't open zip file %s", - archiveName.c_str()); - return false; - } - uint8_t *const buf = new uint8_t[65535 + 10]; - uint16_t val16 = 0U; - uint16_t method = 0U; - ZipLocalHeader *header = nullptr; - -#ifdef DEBUG_ZIP - logger->log("Read archive: %s", archiveName.c_str()); -#endif // DEBUG_ZIP - - // format source https://en.wikipedia.org/wiki/Zip_%28file_format%29 - while (feof(arcFile) == 0) - { - size_t cnt = 0U; - // file header pointer on 0 - // read file header signature - readVal(buf, 4, "zip file header"); // + 4 - // pointer on 4 - - if (buf[0] == 0x50 && - buf[1] == 0x4B && - buf[2] == 0x03 && - buf[3] == 0x04) - { // local file header - header = new ZipLocalHeader; - header->zipEntry = entry; - // skip useless fields - fseek(arcFile, 4, SEEK_CUR); // + 4 - // file header pointer on 8 - readVal(&method, 2, "compression method") // + 2 - swapVal16(method) - header->compressed = (method != 0); - // file header pointer on 10 - fseek(arcFile, 8, SEEK_CUR); // + 8 - // file header pointer on 18 - readVal(&header->compressSize, 4, - "zip compressed size") // + 4 - swapVal32(header->compressSize) - // file header pointer on 22 - readVal(&header->uncompressSize, 4, - "zip uncompressed size") // + 4 - swapVal32(header->uncompressSize) - // file header pointer on 26 - readVal(&val16, 2, "file name length") // + 2 - swapVal16(val16) - // file header pointer on 28 - const uint32_t fileNameLen = CAST_U32(val16); - if (fileNameLen > 1000) - { - reportAlways("Error too long file name in file %s", - archiveName.c_str()); - delete header; - delete [] buf; - fclose(arcFile); - return false; - } - readVal(&val16, 2, "extra field length") // + 2 - swapVal16(val16) - // file header pointer on 30 - const uint32_t extraFieldLen = CAST_U32(val16); - readVal(buf, fileNameLen, "file name"); - // file header pointer on 30 + fileNameLen - buf[fileNameLen] = 0; - header->fileName = std::string( - reinterpret_cast(buf)); - prepareFsPath(header->fileName); - header->dataOffset = CAST_S32(ftell(arcFile) + extraFieldLen); - fseek(arcFile, extraFieldLen + header->compressSize, SEEK_CUR); - // pointer on 30 + fileNameLen + extraFieldLen + compressSize - if (findLast(header->fileName, dirSeparator) == false) - { - headers.push_back(header); -#ifdef DEBUG_ZIP - logger->log(" file name: %s", - header->fileName.c_str()); - logger->log(" compression method: %u", - CAST_U32(method)); - logger->log(" compressed size: %u", - header->compressSize); - logger->log(" uncompressed size: %u", - header->uncompressSize); -#endif // DEBUG_ZIP - } - else - { -#ifdef DEBUG_ZIP - logger->log(" dir name: %s", - header->fileName.c_str()); -#endif // DEBUG_ZIP - dirs.push_back(header->fileName); - delete header; - } - } - else if (buf[0] == 0x50 && - buf[1] == 0x4B && - buf[2] == 0x01 && - buf[3] == 0x02) - { // central directory file header - // !!! This is quick way for read zip archives. !!! - // !!! It ignore modified files in archive. !!! - // ignoring central directory entries - break; - } - else if (buf[0] == 0x50 && - buf[1] == 0x4B && - buf[2] == 0x05 && - buf[3] == 0x06) - { // end of central directory - // !!! This is quick way for read zip archives. !!! - // !!! It ignore modified files in archive. !!! - // ignoring end of central directory - break; - } - else - { - reportAlways("Error in header signature (0x%02x%02x%02x%02x)" - " in file %s", - buf[0], - buf[1], - buf[2], - buf[3], - archiveName.c_str()); - delete [] buf; - fclose(arcFile); - return false; - } - } - delete [] buf; - fclose(arcFile); - return true; - } - - void reportZlibError(const std::string &text, - const int err) - { - reportAlways("Zlib error: '%s' in %s", - text.c_str(), - getZlibError(err).c_str()); - } - - std::string getZlibError(const int err) - { - switch (err) - { - case Z_OK: - return std::string(); - default: - return "unknown zlib error"; - } - } - - uint8_t *readCompressedFile(const ZipLocalHeader *restrict const header) - { - if (header == nullptr) - { - reportAlways("ZipReader::readCompressedFile: header is null"); - return nullptr; - } - FILE *restrict const arcFile = fopen( - header->zipEntry->root.c_str(), - "rb"); - if (arcFile == nullptr) - { - reportAlways("Can't open zip file %s", - header->zipEntry->root.c_str()); - return nullptr; - } - - fseek(arcFile, header->dataOffset, SEEK_SET); - const uint32_t compressSize = header->compressSize; - uint8_t *const buf = new uint8_t[compressSize]; - if (fread(static_cast(buf), 1, compressSize, arcFile) != - compressSize) - { - reportAlways("Read zip compressed file error from archive: %s", - header->zipEntry->root.c_str()); - fclose(arcFile); - delete [] buf; - return nullptr; - } - fclose(arcFile); - return buf; - } - - const uint8_t *readFile(const ZipLocalHeader *restrict const header) - { - if (header == nullptr) - { - reportAlways("Open zip file error. header is null."); - return nullptr; - } - uint8_t *restrict const in = readCompressedFile(header); - if (in == nullptr) - return nullptr; - if (header->compressed == false) - return in; // return as is if data not compressed - const size_t outSize = header->uncompressSize; - uint8_t *restrict const out = new uint8_t[outSize]; - if (outSize == 0) - { - delete [] in; - return out; - } - - z_stream strm; - strm.zalloc = nullptr; - strm.zfree = nullptr; - strm.opaque = nullptr; - strm.next_in = in; - strm.avail_in = header->compressSize; - strm.next_out = out; - strm.avail_out = CAST_U32(outSize); - -PRAGMACLANG6GCC(GCC diagnostic push) -PRAGMACLANG6GCC(GCC diagnostic ignored "-Wold-style-cast") - int ret = inflateInit2(&strm, -MAX_WBITS); -PRAGMACLANG6GCC(GCC diagnostic pop) - - if (ret != Z_OK) - { - reportZlibError(header->zipEntry->root, ret); - delete [] in; - delete [] out; - return nullptr; - } - ret = inflate(&strm, Z_FINISH); -// ret = inflate(&strm, Z_SYNC_FLUSH); - if (ret != Z_OK && - ret != Z_STREAM_END) - { - reportZlibError("file decompression error", - ret); - inflateEnd(&strm); - delete [] in; - delete [] out; - return nullptr; - } - inflateEnd(&strm); - delete [] in; - return out; - } -} // namespace ZipReader - -} // namespace VirtFs diff --git a/src/fs/virtfs/zipreader.h b/src/fs/virtfs/zipreader.h deleted file mode 100644 index cf7a85033..000000000 --- a/src/fs/virtfs/zipreader.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2017 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 . - */ - -#ifndef UTILS_ZIP_H -#define UTILS_ZIP_H - -#include "localconsts.h" - -#include - -namespace VirtFs -{ - -struct ZipEntry; -struct ZipLocalHeader; - -namespace ZipReader -{ - bool readArchiveInfo(ZipEntry *const entry); - std::string getZlibError(const int err); - void reportZlibError(const std::string &text, - const int err); - uint8_t *readCompressedFile(const ZipLocalHeader *restrict const header); - const uint8_t *readFile(const ZipLocalHeader *restrict const header); -} // namespace ZipReader - -} // namespace VirtFs - -#endif // UTILS_ZIP_H diff --git a/src/game.cpp b/src/game.cpp deleted file mode 100644 index e09e6c92f..000000000 --- a/src/game.cpp +++ /dev/null @@ -1,1260 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "game.h" - -#include "actormanager.h" -#include "client.h" -#include "configuration.h" -#include "effectmanager.h" -#include "eventsmanager.h" -#include "gamemodifiers.h" -#include "soundmanager.h" -#include "settings.h" - -#include "being/crazymoves.h" -#include "being/localplayer.h" -#include "being/playerinfo.h" - -#include "const/itemshortcut.h" -#include "const/spells.h" - -#include "const/gui/chat.h" - -#include "enums/being/beingdirection.h" - -#include "fs/mkdir.h" - -#include "fs/virtfs/fs.h" - -#include "gui/dialogsmanager.h" -#include "gui/gui.h" -#include "gui/popupmanager.h" -#include "gui/viewport.h" -#include "gui/windowmanager.h" -#include "gui/windowmenu.h" - -#include "gui/fonts/font.h" - -#include "gui/shortcut/dropshortcut.h" -#include "gui/shortcut/emoteshortcut.h" - -#include "gui/popups/popupmenu.h" - -#include "gui/windows/bankwindow.h" -#include "gui/windows/cutinwindow.h" -#include "gui/windows/mailwindow.h" -#include "gui/windows/chatwindow.h" -#include "gui/windows/debugwindow.h" -#include "gui/windows/didyouknowwindow.h" -#include "gui/windows/emotewindow.h" -#include "gui/windows/equipmentwindow.h" -#include "gui/windows/inventorywindow.h" -#include "gui/windows/killstats.h" -#include "gui/windows/minimap.h" -#include "gui/windows/ministatuswindow.h" -#include "gui/windows/npcdialog.h" -#include "gui/windows/outfitwindow.h" -#include "gui/windows/setupwindow.h" -#include "gui/windows/shopwindow.h" -#include "gui/windows/shortcutwindow.h" -#include "gui/windows/skilldialog.h" -#include "gui/windows/socialwindow.h" -#include "gui/windows/statuswindow.h" -#include "gui/windows/tradewindow.h" -#include "gui/windows/questswindow.h" -#include "gui/windows/whoisonline.h" - -#include "gui/widgets/tabs/chat/battletab.h" - -#include "gui/widgets/createwidget.h" -#include "gui/widgets/emoteshortcutcontainer.h" -#include "gui/widgets/itemshortcutcontainer.h" -#include "gui/widgets/spellshortcutcontainer.h" -#include "gui/widgets/virtshortcutcontainer.h" - -#include "gui/widgets/tabs/chat/gmtab.h" -#include "gui/widgets/tabs/chat/langtab.h" -#include "gui/widgets/tabs/chat/tradetab.h" - -#include "input/inputmanager.h" -#include "input/joystick.h" -#include "input/keyboardconfig.h" - -#include "input/touch/touchmanager.h" - -#include "net/generalhandler.h" -#include "net/gamehandler.h" -#include "net/net.h" -#include "net/packetcounters.h" - -#include "particle/particleengine.h" - -#include "resources/delayedmanager.h" -#include "resources/mapreader.h" -#include "resources/screenshothelper.h" - -#include "resources/db/mapdb.h" - -#include "resources/map/map.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "resources/sprite/animatedsprite.h" - -#include "utils/delete2.h" -#include "utils/foreach.h" -#include "utils/gettext.h" -#include "utils/pnglib.h" -#include "utils/sdlcheckutils.h" -#include "utils/timer.h" - -#ifdef __native_client__ -#include "utils/naclmessages.h" -#endif // __native_client__ - -#include "listeners/assertlistener.h" -#include "listeners/errorlistener.h" - -#ifdef TMWA_SUPPORT -#include "net/tmwa/guildmanager.h" -#endif // TMWA_SUPPORT - -#ifdef USE_MUMBLE -#include "mumblemanager.h" -#endif // USE_MUMBLE - -#ifdef WIN32 -#include -#undef ERROR -#endif // WIN32 - -#include "debug.h" - -QuitDialog *quitDialog = nullptr; -Window *disconnectedDialog = nullptr; - -bool mStatsReUpdated = false; -const time_t adjustDelay = 10; - -/** - * Initialize every game sub-engines in the right order - */ -static void initEngines() -{ - actorManager = new ActorManager; - effectManager = new EffectManager; -#ifdef TMWA_SUPPORT - GuildManager::init(); -#endif // TMWA_SUPPORT - - crazyMoves = new CrazyMoves; - - particleEngine = new ParticleEngine; - particleEngine->setMap(nullptr); - particleEngine->setupEngine(); - BeingInfo::init(); - - if (gameHandler != nullptr) - gameHandler->initEngines(); - - keyboard.update(); - if (joystick != nullptr) - joystick->update(); - - UpdateStatusListener::distributeEvent(); -} - -/** - * Create all the various globally accessible gui windows - */ -static void createGuiWindows() -{ - if (setupWindow != nullptr) - setupWindow->clearWindowsForReset(); - - if (emoteShortcut != nullptr) - emoteShortcut->load(); - - GameModifiers::init(); - - // Create dialogs - CREATEWIDGETV0(emoteWindow, EmoteWindow); - delete2(debugChatTab) - if (chatWindow != nullptr) - { - chatWindow->scheduleDelete(); - chatWindow = nullptr; - } - CREATEWIDGETV(chatWindow, ChatWindow, - "Chat"); - CREATEWIDGETV0(tradeWindow, TradeWindow); - CREATEWIDGETV(equipmentWindow, EquipmentWindow, - PlayerInfo::getEquipment(), - localPlayer); - CREATEWIDGETV(beingEquipmentWindow, EquipmentWindow, - nullptr, nullptr, true); - beingEquipmentWindow->setVisible(Visible_false); - CREATEWIDGETV0(statusWindow, StatusWindow); - CREATEWIDGETV0(miniStatusWindow, MiniStatusWindow); - CREATEWIDGETV(inventoryWindow, InventoryWindow, - PlayerInfo::getInventory()); - if (Net::getNetworkType() != ServerType::TMWATHENA) - { - CREATEWIDGETV(cartWindow, InventoryWindow, - PlayerInfo::getCartInventory()); - } - CREATEWIDGETV0(cutInWindow, CutInWindow); - CREATEWIDGETV0(shopWindow, ShopWindow); - CREATEWIDGETV0(skillDialog, SkillDialog); - CREATEWIDGETV0(minimap, Minimap); - if (debugWindow != nullptr) - { - debugWindow->scheduleDelete(); - debugWindow = nullptr; - } - CREATEWIDGETV(debugWindow, DebugWindow, - "Debug"); - CREATEWIDGETV(itemShortcutWindow, ShortcutWindow, - "ItemShortcut", "items.xml", 83, 460); - - for (unsigned f = 0; f < SHORTCUT_TABS - 1; f ++) - { - itemShortcutWindow->addTab(toString(f + 1), - new ItemShortcutContainer(nullptr, f)); - } - if (Net::getNetworkType() != ServerType::TMWATHENA) - { - itemShortcutWindow->addTab("A", - new ItemShortcutContainer(nullptr, SHORTCUT_TABS - 1)); - } - if (config.getBoolValue("showDidYouKnow")) - { - didYouKnowWindow->setVisible(Visible_true); - didYouKnowWindow->loadData(); - } - - CREATEWIDGETV(emoteShortcutWindow, ShortcutWindow, - "EmoteShortcut", - new EmoteShortcutContainer(nullptr), - "emotes.xml", - 130, 480); - CREATEWIDGETV0(outfitWindow, OutfitWindow); - CREATEWIDGETV(dropShortcutWindow, ShortcutWindow, - "DropShortcut", - new VirtShortcutContainer(nullptr, dropShortcut), - "drops.xml"); - CREATEWIDGETV(spellShortcutWindow, ShortcutWindow, - "SpellShortcut", - "spells.xml", - 265, 328); - for (unsigned f = 0; f < SPELL_SHORTCUT_TABS; f ++) - { - spellShortcutWindow->addTab(toString(f + 1), - new SpellShortcutContainer(nullptr, f)); - } - - CREATEWIDGETV0(bankWindow, BankWindow); - CREATEWIDGETV0(mailWindow, MailWindow); - CREATEWIDGETV0(whoIsOnline, WhoIsOnline); - CREATEWIDGETV0(killStats, KillStats); - CREATEWIDGETV0(socialWindow, SocialWindow); - CREATEWIDGETV0(questsWindow, QuestsWindow); - - // TRANSLATORS: chat tab header - localChatTab = new ChatTab(chatWindow, _("General"), - GENERAL_CHANNEL, "#General", ChatTabType::INPUT); - localChatTab->setAllowHighlight(false); - if (config.getBoolValue("showChatHistory")) - localChatTab->loadFromLogFile("#General"); - - // TRANSLATORS: chat tab header - debugChatTab = new ChatTab(chatWindow, _("Debug"), "", - "#Debug", ChatTabType::DEBUG); - debugChatTab->setAllowHighlight(false); - - if (assertListener != nullptr) - { - const StringVect &messages = assertListener->getMessages(); - FOR_EACH (StringVectCIter, it, messages) - debugChatTab->chatLog(*it, ChatMsgType::BY_SERVER); - delete2(assertListener); - } - if (config.getBoolValue("enableTradeTab")) - chatWindow->addSpecialChannelTab(TRADE_CHANNEL, false); - else - tradeChatTab = nullptr; - - if (config.getBoolValue("enableBattleTab")) - { - battleChatTab = new BattleTab(chatWindow); - battleChatTab->setAllowHighlight(false); - } - else - { - battleChatTab = nullptr; - } - - chatWindow->showGMTab(); - if (!isSafeMode) - chatWindow->loadState(); - - if (setupWindow != nullptr) - setupWindow->externalUpdate(); - - if (localPlayer != nullptr) - localPlayer->updateStatus(); - - if (generalHandler != nullptr) - generalHandler->gameStarted(); -} - -/** - * Destroy all the globally accessible gui windows - */ -static void destroyGuiWindows() -{ - if (generalHandler != nullptr) - generalHandler->gameEnded(); - - if (whoIsOnline != nullptr) - whoIsOnline->setAllowUpdate(false); - -#ifdef TMWA_SUPPORT - GuildManager::clear(); -#endif // TMWA_SUPPORT - - delete2(windowMenu); - delete2(localChatTab) // Need to do this first, so it can remove itself - delete2(debugChatTab) - delete2(tradeChatTab) - delete2(battleChatTab) - delete2(langChatTab) - delete2(gmChatTab); -#ifdef TMWA_SUPPORT - if (guildManager != nullptr && GuildManager::getEnableGuildBot()) - guildManager->reload(); -#endif // TMWA_SUPPORT - - logger->log("start deleting"); - delete2(emoteWindow); - delete2(chatWindow) - logger->log("end deleting"); - delete2(statusWindow) - delete2(miniStatusWindow) - delete2(inventoryWindow) - delete2(cartWindow) - delete2(shopWindow) - delete2(skillDialog) - delete2(minimap) - delete2(equipmentWindow) - delete2(beingEquipmentWindow) - delete2(tradeWindow) - delete2(debugWindow) - delete2(itemShortcutWindow) - delete2(emoteShortcutWindow) - delete2(outfitWindow) - delete2(socialWindow) - delete2(dropShortcutWindow); - delete2(spellShortcutWindow); - delete2(bankWindow); - delete2(cutInWindow); - delete2(mailWindow); - delete2(questsWindow); - delete2(whoIsOnline); - delete2(killStats); -} - -Game *Game::mInstance = nullptr; - -Game::Game() : - mCurrentMap(nullptr), - mMapName(""), - mValidSpeed(true), - mNextAdjustTime(cur_time + adjustDelay), - mAdjustLevel(0), - mAdjustPerfomance(config.getBoolValue("adjustPerfomance")), - mLowerCounter(0), - mPing(0), - mTime(cur_time + 1), - mTime2(cur_time + 10) -{ - touchManager.setInGame(true); - -// assert(!mInstance); - if (mInstance != nullptr) - logger->log("error: double game creation"); - mInstance = this; - - config.incValue("gamecount"); - - disconnectedDialog = nullptr; - - // Create the viewport - viewport = new Viewport; - viewport->setSize(mainGraphics->mWidth, mainGraphics->mHeight); - PlayerInfo::clear(); - - emptyBeingSlot = new BeingSlot; - - BasicContainer2 *const top = static_cast(gui->getTop()); - if (top != nullptr) - top->add(viewport); - viewport->requestMoveToBottom(); - - AnimatedSprite::setEnableCache( - mainGraphics->getOpenGL() != RENDER_SOFTWARE && - config.getBoolValue("enableDelayedAnimations")); - - CompoundSprite::setEnableDelay( - config.getBoolValue("enableCompoundSpriteDelay")); - - createGuiWindows(); - windowMenu = new WindowMenu(nullptr); - - if (windowContainer != nullptr) - windowContainer->add(windowMenu); - -#ifdef USE_OPENGL - MapReader::loadEmptyAtlas(); -#endif // USE_OPENGL - - initEngines(); - - chatWindow->postConnection(); - mailWindow->postConnection(); - - // Initialize beings - if (actorManager != nullptr) - actorManager->setPlayer(localPlayer); - - gameHandler->ping(tick_time); - - if (setupWindow != nullptr) - setupWindow->setInGame(true); - clearKeysArray(); - -#ifdef TMWA_SUPPORT - if (guildManager != nullptr && GuildManager::getEnableGuildBot()) - guildManager->requestGuildInfo(); -#endif // TMWA_SUPPORT - - settings.disableLoggingInGame = config.getBoolValue( - "disableLoggingInGame"); -} - -Game::~Game() -{ -#ifdef USE_OPENGL - MapReader::unloadEmptyAtlas(); -#endif // USE_OPENGL - - settings.disableLoggingInGame = false; - touchManager.setInGame(false); - config.write(); - serverConfig.write(); - resetAdjustLevel(); - destroyGuiWindows(); - - AnimatedSprite::setEnableCache(false); - - delete2(actorManager) - if (client->getState() != State::CHANGE_MAP) - delete2(localPlayer) - if (effectManager != nullptr) - effectManager->clear(); - delete2(effectManager) - delete2(particleEngine) - delete2(viewport) - delete2(mCurrentMap) -#ifdef TMWA_SUPPORT - delete2(guildManager) -#endif // TMWA_SUPPORT -#ifdef USE_MUMBLE - delete2(mumbleManager) -#endif // USE_MUMBLE - - delete2(crazyMoves); - delete2(emptyBeingSlot); - - Being::clearCache(); - mInstance = nullptr; - PlayerInfo::gameDestroyed(); -} - -void Game::addWatermark() -{ - if ((boldFont == nullptr) || !config.getBoolValue("addwatermark")) - return; - - const Color &color1 = theme->getColor(ThemeColorId::TEXT, 255); - const Color &color2 = theme->getColor(ThemeColorId::TEXT_OUTLINE, 255); - - boldFont->drawString(mainGraphics, - color1, - color2, - settings.serverName, - 100, 50); -} - -bool Game::createScreenshot(const std::string &prefix) -{ - if ((mainGraphics == nullptr) || (screenshortHelper == nullptr)) - return false; - - SDL_Surface *screenshot = nullptr; - - if (!config.getBoolValue("showip") && (gui != nullptr)) - { - mainGraphics->setSecure(true); - screenshortHelper->prepare(); - gui->draw(); - addWatermark(); - screenshot = screenshortHelper->getScreenshot(); - mainGraphics->setSecure(false); - } - else - { - addWatermark(); - screenshot = screenshortHelper->getScreenshot(); - } - - if (screenshot == nullptr) - return false; - - return saveScreenshot(screenshot, prefix); -} - -bool Game::saveScreenshot(SDL_Surface *const screenshot, - const std::string &prefix) -{ - std::string screenshotDirectory = settings.screenshotDir; - if (mkdir_r(screenshotDirectory.c_str()) != 0) - { - logger->log("Directory %s doesn't exist and can't be created! " - "Setting screenshot directory to home.", - screenshotDirectory.c_str()); - screenshotDirectory = std::string(VirtFs::getUserDir()); - } - - // Search for an unused screenshot name - std::stringstream filename; - std::fstream testExists; - - time_t rawtime; - char buffer [100]; - time(&rawtime); - struct tm *const timeinfo = localtime(&rawtime); - strftime(buffer, 99, "%Y-%m-%d_%H-%M-%S", timeinfo); - - const std::string serverName = settings.serverName; - std::string screenShortStr; - if (prefix.empty()) - { - if (serverName.empty()) - { - screenShortStr = strprintf("%s_Screenshot_%s_", - branding.getValue("appName", "ManaPlus").c_str(), - buffer); - } - else - { - screenShortStr = strprintf("%s_Screenshot_%s_%s_", - branding.getValue("appName", "ManaPlus").c_str(), - serverName.c_str(), buffer); - } - - bool found = false; - static unsigned int screenshotCount = 0; - do - { - screenshotCount++; - filename.str(""); - filename << screenshotDirectory << "/"; - filename << screenShortStr << screenshotCount << ".png"; - testExists.open(filename.str().c_str(), std::ios::in); - found = !testExists.is_open(); - testExists.close(); - } - while (!found); - } - else - { - screenShortStr = prefix; - filename.str(""); - filename << screenshotDirectory << "/"; - filename << screenShortStr; - } - - const std::string fileNameStr = filename.str(); - const bool success = PngLib::writePNG(screenshot, fileNameStr); -#ifdef __native_client__ - std::string nacScreenshotlDir = fileNameStr; - cutFirst(nacScreenshotlDir, "/persistent"); - naclPostMessage("copy-from-persistent", nacScreenshotlDir); - logger->log("nacl screenshot path: " + nacScreenshotlDir); -#endif // __native_client__ - - if (success) - { - if (localChatTab != nullptr) - { - // TRANSLATORS: save file message - std::string str = strprintf(_("Screenshot saved as %s"), - fileNameStr.c_str()); - localChatTab->chatLog(str, ChatMsgType::BY_SERVER); - } - } - else - { - if (localChatTab != nullptr) - { - // TRANSLATORS: save file message - localChatTab->chatLog(_("Saving screenshot failed!"), - ChatMsgType::BY_SERVER); - } - logger->log1("Error: could not save screenshot."); - } - - MSDL_FreeSurface(screenshot); - return success; -} - -void Game::logic() -{ - BLOCK_START("Game::logic") - handleInput(); - - // Handle all necessary game logic - if (actorManager != nullptr) - actorManager->logic(); - if (particleEngine != nullptr) - particleEngine->update(); - if (mCurrentMap != nullptr) - mCurrentMap->update(); - - BLOCK_END("Game::logic") -} - -void Game::slowLogic() -{ - BLOCK_START("Game::slowLogic") - if (localPlayer != nullptr) - localPlayer->slowLogic(); - const time_t time = cur_time; - if (mTime != time) - { - if (valTest(Updated)) - mValidSpeed = false; - - mTime = time + 1; - if (debugWindow != nullptr) - debugWindow->slowLogic(); - if (killStats != nullptr) - killStats->update(); - if (socialWindow != nullptr) - socialWindow->slowLogic(); - if (whoIsOnline != nullptr) - whoIsOnline->slowLogic(); - Being::reReadConfig(); - if (killStats != nullptr) - cilk_spawn killStats->recalcStats(); - - if (time > mTime2 || mTime2 - time > 10) - { - mTime2 = time + 10; - config.writeUpdated(); - serverConfig.writeUpdated(); - } - if (effectManager != nullptr) - effectManager->logic(); - } - - if (mainGraphics->getOpenGL() != RENDER_SOFTWARE) - DelayedManager::delayedLoad(); - -#ifdef TMWA_SUPPORT - if (shopWindow != nullptr) - cilk_spawn shopWindow->updateTimes(); - if (guildManager != nullptr) - guildManager->slowLogic(); -#endif // TMWA_SUPPORT - - if (skillDialog != nullptr) - cilk_spawn skillDialog->slowLogic(); - - cilk_spawn PacketCounters::update(); - - // Handle network stuff - if (!gameHandler->isConnected()) - { - if (client->getState() == State::CHANGE_MAP) - return; // Not a problem here - - if (client->getState() != State::ERROR) - { - if (disconnectedDialog == nullptr) - { - // TRANSLATORS: error message text - errorMessage = _("The connection to the server was lost."); - disconnectedDialog = DialogsManager::openErrorDialog( - // TRANSLATORS: error message header - _("Network Error"), - errorMessage, - Modal_false); - disconnectedDialog->addActionListener(&errorListener); - disconnectedDialog->requestMoveToTop(); - } - } - - if ((viewport != nullptr) && !errorMessage.empty()) - { - const Map *const map = viewport->getMap(); - if (map != nullptr) - map->saveExtraLayer(); - } - DialogsManager::closeDialogs(); - WindowManager::setFramerate(config.getIntValue("fpslimit")); - mNextAdjustTime = cur_time + adjustDelay; - if (client->getState() != State::ERROR) - errorMessage.clear(); - } - else - { - if (gameHandler->mustPing() - && get_elapsed_time1(mPing) > 3000) - { - mPing = tick_time; - gameHandler->ping(tick_time); - } - - if (mAdjustPerfomance) - adjustPerfomance(); - if (disconnectedDialog != nullptr) - { - disconnectedDialog->scheduleDelete(); - disconnectedDialog = nullptr; - } - } - BLOCK_END("Game::slowLogic") -} - -void Game::adjustPerfomance() -{ - FUNC_BLOCK("Game::adjustPerfomance", 1) - const time_t time = cur_time; - if (mNextAdjustTime <= adjustDelay) - { - mNextAdjustTime = time + adjustDelay; - } - else if (mNextAdjustTime < time) - { - mNextAdjustTime = time + adjustDelay; - - if (mAdjustLevel > 3 || - localPlayer == nullptr || - localPlayer->getHalfAway() || - settings.awayMode) - { - return; - } - - int maxFps = WindowManager::getFramerate(); - if (maxFps != config.getIntValue("fpslimit")) - return; - - if (maxFps == 0) - maxFps = 30; - else if (maxFps < 10) - return; - - if (fps < maxFps - 10) - { - if (mLowerCounter < 2) - { - mLowerCounter ++; - mNextAdjustTime = cur_time + 1; - return; - } - mLowerCounter = 0; - mAdjustLevel ++; - switch (mAdjustLevel) - { - case 1: - { - if (config.getBoolValue("beingopacity")) - { - config.setValue("beingopacity", false); - config.setSilent("beingopacity", true); - if (localChatTab != nullptr) - { - localChatTab->chatLog("Auto disable Show " - "beings transparency", ChatMsgType::BY_SERVER); - } - } - else - { - mNextAdjustTime = time + 1; - mLowerCounter = 2; - } - break; - } - case 2: - if (ParticleEngine::emitterSkip < 4) - { - ParticleEngine::emitterSkip = 4; - if (localChatTab != nullptr) - { - localChatTab->chatLog("Auto lower Particle " - "effects", ChatMsgType::BY_SERVER); - } - } - else - { - mNextAdjustTime = time + 1; - mLowerCounter = 2; - } - break; - case 3: - if (!config.getBoolValue("alphaCache")) - { - config.setValue("alphaCache", true); - config.setSilent("alphaCache", false); - if (localChatTab != nullptr) - { - localChatTab->chatLog("Auto enable opacity cache", - ChatMsgType::BY_SERVER); - } - } - break; - default: - break; - } - } - } -} - -void Game::resetAdjustLevel() -{ - if (!mAdjustPerfomance) - return; - - mNextAdjustTime = cur_time + adjustDelay; - switch (mAdjustLevel) - { - case 1: - config.setValue("beingopacity", - config.getBoolValue("beingopacity")); - break; - case 2: - config.setValue("beingopacity", - config.getBoolValue("beingopacity")); - ParticleEngine::emitterSkip = config.getIntValue( - "particleEmitterSkip") + 1; - break; - default: - case 3: - config.setValue("beingopacity", - config.getBoolValue("beingopacity")); - ParticleEngine::emitterSkip = config.getIntValue( - "particleEmitterSkip") + 1; - config.setValue("alphaCache", - config.getBoolValue("alphaCache")); - break; - } - mAdjustLevel = 0; -} - -void Game::handleMove() -{ - BLOCK_START("Game::handleMove") - if (localPlayer == nullptr) - { - BLOCK_END("Game::handleMove") - return; - } - - // Moving player around - if ((chatWindow != nullptr) && - (quitDialog == nullptr) && - localPlayer->canMove() && - !chatWindow->isInputFocused() && - !InventoryWindow::isAnyInputFocused() && - !popupMenu->isPopupVisible()) - { - NpcDialog *const dialog = NpcDialog::getActive(); - if (dialog != nullptr) - { - BLOCK_END("Game::handleMove") - return; - } - - // Ignore input if either "ignore" key is pressed - // Stops the character moving about if the user's window manager - // uses "ignore+arrow key" to switch virtual desktops. - if (inputManager.isActionActive(InputAction::IGNORE_INPUT_1) || - inputManager.isActionActive(InputAction::IGNORE_INPUT_2)) - { - BLOCK_END("Game::handleMove") - return; - } - - unsigned char direction = 0; - - // Translate pressed keys to movement and direction - if (inputManager.isActionActive(InputAction::MOVE_UP) || - ((joystick != nullptr) && joystick->isUp())) - { - direction |= BeingDirection::UP; - setValidSpeed(); - localPlayer->cancelFollow(); - } - else if (inputManager.isActionActive(InputAction::MOVE_DOWN) || - ((joystick != nullptr) && joystick->isDown())) - { - direction |= BeingDirection::DOWN; - setValidSpeed(); - localPlayer->cancelFollow(); - } - - if (inputManager.isActionActive(InputAction::MOVE_LEFT) || - ((joystick != nullptr) && joystick->isLeft())) - { - direction |= BeingDirection::LEFT; - setValidSpeed(); - localPlayer->cancelFollow(); - } - else if (inputManager.isActionActive(InputAction::MOVE_RIGHT) || - ((joystick != nullptr) && joystick->isRight())) - { - direction |= BeingDirection::RIGHT; - setValidSpeed(); - localPlayer->cancelFollow(); - } - else if (inputManager.isActionActive(InputAction::MOVE_FORWARD)) - { - direction = localPlayer->getDirection(); - setValidSpeed(); - localPlayer->cancelFollow(); - } - - if ((!inputManager.isActionActive(InputAction::EMOTE) - && !inputManager.isActionActive(InputAction::PET_EMOTE) - && !inputManager.isActionActive(InputAction::HOMUN_EMOTE) - && !inputManager.isActionActive(InputAction::STOP_ATTACK)) - || direction == 0) - { - moveInDirection(direction); - } - } - BLOCK_END("Game::handleMove") -} - -void Game::moveInDirection(const unsigned char direction) -{ - if (viewport == nullptr) - return; - - if (settings.cameraMode == 0u) - { - if (localPlayer != nullptr) - localPlayer->specialMove(direction); - } - else - { - int dx = 0; - int dy = 0; - if ((direction & BeingDirection::LEFT) != 0) - dx = -5; - else if ((direction & BeingDirection::RIGHT) != 0) - dx = 5; - - if ((direction & BeingDirection::UP) != 0) - dy = -5; - else if ((direction & BeingDirection::DOWN) != 0) - dy = 5; - viewport->moveCamera(dx, dy); - } -} - -void Game::updateFrameRate(int fpsLimit) -{ - if (fpsLimit == 0) - { - if (settings.awayMode) - { - if (settings.inputFocused != KeyboardFocus::Unfocused || - settings.mouseFocused) - { - fpsLimit = config.getIntValue("fpslimit"); - } - else - { - fpsLimit = config.getIntValue("altfpslimit"); - } - } - else - { - fpsLimit = config.getIntValue("fpslimit"); - } - } - WindowManager::setFramerate(fpsLimit); - mNextAdjustTime = cur_time + adjustDelay; -} - -/** - * The huge input handling method. - */ -void Game::handleInput() -{ - BLOCK_START("Game::handleInput 1") - if (joystick != nullptr) - joystick->logic(); - - eventsManager.handleGameEvents(); - - // If the user is configuring the keys then don't respond. - if (!keyboard.isEnabled() || settings.awayMode) - { - BLOCK_END("Game::handleInput 1") - return; - } - - // If pressed outfits keys, stop processing keys. - if (inputManager.isActionActive(InputAction::WEAR_OUTFIT) - || inputManager.isActionActive(InputAction::COPY_OUTFIT) - || ((setupWindow != nullptr) && setupWindow->isWindowVisible())) - { - BLOCK_END("Game::handleInput 1") - return; - } - - handleMove(); - InputManager::handleRepeat(); - BLOCK_END("Game::handleInput 1") -} - -/** - * Changes the currently active map. Should only be called while the game is - * running. - */ -void Game::changeMap(const std::string &mapPath) -{ - BLOCK_START("Game::changeMap") - - resetAdjustLevel(); - ResourceManager::cleanProtected(); - - PopupManager::clearPopup(); - PopupManager::closePopupMenu(); - - // Clean up floor items, beings and particles - if (actorManager != nullptr) - actorManager->clear(); - - // Close the popup menu on map change so that invalid options can't be - // executed. - if (viewport != nullptr) - viewport->cleanHoverItems(); - - // Unset the map of the player so that its particles are cleared before - // being deleted in the next step - if (localPlayer != nullptr) - localPlayer->setMap(nullptr); - - if (particleEngine != nullptr) - particleEngine->clear(); - - mMapName = mapPath; - - std::string fullMap = pathJoin(paths.getValue("maps", "maps/"), - mMapName).append(".tmx"); - std::string realFullMap = pathJoin(paths.getValue("maps", "maps/"), - MapDB::getMapName(mMapName)).append(".tmx"); - - if (!VirtFs::exists(realFullMap)) - realFullMap.append(".gz"); - - // Attempt to load the new map - Map *const newMap = MapReader::readMap(fullMap, realFullMap); - - if (mCurrentMap != nullptr) - mCurrentMap->saveExtraLayer(); - - if (newMap != nullptr) - newMap->addExtraLayer(); - - if (socialWindow != nullptr) - socialWindow->setMap(newMap); - - // Notify the minimap and actorManager about the map change - if (minimap != nullptr) - minimap->setMap(newMap); - if (actorManager != nullptr) - actorManager->setMap(newMap); - if (particleEngine != nullptr) - particleEngine->setMap(newMap); - if (viewport != nullptr) - viewport->setMap(newMap); - - // Initialize map-based particle effects - if (newMap != nullptr) - newMap->initializeParticleEffects(); - - // Start playing new music file when necessary - const std::string oldMusic = mCurrentMap != nullptr - ? mCurrentMap->getMusicFile() : ""; - const std::string newMusic = newMap != nullptr ? - newMap->getMusicFile() : ""; - if (newMusic != oldMusic) - { - if (newMusic.empty()) - soundManager.fadeOutMusic(); - else - soundManager.fadeOutAndPlayMusic(newMusic); - } - - if (mCurrentMap != nullptr) - mCurrentMap->saveExtraLayer(); - - delete mCurrentMap; - mCurrentMap = newMap; - - if (questsWindow != nullptr) - questsWindow->setMap(mCurrentMap); - -#ifdef USE_MUMBLE - if (mumbleManager) - mumbleManager->setMap(mapPath); -#endif // USE_MUMBLE - - if (localPlayer != nullptr) - localPlayer->recreateItemParticles(); - - gameHandler->mapLoadedEvent(); - BLOCK_END("Game::changeMap") -} - -void Game::updateHistory(const SDL_Event &event) -{ - if ((localPlayer == nullptr) || (settings.attackType == 0u)) - return; - - if (CAST_S32(event.key.keysym.sym) != -1) - { - bool old = false; - - const InputActionT key = KeyboardConfig::getKeyIndex(event); - const time_t time = cur_time; - int idx = -1; - for (int f = 0; f < MAX_LASTKEYS; f ++) - { - LastKey &lastKey = mLastKeys[f]; - if (lastKey.key == key) - { - idx = f; - old = true; - break; - } - else if (idx >= 0 && lastKey.time < mLastKeys[idx].time) - { - idx = f; - } - } - if (idx < 0) - { - idx = 0; - for (int f = 0; f < MAX_LASTKEYS; f ++) - { - LastKey &lastKey = mLastKeys[f]; - if (lastKey.key == InputAction::NO_VALUE || - lastKey.time < mLastKeys[idx].time) - { - idx = f; - } - } - } - - if (idx < 0) - idx = 0; - - LastKey &keyIdx = mLastKeys[idx]; - if (!old) - { - keyIdx.time = time; - keyIdx.key = key; - keyIdx.cnt = 0; - } - else - { - keyIdx.cnt++; - } - } -} - -void Game::checkKeys() -{ - const int timeRange = 120; - const int cntInTime = 130; - - if ((localPlayer == nullptr) || (settings.attackType == 0u)) - return; - - const time_t time = cur_time; - for (int f = 0; f < MAX_LASTKEYS; f ++) - { - LastKey &lastKey = mLastKeys[f]; - if (lastKey.key != InputAction::NO_VALUE) - { - if (lastKey.time + timeRange < time) - { - if (lastKey.cnt > cntInTime) - mValidSpeed = false; - lastKey.key = InputAction::NO_VALUE; - } - } - } -} - -void Game::setValidSpeed() -{ - clearKeysArray(); - mValidSpeed = true; -} - -void Game::clearKeysArray() -{ - for (int f = 0; f < MAX_LASTKEYS; f ++) - { - mLastKeys[f].time = 0; - mLastKeys[f].key = InputAction::NO_VALUE; - mLastKeys[f].cnt = 0; - } -} - -void Game::videoResized(const int width, const int height) -{ - if (viewport != nullptr) - viewport->setSize(width, height); - if (windowMenu != nullptr) - windowMenu->setPosition(width - windowMenu->getWidth(), 0); -} diff --git a/src/game.h b/src/game.h deleted file mode 100644 index 53b417a5d..000000000 --- a/src/game.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GAME_H -#define GAME_H - -#include "enums/input/inputaction.h" - -#include - -#include "localconsts.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -static const int MAX_LASTKEYS = 10; - -extern volatile time_t cur_time; - -class Map; - -struct LastKey final -{ - A_DELETE_COPY(LastKey) - - LastKey() : - time(0), - key(InputAction::NO_VALUE), - cnt(0) - { } - - time_t time; - InputActionT key; - int cnt; -}; - -/** - * The main class responsible for running the game. The game starts after you - * have selected your character. - */ -class Game final -{ - public: - /** - * Constructs the game, creating all the managers, handlers, engines - * and GUI windows that make up the game. - */ - Game(); - - A_DELETE_COPY(Game) - - /** - * Destructor, cleans up the game. - */ - ~Game(); - - /** - * Provides access to the game instance. - */ - static Game *instance() A_WARN_UNUSED - { return mInstance; } - - constexpr2 static void clearInstance() noexcept2 - { mInstance = nullptr; } - - /** - * This method takes the game a small step further. It is called 100 - * times per second. - */ - void logic(); - - void slowLogic(); - - void handleInput(); - - void handleMove(); - - void changeMap(const std::string &mapName); - - void updateFrameRate(int fpsLimit); - - /** - * Returns the currently active map. - */ - Map *getCurrentMap() const noexcept2 A_WARN_UNUSED - { return mCurrentMap; } - - const std::string &getCurrentMapName() const noexcept2 A_WARN_UNUSED - { return mMapName; } - - void setValidSpeed(); - - void adjustPerfomance(); - - void resetAdjustLevel(); - - void setAdjustLevel(const int n) - { mAdjustLevel = n; } - - static void videoResized(const int width, const int height); - - bool getValidSpeed() const noexcept2 A_WARN_UNUSED - { return mValidSpeed; } - - static void moveInDirection(const unsigned char direction); - - static bool createScreenshot(const std::string &prefix); - - static void addWatermark(); - - static bool saveScreenshot(SDL_Surface *const screenshot, - const std::string &prefix); - - void updateHistory(const SDL_Event &event); - - void checkKeys(); - - private: - void clearKeysArray(); - - Map *mCurrentMap; - std::string mMapName; - bool mValidSpeed; - LastKey mLastKeys[MAX_LASTKEYS]; - time_t mNextAdjustTime; - int mAdjustLevel; - bool mAdjustPerfomance; - int mLowerCounter; - int mPing; - time_t mTime; - time_t mTime2; - - static Game *mInstance; -}; - -extern bool mStatsReUpdated; - -#endif // GAME_H diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp deleted file mode 100644 index bed509dae..000000000 --- a/src/gamemodifiers.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "gamemodifiers.h" - -#include "configuration.h" -#include "game.h" -#include "settings.h" -#include "soundmanager.h" - -#include "being/localplayer.h" - -#include "gui/viewport.h" - -#include "gui/windows/chatwindow.h" -#include "gui/windows/okdialog.h" -#include "gui/windows/outfitwindow.h" - -#include "gui/widgets/createwidget.h" - -#include "gui/widgets/tabs/chat/chattab.h" - -#include "listeners/gamemodifierlistener.h" - -#include "resources/map/map.h" - -#include "listeners/awaylistener.h" -#include "listeners/updatestatuslistener.h" - -#include "utils/gettext.h" - -#include "debug.h" - -#define addModifier(name1, name2, sz, ...) \ - const unsigned GameModifiers::m##name1##Size = sz; \ - const char *const GameModifiers::m##name1##Strings[] = \ - __VA_ARGS__; \ - std::string GameModifiers::get##name1##String() \ - { \ - return gettext(getVarItem(&m##name1##Strings[0], \ - CAST_U32(settings.name2), m##name1##Size)); \ - } - -#define addModifier2(name1, name2, str, sz, ...) \ - const unsigned GameModifiers::m##name1##Size = sz; \ - const char *const GameModifiers::m##name1##Strings[] = \ - __VA_ARGS__; \ - void GameModifiers::change##name1(const bool forward) \ - { \ - changeMode(&settings.name2, m##name1##Size, str, \ - &GameModifiers::get##name1##String, 0, true, forward); \ - } \ - std::string GameModifiers::get##name1##String() \ - { \ - return gettext(getVarItem(&m##name1##Strings[0], \ - settings.name2, m##name1##Size)); \ - } - -#define changeMethod(name1, name2, str) \ - void GameModifiers::change##name1(const bool forward) \ - { \ - changeMode(&settings.name2, m##name1##Size, str, \ - &GameModifiers::get##name1##String, 0, true, forward); \ - } - -void GameModifiers::init() -{ - settings.crazyMoveType = config.getIntValue("crazyMoveType"); - settings.moveToTargetType = config.getIntValue("moveToTargetType"); - settings.followMode = config.getIntValue("followMode"); - settings.attackWeaponType = config.getIntValue("attackWeaponType"); - settings.attackType = config.getIntValue("attackType"); - settings.targetingType = config.getIntValue("targetingType"); - settings.quickDropCounter = config.getIntValue("quickDropCounter"); - settings.pickUpType = config.getIntValue("pickUpType"); - settings.magicAttackType = config.getIntValue("magicAttackType"); - settings.pvpAttackType = config.getIntValue("pvpAttackType"); - settings.imitationMode = config.getIntValue("imitationMode"); - settings.disableGameModifiers = config.getBoolValue( - "disableGameModifiers"); - settings.awayMode = false; - settings.mapDrawType = MapType::NORMAL; -// UpdateStatusListener::distributeEvent(); -} - -void GameModifiers::changeMode(unsigned *restrict const var, - const unsigned limit, - const char *restrict const conf, - std::string (*const func)(), - const unsigned def, - const bool save, - const bool forward) -{ - if (var == nullptr) - return; - - if (forward) - { - (*var) ++; - if (*var >= limit) - *var = def; - } - else - { - if (*var == 0u) - *var = limit - 1; - else - (*var) --; - } - - if (save) - config.setValue(conf, *var); - UpdateStatusListener::distributeEvent(); - GameModifierListener::distributeEvent(); - const std::string str = (*func)(); - if (str.size() > 4) - debugMsg(str.substr(4)); -} - -const char *GameModifiers::getVarItem(const char *const *const arr, - const unsigned index, - const unsigned sz) -{ - if (index < sz) - return arr[index]; - return arr[sz]; -} - -addModifier(MoveType, moveType, 5, -{ - // TRANSLATORS: move type in status bar - N_("(D) default moves"), - // TRANSLATORS: move type in status bar - N_("(I) invert moves"), - // TRANSLATORS: move type in status bar - N_("(c) moves with some crazy moves"), - // TRANSLATORS: move type in status bar - N_("(C) moves with crazy moves"), - // TRANSLATORS: move type in status bar - N_("(d) double normal + crazy"), - // TRANSLATORS: move type in status bar - N_("(?) unknown move") -}) - -void GameModifiers::changeMoveType(const bool forward) -{ - localPlayer->setMoveState(0); - changeMode(&settings.moveType, mMoveTypeSize, "invertMoveDirection", - &GameModifiers::getMoveTypeString, 0, false, forward); -} - -const unsigned GameModifiers::mCrazyMoveTypeSize = 11; - -void GameModifiers::changeCrazyMoveType(const bool forward) -{ - settings.crazyMoveState = 0U; - changeMode(&settings.crazyMoveType, mCrazyMoveTypeSize, "crazyMoveType", - &GameModifiers::getCrazyMoveTypeString, 1, true, forward); -} - -std::string GameModifiers::getCrazyMoveTypeString() -{ - const unsigned int crazyMoveType = settings.crazyMoveType; - if (crazyMoveType < mCrazyMoveTypeSize - 1) - { - // TRANSLATORS: crazy move type in status bar - return strprintf(_("(%u) crazy move number %u"), - crazyMoveType, crazyMoveType); - } - else if (crazyMoveType == mCrazyMoveTypeSize - 1) - { - // TRANSLATORS: crazy move type in status bar - return _("(a) custom crazy move"); - } - else - { - // TRANSLATORS: crazy move type in status bar - return _("(?) crazy move"); - } -} - -addModifier2(MoveToTargetType, moveToTargetType, "moveToTargetType", 13, -{ - // TRANSLATORS: move to target type in status bar - N_("(0) default moves to target"), - // TRANSLATORS: move to target type in status bar - N_("(1) moves to target in distance 1"), - // TRANSLATORS: move to target type in status bar - N_("(2) moves to target in distance 2"), - // TRANSLATORS: move to target type in status bar - N_("(3) moves to target in distance 3"), - // TRANSLATORS: move to target type in status bar - N_("(4) moves to target in distance 4"), - // TRANSLATORS: move to target type in status bar - N_("(5) moves to target in distance 5"), - // TRANSLATORS: move to target type in status bar - N_("(6) moves to target in distance 6"), - // TRANSLATORS: move to target type in status bar - N_("(7) moves to target in distance 7"), - // TRANSLATORS: move to target type in status bar - N_("(8) moves to target in distance 8"), - // TRANSLATORS: move to target type in status bar - N_("(9) moves to target in distance 9"), - // TRANSLATORS: move to target type in status bar - N_("(A) moves to target in attack range"), - // TRANSLATORS: move to target type in status bar - N_("(a) archer attack range"), - // TRANSLATORS: move to target type in status bar - N_("(B) moves to target in attack range - 1"), - // TRANSLATORS: move to target type in status bar - N_("(?) move to target") -}) - -addModifier2(FollowMode, followMode, "followMode", 4, -{ - // TRANSLATORS: folow mode in status bar - N_("(D) default follow"), - // TRANSLATORS: folow mode in status bar - N_("(R) relative follow"), - // TRANSLATORS: folow mode in status bar - N_("(M) mirror follow"), - // TRANSLATORS: folow mode in status bar - N_("(P) pet follow"), - // TRANSLATORS: folow mode in status bar - N_("(?) unknown follow") -}) - -addModifier2(AttackWeaponType, attackWeaponType, "attackWeaponType", 4, -{ - // TRANSLATORS: switch attack type in status bar - N_("(?) attack"), - // TRANSLATORS: switch attack type in status bar - N_("(D) default attack"), - // TRANSLATORS: switch attack type in status bar - N_("(s) switch attack without shield"), - // TRANSLATORS: switch attack type in status bar - N_("(S) switch attack with shield"), - // TRANSLATORS: switch attack type in status bar - N_("(?) attack") -}) - -addModifier2(AttackType, attackType, "attackType", 4, -{ - // TRANSLATORS: attack type in status bar - N_("(D) default attack"), - // TRANSLATORS: attack type in status bar - N_("(G) go and attack"), - // TRANSLATORS: attack type in status bar - N_("(A) go, attack, pickup"), - // TRANSLATORS: attack type in status bar - N_("(d) without auto attack"), - // TRANSLATORS: attack type in status bar - N_("(?) attack") -}) - -addModifier2(TargetingType, targetingType, "targetingType", 2, -{ - // TRANSLATORS: targeting type in status bar - N_("(D) don't switch target"), - // TRANSLATORS: targeting type in status bar - N_("(C) always attack closest"), - // TRANSLATORS: targeting type in status bar - N_("(?) targeting") -}) - -const unsigned GameModifiers::mQuickDropCounterSize = 31; - -changeMethod(QuickDropCounter, quickDropCounter, "quickDropCounter") - -std::string GameModifiers::getQuickDropCounterString() -{ - const unsigned int cnt = settings.quickDropCounter; - if (cnt > 9) - { - return strprintf("(%c) drop counter %u", CAST_S8( - 'a' + cnt - 10), cnt); - } - return strprintf("(%u) drop counter %u", cnt, cnt); -} - -void GameModifiers::setQuickDropCounter(const int n) -{ - if (n < 1 || n >= CAST_S32(mQuickDropCounterSize)) - return; - settings.quickDropCounter = n; - config.setValue("quickDropCounter", n); - UpdateStatusListener::distributeEvent(); - GameModifierListener::distributeEvent(); -} - -addModifier2(PickUpType, pickUpType, "pickUpType", 7, -{ - // TRANSLATORS: pickup size in status bar - N_("(S) small pick up 1x1 cells"), - // TRANSLATORS: pickup size in status bar - N_("(D) default pick up 2x1 cells"), - // TRANSLATORS: pickup size in status bar - N_("(F) forward pick up 2x3 cells"), - // TRANSLATORS: pickup size in status bar - N_("(3) pick up 3x3 cells"), - // TRANSLATORS: pickup size in status bar - N_("(g) go and pick up in distance 4"), - // TRANSLATORS: pickup size in status bar - N_("(G) go and pick up in distance 8"), - // TRANSLATORS: pickup size in status bar - N_("(A) go and pick up in max distance"), - // TRANSLATORS: pickup size in status bar - N_("(?) pick up") -}) - -addModifier2(MagicAttackType, magicAttackType, "magicAttackType", 5, -{ - // TRANSLATORS: magic attack in status bar - N_("(f) use #flar for magic attack"), - // TRANSLATORS: magic attack in status bar - N_("(c) use #chiza for magic attack"), - // TRANSLATORS: magic attack in status bar - N_("(I) use #ingrav for magic attack"), - // TRANSLATORS: magic attack in status bar - N_("(F) use #frillyar for magic attack"), - // TRANSLATORS: magic attack in status bar - N_("(U) use #upmarmu for magic attack"), - // TRANSLATORS: magic attack in status bar - N_("(?) magic attack") -}) - -addModifier2(PvpAttackType, pvpAttackType, "pvpAttackType", 4, -{ - // TRANSLATORS: player attack type in status bar - N_("(a) attack all players"), - // TRANSLATORS: player attack type in status bar - N_("(f) attack all except friends"), - // TRANSLATORS: player attack type in status bar - N_("(b) attack bad relations"), - // TRANSLATORS: player attack type in status bar - N_("(d) don't attack players"), - // TRANSLATORS: player attack type in status bar - N_("(?) pvp attack") -}) - -addModifier2(ImitationMode, imitationMode, "imitationMode", 2, -{ - // TRANSLATORS: imitation type in status bar - N_("(D) default imitation"), - // TRANSLATORS: imitation type in status bar - N_("(O) outfits imitation"), - // TRANSLATORS: imitation type in status bar - N_("(?) imitation") -}) - -addModifier(GameModifiers, disableGameModifiers, 2, -{ - // TRANSLATORS: game modifiers state in status bar - N_("Game modifiers are enabled"), - // TRANSLATORS: game modifiers state in status bar - N_("Game modifiers are disabled"), - // TRANSLATORS: game modifiers state in status bar - N_("Game modifiers are unknown") -}) - -void GameModifiers::changeGameModifiers(const bool forward A_UNUSED) -{ - settings.disableGameModifiers = !settings.disableGameModifiers; - config.setValue("disableGameModifiers", settings.disableGameModifiers); - UpdateStatusListener::distributeEvent(); - GameModifierListener::distributeEvent(); -} - -addModifier(MapDrawType, mapDrawType, 7, -{ - // TRANSLATORS: map view type in status bar - N_("(N) normal map view"), - // TRANSLATORS: map view type in status bar - N_("(D) debug map view"), - // TRANSLATORS: map view type in status bar - N_("(u) ultra map view"), - // TRANSLATORS: map view type in status bar - N_("(U) ultra map view 2"), - // TRANSLATORS: map view type in status bar - N_("(e) empty map view with collision"), - // TRANSLATORS: map view type in status bar - N_("(E) empty map view"), - // TRANSLATORS: map view type in status bar - N_("(b) black & white map view"), - // TRANSLATORS: pickup size in status bar - N_("(?) map view") -}) - -void GameModifiers::changeMapDrawType(const bool forward A_UNUSED) -{ - if (viewport != nullptr) - viewport->toggleMapDrawType(); -} - -addModifier(AwayMode, awayMode, 2, -{ - // TRANSLATORS: away type in status bar - N_("(O) on keyboard"), - // TRANSLATORS: away type in status bar - N_("(A) away"), - // TRANSLATORS: away type in status bar - N_("(?) away") -}) - -void GameModifiers::changeAwayMode(const bool forward A_UNUSED) -{ - if (localPlayer == nullptr) - return; - - settings.awayMode = !settings.awayMode; - localPlayer->setAfkTime(0); - localPlayer->setHalfAway(false); - localPlayer->updateName(); - Game::instance()->updateFrameRate(0); - UpdateStatusListener::distributeEvent(); - GameModifierListener::distributeEvent(); - if (settings.awayMode) - { - if (chatWindow != nullptr) - chatWindow->clearAwayLog(); - - localPlayer->cancelFollow(); - localPlayer->navigateClean(); - if (outfitWindow != nullptr) - outfitWindow->wearAwayOutfit(); - OkDialog *const dialog = CREATEWIDGETR(OkDialog, - // TRANSLATORS: away message box header - _("Away"), - serverConfig.getValue("afkMessage", "I am away from keyboard."), - // TRANSLATORS: ok dialog button - _("OK"), - DialogType::SILENCE, - Modal_true, - ShowCenter_false, - nullptr, - 260); - localPlayer->setAwayDialog(dialog); - dialog->addActionListener(localPlayer->getAwayListener()); - soundManager.volumeOff(); - localPlayer->addAfkEffect(); - } - else - { - localPlayer->setAwayDialog(nullptr); - soundManager.volumeRestore(); - if (chatWindow != nullptr) - { - chatWindow->displayAwayLog(); - chatWindow->clearAwayLog(); - } - localPlayer->removeAfkEffect(); - } -} - -addModifier(CameraMode, cameraMode, 2, -{ - // TRANSLATORS: camera mode in status bar - N_("(G) game camera mode"), - // TRANSLATORS: camera mode in status bar - N_("(F) free camera mode"), - // TRANSLATORS: camera mode in status bar - N_("(?) away") -}) - - -void GameModifiers::changeCameraMode(const bool forward A_UNUSED) -{ - if (viewport != nullptr) - viewport->toggleCameraMode(); -} - -void GameModifiers::resetModifiers() -{ - settings.moveType = 0; - settings.crazyMoveType = config.resetIntValue("crazyMoveType"); - settings.moveToTargetType = config.resetIntValue("moveToTargetType"); - settings.followMode = config.resetIntValue("followMode"); - settings.attackWeaponType = config.resetIntValue("attackWeaponType"); - settings.attackType = config.resetIntValue("attackType"); - settings.magicAttackType = config.resetIntValue("magicAttackType"); - settings.pvpAttackType = config.resetIntValue("pvpAttackType"); - settings.quickDropCounter = config.resetIntValue("quickDropCounter"); - settings.pickUpType = config.resetIntValue("pickUpType"); - settings.targetingType = config.resetIntValue("targetingType"); - settings.mapDrawType = MapType::NORMAL; - if (viewport != nullptr) - { - if (settings.cameraMode != 0u) - viewport->toggleCameraMode(); - Map *const map = viewport->getMap(); - if (map != nullptr) - map->setDrawLayersFlags(MapType::NORMAL); - } - settings.imitationMode = config.resetIntValue("imitationMode"); - settings.disableGameModifiers = config.resetBoolValue( - "disableGameModifiers"); - - UpdateStatusListener::distributeEvent(); - GameModifierListener::distributeEvent(); -} diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h deleted file mode 100644 index 3730b9e13..000000000 --- a/src/gamemodifiers.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GAMEMODIFIERS_H -#define GAMEMODIFIERS_H - -#include - -#include "localconsts.h" - -#define declModifier(name1) \ - static void change##name1(const bool forward); \ - static std::string get##name1##String(); \ - static const unsigned m##name1##Size; \ - static const char *const m##name1##Strings[]; - -class GameModifiers final -{ - public: - A_DELETE_COPY(GameModifiers) - - static void init(); - - static void changeMode(unsigned *restrict const var, - const unsigned limit, - const char *restrict const conf, - std::string (*const func)(), - const unsigned def, - const bool save, - const bool forward); - - declModifier(MoveType) - declModifier(CrazyMoveType) - declModifier(MoveToTargetType) - declModifier(FollowMode) - declModifier(AttackWeaponType) - declModifier(AttackType) - declModifier(TargetingType) - declModifier(QuickDropCounter) - declModifier(PickUpType) - declModifier(MagicAttackType) - declModifier(PvpAttackType) - declModifier(ImitationMode) - declModifier(GameModifiers) - declModifier(MapDrawType) - declModifier(CameraMode) - declModifier(AwayMode) - - static void setQuickDropCounter(const int n); - - static void resetModifiers(); - - protected: - static const char *getVarItem(const char *const *const arr, - const unsigned index, - const unsigned sz) - A_WARN_UNUSED A_NONNULL(1); -}; - -#undef declModifier - -#endif // GAMEMODIFIERS_H diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp deleted file mode 100644 index 108facc73..000000000 --- a/src/graphicsmanager.cpp +++ /dev/null @@ -1,1724 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "graphicsmanager.h" - -#ifdef USE_OPENGL -#ifndef WIN32 - -#ifdef ANDROID -#include -#include -#include - -#ifndef USE_SDL2 -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) -#endif // USE_SDL2 -#elif defined(__native_client__) -#include -#include "render/opengl/naclglfunctions.h" -#else // ANDROID -#ifdef USE_X11 -#include -#endif // USE_X11 -#endif // ANDROID -#endif // WIN32 -#endif // USE_OPENGL - -#include "settings.h" - -#ifdef USE_OPENGL -#include "render/mobileopengl2graphics.h" -#include "render/mobileopenglgraphics.h" -#include "render/modernopenglgraphics.h" -#include "render/normalopenglgraphics.h" -#include "render/safeopenglgraphics.h" - -#include "render/opengl/mgl.h" -#include "render/opengl/mglcheck.h" -#include "render/opengl/mglemu.h" -#endif // USE_OPENGL - -#include "render/sdlgraphics.h" - -#ifdef USE_OPENGL -#include "resources/openglimagehelper.h" -#include "resources/openglscreenshothelper.h" -#ifndef ANDROID -#include "resources/mobileopenglscreenshothelper.h" -#include "resources/safeopenglimagehelper.h" -#endif // ANDROID -#include "render/opengl/mglfunctions.h" -#endif // USE_OPENGL - -#include "resources/sdlimagehelper.h" -#include "resources/sdlscreenshothelper.h" - -#ifdef USE_SDL2 -#include "render/sdl2softwaregraphics.h" - -#include "resources/sdl2softwareimagehelper.h" -#include "resources/sdl2softwarescreenshothelper.h" -#include "resources/surfaceimagehelper.h" -#endif // USE_SDL2 - -#include "utils/delete2.h" -#include "utils/sdlhelper.h" - -#ifdef USE_OPENGL -#include "test/testmain.h" -#else // USE_OPENGL -#include "configuration.h" - -#include "render/renderers.h" -#endif // USE_OPENGL - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "debug.h" - -#ifdef USE_OPENGL -#ifndef GL_MAX_RENDERBUFFER_SIZE -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#endif // GL_MAX_RENDERBUFFER_SIZE -#define useCompression(name) \ - OpenGLImageHelper::setInternalTextureType(name); \ - logger->log("using " #name " texture compression"); -#endif // USE_OPENGL - -GraphicsManager graphicsManager; - -RenderType openGLMode = RENDER_SOFTWARE; - -ScreenshotHelper *screenshortHelper = nullptr; - -const int densitySize = 6; - -const std::string densityNames[] = -{ - "low", - "medium", - "tv", - "high", - "xhigh", - "xxhigh" -}; - -#ifdef USE_OPENGL -GLenum GraphicsManager::mLastError(GL_NO_ERROR); -#endif // USE_OPENGL - -GraphicsManager::GraphicsManager() : - mExtensions(), - mPlatformExtensions(), - mGlVersionString(), - mGlVendor(), - mGlRenderer(), - mGlShaderVersionString(), - mMinor(0), - mMajor(0), - mSLMinor(0), - mSLMajor(0), - mPlatformMinor(0), - mPlatformMajor(0), - mMaxVertices(500), - mMaxFboSize(0), - mMaxWidth(0), - mMaxHeight(0), - mWidthMM(0), - mHeightMM(0), - mDensity(-1), -#ifdef USE_OPENGL - mUseTextureSampler(true), - mTextureSampler(0), - mSupportDebug(0), - mSupportModernOpengl(false), - mGles(false), -#endif // USE_OPENGL - mUseAtlases(false) -{ -} - -GraphicsManager::~GraphicsManager() -{ -#ifdef USE_OPENGL - if (isGLNotNull(mglGenSamplers) && mTextureSampler) - mglDeleteSamplers(1, &mTextureSampler); -#endif // USE_OPENGL -} - -#ifdef USE_OPENGL -TestMain *GraphicsManager::startDetection() -{ - TestMain *const test = new TestMain; - test->exec(false); - return test; -} - -int GraphicsManager::detectGraphics() -{ - logger->log1("start detecting best mode..."); - logger->log1("enable opengl mode"); - int textureSampler = 0; - int compressTextures = 0; -#if !defined(ANDROID) && !defined(__native_client__) - mainGraphics = new NormalOpenGLGraphics; -#endif // !defined(ANDROID) && !defined(__native_client__) - - SDL_Window *const window = createWindow(100, 100, 0, - SDL_ANYFORMAT | SDL_OPENGL); - mainGraphics->setWindow(window, 100, 100); - mainGraphics->createGLContext(false); - - initOpenGL(); - logVersion(); - - RenderType mode = RENDER_NORMAL_OPENGL; - - // detecting features by known renderers or vendors - if (findI(mGlRenderer, "gdi generic") != std::string::npos) - { - // windows gdi OpenGL emulation - logger->log("detected gdi drawing"); - logger->log("disable OpenGL"); - mode = RENDER_SOFTWARE; - } - else if (findI(mGlRenderer, "Software Rasterizer") != std::string::npos) - { - // software OpenGL emulation - logger->log("detected software drawing"); - logger->log("disable OpenGL"); - mode = RENDER_SOFTWARE; - } - else if (findI(mGlRenderer, "Indirect") != std::string::npos) - { - // indirect OpenGL drawing - logger->log("detected indirect drawing"); - logger->log("disable OpenGL"); - mode = RENDER_SOFTWARE; - } - else if (findI(mGlVendor, "VMWARE") != std::string::npos) - { - // vmware emulation - logger->log("detected VMWARE driver"); - logger->log("disable OpenGL"); - mode = RENDER_SOFTWARE; - } - else if (findI(mGlVendor, "NVIDIA") != std::string::npos) - { - // hope it can work well - logger->log("detected NVIDIA driver"); - config.setValue("useTextureSampler", true); - textureSampler = 1; - mode = RENDER_NORMAL_OPENGL; - } - - // detecting feature based on OpenGL version - if (!checkGLVersion(1, 1)) - { - // very old OpenGL version - logger->log("OpenGL version too old"); - mode = RENDER_SOFTWARE; - } - - if (mode != RENDER_SOFTWARE && findI(mGlVersionString, "Mesa") - != std::string::npos) - { - // Mesa detected. In latest Mesa look like compression broken. - config.setValue("compresstextures", false); - compressTextures = 0; - } - - config.setValue("opengl", CAST_S32(mode)); - config.setValue("videoconfigured", true); - config.write(); - - logger->log("detection complete"); - return CAST_U32(mode) - | (1024 * textureSampler) | (2048 * compressTextures); -} - -#ifdef USE_SDL2 -#define RENDER_SOFTWARE_INIT \ - imageHelper = new SDL2SoftwareImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new SDL2SoftwareGraphics; \ - screenshortHelper = new Sdl2SoftwareScreenshotHelper; -#define RENDER_SDL2_DEFAULT_INIT \ - imageHelper = new SDLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new SDLGraphics; \ - screenshortHelper = new SdlScreenshotHelper; \ - mainGraphics->setRendererFlags(SDL_RENDERER_ACCELERATED); \ - mUseTextureSampler = false; -#else // USE_SDL2 -#define RENDER_SOFTWARE_INIT \ - imageHelper = new SDLImageHelper; \ - surfaceImageHelper = imageHelper; \ - mainGraphics = new SDLGraphics; \ - screenshortHelper = new SdlScreenshotHelper; -#define RENDER_SDL2_DEFAULT_INIT -#endif // USE_SDL2 - -#if defined(ANDROID) || defined(__native_client__) -#define RENDER_NORMAL_OPENGL_INIT -#define RENDER_MODERN_OPENGL_INIT -#else // defined(ANDROID) || defined(__native_client__) -#define RENDER_NORMAL_OPENGL_INIT \ - imageHelper = new OpenGLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new NormalOpenGLGraphics; \ - screenshortHelper = new OpenGLScreenshotHelper; \ - mUseTextureSampler = true; -#define RENDER_MODERN_OPENGL_INIT \ - imageHelper = new OpenGLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new ModernOpenGLGraphics; \ - screenshortHelper = new OpenGLScreenshotHelper; \ - mUseTextureSampler = true; -#endif // defined(ANDROID) || defined(__native_client__) - -#if defined(ANDROID) -#define RENDER_SAFE_OPENGL_INIT -#define RENDER_GLES2_OPENGL_INIT -#else // defined(ANDROID) -#define RENDER_SAFE_OPENGL_INIT \ - imageHelper = new SafeOpenGLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new SafeOpenGLGraphics; \ - screenshortHelper = new OpenGLScreenshotHelper; \ - mUseTextureSampler = false; -#define RENDER_GLES2_OPENGL_INIT \ - imageHelper = new OpenGLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new MobileOpenGL2Graphics; \ - screenshortHelper = new MobileOpenGLScreenshotHelper; \ - mUseTextureSampler = false; -#endif // defined(ANDROID) - -#if defined(__native_client__) -#define RENDER_GLES_OPENGL_INIT -#else // defined(__native_client__) -#define RENDER_GLES_OPENGL_INIT \ - imageHelper = new OpenGLImageHelper; \ - surfaceImageHelper = new SurfaceImageHelper; \ - mainGraphics = new MobileOpenGLGraphics; \ - screenshortHelper = new OpenGLScreenshotHelper; \ - mUseTextureSampler = false; -#endif // defined(__native_client__) - -void GraphicsManager::createRenderers() -{ - RenderType useOpenGL = RENDER_SOFTWARE; - if (!settings.options.noOpenGL) - { - if (settings.options.renderer < 0) - { - useOpenGL = intToRenderType(config.getIntValue("opengl")); - settings.options.renderer = CAST_S32(useOpenGL); - } - else - { - useOpenGL = intToRenderType(settings.options.renderer); - } - } - - // Setup image loading for the right image format - ImageHelper::setOpenGlMode(useOpenGL); - - // Create the graphics context - switch (useOpenGL) - { - case RENDER_SOFTWARE: - RENDER_SOFTWARE_INIT - mUseTextureSampler = false; - break; - case RENDER_LAST: - case RENDER_NULL: - default: - break; - case RENDER_NORMAL_OPENGL: - RENDER_NORMAL_OPENGL_INIT - break; - case RENDER_SAFE_OPENGL: - RENDER_SAFE_OPENGL_INIT - break; - case RENDER_MODERN_OPENGL: - RENDER_MODERN_OPENGL_INIT - break; - case RENDER_GLES2_OPENGL: - RENDER_GLES2_OPENGL_INIT - break; - case RENDER_GLES_OPENGL: - RENDER_GLES_OPENGL_INIT - break; - case RENDER_SDL2_DEFAULT: - RENDER_SDL2_DEFAULT_INIT - break; - }; - mUseAtlases = (useOpenGL == RENDER_NORMAL_OPENGL || - useOpenGL == RENDER_SAFE_OPENGL || - useOpenGL == RENDER_MODERN_OPENGL || - useOpenGL == RENDER_GLES_OPENGL || - useOpenGL == RENDER_GLES2_OPENGL) && - config.getBoolValue("useAtlases"); - -#else // USE_OPENGL - -void GraphicsManager::createRenderers() -{ - RenderType useOpenGL = RENDER_SOFTWARE; - if (!settings.options.noOpenGL) - useOpenGL = intToRenderType(config.getIntValue("opengl")); - - // Setup image loading for the right image format - ImageHelper::setOpenGlMode(useOpenGL); - - // Create the graphics context - switch (useOpenGL) - { - case RENDER_SOFTWARE: - case RENDER_SAFE_OPENGL: - case RENDER_GLES_OPENGL: - case RENDER_GLES2_OPENGL: - case RENDER_MODERN_OPENGL: - case RENDER_NORMAL_OPENGL: - case RENDER_NULL: - case RENDER_LAST: - default: -#ifndef USE_SDL2 - case RENDER_SDL2_DEFAULT: - imageHelper = new SDLImageHelper; - surfaceImageHelper = imageHelper; - mainGraphics = new SDLGraphics; - screenshortHelper = new SdlScreenshotHelper; -#else // USE_SDL2 - - imageHelper = new SDL2SoftwareImageHelper; - surfaceImageHelper = new SurfaceImageHelper; - mainGraphics = new SDL2SoftwareGraphics; - screenshortHelper = new Sdl2SoftwareScreenshotHelper; - -#endif // USE_SDL2 - - break; -#ifdef USE_SDL2 - case RENDER_SDL2_DEFAULT: - imageHelper = new SDLImageHelper; - surfaceImageHelper = new SurfaceImageHelper; - mainGraphics = new SDLGraphics; - mainGraphics->setRendererFlags(SDL_RENDERER_ACCELERATED); - screenshortHelper = new SdlScreenshotHelper; - break; -#endif // USE_SDL2 - }; -#endif // USE_OPENGL -} - -void GraphicsManager::deleteRenderers() -{ - delete2(mainGraphics); - if (imageHelper != surfaceImageHelper) - delete surfaceImageHelper; - surfaceImageHelper = nullptr; - delete2(imageHelper); -} - -void GraphicsManager::setVideoMode() -{ - const int bpp = 0; - const bool fullscreen = config.getBoolValue("screen"); - const bool hwaccel = config.getBoolValue("hwaccel"); - const bool enableResize = config.getBoolValue("enableresize"); - const bool noFrame = config.getBoolValue("noframe"); - const bool allowHighDPI = config.getBoolValue("allowHighDPI"); - -#ifdef ANDROID -// int width = config.getValue("screenwidth", 0); -// int height = config.getValue("screenheight", 0); - StringVect videoModes; - SDL::getAllVideoModes(videoModes); - if (videoModes.empty()) - logger->error("no video modes detected"); - STD_VECTOR res; - splitToIntVector(res, videoModes[0], 'x'); - if (res.size() != 2) - logger->error("no video modes detected"); - - int width = res[0]; - int height = res[1]; -#elif defined __native_client__ -#ifdef USE_SDL2 - // not implemented -#else // USE_SDL2 - - const SDL_VideoInfo* info = SDL_GetVideoInfo(); - int width = info->current_w; - int height = info->current_h; -#endif // USE_SDL2 -#else // defined __native_client__ - - int width = config.getIntValue("screenwidth"); - int height = config.getIntValue("screenheight"); -#endif // defined __native_client__ - - const int scale = config.getIntValue("scale"); - - // Try to set the desired video mode - if (!mainGraphics->setVideoMode(width, height, scale, bpp, - fullscreen, hwaccel, enableResize, noFrame, allowHighDPI)) - { - logger->log(strprintf("Couldn't set %dx%dx%d video mode: %s", - width, height, bpp, SDL_GetError())); - - const int oldWidth = config.getValueInt("oldscreenwidth", -1); - const int oldHeight = config.getValueInt("oldscreenheight", -1); - const int oldFullscreen = config.getValueInt("oldscreen", -1); - if (oldWidth != -1 && oldHeight != -1 && oldFullscreen != -1) - { - config.deleteKey("oldscreenwidth"); - config.deleteKey("oldscreenheight"); - config.deleteKey("oldscreen"); - - config.setValueInt("screenwidth", oldWidth); - config.setValueInt("screenheight", oldHeight); - config.setValue("screen", oldFullscreen == 1); - if (!mainGraphics->setVideoMode(oldWidth, oldHeight, - scale, - bpp, - oldFullscreen != 0, - hwaccel, - enableResize, - noFrame, - allowHighDPI)) - { - logger->safeError(strprintf("Couldn't restore %dx%dx%d " - "video mode: %s", oldWidth, oldHeight, bpp, - SDL_GetError())); - } - } - } -} - -void GraphicsManager::initGraphics() -{ - openGLMode = intToRenderType(config.getIntValue("opengl")); -#ifdef USE_OPENGL - OpenGLImageHelper::setBlur(config.getBoolValue("blur")); -#ifndef ANDROID - SafeOpenGLImageHelper::setBlur(config.getBoolValue("blur")); -#endif // ANDROID - SurfaceImageHelper::SDLSetEnableAlphaCache( - config.getBoolValue("alphaCache") && - openGLMode == RENDER_SOFTWARE); - ImageHelper::setEnableAlpha((config.getFloatValue("guialpha") != 1.0F || - openGLMode != RENDER_SOFTWARE) && - config.getBoolValue("enableGuiOpacity")); -#else // USE_OPENGL - SurfaceImageHelper::SDLSetEnableAlphaCache( - config.getBoolValue("alphaCache")); - ImageHelper::setEnableAlpha(config.getFloatValue("guialpha") != 1.0F && - config.getBoolValue("enableGuiOpacity")); -#endif // USE_OPENGL - createRenderers(); - setVideoMode(); - detectPixelSize(); -#ifdef USE_OPENGL - if (config.getBoolValue("checkOpenGLVersion") == true) - { - const RenderType oldOpenGLMode = openGLMode; - if (openGLMode == RENDER_MODERN_OPENGL) - { - if (!mSupportModernOpengl || !checkGLVersion(3, 0)) - { - logger->log("Fallback to normal OpenGL mode"); - openGLMode = RENDER_NORMAL_OPENGL; - } - } - if (openGLMode == RENDER_NORMAL_OPENGL) - { - if (!checkGLVersion(2, 0)) - { - logger->log("Fallback to safe OpenGL mode"); - openGLMode = RENDER_SAFE_OPENGL; - } - } - if (openGLMode == RENDER_GLES_OPENGL) - { - if (!checkGLVersion(2, 0) && !checkGLesVersion(1, 0)) - { - logger->log("Fallback to safe OpenGL mode"); - openGLMode = RENDER_SAFE_OPENGL; - } - } - if (openGLMode == RENDER_GLES2_OPENGL) - { - // +++ here need check also not implemented gles flag - if (!checkGLVersion(2, 0)) - { - logger->log("Fallback to software mode"); - openGLMode = RENDER_SOFTWARE; - } - } - - if (openGLMode != oldOpenGLMode) - { - deleteRenderers(); - settings.options.renderer = CAST_S32(openGLMode); - config.setValue("opengl", settings.options.renderer); - createRenderers(); - setVideoMode(); - detectPixelSize(); - } - } -#if !defined(ANDROID) && !defined(__APPLE__) - const std::string str = config.getStringValue("textureSize"); - STD_VECTOR sizes; - splitToIntVector(sizes, str, ','); - const size_t pos = CAST_SIZE(openGLMode); - if (sizes.size() <= pos) - settings.textureSize = 1024; - else - settings.textureSize = sizes[pos]; - logger->log("Detected max texture size: %u", settings.textureSize); -#endif // !defined(ANDROID) && !defined(__APPLE__) -#endif // USE_OPENGL -} - -#ifdef USE_SDL2 -SDL_Window *GraphicsManager::createWindow(const int w, const int h, - const int bpp A_UNUSED, - const int flags) -{ - return SDL_CreateWindow("ManaPlus", SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, w, h, flags); -} - -SDL_Renderer *GraphicsManager::createRenderer(SDL_Window *const window, - const int flags) -{ - SDL::setRendererHint(config.getStringValue("sdlDriver")); - SDL_Renderer *const renderer = SDL_CreateRenderer(window, -1, flags); - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); - return renderer; -} -#else // USE_SDL2 - -SDL_Window *GraphicsManager::createWindow(const int w, const int h, - const int bpp, const int flags) -{ - return SDL_SetVideoMode(w, h, bpp, flags); -} -#endif // USE_SDL2 - -#ifdef USE_OPENGL -void GraphicsManager::updateExtensions() -{ - mExtensions.clear(); - logger->log1("opengl extensions: "); - if (checkGLVersion(3, 0)) - { // get extensions in new way - assignFunction2(glGetStringi, "glGetStringi"); - std::string extList; - int num = 0; - glGetIntegerv(GL_NUM_EXTENSIONS, &num); - for (int f = 0; f < num; f ++) - { - std::string str = reinterpret_cast( - mglGetStringi(GL_EXTENSIONS, f)); - mExtensions.insert(str); - extList.append(str).append(" "); - } - logger->log1(extList.c_str()); - } - else - { // get extensions in old way - char const *extensions = reinterpret_cast( - mglGetString(GL_EXTENSIONS)); - if (extensions) - { - logger->log1(extensions); - splitToStringSet(mExtensions, extensions, ' '); - } - } -} - -void GraphicsManager::updatePlanformExtensions() -{ - SDL_SysWMinfo info; - SDL_VERSION(&info.version); - if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) - { -#ifdef WIN32 - if (!mwglGetExtensionsString) - return; - - HDC hdc = GetDC(info.window); - if (hdc) - { - const char *const extensions = mwglGetExtensionsString(hdc); - if (extensions) - { - logger->log1("wGL extensions:"); - logger->log1(extensions); - splitToStringSet(mPlatformExtensions, extensions, ' '); - } - } -#elif defined USE_X11 - Display *const display = info.info.x11.display; - if (display) - { - Screen *const screen = XDefaultScreenOfDisplay(display); - if (!screen) - return; - - const int screenNum = XScreenNumberOfScreen(screen); - const char *const extensions = glXQueryExtensionsString( - display, screenNum); - if (extensions) - { - logger->log1("glx extensions:"); - logger->log1(extensions); - splitToStringSet(mPlatformExtensions, extensions, ' '); - } - glXQueryVersion(display, &mPlatformMajor, &mPlatformMinor); - if (checkPlatformVersion(1, 1)) - { - const char *const vendor1 = glXQueryServerString( - display, screenNum, GLX_VENDOR); - if (vendor1) - logger->log("glx server vendor: %s", vendor1); - const char *const version1 = glXQueryServerString( - display, screenNum, GLX_VERSION); - if (version1) - logger->log("glx server version: %s", version1); - const char *const extensions1 = glXQueryServerString( - display, screenNum, GLX_EXTENSIONS); - if (extensions1) - { - logger->log1("glx server extensions:"); - logger->log1(extensions1); - } - - const char *const vendor2 = glXGetClientString( - display, GLX_VENDOR); - if (vendor2) - logger->log("glx client vendor: %s", vendor2); - const char *const version2 = glXGetClientString( - display, GLX_VERSION); - if (version2) - logger->log("glx client version: %s", version2); - const char *const extensions2 = glXGetClientString( - display, GLX_EXTENSIONS); - if (extensions2) - { - logger->log1("glx client extensions:"); - logger->log1(extensions2); - } - } - logger->log("width=%d", DisplayWidth(display, screenNum)); - } -#endif // WIN32 - } -} - -bool GraphicsManager::supportExtension(const std::string &ext) const -{ - return mExtensions.find(ext) != mExtensions.end(); -} - -void GraphicsManager::updateTextureCompressionFormat() const -{ - const int compressionFormat = config.getIntValue("compresstextures"); - // using extensions if can - if (checkGLVersion(3, 1) || - checkGLesVersion(2, 0) || - supportExtension("GL_ARB_texture_compression")) - { - GLint num = 0; - mglGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num); - logger->log("support %d compressed formats", num); - GLint *const formats = new GLint[num > 10 - ? CAST_SIZE(num) : 10]; - mglGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); - for (int f = 0; f < num; f ++) - logger->log(" 0x%x", CAST_U32(formats[f])); - - if (compressionFormat) - { - for (int f = 0; f < num; f ++) - { - switch (formats[f]) - { - case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - if (compressionFormat == 1) - { - delete []formats; - useCompression(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); - return; - } - break; - case GL_COMPRESSED_RGBA_FXT1_3DFX: - if (compressionFormat == 2) - { - delete []formats; - useCompression(GL_COMPRESSED_RGBA_FXT1_3DFX); - return; - } - break; - case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB: - if (compressionFormat == 4) - { - delete []formats; - useCompression(GL_COMPRESSED_RGBA_BPTC_UNORM_ARB); - return; - } - break; - default: - break; - } - } - if (compressionFormat == 3) - { - delete []formats; - useCompression(GL_COMPRESSED_RGBA_ARB); - return; - } - - // workaround for MESA bptc compression detection - if (compressionFormat == 4 - && supportExtension("GL_ARB_texture_compression_bptc")) - { - delete []formats; - useCompression(GL_COMPRESSED_RGBA_BPTC_UNORM_ARB); - return; - } - } - delete []formats; - if (compressionFormat) - logger->log1("no correct compression format found"); - } - else - { - if (compressionFormat) - logger->log1("no correct compression format found"); - } -} - -void GraphicsManager::updateTextureFormat() -{ - const int renderer = settings.options.renderer; - - // using default formats - if (renderer == RENDER_MODERN_OPENGL || - renderer == RENDER_GLES_OPENGL || - renderer == RENDER_GLES2_OPENGL || - config.getBoolValue("newtextures")) - { - OpenGLImageHelper::setInternalTextureType(GL_RGBA); -#ifndef ANDROID - SafeOpenGLImageHelper::setInternalTextureType(GL_RGBA); -#endif // ANDROID - - logger->log1("using RGBA texture format"); - } - else - { - OpenGLImageHelper::setInternalTextureType(4); -#ifndef ANDROID - SafeOpenGLImageHelper::setInternalTextureType(4); -#endif // ANDROID - - logger->log1("using 4 texture format"); - } -} - -void GraphicsManager::logString(const char *const format, const int num) -{ - const char *str = reinterpret_cast(mglGetString(num)); - if (!str) - logger->log(format, "?"); - else - logger->log(format, str); -} - -std::string GraphicsManager::getGLString(const int num) -{ - const char *str = reinterpret_cast(mglGetString(num)); - return str ? str : ""; -} - -void GraphicsManager::setGLVersion() -{ - mGlVersionString = getGLString(GL_VERSION); - std::string version = mGlVersionString; - if (findCutFirst(version, "OpenGL ES ")) - mGles = true; - sscanf(version.c_str(), "%5d.%5d", &mMajor, &mMinor); - logger->log("Detected gl version: %d.%d", mMajor, mMinor); - mGlVendor = getGLString(GL_VENDOR); - mGlRenderer = getGLString(GL_RENDERER); - mGlShaderVersionString = getGLString(GL_SHADING_LANGUAGE_VERSION); - version = mGlShaderVersionString; - cutFirst(version, "OpenGL ES GLSL ES "); - cutFirst(version, "OpenGL ES GLSL "); - cutFirst(version, "OpenGL ES "); - sscanf(version.c_str(), "%5d.%5d", &mSLMajor, &mSLMinor); - logger->log("Detected glsl version: %d.%d", mSLMajor, mSLMinor); -#ifdef ANDROID - if (!mMajor && !mMinor) - { - logger->log("Overriding detected OpenGL version on Android to 1.0"); - mGles = true; - mMajor = 1; - mMinor = 0; - } -#endif // ANDROID -} - -void GraphicsManager::logVersion() const -{ - logger->log("gl vendor: " + mGlVendor); - logger->log("gl renderer: " + mGlRenderer); - logger->log("gl version: " + mGlVersionString); - logger->log("glsl version: " + mGlShaderVersionString); -} - -bool GraphicsManager::checkGLVersion(const int major, const int minor) const -{ - return mMajor > major || (mMajor == major && mMinor >= minor); -} - -bool GraphicsManager::checkSLVersion(const int major, const int minor) const -{ - return mSLMajor > major || (mSLMajor == major && mSLMinor >= minor); -} - -bool GraphicsManager::checkGLesVersion(const int major, const int minor) const -{ - return mGles && (mMajor > major || (mMajor == major && mMinor >= minor)); -} - -bool GraphicsManager::checkPlatformVersion(const int major, - const int minor) const -{ - return mPlatformMajor > major || (mPlatformMajor == major - && mPlatformMinor >= minor); -} - -void GraphicsManager::createFBO(const int width, const int height, - FBOInfo *const fbo) -{ - if (!fbo) - return; - - // create a texture object - glGenTextures(1, &fbo->textureId); - glBindTexture(OpenGLImageHelper::mTextureType, fbo->textureId); - glTexParameterf(OpenGLImageHelper::mTextureType, - GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameterf(OpenGLImageHelper::mTextureType, - GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(OpenGLImageHelper::mTextureType, - GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(OpenGLImageHelper::mTextureType, - GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(OpenGLImageHelper::mTextureType, 0, GL_RGBA8, width, height, - 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); - glBindTexture(OpenGLImageHelper::mTextureType, 0); - - // create a renderbuffer object to store depth info - mglGenRenderbuffers(1, &fbo->rboId); - mglBindRenderbuffer(GL_RENDERBUFFER, fbo->rboId); - mglRenderbufferStorage(GL_RENDERBUFFER, - GL_DEPTH_COMPONENT, width, height); - mglBindRenderbuffer(GL_RENDERBUFFER, 0); - - // create a framebuffer object - mglGenFramebuffers(1, &fbo->fboId); - mglBindFramebuffer(GL_FRAMEBUFFER, fbo->fboId); - - // attach the texture to FBO color attachment point - mglFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - OpenGLImageHelper::mTextureType, fbo->textureId, 0); - - // attach the renderbuffer to depth attachment point - mglFramebufferRenderbuffer(GL_FRAMEBUFFER, - GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo->rboId); - - mglBindFramebuffer(GL_FRAMEBUFFER, fbo->fboId); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -} - -void GraphicsManager::deleteFBO(FBOInfo *const fbo) -{ - if (!fbo) - return; - - mglBindFramebuffer(GL_FRAMEBUFFER, 0); - if (fbo->fboId) - { - mglDeleteFramebuffers(1, &fbo->fboId); - fbo->fboId = 0; - } - mglBindRenderbuffer(GL_RENDERBUFFER, 0); - if (fbo->rboId) - { - mglDeleteRenderbuffers(1, &fbo->rboId); - fbo->rboId = 0; - } - if (fbo->textureId) - { - glDeleteTextures(1, &fbo->textureId); - fbo->textureId = 0; - } -} - -void GraphicsManager::initOpenGLFunctions() -{ -#ifdef __native_client__ - emulateFunction(glTextureSubImage2DEXT); -#else // __native_client__ - - const bool is10 = checkGLVersion(1, 0); - const bool is11 = checkGLVersion(1, 1); - const bool is12 = checkGLVersion(1, 2); - const bool is13 = checkGLVersion(1, 3); - const bool is15 = checkGLVersion(1, 5); - const bool is20 = checkGLVersion(2, 0); - const bool is21 = checkGLVersion(2, 1); - const bool is30 = checkGLVersion(3, 0); - const bool is33 = checkGLVersion(3, 3); - const bool is41 = checkGLVersion(4, 1); - const bool is42 = checkGLVersion(4, 2); - const bool is43 = checkGLVersion(4, 3); - const bool is44 = checkGLVersion(4, 4); - const bool is45 = checkGLVersion(4, 5); - mSupportModernOpengl = true; - - // Texture sampler - if (is10 && (is33 || supportExtension("GL_ARB_sampler_objects"))) - { - logger->log1("found GL_ARB_sampler_objects"); - assignFunction(glGenSamplers); - assignFunction(glDeleteSamplers); - assignFunction(glBindSampler); - assignFunction(glSamplerParameteri); - if (isGLNotNull(mglGenSamplers) - && config.getBoolValue("useTextureSampler")) - { - mUseTextureSampler &= true; - } - else - { - mUseTextureSampler = false; - } - } - else - { - logger->log1("texture sampler not found"); - mUseTextureSampler = false; - } - - if (!is11) - { - mSupportModernOpengl = false; - emulateFunction(glTextureSubImage2DEXT); - return; - } - -/* - if (findI(mGlVendor, "NVIDIA") != std::string::npos || - mGlVersionString.find("Mesa 10.6.") != std::string::npos || - mGlVersionString.find("Mesa 11.1.1") != std::string::npos || - mGlVersionString.find("Mesa 11.1.2") != std::string::npos || - mGlVersionString.find("Mesa 11.1.3") != std::string::npos || - mGlVersionString.find("Mesa 11.2") != std::string::npos || - (findI(mGlRenderer, "AMD Radeon HD") != std::string::npos && - (mGlVersionString.find( - "Compatibility Profile Context 14.") != std::string::npos || - mGlVersionString.find( - "Compatibility Profile Context 15.") != std::string::npos))) - { - logger->log1("Not checked for DSA because on " - "NVIDIA or AMD or in Mesa it broken"); - emulateFunction(glTextureSubImage2DEXT); - } - else -*/ - { // not for NVIDIA. in NVIDIA atleast in windows drivers DSA is broken - // Mesa 10.6.3 show support for DSA, but it broken. Works in 10.7 dev - if (config.getBoolValue("enableDSA") == true) - { - if (is45) - { - logger->log1("found GL_EXT_direct_state_access"); - assignFunction(glTextureSubImage2D); - } - else if (supportExtension("GL_EXT_direct_state_access")) - { - logger->log1("found GL_EXT_direct_state_access"); - assignFunctionEmu2(glTextureSubImage2DEXT, - "glTextureSubImage2DEXT"); - } - else if (supportExtension("GL_ARB_direct_state_access")) - { - logger->log1("found GL_ARB_direct_state_access"); - logger->log1("GL_EXT_direct_state_access not found"); - assignFunction(glTextureSubImage2D); - } - else - { - logger->log1("GL_EXT_direct_state_access not found"); - logger->log1("GL_ARB_direct_state_access not found"); - emulateFunction(glTextureSubImage2DEXT); - } - } - else - { - logger->log1("Direct state access disabled in settings"); - emulateFunction(glTextureSubImage2DEXT); - } - } - - if (is12 && (is42 || supportExtension("GL_ARB_texture_storage"))) - { - logger->log1("found GL_ARB_texture_storage"); - assignFunction(glTexStorage2D); - } - else - { - logger->log1("GL_ARB_texture_storage not found"); - } - - if (is13 || supportExtension("GL_ARB_multitexture")) - { - logger->log1("found GL_ARB_multitexture or OpenGL 1.3"); - assignFunction(glActiveTexture); - } - else - { - emulateFunction(glActiveTexture); - logger->log1("GL_ARB_multitexture not found"); - } - - if (is20 || supportExtension("GL_ARB_explicit_attrib_location")) - { - logger->log1("found GL_ARB_explicit_attrib_location or OpenGL 2.0"); - assignFunction(glBindAttribLocation); - } - else - { - logger->log1("GL_ARB_explicit_attrib_location not found"); - } - - if (is30 || supportExtension("GL_ARB_framebuffer_object")) - { // frame buffer supported - logger->log1("found GL_ARB_framebuffer_object"); - assignFunction(glGenRenderbuffers); - assignFunction(glBindRenderbuffer); - assignFunction(glRenderbufferStorage); - assignFunction(glGenFramebuffers); - assignFunction(glBindFramebuffer); - assignFunction(glFramebufferTexture2D); - assignFunction(glFramebufferRenderbuffer); - assignFunction(glDeleteFramebuffers); - assignFunction(glDeleteRenderbuffers); - assignFunction(glCheckFramebufferStatus); - } - else if (supportExtension("GL_EXT_framebuffer_object")) - { // old frame buffer extension - logger->log1("found GL_EXT_framebuffer_object"); - assignFunctionEXT(glGenRenderbuffers); - assignFunctionEXT(glBindRenderbuffer); - assignFunctionEXT(glRenderbufferStorage); - assignFunctionEXT(glGenFramebuffers); - assignFunctionEXT(glBindFramebuffer); - assignFunctionEXT(glFramebufferTexture2D); - assignFunctionEXT(glFramebufferRenderbuffer); - assignFunctionEXT(glDeleteFramebuffers); - assignFunctionEXT(glDeleteRenderbuffers); - } - else - { // no frame buffer support - logger->log1("GL_ARB_framebuffer_object or " - "GL_EXT_framebuffer_object not found"); - config.setValue("usefbo", false); - } - - // debug extensions - if (is43 || supportExtension("GL_KHR_debug")) - { - logger->log1("found GL_KHR_debug"); - assignFunction(glDebugMessageControl); - assignFunction(glDebugMessageCallback); - assignFunction(glPushDebugGroup); - assignFunction(glPopDebugGroup); - assignFunction(glObjectLabel); - mSupportDebug = 2; - } - else if (supportExtension("GL_ARB_debug_output")) - { - logger->log1("found GL_ARB_debug_output"); - assignFunctionARB(glDebugMessageControl); - assignFunctionARB(glDebugMessageCallback); - mSupportDebug = 1; - } - else - { - logger->log1("debug extensions not found"); - mSupportDebug = 0; - } - - if (supportExtension("GL_GREMEDY_frame_terminator")) - { - logger->log1("found GL_GREMEDY_frame_terminator"); - assignFunction2(glFrameTerminator, "glFrameTerminatorGREMEDY"); - } - else - { - logger->log1("GL_GREMEDY_frame_terminator not found"); - } - if (is44 || supportExtension("GL_EXT_debug_label")) - { - logger->log1("found GL_EXT_debug_label"); - assignFunction2(glLabelObject, "glObjectLabel"); - if (isGLNull(mglLabelObject)) - assignFunctionEXT(glLabelObject); - assignFunctionEXT(glGetObjectLabel); - } - else - { - logger->log1("GL_EXT_debug_label not found"); - } - if (supportExtension("GL_GREMEDY_string_marker")) - { - logger->log1("found GL_GREMEDY_string_marker"); - assignFunction2(glPushGroupMarker, "glStringMarkerGREMEDY"); - } - else - { - logger->log1("GL_GREMEDY_string_marker not found"); - } - if (supportExtension("GL_EXT_debug_marker")) - { - logger->log1("found GL_EXT_debug_marker"); - assignFunctionEXT(glInsertEventMarker); - assignFunctionEXT(glPushGroupMarker); - assignFunctionEXT(glPopGroupMarker); - } - else - { - logger->log1("GL_EXT_debug_marker not found"); - } - if (is15 && (is30 || supportExtension("GL_EXT_timer_query"))) - { - logger->log1("found GL_EXT_timer_query"); - assignFunction(glGenQueries); - assignFunction(glBeginQuery); - assignFunction(glEndQuery); - assignFunction(glDeleteQueries); - assignFunction(glGetQueryObjectiv); - assignFunctionEXT(glGetQueryObjectui64v); - } - else - { - logger->log1("GL_EXT_timer_query not supported"); - } - if (is20 && (is43 || supportExtension("GL_ARB_invalidate_subdata"))) - { - logger->log1("found GL_ARB_invalidate_subdata"); - assignFunction(glInvalidateTexImage); - } - else - { - logger->log1("GL_ARB_invalidate_subdata not supported"); - } - if (is21 && (is30 || supportExtension("GL_ARB_vertex_array_object"))) - { - logger->log1("found GL_ARB_vertex_array_object"); - assignFunction(glGenVertexArrays); - assignFunction(glBindVertexArray); - assignFunction(glDeleteVertexArrays); - assignFunction(glVertexAttribPointer); - assignFunction(glEnableVertexAttribArray); - assignFunction(glDisableVertexAttribArray); - assignFunction(glVertexAttribIPointer); - } - else - { - mSupportModernOpengl = false; - logger->log1("GL_ARB_vertex_array_object not found"); - } - if (is20 || supportExtension("GL_ARB_vertex_buffer_object")) - { - assignFunction(glGenBuffers); - assignFunction(glDeleteBuffers); - assignFunction(glBindBuffer); - assignFunction(glBufferData); - assignFunction(glIsBuffer); - } - else - { - mSupportModernOpengl = false; - logger->log1("buffers extension not found"); - } - if (is43 || supportExtension("GL_ARB_copy_image")) - { - logger->log1("found GL_ARB_copy_image"); - assignFunction(glCopyImageSubData); - } - else - { - logger->log1("GL_ARB_copy_image not found"); - } - if (is44 || supportExtension("GL_ARB_clear_texture")) - { - logger->log1("found GL_ARB_clear_texture"); - assignFunction(glClearTexImage); - assignFunction(glClearTexSubImage); - } - else - { - logger->log1("GL_ARB_clear_texture not found"); - } - if (is20 || supportExtension("GL_ARB_shader_objects")) - { - logger->log1("found GL_ARB_shader_objects"); - assignFunction(glCreateShader); - assignFunction(glDeleteShader); - assignFunction(glGetShaderiv); - assignFunction(glGetShaderInfoLog); - assignFunction(glGetShaderSource); - assignFunction(glShaderSource); - assignFunction(glCompileShader); - assignFunction(glLinkProgram); - assignFunction(glGetProgramInfoLog); - assignFunction(glDeleteProgram); - assignFunction(glCreateProgram); - assignFunction(glAttachShader); - assignFunction(glDetachShader); - assignFunction(glGetAttachedShaders); - assignFunction(glGetUniformLocation); - assignFunction(glGetActiveUniform); - assignFunction(glGetProgramiv); - assignFunction(glUseProgram); - assignFunction(glValidateProgram); - assignFunction(glGetAttribLocation); - assignFunction(glUniform1f); - assignFunction(glUniform2f); - assignFunction(glUniform3f); - assignFunction(glUniform4f); - - if (is30 || supportExtension("GL_EXT_gpu_shader4")) - { - logger->log1("found GL_EXT_gpu_shader4"); - assignFunction(glBindFragDataLocation); - } - else - { - mSupportModernOpengl = false; - logger->log1("GL_EXT_gpu_shader4 not supported"); - } - if (is41 || supportExtension("GL_ARB_separate_shader_objects")) - { - logger->log1("found GL_ARB_separate_shader_objects"); - assignFunction(glProgramUniform1f); - assignFunction(glProgramUniform2f); - assignFunction(glProgramUniform3f); - assignFunction(glProgramUniform4f); - } - else - { - logger->log1("GL_ARB_separate_shader_objects not supported"); - } - if (is43 || supportExtension("GL_ARB_vertex_attrib_binding")) - { - logger->log1("found GL_ARB_vertex_attrib_binding"); - assignFunction(glBindVertexBuffer); - assignFunction(glVertexAttribBinding); - assignFunction(glVertexAttribFormat); - assignFunction(glVertexAttribIFormat); - } - else - { - mSupportModernOpengl = false; - logger->log1("GL_ARB_vertex_attrib_binding not supported"); - } - if (is44 || supportExtension("GL_ARB_multi_bind")) - { - logger->log1("found GL_ARB_multi_bind"); - assignFunction(glBindVertexBuffers); - } - else - { - logger->log1("GL_ARB_multi_bind not supported"); - } - } - else - { - mSupportModernOpengl = false; - logger->log1("shaders not supported"); - } - -#ifdef WIN32 - assignFunctionARB(wglGetExtensionsString); -#endif // WIN32 -#endif // __native_client__ -} - -void GraphicsManager::updateLimits() -{ - GLint value = 0; -#ifdef __native_client__ - mMaxVertices = 500; -#else // __native_client__ - - glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &value); - logger->log("GL_MAX_ELEMENTS_VERTICES: %d", value); - - mMaxVertices = value; - - value = 0; - glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &value); - logger->log("GL_MAX_ELEMENTS_INDICES: %d", value); - if (value < mMaxVertices) - mMaxVertices = value; - if (!mMaxVertices) - { - logger->log("Got 0 max amount of vertices or indicies. " - "Overriding to 500"); - mMaxVertices = 500; - } -#endif // __native_client__ - - value = 0; - glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value); - logger->log("Max FBO size: %d", value); - mMaxFboSize = value; -} - -void GraphicsManager::initOpenGL() -{ - setGLVersion(); - updateExtensions(); - initOpenGLFunctions(); - updatePlanformExtensions(); - updateDebugLog(); - createTextureSampler(); - updateLimits(); -} - -void GraphicsManager::createTextureSampler() -{ - GLenum err = getLastError(); - if (err) - logger->log(errorToString(err)); - if (mUseTextureSampler) - { - logger->log1("using texture sampler"); - mglGenSamplers(1, &mTextureSampler); - if (getLastError() != GL_NO_ERROR) - { - mUseTextureSampler = false; - logger->log1("texture sampler error"); - OpenGLImageHelper::setUseTextureSampler(mUseTextureSampler); - return; - } - OpenGLImageHelper::initTextureSampler(mTextureSampler); - mglBindSampler(0, mTextureSampler); - if (getLastError() != GL_NO_ERROR) - { - mUseTextureSampler = false; - logger->log1("texture sampler error"); - } - } - OpenGLImageHelper::setUseTextureSampler(mUseTextureSampler); -#ifndef ANDROID - SafeOpenGLImageHelper::setUseTextureSampler(false); -#endif // ANDROID -} - -GLenum GraphicsManager::getLastError() -{ - GLenum tmp = glGetError(); - GLenum error = GL_NO_ERROR; - while (tmp != GL_NO_ERROR) - { - error = tmp; - mLastError = tmp; - tmp = glGetError(); - } - return error; -} - -std::string GraphicsManager::errorToString(const GLenum error) -{ - if (error) - { - std::string errmsg("Unknown error"); - switch (error) - { - case GL_INVALID_ENUM: - errmsg = "GL_INVALID_ENUM"; - break; - case GL_INVALID_VALUE: - errmsg = "GL_INVALID_VALUE"; - break; - case GL_INVALID_OPERATION: - errmsg = "GL_INVALID_OPERATION"; - break; - case GL_STACK_OVERFLOW: - errmsg = "GL_STACK_OVERFLOW"; - break; - case GL_STACK_UNDERFLOW: - errmsg = "GL_STACK_UNDERFLOW"; - break; - case GL_OUT_OF_MEMORY: - errmsg = "GL_OUT_OF_MEMORY"; - break; - default: - break; - } - return "OpenGL error: " + errmsg; - } - return ""; -} - -void GraphicsManager::logError() -{ - const GLenum error = GraphicsManager::getLastError(); - if (error != GL_NO_ERROR) - logger->log(errorToString(error)); -} - -void GraphicsManager::detectVideoSettings() -{ - config.setValue("videodetected", true); - TestMain *const test = startDetection(); - - if (test) - { - const Configuration &conf = test->getConfig(); - int val = conf.getValueInt("opengl", -1); - if (val >= 0 && val < CAST_S32(RENDER_LAST)) - { - config.setValue("opengl", val); - val = conf.getValue("useTextureSampler", -1); - if (val != -1) - config.setValue("useTextureSampler", val); - val = conf.getValue("compresstextures", -1); - if (val != -1) - config.setValue("compresstextures", val); - } - config.setValue("textureSize", conf.getValue("textureSize", - "1024,1024,1024,1024,1024,1024")); - config.setValue("testInfo", conf.getValue("testInfo", "")); - config.setValue("sound", conf.getValue("sound", 0)); - delete test; - } -} - -static CALLBACK void debugCallback(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei length, - const GLchar *text, GLvoid *userParam A_UNUSED) -{ - std::string message("OPENGL:"); - switch (source) - { - case GL_DEBUG_SOURCE_API: - message.append(" API"); - break; - case GL_DEBUG_SOURCE_WINDOW_SYSTEM: - message.append(" WM"); - break; - case GL_DEBUG_SOURCE_SHADER_COMPILER: - message.append(" SHADERS"); - break; - case GL_DEBUG_SOURCE_THIRD_PARTY: - message.append(" THIRD_PARTY"); - break; - case GL_DEBUG_SOURCE_APPLICATION: - message.append(" APP"); - break; - case GL_DEBUG_SOURCE_OTHER: - message.append(" OTHER"); - break; - default: - message.append(" ?").append(toString(source)); - break; - } - switch (type) - { - case GL_DEBUG_TYPE_ERROR: - message.append(" ERROR"); - break; - case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: - message.append(" DEPRECATED"); - break; - case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: - message.append(" UNDEFINED"); - break; - case GL_DEBUG_TYPE_PORTABILITY: - message.append(" PORTABILITY"); - break; - case GL_DEBUG_TYPE_PERFORMANCE: - message.append(" PERFORMANCE"); - break; - case GL_DEBUG_TYPE_OTHER: - message.append(" OTHER"); - break; - case GL_DEBUG_TYPE_MARKER: - message.append(" MARKER"); - break; - case GL_DEBUG_TYPE_PUSH_GROUP: - message.append(" PUSH GROUP"); - break; - case GL_DEBUG_TYPE_POP_GROUP: - message.append(" POP GROUP"); - break; - default: - message.append(" ?").append(toString(type)); - break; - } - message.append(" ").append(toString(id)); - switch (severity) - { - case GL_DEBUG_SEVERITY_NOTIFICATION: - message.append(" N"); - break; - case GL_DEBUG_SEVERITY_HIGH: - message.append(" H"); - break; - case GL_DEBUG_SEVERITY_MEDIUM: - message.append(" M"); - break; - case GL_DEBUG_SEVERITY_LOW: - message.append(" L"); - break; - default: - message.append(" ?").append(toString(type)); - break; - } - char *const buf = new char[CAST_SIZE(length + 1)]; - memcpy(buf, text, length); - buf[length] = 0; - message.append(" ").append(buf); - delete [] buf; - logger->log(message); -} - -void GraphicsManager::updateDebugLog() const -{ - if (mSupportDebug && config.getIntValue("debugOpenGL")) - { - logger->log1("Enable OpenGL debug log"); - glEnable(GL_DEBUG_OUTPUT); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - - mglDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, - 0, nullptr, GL_TRUE); - mglDebugMessageCallback(&debugCallback, this); - } -} -#endif // USE_OPENGL - -void GraphicsManager::detectPixelSize() -{ - SDL_SysWMinfo info; - SDL_VERSION(&info.version); - if (SDL::getWindowWMInfo(mainGraphics->getWindow(), &info)) - { -#ifdef WIN32 - HDC hdc = GetDC(info.window); - if (hdc) - { -// SetProcessDPIAware(); - mMaxWidth = GetDeviceCaps(hdc, HORZRES); - mMaxHeight = GetDeviceCaps(hdc, VERTRES); - mWidthMM = GetDeviceCaps(hdc, HORZSIZE); - mHeightMM = GetDeviceCaps(hdc, VERTSIZE); - } -#elif defined USE_X11 - Display *const display = info.info.x11.display; - if (display) - { - Screen *const screen = XDefaultScreenOfDisplay(display); - if (!screen) - return; - - const int screenNum = XScreenNumberOfScreen(screen); - mMaxWidth = DisplayWidth(display, screenNum); - mMaxHeight = DisplayHeight(display, screenNum); - mWidthMM = DisplayWidthMM(display, screenNum); - mHeightMM = DisplayHeightMM(display, screenNum); - } -#endif // WIN32 - } -#if defined ANDROID -#ifdef USE_SDL2 - const int dpi = atoi(getenv("DISPLAY_DPI")); - if (dpi <= 120) - mDensity = 0; - else if (dpi <= 160) - mDensity = 1; - else if (dpi <= 213) - mDensity = 2; - else if (dpi <= 240) - mDensity = 3; - else if (dpi <= 320) - mDensity = 4; -// else if (dpi <= 480) - else - mDensity = 5; - mMaxWidth = atoi(getenv("DISPLAY_RESOLUTION_WIDTH")); - mMaxHeight = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT")); - mWidthMM = atoi(getenv("DISPLAY_WIDTH_MM")); - mHeightMM = atoi(getenv("DISPLAY_HEIGHT_MM")); -#else // USE_SDL2 - - SDL_ANDROID_GetMetrics(&mMaxWidth, &mMaxHeight, - &mWidthMM, &mHeightMM, &mDensity); -#endif // USE_SDL2 -#endif // defined ANDROID - - logger->log("screen size in pixels: %ux%u", mMaxWidth, mMaxHeight); - logger->log("screen size in millimeters: %ux%u", mWidthMM, mHeightMM); - logger->log("actual screen density: " + getDensityString()); - const int density = config.getIntValue("screenDensity"); - if (density > 0 && density <= densitySize) - { - mDensity = density - 1; - logger->log("selected screen density: " + getDensityString()); - } -} - -std::string GraphicsManager::getDensityString() const -{ - if (mDensity >= 0 && mDensity < densitySize) - return densityNames[mDensity]; - return ""; -} diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h deleted file mode 100644 index 6d0777d27..000000000 --- a/src/graphicsmanager.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GRAPHICSMANAGER_H -#define GRAPHICSMANAGER_H - -#include "localconsts.h" - -#ifdef USE_OPENGL -#ifdef ANDROID -#include -#else // ANDROID -#ifndef USE_SDL2 -#define GL_GLEXT_PROTOTYPES 1 -#endif // USE_SDL2 -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) -// hack to hide warnings -#undef GL_GLEXT_VERSION -#undef GL_GLEXT_PROTOTYPES -#endif // ANDROID - -#endif // USE_OPENGL - -#include "sdlshared.h" - -#include "utils/stringvector.h" - -#include - -class TestMain; - -struct FBOInfo; -#ifdef USE_SDL2 -struct SDL_Renderer; -#endif // USE_SDL2 -struct SDL_Window; - -class GraphicsManager final -{ - public: - GraphicsManager(); - - A_DELETE_COPY(GraphicsManager) - - ~GraphicsManager(); - - void createRenderers(); - - static void deleteRenderers(); - - void initGraphics(); - - static void setVideoMode(); - - SDL_Window *createWindow(const int w, const int h, - const int bpp, const int flags); - -#ifdef USE_SDL2 - SDL_Renderer *createRenderer(SDL_Window *const window, - const int flags); -#endif // USE_SDL2 - - bool getAllVideoModes(StringVect &modeList); - - void detectPixelSize(); - - std::string getDensityString() const; - - int getDensity() const - { return mDensity; } - -#ifdef USE_OPENGL - TestMain *startDetection() A_WARN_UNUSED; - - int detectGraphics() A_WARN_UNUSED; - - bool supportExtension(const std::string &ext) const A_WARN_UNUSED; - - static void updateTextureFormat(); - - void updateTextureCompressionFormat() const; - - bool checkGLVersion(const int major, const int minor) - const A_WARN_UNUSED; - - bool checkGLesVersion(const int major, const int minor) - const A_WARN_UNUSED; - - bool checkSLVersion(const int major, const int minor) - const A_WARN_UNUSED; - - bool checkPlatformVersion(const int major, const int minor) - const A_WARN_UNUSED; - - static void createFBO(const int width, const int height, - FBOInfo *const fbo); - - static void deleteFBO(FBOInfo *const fbo); - - void initOpenGLFunctions(); - - void updateExtensions(); - - void updatePlanformExtensions(); - - void initOpenGL(); - - void updateLimits(); - - int getMaxVertices() const noexcept2 A_WARN_UNUSED - { return mMaxVertices; } - - bool getUseAtlases() const noexcept2 A_WARN_UNUSED - { return mUseAtlases; } - - void logVersion() const; - - void setGLVersion(); - - static std::string getGLString(const int num) A_WARN_UNUSED; - - static void logString(const char *const format, - const int num) A_NONNULL(1); - - void detectVideoSettings(); - - void createTextureSampler(); - - bool isUseTextureSampler() const noexcept2 A_WARN_UNUSED - { return mUseTextureSampler; } - - static GLenum getLastError(); - - static std::string errorToString(const GLenum error) A_WARN_UNUSED; - - static void logError(); - - void updateDebugLog() const; - - std::string getGLVersion() const - { return mGlVersionString; } - - static GLenum getLastErrorCached() - { return mLastError; } - - constexpr2 static void resetCachedError() noexcept2 - { mLastError = GL_NO_ERROR; } -#endif // USE_OPENGL - - private: - std::set mExtensions; - - std::set mPlatformExtensions; - - std::string mGlVersionString; - - std::string mGlVendor; - - std::string mGlRenderer; - - std::string mGlShaderVersionString; -#ifdef USE_OPENGL - static GLenum mLastError; -#endif // USE_OPENGL - - int mMinor; - - int mMajor; - - int mSLMinor; - - int mSLMajor; - - int mPlatformMinor; - - int mPlatformMajor; - - int mMaxVertices; - - int mMaxFboSize; - - uint32_t mMaxWidth; - - uint32_t mMaxHeight; - - uint32_t mWidthMM; - - uint32_t mHeightMM; - - int32_t mDensity; - -#ifdef USE_OPENGL - bool mUseTextureSampler; - - GLuint mTextureSampler; - - int mSupportDebug; - - bool mSupportModernOpengl; - - bool mGles; -#endif // USE_OPENGL - - bool mUseAtlases; -}; - -extern GraphicsManager graphicsManager; - -#endif // GRAPHICSMANAGER_H diff --git a/src/gui/browserlink.h b/src/gui/browserlink.h deleted file mode 100644 index a8dc0cb6f..000000000 --- a/src/gui/browserlink.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * 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 . - */ - -#ifndef GUI_BROWSERLINK_H -#define GUI_BROWSERLINK_H - -#include - -#include "localconsts.h" - -struct BrowserLink final -{ - BrowserLink() : - x1(0), - x2(0), - y1(0), - y2(0), - link(), - caption() - { - } - - A_DEFAULT_COPY(BrowserLink) - - int x1; - int x2; - int y1; - int y2; - std::string link; - std::string caption; -}; - -#endif // GUI_BROWSERLINK_H diff --git a/src/gui/buttoninfo.h b/src/gui/buttoninfo.h deleted file mode 100644 index d6039e08f..000000000 --- a/src/gui/buttoninfo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_BUTTONINFO_H -#define GUI_BUTTONINFO_H - -#include "enums/input/inputaction.h" - -#include "enums/simpletypes/visible.h" - -#include "localconsts.h" - -class Button; - -struct ButtonInfo final -{ - ButtonInfo(Button *const button0, - const InputActionT key0, - const Visible visible0) : - button(button0), - key(key0), - visible(visible0) - { - } - - A_DELETE_COPY(ButtonInfo) - - Button *button; - InputActionT key; - Visible visible; -}; -#endif // GUI_BUTTONINFO_H diff --git a/src/gui/buttontext.h b/src/gui/buttontext.h deleted file mode 100644 index f827859b6..000000000 --- a/src/gui/buttontext.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_BUTTONTEXT_H -#define GUI_BUTTONTEXT_H - -#include "enums/input/inputaction.h" - -#include "localconsts.h" - -#include - -struct ButtonText final -{ - ButtonText(const std::string &text0, - const InputActionT key0) : - text(text0), - key(key0) - { - } - - A_DELETE_COPY(ButtonText) - - std::string text; - InputActionT key; -}; - -#endif // GUI_BUTTONTEXT_H diff --git a/src/gui/chatlog.h b/src/gui/chatlog.h deleted file mode 100644 index 20820ad13..000000000 --- a/src/gui/chatlog.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_CHATLOG_H -#define GUI_CHATLOG_H - -#include "enums/gui/chatmsgtype.h" - -#include - -#include "localconsts.h" - -/** One item in the chat log */ -struct CHATLOG final -{ - CHATLOG() : - nick(), - text(), - own(ChatMsgType::BY_UNKNOWN) - { - } - - A_DELETE_COPY(CHATLOG) - - std::string nick; - std::string text; - ChatMsgTypeT own; -}; -#endif // GUI_CHATLOG_H diff --git a/src/gui/cliprect.h b/src/gui/cliprect.h deleted file mode 100644 index 149420b8c..000000000 --- a/src/gui/cliprect.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_CLIPRECT_H -#define GUI_CLIPRECT_H - -#include "gui/rect.h" - -#include "localconsts.h" - -/** - * A rectangle used when dealing with clipping. A clip rectangle is - * a regular rectangle extended with variables for x offsets and y - * offsets. The offsets are used for calculations from relative - * screen coordinates to actual screen coordinates. - */ -class ClipRect final : public Rect -{ - public: - /** - * Constructor. - */ - ClipRect() : - Rect(0, 0, 0, 0), - xOffset(0), - yOffset(0) - { - } - - /** - * Constructor. - * - * @param x0 The rectangle x coordinate. - * @param y0 The rectangle y coordinate. - * @param width0 The rectangle width. - * @param height0 The rectangle height. - * @param xOffset0 The offset of the x coordinate. Used to for - * calculating the actual screen coordinate from - * the relative screen coordinate. - * @param yOffset0 The offset of the y coordinate. Used to for - * calculating the actual screen coordinate from - * the relative screen coordinate. - */ - ClipRect(const int x0, - const int y0, - const int width0, - const int height0, - const int xOffset0, - const int yOffset0) : - Rect(x0, y0, width0, height0), - xOffset(xOffset0), - yOffset(yOffset0) - { - } - - A_DELETE_COPY(ClipRect) - - /** - * Holds the x offset of the x coordinate. - */ - int xOffset; - - /** - * Holds the y offset of the y coordinate. - */ - int yOffset; -}; - -#endif // GUI_CLIPRECT_H diff --git a/src/gui/color.h b/src/gui/color.h deleted file mode 100644 index c4a1aab01..000000000 --- a/src/gui/color.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_COLOR_H -#define GUI_COLOR_H - -#include "utils/cast.h" - -#include "localconsts.h" - -/** - * Represents a color with red, green, blue and alpha components. - */ -class Color final -{ - public: - /** - * Constructor. Initializes the color to black. - */ - constexpr Color() : - r(0U), - g(0U), - b(0U), - a(255U) - { - } - - /** - * Constructor. Constructs a color from the bytes in an integer. - * Call it with a hexadecimal constant for HTML-style color - * representation. - * The alpha component is 255 by default. - * - * EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color. - * - * NOTE: Because of this constructor, integers will be automatically - * casted to a color by your compiler. - * - * @param color The color to initialise the object with. - */ - explicit constexpr Color(const unsigned int color) : - r((color >> 16) & 0xFFU), - g((color >> 8) & 0xFFU), - b(color & 0xFFU), - a(255U) - { - } - - /** - * Constructor. The default alpha value is 255. - * - * @param ar Red color component (range 0-255). - * @param ag Green color component (range 0-255). - * @param ab Blue color component (range 0-255). - * @param aa Alpha, used for transparency. A value of 0 means - * totaly transparent, 255 is totaly opaque. - */ - constexpr Color(const unsigned int ar, - const unsigned int ag, - const unsigned int ab, - const unsigned int aa = 255) : - r(ar), - g(ag), - b(ab), - a(aa) - { - } - - - A_DEFAULT_COPY(Color) - - /** - * Adds the RGB values of two colors together. The values will be - * clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to add to this color. - * @return The added colors with an alpha value set to 255. - */ - constexpr2 Color operator+(const Color& color) const - { - Color result(r + color.r, - g + color.g, - b + color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - /** - * Subtracts the RGB values of one color from another. - * The values will be clamped if they go out of range. - * - * WARNING: This function will reset the alpha value of the - * returned color to 255. - * - * @param color A color to subtract from this color. - * @return The subtracted colors with an alpha value set to 255. - */ - constexpr2 Color operator-(const Color& color) const - { - Color result(r - color.r, - g - color.g, - b - color.b, - 255U); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - /** - * Multiplies the RGB values of a color with a float value. - * The values will be clamped if they go out of range. - * - * @param value The value to multiply the color with. - * @return The multiplied colors. The alpha value will, unlike - * the add and subtract operations, be multiplied as - * well. - */ - constexpr2 Color operator*(const float value) const - { - Color result(CAST_U32(static_cast(r) * value), - CAST_U32(static_cast(g) * value), - CAST_U32(static_cast(b) * value), - a); - - result.r = (result.r > 255U ? 255U : result.r); - result.g = (result.g > 255U ? 255U : result.g); - result.b = (result.b > 255U ? 255U : result.b); - - return result; - } - - /** - * Compares two colors. - * - * @return True if the two colors have the same RGBA components - * false otherwise. - */ - constexpr bool operator==(const Color& color) const - { - return r == color.r && - g == color.g && - b == color.b && - a == color.a; - } - - /** - * Compares two colors. - * - * @return True if the two colors have different RGBA components, - * false otherwise. - */ - constexpr bool operator!=(const Color& color) const - { - return !(r == color.r && - g == color.g && - b == color.b && - a == color.a); - } - - /** - * Holds the red color component (range 0-255). - */ - unsigned int r; - - /** - * Holds the green color component (range 0-255). - */ - unsigned int g; - - /** - * Holds the blue color component (range 0-255). - */ - unsigned int b; - - /** - * Holds the alpha color component. A value of 0 means totally - * transparent while a value of 255 is considered opaque. - */ - unsigned int a; -}; - -#endif // GUI_COLOR_H diff --git a/src/gui/colorpair.h b/src/gui/colorpair.h deleted file mode 100644 index f3089868e..000000000 --- a/src/gui/colorpair.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_COLORPAIR_H -#define GUI_COLORPAIR_H - -#include "localconsts.h" - -class Color; - -struct ColorPair final -{ - constexpr ColorPair(const Color *const c1, - const Color *const c2) : - color1(c1), - color2(c2) - { - } - - A_DEFAULT_COPY(ColorPair) - - const Color *color1; - const Color *color2; -}; - -#endif // GUI_COLORPAIR_H diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp deleted file mode 100644 index f24352a43..000000000 --- a/src/gui/dialogsmanager.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/dialogsmanager.h" - -#include "configuration.h" -#include "settings.h" - -#include "being/playerinfo.h" - -#include "gui/widgets/createwidget.h" - -#include "gui/windows/confirmdialog.h" - -#ifndef DYECMD -#include "gui/widgets/selldialog.h" - -#include "gui/windows/buyselldialog.h" -#include "gui/windows/buydialog.h" -#include "gui/windows/updaterwindow.h" - -#include "listeners/playerpostdeathlistener.h" -#endif // DYECMD - -#include "listeners/weightlistener.h" - -#include "net/inventoryhandler.h" - -#include "resources/db/deaddb.h" - -#include "utils/gettext.h" - -#include "debug.h" - -#ifdef WIN32 -#undef ERROR -#endif // WIN32 - -OkDialog *deathNotice = nullptr; -DialogsManager *dialogsManager = nullptr; -OkDialog *weightNotice = nullptr; -time_t weightNoticeTime = 0; - -#ifndef DYECMD -namespace -{ - PlayerPostDeathListener postDeathListener; - WeightListener weightListener; -} // namespace -#endif // DYECMD - -DialogsManager::DialogsManager() : - AttributeListener(), - PlayerDeathListener() -{ -} - -void DialogsManager::closeDialogs() -{ -#ifndef DYECMD - NpcDialog::clearDialogs(); - BuyDialog::closeAll(); - BuySellDialog::closeAll(); - NpcDialog::closeAll(); - SellDialog::closeAll(); - if (inventoryHandler != nullptr) - inventoryHandler->destroyStorage(); -#endif // DYECMD - - if (deathNotice != nullptr) - { - deathNotice->scheduleDelete(); - deathNotice = nullptr; - } -} - -void DialogsManager::createUpdaterWindow() -{ -#ifndef DYECMD - CREATEWIDGETV(updaterWindow, UpdaterWindow, - settings.updateHost, - settings.oldUpdates, - false, - UpdateType::Normal); -#endif // DYECMD -} - -Window *DialogsManager::openErrorDialog(const std::string &header, - const std::string &message, - const Modal modal) -{ - if (settings.supportUrl.empty() || config.getBoolValue("hidesupport")) - { - OkDialog *const dialog = CREATEWIDGETR(OkDialog, - header, - message, - // TRANSLATORS: ok dialog button - _("Close"), - DialogType::ERROR, - modal, - ShowCenter_true, - nullptr, - 260); - return dialog; - } - ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog, - header, - strprintf("%s %s", message.c_str(), - // TRANSLATORS: error message question - _("Do you want to open support page?")), - SOUND_ERROR, - false, - modal); - return dialog; -} - -void DialogsManager::playerDeath() -{ -#ifndef DYECMD - if (deathNotice == nullptr) - { - CREATEWIDGETV(deathNotice, OkDialog, - // TRANSLATORS: message header - _("Message"), - DeadDB::getRandomString(), - // TRANSLATORS: ok dialog button - _("Revive"), - DialogType::OK, - Modal_false, - ShowCenter_true, - nullptr, - 260); - deathNotice->addActionListener(&postDeathListener); - } -#endif // DYECMD -} - -#ifndef DYECMD -void DialogsManager::attributeChanged(const AttributesT id, - const int64_t oldVal, - const int64_t newVal) -{ - if (id == Attributes::TOTAL_WEIGHT) - { - if ((weightNotice == nullptr) && config.getBoolValue("weightMsg")) - { - int percent = settings.overweightPercent; - if (percent < 1) - percent = 50; - const int max = PlayerInfo::getAttribute( - Attributes::MAX_WEIGHT) * percent / 100; - const int total = CAST_S32(oldVal); - if (newVal >= max && total < max) - { - weightNoticeTime = cur_time + 5; - CREATEWIDGETV(weightNotice, OkDialog, - // TRANSLATORS: message header - _("Message"), - // TRANSLATORS: weight message - _("You are carrying more than " - "half your weight. You are " - "unable to regain health."), - // TRANSLATORS: ok dialog button - _("OK"), - DialogType::OK, - Modal_false, - ShowCenter_true, - nullptr, - 260); - weightNotice->addActionListener( - &weightListener); - } - else if (newVal < max && total >= max) - { - weightNoticeTime = cur_time + 5; - CREATEWIDGETV(weightNotice, OkDialog, - // TRANSLATORS: message header - _("Message"), - // TRANSLATORS: weight message - _("You are carrying less than " - "half your weight. You " - "can regain health."), - // TRANSLATORS: ok dialog button - _("OK"), - DialogType::OK, - Modal_false, - ShowCenter_true, - nullptr, - 260); - weightNotice->addActionListener( - &weightListener); - } - } - } -} -#else // DYECMD - -void DialogsManager::attributeChanged(const AttributesT id A_UNUSED, - const int64_t oldVal A_UNUSED, - const int64_t newVal A_UNUSED) -{ -} -#endif // DYECMD diff --git a/src/gui/dialogsmanager.h b/src/gui/dialogsmanager.h deleted file mode 100644 index 04ace68e2..000000000 --- a/src/gui/dialogsmanager.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_DIALOGSMANAGER_H -#define GUI_DIALOGSMANAGER_H - -#include "enums/simpletypes/modal.h" - -#include "listeners/attributelistener.h" -#include "listeners/playerdeathlistener.h" - -#include - -#include "localconsts.h" - -class Window; - -class DialogsManager final : public AttributeListener, - public PlayerDeathListener -{ - public: - DialogsManager(); - - virtual ~DialogsManager() - { } - - A_DELETE_COPY(DialogsManager) - - static void closeDialogs(); - - static void createUpdaterWindow(); - - static Window *openErrorDialog(const std::string &header, - const std::string &message, - const Modal modal) RETURNS_NONNULL; - - void playerDeath() override final; - - void attributeChanged(const AttributesT id, - const int64_t oldVal, - const int64_t newVal) override final; -}; - -extern DialogsManager *dialogsManager; - -#endif // GUI_DIALOGSMANAGER_H diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp deleted file mode 100644 index ebfc988ac..000000000 --- a/src/gui/focushandler.cpp +++ /dev/null @@ -1,621 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gui/focushandler.h" - -#include "gui/gui.h" - -#include "gui/widgets/window.h" - -#include "listeners/focuslistener.h" - -#include "utils/foreach.h" - -#include "debug.h" - -FocusHandler::FocusHandler() : - mWidgets(), - mFocusedWidget(nullptr), - mModalFocusedWidget(nullptr), - mModalMouseInputFocusedWidget(nullptr), - mDraggedWidget(nullptr), - mLastWidgetWithMouse(nullptr), - mLastWidgetWithModalFocus(nullptr), - mLastWidgetWithModalMouseInputFocus(nullptr), - mLastWidgetPressed(nullptr), - mModalStack() -{ -} - -void FocusHandler::requestModalFocus(Widget *const widget) -{ - /* If there is another widget with modal focus, remove its modal focus - * and put it on the modal widget stack. - */ - if ((mModalFocusedWidget != nullptr) && mModalFocusedWidget != widget) - { - mModalStack.push_front(mModalFocusedWidget); - mModalFocusedWidget = nullptr; - } - - mModalFocusedWidget = widget; - if ((mFocusedWidget != nullptr) && !mFocusedWidget->isModalFocused()) - focusNone(); -} - -void FocusHandler::releaseModalFocus(Widget *const widget) -{ - mModalStack.remove(widget); - - if (mModalFocusedWidget == widget) - { - mModalFocusedWidget = nullptr; - - /* Check if there were any previously modal widgets that'd still like - * to regain their modal focus. - */ - if (!mModalStack.empty()) - { - requestModalFocus(mModalStack.front()); - mModalStack.pop_front(); - } - } -} - -void FocusHandler::remove(Widget *const widget) -{ - releaseModalFocus(widget); - - if (isFocused(widget)) - mFocusedWidget = nullptr; - - FOR_EACH (WidgetIterator, iter, mWidgets) - { - if ((*iter) == widget) - { - mWidgets.erase(iter); - break; - } - } - - if (mDraggedWidget == widget) - { - mDraggedWidget = nullptr; - return; - } - - if (mLastWidgetWithMouse == widget) - { - mLastWidgetWithMouse = nullptr; - return; - } - - if (mLastWidgetWithModalFocus == widget) - { - mLastWidgetWithModalFocus = nullptr; - return; - } - - if (mLastWidgetWithModalMouseInputFocus == widget) - { - mLastWidgetWithModalMouseInputFocus = nullptr; - return; - } - - if (mLastWidgetPressed == widget) - { - mLastWidgetPressed = nullptr; - return; - } -} - -void FocusHandler::tabNext() -{ - if (mFocusedWidget != nullptr) - { - if (!mFocusedWidget->isTabOutEnabled()) - return; - } - - if (mWidgets.empty()) - { - mFocusedWidget = nullptr; - return; - } - - int i; - int focusedWidget = -1; - const int sz = CAST_S32(mWidgets.size()); - for (i = 0; i < sz; ++ i) - { - if (mWidgets[i] == mFocusedWidget) - focusedWidget = i; - } - const int focused = focusedWidget; - bool done = false; - - // i is a counter that ensures that the following loop - // won't get stuck in an infinite loop - i = sz; - do - { - ++ focusedWidget; - - if (i == 0) - { - focusedWidget = -1; - break; - } - - -- i; - - if (focusedWidget >= sz) - focusedWidget = 0; - - if (focusedWidget == focused) - return; - - const Widget *const widget = mWidgets.at(focusedWidget); - if (widget->isFocusable() && widget->isTabInEnabled() && - ((mModalFocusedWidget == nullptr) || widget->isModalFocused())) - { - done = true; - } - } - while (!done); - - if (focusedWidget >= 0) - { - mFocusedWidget = mWidgets.at(focusedWidget); - Event focusEvent(mFocusedWidget); - distributeFocusGainedEvent(focusEvent); - } - - if (focused >= 0) - { - Event focusEvent(mWidgets.at(focused)); - distributeFocusLostEvent(focusEvent); - } - - checkForWindow(); -} - -void FocusHandler::tabPrevious() -{ - if (mFocusedWidget != nullptr) - { - if (!mFocusedWidget->isTabOutEnabled()) - return; - } - - if (mWidgets.empty()) - { - mFocusedWidget = nullptr; - return; - } - - int i; - int focusedWidget = -1; - const int sz = CAST_S32(mWidgets.size()); - for (i = 0; i < sz; ++ i) - { - if (mWidgets[i] == mFocusedWidget) - focusedWidget = i; - } - const int focused = focusedWidget; - bool done = false; - - // i is a counter that ensures that the following loop - // won't get stuck in an infinite loop - i = sz; - do - { - -- focusedWidget; - - if (i == 0) - { - focusedWidget = -1; - break; - } - - -- i; - - if (focusedWidget <= 0) - focusedWidget = sz - 1; - - if (focusedWidget == focused) - return; - - const Widget *const widget = mWidgets.at(focusedWidget); - if (widget->isFocusable() && widget->isTabInEnabled() && - ((mModalFocusedWidget == nullptr) || widget->isModalFocused())) - { - done = true; - } - } - while (!done); - - if (focusedWidget >= 0) - { - mFocusedWidget = mWidgets.at(focusedWidget); - Event focusEvent(mFocusedWidget); - distributeFocusGainedEvent(focusEvent); - } - - if (focused >= 0) - { - Event focusEvent(mWidgets.at(focused)); - distributeFocusLostEvent(focusEvent); - } - - checkForWindow(); -} - -void FocusHandler::checkForWindow() const -{ - if (mFocusedWidget != nullptr) - { - Widget *widget = mFocusedWidget->getParent(); - - while (widget != nullptr) - { - Window *const window = dynamic_cast(widget); - - if (window != nullptr) - { - window->requestMoveToTop(); - break; - } - - widget = widget->getParent(); - } - } -} - -void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent) -{ - if (gui != nullptr) - gui->distributeGlobalFocusGainedEvent(focusEvent); - - const Widget *const sourceWidget = focusEvent.getSource(); - - if (sourceWidget == nullptr) - return; - std::list focusListeners - = sourceWidget->getFocusListeners(); - - // Send the event to all focus listeners of the widget. - for (std::list::const_iterator - it = focusListeners.begin(); - it != focusListeners.end(); - ++ it) - { - (*it)->focusGained(focusEvent); - } -} - -void FocusHandler::requestFocus(const Widget *const widget) -{ - if ((widget == nullptr) || widget == mFocusedWidget) - return; - - int toBeFocusedIndex = -1; - for (unsigned int i = 0, fsz = CAST_U32( - mWidgets.size()); i < fsz; ++i) - { - if (mWidgets[i] == widget) - { - toBeFocusedIndex = i; - break; - } - } - - if (toBeFocusedIndex < 0) - return; - - Widget *const oldFocused = mFocusedWidget; - - if (oldFocused != widget) - { - mFocusedWidget = mWidgets.at(toBeFocusedIndex); - - if (oldFocused != nullptr) - { - Event focusEvent(oldFocused); - distributeFocusLostEvent(focusEvent); - } - - Event focusEvent(mWidgets.at(toBeFocusedIndex)); - distributeFocusGainedEvent(focusEvent); - } -} - -void FocusHandler::requestModalMouseInputFocus(Widget *const widget) -{ - if ((mModalMouseInputFocusedWidget != nullptr) - && mModalMouseInputFocusedWidget != widget) - { - return; - } - - mModalMouseInputFocusedWidget = widget; -} - -void FocusHandler::releaseModalMouseInputFocus(const Widget *const widget) -{ - if (mModalMouseInputFocusedWidget == widget) - mModalMouseInputFocusedWidget = nullptr; -} - -Widget* FocusHandler::getFocused() const -{ - return mFocusedWidget; -} - -Widget* FocusHandler::getModalFocused() const -{ - return mModalFocusedWidget; -} - -Widget* FocusHandler::getModalMouseInputFocused() const -{ - return mModalMouseInputFocusedWidget; -} - -void FocusHandler::focusNext() -{ - int i; - int focusedWidget = -1; - const int sz = CAST_S32(mWidgets.size()); - for (i = 0; i < sz; ++i) - { - if (mWidgets[i] == mFocusedWidget) - focusedWidget = i; - } - const int focused = focusedWidget; - - // i is a counter that ensures that the following loop - // won't get stuck in an infinite loop - i = sz; - do - { - ++ focusedWidget; - - if (i == 0) - { - focusedWidget = -1; - break; - } - - -- i; - - if (focusedWidget >= sz) - focusedWidget = 0; - - if (focusedWidget == focused) - return; - } - while (!mWidgets.at(focusedWidget)->isFocusable()); - - if (focusedWidget >= 0) - { - mFocusedWidget = mWidgets.at(focusedWidget); - - Event focusEvent(mFocusedWidget); - distributeFocusGainedEvent(focusEvent); - } - - if (focused >= 0) - { - Event focusEvent(mWidgets.at(focused)); - distributeFocusLostEvent(focusEvent); - } -} - -void FocusHandler::focusPrevious() -{ - if (mWidgets.empty()) - { - mFocusedWidget = nullptr; - return; - } - - int i; - int focusedWidget = -1; - const int sz = CAST_S32(mWidgets.size()); - for (i = 0; i < sz; ++ i) - { - if (mWidgets[i] == mFocusedWidget) - focusedWidget = i; - } - const int focused = focusedWidget; - - // i is a counter that ensures that the following loop - // won't get stuck in an infinite loop - i = sz; - do - { - -- focusedWidget; - - if (i == 0) - { - focusedWidget = -1; - break; - } - - -- i; - - if (focusedWidget <= 0) - focusedWidget = sz - 1; - - if (focusedWidget == focused) - return; - } - while (!mWidgets.at(focusedWidget)->isFocusable()); - - if (focusedWidget >= 0) - { - mFocusedWidget = mWidgets.at(focusedWidget); - Event focusEvent(mFocusedWidget); - distributeFocusGainedEvent(focusEvent); - } - - if (focused >= 0) - { - Event focusEvent(mWidgets.at(focused)); - distributeFocusLostEvent(focusEvent); - } -} - -bool FocusHandler::isFocused(const Widget *const widget) const -{ - return mFocusedWidget == widget; -} - -void FocusHandler::add(Widget *const widget) -{ - mWidgets.push_back(widget); -} - -void FocusHandler::focusNone() -{ - if (mFocusedWidget != nullptr) - { - Widget *const focused = mFocusedWidget; - mFocusedWidget = nullptr; - - Event focusEvent(focused); - distributeFocusLostEvent(focusEvent); - } -} - -void FocusHandler::distributeFocusLostEvent(const Event& focusEvent) -{ - const Widget *const sourceWidget = focusEvent.getSource(); - if (sourceWidget == nullptr) - return; - - std::list focusListeners - = sourceWidget->getFocusListeners(); - - // Send the event to all focus listeners of the widget. - for (std::list::const_iterator - it = focusListeners.begin(); - it != focusListeners.end(); - ++ it) - { - (*it)->focusLost(focusEvent); - } -} - -Widget* FocusHandler::getDraggedWidget() const -{ - return mDraggedWidget; -} - -void FocusHandler::setDraggedWidget(Widget *const draggedWidget) -{ - mDraggedWidget = draggedWidget; -} - -Widget* FocusHandler::getLastWidgetWithMouse() const -{ - return mLastWidgetWithMouse; -} - -void FocusHandler::setLastWidgetWithMouse(Widget *const lastWidgetWithMouse) -{ - mLastWidgetWithMouse = lastWidgetWithMouse; -} - -Widget* FocusHandler::getLastWidgetWithModalFocus() const -{ - return mLastWidgetWithModalFocus; -} - -void FocusHandler::setLastWidgetWithModalFocus(Widget *const widget) -{ - mLastWidgetWithModalFocus = widget; -} - -Widget* FocusHandler::getLastWidgetWithModalMouseInputFocus() const -{ - return mLastWidgetWithModalMouseInputFocus; -} - -void FocusHandler::setLastWidgetWithModalMouseInputFocus(Widget *const widget) -{ - mLastWidgetWithModalMouseInputFocus = widget; -} - -Widget* FocusHandler::getLastWidgetPressed() const -{ - return mLastWidgetPressed; -} - -void FocusHandler::setLastWidgetPressed(Widget *const lastWidgetPressed) -{ - mLastWidgetPressed = lastWidgetPressed; -} diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h deleted file mode 100644 index 248ae8f71..000000000 --- a/src/gui/focushandler.h +++ /dev/null @@ -1,410 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_FOCUSHANDLER_H -#define GUI_FOCUSHANDLER_H - -#include "utils/vector.h" - -#include - -#include "localconsts.h" - -class Event; -class Widget; - -/** - * The focus handler. This focus handler does exactly the same as the Guichan - * focus handler, but keeps a stack of modal widgets to be able to handle - * multiple modal focus requests. - */ -class FocusHandler final -{ - public: - FocusHandler(); - - A_DELETE_COPY(FocusHandler) - - /** - * Requests focus for a widget. Focus will only be granted to a widget - * if it's focusable and if no other widget has modal focus. - * If a widget receives focus a focus event will be sent to the - * focus listeners of the widget. - * - * @param widget The widget to request focus for. - * @see isFocused, Widget::requestFocus - */ - void requestFocus(const Widget *const widget); - - /** - * Requests modal focus for a widget. Focus will only be granted - * to a widget if it's focusable and if no other widget has modal - * focus. - * - * @param widget The widget to request modal focus for. - * @throws Exception when another widget already has modal focus. - * @see releaseModalFocus, Widget::requestModalFocus - */ - void requestModalFocus(Widget *const widget); - - /** - * Requests modal mouse input focus for a widget. Focus will only - * be granted to a widget if it's focusable and if no other widget - * has modal mouse input focus. - * - * Modal mouse input focus means no other widget then the widget with - * modal mouse input focus will receive mouse input. The widget with - * modal mouse input focus will also receive mouse input no matter what - * the mouse input is or where the mouse input occurs. - * - * @param widget The widget to focus for modal mouse input focus. - * @throws Exception when another widget already has modal mouse input - * focus. - * @see releaseModalMouseInputFocus, Widget::requestModalMouseInputFocus - */ - void requestModalMouseInputFocus(Widget *const widget); - - /** - * Releases modal focus if the widget has modal focus. - * If the widget doesn't have modal focus no relase will occur. - * - * @param widget The widget to release modal focus for. - * @see reuqestModalFocus, Widget::releaseModalFocus - */ - void releaseModalFocus(Widget *const widget); - - /** - * Releases modal mouse input focus if the widget has modal mouse input - * focus. If the widget doesn't have modal mouse input focus no relase - * will occur. - * - * @param widget the widget to release modal mouse input focus for. - * @see requestModalMouseInputFocus, Widget::releaseModalMouseInputFocus - */ - void releaseModalMouseInputFocus(const Widget *const widget); - - /** - * Checks if a widget is focused. - * - * @param widget The widget to check. - * @return True if the widget is focused, false otherwise. - * @see Widget::isFocused - */ - bool isFocused(const Widget *const widget) const; - - /** - * Gets the widget with focus. - * - * @return The widget with focus. NULL if no widget has focus. - */ - Widget* getFocused() const A_WARN_UNUSED; - - /** - * Gets the widget with modal focus. - * - * @return The widget with modal focus. NULL if no widget has - * modal focus. - */ - Widget* getModalFocused() const A_WARN_UNUSED; - - /** - * Gets the widget with modal mouse input focus. - * - * @return The widget with modal mouse input focus. NULL if - * no widget has modal mouse input focus. - */ - Widget* getModalMouseInputFocused() const A_WARN_UNUSED; - - /** - * Focuses the next widget added to a conainer. - * If no widget has focus the first widget gets focus. The order - * in which the widgets are focused is determined by the order - * they were added to a container. - * - * @see focusPrevious - */ - void focusNext(); - - /** - * Focuses the previous widget added to a contaienr. - * If no widget has focus the first widget gets focus. The order - * in which the widgets are focused is determined by the order - * they were added to a container. - * - * @see focusNext - */ - void focusPrevious(); - - /** - * Adds a widget to by handles by the focus handler. - * - * @param widget The widget to add. - * @see remove - */ - void add(Widget *const widget); - - /** - * Removes a widget from the focus handler. - * - * @param widget The widget to remove. - * @see add - */ - void remove(Widget *const widget); - - /** - * Focuses nothing. A focus event will also be sent to the - * focused widget's focus listeners if a widget has focus. - */ - void focusNone(); - - /** - * Focuses the next widget which allows tabbing in unless - * the current focused Widget disallows tabbing out. - * - * @see tabPrevious - */ - void tabNext(); - - /** - * Focuses the previous widget which allows tabbing in unless - * current focused widget disallows tabbing out. - * - * @see tabNext - */ - void tabPrevious(); - - /** - * Gets the widget being dragged. Used by the Gui class to - * keep track of the dragged widget. - * - * @return the widget being dragged. - * @see setDraggedWidget - */ - Widget* getDraggedWidget() const A_WARN_UNUSED; - - /** - * Sets the widget being dragged. Used by the Gui class to - * keep track of the dragged widget. - * - * @param draggedWidget The widget being dragged. - * @see getDraggedWidget - */ - void setDraggedWidget(Widget *const draggedWidget); - - /** - * Gets the last widget with the mouse. Used by the Gui class - * to keep track the last widget with the mouse. - * - * @return The last widget with the mouse. - * @see setLastWidgetWithMouse - */ - Widget* getLastWidgetWithMouse() const A_WARN_UNUSED; - - /** - * Sets the last widget with the mouse. Used by the Gui class - * to keep track the last widget with the mouse. - * - * @param lastWidgetWithMouse The last widget with the mouse. - * @see getLastWidgetWithMouse - */ - void setLastWidgetWithMouse(Widget *const lastWidgetWithMouse); - - /** - * Gets the last widget with modal focus. - * - * @return The last widget with modal focus. - * @see setLastWidgetWithModalFocus - */ - Widget* getLastWidgetWithModalFocus() const A_WARN_UNUSED; - - /** - * Sets the last widget with modal focus. - * - * @param widget The last widget with modal focus. - * @see getLastWidgetWithModalFocus - */ - void setLastWidgetWithModalFocus(Widget *const widget); - - /** - * Gets the last widget with modal mouse input focus. - * - * @return The last widget with modal mouse input focus. - * @see setLastWidgetWithModalMouseInputFocus - */ - Widget* getLastWidgetWithModalMouseInputFocus() const A_WARN_UNUSED; - - /** - * Sets the last widget with modal mouse input focus. - * - * @param widget The last widget with modal mouse input focus. - * @see getLastWidgetWithModalMouseInputFocus - */ - void setLastWidgetWithModalMouseInputFocus(Widget *const widget); - - /** - * Gets the last widget pressed. Used by the Gui class to keep track - * of pressed widgets. - * - * @return The last widget pressed. - * @see setLastWidgetPressed - */ - Widget* getLastWidgetPressed() const A_WARN_UNUSED; - - /** - * Sets the last widget pressed. Used by the Gui class to keep track - * of pressed widgets. - * - * @param lastWidgetPressed The last widget pressed. - * @see getLastWidgetPressed - */ - void setLastWidgetPressed(Widget *const lastWidgetPressed); - - private: - /** - * Checks to see if the widget tabbed to is in a window, and if it is, - * it requests the window be moved to the top. - */ - void checkForWindow() const; - - /** - * Distributes a focus lost event. - * - * @param focusEvent the event to distribute. - */ - static void distributeFocusLostEvent(const Event& focusEvent); - - /** - * Distributes a focus gained event. - * - * @param focusEvent the event to distribute. - */ - static void distributeFocusGainedEvent(const Event& focusEvent); - - /** - * Typedef. - */ - typedef STD_VECTOR WidgetVector; - - /** - * Typedef. - */ - typedef WidgetVector::iterator WidgetIterator; - - /** - * Holds the widgets currently being handled by the - * focus handler. - */ - WidgetVector mWidgets; - - /** - * Holds the focused widget. NULL if no widget has focus. - */ - Widget* mFocusedWidget; - - /** - * Holds the modal focused widget. NULL if no widget has - * modal focused. - */ - Widget* mModalFocusedWidget; - - /** - * Holds the modal mouse input focused widget. NULL if no widget - * is being dragged. - */ - Widget* mModalMouseInputFocusedWidget; - - /** - * Holds the dragged widget. NULL if no widget is - * being dragged. - */ - Widget* mDraggedWidget; - - /** - * Holds the last widget with the mouse. - */ - Widget* mLastWidgetWithMouse; - - /** - * Holds the last widget with modal focus. - */ - Widget* mLastWidgetWithModalFocus; - - /** - * Holds the last widget with modal mouse input focus. - */ - Widget* mLastWidgetWithModalMouseInputFocus; - - /** - * Holds the last widget pressed. - */ - Widget* mLastWidgetPressed; - - /** - * Stack of widgets that have requested modal forcus. - */ - std::list mModalStack; -}; - -#endif // GUI_FOCUSHANDLER_H diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp deleted file mode 100644 index 2ac2bcb4a..000000000 --- a/src/gui/fonts/font.cpp +++ /dev/null @@ -1,499 +0,0 @@ -/* - * The ManaPlus Client - * 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-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gui/fonts/font.h" - -#include "fs/files.h" -#include "fs/paths.h" - -#include "fs/virtfs/tools.h" -#ifdef USE_SDL2 -#include "fs/virtfs/rwops.h" -#endif // USE_SDL2 - -#include "gui/fonts/textchunk.h" - -#include "render/graphics.h" - -#include "resources/imagehelper.h" - -#include "resources/image/image.h" - -#include "utils/checkutils.h" -#include "utils/delete2.h" -#include "utils/sdlcheckutils.h" -#include "utils/stringutils.h" -#include "utils/timer.h" - -#include "debug.h" - -const unsigned int CACHE_SIZE = 256; -const unsigned int CACHE_SIZE_SMALL1 = 2; -const unsigned int CACHE_SIZE_SMALL2 = 50; -const unsigned int CACHE_SIZE_SMALL3 = 170; -const unsigned int CLEAN_TIME = 7; - -bool Font::mSoftMode(false); - -extern char *strBuf; - -static int fontCounter; - -Font::Font(std::string filename, - int size, - const int style) : - mFont(nullptr), - mCreateCounter(0), - mDeleteCounter(0), - mCleanTime(cur_time + CLEAN_TIME) -{ - if (fontCounter == 0) - { - mSoftMode = imageHelper->useOpenGL() == RENDER_SOFTWARE; - if (TTF_Init() == -1) - { - logger->error("Unable to initialize SDL_ttf: " + - std::string(SDL_GetError())); - } - } - - if (size < 4) - { - reportAlways("Error: requested load font %s with size %d", - filename.c_str(), - size); - size = 4; - } - - if (fontCounter == 0) - { - strBuf = new char[65535]; - memset(strBuf, 0, 65535); - } - - ++fontCounter; - - fixDirSeparators(filename); - logger->log("Attempt to load font: %s", - filename.c_str()); - mFont = openFont(filename.c_str(), size); - - if (mFont == nullptr) - { - logger->log("Error normal loading font " + filename); - - filename = "fonts/dejavusans.ttf"; - mFont = openFont(fixDirSeparators(filename).c_str(), size); - if (mFont == nullptr) - { -#ifdef UNITTESTS - reportAlways("Font load failed %s", - filename.c_str()); -#endif // UNITTESTS - logger->error("Font::Font: " + - std::string(SDL_GetError())); - } - else - { - logger->log("Loaded fallback font %s, %d", - filename.c_str(), - size); - } - } - else - { - logger->log("Loaded font %s, %d", - filename.c_str(), - size); - } - - TTF_SetFontStyle(mFont, style); -} - -Font::~Font() -{ - TTF_CloseFont(mFont); - mFont = nullptr; - --fontCounter; - clear(); - - if (fontCounter == 0) - { - TTF_Quit(); - delete []strBuf; - } -} - -TTF_Font *Font::openFont(const char *const name, - const int size) -{ -#ifdef USE_SDL2 - SDL_RWops *const rw = VirtFs::rwopsOpenRead(name); - if (rw) - { - logger->log("Loading virtfs font file: %s", - name); - return TTF_OpenFontIndexRW(rw, 1, size, 0); - } -#endif - const std::string path = VirtFs::getPath(name); - if (Files::existsLocal(path) == false) - { -#ifndef UNITTESTS - // +++ in future need trigger assert in unit tests here too - reportAlways("Font::openFont font not exists: %s", - path.c_str()); -#endif // UNITTESTS - return nullptr; - } - logger->log("Loading physical font file: %s", - path.c_str()); - return TTF_OpenFontIndex(path.c_str(), - size, 0); -} - -void Font::loadFont(std::string filename, - const int size, - const int style) -{ - if (fontCounter == 0 && TTF_Init() == -1) - { - logger->log("Unable to initialize SDL_ttf: " + - std::string(SDL_GetError())); - return; - } - - fixDirSeparators(filename); - TTF_Font *const font = openFont(filename.c_str(), size); - - if (font == nullptr) - { - logger->log("Font::Font: " + - std::string(SDL_GetError())); - return; - } - - if (mFont != nullptr) - TTF_CloseFont(mFont); - - mFont = font; - TTF_SetFontStyle(mFont, style); - clear(); -} - -void Font::clear() -{ - for (size_t f = 0; f < CACHES_NUMBER; f ++) - mCache[f].clear(); -} - -void Font::drawString(Graphics *const graphics, - Color col, - const Color &col2, - const std::string &text, - const int x, const int y) -{ - BLOCK_START("Font::drawString") - if (text.empty()) - { - BLOCK_END("Font::drawString") - return; - } - -// Color col = graphics->getColor(); -// const Color &col2 = graphics->getColor2(); - const float alpha = static_cast(col.a) / 255.0F; - - /* The alpha value is ignored at string generation so avoid caching the - * same text with different alpha values. - */ - col.a = 255; - - const unsigned char chr = text[0]; - TextChunkList *const cache = &mCache[chr]; - - std::map &search = cache->search; - std::map::iterator i - = search.find(TextChunkSmall(text, col, col2)); - if (i != search.end()) - { - TextChunk *const chunk2 = (*i).second; - cache->moveToFirst(chunk2); - Image *const image = chunk2->img; - if (image != nullptr) - { - image->setAlpha(alpha); - graphics->drawImage(image, x, y); - } - } - else - { - if (cache->size >= CACHE_SIZE) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter ++; -#endif // DEBUG_FONT_COUNTERS - - cache->removeBack(); - } -#ifdef DEBUG_FONT_COUNTERS - mCreateCounter ++; -#endif // DEBUG_FONT_COUNTERS - - TextChunk *chunk2 = new TextChunk(text, col, col2, this); - - chunk2->generate(mFont, alpha); - cache->insertFirst(chunk2); - - const Image *const image = chunk2->img; - if (image != nullptr) - graphics->drawImage(image, x, y); - } - BLOCK_END("Font::drawString") -} - -void Font::slowLogic(const int rnd) -{ - BLOCK_START("Font::slowLogic") - if (mCleanTime == 0) - { - mCleanTime = cur_time + CLEAN_TIME + rnd; - } - else if (mCleanTime < cur_time) - { - doClean(); - mCleanTime = cur_time + CLEAN_TIME + rnd; - } - BLOCK_END("Font::slowLogic") -} - -int Font::getWidth(const std::string &text) const -{ - if (text.empty()) - return 0; - - const unsigned char chr = text[0]; - TextChunkList *const cache = &mCache[chr]; - - std::map &search = cache->searchWidth; - std::map::iterator i = search.find(text); - if (i != search.end()) - { - TextChunk *const chunk = (*i).second; - cache->moveToFirst(chunk); - const Image *const image = chunk->img; - if (image != nullptr) - return image->getWidth(); - return 0; - } - - // if string was not drawed - int w, h; - getSafeUtf8String(text, strBuf); - TTF_SizeUTF8(mFont, strBuf, &w, &h); - return w; -} - -int Font::getHeight() const -{ - return TTF_FontHeight(mFont); -} - -void Font::doClean() -{ - for (unsigned int f = 0; f < CACHES_NUMBER; f ++) - { - TextChunkList *const cache = &mCache[f]; - const size_t size = CAST_SIZE(cache->size); -#ifdef DEBUG_FONT_COUNTERS - logger->log("ptr: %u, size: %ld", f, size); -#endif // DEBUG_FONT_COUNTERS - - if (size > CACHE_SIZE_SMALL3) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter += 100; -#endif // DEBUG_FONT_COUNTERS - - cache->removeBack(100); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete3"); -#endif // DEBUG_FONT_COUNTERS - } - else if (size > CACHE_SIZE_SMALL2) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter += 20; -#endif // DEBUG_FONT_COUNTERS - - cache->removeBack(20); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete2"); -#endif // DEBUG_FONT_COUNTERS - } - else if (size > CACHE_SIZE_SMALL1) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter ++; -#endif // DEBUG_FONT_COUNTERS - - cache->removeBack(); -#ifdef DEBUG_FONT_COUNTERS - logger->log("delete1"); -#endif // DEBUG_FONT_COUNTERS - } - } -} - -int Font::getStringIndexAt(const std::string& text, const int x) const -{ - const size_t sz = text.size(); - for (size_t i = 0; i < sz; ++i) - { - if (getWidth(text.substr(0, i)) > x) - return CAST_S32(i); - } - - return CAST_S32(sz); -} - -const TextChunkList *Font::getCache() const noexcept2 -{ - return mCache; -} - -void Font::generate(TextChunk &chunk) -{ - const std::string &text = chunk.text; - if (text.empty()) - return; - - const unsigned char chr = text[0]; - TextChunkList *const cache = &mCache[chr]; - Color &col = chunk.color; - Color &col2 = chunk.color2; - const int oldAlpha = col.a; - col.a = 255; - - TextChunkSmall key(text, col, col2); - std::map &search = cache->search; - std::map::iterator i = search.find(key); - if (i != search.end()) - { - TextChunk *const chunk2 = (*i).second; - cache->moveToFirst(chunk2); -// search.erase(key); - cache->remove(chunk2); - chunk.img = chunk2->img; - chunk2->img = nullptr; - delete chunk2; -// logger->log("cached image: " + chunk.text); - } - else - { - if (cache->size >= CACHE_SIZE) - { -#ifdef DEBUG_FONT_COUNTERS - mDeleteCounter ++; -#endif // DEBUG_FONT_COUNTERS - - cache->removeBack(); - } -#ifdef DEBUG_FONT_COUNTERS - mCreateCounter ++; -#endif // DEBUG_FONT_COUNTERS - - const float alpha = static_cast(chunk.color.a) / 255.0F; - chunk.generate(mFont, alpha); -// logger->log("generate image: " + chunk.text); - } - col.a = oldAlpha; -} - -void Font::insertChunk(TextChunk *const chunk) -{ - if ((chunk == nullptr) || chunk->text.empty() || (chunk->img == nullptr)) - return; -// logger->log("insert chunk: text=%s, color: %d,%d,%d", -// chunk->text.c_str(), chunk->color.r, chunk->color.g, chunk->color.b); - const unsigned char chr = chunk->text[0]; - TextChunkList *const cache = &mCache[chr]; - - std::map &search = cache->search; - std::map::iterator i - = search.find(TextChunkSmall(chunk->text, - chunk->color, chunk->color2)); - if (i != search.end()) - { - delete2(chunk->img); - return; - } - - TextChunk *const chunk2 = new TextChunk(chunk->text, - chunk->color, chunk->color2, chunk->textFont); - chunk2->img = chunk->img; - cache->insertFirst(chunk2); -} diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h deleted file mode 100644 index 4f3670374..000000000 --- a/src/gui/fonts/font.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_FONTS_FONT_H -#define GUI_FONTS_FONT_H - -#include "gui/fonts/textchunklist.h" - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "localconsts.h" - -class Graphics; - -const unsigned int CACHES_NUMBER = 256; - -/** - * A wrapper around SDL_ttf for allowing the use of TrueType fonts. - * - * NOTE: This class initializes SDL_ttf as necessary. - */ -class Font final -{ - public: - Font(std::string filename, - int size, - const int style); - - A_DELETE_COPY(Font) - - ~Font(); - - void loadFont(std::string filename, - const int size, - const int style) restrict2; - - int getWidth(const std::string &text) const restrict2 A_WARN_UNUSED; - - int getHeight() const restrict2 A_WARN_UNUSED; - - const TextChunkList *getCache() const restrict2 noexcept2 - A_CONST A_WARN_UNUSED; - - /** - * @see Font::drawString - */ - void drawString(Graphics *restrict const graphics, - Color col, - const Color &restrict col2, - const std::string &restrict text, - const int x, - const int y) restrict2 A_NONNULL(2); - - void clear() restrict2; - - void doClean() restrict2; - - void slowLogic(const int rnd) restrict2; - - unsigned int getCreateCounter() const restrict2 noexcept2 A_WARN_UNUSED - { return mCreateCounter; } - - unsigned int getDeleteCounter() const restrict2 noexcept2 A_WARN_UNUSED - { return mDeleteCounter; } - - int getStringIndexAt(const std::string &restrict text, - const int x) const restrict2 A_WARN_UNUSED; - - void generate(TextChunk &restrict chunk) restrict2; - - void insertChunk(TextChunk *const chunk) restrict2; - - static bool mSoftMode; - - private: - static TTF_Font *openFont(const char *restrict const name, - const int size); - - TTF_Font *restrict mFont; - unsigned int mCreateCounter; - unsigned int mDeleteCounter; - - // Word surfaces cache - time_t mCleanTime; - mutable TextChunkList mCache[CACHES_NUMBER]; -}; - -#ifdef UNITTESTS -extern int textChunkCnt; -#endif // UNITTESTS - -#endif // GUI_FONTS_FONT_H diff --git a/src/gui/fonts/textchunk.cpp b/src/gui/fonts/textchunk.cpp deleted file mode 100644 index 22dcd18dc..000000000 --- a/src/gui/fonts/textchunk.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * The ManaPlus Client - * 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-2017 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 . - */ - -#include "gui/fonts/textchunk.h" - -#include "sdlshared.h" - -#include "gui/fonts/font.h" - -#include "resources/surfaceimagehelper.h" - -#include "resources/image/image.h" - -#include "utils/delete2.h" -#include "utils/sdlcheckutils.h" -#include "utils/stringutils.h" - -#include "debug.h" - -namespace -{ - const int OUTLINE_SIZE = 1; -} // namespace - -char *restrict strBuf = nullptr; - -#ifdef UNITTESTS -int textChunkCnt = 0; -#endif // UNITTESTS - -TextChunk::TextChunk() : - img(nullptr), - textFont(nullptr), - text(), - color(), - color2(), - prev(nullptr), - next(nullptr) -{ -#ifdef UNITTESTS - textChunkCnt ++; -#endif // UNITTESTS -} - -TextChunk::TextChunk(const std::string &restrict text0, - const Color &restrict color0, - const Color &restrict color1, - Font *restrict const font) : - img(nullptr), - textFont(font), - text(text0), - color(color0), - color2(color1), - prev(nullptr), - next(nullptr) -{ -#ifdef UNITTESTS - textChunkCnt ++; -#endif // UNITTESTS -} - -TextChunk::~TextChunk() -{ - delete2(img); -#ifdef UNITTESTS - textChunkCnt --; -#endif // UNITTESTS -} - -bool TextChunk::operator==(const TextChunk &restrict chunk) const -{ - return chunk.text == text && chunk.color == color - && chunk.color2 == color2; -} - -void TextChunk::generate(TTF_Font *restrict const font, - const float alpha) -{ - BLOCK_START("TextChunk::generate") - SDL_Color sdlCol; - sdlCol.b = CAST_U8(color.b); - sdlCol.r = CAST_U8(color.r); - sdlCol.g = CAST_U8(color.g); -#ifdef USE_SDL2 - sdlCol.a = 255; -#else // USE_SDL2 - - sdlCol.unused = 0; -#endif // USE_SDL2 - - getSafeUtf8String(text, strBuf); - - SDL_Surface *surface = MTTF_RenderUTF8_Blended( - font, strBuf, sdlCol); - - if (surface == nullptr) - { - img = nullptr; - BLOCK_END("TextChunk::generate") - return; - } - - const int width = surface->w; - const int height = surface->h; - - if (color.r != color2.r || color.g != color2.g - || color.b != color2.b) - { // outlining - SDL_Color sdlCol2; - SDL_Surface *const background = imageHelper->create32BitSurface( - width, height); - if (background == nullptr) - { - img = nullptr; - MSDL_FreeSurface(surface); - BLOCK_END("TextChunk::generate") - return; - } - sdlCol2.b = CAST_U8(color2.b); - sdlCol2.r = CAST_U8(color2.r); - sdlCol2.g = CAST_U8(color2.g); -#ifdef USE_SDL2 - sdlCol2.a = 255; -#else // USE_SDL2 - - sdlCol2.unused = 0; -#endif // USE_SDL2 - - SDL_Surface *const surface2 = MTTF_RenderUTF8_Blended( - font, strBuf, sdlCol2); - if (surface2 == nullptr) - { - img = nullptr; - MSDL_FreeSurface(surface); - BLOCK_END("TextChunk::generate") - return; - } - SDL_Rect rect = - { - OUTLINE_SIZE, - 0, - static_cast(surface->w), - static_cast(surface->h) - }; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = -OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = 0; - rect.y = -OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.y = OUTLINE_SIZE; - SurfaceImageHelper::combineSurface(surface2, nullptr, - background, &rect); - rect.x = 0; - rect.y = 0; - SurfaceImageHelper::combineSurface(surface, nullptr, - background, &rect); - MSDL_FreeSurface(surface); - MSDL_FreeSurface(surface2); - surface = background; - } - img = imageHelper->createTextSurface( - surface, width, height, alpha); - MSDL_FreeSurface(surface); - - BLOCK_END("TextChunk::generate") -} - -void TextChunk::deleteImage() -{ - if (textFont != nullptr) - { - textFont->insertChunk(this); - img = nullptr; - } - else - { - delete2(img); - } -} diff --git a/src/gui/fonts/textchunk.h b/src/gui/fonts/textchunk.h deleted file mode 100644 index bbd50fdff..000000000 --- a/src/gui/fonts/textchunk.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * Copyright (C) 2009 Aethyra Development Team - * - * 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 . - */ - -#ifndef GUI_FONTS_TEXTCHUNK_H -#define GUI_FONTS_TEXTCHUNK_H - -#include "gui/color.h" - -#include - -PRAGMA48(GCC diagnostic push) -PRAGMA48(GCC diagnostic ignored "-Wshadow") -#include -PRAGMA48(GCC diagnostic pop) - -#include "localconsts.h" - -class Font; -class Image; - -class TextChunk final -{ - public: - TextChunk(); - - TextChunk(const std::string &restrict text0, - const Color &restrict color0, - const Color &restrict color1, - Font *restrict const font); - - A_DELETE_COPY(TextChunk) - - ~TextChunk(); - - bool operator==(const TextChunk &restrict chunk) const restrict2; - - void generate(TTF_Font *restrict const font, - const float alpha) restrict2; - - void deleteImage() restrict2; - - Image *restrict img; - Font *restrict textFont; - std::string text; - Color color; - Color color2; - TextChunk *restrict prev; - TextChunk *restrict next; -}; - -#ifdef UNITTESTS -extern int textChunkCnt; -#endif // UNITTESTS - -#endif // GUI_FONTS_TEXTCHUNK_H diff --git a/src/gui/fonts/textchunklist.cpp b/src/gui/fonts/textchunklist.cpp deleted file mode 100644 index 4ce39406b..000000000 --- a/src/gui/fonts/textchunklist.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/fonts/textchunklist.h" - -#include "gui/fonts/textchunk.h" - -#include "debug.h" - -TextChunkList::TextChunkList() : - start(nullptr), - end(nullptr), - size(0), - search(), - searchWidth() -{ -} - -void TextChunkList::insertFirst(TextChunk *restrict const item) -{ - TextChunk *restrict const oldFirst = start; - if (start != nullptr) - start->prev = item; - item->prev = nullptr; - if (oldFirst != nullptr) - item->next = oldFirst; - else - end = item; - start = item; - size ++; - search[TextChunkSmall(item->text, item->color, item->color2)] = item; - searchWidth[item->text] = item; -} - -void TextChunkList::moveToFirst(TextChunk *restrict const item) -{ - if (item == start) - return; - - TextChunk *restrict const oldPrev = item->prev; - if (oldPrev != nullptr) - oldPrev->next = item->next; - TextChunk *restrict const oldNext = item->next; - if (oldNext != nullptr) - oldNext->prev = item->prev; - else - end = oldPrev; - TextChunk *restrict const oldFirst = start; - if (start != nullptr) - start->prev = item; - item->prev = nullptr; - item->next = oldFirst; - start = item; -} - -void TextChunkList::remove(const TextChunk *restrict const item) -{ - if (item == nullptr) - return; - - TextChunk *restrict const oldPrev = item->prev; - TextChunk *restrict const oldNext = item->next; - if (oldPrev != nullptr) - oldPrev->next = item->next; - else - start = oldNext; - if (oldNext != nullptr) - oldNext->prev = item->prev; - else - end = oldPrev; - - search.erase(TextChunkSmall(item->text, - item->color, item->color2)); - searchWidth.erase(item->text); - size --; -} - -void TextChunkList::removeBack() -{ - TextChunk *restrict oldEnd = end; - if (oldEnd != nullptr) - { - end = oldEnd->prev; - if (end != nullptr) - end->next = nullptr; - else - start = nullptr; - search.erase(TextChunkSmall(oldEnd->text, - oldEnd->color, oldEnd->color2)); - searchWidth.erase(oldEnd->text); - delete oldEnd; - size --; - } -} - -void TextChunkList::removeBack(int n) -{ - TextChunk *restrict item = end; - while ((n != 0) && (item != nullptr)) - { - n --; - TextChunk *oldEnd = item; - item = item->prev; - search.erase(TextChunkSmall(oldEnd->text, - oldEnd->color, oldEnd->color2)); - searchWidth.erase(oldEnd->text); - delete oldEnd; - size --; - } - if (item != nullptr) - { - item->next = nullptr; - end = item; - } - else - { - start = nullptr; - end = nullptr; - } -} - -void TextChunkList::clear() -{ - search.clear(); - searchWidth.clear(); - TextChunk *restrict item = start; - while (item != nullptr) - { - TextChunk *restrict const item2 = item->next; - delete item; - item = item2; - } - start = nullptr; - end = nullptr; - size = 0; -} diff --git a/src/gui/fonts/textchunklist.h b/src/gui/fonts/textchunklist.h deleted file mode 100644 index fff198445..000000000 --- a/src/gui/fonts/textchunklist.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_FONTS_TEXTCHUNKLIST_H -#define GUI_FONTS_TEXTCHUNKLIST_H - -#include "gui/fonts/textchunksmall.h" - -#include - -#include "localconsts.h" - -class TextChunk; - -class TextChunkList final -{ - public: - TextChunkList(); - - A_DELETE_COPY(TextChunkList) - - void insertFirst(TextChunk *restrict const item) - restrict2 A_NONNULL(2); - - void moveToFirst(TextChunk *restrict const item) - restrict2 A_NONNULL(2); - - void remove(const TextChunk *restrict const item) restrict2; - - void removeBack() restrict2; - - void removeBack(int n) restrict2; - - void clear() restrict2; - - TextChunk *restrict start; - TextChunk *restrict end; - uint32_t size; - std::map search; - std::map searchWidth; -}; - -#endif // GUI_FONTS_TEXTCHUNKLIST_H diff --git a/src/gui/fonts/textchunksmall.cpp b/src/gui/fonts/textchunksmall.cpp deleted file mode 100644 index 73e8ad386..000000000 --- a/src/gui/fonts/textchunksmall.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/fonts/textchunksmall.h" - -#include "gui/fonts/font.h" - -#include "debug.h" - -TextChunkSmall::TextChunkSmall(const std::string &text0, - const Color &color0, - const Color &color1) : - text(text0), - color(color0), - color2(color1) -{ -} - -TextChunkSmall::TextChunkSmall(const TextChunkSmall &old) : - text(old.text), - color(old.color), - color2(old.color2) -{ -} - -TextChunkSmall &TextChunkSmall::operator=(const TextChunkSmall &chunk) -{ - text = chunk.text; - color = chunk.color; - color2 = chunk.color2; - return *this; -} - -bool TextChunkSmall::operator==(const TextChunkSmall &chunk) const -{ - return chunk.text == text && - chunk.color == color && - chunk.color2 == color2; -} - -bool TextChunkSmall::operator<(const TextChunkSmall &chunk) const -{ - if (chunk.text != text) - return chunk.text > text; - - const Color &restrict c = chunk.color; - if (c.r != color.r) - return c.r > color.r; - if (c.g != color.g) - return c.g > color.g; - if (c.b != color.b) - return c.b > color.b; - - const Color &restrict c2 = chunk.color2; - if (c2.r != color2.r) - return c2.r > color2.r; - if (c2.g != color2.g) - return c2.g > color2.g; - if (c2.b != color2.b) - return c2.b > color2.b; - - if (c.a != color.a && Font::mSoftMode) - return c.a > color.a; - - return false; -} diff --git a/src/gui/fonts/textchunksmall.h b/src/gui/fonts/textchunksmall.h deleted file mode 100644 index 0896c3591..000000000 --- a/src/gui/fonts/textchunksmall.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_FONTS_TEXTCHUNKSMALL_H -#define GUI_FONTS_TEXTCHUNKSMALL_H - -#include "gui/color.h" - -#include - -#include "localconsts.h" - -class TextChunkSmall final -{ - public: - A_DEFAULT_COPY(TextChunkSmall) - - TextChunkSmall(const std::string &restrict text0, - const Color &restrict color0, - const Color &restrict color1); - - TextChunkSmall(const TextChunkSmall &restrict old); - - bool operator==(const TextChunkSmall &restrict chunk) const restrict2; - bool operator<(const TextChunkSmall &restrict chunk) const restrict2; - TextChunkSmall &operator=(const TextChunkSmall &restrict chunk) - restrict2; - std::string text; - Color color; - Color color2; -}; -#endif // GUI_FONTS_TEXTCHUNKSMALL_H diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp deleted file mode 100644 index 3fab73d0a..000000000 --- a/src/gui/gui.cpp +++ /dev/null @@ -1,1515 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gui/gui.h" - -#include "gui/focushandler.h" -#include "gui/sdlinput.h" -#include "gui/viewport.h" - -#include "gui/fonts/font.h" - -#include "gui/widgets/label.h" -#include "gui/widgets/window.h" - -#include "gui/widgets/tabs/tab.h" - -#ifndef DYECMD -#include "dragdrop.h" -#else // DYECMD -#include "resources/image/image.h" -#endif // DYECMD -#include "settings.h" - -#include "listeners/focuslistener.h" -#include "listeners/guiconfiglistener.h" -#include "listeners/keylistener.h" - -#include "input/inputmanager.h" - -#include "input/touch/touchmanager.h" - -#include "render/renderers.h" - -#include "resources/imageset.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/delete2.h" -#include "utils/foreach.h" -#include "utils/langs.h" -#include "utils/sdlsharedhelper.h" -#include "utils/timer.h" - -#include "net/ipc.h" - -#include "debug.h" - -Gui *gui = nullptr; -Font *boldFont = nullptr; - -Gui::Gui() : - mTop(nullptr), - mGraphics(nullptr), - mInput(nullptr), - mFocusHandler(new FocusHandler), - mKeyListeners(), - mLastMousePressButton(MouseButton::EMPTY), - mLastMousePressTimeStamp(0U), - mLastMouseX(0), - mLastMouseY(0), - mClickCount(1), - mLastMouseDragButton(MouseButton::EMPTY), - mWidgetWithMouseQueue(), - mConfigListener(new GuiConfigListener(this)), - mGuiFont(nullptr), - mInfoParticleFont(nullptr), - mHelpFont(nullptr), - mSecureFont(nullptr), - mNpcFont(nullptr), - mMouseCursors(nullptr), - mMouseCursorAlpha(1.0F), - mMouseInactivityTimer(0), - mCursorType(Cursor::CURSOR_POINTER), -#ifdef ANDROID - mLastMouseRealX(0), - mLastMouseRealY(0), -#endif // ANDROID - mFocusListeners(), - mForegroundColor(theme->getColor(ThemeColorId::TEXT, 255)), - mForegroundColor2(theme->getColor(ThemeColorId::TEXT_OUTLINE, 255)), - mTime(0), - mTime10(0), - mCustomCursor(false), - mDoubleClick(true) -{ -} - -void Gui::postInit(Graphics *const graphics) -{ - logger->log1("Initializing GUI..."); - // Set graphics - setGraphics(graphics); - - // Set input - guiInput = new SDLInput; - setInput(guiInput); - - // Set focus handler - delete mFocusHandler; - mFocusHandler = new FocusHandler; - - // Initialize top GUI widget - WindowContainer *const guiTop = new WindowContainer(nullptr); - guiTop->setFocusable(true); - guiTop->setSize(graphics->mWidth, graphics->mHeight); - guiTop->setOpaque(Opaque_false); - Window::setWindowContainer(guiTop); - setTop(guiTop); - - const StringVect langs = getLang(); - const bool isJapan = (!langs.empty() && langs[0].size() > 3 - && langs[0].substr(0, 3) == "ja_"); - const bool isChinese = (!langs.empty() && langs[0].size() > 3 - && langs[0].substr(0, 3) == "zh_"); - - // Set global font - const int fontSize = config.getIntValue("fontSize"); - std::string fontFile = config.getValue("font", ""); - if (isJapan) - { - fontFile = config.getValue("japanFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("japanFont"); - } - else if (isChinese) - { - fontFile = config.getValue("chinaFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("chinaFont"); - } - if (fontFile.empty()) - fontFile = branding.getStringValue("font"); - - mGuiFont = new Font(fontFile, fontSize, TTF_STYLE_NORMAL); - - // Set particle font - fontFile = config.getValue("particleFont", ""); - if (isJapan) - { - fontFile = config.getValue("japanFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("japanFont"); - } - else if (isChinese) - { - fontFile = config.getValue("chinaFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("chinaFont"); - } - if (fontFile.empty()) - fontFile = branding.getStringValue("particleFont"); - - mInfoParticleFont = new Font(fontFile, fontSize, TTF_STYLE_BOLD); - - // Set bold font - fontFile = config.getValue("boldFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("boldFont"); - - boldFont = new Font(fontFile, fontSize, TTF_STYLE_NORMAL); - - // Set help font - fontFile = config.getValue("helpFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("helpFont"); - - mHelpFont = new Font(fontFile, fontSize, TTF_STYLE_NORMAL); - - // Set secure font - fontFile = config.getValue("secureFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("secureFont"); - - mSecureFont = new Font(fontFile, fontSize, TTF_STYLE_NORMAL); - - // Set npc font - const int npcFontSize = config.getIntValue("npcfontSize"); - fontFile = config.getValue("npcFont", ""); - if (isJapan) - { - fontFile = config.getValue("japanFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("japanFont"); - } - else if (isChinese) - { - fontFile = config.getValue("chinaFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("chinaFont"); - } - if (fontFile.empty()) - fontFile = branding.getStringValue("npcFont"); - - mNpcFont = new Font(fontFile, npcFontSize, TTF_STYLE_NORMAL); - - Widget::setGlobalFont(mGuiFont); - - // Initialize mouse cursor and listen for changes to the option - setUseCustomCursor(config.getBoolValue("customcursor")); - setDoubleClick(config.getBoolValue("doubleClick")); - config.addListener("customcursor", mConfigListener); - config.addListener("doubleClick", mConfigListener); -} - -Gui::~Gui() -{ - config.removeListeners(mConfigListener); - delete2(mConfigListener); - - if (mMouseCursors != nullptr) - { - mMouseCursors->decRef(); - mMouseCursors = nullptr; - } - - if (windowContainer != nullptr) - windowContainer->slowLogic(); - Widget *top = mTop; - if (Widget::widgetExists(mTop)) - setTop(nullptr); - Window::setWindowContainer(nullptr); - delete top; - - delete2(mGuiFont); - delete2(boldFont); - delete2(mHelpFont); - delete2(mSecureFont); - delete2(mInfoParticleFont); - delete2(mNpcFont); - delete2(guiInput); - delete2(theme); - - delete2(mFocusHandler); - Label::finalCleanup(); - Tab::finalCleanup(); - Widget::cleanGlobalFont(); -} - -void Gui::logic() -{ - BLOCK_START("Gui::logic") - ResourceManager::clearScheduled(); - - if (mTop == nullptr) - { - BLOCK_END("Gui::logic") - return; - } - - handleModalFocus(); - handleModalMouseInputFocus(); - - if (guiInput != nullptr) - handleMouseInput(); - - mTop->logic(); - BLOCK_END("Gui::logic") -} - -void Gui::slowLogic() -{ - BLOCK_START("Gui::slowLogic") - Palette::advanceGradients(); - - // Fade out mouse cursor after extended inactivity - if (mMouseInactivityTimer < 100 * 15) - { - ++mMouseInactivityTimer; - mMouseCursorAlpha = std::min(1.0F, mMouseCursorAlpha + 0.05F); - } - else - { - mMouseCursorAlpha = std::max(0.0F, mMouseCursorAlpha - 0.005F); - } - if (mGuiFont != nullptr) - mGuiFont->slowLogic(0); - if (mInfoParticleFont != nullptr) - mInfoParticleFont->slowLogic(1); - if (mHelpFont != nullptr) - mHelpFont->slowLogic(2); - if (mSecureFont != nullptr) - mSecureFont->slowLogic(3); - if (boldFont != nullptr) - boldFont->slowLogic(4); - if (mNpcFont != nullptr) - mNpcFont->slowLogic(5); - if (windowContainer != nullptr) - windowContainer->slowLogic(); - - const time_t time = cur_time; - if (mTime != time) - { - logger->flush(); - if (ipc != nullptr) - ipc->flush(); - mTime = time; - - if (time > mTime10 || mTime10 - time > 10) - { - mTime10 = time + 10; - ResourceManager::cleanOrphans(); - guiInput->simulateMouseMove(); - } - } - - BLOCK_END("Gui::slowLogic") -} - -void Gui::clearFonts() -{ - if (mGuiFont != nullptr) - mGuiFont->clear(); - if (mInfoParticleFont != nullptr) - mInfoParticleFont->clear(); - if (mHelpFont != nullptr) - mHelpFont->clear(); - if (mSecureFont != nullptr) - mSecureFont->clear(); - if (boldFont != nullptr) - boldFont->clear(); - if (mNpcFont != nullptr) - mNpcFont->clear(); -} - -bool Gui::handleInput() -{ - if (mInput != nullptr) - return handleKeyInput(); - return false; -} - -bool Gui::handleKeyInput() -{ - if (guiInput == nullptr) - return false; - - BLOCK_START("Gui::handleKeyInput") - bool consumed(false); - - while (!mInput->isKeyQueueEmpty()) - { - const KeyInput keyInput = guiInput->dequeueKeyInput(); - - KeyEvent eventToGlobalKeyListeners(nullptr, - keyInput.getType(), - keyInput.getActionId(), keyInput.getKey()); - -#ifdef USE_SDL2 - if (!keyInput.getText().empty()) - eventToGlobalKeyListeners.setText(keyInput.getText()); -#endif // USE_SDL2 - - distributeKeyEventToGlobalKeyListeners( - eventToGlobalKeyListeners); - - // If a global key listener consumes the event it will not be - // sent further to the source of the event. - if (eventToGlobalKeyListeners.isConsumed()) - { - consumed = true; - continue; - } - - if (mFocusHandler != nullptr) - { - bool eventConsumed = false; - - // Send key inputs to the focused widgets - if (mFocusHandler->getFocused() != nullptr) - { - KeyEvent event(getKeyEventSource(), - keyInput.getType(), - keyInput.getActionId(), keyInput.getKey()); -#ifdef USE_SDL2 - if (!keyInput.getText().empty()) - event.setText(keyInput.getText()); -#endif // USE_SDL2 - - if (!mFocusHandler->getFocused()->isFocusable()) - mFocusHandler->focusNone(); - else - distributeKeyEvent(event); - - eventConsumed = event.isConsumed(); - if (eventConsumed) - consumed = true; - } - - // If the key event hasn't been consumed and - // tabbing is enable check for tab press and - // change focus. - if (!eventConsumed && keyInput.getActionId() - == InputAction::GUI_TAB && - keyInput.getType() == KeyEventType::PRESSED) - { - if (inputManager.isActionActive(InputAction::GUI_MOD)) - mFocusHandler->tabPrevious(); - else - mFocusHandler->tabNext(); - } - } - } // end while - BLOCK_END("Gui::handleKeyInput") - return consumed; -} - -void Gui::draw() -{ - BLOCK_START("Gui::draw 1") - Widget *const top = getTop(); - if (top == nullptr) - return; - mGraphics->pushClipArea(top->getDimension()); - - if (isBatchDrawRenders(openGLMode)) - { - top->draw(mGraphics); - touchManager.draw(); - } - else - { - top->safeDraw(mGraphics); - touchManager.safeDraw(); - } - - int mouseX; - int mouseY; - const MouseStateType button = getMouseState(mouseX, mouseY); - - if ((settings.mouseFocused || - ((button & SDL_BUTTON(1)) != 0)) && - mMouseCursors != nullptr && - mCustomCursor && - mMouseCursorAlpha > 0.0F) - { -#ifndef DYECMD - const Image *const image = dragDrop.getItemImage(); - if (mGuiFont != nullptr) - { - const std::string &str = dragDrop.getText(); - if (!str.empty()) - { - const int posX = mouseX - mGuiFont->getWidth(str) / 2; - const int posY = mouseY + - (image != nullptr ? image->mBounds.h / 2 : 0); - mGuiFont->drawString(mGraphics, - mForegroundColor, mForegroundColor2, - str, - posX, posY); - } - } - if (image != nullptr) - { - const int posX = mouseX - (image->mBounds.w / 2); - const int posY = mouseY - (image->mBounds.h / 2); - mGraphics->drawImage(image, posX, posY); - } -#endif // DYECMD - - Image *const mouseCursor = mMouseCursors->get( - CAST_SIZE(mCursorType)); - if (mouseCursor != nullptr) - { - mouseCursor->setAlpha(mMouseCursorAlpha); - mGraphics->drawImage(mouseCursor, mouseX - 15, mouseY - 17); - } - } - - mGraphics->popClipArea(); - BLOCK_END("Gui::draw 1") -} - -void Gui::videoResized() const -{ - WindowContainer *const top = static_cast(getTop()); - - if (top != nullptr) - { - const int oldWidth = top->getWidth(); - const int oldHeight = top->getHeight(); - - top->setSize(mainGraphics->mWidth, mainGraphics->mHeight); - top->adjustAfterResize(oldWidth, oldHeight); - } - - if (viewport != nullptr) - viewport->videoResized(); - Widget::distributeWindowResizeEvent(); -} - -void Gui::setUseCustomCursor(const bool customCursor) -{ - if (settings.options.hideCursor) - { - SDL::showCursor(false); - return; - } - if (customCursor != mCustomCursor) - { - mCustomCursor = customCursor; - - if (mCustomCursor) - { - // Hide the SDL mouse cursor - SDL::showCursor(false); - - // Load the mouse cursor - if (mMouseCursors != nullptr) - mMouseCursors->decRef(); - mMouseCursors = Theme::getImageSetFromTheme("mouse.png", 40, 40); - - if (mMouseCursors == nullptr) - logger->log("Error: Unable to load mouse cursors."); - } - else - { - // Show the SDL mouse cursor - SDL::showCursor(true); - - // Unload the mouse cursor - if (mMouseCursors != nullptr) - { - mMouseCursors->decRef(); - mMouseCursors = nullptr; - } - } - } -} - -void Gui::handleMouseMoved(const MouseInput &mouseInput) -{ - // Check if the mouse leaves the application window. - if (mTop != nullptr && - !mWidgetWithMouseQueue.empty() && - (mouseInput.getX() < 0 || - mouseInput.getY() < 0 || - !mTop->getDimension().isPointInRect(mouseInput.getX(), - mouseInput.getY()))) - { - // Distribute an event to all widgets in the - // "widget with mouse" queue. - while (!mWidgetWithMouseQueue.empty()) - { - Widget *const widget = mWidgetWithMouseQueue.front(); - - if (Widget::widgetExists(widget)) - { - distributeMouseEvent(widget, - MouseEventType::EXITED, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY(), - true, - true); - } - - mWidgetWithMouseQueue.pop_front(); - } - - mMouseInactivityTimer = 0; - return; - } - - const int mouseX = mouseInput.getX(); - const int mouseY = mouseInput.getY(); - const MouseButtonT button = mouseInput.getButton(); - - // Check if there is a need to send mouse exited events by - // traversing the "widget with mouse" queue. - bool widgetWithMouseQueueCheckDone = mWidgetWithMouseQueue.empty(); - while (!widgetWithMouseQueueCheckDone) - { - unsigned int iterations = 0; - for (std::deque::iterator - iter = mWidgetWithMouseQueue.begin(); - iter != mWidgetWithMouseQueue.end(); - ++ iter) - { - Widget *const widget = *iter; - - // If a widget in the "widget with mouse queue" doesn't - // exists anymore it should be removed from the queue. - if (!Widget::widgetExists(widget)) - { - mWidgetWithMouseQueue.erase(iter); - break; - } - else - { - int x; - int y; - widget->getAbsolutePosition(x, y); - - if (x > mouseX - || y > mouseY - || x + widget->getWidth() <= mouseX - || y + widget->getHeight() <= mouseY - || !widget->isVisible()) - { - distributeMouseEvent(widget, - MouseEventType::EXITED, - button, - mouseX, - mouseY, - true, - true); - mClickCount = 1; - mLastMousePressTimeStamp = 0U; - mWidgetWithMouseQueue.erase(iter); - break; - } - } - - iterations++; - } - - widgetWithMouseQueueCheckDone = - (CAST_SIZE(iterations) == mWidgetWithMouseQueue.size()); - } - - // Check all widgets below the mouse to see if they are - // present in the "widget with mouse" queue. If a widget - // is not then it should be added and an entered event should - // be sent to it. - Widget* parent = getMouseEventSource(mouseX, mouseY); - Widget* widget = parent; - - // If a widget has modal mouse input focus then it will - // always be returned from getMouseEventSource, but we only wan't to - // send mouse entered events if the mouse has actually entered the - // widget with modal mouse input focus, hence we need to check if - // that's the case. If it's not we should simply ignore to send any - // mouse entered events. - if ((mFocusHandler->getModalMouseInputFocused() != nullptr) - && widget == mFocusHandler->getModalMouseInputFocused() - && Widget::widgetExists(widget) && - (widget != nullptr)) - { - int x, y; - widget->getAbsolutePosition(x, y); - - if (x > mouseX || y > mouseY - || x + widget->getWidth() <= mouseX - || y + widget->getHeight() <= mouseY) - { - parent = nullptr; - } - } - - while (parent != nullptr) - { - parent = widget->getParent(); - - // Check if the widget is present in the "widget with mouse" queue. - bool widgetIsPresentInQueue = false; - FOR_EACH (std::deque::const_iterator, - iter, mWidgetWithMouseQueue) - { - if (*iter == widget) - { - widgetIsPresentInQueue = true; - break; - } - } - - // Widget is not present, send an entered event and add - // it to the "widget with mouse" queue. - if (!widgetIsPresentInQueue - && Widget::widgetExists(widget)) - { - distributeMouseEvent(widget, - MouseEventType::ENTERED, - button, - mouseX, - mouseY, - true, - true); - mWidgetWithMouseQueue.push_front(widget); - } - - const Widget *const swap = widget; - widget = parent; - parent = swap->getParent(); - } - - if (mFocusHandler->getDraggedWidget() != nullptr) - { - distributeMouseEvent(mFocusHandler->getDraggedWidget(), - MouseEventType::DRAGGED, - mLastMouseDragButton, - mouseX, - mouseY); - } - else - { - Widget *const sourceWidget = getMouseEventSource(mouseX, mouseY); - distributeMouseEvent(sourceWidget, - MouseEventType::MOVED, - button, - mouseX, - mouseY); - } - mMouseInactivityTimer = 0; -} - -void Gui::handleMousePressed(const MouseInput &mouseInput) -{ - const int x = mouseInput.getX(); - const int y = mouseInput.getY(); - const MouseButtonT button = mouseInput.getButton(); - const unsigned int timeStamp = mouseInput.getTimeStamp(); - - Widget *sourceWidget = getMouseEventSource(x, y); - - if (mFocusHandler->getDraggedWidget() != nullptr) - sourceWidget = mFocusHandler->getDraggedWidget(); - - if (sourceWidget == nullptr) - return; - int sourceWidgetX; - int sourceWidgetY; - sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); - - if (((mFocusHandler->getModalFocused() != nullptr) - && sourceWidget->isModalFocused()) - || (mFocusHandler->getModalFocused() == nullptr)) - { - sourceWidget->requestFocus(); - } - - if (mDoubleClick && - timeStamp - mLastMousePressTimeStamp < 250U && - mLastMousePressButton == button) - { - mClickCount ++; - } - else - { - mClickCount = 1; - } - - distributeMouseEvent(sourceWidget, MouseEventType::PRESSED, button, x, y); - mFocusHandler->setLastWidgetPressed(sourceWidget); - mFocusHandler->setDraggedWidget(sourceWidget); - mLastMouseDragButton = button; - mLastMousePressButton = button; - mLastMousePressTimeStamp = timeStamp; -} - -void Gui::updateFonts() -{ - const int fontSize = config.getIntValue("fontSize"); - std::string fontFile = config.getValue("font", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("font"); - - mGuiFont->loadFont(fontFile, fontSize, TTF_STYLE_NORMAL); - - fontFile = config.getValue("particleFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("particleFont"); - - mInfoParticleFont->loadFont(fontFile, fontSize, TTF_STYLE_BOLD); - - fontFile = config.getValue("boldFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("boldFont"); - - boldFont->loadFont(fontFile, fontSize, TTF_STYLE_NORMAL); - - const int npcFontSize = config.getIntValue("npcfontSize"); - - fontFile = config.getValue("npcFont", ""); - if (fontFile.empty()) - fontFile = branding.getStringValue("npcFont"); - - mNpcFont->loadFont(fontFile, npcFontSize, TTF_STYLE_NORMAL); -} - -void Gui::distributeMouseEvent(Widget *const source, - const MouseEventTypeT type, - const MouseButtonT button, - const int x, const int y, - const bool force, - const bool toSourceOnly) -{ - if ((source == nullptr) || (mFocusHandler == nullptr)) - return; - - Widget *widget = source; - - if (!force) - { - if (mFocusHandler->getModalFocused() != nullptr - && !widget->isModalFocused()) - { - return; - } - if (mFocusHandler->getModalMouseInputFocused() != nullptr - && !widget->isModalMouseInputFocused()) - { - return; - } - } - - MouseEvent event(source, - type, button, - x, y, mClickCount); - - Widget* parent = source; - while (parent != nullptr) - { - // If the widget has been removed due to input - // cancel the distribution. - if (!Widget::widgetExists(widget)) - break; - - parent = widget->getParent(); - - if (widget->isEnabled() || force) - { - int widgetX; - int widgetY; - widget->getAbsolutePosition(widgetX, widgetY); - - event.setX(x - widgetX); - event.setY(y - widgetY); - - std::list mouseListeners - = widget->getMouseListeners(); - - const MouseEventTypeT mouseType = event.getType(); - // Send the event to all mouse listeners of the widget. - FOR_EACH (std::list::const_iterator, - it, mouseListeners) - { - switch (mouseType) - { - case MouseEventType::ENTERED: - (*it)->mouseEntered(event); - break; - case MouseEventType::EXITED: - (*it)->mouseExited(event); - break; - case MouseEventType::MOVED: - (*it)->mouseMoved(event); - break; - case MouseEventType::PRESSED: - (*it)->mousePressed(event); - break; - case MouseEventType::RELEASED: - case MouseEventType::RELEASED2: - (*it)->mouseReleased(event); - break; - case MouseEventType::WHEEL_MOVED_UP: - (*it)->mouseWheelMovedUp(event); - break; - case MouseEventType::WHEEL_MOVED_DOWN: - (*it)->mouseWheelMovedDown(event); - break; - case MouseEventType::DRAGGED: - (*it)->mouseDragged(event); - break; - case MouseEventType::CLICKED: - (*it)->mouseClicked(event); - break; - default: - break; - } - } - - if (toSourceOnly) - break; - } - - const Widget *const swap = widget; - widget = parent; - parent = swap->getParent(); - -#ifndef DYECMD - if (type == MouseEventType::RELEASED) - dragDrop.clear(); -#endif // DYECMD - - if ((widget == nullptr) || event.isConsumed()) - break; - - // If a non modal focused widget has been reach - // and we have modal focus cancel the distribution. - if ((mFocusHandler->getModalFocused() != nullptr) - && !widget->isModalFocused()) - { - break; - } - - // If a non modal mouse input focused widget has been reach - // and we have modal mouse input focus cancel the distribution. - if ((mFocusHandler->getModalMouseInputFocused() != nullptr) - && !widget->isModalMouseInputFocused()) - { - break; - } - } -} - -void Gui::resetClickCount() -{ - mClickCount = 1; - mLastMousePressTimeStamp = 0; -} - -MouseEvent *Gui::createMouseEvent(Window *const widget) -{ - if ((viewport == nullptr) || (widget == nullptr)) - return nullptr; - - int x = 0; - int y = 0; - int mouseX = 0; - int mouseY = 0; - - getAbsolutePosition(widget, x, y); - getMouseState(mouseX, mouseY); - - return new MouseEvent(widget, - MouseEventType::MOVED, - MouseButton::EMPTY, - mouseX - x, - mouseY - y, - mClickCount); -} - -void Gui::getAbsolutePosition(Widget *restrict widget, - int &restrict x, - int &restrict y) -{ - if (widget == nullptr) - return; - x = 0; - y = 0; - while (widget->getParent() != nullptr) - { - x += widget->getX(); - y += widget->getY(); - widget = widget->getParent(); - } -} - -void Gui::handleMouseInput() -{ - BLOCK_START("Gui::handleMouseInput") - while (!mInput->isMouseQueueEmpty()) - { - const MouseInput mouseInput = guiInput->dequeueMouseInput(); - - if (touchManager.processEvent(mouseInput)) - { -#ifdef ANDROID -#ifndef USE_SDL2 - SDL_WarpMouse(mLastMouseX, mLastMouseY, - mLastMouseRealX, mLastMouseRealY); -#endif // USE_SDL2 -#endif // ANDROID - - mMouseInactivityTimer = 0; - continue; - } - - // Save the current mouse state. It will be needed if modal focus - // changes or modal mouse input focus changes. - mLastMouseX = mouseInput.getX(); - mLastMouseY = mouseInput.getY(); -#ifdef ANDROID - mLastMouseRealX = mouseInput.getRealX(); - mLastMouseRealY = mouseInput.getRealY(); -#endif // ANDROID - - switch (mouseInput.getType()) - { - case MouseEventType::PRESSED: - handleMousePressed(mouseInput); - break; - case MouseEventType::RELEASED: - handleMouseReleased(mouseInput); - break; - case MouseEventType::MOVED: - handleMouseMoved(mouseInput); - break; - case MouseEventType::WHEEL_MOVED_DOWN: - handleMouseWheelMovedDown(mouseInput); - break; - case MouseEventType::WHEEL_MOVED_UP: - handleMouseWheelMovedUp(mouseInput); - break; - case MouseEventType::CLICKED: - case MouseEventType::ENTERED: - case MouseEventType::EXITED: - case MouseEventType::DRAGGED: - case MouseEventType::RELEASED2: - default: - break; - } - } - BLOCK_END("Gui::handleMouseInput") -} - -void Gui::handleMouseReleased(const MouseInput &mouseInput) -{ - Widget *sourceWidget = getMouseEventSource( - mouseInput.getX(), mouseInput.getY()); - - int sourceWidgetX; - int sourceWidgetY; - if (mFocusHandler->getDraggedWidget() != nullptr) - { - if (sourceWidget != mFocusHandler->getLastWidgetPressed()) - mFocusHandler->setLastWidgetPressed(nullptr); - - Widget *const oldWidget = sourceWidget; - sourceWidget = mFocusHandler->getDraggedWidget(); - if ((oldWidget != nullptr) && oldWidget != sourceWidget) - { - oldWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); - distributeMouseEvent(oldWidget, - MouseEventType::RELEASED2, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY()); - } - } - - if (sourceWidget == nullptr) - return; - sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); - distributeMouseEvent(sourceWidget, - MouseEventType::RELEASED, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY()); - - if (mouseInput.getButton() == mLastMousePressButton - && mFocusHandler->getLastWidgetPressed() == sourceWidget) - { - distributeMouseEvent(sourceWidget, - MouseEventType::CLICKED, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY()); - - mFocusHandler->setLastWidgetPressed(nullptr); - } - else - { - mLastMousePressButton = MouseButton::EMPTY; - mClickCount = 0; - } - - if (mFocusHandler->getDraggedWidget() != nullptr) - mFocusHandler->setDraggedWidget(nullptr); -} - -void Gui::addGlobalFocusListener(FocusListener* focusListener) -{ - mFocusListeners.push_back(focusListener); -} - -void Gui::removeGlobalFocusListener(FocusListener* focusListener) -{ - mFocusListeners.remove(focusListener); -} - -void Gui::distributeGlobalFocusGainedEvent(const Event &focusEvent) -{ - for (FocusListenerIterator iter = mFocusListeners.begin(); - iter != mFocusListeners.end(); - ++ iter) - { - (*iter)->focusGained(focusEvent); - } -} - -void Gui::removeDragged(const Widget *const widget) -{ - if (mFocusHandler == nullptr) - return; - - if (mFocusHandler->getDraggedWidget() == widget) - mFocusHandler->setDraggedWidget(nullptr); -} - -MouseStateType Gui::getMouseState(int &x, int &y) -{ - const MouseStateType res = SDL_GetMouseState(&x, &y); - const int scale = mainGraphics->getScale(); - x /= scale; - y /= scale; - return res; -} - -void Gui::setTop(Widget *const top) -{ - if (mTop != nullptr) - mTop->setFocusHandler(nullptr); - if (top != nullptr) - top->setFocusHandler(mFocusHandler); - - mTop = top; -} - -void Gui::setGraphics(Graphics *const graphics) -{ - mGraphics = graphics; -} - -Graphics* Gui::getGraphics() const -{ - return mGraphics; -} - -void Gui::setInput(SDLInput *const input) -{ - mInput = input; -} - -SDLInput* Gui::getInput() const -{ - return mInput; -} - -void Gui::addGlobalKeyListener(KeyListener *const keyListener) -{ - mKeyListeners.push_back(keyListener); -} - -void Gui::removeGlobalKeyListener(KeyListener *const keyListener) -{ - mKeyListeners.remove(keyListener); -} - -void Gui::handleMouseWheelMovedDown(const MouseInput& mouseInput) -{ - Widget* sourceWidget = getMouseEventSource( - mouseInput.getX(), mouseInput.getY()); - - if (mFocusHandler->getDraggedWidget() != nullptr) - sourceWidget = mFocusHandler->getDraggedWidget(); - - if (sourceWidget != nullptr) - { - int sourceWidgetX = 0; - int sourceWidgetY = 0; - - sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); - distributeMouseEvent(sourceWidget, - MouseEventType::WHEEL_MOVED_DOWN, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY()); - } -} - -void Gui::handleMouseWheelMovedUp(const MouseInput& mouseInput) -{ - Widget* sourceWidget = getMouseEventSource( - mouseInput.getX(), mouseInput.getY()); - - if (mFocusHandler->getDraggedWidget() != nullptr) - sourceWidget = mFocusHandler->getDraggedWidget(); - - if (sourceWidget != nullptr) - { - int sourceWidgetX; - int sourceWidgetY; - - sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY); - distributeMouseEvent(sourceWidget, - MouseEventType::WHEEL_MOVED_UP, - mouseInput.getButton(), - mouseInput.getX(), - mouseInput.getY()); - } -} - -Widget* Gui::getWidgetAt(const int x, const int y) const -{ - // If the widget's parent has no child then we have found the widget.. - Widget* parent = mTop; - Widget* child = mTop; - Widget* selectable = mTop; - - while (child != nullptr) - { - Widget *const swap = child; - int parentX, parentY; - parent->getAbsolutePosition(parentX, parentY); - child = parent->getWidgetAt(x - parentX, y - parentY); - parent = swap; - if (parent->isSelectable()) - selectable = parent; - } - - return selectable; -} - -Widget* Gui::getMouseEventSource(const int x, const int y) const -{ - Widget *const widget = getWidgetAt(x, y); - if (widget == nullptr) - return nullptr; - - if (mFocusHandler != nullptr && - mFocusHandler->getModalMouseInputFocused() != nullptr && - !widget->isModalMouseInputFocused()) - { - return mFocusHandler->getModalMouseInputFocused(); - } - - return widget; -} - -Widget* Gui::getKeyEventSource() const -{ - Widget* widget = mFocusHandler->getFocused(); - - while (widget != nullptr && - widget->getInternalFocusHandler() != nullptr && - widget->getInternalFocusHandler()->getFocused() != nullptr) - { - widget = widget->getInternalFocusHandler()->getFocused(); - } - - return widget; -} - -void Gui::distributeKeyEvent(KeyEvent &event) const -{ - Widget* parent = event.getSource(); - Widget* widget = parent; - - if (parent == nullptr) - return; - if (mFocusHandler->getModalFocused() != nullptr && - !widget->isModalFocused()) - { - return; - } - if (mFocusHandler->getModalMouseInputFocused() != nullptr && - !widget->isModalMouseInputFocused()) - { - return; - } - - while (parent != nullptr) - { - // If the widget has been removed due to input - // cancel the distribution. - if (!Widget::widgetExists(widget)) - break; - - parent = widget->getParent(); - - if (widget->isEnabled()) - { - std::list keyListeners - = widget->getKeyListeners(); - - const KeyEventTypeT eventType = event.getType(); - // Send the event to all key listeners of the source widget. - FOR_EACH (std::list::const_iterator, - it, keyListeners) - { - switch (eventType) - { - case KeyEventType::PRESSED: - (*it)->keyPressed(event); - break; - case KeyEventType::RELEASED: - (*it)->keyReleased(event); - break; - default: - break; - } - } - } - - const Widget *const swap = widget; - widget = parent; - parent = swap->getParent(); - - // If a non modal focused widget has been reach - // and we have modal focus cancel the distribution. - if ((widget != nullptr) && - (mFocusHandler->getModalFocused() != nullptr) && - !widget->isModalFocused()) - { - break; - } - } -} - -void Gui::distributeKeyEventToGlobalKeyListeners(KeyEvent& event) -{ - BLOCK_START("Gui::distributeKeyEventToGlobalKeyListeners") - const KeyEventTypeT eventType = event.getType(); - FOR_EACH (KeyListenerListIterator, it, mKeyListeners) - { - switch (eventType) - { - case KeyEventType::PRESSED: - (*it)->keyPressed(event); - break; - case KeyEventType::RELEASED: - (*it)->keyReleased(event); - break; - default: - break; - } - - if (event.isConsumed()) - break; - } - BLOCK_END("Gui::distributeKeyEventToGlobalKeyListeners") -} - -void Gui::handleModalMouseInputFocus() -{ - BLOCK_START("Gui::handleModalMouseInputFocus") - Widget *const lastModalWidget - = mFocusHandler->getLastWidgetWithModalMouseInputFocus(); - Widget *const modalWidget = mFocusHandler->getModalMouseInputFocused(); - if (lastModalWidget != modalWidget) - { - // Check if modal mouse input focus has been gained by a widget. - if (lastModalWidget == nullptr) - { - handleModalFocusGained(); - mFocusHandler->setLastWidgetWithModalMouseInputFocus(modalWidget); - } - // Check if modal mouse input focus has been released. - else - { - handleModalFocusReleased(); - mFocusHandler->setLastWidgetWithModalMouseInputFocus(nullptr); - } - } - BLOCK_END("Gui::handleModalMouseInputFocus") -} - -void Gui::handleModalFocus() -{ - BLOCK_START("Gui::handleModalFocus") - Widget *const lastModalWidget - = mFocusHandler->getLastWidgetWithModalFocus(); - Widget *const modalWidget = mFocusHandler->getModalFocused(); - - if (lastModalWidget != modalWidget) - { - // Check if modal focus has been gained by a widget. - if (lastModalWidget == nullptr) - { - handleModalFocusGained(); - mFocusHandler->setLastWidgetWithModalFocus(modalWidget); - } - // Check if modal focus has been released. - else - { - handleModalFocusReleased(); - mFocusHandler->setLastWidgetWithModalFocus(nullptr); - } - } - BLOCK_END("Gui::handleModalFocus") -} - -void Gui::handleModalFocusGained() -{ - // Distribute an event to all widgets in the "widget with mouse" queue. - while (!mWidgetWithMouseQueue.empty()) - { - Widget *const widget = mWidgetWithMouseQueue.front(); - - if (Widget::widgetExists(widget)) - { - distributeMouseEvent(widget, - MouseEventType::EXITED, - mLastMousePressButton, - mLastMouseX, - mLastMouseY, - true, - true); - } - - mWidgetWithMouseQueue.pop_front(); - } - - mFocusHandler->setLastWidgetWithModalMouseInputFocus( - mFocusHandler->getModalMouseInputFocused()); -} - -void Gui::handleModalFocusReleased() -{ - // Check all widgets below the mouse to see if they are - // present in the "widget with mouse" queue. If a widget - // is not then it should be added and an entered event should - // be sent to it. - Widget* widget = getMouseEventSource(mLastMouseX, mLastMouseY); - Widget* parent = widget; - - while (parent != nullptr && - widget != nullptr) - { - parent = widget->getParent(); - - // Check if the widget is present in the "widget with mouse" queue. - bool widgetIsPresentInQueue = false; - FOR_EACH (std::deque::const_iterator, - iter, mWidgetWithMouseQueue) - { - if (*iter == widget) - { - widgetIsPresentInQueue = true; - break; - } - } - - // Widget is not present, send an entered event and add - // it to the "widget with mouse" queue. - if (!widgetIsPresentInQueue && Widget::widgetExists(widget)) - { - distributeMouseEvent(widget, - MouseEventType::ENTERED, - mLastMousePressButton, - mLastMouseX, - mLastMouseY, - false, - true); - mWidgetWithMouseQueue.push_front(widget); - } - - const Widget *const swap = widget; - widget = parent; - parent = swap->getParent(); - } -} - -int Gui::getMousePressLength() const -{ - if (mLastMousePressTimeStamp == 0u) - return 0; - unsigned int ticks = SDL_GetTicks(); - if (ticks > mLastMousePressTimeStamp) - return ticks - mLastMousePressTimeStamp; - return mLastMousePressTimeStamp - ticks; -} diff --git a/src/gui/gui.h b/src/gui/gui.h deleted file mode 100644 index a846f1a5d..000000000 --- a/src/gui/gui.h +++ /dev/null @@ -1,527 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_GUI_H -#define GUI_GUI_H - -#include "gui/color.h" - -#include "enums/events/mousebutton.h" -#include "enums/events/mouseeventtype.h" - -#include "enums/resources/cursor.h" - -#include -#include - -#include "localconsts.h" - -class Event; -class FocusHandler; -class FocusListener; -class Graphics; -class GuiConfigListener; -class ImageSet; -class KeyEvent; -class KeyListener; -class MouseEvent; -class MouseInput; -class Font; -class SDLInput; -class Widget; -class Window; - -#ifdef USE_SDL2 -#define MouseStateType uint32_t -#else // USE_SDL2 -#define MouseStateType uint8_t -#endif // USE_SDL2 - -/** - * \defgroup GUI Core GUI related classes (widgets) - */ - -/** - * \defgroup Interface User interface related classes (windows, dialogs) - */ - -/** - * Main GUI class. - * - * \ingroup GUI - */ -class Gui final -{ - public: - /** - * Constructor. - */ - Gui(); - - A_DELETE_COPY(Gui) - - /** - * Destructor. - */ - ~Gui(); - - void postInit(Graphics *const graphics) A_NONNULL(2); - - /** - * Performs logic of the GUI. Overridden to track mouse pointer - * activity. - */ - void logic(); - - void slowLogic(); - - void clearFonts(); - - /** - * Draws the whole Gui by calling draw functions down in the - * Gui hierarchy. It also draws the mouse pointer. - */ - void draw(); - - /** - * Called when the application window has been resized. - */ - void videoResized() const; - - FocusHandler *getFocusHandler() const noexcept2 A_WARN_UNUSED - { return mFocusHandler; } - - /** - * Return game font. - */ - Font *getFont() const RETURNS_NONNULL A_WARN_UNUSED - { return mGuiFont; } - - /** - * Return help font. - */ - Font *getHelpFont() const RETURNS_NONNULL A_WARN_UNUSED - { return mHelpFont; } - - /** - * Return secure font. - */ - Font *getSecureFont() const RETURNS_NONNULL A_WARN_UNUSED - { return mSecureFont; } - - /** - * Return npc font. - */ - Font *getNpcFont() const RETURNS_NONNULL A_WARN_UNUSED - { return mNpcFont; } - - /** - * Return the Font used for "Info Particles", i.e. ones showing, what - * you picked up, etc. - */ - Font *getInfoParticleFont() const RETURNS_NONNULL A_WARN_UNUSED - { return mInfoParticleFont; } - - /** - * Sets whether a custom cursor should be rendered. - */ - void setUseCustomCursor(const bool customCursor); - - /** - * Sets which cursor should be used. - */ - void setCursorType(const CursorT index) - { mCursorType = index; } - - void setDoubleClick(const bool b) - { mDoubleClick = b; } - - void updateFonts(); - - bool handleInput(); - - bool handleKeyInput(); - - void resetClickCount(); - - MouseEvent *createMouseEvent(Window *const widget) A_WARN_UNUSED; - - static void getAbsolutePosition(Widget *restrict widget, - int &restrict x, - int &restrict y); - - void addGlobalFocusListener(FocusListener* focusListener); - - void removeGlobalFocusListener(FocusListener* focusListener); - - void distributeGlobalFocusGainedEvent(const Event &focusEvent); - - void removeDragged(const Widget *const widget); - - int getLastMouseX() const - { return mLastMouseX; } - - int getLastMouseY() const - { return mLastMouseY; } - - static MouseStateType getMouseState(int &x, int &y); - - /** - * Sets the top widget. The top widget is the root widget - * of the GUI. If you want a GUI to be able to contain more - * than one widget the top widget should be a container. - * - * @param top The top widget. - * @see Container - */ - void setTop(Widget *const top); - - /** - * Gets the top widget. The top widget is the root widget - * of the GUI. - * - * @return The top widget. NULL if no top widget has been set. - */ - Widget* getTop() const noexcept2 A_WARN_UNUSED - { return mTop; } - - /** - * Sets the graphics object to use for drawing. - * - * @param graphics The graphics object to use for drawing. - * @see getGraphics, AllegroGraphics, HGEGraphics, - * OpenLayerGraphics, OpenGLGraphics, SDLGraphics - */ - void setGraphics(Graphics *const graphics) A_NONNULL(2); - - /** - * Gets the graphics object used for drawing. - * - * @return The graphics object used for drawing. NULL if no - * graphics object has been set. - * @see setGraphics, AllegroGraphics, HGEGraphics, - * OpenLayerGraphics, OpenGLGraphics, SDLGraphics - */ - Graphics* getGraphics() const RETURNS_NONNULL A_WARN_UNUSED; - - /** - * Sets the input object to use for input handling. - * - * @param input The input object to use for input handling. - * @see getInput, AllegroInput, HGEInput, OpenLayerInput, - * SDLInput - */ - void setInput(SDLInput *const input) A_NONNULL(2); - - /** - * Gets the input object being used for input handling. - * - * @return The input object used for handling input. NULL if no - * input object has been set. - * @see setInput, AllegroInput, HGEInput, OpenLayerInput, - * SDLInput - */ - SDLInput* getInput() const A_WARN_UNUSED; - - /** - * Adds a global key listener to the Gui. A global key listener - * will receive all key events generated from the GUI and global - * key listeners will receive the events before key listeners - * of widgets. - * - * @param keyListener The key listener to add. - * @see removeGlobalKeyListener - */ - void addGlobalKeyListener(KeyListener *const keyListener); - - /** - * Removes global key listener from the Gui. - * - * @param keyListener The key listener to remove. - * @throws Exception if the key listener hasn't been added. - * @see addGlobalKeyListener - */ - void removeGlobalKeyListener(KeyListener *const keyListener); - - bool isLongPress() const - { return getMousePressLength() > 250; } - - int getMousePressLength() const; - - protected: - void handleMouseMoved(const MouseInput &mouseInput); - - void handleMouseReleased(const MouseInput &mouseInput); - - void handleMousePressed(const MouseInput &mouseInput); - - void handleMouseInput(); - - void distributeMouseEvent(Widget *const source, - const MouseEventTypeT type, - const MouseButtonT button, - const int x, const int y, - const bool force = false, - const bool toSourceOnly = false); - - /** - * - * Handles mouse wheel moved down input. - * - * @param mouseInput The mouse input to handle. - */ - void handleMouseWheelMovedDown(const MouseInput& mouseInput); - - /** - * Handles mouse wheel moved up input. - * - * @param mouseInput The mouse input to handle. - */ - void handleMouseWheelMovedUp(const MouseInput& mouseInput); - - /** - * Gets the widget at a certain position. - * - * @return The widget at a certain position. - */ - Widget* getWidgetAt(const int x, const int y) const A_WARN_UNUSED; - - /** - * Gets the source of the mouse event. - * - * @return The source widget of the mouse event. - */ - Widget* getMouseEventSource(const int x, - const int y) const A_WARN_UNUSED; - - /** - * Gets the source of the key event. - * - * @return The source widget of the key event. - */ - Widget* getKeyEventSource() const A_WARN_UNUSED; - - /** - * Distributes a key event. - * - * @param event The key event to distribute. - - */ - void distributeKeyEvent(KeyEvent &event) const; - - /** - * Distributes a key event to the global key listeners. - * - * @param event The key event to distribute. - * - */ - void distributeKeyEventToGlobalKeyListeners(KeyEvent& event); - - /** - * Handles modal mouse input focus. Modal mouse input focus needs - * to be checked at each logic iteration as it might be necessary to - * distribute mouse entered or mouse exited events. - * - */ - void handleModalMouseInputFocus(); - - /** - * Handles modal focus. Modal focus needs to be checked at - * each logic iteration as it might be necessary to distribute - * mouse entered or mouse exited events. - * - */ - void handleModalFocus(); - - /** - * Handles modal focus gained. If modal focus has been gained it might - * be necessary to distribute mouse entered or mouse exited events. - * - */ - void handleModalFocusGained(); - - /** - * Handles modal mouse input focus gained. If modal focus has been - * gained it might be necessary to distribute mouse entered or mouse - * exited events. - * - */ - void handleModalFocusReleased(); - - private: - /** - * Holds the top widget. - */ - Widget* mTop; - - /** - * Holds the graphics implementation used. - */ - Graphics* mGraphics A_NONNULLPOINTER; - - /** - * Holds the input implementation used. - */ - SDLInput* mInput A_NONNULLPOINTER; - - /** - * Holds the focus handler for the Gui. - */ - FocusHandler* mFocusHandler A_NONNULLPOINTER; - - /** - * Typedef. - */ - typedef std::list KeyListenerList; - - /** - * Typedef. - */ - typedef KeyListenerList::iterator KeyListenerListIterator; - - /** - * Holds the global key listeners of the Gui. - */ - KeyListenerList mKeyListeners; - - /** - * Holds the last mouse button pressed. - */ - MouseButtonT mLastMousePressButton; - - /** - * Holds the last mouse press time stamp. - */ - unsigned int mLastMousePressTimeStamp; - - /** - * Holds the last mouse x coordinate. - */ - int mLastMouseX; - - /** - * Holds the last mouse y coordinate. - */ - int mLastMouseY; - - /** - * Holds the current click count. Used to keep track - * of clicks for a the last pressed button. - */ - int mClickCount; - - /** - * Holds the last button used when a drag of a widget - * was initiated. Used to be able to release a drag - * when the same button is released. - */ - MouseButtonT mLastMouseDragButton; - - /** - * Holds a stack with all the widgets with the mouse. - * Used to properly distribute mouse events. - */ - std::deque mWidgetWithMouseQueue; - - GuiConfigListener *mConfigListener; - /** The global GUI font */ - Font *mGuiFont A_NONNULLPOINTER; - /** Font for Info Particles */ - Font *mInfoParticleFont A_NONNULLPOINTER; - /** Font for Help Window */ - Font *mHelpFont A_NONNULLPOINTER; - /** Font for secure labels */ - Font *mSecureFont A_NONNULLPOINTER; - /** Font for npc text */ - Font *mNpcFont A_NONNULLPOINTER; - /** Mouse cursor images */ - ImageSet *mMouseCursors; - float mMouseCursorAlpha; - int mMouseInactivityTimer; - CursorT mCursorType; -#ifdef ANDROID - uint16_t mLastMouseRealX; - uint16_t mLastMouseRealY; -#endif // ANDROID - - typedef std::list FocusListenerList; - typedef FocusListenerList::iterator FocusListenerIterator; - FocusListenerList mFocusListeners; - Color mForegroundColor; - Color mForegroundColor2; - time_t mTime; - time_t mTime10; - bool mCustomCursor; /**< Show custom cursor */ - bool mDoubleClick; -}; - -extern Gui *gui; /**< The GUI system */ - -/** - * Bolded text font - */ -extern Font *boldFont A_NONNULLPOINTER; - -#endif // GUI_GUI_H diff --git a/src/gui/mailmessage.h b/src/gui/mailmessage.h deleted file mode 100644 index f96a6d675..000000000 --- a/src/gui/mailmessage.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2015-2017 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 . - */ - -#ifndef GUI_MAILMESSAGE_H -#define GUI_MAILMESSAGE_H - -#include "enums/net/mailmessagetype.h" - -#include - -#include "localconsts.h" - -struct MailMessage final -{ - MailMessage() : - title(), - sender(), - strTime(), - text(), - id(0), - time(0), - expireTime(0), - money(0), - type(MailMessageType::Text), - read(false) - { - } - - A_DELETE_COPY(MailMessage) - - std::string title; - std::string sender; - std::string strTime; - std::string text; - int64_t id; - int time; - int expireTime; - int64_t money; - MailMessageType::Type type; - bool read; -}; -#endif // GUI_MAILMESSAGE_H diff --git a/src/gui/models/avatarlistmodel.h b/src/gui/models/avatarlistmodel.h deleted file mode 100644 index 67ec6846a..000000000 --- a/src/gui/models/avatarlistmodel.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_AVATARLISTMODEL_H -#define GUI_MODELS_AVATARLISTMODEL_H - -#include "avatar.h" - -#include "gui/models/listmodel.h" - -class AvatarListModel notfinal : public ListModel -{ - public: - AvatarListModel() : - ListModel() - { } - - A_DELETE_COPY(AvatarListModel) - - virtual Avatar *getAvatarAt(const int i) A_WARN_UNUSED = 0; - - std::string getElementAt(int i) override final A_WARN_UNUSED - { return getAvatarAt(i)->getName(); } -}; - -#endif // GUI_MODELS_AVATARLISTMODEL_H diff --git a/src/gui/models/beingslistmodel.h b/src/gui/models/beingslistmodel.h deleted file mode 100644 index a0a9d2920..000000000 --- a/src/gui/models/beingslistmodel.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_BEINGSLISTMODEL_H -#define GUI_MODELS_BEINGSLISTMODEL_H - -#include "gui/models/avatarlistmodel.h" - -#include "utils/cast.h" -#include "utils/dtor.h" -#include "utils/vector.h" - -class BeingsListModel final : public AvatarListModel -{ - public: - BeingsListModel() : - AvatarListModel(), - mMembers() - { - } - - A_DELETE_COPY(BeingsListModel) - - ~BeingsListModel() - { - delete_all(mMembers); - mMembers.clear(); - } - - STD_VECTOR *getMembers() RETURNS_NONNULL A_WARN_UNUSED - { - return &mMembers; - } - - Avatar *getAvatarAt(int index) override final - { - return mMembers[index]; - } - - int getNumberOfElements() override final - { - return CAST_S32(mMembers.size()); - } - - STD_VECTOR mMembers; -}; - -#endif // GUI_MODELS_BEINGSLISTMODEL_H diff --git a/src/gui/models/colorlistmodel.h b/src/gui/models/colorlistmodel.h deleted file mode 100644 index bb2d413c2..000000000 --- a/src/gui/models/colorlistmodel.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_COLORLISTMODEL_H -#define GUI_MODELS_COLORLISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -const char *COLOR_NAME[14] = -{ - // TRANSLATORS: chat color - N_("default"), - // TRANSLATORS: chat color - N_("black"), - // TRANSLATORS: chat color - N_("red"), - // TRANSLATORS: chat color - N_("green"), - // TRANSLATORS: chat color - N_("blue"), - // TRANSLATORS: chat color - N_("gold"), - // TRANSLATORS: chat color - N_("yellow"), - // TRANSLATORS: chat color - N_("pink"), - // TRANSLATORS: chat color - N_("purple"), - // TRANSLATORS: chat color - N_("grey"), - // TRANSLATORS: chat color - N_("brown"), - // TRANSLATORS: chat color - N_("rainbow 1"), - // TRANSLATORS: chat color - N_("rainbow 2"), - // TRANSLATORS: chat color - N_("rainbow 3"), -}; - -class ColorListModel final : public ListModel -{ - public: - ColorListModel() : - ListModel() - { } - - A_DELETE_COPY(ColorListModel) - - ~ColorListModel() - { } - - int getNumberOfElements() override final - { - return 14; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return gettext(COLOR_NAME[i]); - } -}; - -#endif // GUI_MODELS_COLORLISTMODEL_H diff --git a/src/gui/models/colormodel.cpp b/src/gui/models/colormodel.cpp deleted file mode 100644 index 3bbded2e2..000000000 --- a/src/gui/models/colormodel.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "gui/models/colormodel.h" - -#include "gui/widgets/widget2.h" - -#include "utils/gettext.h" - -#include "debug.h" - -ColorModel::ColorModel() : - ListModel(), - mNames(), - mColors() -{ -} - -ColorModel::~ColorModel() -{ -} - -int ColorModel::getNumberOfElements() -{ - return CAST_S32(mNames.size()); -} - -std::string ColorModel::getElementAt(int i) -{ - if (i >= getNumberOfElements() || i < 0) - return "???"; - return mNames[CAST_SIZE(i)]; -} - -const ColorPair *ColorModel::getColorAt(const int i) const -{ - if (i >= CAST_S32(mColors.size()) || i < 0) - return &mColors[0]; - - return &mColors[CAST_SIZE(i)]; -} - -void ColorModel::add(const std::string &name, const Color *const color1, - const Color *const color2) -{ - mNames.push_back(name); - mColors.push_back(ColorPair(color1, color2)); -} - -#define addColor(name, color) \ - model->add(name, &widget->getThemeColor(ThemeColorId::color), \ - &widget->getThemeColor(ThemeColorId::color##_OUTLINE)); - -ColorModel *ColorModel::createDefault(const Widget2 *const widget) -{ - ColorModel *const model = new ColorModel; - if (widget == nullptr) - return model; - // TRANSLATORS: color name - addColor(_("black"), BLACK); - // TRANSLATORS: color name - addColor(_("red"), RED); - // TRANSLATORS: color name - addColor(_("green"), GREEN); - // TRANSLATORS: color name - addColor(_("blue"), BLUE); - // TRANSLATORS: color name - addColor(_("gold"), ORANGE); - // TRANSLATORS: color name - addColor(_("yellow"), YELLOW); - // TRANSLATORS: color name - addColor(_("pink"), PINK); - // TRANSLATORS: color name - addColor(_("purple"), PURPLE); - // TRANSLATORS: color name - addColor(_("grey"), GRAY); - // TRANSLATORS: color name - addColor(_("brown"), BROWN); - return model; -} diff --git a/src/gui/models/colormodel.h b/src/gui/models/colormodel.h deleted file mode 100644 index 9d621dfbe..000000000 --- a/src/gui/models/colormodel.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_COLORMODEL_H -#define GUI_MODELS_COLORMODEL_H - -#include "utils/stringvector.h" - -#include "gui/colorpair.h" - -#include "gui/models/listmodel.h" - -#include "localconsts.h" - -class Color; -class Widget2; - -class ColorModel final : public ListModel -{ - public: - ColorModel(); - - A_DELETE_COPY(ColorModel) - - virtual ~ColorModel(); - - int getNumberOfElements() override final A_WARN_UNUSED; - - std::string getElementAt(int i) override final A_WARN_UNUSED; - - const ColorPair *getColorAt(const int i) - const RETURNS_NONNULL A_WARN_UNUSED; - - StringVect &getNames() A_WARN_UNUSED - { return mNames; } - - size_t size() A_WARN_UNUSED - { return mNames.size(); } - - void add(const std::string &name, - const Color *const color1, - const Color *const color2); - - static ColorModel *createDefault(const Widget2 *const widget) - RETURNS_NONNULL; - - protected: - StringVect mNames; - STD_VECTOR mColors; -}; - -#endif // GUI_MODELS_COLORMODEL_H diff --git a/src/gui/models/extendedlistmodel.h b/src/gui/models/extendedlistmodel.h deleted file mode 100644 index 981a96897..000000000 --- a/src/gui/models/extendedlistmodel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_EXTENDEDLISTMODEL_H -#define GUI_MODELS_EXTENDEDLISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "resources/image/image.h" - -class ExtendedListModel notfinal : public ListModel -{ - public: - ExtendedListModel() : - ListModel() - { } - - A_DELETE_COPY(ExtendedListModel) - - virtual const Image *getImageAt(int i) A_WARN_UNUSED = 0; -}; - -#endif // GUI_MODELS_EXTENDEDLISTMODEL_H diff --git a/src/gui/models/extendednamesmodel.cpp b/src/gui/models/extendednamesmodel.cpp deleted file mode 100644 index 76191ae5a..000000000 --- a/src/gui/models/extendednamesmodel.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "gui/models/extendednamesmodel.h" - -#include "utils/cast.h" -#include "utils/foreach.h" - -#include "debug.h" - -ExtendedNamesModel::ExtendedNamesModel() : - mNames(), - mImages() -{ -} - -ExtendedNamesModel::~ExtendedNamesModel() -{ - clear(); -} - -int ExtendedNamesModel::getNumberOfElements() -{ - return CAST_S32(mNames.size()); -} - -std::string ExtendedNamesModel::getElementAt(int i) -{ - if (i >= getNumberOfElements() || i < 0) - return "???"; - return mNames[CAST_SIZE(i)]; -} - -const Image *ExtendedNamesModel::getImageAt(int i) -{ - if (i >= CAST_S32(mImages.size()) || i < 0) - return nullptr; - - return mImages[CAST_SIZE(i)]; -} - -void ExtendedNamesModel::clear() -{ - mNames.clear(); - FOR_EACH (STD_VECTOR::iterator, it, mImages) - { - if (*it != nullptr) - (*it)->decRef(); - } - mImages.clear(); -} diff --git a/src/gui/models/extendednamesmodel.h b/src/gui/models/extendednamesmodel.h deleted file mode 100644 index 2e85a4b2b..000000000 --- a/src/gui/models/extendednamesmodel.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_EXTENDEDNAMESMODEL_H -#define GUI_MODELS_EXTENDEDNAMESMODEL_H - -#include "utils/stringvector.h" - -#include "gui/models/extendedlistmodel.h" - -class ExtendedNamesModel notfinal : public ExtendedListModel -{ - public: - ExtendedNamesModel(); - - A_DELETE_COPY(ExtendedNamesModel) - - virtual ~ExtendedNamesModel(); - - int getNumberOfElements() override final A_WARN_UNUSED; - - std::string getElementAt(int i) override final A_WARN_UNUSED; - - const Image *getImageAt(int i) override final A_WARN_UNUSED; - - StringVect &getNames() A_WARN_UNUSED - { return mNames; } - - STD_VECTOR &getImages() A_WARN_UNUSED - { return mImages; } - - size_t size() A_WARN_UNUSED - { return mNames.size(); } - - void add(const std::string &str) - { mNames.push_back(str); } - - void clear(); - - protected: - StringVect mNames; - STD_VECTOR mImages; -}; - -#endif // GUI_MODELS_EXTENDEDNAMESMODEL_H diff --git a/src/gui/models/fontsizechoicelistmodel.h b/src/gui/models/fontsizechoicelistmodel.h deleted file mode 100644 index 79aecf2fb..000000000 --- a/src/gui/models/fontsizechoicelistmodel.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_FONTSIZECHOICELISTMODEL_H -#define GUI_MODELS_FONTSIZECHOICELISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -#include "localconsts.h" - -const int maxFontSizes = 16; - -const char *SIZE_NAME[maxFontSizes] = -{ - // TRANSLATORS: font size - N_("Very small (8)"), - // TRANSLATORS: font size - N_("Very small (9)"), - // TRANSLATORS: font size - N_("Tiny (10)"), - // TRANSLATORS: font size - N_("Small (11)"), - // TRANSLATORS: font size - N_("Medium (12)"), - // TRANSLATORS: font size - N_("Normal (13)"), - // TRANSLATORS: font size - N_("Large (14)"), - // TRANSLATORS: font size - N_("Large (15)"), - // TRANSLATORS: font size - N_("Large (16)"), - // TRANSLATORS: font size - N_("Big (17)"), - // TRANSLATORS: font size - N_("Big (18)"), - // TRANSLATORS: font size - N_("Big (19)"), - // TRANSLATORS: font size - N_("Very big (20)"), - // TRANSLATORS: font size - N_("Very big (21)"), - // TRANSLATORS: font size - N_("Very big (22)"), - // TRANSLATORS: font size - N_("Huge (23)") -}; - -class FontSizeChoiceListModel final : public ListModel -{ - public: - FontSizeChoiceListModel() : - ListModel() - { } - - A_DELETE_COPY(FontSizeChoiceListModel) - - ~FontSizeChoiceListModel() - { } - - int getNumberOfElements() override final A_WARN_UNUSED - { return maxFontSizes; } - - std::string getElementAt(int i) override final A_WARN_UNUSED - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - - return gettext(SIZE_NAME[i]); - } -}; - -#endif // GUI_MODELS_FONTSIZECHOICELISTMODEL_H diff --git a/src/gui/models/fontsmodel.h b/src/gui/models/fontsmodel.h deleted file mode 100644 index b7f5fc4be..000000000 --- a/src/gui/models/fontsmodel.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_FONTSMODEL_H -#define GUI_MODELS_FONTSMODEL_H - -#include "gui/theme.h" - -#include "gui/models/namesmodel.h" - -#include "localconsts.h" - -class FontsModel final : public NamesModel -{ - public: - FontsModel() : - NamesModel() - { Theme::fillFontsList(mNames); } - - A_DELETE_COPY(FontsModel) - - ~FontsModel() - { } -}; - -#endif // GUI_MODELS_FONTSMODEL_H diff --git a/src/gui/models/iconsmodel.h b/src/gui/models/iconsmodel.h deleted file mode 100644 index 4028895fb..000000000 --- a/src/gui/models/iconsmodel.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_ICONSMODEL_H -#define GUI_MODELS_ICONSMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/foreach.h" - -#include "resources/iteminfo.h" - -#include "resources/db/itemdb.h" - -#include - -#include "localconsts.h" - -class IconsModel final : public ListModel -{ - public: - IconsModel() : - mStrings() - { - const std::map &items = ItemDB::getItemInfos(); - std::list tempStrings; - - for (std::map::const_iterator - i = items.begin(), i_end = items.end(); - i != i_end; ++i) - { - if (i->first < 0) - continue; - - const ItemInfo &info = (*i->second); - const std::string &name = info.getName(); - if (name != "unnamed" && !info.getName().empty() - && info.getName() != "unnamed") - { - tempStrings.push_back(name); - } - } - tempStrings.sort(); - mStrings.push_back(""); - FOR_EACH (std::list::const_iterator, i, tempStrings) - mStrings.push_back(*i); - } - - A_DELETE_COPY(IconsModel) - - ~IconsModel() - { } - - int getNumberOfElements() override final - { - return CAST_S32(mStrings.size()); - } - - std::string getElementAt(int i) override final - { - if (i < 0 || i >= getNumberOfElements()) - return "???"; - return mStrings.at(i); - } - private: - StringVect mStrings; -}; - -#endif // GUI_MODELS_ICONSMODEL_H diff --git a/src/gui/models/ignorechoiceslistmodel.h b/src/gui/models/ignorechoiceslistmodel.h deleted file mode 100644 index 6cd8bbe87..000000000 --- a/src/gui/models/ignorechoiceslistmodel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_IGNORECHOICESLISTMODEL_H -#define GUI_MODELS_IGNORECHOICESLISTMODEL_H - -#include "gui/models/playerrelationlistmodel.h" - -#include "being/playerignorestrategy.h" -#include "being/playerrelations.h" - -#include "utils/cast.h" - -/** - * Class for choosing one of the various `what to do when ignoring a player' options - */ -class IgnoreChoicesListModel final : public ListModel -{ - public: - IgnoreChoicesListModel() : - ListModel() - { } - - A_DELETE_COPY(IgnoreChoicesListModel) - - ~IgnoreChoicesListModel() - { } - - int getNumberOfElements() override final - { - return CAST_S32(playerRelations. - getPlayerIgnoreStrategies()->size()); - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - - return (*playerRelations.getPlayerIgnoreStrategies()) - [i]->mDescription; - } -}; - -#endif // GUI_MODELS_IGNORECHOICESLISTMODEL_H diff --git a/src/gui/models/itemsmodel.h b/src/gui/models/itemsmodel.h deleted file mode 100644 index a49a7cfc5..000000000 --- a/src/gui/models/itemsmodel.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_ITEMSMODEL_H -#define GUI_MODELS_ITEMSMODEL_H - -#include "gui/models/listmodel.h" - -#include "resources/iteminfo.h" - -#include "resources/db/itemdb.h" - -#include "utils/foreach.h" - -#include - -#include "localconsts.h" - -class ItemsModal final : public ListModel -{ - public: - ItemsModal() : - mStrings() - { - const std::map &items = ItemDB::getItemInfos(); - std::list tempStrings; - - for (std::map::const_iterator - i = items.begin(), i_end = items.end(); - i != i_end; ++i) - { - if (i->first < 0) - continue; - - const ItemInfo &info = *i->second; - const std::string &name = info.getName(); - if (name != "unnamed" && !info.getName().empty() - && info.getName() != "unnamed") - { - tempStrings.push_back(name); - } - } - tempStrings.sort(); - FOR_EACH (std::list::const_iterator, i, tempStrings) - mStrings.push_back(*i); - } - - A_DELETE_COPY(ItemsModal) - - ~ItemsModal() - { } - - int getNumberOfElements() override final - { - return CAST_S32(mStrings.size()); - } - - std::string getElementAt(int i) override final - { - if (i < 0 || i >= getNumberOfElements()) - return "???"; - return mStrings.at(i); - } - - private: - StringVect mStrings; -}; - -#endif // GUI_MODELS_ITEMSMODEL_H diff --git a/src/gui/models/keylistmodel.h b/src/gui/models/keylistmodel.h deleted file mode 100644 index 601426f8a..000000000 --- a/src/gui/models/keylistmodel.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2007 Joshua Langley - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_KEYLISTMODEL_H -#define GUI_MODELS_KEYLISTMODEL_H - -#include "gui/setupactiondata.h" - -#include "gui/models/listmodel.h" - -#include "localconsts.h" - -extern SetupActionData *const setupActionData[]; - -/** - * The list model for key function list. - * - * \ingroup Interface - */ -class KeyListModel final : public ListModel -{ - public: - KeyListModel() : - mDataNum(0), - mSelectedData(0), - mSize(0) - { - } - - A_DELETE_COPY(KeyListModel) - - /** - * Returns the number of elements in container. - */ - int getNumberOfElements() override final - { return mSize; } - - /** - * Returns element from container. - */ - std::string getElementAt(int i) override final - { return setupActionData[mSelectedData][i].text; } - - /** - * Sets element from container. - */ - void setElementAt(const int i, const std::string &caption) - { setupActionData[mSelectedData][i].text = caption; } - - void setSize(const int size) noexcept2 - { mSize = size; } - - void setDataNum(const int num) noexcept2 - { mDataNum = num; } - - void setSelectedData(const int i) noexcept2 - { mSelectedData = i; } - - int getSelectedData() const noexcept2 A_WARN_UNUSED - { return mSelectedData; } - - private: - int mDataNum; - int mSelectedData; - int mSize; -}; - -#endif // GUI_MODELS_KEYLISTMODEL_H diff --git a/src/gui/models/langlistmodel.h b/src/gui/models/langlistmodel.h deleted file mode 100644 index f8c67ad30..000000000 --- a/src/gui/models/langlistmodel.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_LANGLISTMODEL_H -#define GUI_MODELS_LANGLISTMODEL_H - -#include "gui/models/extendedlistmodel.h" - -#include "resources/loaders/imageloader.h" - -#include "utils/gettext.h" - -#include "localconsts.h" - -struct Language final -{ - A_DEFAULT_COPY(Language) - - std::string name; - std::string value; - std::string icon; -}; - -const int langs_count = 22; - -const Language LANG_NAME[langs_count] = -{ - // TRANSLATORS: language - {N_("(default)"), "", ""}, - // TRANSLATORS: language - {N_("Catalan"), "ca_ES", "ca.png"}, - // TRANSLATORS: language - {N_("Chinese (China)"), "zh_CN", "cn.png"}, - // TRANSLATORS: language - {N_("Chinese (Hong Kong)"), "zh_HK", "hk.png"}, - // TRANSLATORS: language - {N_("Czech"), "cs_CZ", "cz.png"}, - // TRANSLATORS: language - {N_("Dutch (Belgium/Flemish)"), "nl_BE", "nl_BE.png"}, - // TRANSLATORS: language - {N_("English"), "C", "en.png"}, - // TRANSLATORS: language - {N_("Finnish"), "fi_FI", "fi.png"}, - // TRANSLATORS: language - {N_("French"), "fr_FR", "fr.png"}, - // TRANSLATORS: language - {N_("German"), "de_DE", "de.png"}, - // TRANSLATORS: language - {N_("Indonesian"), "id_ID", "id.png"}, - // TRANSLATORS: language - {N_("Italian"), "it_IT", "it.png"}, - // TRANSLATORS: language - {N_("Japanese"), "ja_JP", "jp.png"}, - // TRANSLATORS: language - {N_("Polish"), "pl_PL", "pl.png"}, - // TRANSLATORS: language - {N_("Portuguese"), "pt_PT", "pt.png"}, - // TRANSLATORS: language - {N_("Portuguese (Brazilian)"), "pt_BR", "pt_BR.png"}, - // TRANSLATORS: language - {N_("Russian"), "ru_RU", "ru.png"}, - // TRANSLATORS: language - {N_("Spanish (Castilian)"), "es_ES", "es.png"}, - // TRANSLATORS: language - {N_("Swedish (Sweden)"), "sv_SE", "se.png"}, - // TRANSLATORS: language - {N_("Turkish"), "tr_TR", "tr.png"}, - // TRANSLATORS: language - {N_("Ukrainian"), "uk_UA", "ua.png"}, - // TRANSLATORS: language - {N_("Esperanto"), "eo", "eo.png"} -}; - -class LangListModel final : public ExtendedListModel -{ - public: - LangListModel() - { - for (int f = 0; f < langs_count; f ++) - { - const std::string icon = LANG_NAME[f].icon; - if (!icon.empty()) - { - mIcons[f] = Loader::getImage("graphics/flags/" - + icon); - } - else - { - mIcons[f] = nullptr; - } - } - } - - A_DELETE_COPY(LangListModel) - - ~LangListModel() - { - for (int f = 0; f < langs_count; f ++) - { - Image *const img = mIcons[f]; - if (img != nullptr) - img->decRef(); - } - } - - int getNumberOfElements() override final A_WARN_UNUSED - { return langs_count; } - - std::string getElementAt(int i) override final A_WARN_UNUSED - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - - return gettext(LANG_NAME[i].name.c_str()); - } - - const Image *getImageAt(int i) override final A_WARN_UNUSED - { - if (i >= getNumberOfElements() || i < 0) - return nullptr; - return mIcons[i]; - } - - Image *mIcons[langs_count] A_NONNULLPOINTER; -}; - -#endif // GUI_MODELS_LANGLISTMODEL_H diff --git a/src/gui/models/listmodel.h b/src/gui/models/listmodel.h deleted file mode 100644 index df8db8b54..000000000 --- a/src/gui/models/listmodel.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GUI_MODELS_LISTMODEL_H -#define GUI_MODELS_LISTMODEL_H - -#include - -#include "localconsts.h" - -/** - * An interface for a model that represents a list. It is - * used in certain widgets, like the ListBox, to handle a - * lists with string elements. If you want to use widgets - * like ListBox, make a derived class from this class that - * represents your list. - */ -class ListModel notfinal -{ - public: - ListModel() - { } - - A_DELETE_COPY(ListModel) - - /** - * Destructor. - */ - virtual ~ListModel() - { } - - /** - * Gets the number of elements in the list. - * - * @return The number of elements in the list - */ - virtual int getNumberOfElements() A_WARN_UNUSED = 0; - - /** - * Gets an element at a certain index in the list. - * - * @param i An index in the list. - * @return An element as a string at the a certain index. - */ - virtual std::string getElementAt(int i) A_WARN_UNUSED = 0; -}; - -#endif // GUI_MODELS_LISTMODEL_H diff --git a/src/gui/models/magicschoolmodel.h b/src/gui/models/magicschoolmodel.h deleted file mode 100644 index 2dcd01880..000000000 --- a/src/gui/models/magicschoolmodel.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_MAGICSCHOOLMODEL_H -#define GUI_MODELS_MAGICSCHOOLMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -#include "localconsts.h" - -const char *MAGIC_SCHOOL_TEXT[6] = -{ - // TRANSLATORS: magic school - N_("General Magic"), - // TRANSLATORS: magic school - N_("Life Magic"), - // TRANSLATORS: magic school - N_("War Magic"), - // TRANSLATORS: magic school - N_("Transmute Magic"), - // TRANSLATORS: magic school - N_("Nature Magic"), - // TRANSLATORS: magic school - N_("Astral Magic") -}; - -class MagicSchoolModel final : public ListModel -{ - public: - MagicSchoolModel() : - ListModel() - { } - - A_DELETE_COPY(MagicSchoolModel) - - ~MagicSchoolModel() - { } - - int getNumberOfElements() override final - { - return 6; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return MAGIC_SCHOOL_TEXT[i]; - } -}; - -#endif // GUI_MODELS_MAGICSCHOOLMODEL_H diff --git a/src/gui/models/modelistmodel.cpp b/src/gui/models/modelistmodel.cpp deleted file mode 100644 index d1253b9f1..000000000 --- a/src/gui/models/modelistmodel.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "render/graphics.h" - -#include "utils/sdlhelper.h" -#include "utils/stringutils.h" - -#include "gui/models/modelistmodel.h" - -#include - -#include "debug.h" - -#ifndef ANDROID -static bool modeSorter(const std::string &mode1, const std::string &mode2) -{ - const int width1 = atoi(mode1.substr(0, mode1.find('x')).c_str()); - const int height1 = atoi(mode1.substr(mode1.find('x') + 1).c_str()); - if ((width1 == 0) || (height1 == 0)) - return false; - - const int width2 = atoi(mode2.substr(0, mode2.find('x')).c_str()); - const int height2 = atoi(mode2.substr(mode2.find('x') + 1).c_str()); - if ((width2 == 0) || (height2 == 0)) - return false; - if (width1 != width2) - return width1 < width2; - - if (height1 != height2) - return height1 < height2; - - return false; -} -#endif // ANDROID - -ModeListModel::ModeListModel() : - ListModel(), - mVideoModes() -{ - SDL::getAllVideoModes(mVideoModes); -#ifndef ANDROID - addCustomMode("640x480"); - addCustomMode("800x600"); - addCustomMode("1024x768"); - addCustomMode("1280x1024"); - addCustomMode("1400x900"); - addCustomMode("1500x990"); - addCustomMode(toString(mainGraphics->mActualWidth).append("x") - .append(toString(mainGraphics->mActualHeight))); - - std::sort(mVideoModes.begin(), mVideoModes.end(), &modeSorter); - mVideoModes.push_back("custom"); -#endif // ANDROID -} - -#ifndef ANDROID -void ModeListModel::addCustomMode(const std::string &mode) -{ - StringVectCIter it = mVideoModes.begin(); - const StringVectCIter it_end = mVideoModes.end(); - while (it != it_end) - { - if (*it == mode) - return; - ++ it; - } - mVideoModes.push_back(mode); -} -#endif // ANDROID - -int ModeListModel::getIndexOf(const std::string &widthXHeightMode) -{ - std::string currentMode; - for (int i = 0; i < getNumberOfElements(); i++) - { - currentMode = getElementAt(i); - if (currentMode == widthXHeightMode) - return i; - } - return -1; -} diff --git a/src/gui/models/modelistmodel.h b/src/gui/models/modelistmodel.h deleted file mode 100644 index ed4d449d7..000000000 --- a/src/gui/models/modelistmodel.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_MODELISTMODEL_H -#define GUI_MODELS_MODELISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/cast.h" -#include "utils/stringvector.h" - -#include "localconsts.h" - -class ModeListModel final : public ListModel -{ - public: - ModeListModel(); - - A_DELETE_COPY(ModeListModel) - - ~ModeListModel() - { } - - /** - * Returns the number of elements in container. - */ - int getNumberOfElements() override final - { return CAST_S32(mVideoModes.size()); } - - /** - * Returns element from container. - */ - std::string getElementAt(int i) override final - { return mVideoModes[CAST_SIZE(i)]; } - - /** - * Returns the index corresponding to the given video mode. - * E.g.: "800x600". - * or -1 if not found. - */ - int getIndexOf(const std::string &widthXHeightMode); - - private: -#ifndef ANDROID - void addCustomMode(const std::string &mode); -#endif // ANDROID - - StringVect mVideoModes; -}; - -#endif // GUI_MODELS_MODELISTMODEL_H diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp deleted file mode 100644 index 5344a7a7d..000000000 --- a/src/gui/models/namesmodel.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "gui/models/namesmodel.h" - -#include "utils/cast.h" -#include "utils/foreach.h" -#include "utils/gettext.h" - -#include "debug.h" - -NamesModel::NamesModel() : - ListModel(), - mNames() -{ -} - -NamesModel::~NamesModel() -{ -} - -int NamesModel::getNumberOfElements() -{ - return CAST_S32(mNames.size()); -} - -std::string NamesModel::getElementAt(int i) -{ - if (i >= getNumberOfElements() || i < 0) - return "???"; - return mNames[CAST_SIZE(i)]; -} - -void NamesModel::fillFromArray(const char *const *const arr, - const std::size_t sz) -{ - if (arr == nullptr) - return; - for (size_t f = 0; f < sz; f ++) - mNames.push_back(gettext(arr[f])); -} - -void NamesModel::fillFromVector(const StringVect &vect) -{ - FOR_EACH(StringVectCIter, it, vect) - { - const std::string str = *it; - if (!str.empty()) - mNames.push_back(str); - } -} diff --git a/src/gui/models/namesmodel.h b/src/gui/models/namesmodel.h deleted file mode 100644 index a239bd9aa..000000000 --- a/src/gui/models/namesmodel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_NAMESMODEL_H -#define GUI_MODELS_NAMESMODEL_H - -#include "utils/stringvector.h" - -#include "gui/models/listmodel.h" - -#include "localconsts.h" - -class NamesModel notfinal : public ListModel -{ - public: - NamesModel(); - - A_DELETE_COPY(NamesModel) - - virtual ~NamesModel(); - - int getNumberOfElements() override final A_WARN_UNUSED; - - std::string getElementAt(int i) override final A_WARN_UNUSED; - - StringVect &getNames() noexcept2 A_WARN_UNUSED - { return mNames; } - - size_t size() const noexcept2 A_WARN_UNUSED - { return mNames.size(); } - - void clear() - { mNames.clear(); } - - void add(const std::string &str) - { mNames.push_back(str); } - - void fillFromArray(const char *const *const arr, - const std::size_t size); - - void fillFromVector(const StringVect &vect); - - protected: - StringVect mNames; -}; - -#endif // GUI_MODELS_NAMESMODEL_H diff --git a/src/gui/models/opengllistmodel.h b/src/gui/models/opengllistmodel.h deleted file mode 100644 index 085dd17a5..000000000 --- a/src/gui/models/opengllistmodel.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_OPENGLLISTMODEL_H -#define GUI_MODELS_OPENGLLISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "render/rendererslistsdl.h" - -#include "localconsts.h" - -class OpenGLListModel final : public ListModel -{ - public: - OpenGLListModel() : - ListModel() - { } - - A_DELETE_COPY(OpenGLListModel) - - ~OpenGLListModel() - { } - - int getNumberOfElements() override final - { return renderModesListSize; } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return gettext(OPENGL_NAME[i]); - } -}; - -#endif // GUI_MODELS_OPENGLLISTMODEL_H diff --git a/src/gui/models/playerrelationlistmodel.h b/src/gui/models/playerrelationlistmodel.h deleted file mode 100644 index 5e58d4905..000000000 --- a/src/gui/models/playerrelationlistmodel.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_PLAYERRELATIONLISTMODEL_H -#define GUI_MODELS_PLAYERRELATIONLISTMODEL_H - -#include "being/playerrelation.h" - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -static const char *const RELATION_NAMES[PlayerRelation::RELATIONS_NR] = -{ - // TRANSLATORS: relation type - N_("Neutral"), - // TRANSLATORS: relation type - N_("Friend"), - // TRANSLATORS: relation type - N_("Disregarded"), - // TRANSLATORS: relation type - N_("Ignored"), - // TRANSLATORS: relation type - N_("Erased"), - // TRANSLATORS: relation type - N_("Blacklisted"), - // TRANSLATORS: relation type - N_("Enemy") -}; - -class PlayerRelationListModel final : public ListModel -{ - public: - PlayerRelationListModel() : - ListModel() - { } - - A_DELETE_COPY(PlayerRelationListModel) - - ~PlayerRelationListModel() - { } - - int getNumberOfElements() override final - { - return PlayerRelation::RELATIONS_NR; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return ""; - return gettext(RELATION_NAMES[i]); - } -}; - -#endif // GUI_MODELS_PLAYERRELATIONLISTMODEL_H diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp deleted file mode 100644 index 271b6a5bb..000000000 --- a/src/gui/models/playertablemodel.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/models/playertablemodel.h" - -#include "being/playerrelations.h" - -#include "gui/widgets/dropdown.h" -#include "gui/widgets/label.h" - -#include "gui/models/playerrelationlistmodel.h" - -#include "utils/delete2.h" -#include "utils/dtor.h" - -#include "debug.h" - -static const int COLUMNS_NR = 2; // name plus listbox -static const int NAME_COLUMN = 0; -static const unsigned int RELATION_CHOICE_COLUMN = 1; - -static const unsigned int ROW_HEIGHT = 12; -// The following column widths really shouldn't be hardcoded -// but should scale with the size of the widget... except -// that, right now, the widget doesn't exactly scale either. -static const unsigned int NAME_COLUMN_WIDTH = 230; -static const unsigned int RELATION_CHOICE_COLUMN_WIDTH = 80; - -#define WIDGET_AT(row, column) (((row) * COLUMNS_NR) + column) - -PlayerTableModel::PlayerTableModel(const Widget2 *const widget) : - Widget2(widget), - TableModel(), - mPlayers(nullptr), - mWidgets(), - mListModel(new PlayerRelationListModel) -{ - playerRelationsUpdated(); -} - -PlayerTableModel::~PlayerTableModel() -{ - freeWidgets(); - delete2(mListModel) - delete2(mPlayers) -} - -int PlayerTableModel::getRows() const -{ - if (mPlayers != nullptr) - return CAST_S32(mPlayers->size()); - return 0; -} - -int PlayerTableModel::getColumns() const -{ - return COLUMNS_NR; -} - -int PlayerTableModel::getRowHeight() const -{ - return ROW_HEIGHT; -} - -int PlayerTableModel::getColumnWidth(const int index) const -{ - if (index == NAME_COLUMN) - return NAME_COLUMN_WIDTH; - return RELATION_CHOICE_COLUMN_WIDTH; -} - -void PlayerTableModel::playerRelationsUpdated() -{ - signalBeforeUpdate(); - - freeWidgets(); - StringVect *const player_names = playerRelations.getPlayers(); - delete mPlayers; - mPlayers = player_names; - - // set up widgets - for (unsigned int r = 0, fsz = CAST_U32( - player_names->size()); r < fsz; ++r) - { - const std::string name = (*player_names)[r]; - Widget *const widget = new Label(this, name); - mWidgets.push_back(widget); - - DropDown *const choicebox = new DropDown(this, mListModel); - choicebox->setSelected(CAST_S32( - playerRelations.getRelation(name))); - mWidgets.push_back(choicebox); - } - - signalAfterUpdate(); -} - -void PlayerTableModel::updateModelInRow(const int row) const -{ - const DropDown *const choicebox = static_cast( - getElementAt(row, RELATION_CHOICE_COLUMN)); - if (choicebox == nullptr) - return; - playerRelations.setRelation(getPlayerAt(row), - static_cast( - choicebox->getSelected())); -} - -Widget *PlayerTableModel::getElementAt(int row, int column) const -{ - return mWidgets[WIDGET_AT(row, column)]; -} - -void PlayerTableModel::freeWidgets() -{ - delete2(mPlayers) - delete_all(mWidgets); - mWidgets.clear(); -} - -std::string PlayerTableModel::getPlayerAt(const int index) const -{ - if ((mPlayers == nullptr) || index < 0 - || index >= CAST_S32(mPlayers->size())) - { - return std::string(); - } - return (*mPlayers)[index]; -} diff --git a/src/gui/models/playertablemodel.h b/src/gui/models/playertablemodel.h deleted file mode 100644 index dfb00eeb4..000000000 --- a/src/gui/models/playertablemodel.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_PLAYERTABLEMODEL_H -#define GUI_MODELS_PLAYERTABLEMODEL_H - -#include "gui/widgets/widget2.h" - -#include "gui/models/tablemodel.h" - -#include "localconsts.h" - -class PlayerRelationListModel; - -class PlayerTableModel final : public Widget2, - public TableModel -{ - public: - explicit PlayerTableModel(const Widget2 *const widget); - - A_DELETE_COPY(PlayerTableModel) - - ~PlayerTableModel(); - - int getRows() const override final; - - int getColumns() const override final A_CONST; - - int getRowHeight() const override final A_CONST; - - int getColumnWidth(const int index) const override final A_CONST; - - void playerRelationsUpdated(); - - void updateModelInRow(const int row) const; - - Widget *getElementAt(int row, int column) const override final; - - void freeWidgets(); - - std::string getPlayerAt(const int index) const; - - protected: - StringVect *mPlayers; - STD_VECTOR mWidgets; - PlayerRelationListModel *mListModel; -}; - -#endif // GUI_MODELS_PLAYERTABLEMODEL_H diff --git a/src/gui/models/questsmodel.h b/src/gui/models/questsmodel.h deleted file mode 100644 index f80e7a32d..000000000 --- a/src/gui/models/questsmodel.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_QUESTSMODEL_H -#define GUI_MODELS_QUESTSMODEL_H - -#include "gui/models/extendednamesmodel.h" - -class QuestsModel final : public ExtendedNamesModel -{ - public: - QuestsModel() : - ExtendedNamesModel() - { - } - - A_DELETE_COPY(QuestsModel) - - ~QuestsModel() - { } -}; - -#endif // GUI_MODELS_QUESTSMODEL_H diff --git a/src/gui/models/serverslistmodel.h b/src/gui/models/serverslistmodel.h deleted file mode 100644 index 8e236ebe0..000000000 --- a/src/gui/models/serverslistmodel.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SERVERSLISTMODEL_H -#define GUI_MODELS_SERVERSLISTMODEL_H - -#include "gui/gui.h" - -#include "gui/fonts/font.h" - -#include "gui/windows/serverdialog.h" - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -/** - * Server and Port List Model - */ -class ServersListModel final : public ListModel -{ - public: - typedef std::pair VersionString; - - ServersListModel(ServerInfos *const servers, - ServerDialog *const parent) : - mServers(servers), - mVersionStrings(servers != nullptr ? servers->size() : 0, - VersionString(0, "")), - mParent(parent) - { - } - - A_DELETE_COPY(ServersListModel) - - /** - * Used to get number of line in the list - */ - int getNumberOfElements() override final A_WARN_UNUSED - { - MutexLocker lock = mParent->lock(); - return CAST_S32(mServers->size()); - } - - /** - * Used to get an element from the list - */ - std::string getElementAt(int elementIndex) - override final A_WARN_UNUSED - { - MutexLocker lock = mParent->lock(); - const ServerInfo &server = mServers->at(elementIndex); - std::string myServer; - if (server.freeType == ServerFreeType::NonFree) - { - // TRANSLATORS: server license comment - myServer.append(_("(NON FREE)")); - myServer.append(" "); - } - else if (server.freeType == ServerFreeType::Unknown) - { - // TRANSLATORS: server license comment - myServer.append(_("(UNKNOWN)")); - myServer.append(" "); - } - myServer.append(server.hostname); - return myServer; - } - - /** - * Used to get the corresponding Server struct - */ - const ServerInfo &getServer(const int elementIndex) const A_WARN_UNUSED - { return mServers->at(elementIndex); } - - void setVersionString(const int index, const std::string &version) - { - if (index < 0 || index >= CAST_S32(mVersionStrings.size())) - return; - - if (version.empty() || (gui == nullptr)) - { - mVersionStrings[index] = VersionString(0, ""); - } - else - { - mVersionStrings[index] = VersionString( - gui->getFont()->getWidth(version), version); - } - } - - private: - typedef STD_VECTOR VersionStrings; - - ServerInfos *mServers; - VersionStrings mVersionStrings; - ServerDialog *mParent; -}; - -#endif // GUI_MODELS_SERVERSLISTMODEL_H diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp deleted file mode 100644 index 27e05ff12..000000000 --- a/src/gui/models/shopitems.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/models/shopitems.h" - -#include "resources/item/shopitem.h" - -#include "utils/dtor.h" -#include "utils/foreach.h" - -#include "debug.h" - -ShopItems::ShopItems(const bool mergeDuplicates, - const std::string ¤cy) : - ListModel(), - mAllShopItems(), - mShopItems(), - mCurrency(currency), - mMergeDuplicates(mergeDuplicates) -{ -} - -ShopItems::~ShopItems() -{ - clear(); -} - -std::string ShopItems::getElementAt(int i) -{ - if (i < 0 || CAST_U32(i) - >= CAST_U32(mShopItems.size()) || (mShopItems.at(i) == nullptr)) - { - return ""; - } - - return mShopItems.at(i)->getDisplayName(); -} - -ShopItem *ShopItems::addItem(const int id, - const ItemTypeT type, - const ItemColor color, - const int amount, - const int price) -{ - ShopItem *const item = new ShopItem(-1, - id, - type, - color, - amount, - price, - mCurrency); - mShopItems.push_back(item); - mAllShopItems.push_back(item); - return item; -} - -ShopItem *ShopItems::addItemNoDup(const int id, - const ItemTypeT type, - const ItemColor color, - const int amount, - const int price) -{ - ShopItem *item = findItem(id, color); - if (item == nullptr) - { - item = new ShopItem(-1, - id, - type, - color, - amount, - price, - mCurrency); - mShopItems.push_back(item); - mAllShopItems.push_back(item); - } - return item; -} - -ShopItem *ShopItems::addItem2(const int inventoryIndex, - const int id, - const ItemTypeT type, - const ItemColor color, - const int quantity, - const int price) -{ - ShopItem *item = nullptr; - if (mMergeDuplicates) - item = findItem(id, color); - - if (item != nullptr) - { - item->addDuplicate(inventoryIndex, quantity); - } - else - { - item = new ShopItem(inventoryIndex, - id, - type, - color, - quantity, - price, - mCurrency); - mShopItems.push_back(item); - mAllShopItems.push_back(item); - } - return item; -} - -ShopItem *ShopItems::at(const size_t i) const -{ - if (i >= mShopItems.size()) - return nullptr; - - return mShopItems.at(i); -} - -bool ShopItems::findInAllItems(STD_VECTOR::iterator &it, - const ShopItem *const item) -{ - const STD_VECTOR::iterator it_end = mAllShopItems.end(); - for (it = mAllShopItems.begin(); it != it_end; ++ it) - { - if (*it == item) - return true; - } - return false; -} - -void ShopItems::erase(const unsigned int i) -{ - if (i >= CAST_U32(mShopItems.size())) - return; - - const ShopItem *const item = *(mShopItems.begin() + i); - STD_VECTOR::iterator it; - if (findInAllItems(it, item)) - mAllShopItems.erase(it); - mShopItems.erase(mShopItems.begin() + i); -} - -void ShopItems::del(const unsigned int i) -{ - if (i >= CAST_U32(mShopItems.size())) - return; - - ShopItem *item = *(mShopItems.begin() + i); - STD_VECTOR::iterator it; - if (findInAllItems(it, item)) - mAllShopItems.erase(it); - mShopItems.erase(mShopItems.begin() + i); - delete item; -} - -void ShopItems::clear() -{ - delete_all(mAllShopItems); - mAllShopItems.clear(); - mShopItems.clear(); -} - -ShopItem *ShopItems::findItem(const int id, - const ItemColor color) const -{ - STD_VECTOR::const_iterator it = mShopItems.begin(); - const STD_VECTOR::const_iterator e = mShopItems.end(); - while (it != e) - { - ShopItem *const item = *it; - if (item->getId() == id && item->getColor() == color) - return item; - - ++it; - } - - return nullptr; -} - -void ShopItems::updateList() -{ - mShopItems.clear(); - FOR_EACH (STD_VECTOR::iterator, it, mAllShopItems) - { - ShopItem *const item = *it; - if ((item != nullptr) && item->isVisible()) - mShopItems.push_back(item); - } -} diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h deleted file mode 100644 index 26c5a94e4..000000000 --- a/src/gui/models/shopitems.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SHOPITEMS_H -#define GUI_MODELS_SHOPITEMS_H - -#include "enums/resources/item/itemtype.h" - -#include "enums/simpletypes/itemcolor.h" - -#include "gui/models/listmodel.h" - -#include "utils/cast.h" -#include "utils/vector.h" - -#include "localconsts.h" - -class ShopItem; - -/** - * This class handles the list of items available in a shop. - * - * The addItem routine can automatically check, if an item already exists and - * only adds duplicates to the old item, if one is found. The original - * distribution of the duplicates can be retrieved from the item. - * - * This functionality can be enabled in the constructor. - */ -class ShopItems final : public ListModel -{ - public: - /** - * Constructor. - * - * @param mergeDuplicates lets the Shop look for duplicate entries and - * merges them to one item. - */ - ShopItems(const bool mergeDuplicates, - const std::string ¤cy); - - A_DELETE_COPY(ShopItems) - - ~ShopItems(); - - /** - * Adds an item to the list. - */ - ShopItem *addItem(const int id, - const ItemTypeT type, - const ItemColor color, - const int amount, - const int price); - - /** - * Adds an item to the list (used by sell dialog). Looks for - * duplicate entries, if mergeDuplicates was turned on. - * - * @param inventoryIndex the inventory index of the item - * @param id the id of the item - * @param amount number of available copies of the item - * @param price price of the item - */ - ShopItem *addItem2(const int inventoryIndex, - const int id, - const ItemTypeT type, - const ItemColor color, - const int amount, - const int price); - - ShopItem *addItemNoDup(const int id, - const ItemTypeT type, - const ItemColor color, - const int amount, - const int price); - - /** - * Returns the number of items in the shop. - */ - int getNumberOfElements() override final A_WARN_UNUSED - { return CAST_S32(mShopItems.size()); } - - bool empty() const noexcept2 A_WARN_UNUSED - { return mShopItems.empty(); } - - /** - * Returns the name of item number i in the shop. - * - * @param i the index to retrieve - */ - std::string getElementAt(int i) override final A_WARN_UNUSED; - - /** - * Returns the item number i in the shop. - */ - ShopItem *at(const size_t i) const A_WARN_UNUSED; - - /** - * Removes an element from the shop. - * - * @param i index to remove - */ - void erase(const unsigned int i); - - /** - * Removes an element from the shop and destroy it. - * - * @param i index to remove - */ - void del(const unsigned int i); - - /** - * Clears the list of items in the shop. - */ - void clear(); - - STD_VECTOR &items() A_WARN_UNUSED - { return mShopItems; } - - STD_VECTOR &allItems() A_WARN_UNUSED - { return mAllShopItems; } - - void setMergeDuplicates(const bool b) - { mMergeDuplicates = b; } - - void updateList(); - - private: - /** - * Searches the current items in the shop for the specified - * id and returns the item if found, or 0 else. - * - * @return the item found or 0 - */ - ShopItem *findItem(const int id, - const ItemColor color) const A_WARN_UNUSED; - - bool findInAllItems(STD_VECTOR::iterator &it, - const ShopItem *const item); - - /** The list of items in the shop. */ - STD_VECTOR mAllShopItems; - - STD_VECTOR mShopItems; - - std::string mCurrency; - - /** Look for duplicate entries on addition. */ - bool mMergeDuplicates; -}; - -#endif // GUI_MODELS_SHOPITEMS_H diff --git a/src/gui/models/skillmodel.cpp b/src/gui/models/skillmodel.cpp deleted file mode 100644 index 4d22280d8..000000000 --- a/src/gui/models/skillmodel.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/models/skillmodel.h" - -#include "utils/foreach.h" - -#include "resources/skill/skilldata.h" - -#include "debug.h" - -SkillModel::SkillModel() : - ListModel(), - mSkills(), - mVisibleSkills() -{ -} - -SkillInfo *SkillModel::getSkillAt(const int i) const -{ - if (i < 0 || i >= CAST_S32(mVisibleSkills.size())) - return nullptr; - return mVisibleSkills.at(i); -} - -std::string SkillModel::getElementAt(int i) -{ - const SkillInfo *const info = getSkillAt(i); - if (info != nullptr) - return info->data->name; - return std::string(); -} - -void SkillModel::updateVisibilities() -{ - mVisibleSkills.clear(); - - FOR_EACH (SkillList::const_iterator, it, mSkills) - { - if (((*it) != nullptr) && (*it)->visible == Visible_true) - mVisibleSkills.push_back((*it)); - } -} diff --git a/src/gui/models/skillmodel.h b/src/gui/models/skillmodel.h deleted file mode 100644 index 6c7792508..000000000 --- a/src/gui/models/skillmodel.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SKILLMODEL_H -#define GUI_MODELS_SKILLMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/cast.h" - -#include "resources/skill/skillinfo.h" - -#include "localconsts.h" - -class SkillModel final : public ListModel -{ - public: - SkillModel(); - - A_DELETE_COPY(SkillModel) - - SkillInfo *getSkillAt(const int i) const; - - std::string getElementAt(int i) override final; - - int getNumberOfElements() override final - { return CAST_S32(mVisibleSkills.size()); } - - void addSkill(SkillInfo *const info) - { mSkills.push_back(info); } - - void updateVisibilities(); - - private: - SkillList mSkills; - SkillList mVisibleSkills; -}; - -#endif // GUI_MODELS_SKILLMODEL_H diff --git a/src/gui/models/sortlistmodelbuy.h b/src/gui/models/sortlistmodelbuy.h deleted file mode 100644 index 3af489222..000000000 --- a/src/gui/models/sortlistmodelbuy.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SORTLISTMODELBUY_H -#define GUI_MODELS_SORTLISTMODELBUY_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -static const char *const SORT_NAME_BUY[7] = -{ - // TRANSLATORS: buy dialog sort type. - N_("unsorted"), - // TRANSLATORS: buy dialog sort type. - N_("by price"), - // TRANSLATORS: buy dialog sort type. - N_("by name"), - // TRANSLATORS: buy dialog sort type. - N_("by id"), - // TRANSLATORS: buy dialog sort type. - N_("by weight"), - // TRANSLATORS: buy dialog sort type. - N_("by amount"), - // TRANSLATORS: buy dialog sort type. - N_("by type") -}; - -class SortListModelBuy final : public ListModel -{ - public: - SortListModelBuy() : - ListModel() - { } - - A_DELETE_COPY(SortListModelBuy) - - ~SortListModelBuy() - { } - - int getNumberOfElements() override final - { return 7; } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return gettext(SORT_NAME_BUY[i]); - } -}; - -#endif // GUI_MODELS_SORTLISTMODELBUY_H diff --git a/src/gui/models/sortlistmodelinv.h b/src/gui/models/sortlistmodelinv.h deleted file mode 100644 index 3561d2621..000000000 --- a/src/gui/models/sortlistmodelinv.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SORTLISTMODELINV_H -#define GUI_MODELS_SORTLISTMODELINV_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -static const char *const SORT_NAME_INVENTORY[6] = -{ - // TRANSLATORS: inventory sort mode - N_("default"), - // TRANSLATORS: inventory sort mode - N_("by name"), - // TRANSLATORS: inventory sort mode - N_("by id"), - // TRANSLATORS: inventory sort mode - N_("by weight"), - // TRANSLATORS: inventory sort mode - N_("by amount"), - // TRANSLATORS: inventory sort mode - N_("by type") -}; - -class SortListModelInv final : public ListModel -{ - public: - SortListModelInv() : - ListModel() - { } - - A_DELETE_COPY(SortListModelInv) - - ~SortListModelInv() - { } - - int getNumberOfElements() override final - { return 6; } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - - return gettext(SORT_NAME_INVENTORY[i]); - } -}; - -#endif // GUI_MODELS_SORTLISTMODELINV_H diff --git a/src/gui/models/soundsmodel.h b/src/gui/models/soundsmodel.h deleted file mode 100644 index ad66049a3..000000000 --- a/src/gui/models/soundsmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_SOUNDSMODEL_H -#define GUI_MODELS_SOUNDSMODEL_H - -#include "gui/theme.h" - -#include "gui/models/namesmodel.h" - -#include "utils/gettext.h" - -#include "localconsts.h" - -class SoundsModel final : public NamesModel -{ - public: - SoundsModel() : - NamesModel() - { - mNames.push_back(gettext("(no sound)")); - Theme::fillSoundsList(mNames); - } - - A_DELETE_COPY(SoundsModel) - - ~SoundsModel() - { } -}; - -#endif // GUI_MODELS_SOUNDSMODEL_H diff --git a/src/gui/models/tablemodel.cpp b/src/gui/models/tablemodel.cpp deleted file mode 100644 index 08cfb6d83..000000000 --- a/src/gui/models/tablemodel.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/models/tablemodel.h" - -#include "utils/dtor.h" - -#include "gui/widgets/widget.h" - -#include "listeners/tablemodellistener.h" - -#include "debug.h" - -void TableModel::installListener(TableModelListener *const listener) -{ - if (listener != nullptr) - listeners.insert(listener); -} - -void TableModel::removeListener(TableModelListener *const listener) -{ - if (listener != nullptr) - listeners.erase(listener); -} - -void TableModel::signalBeforeUpdate() -{ - for (std::set::const_iterator it = listeners.begin(); - it != listeners.end(); ++it) - { - (*it)->modelUpdated(false); - } -} - -void TableModel::signalAfterUpdate() -{ - for (std::set::const_iterator it = listeners.begin(); - it != listeners.end(); ++it) - { - if (*it != nullptr) - (*it)->modelUpdated(true); - } -} - - -#define WIDGET_AT(row, column) (((row) * mColumns) + (column)) -#define DYN_SIZE(h) ((h) >= 0) - -StaticTableModel::StaticTableModel(const int row, const int column) : - TableModel(), - mRows(row), - mColumns(column), - mHeight(1), - mTableModel(), - mWidths() -{ - mTableModel.resize(row * column, nullptr); - mWidths.resize(column, 1); -} - -StaticTableModel::~StaticTableModel() -{ - delete_all(mTableModel); - mTableModel.clear(); -} - -void StaticTableModel::resize() -{ - mRows = getRows(); - mColumns = getColumns(); - mTableModel.resize(mRows * mColumns, nullptr); -} - -void StaticTableModel::set(const int row, const int column, - Widget *const widget) -{ - if ((widget == nullptr) || row >= mRows || row < 0 - || column >= mColumns || column < 0) - { - // raise exn? - return; - } - - if (DYN_SIZE(mHeight) - && widget->getHeight() > mHeight) - { - mHeight = widget->getHeight(); - } - - if (DYN_SIZE(mWidths[column]) - && widget->getWidth() > mWidths[column]) - { - mWidths[column] = widget->getWidth(); - } - - signalBeforeUpdate(); - - delete mTableModel[WIDGET_AT(row, column)]; - - mTableModel[WIDGET_AT(row, column)] = widget; - - signalAfterUpdate(); -} - -Widget *StaticTableModel::getElementAt(const int row, - const int column) const -{ - return mTableModel[WIDGET_AT(row, column)]; -} - -void StaticTableModel::fixColumnWidth(const int column, const int width) -{ - if (width < 0 || column < 0 || column >= mColumns) - return; - - mWidths[column] = -width; // Negate to tag as fixed -} - -void StaticTableModel::fixRowHeight(const int height) -{ - if (height < 0) - return; - - mHeight = -height; -} - -int StaticTableModel::getRowHeight() const -{ - return abs(mHeight); -} - -int StaticTableModel::getColumnWidth(const int column) const -{ - if (column < 0 || column >= mColumns) - return 0; - - return abs(mWidths[column]); -} - -int StaticTableModel::getRows() const -{ - return mRows; -} - -int StaticTableModel::getColumns() const -{ - return mColumns; -} - -int StaticTableModel::getWidth() const -{ - int width = 0; - - for (size_t i = 0, sz = mWidths.size(); i < sz; i++) - width += mWidths[i]; - - return width; -} - -int StaticTableModel::getHeight() const -{ - return mColumns * mHeight; -} diff --git a/src/gui/models/tablemodel.h b/src/gui/models/tablemodel.h deleted file mode 100644 index 23f286c2e..000000000 --- a/src/gui/models/tablemodel.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_TABLEMODEL_H -#define GUI_MODELS_TABLEMODEL_H - -#include "utils/vector.h" - -#include - -#include "localconsts.h" - -class Widget; - -class TableModelListener; - -/** - * A model for a regular table of widgets. - */ -class TableModel notfinal -{ - public: - A_DELETE_COPY(TableModel) - - virtual ~TableModel() - { } - - /** - * Determines the number of rows (lines) in the table - */ - virtual int getRows() const A_WARN_UNUSED = 0; - - /** - * Determines the number of columns in each row - */ - virtual int getColumns() const A_WARN_UNUSED = 0; - - /** - * Determines the height for each row - */ - virtual int getRowHeight() const A_WARN_UNUSED = 0; - - /** - * Determines the width of each individual column - */ - virtual int getColumnWidth(const int index) const A_WARN_UNUSED = 0; - - /** - * Retrieves the widget stored at the specified location - * within the table. - */ - virtual Widget *getElementAt(const int row, const int column) - const A_WARN_UNUSED = 0; - - virtual void installListener(TableModelListener *const listener); - - virtual void removeListener(TableModelListener *const listener); - - protected: - TableModel() : - listeners() - { - } - - /** - * Tells all listeners that the table is about to see an update - */ - virtual void signalBeforeUpdate(); - - /** - * Tells all listeners that the table has seen an update - */ - virtual void signalAfterUpdate(); - - private: - std::set listeners; -}; - - -class StaticTableModel final : public TableModel -{ - public: - StaticTableModel(const int width, const int height); - - A_DELETE_COPY(StaticTableModel) - - ~StaticTableModel(); - - /** - * Inserts a widget into the table model. - * The model is resized to accomodate the widget's width and height, - * unless column width / row height have been fixed. - */ - void set(const int row, const int column, Widget *const widget); - - /** - * Fixes the column width for a given column; this overrides dynamic - * width inference. - * - * Semantics are undefined for width 0. - */ - void fixColumnWidth(const int column, const int width); - - /** - * Fixes the row height; this overrides dynamic height inference. - * - * Semantics are undefined for width 0. - */ - void fixRowHeight(const int height); - - /** - * Resizes the table model - */ - void resize(); - - int getRows() const override final A_WARN_UNUSED; - int getColumns() const override final A_WARN_UNUSED; - int getRowHeight() const override final A_WARN_UNUSED; - int getWidth() const A_WARN_UNUSED; - int getHeight() const A_WARN_UNUSED; - int getColumnWidth(const int index) const override final A_WARN_UNUSED; - Widget *getElementAt(const int row, - const int column) const override final - A_WARN_UNUSED; - - protected: - int mRows; - int mColumns; - int mHeight; - STD_VECTOR mTableModel; - STD_VECTOR mWidths; -}; - -#endif // GUI_MODELS_TABLEMODEL_H diff --git a/src/gui/models/targettypemodel.h b/src/gui/models/targettypemodel.h deleted file mode 100644 index ec049bf66..000000000 --- a/src/gui/models/targettypemodel.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_TARGETTYPEMODEL_H -#define GUI_MODELS_TARGETTYPEMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/gettext.h" - -const char *TARGET_TYPE_TEXT[3] = -{ - // TRANSLATORS: target type - N_("No Target"), - // TRANSLATORS: target type - N_("Allow Target"), - // TRANSLATORS: target type - N_("Need Target") -}; - -class TargetTypeModel final : public ListModel -{ - public: - TargetTypeModel() : - ListModel() - { } - - A_DELETE_COPY(TargetTypeModel) - - ~TargetTypeModel() - { } - - int getNumberOfElements() override final - { - return 3; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return TARGET_TYPE_TEXT[i]; - } -}; - -#endif // GUI_MODELS_TARGETTYPEMODEL_H diff --git a/src/gui/models/themesmodel.h b/src/gui/models/themesmodel.h deleted file mode 100644 index c68cc0a2f..000000000 --- a/src/gui/models/themesmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_THEMESMODEL_H -#define GUI_MODELS_THEMESMODEL_H - -#include "gui/theme.h" - -#include "gui/models/namesmodel.h" - -#include "utils/gettext.h" - -#include "localconsts.h" - -class ThemesModel final : public NamesModel -{ - public: - ThemesModel() : - NamesModel() - { - mNames.push_back(gettext("(default)")); - Theme::fillSkinsList(mNames); - } - - A_DELETE_COPY(ThemesModel) - - ~ThemesModel() - { } -}; - -#endif // GUI_MODELS_THEMESMODEL_H diff --git a/src/gui/models/touchactionmodel.cpp b/src/gui/models/touchactionmodel.cpp deleted file mode 100644 index 1998d2752..000000000 --- a/src/gui/models/touchactionmodel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#include "gui/setupactiondata.h" -#include "gui/touchactiondata.h" - -#include "gui/models/touchactionmodel.h" - -#include "utils/foreach.h" - -#include - -#include "debug.h" - -const int touchActionDataSize = 5; - -static class SortTouchActionFunctor final -{ - public: - A_DEFAULT_COPY(SortTouchActionFunctor) - - bool operator() (const SetupActionData *const data1, - const SetupActionData *const data2) const - { - if ((data1 == nullptr) || (data2 == nullptr)) - return false; - return data1->name < data2->name; - } -} touchActionSorter; - -TouchActionsModel::TouchActionsModel() : - NamesModel(), - mActionId(), - mActionToSelection() -{ - STD_VECTOR data; - - for (int f = 0, fsz = touchActionDataSize; f < fsz; f ++) - { - int k = 0; - while (!touchActionData[f][k].name.empty()) - { - data.push_back(&touchActionData[f][k]); - k ++; - } - } - - std::sort(data.begin(), data.end(), touchActionSorter); - int cnt = 0; - FOR_EACH (STD_VECTOR::iterator, it, data) - { - const SetupActionData *const data1 = *it; - mNames.push_back(data1->name); - mActionId.push_back(data1->actionId); - mActionToSelection[data1->actionId] = cnt; - cnt ++; - } -} - -InputActionT TouchActionsModel::getActionFromSelection(const int sel) const -{ - if (sel < 0 || sel > static_cast(mActionId.size())) - return InputAction::NO_VALUE; - return mActionId[sel]; -} - -int TouchActionsModel::getSelectionFromAction(const InputActionT action) const -{ - const std::map::const_iterator it - = mActionToSelection.find(action); - if (it == mActionToSelection.end()) - return 0; - return (*it).second; -} diff --git a/src/gui/models/touchactionmodel.h b/src/gui/models/touchactionmodel.h deleted file mode 100644 index 2d8cff02a..000000000 --- a/src/gui/models/touchactionmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_TOUCHACTIONMODEL_H -#define GUI_MODELS_TOUCHACTIONMODEL_H - -#include "enums/input/inputaction.h" - -#include "gui/models/namesmodel.h" - -#include - -class TouchActionsModel final : public NamesModel -{ - public: - TouchActionsModel(); - - A_DELETE_COPY(TouchActionsModel) - - ~TouchActionsModel() - { } - - InputActionT getActionFromSelection(const int sel) const; - - int getSelectionFromAction(const InputActionT action) const; - - private: - STD_VECTOR mActionId; - std::map mActionToSelection; -}; - -#endif // GUI_MODELS_TOUCHACTIONMODEL_H diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h deleted file mode 100644 index 681e019fc..000000000 --- a/src/gui/models/typelistmodel.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2012 The Mana Developers - * Copyright (C) 2012-2017 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 . - */ - -#ifndef GUI_MODELS_TYPELISTMODEL_H -#define GUI_MODELS_TYPELISTMODEL_H - -#include "gui/models/listmodel.h" - -/** - * Server Type List Model - */ -class TypeListModel final : public ListModel -{ - public: - TypeListModel() : - ListModel() - { } - - A_DELETE_COPY(TypeListModel) - - /** - * Used to get number of line in the list - */ - int getNumberOfElements() override final A_WARN_UNUSED -#if defined(TMWA_SUPPORT) - { return 3; } -#else // defined(TMWA_SUPPORT) - { return 2; } -#endif // defined(TMWA_SUPPORT) - - /** - * Used to get an element from the list - */ - std::string getElementAt(int elementIndex) - override final A_WARN_UNUSED - { -#ifdef TMWA_SUPPORT - if (elementIndex == 0) - return "TmwAthena"; - else if (elementIndex == 1) - return "Hercules"; - else if (elementIndex == 2) - return "Evol2"; - else -#else // TMWA_SUPPORT - if (elementIndex == 0) - return "Hercules"; - else if (elementIndex == 1) - return "Evol2"; - else -#endif // TMWA_SUPPORT - return "Unknown"; - } -}; - -#endif // GUI_MODELS_TYPELISTMODEL_H diff --git a/src/gui/models/updatelistmodel.h b/src/gui/models/updatelistmodel.h deleted file mode 100644 index cd4ba50c3..000000000 --- a/src/gui/models/updatelistmodel.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_UPDATELISTMODEL_H -#define GUI_MODELS_UPDATELISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "net/serverinfo.h" - -#include "utils/cast.h" -#include "utils/foreach.h" - -#include "localconsts.h" - -class UpdateListModel final : public ListModel -{ - public: - explicit UpdateListModel(ServerInfo *const server) : - ListModel(), - mNames(), - mServer(server) - { - FOR_EACH(STD_VECTOR::const_iterator, - it, - server->updateHosts) - { - const HostsGroup &group = *it; - mNames.push_back(group.name); - } - } - - A_DELETE_COPY(UpdateListModel) - - ~UpdateListModel() - { } - - int getNumberOfElements() override final - { - return CAST_S32(mNames.size()); - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return mNames[i]; - } - - bool empty() const - { - return mNames.empty(); - } - - protected: - StringVect mNames; - ServerInfo *mServer; -}; - -#endif // GUI_MODELS_UPDATELISTMODEL_H diff --git a/src/gui/models/updatetypemodel.h b/src/gui/models/updatetypemodel.h deleted file mode 100644 index 232be8223..000000000 --- a/src/gui/models/updatetypemodel.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_UPDATETYPEMODEL_H -#define GUI_MODELS_UPDATETYPEMODEL_H - -#include "utils/gettext.h" - -#include "gui/models/listmodel.h" - -const char *UPDATE_TYPE_TEXT[3] = -{ - // TRANSLATORS: update type - N_("Normal"), - // TRANSLATORS: update type - N_("Auto Close"), - // TRANSLATORS: update type - N_("Skip"), -}; - -class UpdateTypeModel final : public ListModel -{ - public: - UpdateTypeModel() - { } - - A_DELETE_COPY(UpdateTypeModel) - - ~UpdateTypeModel() - { } - - int getNumberOfElements() override final - { - return 3; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - return gettext(UPDATE_TYPE_TEXT[i]); - } -}; - -#endif // GUI_MODELS_UPDATETYPEMODEL_H diff --git a/src/gui/models/worldlistmodel.h b/src/gui/models/worldlistmodel.h deleted file mode 100644 index 3be179c61..000000000 --- a/src/gui/models/worldlistmodel.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MODELS_WORLDLISTMODEL_H -#define GUI_MODELS_WORLDLISTMODEL_H - -#include "gui/models/listmodel.h" - -#include "utils/cast.h" -#include "utils/stringutils.h" - -#include "net/worldinfo.h" - -/** - * The list model for the server list. - */ -class WorldListModel final : public ListModel -{ - public: - explicit WorldListModel(const Worlds &worlds) : - mWorlds(worlds) - { - } - - A_DELETE_COPY(WorldListModel) - - ~WorldListModel() - { } - - int getNumberOfElements() override final - { - return CAST_S32(mWorlds.size()); - } - - std::string getElementAt(int i) override final - { - const WorldInfo *const si = mWorlds[i]; - if (si != nullptr) - { - return std::string(si->name).append(" (").append( - toString(si->online_users)).append(")"); - } - return "???"; - } - private: - Worlds mWorlds; -}; - -#endif // GUI_MODELS_WORLDLISTMODEL_H diff --git a/src/gui/mouseoverlink.h b/src/gui/mouseoverlink.h deleted file mode 100644 index 758d02b6e..000000000 --- a/src/gui/mouseoverlink.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_MOUSEOVERLINK_H -#define GUI_MOUSEOVERLINK_H - -#include "gui/browserlink.h" - -#include "localconsts.h" - -struct MouseOverLink final -{ - MouseOverLink(const int x, - const int y) : - mX(x), - mY(y) - { } - - A_DEFAULT_COPY(MouseOverLink) - - bool operator() (const BrowserLink &link) const - { - return mX >= link.x1 && - mX < link.x2 && - mY >= link.y1 && - mY < link.y2; - } - const int mX; - const int mY; -}; - -#endif // GUI_MOUSEOVERLINK_H diff --git a/src/gui/onlineplayer.h b/src/gui/onlineplayer.h deleted file mode 100644 index 43ebb5c5f..000000000 --- a/src/gui/onlineplayer.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_ONLINEPLAYER_H -#define GUI_ONLINEPLAYER_H - -#include "enums/being/gender.h" - -#include - -#include "localconsts.h" - -class OnlinePlayer final -{ - public: - OnlinePlayer(const std::string &nick, - const unsigned char status, - const signed char level, - const GenderT gender, - const signed char version) : - mNick(nick), - mText(), - mStatus(status), - mLevel(level), - mVersion(version), - mGender(gender), - mIsGM(false) - { - } - - A_DELETE_COPY(OnlinePlayer) - - const std::string getNick() const noexcept2 A_WARN_UNUSED - { return mNick; } - - unsigned char getStaus() const noexcept2 A_WARN_UNUSED - { return mStatus; } - - void setIsGM(const bool b) - { mIsGM = b; } - - char getVersion() const noexcept2 A_WARN_UNUSED - { return mVersion; } - - char getLevel() const noexcept2 A_WARN_UNUSED - { return mLevel; } - - const std::string getText() const noexcept2 A_WARN_UNUSED - { return mText; } - - void setText(std::string str); - - void setLevel(const char level) noexcept2 - { mLevel = level; } - - private: - std::string mNick; - - std::string mText; - - unsigned char mStatus; - - signed char mLevel; - - signed char mVersion; - - GenderT mGender; - - bool mIsGM; -}; - -#endif // GUI_ONLINEPLAYER_H diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp deleted file mode 100644 index 7fcf153fe..000000000 --- a/src/gui/palette.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Douglas Boffey - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/palette.h" - -#include "utils/foreach.h" -#include "utils/timer.h" - -#ifndef USE_SDL2 -#include -#endif // USE_SDL2 - -#include "debug.h" - -const Color Palette::BLACK = Color(0, 0, 0); -Palette::Palettes Palette::mInstances; - -const Color Palette::RAINBOW_COLORS[7] = -{ - Color(255, 0, 0), - Color(255, 153, 0), - Color(255, 255, 0), - Color(0, 153, 0), - Color(0, 204, 204), - Color(51, 0, 153), - Color(153, 0, 153) -}; - -const int Palette::RAINBOW_COLOR_COUNT = 7; - -Palette::Palette(const int size) : - mRainbowTime(tick_time), - mColors(Colors(size)), - mCharColors(), - mGradVector() -{ - mInstances.insert(this); -} - -Palette::~Palette() -{ - mInstances.erase(this); -} - -const Color& Palette::getCharColor(const signed char c, bool &valid) const -{ - const CharColors::const_iterator it = mCharColors.find(c); - if (it != mCharColors.end()) - { - valid = true; - return mColors[(*it).second].color; - } - - valid = false; - return BLACK; -} - -void Palette::advanceGradients() -{ - FOR_EACH (Palettes::const_iterator, it, mInstances) - (*it)->advanceGradient(); -} - -void Palette::advanceGradient() -{ - const int time = get_elapsed_time(mRainbowTime); - if (time > 5) - { - // For slower systems, advance can be greater than one (advance > 1 - // skips advance-1 steps). Should make gradient look the same - // independent of the framerate. - const int advance = time / 5; - - for (size_t i = 0, sz = mGradVector.size(); i < sz; i++) - { - ColorElem *const elem A_NONNULLPOINTER = mGradVector[i]; - if (elem == nullptr) - continue; - - int delay = elem->delay; - const GradientTypeT &grad = elem->grad; - - if (grad == GradientType::PULSE) - delay = delay / 20; - - const int numOfColors = (elem->grad == GradientType::SPECTRUM ? 6 : - grad == GradientType::PULSE ? 127 : - RAINBOW_COLOR_COUNT); - - elem->gradientIndex = (elem->gradientIndex + advance) - % (delay * numOfColors); - - const int gradIndex = elem->gradientIndex; - const int pos = delay != 0 ? (gradIndex % delay) : gradIndex; - int colIndex; - if (delay != 0) - colIndex = gradIndex / delay; - else - colIndex = gradIndex; - - Color &color = elem->color; - int colVal; - - if (grad == GradientType::PULSE) - { - colVal = CAST_S32(255.0 * - sin(M_PI * colIndex / numOfColors)); - - const Color &col = elem->testColor; - - color.r = ((colVal * col.r) / 255) % (col.r + 1); - color.g = ((colVal * col.g) / 255) % (col.g + 1); - color.b = ((colVal * col.b) / 255) % (col.b + 1); - } - else if (grad == GradientType::SPECTRUM) - { - if ((colIndex % 2) != 0) - { // falling curve - if (delay != 0) - { - colVal = CAST_S32(255.0 * - (cos(M_PI * pos / delay) + 1) / 2); - } - else - { - colVal = CAST_S32(255.0 * - (cos(M_PI * pos) + 1) / 2); - } - } - else - { // ascending curve - if (delay != 0) - { - colVal = CAST_S32(255.0 * (cos(M_PI * - (delay - pos) / delay) + 1) / 2); - } - else - { - colVal = CAST_S32(255.0 * (cos(M_PI * - (delay - pos)) + 1) / 2); - } - } - - color.r = (colIndex == 0 || colIndex == 5) ? 255 : - (colIndex == 1 || colIndex == 4) ? colVal : 0; - color.g = (colIndex == 1 || colIndex == 2) ? 255 : - (colIndex == 0 || colIndex == 3) ? colVal : 0; - color.b = (colIndex == 3 || colIndex == 4) ? 255 : - (colIndex == 2 || colIndex == 5) ? colVal : 0; - } - else if (elem->grad == GradientType::RAINBOW) - { - const Color &startCol = RAINBOW_COLORS[colIndex]; - const Color &destCol - = RAINBOW_COLORS[(colIndex + 1) % numOfColors]; - double startColVal; - double destColVal; - - if (delay != 0) - startColVal = (cos(M_PI * pos / delay) + 1) / 2; - else - startColVal = 0; - - destColVal = 1 - startColVal; - - color.r = CAST_S32(startColVal - * startCol.r + destColVal * destCol.r); - - color.g = CAST_S32(startColVal - * startCol.g + destColVal * destCol.g); - - color.b = CAST_S32(startColVal - * startCol.b + destColVal * destCol.b); - } - } - - mRainbowTime = tick_time; - } -} diff --git a/src/gui/palette.h b/src/gui/palette.h deleted file mode 100644 index 048dacf54..000000000 --- a/src/gui/palette.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008 Douglas Boffey - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_PALETTE_H -#define GUI_PALETTE_H - -#include "enums/gui/gradienttype.h" - -#include "gui/color.h" - -#include "utils/vector.h" - -#include -#include -#include - -// Default Gradient Delay -#define GRADIENT_DELAY 40 - -/** - * Class controlling the game's color palette. - */ -class Palette notfinal -{ - public: - /** Black Color Constant */ - static const Color BLACK; - - A_DELETE_COPY(Palette) - - /** - * Returns the color associated with a character, if it exists. Returns - * Palette::BLACK if the character is not found. - * - * @param c character requested - * @param valid indicate whether character is known - * - * @return the requested color or Palette::BLACK - */ - const Color &getCharColor(const signed char c, - bool &valid) const A_WARN_UNUSED; - - /** - * Get the character used by the specified color. - * - * @param type the color type of the color - * - * @return the color char of the color with the given index - */ - inline char getColorChar(const int type) const A_WARN_UNUSED - { return mColors[CAST_SIZE(type)].ch; } - - /** - * Updates all colors, that are non-static. - */ - static void advanceGradients(); - - protected: - /** Colors used for the rainbow gradient */ - static const Color RAINBOW_COLORS[7]; - static const int RAINBOW_COLOR_COUNT; - - /** Time tick, that gradient-type colors were updated the last time. */ - int mRainbowTime; - - typedef std::set Palettes; - static Palettes mInstances; - - /** - * Constructor - */ - explicit Palette(const int size); - - /** - * Destructor - */ - virtual ~Palette(); - - void advanceGradient(); - - struct ColorElem final - { - ColorElem() : - type(0), - color(0), - testColor(0), - committedColor(0), - text(), - ch(0), - grad(GradientType::STATIC), - committedGrad(GradientType::STATIC), - gradientIndex(0), - delay(0), - committedDelay(0) - { - } - - A_DEFAULT_COPY(ColorElem) - - int type; - Color color; - Color testColor; - Color committedColor; - std::string text; - signed char ch; - GradientTypeT grad; - GradientTypeT committedGrad; - int gradientIndex; - int delay; - int committedDelay; - - void set(const int type0, - const Color &color0, - const GradientTypeT grad0, - const int delay0) - { - type = type0; - color = color0; - testColor = color0; - grad = grad0; - delay = delay0; - gradientIndex = rand(); - } - - inline unsigned int getRGB() const noexcept2 A_WARN_UNUSED - { - return (committedColor.r << 16) | (committedColor.g << 8) | - committedColor.b; - } - }; - typedef STD_VECTOR Colors; - typedef std::map CharColors; - Colors mColors; - CharColors mCharColors; - STD_VECTOR mGradVector; -}; - -#endif // GUI_PALETTE_H diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp deleted file mode 100644 index 134aaac7b..000000000 --- a/src/gui/popupmanager.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/popupmanager.h" - -#include "sdlshared.h" - -#ifndef DYECMD -#include "gui/popups/beingpopup.h" -#include "gui/popups/itempopup.h" -#include "gui/popups/popupmenu.h" -#endif // DYECMD -#include "gui/popups/textpopup.h" - -#include "debug.h" - -PopupManager *popupManager = nullptr; - -PopupManager::PopupManager() -{ -} - -PopupManager::~PopupManager() -{ -} - -void PopupManager::closePopupMenu() -{ -#ifndef DYECMD - if (popupMenu != nullptr) - popupMenu->handleLink("cancel", nullptr); -#endif // DYECMD -} - -void PopupManager::hideBeingPopup() -{ -#ifndef DYECMD - if (beingPopup != nullptr) - beingPopup->setVisible(Visible_false); -#endif // DYECMD -} - -void PopupManager::hideTextPopup() -{ - if (textPopup != nullptr) - textPopup->setVisible(Visible_false); -} - -void PopupManager::hidePopupMenu() -{ -#ifndef DYECMD - if (popupMenu != nullptr) - popupMenu->setVisible(Visible_false); -#endif // DYECMD -} - -void PopupManager::hideItemPopup() -{ -#ifndef DYECMD - if (itemPopup != nullptr) - itemPopup->hide(); -#endif // DYECMD -} - -bool PopupManager::isPopupMenuVisible() -{ -#ifndef DYECMD - return popupMenu != nullptr ? popupMenu->isPopupVisible() : false; -#else - return false; -#endif // DYECMD -} - -void PopupManager::clearPopup() -{ -#ifndef DYECMD - if (popupMenu != nullptr) - popupMenu->clear(); -#endif // DYECMD -} - -bool PopupManager::isTextPopupVisible() -{ - return textPopup != nullptr ? textPopup->isPopupVisible() : false; -} - -bool PopupManager::isBeingPopupVisible() -{ -#ifndef DYECMD - return beingPopup != nullptr ? beingPopup->isPopupVisible() : false; -#else // DYECMD - return false; -#endif // DYECMD -} diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h deleted file mode 100644 index a3dd08a54..000000000 --- a/src/gui/popupmanager.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_POPUPMANAGER_H -#define GUI_POPUPMANAGER_H - -#include "localconsts.h" - -class PopupManager final -{ - public: - /** - * Constructor. - */ - PopupManager() A_CONST; - - A_DELETE_COPY(PopupManager) - - /** - * Destructor. - */ - ~PopupManager() A_CONST; - - static bool isBeingPopupVisible() A_WARN_UNUSED; - - static bool isTextPopupVisible() A_WARN_UNUSED; - - /** - * Closes the popup menu. Needed for when the player dies or switching - * maps. - */ - static void closePopupMenu(); - - /** - * Hides the BeingPopup. - */ - static void hideBeingPopup(); - - static void hideTextPopup(); - - static void hideItemPopup(); - - static bool isPopupMenuVisible() A_WARN_UNUSED; - - static void clearPopup(); - - static void hidePopupMenu(); -}; - -extern PopupManager *popupManager; - -#endif // GUI_POPUPMANAGER_H diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp deleted file mode 100644 index 299683f6d..000000000 --- a/src/gui/popups/beingpopup.cpp +++ /dev/null @@ -1,337 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/popups/beingpopup.h" - -#include "being/being.h" -#include "being/homunculusinfo.h" -#include "being/petinfo.h" -#include "being/playerinfo.h" -#include "being/playerrelations.h" - -#include "gui/gui.h" - -#include "gui/fonts/font.h" - -#include "gui/widgets/label.h" - -#include "resources/chatobject.h" - -#include "resources/db/groupdb.h" - -#include "utils/gettext.h" -#include "utils/foreach.h" -#include "utils/stringutils.h" - -#include "debug.h" - -BeingPopup *beingPopup = nullptr; - -BeingPopup::BeingPopup() : - Popup("BeingPopup", "beingpopup.xml"), - mBeingName(new Label(this, "A")), - mLabels() -{ - // Being Name - mBeingName->setFont(boldFont); - mBeingName->setPosition(0, 0); - - const int fontHeight = mBeingName->getHeight(); - setMinHeight(fontHeight); - addLabels(fontHeight); -} - -BeingPopup::~BeingPopup() -{ -} - -void BeingPopup::postInit() -{ - Popup::postInit(); - add(mBeingName); - FOR_EACH (STD_VECTOR::iterator, it, mLabels) - { - add(*it); - } -} - -void BeingPopup::addLabels(const int fontHeight) -{ - for (int f = 0; f < 11; f ++) - { - Label *const label = new Label(this, "A"); - label->setPosition(0, fontHeight * (f + 1)); - label->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - mLabels.push_back(label); - } -} - -void BeingPopup::show(const int x, const int y, Being *const b) -{ - if (b == nullptr) - { - setVisible(Visible_false); - return; - } - - int num = 0; - Label *ptr = nullptr; - b->updateComment(); - - if (b->getType() == ActorType::Npc && b->getComment().empty()) - { - setVisible(Visible_false); - return; - } - - mBeingName->setCaption(b->getName() + b->getGenderSignWithSpace()); - if (gui != nullptr) - { - if (playerRelations.isGoodName(b)) - mBeingName->setFont(boldFont); - else - mBeingName->setFont(gui->getSecureFont()); - } - if (b->isAdvanced()) - { - mBeingName->setForegroundColorAll(getThemeColor( - ThemeColorId::PLAYER_ADVANCED), getThemeColor( - ThemeColorId::PLAYER_ADVANCED_OUTLINE)); - } - else - { - mBeingName->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - } - - mBeingName->adjustSize(); - FOR_EACH (STD_VECTOR::iterator, it, mLabels) - { - (*it)->setCaption(std::string()); - } - - const ActorTypeT type = b->getType(); - if (type == ActorType::Pet) - { - const PetInfo *const info = PlayerInfo::getPet(); - if ((info != nullptr) && info->id == b->getId()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Hungry: %d"), - info->hungry)); - ptr->adjustSize(); - num ++; - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Intimacy: %d"), - info->intimacy)); - ptr->adjustSize(); - num ++; - } - } - else if (type == ActorType::Homunculus) - { - const HomunculusInfo *const info = PlayerInfo::getHomunculus(); - if ((info != nullptr) && info->id == b->getId()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Hungry: %d"), - info->hungry)); - ptr->adjustSize(); - num ++; - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Intimacy: %d"), - info->intimacy)); - ptr->adjustSize(); - num ++; - } - } - else - { - const int groupId = b->getGroupId(); - const std::string &groupName = GroupDb::getLongName(groupId); - if (!groupName.empty()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Group: %s (%d)"), - groupName.c_str(), - groupId)); - ptr->adjustSize(); - num ++; - } - - if (!(b->getPartyName().empty())) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Party: %s"), - b->getPartyName().c_str())); - ptr->adjustSize(); - num ++; - } - - if (!(b->getGuildName().empty())) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Guild: %s"), - b->getGuildName().c_str())); - ptr->adjustSize(); - num ++; - } - - if (b->getPvpRank() > 0) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Pvp rank: %u"), - b->getPvpRank())); - ptr->adjustSize(); - num ++; - } - - if (!b->getBuyBoard().empty()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Buy shop: %s"), - b->getBuyBoard().c_str())); - ptr->adjustSize(); - num ++; - } - - if (!b->getSellBoard().empty()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Sell shop: %s"), - b->getSellBoard().c_str())); - ptr->adjustSize(); - num ++; - } - - if (!b->getComment().empty()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Comment: %s"), - b->getComment().c_str())); - ptr->adjustSize(); - num ++; - } - - const std::string effects = b->getStatusEffectsString(); - if (!effects.empty()) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Effects: %s"), - effects.c_str())); - ptr->adjustSize(); - num ++; - } - - const ChatObject *const chat = b->getChat(); - if (chat != nullptr) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Chat room: %s"), - chat->title.c_str())); - ptr->adjustSize(); - num ++; - } - } - - const int level = b->getLevel(); - if (level > 1) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Level: %d"), - level)); - ptr->adjustSize(); - num ++; - } - - const int maxHp = b->getMaxHP(); - if (maxHp > 0) - { - int hp = b->getHP(); - if (hp == 0) - hp = maxHp - b->getDamageTaken(); - if (hp > 0) - { - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Hp: %d/%d"), - hp, - maxHp)); - ptr->adjustSize(); - num ++; - } - } - - ptr = mLabels[num]; - // TRANSLATORS: being popup label - ptr->setCaption(strprintf(_("Particles: %u"), - CAST_U32(b->getParticlesCount()))); - ptr->adjustSize(); - num ++; - - const size_t sz = mLabels.size(); - for (size_t f = num; f < sz; f ++) - { - mLabels[f]->setCaption(std::string()); - } - - int minWidth = mBeingName->getWidth(); - const int height1 = getFont()->getHeight(); - int height = height1; - FOR_EACH (STD_VECTOR::iterator, it, mLabels) - { - const Label *const label = *it; - if (label != nullptr) - { - if (label->getWidth() > minWidth) - minWidth = label->getWidth(); - if (!label->getCaption().empty()) - height += height1; - } - } - - setContentSize(minWidth, height); - position(x, y); -} - -#ifdef USE_PROFILER -void BeingPopup::logic() -{ - BLOCK_START("BeingPopup::logic") - logicChildren(); - BLOCK_END("BeingPopup::logic") -} -#endif // USE_PROFILER diff --git a/src/gui/popups/beingpopup.h b/src/gui/popups/beingpopup.h deleted file mode 100644 index a14f44568..000000000 --- a/src/gui/popups/beingpopup.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#ifndef GUI_POPUPS_BEINGPOPUP_H -#define GUI_POPUPS_BEINGPOPUP_H - -#include "gui/widgets/popup.h" - -class Being; -class Label; - -/** - * A popup that displays information about a being. - */ -class BeingPopup final : public Popup -{ - public: - /** - * Constructor. Initializes the being popup. - */ - BeingPopup(); - - A_DELETE_COPY(BeingPopup) - - /** - * Destructor. Cleans up the being popup on deletion. - */ - ~BeingPopup(); - - /** - * Sets the info to be displayed given a particular player. - */ - void show(const int x, const int y, Being *const b); - - void postInit() override final; - -#ifdef USE_PROFILER - void logic(); -#endif // USE_PROFILER - - private: - void addLabels(const int fontHeight); - - Label *mBeingName A_NONNULLPOINTER; - STD_VECTOR mLabels; -}; - -extern BeingPopup *beingPopup; - -#endif // GUI_POPUPS_BEINGPOPUP_H diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp deleted file mode 100644 index 28de3b641..000000000 --- a/src/gui/popups/itempopup.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * The ManaPlus Client - * 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-2017 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 . - */ - -#include "gui/popups/itempopup.h" - -#include "actormanager.h" -#include "configuration.h" - -#include "gui/gui.h" - -#include "gui/fonts/font.h" - -#include "gui/widgets/icon.h" -#include "gui/widgets/label.h" -#include "gui/widgets/textbox.h" - -#include "net/beinghandler.h" -#ifdef TMWA_SUPPORT -#include "net/net.h" -#endif // TMWA_SUPPORT - -#include "utils/foreach.h" -#include "utils/gettext.h" -#include "utils/stdmove.h" - -#include "utils/translation/podict.h" - -#include "resources/iteminfo.h" - -#include "resources/db/itemoptiondb.h" -#include "resources/db/unitsdb.h" - -#include "resources/image/image.h" - -#include "resources/item/item.h" -#include "resources/item/itemfieldtype.h" -#include "resources/item/itemoptionslist.h" - -#include "resources/loaders/imageloader.h" - -#include "debug.h" - -ItemPopup *itemPopup = nullptr; - -ItemPopup::ItemPopup() : - Popup("ItemPopup", "itempopup.xml"), - mItemName(new Label(this)), - mItemDesc(new TextBox(this)), - mItemEffect(new TextBox(this)), - mItemWeight(new TextBox(this)), - mItemCards(new TextBox(this)), - mItemOptions(new TextBox(this)), - mItemType(ItemDbType::UNUSABLE), - mIcon(new Icon(this, nullptr)), - mLastName(), - mCardsStr(), - mItemOptionsStr(), - mLastId(0), - mLastColor(ItemColor_one) -{ - // Item name - mItemName->setFont(boldFont); - mItemName->setPosition(0, 0); - - const int fontHeight = getFont()->getHeight(); - - // Item description - mItemDesc->setEditable(false); - mItemDesc->setPosition(0, fontHeight); - mItemDesc->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - - // Item effect - mItemEffect->setEditable(false); - mItemEffect->setPosition(0, 2 * fontHeight); - mItemEffect->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - - // Item weight - mItemWeight->setEditable(false); - mItemWeight->setPosition(0, 3 * fontHeight); - mItemWeight->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - - // Item cards - mItemCards->setEditable(false); - mItemCards->setPosition(0, 4 * fontHeight); - mItemCards->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); - - // Item options - mItemOptions->setEditable(false); - mItemOptions->setPosition(0, 5 * fontHeight); - mItemOptions->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), - getThemeColor(ThemeColorId::POPUP_OUTLINE)); -} - -void ItemPopup::postInit() -{ - Popup::postInit(); - add(mItemName); - add(mItemDesc); - add(mItemEffect); - add(mItemWeight); - add(mItemCards); - add(mItemOptions); - add(mIcon); - - addMouseListener(this); -} - -ItemPopup::~ItemPopup() -{ - if (mIcon != nullptr) - { - Image *const image = mIcon->getImage(); - if (image != nullptr) - image->decRef(); - } -} - -void ItemPopup::setItem(const Item *const item, - const bool showImage) -{ - if (item == nullptr) - return; - - const ItemInfo &ii = item->getInfo(); - setItem(ii, - item->getColor(), - showImage, - item->getId(), - item->getCards(), - item->getOptions()); - if (item->getRefine() > 0) - { - mLastName = ii.getName(); - mLastColor = item->getColor(); - mLastId = item->getId(); -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - mItemName->setCaption(strprintf("%s (+%u), %d", - ii.getName().c_str(), - CAST_U32(item->getRefine()), - ii.getId())); - } - else -#endif // TMWA_SUPPORT - { - mItemName->setCaption(strprintf("%s (+%u), %d", - ii.getName(item->getColor()).c_str(), - CAST_U32(item->getRefine()), - ii.getId())); - } - mItemName->adjustSize(); - const unsigned minWidth = mItemName->getWidth() + 8; - if (CAST_U32(getWidth()) < minWidth) - setWidth(minWidth); - } -} - -void ItemPopup::setItem(const ItemInfo &item, - const ItemColor color, - const bool showImage, - int id, - const int *const cards, - const ItemOptionsList *const options) -{ - if (mIcon == nullptr) - return; - - std::string cardsStr; - std::string optionsStr; - - if (item.getName() == mLastName && - color == mLastColor && - id == mLastId) - { - cardsStr = getCardsString(cards); - optionsStr = getOptionsString(options); - if (mItemOptionsStr == optionsStr && - mCardsStr == cardsStr) - { - return; - } - } - else - { - cardsStr = getCardsString(cards); - optionsStr = getOptionsString(options); - } - mItemOptionsStr = STD_MOVE(optionsStr); - mCardsStr = STD_MOVE(cardsStr); - - if (id == -1) - id = item.getId(); - - int space = 0; - - Image *const oldImage = mIcon->getImage(); - if (oldImage != nullptr) - oldImage->decRef(); - - if (showImage) - { - Image *const image = Loader::getImage(combineDye2( - pathJoin(paths.getStringValue("itemIcons"), - item.getDisplay().image), - item.getDyeIconColorsString(color))); - - mIcon->setImage(image); - if (image != nullptr) - { - mIcon->setPosition(0, 0); - space = mIcon->getWidth(); - } - } - else - { - mIcon->setImage(nullptr); - } - - mItemType = item.getType(); - - mLastName = item.getName(); - mLastColor = color; - mLastId = id; - -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - mItemName->setCaption(strprintf("%s, %d", - item.getName().c_str(), id)); - mItemDesc->setTextWrapped(item.getDescription(), 196); - } - else -#endif // TMWA_SUPPORT - { - mItemName->setCaption(strprintf("%s, %d", - item.getName(color).c_str(), id)); - mItemDesc->setTextWrapped(item.getDescription(color), 196); - } - - mItemName->adjustSize(); - setLabelColor(mItemName, mItemType); - mItemName->setPosition(space, 0); - - mItemEffect->setTextWrapped(item.getEffect(), 196); - // TRANSLATORS: popup label - mItemWeight->setTextWrapped(strprintf(_("Weight: %s"), - UnitsDb::formatWeight(item.getWeight()).c_str()), 196); - mItemCards->setTextWrapped(mCardsStr, 196); - mItemOptions->setTextWrapped(mItemOptionsStr, 196); - - int minWidth = mItemName->getWidth() + space; - - if (mItemName->getWidth() + space > minWidth) - minWidth = mItemName->getWidth() + space; - if (mItemDesc->getMinWidth() > minWidth) - minWidth = mItemDesc->getMinWidth(); - if (mItemEffect->getMinWidth() > minWidth) - minWidth = mItemEffect->getMinWidth(); - if (mItemWeight->getMinWidth() > minWidth) - minWidth = mItemWeight->getMinWidth(); - if (mItemCards->getMinWidth() > minWidth) - minWidth = mItemCards->getMinWidth(); - if (mItemOptions->getMinWidth() > minWidth) - minWidth = mItemOptions->getMinWidth(); - - const int numRowsDesc = mItemDesc->getNumberOfRows(); - const int numRowsEffect = mItemEffect->getNumberOfRows(); - const int numRowsWeight = mItemWeight->getNumberOfRows(); - const int numRowsCards = mItemCards->getNumberOfRows(); - const int numRowsOptions = mItemOptions->getNumberOfRows(); - const int height = getFont()->getHeight(); - - if (item.getEffect().empty()) - { - setContentSize(minWidth, - (numRowsDesc + 2 + numRowsWeight + numRowsCards + numRowsOptions) * - height); - mItemWeight->setPosition(0, (numRowsDesc + 2) * height); - mItemCards->setPosition(0, (numRowsDesc + numRowsWeight + 2) * height); - mItemOptions->setPosition(0, - (numRowsDesc + numRowsWeight + numRowsCards + 2) * height); - } - else - { - setContentSize(minWidth, (numRowsDesc + numRowsEffect + 2 - + numRowsWeight + numRowsCards + numRowsOptions) * height); - mItemEffect->setPosition(0, (numRowsDesc + 2) * height); - mItemWeight->setPosition(0, (numRowsDesc + numRowsEffect + 2) - * height); - mItemCards->setPosition(0, (numRowsDesc + numRowsEffect - + numRowsWeight + 2) * height); - mItemOptions->setPosition(0, (numRowsDesc + numRowsEffect - + numRowsWeight + numRowsCards + 2) * height); - } - - mItemDesc->setPosition(0, 2 * height); -} - -std::string ItemPopup::getCardsString(const int *const cards) -{ - if (cards == nullptr) - return std::string(); - - std::string label; - - switch (cards[0]) - { - case 0xfe: // named item - { - const int32_t charId = cards[2] + 65536 * cards[3]; - std::string name = actorManager->findCharById(charId); - if (name.empty()) - { - name = toString(charId); - beingHandler->requestNameByCharId(charId); - mLastId = 0; // allow recreate popup with same data - } - // TRANSLATORS: named item description - label.append(strprintf(_("Item named: %s"), name.c_str())); - return label; - } - case 0x00FFU: // forged item - { - return label; - } - case 0xFF00U: - { - return label; - } - default: - { - for (int f = 0; f < maxCards; f ++) - { - const int id = cards[f]; - if (id != 0) - { - if (!label.empty()) - label.append(" / "); - const ItemInfo &info = ItemDB::get(id); - label.append(info.getName()); - } - } - if (label.empty()) - return label; - // TRANSLATORS: popup label - return _("Cards: ") + label; - } - } -} - -std::string ItemPopup::getOptionsString(const ItemOptionsList *const options) -{ - if (options == nullptr || translator == nullptr) - return std::string(); - const size_t sz = options->size(); - std::string effect; - for (size_t f = 0; f < sz; f ++) - { - const ItemOption &option = options->get(f); - if (option.index == 0) - continue; - const STD_VECTOR &fields = ItemOptionDb::getFields( - option.index); - if (fields.empty()) - continue; - const std::string valueStr = toString(option.value); - FOR_EACH (STD_VECTOR::const_iterator, it, fields) - { - const ItemFieldType *const field = *it; - std::string value = valueStr; - if (!effect.empty()) - effect.append(" / "); - if (field->sign && value[0] != '-') - value = std::string("+").append(value); - const std::string format = translator->getStr(field->description); - effect.append(strprintf(format.c_str(), - value.c_str())); - } - } - if (effect.empty()) - return effect; - // TRANSLATORS: popup label - return _("Options: ") + effect; -} - -#define caseSetColor(name1, name2) \ - case name1: \ - { \ - return label->setForegroundColorAll(getThemeColor(name2), \ - getThemeColor(name2##_OUTLINE)); \ - } -void ItemPopup::setLabelColor(Label *label, - const ItemDbTypeT type) const -{ - switch (type) - { - caseSetColor(ItemDbType::UNUSABLE, ThemeColorId::GENERIC) - caseSetColor(ItemDbType::USABLE, ThemeColorId::USABLE) - caseSetColor(ItemDbType::EQUIPMENT_ONE_HAND_WEAPON, - ThemeColorId::ONEHAND) - caseSetColor(ItemDbType::EQUIPMENT_TWO_HANDS_WEAPON, - ThemeColorId::TWOHAND) - caseSetColor(ItemDbType::EQUIPMENT_TORSO, ThemeColorId::TORSO) - caseSetColor(ItemDbType::EQUIPMENT_ARMS, ThemeColorId::ARMS) - caseSetColor(ItemDbType::EQUIPMENT_HEAD, ThemeColorId::HEAD) - caseSetColor(ItemDbType::EQUIPMENT_LEGS, ThemeColorId::LEGS) - caseSetColor(ItemDbType::EQUIPMENT_SHIELD, ThemeColorId::SHIELD) - caseSetColor(ItemDbType::EQUIPMENT_RING, ThemeColorId::RING) - caseSetColor(ItemDbType::EQUIPMENT_NECKLACE, ThemeColorId::NECKLACE) - caseSetColor(ItemDbType::EQUIPMENT_FEET, ThemeColorId::FEET) - caseSetColor(ItemDbType::EQUIPMENT_AMMO, ThemeColorId::AMMO) - caseSetColor(ItemDbType::EQUIPMENT_CHARM, ThemeColorId::CHARM) - caseSetColor(ItemDbType::SPRITE_RACE, ThemeColorId::UNKNOWN_ITEM) - caseSetColor(ItemDbType::SPRITE_HAIR, ThemeColorId::UNKNOWN_ITEM) - caseSetColor(ItemDbType::CARD, ThemeColorId::CARD) - default: - { - return label->setForegroundColorAll(getThemeColor( - ThemeColorId::UNKNOWN_ITEM), getThemeColor( - ThemeColorId::UNKNOWN_ITEM_OUTLINE)); - } - } -} -#undef caseSetColor - -void ItemPopup::mouseMoved(MouseEvent &event) -{ - Popup::mouseMoved(event); - - // When the mouse moved on top of the popup, hide it - setVisible(Visible_false); - resetPopup(); -} - -void ItemPopup::resetPopup() -{ - mLastName.clear(); - mLastColor = ItemColor_one; - mLastId = 0; -} diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h deleted file mode 100644 index fff3b817d..000000000 --- a/src/gui/popups/itempopup.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * The ManaPlus Client - * 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-2017 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 . - */ - -#ifndef GUI_POPUPS_ITEMPOPUP_H -#define GUI_POPUPS_ITEMPOPUP_H - -#include "enums/resources/item/itemdbtype.h" - -#include "enums/simpletypes/itemcolor.h" - -#include "gui/widgets/popup.h" - -class Icon; -class Item; -class ItemInfo; -class Label; -class TextBox; - -struct ItemOptionsList; - -/** - * A popup that displays information about an item. - */ -class ItemPopup final : public Popup -{ - public: - /** - * Constructor. Initializes the item popup. - */ - ItemPopup(); - - A_DELETE_COPY(ItemPopup) - - /** - * Destructor. Cleans up the item popup on deletion. - */ - ~ItemPopup(); - - void postInit() override final; - - /** - * Sets the info to be displayed given a particular item. - */ - void setItem(const ItemInfo &item, - const ItemColor color, - const bool showImage, - int id, - const int *const cards, - const ItemOptionsList *const options); - - void setItem(const Item *const item, - const bool showImage); - - void mouseMoved(MouseEvent &event) override final; - - void resetPopup(); - - private: - std::string getCardsString(const int *const cards); - - std::string getOptionsString(const ItemOptionsList *const options); - - Label *mItemName A_NONNULLPOINTER; - TextBox *mItemDesc A_NONNULLPOINTER; - TextBox *mItemEffect A_NONNULLPOINTER; - TextBox *mItemWeight A_NONNULLPOINTER; - TextBox *mItemCards A_NONNULLPOINTER; - TextBox *mItemOptions A_NONNULLPOINTER; - ItemDbTypeT mItemType; - Icon *mIcon A_NONNULLPOINTER; - std::string mLastName; - std::string mCardsStr; - std::string mItemOptionsStr; - int mLastId; - ItemColor mLastColor; - - void setLabelColor(Label *label, - const ItemDbTypeT type) const A_NONNULL(2); -}; - -extern ItemPopup *itemPopup; - -#endif // GUI_POPUPS_ITEMPOPUP_H diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp deleted file mode 100644 index 752caff72..000000000 --- a/src/gui/popups/popupmenu.cpp +++ /dev/null @@ -1,3613 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 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 . - */ - -#include "gui/popups/popupmenu.h" - -#include "actormanager.h" -#include "configuration.h" -#include "party.h" -#include "settings.h" - -#include "being/flooritem.h" -#include "being/localplayer.h" -#include "being/playerinfo.h" -#include "being/playerrelation.h" -#include "being/playerrelations.h" - -#include "const/spells.h" - -#include "enums/resources/map/mapitemtype.h" - -#include "input/inputmanager.h" - -#include "gui/buttontext.h" -#include "gui/gui.h" -#include "gui/popupmanager.h" -#include "gui/viewport.h" -#include "gui/windowmenu.h" - -#include "gui/windows/chatwindow.h" -#include "gui/windows/inventorywindow.h" -#include "gui/windows/minimap.h" -#include "gui/windows/ministatuswindow.h" -#include "gui/windows/npcdialog.h" -#include "gui/windows/outfitwindow.h" -#include "gui/windows/socialwindow.h" -#include "gui/windows/textcommandeditor.h" -#include "gui/windows/textdialog.h" -#include "gui/windows/tradewindow.h" - -#include "gui/widgets/button.h" -#include "gui/widgets/createwidget.h" -#include "gui/widgets/progressbar.h" -#include "gui/widgets/scrollarea.h" -#include "gui/widgets/staticbrowserbox.h" -#include "gui/widgets/textfield.h" - -#include "gui/widgets/tabs/chat/whispertab.h" - -#include "net/adminhandler.h" -#include "net/chathandler.h" -#include "net/guildhandler.h" -#include "net/npchandler.h" -#include "net/net.h" - -#ifdef TMWA_SUPPORT -#include "net/tmwa/guildmanager.h" -#endif // TMWA_SUPPORT - -#include "resources/chatobject.h" -#include "resources/groupinfo.h" -#include "resources/iteminfo.h" -#include "resources/itemmenuitem.h" - -#include "resources/db/groupdb.h" -#include "resources/db/npcdb.h" - -#include "resources/item/item.h" - -#include "resources/map/map.h" -#include "resources/map/mapitem.h" -#include "resources/map/speciallayer.h" - -#include "resources/skill/skillinfo.h" - -#include "utils/checkutils.h" -#include "utils/foreach.h" -#include "utils/gettext.h" - -#include "debug.h" - -std::string tradePartnerName; - -PopupMenu *popupMenu = nullptr; - -PopupMenu::PopupMenu() : - Popup("PopupMenu", "popupmenu.xml"), - mBrowserBox(new StaticBrowserBox(this, Opaque_true, - "popupbrowserbox.xml")), - mScrollArea(nullptr), - mBeingId(BeingId_zero), - mFloorItemId(BeingId_zero), - mItemId(0), - mItemIndex(-1), - mItemColor(ItemColor_one), - mMapItem(nullptr), - mTab(nullptr), - mSpell(nullptr), - mCallerWindow(nullptr), - mRenameListener(), - mPlayerListener(), - mDialog(nullptr), - mButton(nullptr), - mGroup(nullptr), - mName(), - mExtName(), - mTextField(nullptr), - mType(ActorType::Unknown), - mSubType(BeingTypeId_zero), - mX(0), - mY(0), - mAllowCleanMenu(true) -{ - mBrowserBox->setOpaque(Opaque_false); - mBrowserBox->setLinkHandler(this); - mRenameListener.setMapItem(nullptr); - mRenameListener.setDialog(nullptr); - mPlayerListener.setNick(""); - mPlayerListener.setDialog(nullptr); - mPlayerListener.setType(ActorType::Unknown); - mScrollArea = new ScrollArea(this, mBrowserBox, Opaque_false); - mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); - addMouseListener(this); -} - -void PopupMenu::postInit() -{ - Popup::postInit(); - add(mScrollArea); -} - -void PopupMenu::initPopup() -{ - if (localPlayer == nullptr) - return; - const int groupId = localPlayer->getGroupId(); - mGroup = GroupDb::getGroup(groupId); -} - -bool PopupMenu::isAllowCommand(const ServerCommandTypeT command) -{ - if (mGroup == nullptr) - return false; -#ifdef TMWA_SUPPORT - // allow any commands for legacy if group > 0 - if (Net::getNetworkType() == ServerType::TMWATHENA && - localPlayer != nullptr && - localPlayer->isGM()) - { - return true; - } -#endif - if (mGroup->mPermissions[CAST_SIZE(ServerPermissionType::all_commands)] == - Enable_true) - { - return true; - } - const ServerCommandEnable::Type enabled = - mGroup->mCommands[CAST_SIZE(command)]; - return (enabled & ServerCommandEnable::Self) != 0; -} - -bool PopupMenu::isAllowOtherCommand(const ServerCommandTypeT command) -{ - if (mGroup == nullptr || - localPlayer == nullptr) - return false; -#ifdef TMWA_SUPPORT - // allow any commands for legacy if group > 0 - if (Net::getNetworkType() == ServerType::TMWATHENA && - localPlayer->isGM()) - { - return true; - } -#endif - const ServerCommandEnable::Type enabled = - mGroup->mCommands[CAST_SIZE(command)]; - if (mName == localPlayer->getName()) - return (enabled & ServerCommandEnable::Self) != 0; - return (enabled & ServerCommandEnable::Other) != 0; -} - -void PopupMenu::showPopup(const int x, const int y, const Being *const being) -{ - if (being == nullptr || - localPlayer == nullptr || - actorManager == nullptr) - { - return; - } - - initPopup(); - mBeingId = being->getId(); - mName = being->getName(); - mExtName = being->getExtName(); - mType = being->getType(); - mSubType = being->getSubType(); - mBrowserBox->clearRows(); - mX = x; - mY = y; - - const std::string &name = mName; - if (being->getType() != ActorType::SkillUnit) - { - mBrowserBox->addRow(name + being->getGenderSignWithSpace()); - } - - switch (being->getType()) - { - case ActorType::Player: - { - // TRANSLATORS: popup menu item - // TRANSLATORS: trade with player - mBrowserBox->addRow("/trade 'NAME'", _("Trade")); - // TRANSLATORS: popup menu item - // TRANSLATORS: trade attack player - mBrowserBox->addRow("/attack 'NAME'", _("Attack")); - // TRANSLATORS: popup menu item - // TRANSLATORS: send whisper to player - mBrowserBox->addRow("/whispertext 'NAME'", _("Whisper")); - addMailCommands(); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() == ServerType::TMWATHENA) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: heal player - mBrowserBox->addRow("/heal :'BEINGID'", _("Heal")); - mBrowserBox->addSeparator("##3---"); - } -#endif // TMWA_SUPPORT - - addPlayerRelation(name); - mBrowserBox->addSeparator("##3---"); - - addFollow(); - addPartyName(being->getPartyName()); - - const Guild *const guild1 = being->getGuild(); - const Guild *const guild2 = localPlayer->getGuild(); - if (guild2 != nullptr) - { - if (guild1 != nullptr) - { - if (guild1->getId() == guild2->getId()) - { - mBrowserBox->addRow("/kickguild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - _("Kick from guild")); - if (guild2->getServerGuild()) - { - mBrowserBox->addRow(strprintf( - "@@guild-pos|%s >@@", - // TRANSLATORS: popup menu item - // TRANSLATORS: change player position in guild - _("Change pos in guild"))); - } - } - } - else if (guild2->getMember(mName) != nullptr) - { - mBrowserBox->addRow("/kickguild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - _("Kick from guild")); - if (guild2->getServerGuild()) - { - mBrowserBox->addRow(strprintf( - "@@guild-pos|%s >@@", - // TRANSLATORS: popup menu item - // TRANSLATORS: change player position in guild - _("Change pos in guild"))); - } - } - else - { -#ifdef TMWA_SUPPORT - if (guild2->getServerGuild() || - (guildManager != nullptr && guildManager->havePower())) -#endif // TMWA_SUPPORT - { - mBrowserBox->addRow("/guild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: invite player to guild - _("Invite to guild")); - } - } - } - - // TRANSLATORS: popup menu item - // TRANSLATORS: set player invisible for self by id - mBrowserBox->addRow("/nuke 'NAME'", _("Nuke")); - // TRANSLATORS: popup menu item - // TRANSLATORS: move to player location - mBrowserBox->addRow("/navigateto 'NAME'", _("Move")); - addPlayerMisc(); - addBuySell(being); - addChat(being); - break; - } - - case ActorType::Npc: - if (!addBeingMenu()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: talk with npc - mBrowserBox->addRow("/talk 'NAME'", _("Talk")); -#ifdef TMWA_SUPPORT - if (Net::getNetworkType() != ServerType::TMWATHENA) -#endif - { - mBrowserBox->addRow("/whispertext NPC:'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: whisper to npc - _("Whisper")); - } - // TRANSLATORS: popup menu item - // TRANSLATORS: buy from npc - mBrowserBox->addRow("/buy 'NAME'", _("Buy")); - // TRANSLATORS: popup menu item - // TRANSLATORS: sell to npc - mBrowserBox->addRow("/sell 'NAME'", _("Sell")); - } - - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: move to npc location - mBrowserBox->addRow("/navigateto 'NAME'", _("Move")); - // TRANSLATORS: popup menu item - // TRANSLATORS: add comment to npc - mBrowserBox->addRow("addcomment", _("Add comment")); - addChat(being); - break; - - case ActorType::Monster: - { - // Monsters can be attacked - // TRANSLATORS: popup menu item - // TRANSLATORS: attack monster - mBrowserBox->addRow("/attack :'BEINGID'", _("Attack")); - addCatchPetCommands(); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - - if (config.getBoolValue("enableAttackFilter")) - { - mBrowserBox->addSeparator("##3---"); - if (actorManager->isInAttackList(name) - || actorManager->isInIgnoreAttackList(name) - || actorManager->isInPriorityAttackList(name)) - { - mBrowserBox->addRow("/removeattack 'NAME'", - // TRANSLATORS: remove monster from attack list - // TRANSLATORS: popup menu item - _("Remove from attack list")); - } - else - { - mBrowserBox->addRow("/addpriorityattack 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: add monster to priotiry attack list - _("Add to priority attack list")); - mBrowserBox->addRow("/addattack 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: add monster to attack list - _("Add to attack list")); - mBrowserBox->addRow("/addignoreattack 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: add monster to ignore list - _("Add to ignore list")); - } - } - break; - } - - case ActorType::Mercenary: - // TRANSLATORS: popup menu item - // TRANSLATORS: Mercenary move to master - mBrowserBox->addRow("/mercenarytomaster", _("Move to master")); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: fire mercenary - mBrowserBox->addRow("/firemercenary", _("Fire")); - mBrowserBox->addSeparator("##3---"); - break; - - case ActorType::Homunculus: - { - const HomunculusInfo *const info = PlayerInfo::getHomunculus(); - if (info != nullptr) - { - mBrowserBox->addRow("/homunculustomaster", - // TRANSLATORS: popup menu item - // TRANSLATORS: homunculus move to master - _("Move to master")); - // TRANSLATORS: popup menu item - // TRANSLATORS: feed homunculus - mBrowserBox->addRow("/homunculusfeed", _("Feed")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet rename item - mBrowserBox->addRow("/sethomunname", _("Rename")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: delete homunculus - mBrowserBox->addRow("/homunculusfire", _("Kill")); - mBrowserBox->addSeparator("##3---"); - } - addGmCommands(); - break; - } - case ActorType::Pet: - if (being->getOwner() == localPlayer) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: feed pet - mBrowserBox->addRow("/petfeed", _("Feed")); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet drop loot - mBrowserBox->addRow("/petdroploot", _("Drop loot")); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet unequip item - mBrowserBox->addRow("/petunequip", _("Unequip")); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: pet rename item - mBrowserBox->addRow("/setpetname", _("Rename")); - mBrowserBox->addSeparator("##3---"); - const BeingInfo *const info = being->getInfo(); - std::string msg; - if (info != nullptr) - msg = info->getString(0); - if (!msg.empty()) - { - mBrowserBox->addRow("/petreturnegg", msg.c_str()); - } - else - { - mBrowserBox->addRow("/petreturnegg", - // TRANSLATORS: popup menu item - // TRANSLATORS: pet return to egg - _("Return to egg")); - } - mBrowserBox->addSeparator("##3---"); - } - else - { - addCatchPetCommands(); - } - break; - case ActorType::SkillUnit: - { - const BeingId id = being->getCreatorId(); - std::string creatorName; - Being *const creator = actorManager->findBeing(id); - if (creator != nullptr) - creatorName = creator->getName(); - else - creatorName = actorManager->getSeenPlayerById(id); - - if (creatorName.empty()) - creatorName = strprintf("?%d", CAST_S32(id)); - - mBrowserBox->addRow(strprintf("%s, %d (%s)", - name.c_str(), - CAST_S32(being->getSubType()), - creatorName.c_str())); - break; - } - case ActorType::Avatar: - case ActorType::Unknown: - case ActorType::FloorItem: - case ActorType::Portal: - case ActorType::Elemental: - default: - break; - } - // TRANSLATORS: popup menu item - // TRANSLATORS: add being name to chat - mBrowserBox->addRow("/addtext 'NAME'", _("Add name to chat")); - mBrowserBox->addSeparator("##3---"); - - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -bool PopupMenu::addBeingMenu() -{ - Being *being = actorManager->findBeing(mBeingId); - if (being == nullptr) - return false; - - BeingInfo *const info = NPCDB::get(fromInt( - being->getSubType(), BeingTypeId)); - if (info == nullptr) - return false; - - const STD_VECTOR &menu = info->getMenu(); - FOR_EACH (STD_VECTOR::const_iterator, it, menu) - { - const BeingMenuItem &item = *it; - mBrowserBox->addRow("/" + item.command, item.name.c_str()); - } - return true; -} - -void PopupMenu::setMousePos() -{ - if (viewport != nullptr) - { - mX = viewport->mMouseX; - mY = viewport->mMouseY; - } - else - { - Gui::getMouseState(mX, mY); - } -} - -void PopupMenu::setMousePos2() -{ - if (mX == 0 && mY == 0) - { - if (viewport != nullptr) - { - mX = viewport->mMouseX; - mY = viewport->mMouseY; - } - else - { - Gui::getMouseState(mX, mY); - } - } -} - -void PopupMenu::showPopup(const int x, const int y, - const STD_VECTOR &beings) -{ - initPopup(); - mX = x; - mY = y; - mBrowserBox->clearRows(); - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Players")); - FOR_EACH (STD_VECTOR::const_iterator, it, beings) - { - const Being *const being = dynamic_cast(*it); - const ActorSprite *const actor = *it; - if ((being != nullptr) && !being->getName().empty()) - { - mBrowserBox->addRow(strprintf("@@player_%u|%s >@@", - CAST_U32(being->getId()), (being->getName() - + being->getGenderSignWithSpace()).c_str())); - } - else if (actor->getType() == ActorType::FloorItem) - { - const FloorItem *const floorItem - = static_cast(actor); - mBrowserBox->addRow(strprintf("@@flooritem_%u|%s >@@", - CAST_U32(actor->getId()), - floorItem->getName().c_str())); - } - } - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - showPopup(x, y); -} - -void PopupMenu::showPlayerPopup(const std::string &nick) -{ - if (nick.empty() || (localPlayer == nullptr)) - return; - - initPopup(); - setMousePos(); - mName = nick; - mExtName = nick; - mBeingId = BeingId_zero; - mType = ActorType::Player; - mSubType = BeingTypeId_zero; - mBrowserBox->clearRows(); - - const std::string &name = mName; - - mBrowserBox->addRow(name); - - // TRANSLATORS: popup menu item - // TRANSLATORS: send whisper to player - mBrowserBox->addRow("/whispertext 'NAME'", _("Whisper")); - addMailCommands(); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - - addPlayerRelation(name); - mBrowserBox->addSeparator("##3---"); - - addFollow(); - // TRANSLATORS: popup menu item - // TRANSLATORS: add comment to player - mBrowserBox->addRow("addcomment", _("Add comment")); - - if (localPlayer->isInParty()) - { - const Party *const party = localPlayer->getParty(); - if (party != nullptr) - { - const PartyMember *const member = party->getMember(mName); - if (member != nullptr) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from party - mBrowserBox->addRow("/kickparty 'NAME'", _("Kick from party")); - mBrowserBox->addSeparator("##3---"); - const PartyMember *const o = party->getMember( - localPlayer->getName()); - showAdoptCommands(); - if ((o != nullptr) && member->getMap() == o->getMap()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: move to player position - mBrowserBox->addRow("/navigate 'X' 'Y'", _("Move")); - } - } - } - } - - const Guild *const guild2 = localPlayer->getGuild(); - if (guild2 != nullptr) - { - if (guild2->getMember(mName) != nullptr) - { -#ifdef TMWA_SUPPORT - if (guild2->getServerGuild() || (guildManager != nullptr - && guildManager->havePower())) -#endif // TMWA_SUPPORT - { - mBrowserBox->addRow("/kickguild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - _("Kick from guild")); - } - if (guild2->getServerGuild()) - { - mBrowserBox->addRow(strprintf( - // TRANSLATORS: popup menu item - // TRANSLATORS: change player position in guild - "@@guild-pos|%s >@@", _("Change pos in guild"))); - } - } - else - { -#ifdef TMWA_SUPPORT - if (guild2->getServerGuild() || (guildManager != nullptr - && guildManager->havePower())) -#endif // TMWA_SUPPORT - { - // TRANSLATORS: popup menu item - // TRANSLATORS: invite player to guild - mBrowserBox->addRow("/guild 'NAME'", _("Invite to guild")); - } - } - } - - addBuySellDefault(); - // TRANSLATORS: popup menu item - // TRANSLATORS: add player name to chat - mBrowserBox->addRow("/addtext 'NAME'", _("Add name to chat")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(mX, mY); -} - -void PopupMenu::showPopup(const int x, const int y, - const FloorItem *const floorItem) -{ - if (floorItem == nullptr) - return; - - initPopup(); - mX = x; - mY = y; - mFloorItemId = floorItem->getId(); - mItemId = floorItem->getItemId(); - mType = ActorType::FloorItem; - mSubType = BeingTypeId_zero; - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = floorItem->getCard(f); - mBrowserBox->clearRows(); - const std::string name = floorItem->getName(); - mName = name; - mExtName = name; - - mBrowserBox->addRow(name); - - if (config.getBoolValue("enablePickupFilter")) - { - if (actorManager->isInPickupList(name) - || (actorManager->isInPickupList("") - && !actorManager->isInIgnorePickupList(name))) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: pickup item from ground - mBrowserBox->addRow("/pickup 'FLOORID'", _("Pick up")); - mBrowserBox->addSeparator("##3---"); - } - addPickupFilter(name); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: pickup item from ground - mBrowserBox->addRow("/pickup 'FLOORID'", _("Pick up")); - } - addProtection(); - // TRANSLATORS: popup menu item - // TRANSLATORS: add item name to chat - mBrowserBox->addRow("/addchat 'FLOORID''CARDS'", _("Add to chat")); - mBrowserBox->addSeparator("##3---"); - addGmCommands(); - - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(mX, mY); -} - -void PopupMenu::showPopup(const int x, const int y, MapItem *const mapItem) -{ - if (mapItem == nullptr) - return; - - initPopup(); - mMapItem = mapItem; - mX = x; - mY = y; - - mBrowserBox->clearRows(); - - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Map Item")); - // TRANSLATORS: popup menu item - // TRANSLATORS: rename map item - mBrowserBox->addRow("rename map", _("Rename")); - // TRANSLATORS: popup menu item - // TRANSLATORS: remove map item - mBrowserBox->addRow("remove map", _("Remove")); - - if (isAllowCommand(ServerCommandType::slide)) - { - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: warp to map item - mBrowserBox->addRow("/slide 'MAPX' 'MAPY'", _("Warp")); - } - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showMapPopup(const int x, const int y, - const int x2, const int y2, - const bool isMinimap) -{ - initPopup(); - mX = x2; - mY = y2; - - if (isMinimap) - mCallerWindow = minimap; - - mBrowserBox->clearRows(); - - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Map Item")); - - if (isAllowCommand(ServerCommandType::slide)) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: warp to map item - mBrowserBox->addRow("/slide 'MAPX' 'MAPY'", _("Warp")); - } - // TRANSLATORS: popup menu item - // TRANSLATORS: move to map item - mBrowserBox->addRow("/navigate 'X' 'Y'", _("Move")); - // TRANSLATORS: popup menu item - // TRANSLATORS: move camera to map item - mBrowserBox->addRow("/movecamera 'X' 'Y'", _("Move camera")); - if (settings.cameraMode != 0) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: restore camera to default view - mBrowserBox->addRow("/restorecamera", _("Restore camera")); - } - mBrowserBox->addSeparator("##3---"); - if (isMinimap) - { - // TRANSLATORS: popup menu item - mBrowserBox->addRow("window close", _("Close")); - } - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showOutfitsWindowPopup(const int x, const int y) -{ - initPopup(); - mX = x; - mY = y; - mCallerWindow = outfitWindow; - - mBrowserBox->clearRows(); - - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Outfits")); - // TRANSLATORS: popup menu item - // TRANSLATORS: copy selected outfit to chat input - mBrowserBox->addRow("/outfittochat", _("Add to chat")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: copy equipment from player to outfit - mBrowserBox->addRow("/itemstooutfit", _("Copy from player")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: clear selected outfit - mBrowserBox->addRow("/clearoutfit", _("Clear outfit")); - mBrowserBox->addSeparator("##3---"); - - addWindowMenu(outfitWindow); - mBrowserBox->addSeparator("##3---"); - - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showSpellPopup(const int x, const int y, - TextCommand *const cmd) -{ - if (cmd == nullptr) - return; - - initPopup(); - mBrowserBox->clearRows(); - - mSpell = cmd; - mX = x; - mY = y; - - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Spells")); - // TRANSLATORS: popup menu item - // TRANSLATORS: edit selected spell - mBrowserBox->addRow("edit spell", _("Edit spell")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) -{ - if (tab == nullptr || - actorManager == nullptr || - localPlayer == nullptr) - { - return; - } - - initPopup(); - mTab = tab; - mX = x; - mY = y; - mCallerWindow = chatWindow; - - mBrowserBox->clearRows(); - - const ChatTabTypeT &type = tab->getType(); - if (type == ChatTabType::WHISPER || type == ChatTabType::CHANNEL) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: close chat tab - mBrowserBox->addRow("/close", _("Close")); - } - - // TRANSLATORS: popup menu item - // TRANSLATORS: remove all text from chat tab - mBrowserBox->addRow("/chatclear", _("Clear")); - mBrowserBox->addSeparator("##3---"); - - if (tab->getAllowHighlight()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: disable chat tab highlight - mBrowserBox->addRow("/disablehighlight", _("Disable highlight")); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: enable chat tab highlight - mBrowserBox->addRow("/enablehighlight", _("Enable highlight")); - } - if (tab->getRemoveNames()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: do not remove player names from chat tab - mBrowserBox->addRow("/dontremovename", _("Don't remove name")); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: remove player names from chat tab - mBrowserBox->addRow("/removename", _("Remove name")); - } - if (tab->getNoAway()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: enable away messages in chat tab - mBrowserBox->addRow("/enableaway", _("Enable away")); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: disable away messages in chat tab - mBrowserBox->addRow("/disableaway", _("Disable away")); - } - mBrowserBox->addSeparator("##3---"); - if (type == ChatTabType::PARTY) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: enable away messages in chat tab - mBrowserBox->addRow("/leaveparty", _("Leave")); - mBrowserBox->addSeparator("##3---"); - } - // TRANSLATORS: popup menu item - // TRANSLATORS: copy selected text to clipboard - mBrowserBox->addRow("/chatclipboard 'X' 'Y'", _("Copy to clipboard")); - mBrowserBox->addSeparator("##3---"); - - if (type == ChatTabType::WHISPER) - { - const WhisperTab *const wTab = static_cast(tab); - const std::string &name = wTab->getNick(); - - const Being* const being = actorManager->findBeingByName( - name, ActorType::Player); - - addGmCommands(); - if (being != nullptr) - { - mBeingId = being->getId(); - mName = being->getName(); - mExtName = being->getExtName(); - mType = being->getType(); - mSubType = being->getSubType(); - - // TRANSLATORS: popup menu item - // TRANSLATORS: trade with player - mBrowserBox->addRow("/trade 'NAME'", _("Trade")); - // TRANSLATORS: popup menu item - // TRANSLATORS: attack player - mBrowserBox->addRow("/attack 'NAME'", _("Attack")); - addMailCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: heal player - mBrowserBox->addRow("/heal :'BEINGID'", _("Heal")); - mBrowserBox->addSeparator("##3---"); - addPlayerRelation(name); - mBrowserBox->addSeparator("##3---"); - addFollow(); - // TRANSLATORS: popup menu item - // TRANSLATORS: move to player position - mBrowserBox->addRow("/navigateto 'NAME'", _("Move")); - addPlayerMisc(); - addBuySell(being); - mBrowserBox->addSeparator("##3---"); - addParty(wTab->getNick()); - const Guild *const guild1 = being->getGuild(); - const Guild *const guild2 = localPlayer->getGuild(); - if (guild2 != nullptr) - { - if (guild1 != nullptr) - { - if (guild1->getId() == guild2->getId()) - { -#ifdef TMWA_SUPPORT - if (guild2->getServerGuild() || - (guildManager != nullptr && - guildManager->havePower())) -#endif // TMWA_SUPPORT - { - mBrowserBox->addRow("/kickguild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: kick player from guild - _("Kick from guild")); - } - if (guild2->getServerGuild()) - { - mBrowserBox->addRow(strprintf("@@guild-pos|%s >@@", - // TRANSLATORS: popup menu item - // TRANSLATORS: change player position in guild - _("Change pos in guild"))); - } - } - } - else - { -#ifdef TMWA_SUPPORT - if (guild2->getServerGuild() || (guildManager != nullptr - && guildManager->havePower())) -#endif // TMWA_SUPPORT - { - mBrowserBox->addRow("/guild 'NAME'", - // TRANSLATORS: popup menu item - // TRANSLATORS: invite player to guild - _("Invite to guild")); - } - } - } - } - else - { - mBeingId = BeingId_zero; - mName = name; - mExtName = name; - mType = ActorType::Player; - mSubType = BeingTypeId_zero; - addPlayerRelation(name); - mBrowserBox->addSeparator("##3---"); - addMailCommands(); - addFollow(); - - if (localPlayer->isInParty()) - { - const Party *const party = localPlayer->getParty(); - if (party != nullptr) - { - const PartyMember *const m = party->getMember(mName); - if (m != nullptr) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: move to player location - mBrowserBox->addRow("/navigateto 'NAME'", _("Move")); - } - } - } - addPlayerMisc(); - addBuySellDefault(); - if (Net::getNetworkType() != ServerType::TMWATHENA) - addParty(wTab->getNick()); - mBrowserBox->addSeparator("##3---"); - } - } - - addWindowMenu(chatWindow); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showChangePos(const int x, const int y) -{ - initPopup(); - mBrowserBox->clearRows(); - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Change guild position")); - - if (localPlayer == nullptr) - return; - - mX = x; - mY = y; - const Guild *const guild = localPlayer->getGuild(); - if (guild != nullptr) - { - const PositionsMap &map = guild->getPositions(); - FOR_EACH (PositionsMap::const_iterator, itr, map) - { - mBrowserBox->addRow(strprintf("@@guild-pos-%u|%s@@", - itr->first, itr->second.c_str())); - } - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); - } - else - { - mBeingId = BeingId_zero; - mFloorItemId = BeingId_zero; - mItemIndex = -1; - mItemId = 0; - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = 0; - mMapItem = nullptr; - mName.clear(); - mExtName.clear(); - mType = ActorType::Unknown; - mSubType = BeingTypeId_zero; - mX = 0; - mY = 0; - setVisible(Visible_false); - } -} - -void PopupMenu::showWindowPopup(Window *const window) -{ - if (window == nullptr) - return; - - initPopup(); - setMousePos(); - mCallerWindow = window; - mBrowserBox->clearRows(); - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("window")); - - addWindowMenu(window); - - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(mX, mY); -} - -void PopupMenu::addWindowMenu(const Window *const window) -{ - if (window == nullptr) - return; - - initPopup(); - if (window->getAlowClose()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: close window - mBrowserBox->addRow("window close", _("Close")); - } - - if (window->isStickyButtonLock()) - { - if (window->isSticky()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: unlock window - mBrowserBox->addRow("window unlock", _("Unlock")); - } - else - { - // TRANSLATORS: popup menu item - // TRANSLATORS: lock window - mBrowserBox->addRow("window lock", _("Lock")); - } - } -} - -void PopupMenu::showEmoteType() -{ - initPopup(); - setMousePos(); - - mBrowserBox->clearRows(); - // TRANSLATORS: popup menu header - mBrowserBox->addRow(_("Show emotes for:")); - - // TRANSLATORS: popup menu item - // TRANSLATORS: show emotes for player - mBrowserBox->addRow("/setemotetype player", _("Player")); - - // TRANSLATORS: popup menu item - // TRANSLATORS: show emotes for pet - mBrowserBox->addRow("/setemotetype pet", _("Pet")); - - if (Net::getNetworkType() == ServerType::EVOL2) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: show emotes for homuncules - mBrowserBox->addRow("/setemotetype homun", _("Homunculus")); - - // TRANSLATORS: popup menu item - // TRANSLATORS: show emotes for mercenary - mBrowserBox->addRow("/setemotetype merc", _("Mercenary")); - } - mBrowserBox->addSeparator("##3---"); - - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(mX, mY); -} - -void PopupMenu::handleLink(const std::string &link, - MouseEvent *event A_UNUSED) -{ - Being *being = nullptr; - if (actorManager != nullptr) - being = actorManager->findBeing(mBeingId); - - mAllowCleanMenu = true; - - if (link == "remove map" && (mMapItem != nullptr)) - { - if (viewport != nullptr) - { - const Map *const map = viewport->getMap(); - if (map != nullptr) - { - SpecialLayer *const specialLayer = map->getSpecialLayer(); - if (specialLayer != nullptr) - { - const bool isHome = (mMapItem->getType() - == CAST_S32(MapItemType::HOME)); - const int x = static_cast(mMapItem->getX()); - const int y = static_cast(mMapItem->getY()); - specialLayer->setTile(x, y, - CAST_S32(MapItemType::EMPTY)); - specialLayer->updateCache(); - if (socialWindow != nullptr) - socialWindow->removePortal(x, y); - if (isHome && (localPlayer != nullptr)) - { - localPlayer->removeHome(); - localPlayer->saveHomes(); - } - } - } - } - } - else if (link == "rename map" && (mMapItem != nullptr)) - { - mRenameListener.setMapItem(mMapItem); - CREATEWIDGETV(mDialog, TextDialog, - // TRANSLATORS: dialog caption - // TRANSLATORS: number of chars in string should be near original - _("Rename map sign "), - // TRANSLATORS: label - // TRANSLATORS: number of chars in string should be near original - _("Name: ")); - mRenameListener.setDialog(mDialog); - mDialog->setText(mMapItem->getComment()); - mDialog->setActionEventId("ok"); - mDialog->addActionListener(&mRenameListener); - } - else if (link == "edit spell" && (mSpell != nullptr)) - { - CREATEWIDGET(TextCommandEditor, mSpell); - } - else if (link == "addcomment" && !mName.empty()) - { - TextDialog *const dialog = CREATEWIDGETR(TextDialog, - // TRANSLATORS: dialog caption - // TRANSLATORS: number of chars in string should be near original - _("Player comment "), - // TRANSLATORS: label - // TRANSLATORS: number of chars in string should be near original - _("Comment: ")); - mPlayerListener.setDialog(dialog); - mPlayerListener.setNick(mName); - mPlayerListener.setType(mType); - - if (being != nullptr) - { - being->updateComment(); - dialog->setText(being->getComment()); - } - else - { - dialog->setText(Being::loadComment(mName, - static_cast(mType))); - } - dialog->setActionEventId("ok"); - dialog->addActionListener(&mPlayerListener); - } - else if (link == "guild-pos" && !mName.empty()) - { - showChangePos(getX(), getY()); - return; - } - else if (link == "clipboard copy") - { - if (mTextField != nullptr) - mTextField->handleCopy(); - } - else if (link == "clipboard paste") - { - if (mTextField != nullptr) - mTextField->handlePaste(); - } - else if (link == "gm" && !mName.empty()) - { - showGMPopup(mName); - return; - } - else if (link == "mute" && !mName.empty()) - { - showMuteCommands(); - return; - } - else if (link == "show" && !mName.empty()) - { - showPlayerMenu(); - return; - } - else if (link == "window close" && (mCallerWindow != nullptr)) - { - if (Widget::widgetExists(mCallerWindow)) - mCallerWindow->close(); - } - else if (link == "window unlock" && (mCallerWindow != nullptr)) - { - if (Widget::widgetExists(mCallerWindow)) - mCallerWindow->setSticky(false); - } - else if (link == "window lock" && (mCallerWindow != nullptr)) - { - if (Widget::widgetExists(mCallerWindow)) - mCallerWindow->setSticky(true); - } - else if (link == "join chat" && (being != nullptr)) - { - const ChatObject *const chat = being->getChat(); - if (chat != nullptr) - chatHandler->joinChat(chat, ""); - } - else if (link == "craftmenu") - { - showCraftPopup(); - return; - } - else if (link.compare(0, 10, "guild-pos-") == 0) - { - if (localPlayer != nullptr) - { - const int num = atoi(link.substr(10).c_str()); - const Guild *const guild = localPlayer->getGuild(); - if (guild != nullptr) - { - guildHandler->changeMemberPostion( - guild->getMember(mName), num); - } - } - } - else if (link.compare(0, 7, "player_") == 0) - { - if (actorManager != nullptr) - { - mBeingId = fromInt(atoi(link.substr(7).c_str()), BeingId); - being = actorManager->findBeing(mBeingId); - if (being != nullptr) - { - showPopup(getX(), getY(), being); - return; - } - } - } - else if (link.compare(0, 10, "flooritem_") == 0) - { - if (actorManager != nullptr) - { - const BeingId id = fromInt(atoi( - link.substr(10).c_str()), BeingId); - if (id != BeingId_zero) - { - const FloorItem *const item = actorManager->findItem(id); - if (item != nullptr) - { - mFloorItemId = item->getId(); - mItemId = item->getItemId(); - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = item->getCard(f); - showPopup(getX(), getY(), item); - return; - } - } - } - } - else if (link.compare(0, 12, "hide button_") == 0) - { - if (windowMenu != nullptr) - windowMenu->showButton(link.substr(12), Visible_false); - } - else if (link.compare(0, 12, "show button_") == 0) - { - if (windowMenu != nullptr) - windowMenu->showButton(link.substr(12), Visible_true); - } - else if (link.compare(0, 9, "hide bar_") == 0) - { - if (miniStatusWindow != nullptr) - miniStatusWindow->showBar(link.substr(9), Visible_false); - } - else if (link.compare(0, 9, "show bar_") == 0) - { - if (miniStatusWindow != nullptr) - miniStatusWindow->showBar(link.substr(9), Visible_true); - } - else if (link.compare(0, 12, "show window_") == 0) - { - const int id = atoi(link.substr(12).c_str()); - if (id >= 0) - inputManager.executeAction(static_cast(id)); - } - else if (link.compare(0, 6, "mute_+") == 0) - { - if (being != nullptr) - { - const int time = atoi(link.substr(6).c_str()); - adminHandler->mute(being, 1, time); - } - } - else if (link.compare(0, 6, "mute_-") == 0) - { - if (being != nullptr) - { - const int time = atoi(link.substr(6).c_str()); - adminHandler->mute(being, 0, time); - } - } - else if (!link.empty() && link[0] == '/') - { - std::string cmd = link.substr(1); - replaceAll(cmd, "'NAME'", mName); - replaceAll(cmd, "'ENAME'", escapeString(mName)); - replaceAll(cmd, "'EXTNAME'", mExtName); - replaceAll(cmd, "'EEXTNAME'", escapeString(mExtName)); - replaceAll(cmd, "'X'", toString(mX)); - replaceAll(cmd, "'Y'", toString(mY)); - replaceAll(cmd, "'BEINGID'", toString(toInt(mBeingId, int))); - replaceAll(cmd, "'FLOORID'", toString(toInt(mFloorItemId, int))); - replaceAll(cmd, "'ITEMID'", toString(mItemId)); - replaceAll(cmd, "'ITEMCOLOR'", toString(toInt(mItemColor, int))); - replaceAll(cmd, "'BEINGTYPEID'", toString(CAST_S32(mType))); - replaceAll(cmd, "'BEINGSUBTYPEID'", toString(CAST_S32(mSubType))); - replaceAll(cmd, "'PLAYER'", localPlayer->getName()); - replaceAll(cmd, "'EPLAYER'", escapeString(localPlayer->getName())); - replaceAll(cmd, "'PLAYERX'", toString(localPlayer->getTileX())); - replaceAll(cmd, "'PLAYERY'", toString(localPlayer->getTileY())); - if (mItemIndex >= 0) - replaceAll(cmd, "'INVINDEX'", toString(mItemIndex)); - else - replaceAll(cmd, "'INVINDEX'", "0"); - if (mMapItem != nullptr) - { - replaceAll(cmd, "'MAPX'", toString(mMapItem->getX())); - replaceAll(cmd, "'MAPY'", toString(mMapItem->getY())); - } - else - { - replaceAll(cmd, "'MAPX'", toString(mX)); - replaceAll(cmd, "'MAPY'", toString(mY)); - } - - std::string cards; - for (int f = 0; f < maxCards; f ++) - { - const int id = mItemCards[f]; - if (id != 0) - { - cards.append(","); - cards.append(toString(id)); - } - } - replaceAll(cmd, "'CARDS'", cards); - replaceAll(cmd, "'ECARDS'", escapeString(cards)); - if (actorManager != nullptr) - { - if (being == nullptr) - { - being = actorManager->findBeingByName(mName, - ActorType::Player); - } - } - if (being != nullptr) - replaceAll(cmd, "'PARTY'", being->getPartyName()); - else - replaceAll(cmd, "'PARTY'", ""); - - const size_t pos = cmd.find(' '); - const std::string type(cmd, 0, pos); - std::string args(cmd, pos == std::string::npos ? cmd.size() : pos + 1); - args = trim(args); - inputManager.executeChatCommand(type, args, mTab); - } - // Unknown actions - else if (link != "cancel") - { - reportAlways("PopupMenu: Warning, unknown action '%s'", link.c_str()); - } - - if (!mAllowCleanMenu) - return; - - setVisible(Visible_false); - - mBeingId = BeingId_zero; - mFloorItemId = BeingId_zero; - mItemId = 0; - mItemIndex = -1; - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = 0; - mItemColor = ItemColor_one; - mMapItem = nullptr; - mTab = nullptr; - mSpell = nullptr; - mCallerWindow = nullptr; - mDialog = nullptr; - mButton = nullptr; - mName.clear(); - mExtName.clear(); - mTextField = nullptr; - mType = ActorType::Unknown; - mSubType = BeingTypeId_zero; - mX = 0; - mY = 0; -} - -void PopupMenu::showPopup(Window *const parent, - const int x, const int y, - const Item *const item, - const InventoryTypeT type) -{ - if (item == nullptr) - return; - - initPopup(); - mItemId = item->getId(); - mItemIndex = item->getInvIndex(); - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = item->getCard(f); - mItemColor = item->getColor(); - mCallerWindow = parent; - mX = x; - mY = y; - mName.clear(); - mExtName.clear(); - mBrowserBox->clearRows(); - - const int cnt = item->getQuantity(); - const bool isProtected = PlayerInfo::isItemProtected(mItemId); - - switch (type) - { - case InventoryType::Inventory: - if (tradeWindow != nullptr && - tradeWindow->isWindowVisible() && - !isProtected) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: add item to trade - mBrowserBox->addRow("/addtrade 'INVINDEX'", _("Add to trade")); - if (cnt > 1) - { - if (cnt > 10) - { - mBrowserBox->addRow("/addtrade 'INVINDEX' 10", - // TRANSLATORS: popup menu item - // TRANSLATORS: add 10 item amount to trade - _("Add to trade 10")); - } - mBrowserBox->addRow("/addtrade 'INVINDEX' /", - // TRANSLATORS: popup menu item - // TRANSLATORS: add half item amount to trade - _("Add to trade half")); - mBrowserBox->addRow("/addtrade 'INVINDEX' -1", - // TRANSLATORS: popup menu item - // TRANSLATORS: add all amount except one item to trade - _("Add to trade all-1")); - mBrowserBox->addRow("/addtrade 'INVINDEX' all", - // TRANSLATORS: popup menu item - // TRANSLATORS: add all amount item to trade - _("Add to trade all")); - } - mBrowserBox->addSeparator("##3---"); - } - if (InventoryWindow::isStorageActive()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: add item to storage - mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store")); - if (cnt > 1) - { - if (cnt > 10) - { - mBrowserBox->addRow("/invtostorage 'INVINDEX' 10", - // TRANSLATORS: popup menu item - // TRANSLATORS: add 10 item amount to storage - _("Store 10")); - } - mBrowserBox->addRow("/invtostorage 'INVINDEX' /", - // TRANSLATORS: popup menu item - // TRANSLATORS: add half item amount to storage - _("Store half")); - mBrowserBox->addRow("/invtostorage 'INVINDEX' -1", - // TRANSLATORS: popup menu item - // TRANSLATORS: add all except one item to storage - _("Store all-1")); - mBrowserBox->addRow("/invtostorage 'INVINDEX' all", - // TRANSLATORS: popup menu item - // TRANSLATORS: add all item amount to storage - _("Store all")); - } - mBrowserBox->addSeparator("##3---"); - } - if (npcHandler != nullptr) - { - NpcDialog *const dialog = npcHandler->getCurrentNpcDialog(); - if ((dialog != nullptr) && - dialog->getInputState() == NpcInputState::ITEM_CRAFT) - { - mBrowserBox->addRow("craftmenu", - // TRANSLATORS: popup menu item - // TRANSLATORS: sub menu for craft - _("Move to craft...")); - } - } - addItemMenu(item, InventoryType::Inventory); - addDrop(item, isProtected); - break; - - case InventoryType::Storage: - // TRANSLATORS: popup menu item - // TRANSLATORS: get item from storage - mBrowserBox->addRow("/storagetoinv 'INVINDEX'", _("Retrieve")); - if (cnt > 1) - { - if (cnt > 10) - { - mBrowserBox->addRow("/storagetoinv 'INVINDEX' 10", - // TRANSLATORS: popup menu item - // TRANSLATORS: get 10 item amount from storage - _("Retrieve 10")); - } - mBrowserBox->addRow("/storagetoinv 'INVINDEX' /", - // TRANSLATORS: popup menu item - // TRANSLATORS: get half item amount from storage - _("Retrieve half")); - mBrowserBox->addRow("/storagetoinv 'INVINDEX' -1", - // TRANSLATORS: popup menu item - // TRANSLATORS: get all except one item amount from storage - _("Retrieve all-1")); - mBrowserBox->addRow("/storagetoinv 'INVINDEX' all", - // TRANSLATORS: popup menu item - // TRANSLATORS: get all item amount from storage - _("Retrieve all")); - mBrowserBox->addSeparator("##3---"); - } - addItemMenu(item, InventoryType::Storage); - break; - case InventoryType::Cart: - addItemMenu(item, InventoryType::Cart); - break; - - case InventoryType::Trade: - case InventoryType::Npc: - case InventoryType::Vending: - case InventoryType::MailEdit: - case InventoryType::MailView: - case InventoryType::Craft: - case InventoryType::TypeEnd: - default: - break; - } - - - addProtection(); - if (config.getBoolValue("enablePickupFilter")) - { - mName = item->getName(); - mExtName = mName; - mBrowserBox->addSeparator("##3---"); - addPickupFilter(mName); - } - addGmCommands(); - // TRANSLATORS: popup menu item - // TRANSLATORS: add item name to chat - mBrowserBox->addRow("/addchat 'ITEMID''CARDS'", _("Add to chat")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showItemPopup(const int x, const int y, - const int itemId, - const ItemColor color) -{ - const Inventory *const inv = PlayerInfo::getInventory(); - if (inv == nullptr) - return; - - Item *const item = inv->findItem(itemId, color); - if (item != nullptr) - { - showItemPopup(x, y, item); - } - else - { - initPopup(); - mItemId = itemId; - mItemIndex = -1; - mItemColor = color; - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = 0; - mX = x; - mY = y; - mBrowserBox->clearRows(); - - if (!PlayerInfo::isItemProtected(mItemId)) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: use item - mBrowserBox->addRow("/use 'ITEMID'", _("Use")); - } - addProtection(); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); - } -} - -void PopupMenu::showItemPopup(const int x, const int y, - const Item *const item) -{ - initPopup(); - mX = x; - mY = y; - if (item != nullptr) - { - mItemId = item->getId(); - mItemColor = item->getColor(); - mItemIndex = item->getInvIndex(); - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = item->getCard(f); - } - else - { - mItemId = 0; - mItemColor = ItemColor_one; - mItemIndex = -1; - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = 0; - } - mName.clear(); - mExtName.clear(); - mBrowserBox->clearRows(); - - if (item != nullptr) - { - const bool isProtected = PlayerInfo::isItemProtected(mItemId); - addUse(item); - addDrop(item, isProtected); - if (InventoryWindow::isStorageActive()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: add item to storage - mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store")); - } - // TRANSLATORS: popup menu item - // TRANSLATORS: add item name to chat - mBrowserBox->addRow("/addchat 'ITEMID''CARDS'", _("Add to chat")); - - if (config.getBoolValue("enablePickupFilter")) - { - mName = item->getName(); - mExtName = mName; - mBrowserBox->addSeparator("##3---"); - addPickupFilter(mName); - } - } - addProtection(); - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showDropPopup(const int x, - const int y, - const Item *const item) -{ - initPopup(); - mX = x; - mY = y; - mName.clear(); - mExtName.clear(); - mBrowserBox->clearRows(); - - if (item != nullptr) - { - mItemId = item->getId(); - mItemColor = item->getColor(); - mItemIndex = item->getInvIndex(); - for (int f = 0; f < maxCards; f ++) - mItemCards[f] = item->getCard(f); - const bool isProtected = PlayerInfo::isItemProtected(mItemId); - addUse(item); - addDrop(item, isProtected); - if (InventoryWindow::isStorageActive()) - { - // TRANSLATORS: popup menu item - // TRANSLATORS: add item to storage - mBrowserBox->addRow("/invtostorage 'INVINDEX'", _("Store")); - } - addProtection(); - // TRANSLATORS: popup menu item - // TRANSLATORS: add item name to chat - mBrowserBox->addRow("/addchat 'ITEMID''CARDS'", _("Add to chat")); - if (config.getBoolValue("enablePickupFilter")) - { - mName = item->getName(); - mExtName = mName; - mBrowserBox->addSeparator("##3---"); - addPickupFilter(mName); - } - } - addGmCommands(); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - mBrowserBox->addRow("/cleardrops", _("Clear drop window")); - mBrowserBox->addSeparator("##3---"); - // TRANSLATORS: popup menu item - // TRANSLATORS: close menu - mBrowserBox->addRow("cancel", _("Cancel")); - - showPopup(x, y); -} - -void PopupMenu::showPopup(const int x, const int y, Button *const button) -{ - if ((button == nullptr) || (windowMenu == nullptr)) - return; - - initPopup(); - mButton = button; - mX = x; - mY = y; - - mBrowserBox->clearRows(); - STD_VECTOR