diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-21 12:52:08 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-21 12:52:08 +0000 |
commit | 8eb8602942d63661674d237d127c5f3ccfcf4ef4 (patch) | |
tree | 0d1e902e16c55f7742ead9a4c9f53506c373df48 | |
parent | d70c0ba4264dee317d1a60f2fa4d81f123dde016 (diff) | |
download | mana-8eb8602942d63661674d237d127c5f3ccfcf4ef4.tar.gz mana-8eb8602942d63661674d237d127c5f3ccfcf4ef4.tar.bz2 mana-8eb8602942d63661674d237d127c5f3ccfcf4ef4.tar.xz mana-8eb8602942d63661674d237d127c5f3ccfcf4ef4.zip |
Now shops get item names from the xml database
-rw-r--r-- | The Mana World.dev | 244 | ||||
-rw-r--r-- | file.list | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/gui/buy.cpp | 7 | ||||
-rw-r--r-- | src/gui/sell.cpp | 7 | ||||
-rw-r--r-- | src/gui/shop.cpp | 119 | ||||
-rw-r--r-- | src/gui/shop.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/main.h | 3 | ||||
-rw-r--r-- | src/resources/itemmanager.cpp | 40 | ||||
-rw-r--r-- | src/resources/itemmanager.h | 1 |
11 files changed, 159 insertions, 267 deletions
diff --git a/The Mana World.dev b/The Mana World.dev index e1b47745..9b5e15ff 100644 --- a/The Mana World.dev +++ b/The Mana World.dev @@ -1,7 +1,7 @@ [Project] FileName=The Mana World.dev Name=tmw -UnitCount=123 +UnitCount=122 Type=0 Ver=1 ObjFiles= @@ -137,18 +137,8 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= -[Unit24] -FileName=src\gui\shop.cpp -CompileCpp=1 -Folder=gui -Compile=1 -Link=1 -Priority=1000 -OverrideBuildCmd=0 -BuildCmd= - [Unit25] -FileName=src\gui\shop.h +FileName=src\gui\skill.cpp CompileCpp=1 Folder=gui Compile=1 @@ -158,9 +148,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit28] -FileName=src\gui\stats.cpp +FileName=src\net\win2linux.h CompileCpp=1 -Folder=gui +Folder=net Compile=1 Link=1 Priority=1000 @@ -168,7 +158,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit29] -FileName=src\net\win2linux.h +FileName=src\net\network.cpp CompileCpp=1 Folder=net Compile=1 @@ -178,7 +168,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit30] -FileName=src\net\network.cpp +FileName=src\net\network.h CompileCpp=1 Folder=net Compile=1 @@ -188,7 +178,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit31] -FileName=src\net\network.h +FileName=src\net\protocol.cpp CompileCpp=1 Folder=net Compile=1 @@ -198,7 +188,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit32] -FileName=src\net\protocol.cpp +FileName=src\net\protocol.h CompileCpp=1 Folder=net Compile=1 @@ -208,9 +198,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit33] -FileName=src\net\protocol.h +FileName=src\sound.h CompileCpp=1 -Folder=net +Folder= Compile=1 Link=1 Priority=1000 @@ -218,7 +208,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit34] -FileName=src\sound.h +FileName=src\sound.cpp CompileCpp=1 Folder= Compile=1 @@ -228,9 +218,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit35] -FileName=src\sound.cpp +FileName=src\gui\npc.h CompileCpp=1 -Folder= +Folder=gui Compile=1 Link=1 Priority=1000 @@ -238,7 +228,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit36] -FileName=src\gui\npc.h +FileName=src\gui\npc.cpp CompileCpp=1 Folder=gui Compile=1 @@ -308,7 +298,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit27] -FileName=src\gui\skill.h +FileName=src\gui\stats.cpp CompileCpp=1 Folder=gui Compile=1 @@ -318,7 +308,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit38] -FileName=src\gui\setup.h +FileName=src\gui\setup.cpp CompileCpp=1 Folder=gui Compile=1 @@ -328,7 +318,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit39] -FileName=src\gui\setup.cpp +FileName=src\gui\checkbox.h CompileCpp=1 Folder=gui Compile=1 @@ -338,7 +328,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit37] -FileName=src\gui\npc.cpp +FileName=src\gui\setup.h CompileCpp=1 Folder=gui Compile=1 @@ -418,7 +408,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit26] -FileName=src\gui\skill.cpp +FileName=src\gui\skill.h CompileCpp=1 Folder=gui Compile=1 @@ -428,7 +418,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit43] -FileName=src\gui\checkbox.cpp +FileName=src\gui\window.cpp CompileCpp=1 Folder=gui Compile=1 @@ -438,7 +428,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit44] -FileName=src\gui\window.cpp +FileName=src\gui\window.h CompileCpp=1 Folder=gui Compile=1 @@ -448,7 +438,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit46] -FileName=src\gui\progressbar.cpp +FileName=src\gui\progressbar.h CompileCpp=1 Folder=gui Compile=1 @@ -458,7 +448,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit47] -FileName=src\gui\progressbar.h +FileName=src\gui\textfield.cpp CompileCpp=1 Folder=gui Compile=1 @@ -468,7 +458,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit48] -FileName=src\gui\textfield.cpp +FileName=src\gui\textfield.h CompileCpp=1 Folder=gui Compile=1 @@ -478,7 +468,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit45] -FileName=src\gui\window.h +FileName=src\gui\progressbar.cpp CompileCpp=1 Folder=gui Compile=1 @@ -488,7 +478,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit49] -FileName=src\gui\textfield.h +FileName=src\gui\passwordfield.cpp CompileCpp=1 Folder=gui Compile=1 @@ -498,7 +488,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit50] -FileName=src\gui\passwordfield.cpp +FileName=src\gui\passwordfield.h CompileCpp=1 Folder=gui Compile=1 @@ -508,9 +498,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit51] -FileName=src\gui\passwordfield.h +FileName=src\configuration.cpp CompileCpp=1 -Folder=gui +Folder= Compile=1 Link=1 Priority=1000 @@ -518,7 +508,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit52] -FileName=src\configuration.cpp +FileName=src\configuration.h CompileCpp=1 Folder= Compile=1 @@ -528,9 +518,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit53] -FileName=src\configuration.h +FileName=src\gui\buy.cpp CompileCpp=1 -Folder= +Folder=gui Compile=1 Link=1 Priority=1000 @@ -538,7 +528,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit54] -FileName=src\gui\buy.cpp +FileName=src\gui\buy.h CompileCpp=1 Folder=gui Compile=1 @@ -548,7 +538,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit55] -FileName=src\gui\buy.h +FileName=src\gui\slider.h CompileCpp=1 Folder=gui Compile=1 @@ -558,7 +548,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit56] -FileName=src\gui\slider.h +FileName=src\gui\slider.cpp CompileCpp=1 Folder=gui Compile=1 @@ -568,7 +558,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit58] -FileName=src\gui\ok_dialog.h +FileName=src\gui\ok_dialog.cpp CompileCpp=1 Folder=gui Compile=1 @@ -578,7 +568,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit59] -FileName=src\gui\ok_dialog.cpp +FileName=src\gui\status.cpp CompileCpp=1 Folder=gui Compile=1 @@ -588,7 +578,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit60] -FileName=src\gui\status.cpp +FileName=src\gui\status.h CompileCpp=1 Folder=gui Compile=1 @@ -598,7 +588,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit61] -FileName=src\gui\status.h +FileName=src\gui\buysell.cpp CompileCpp=1 Folder=gui Compile=1 @@ -608,7 +598,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit62] -FileName=src\gui\buysell.cpp +FileName=src\gui\buysell.h CompileCpp=1 Folder=gui Compile=1 @@ -618,7 +608,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit63] -FileName=src\gui\buysell.h +FileName=src\gui\radiobutton.h CompileCpp=1 Folder=gui Compile=1 @@ -628,7 +618,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit65] -FileName=src\gui\scrollarea.cpp +FileName=src\gui\scrollarea.h CompileCpp=1 Folder=gui Compile=1 @@ -638,7 +628,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit66] -FileName=src\gui\scrollarea.h +FileName=src\gui\radiobutton.cpp CompileCpp=1 Folder=gui Compile=1 @@ -648,7 +638,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit64] -FileName=src\gui\radiobutton.h +FileName=src\gui\scrollarea.cpp CompileCpp=1 Folder=gui Compile=1 @@ -658,7 +648,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit67] -FileName=src\gui\radiobutton.cpp +FileName=src\gui\sell.h CompileCpp=1 Folder=gui Compile=1 @@ -668,7 +658,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit68] -FileName=src\gui\sell.h +FileName=src\gui\sell.cpp Folder=gui Compile=1 Link=1 @@ -678,7 +668,7 @@ BuildCmd= CompileCpp=1 [Unit69] -FileName=src\gui\sell.cpp +FileName=src\gui\npc_text.cpp CompileCpp=1 Folder=gui Compile=1 @@ -688,7 +678,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit70] -FileName=src\gui\npc_text.cpp +FileName=src\gui\npc_text.h CompileCpp=1 Folder=gui Compile=1 @@ -698,7 +688,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit71] -FileName=src\gui\npc_text.h +FileName=src\gui\listbox.h CompileCpp=1 Folder=gui Compile=1 @@ -708,7 +698,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit72] -FileName=src\gui\listbox.h +FileName=src\gui\listbox.cpp CompileCpp=1 Folder=gui Compile=1 @@ -718,7 +708,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit73] -FileName=src\gui\listbox.cpp +FileName=src\gui\textbox.cpp CompileCpp=1 Folder=gui Compile=1 @@ -728,7 +718,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit74] -FileName=src\gui\textbox.cpp +FileName=src\gui\textbox.h CompileCpp=1 Folder=gui Compile=1 @@ -738,7 +728,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit75] -FileName=src\gui\textbox.h +FileName=src\gui\windowcontainer.h CompileCpp=1 Folder=gui Compile=1 @@ -748,7 +738,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit76] -FileName=src\gui\windowcontainer.h +FileName=src\gui\windowcontainer.cpp CompileCpp=1 Folder=gui Compile=1 @@ -758,7 +748,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit40] -FileName=src\gui\checkbox.h +FileName=src\gui\button.cpp CompileCpp=1 Folder=gui Compile=1 @@ -768,7 +758,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit41] -FileName=src\gui\button.cpp +FileName=src\gui\button.h CompileCpp=1 Folder=gui Compile=1 @@ -778,7 +768,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit77] -FileName=src\gui\windowcontainer.cpp +FileName=src\gui\playerbox.h CompileCpp=1 Folder=gui Compile=1 @@ -788,7 +778,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit78] -FileName=src\gui\playerbox.h +FileName=src\gui\playerbox.cpp CompileCpp=1 Folder=gui Compile=1 @@ -798,7 +788,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit79] -FileName=src\gui\playerbox.cpp +FileName=src\gui\confirm_dialog.cpp CompileCpp=1 Folder=gui Compile=1 @@ -808,7 +798,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit80] -FileName=src\gui\confirm_dialog.cpp +FileName=src\gui\confirm_dialog.h CompileCpp=1 Folder=gui Compile=1 @@ -818,9 +808,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit81] -FileName=src\gui\confirm_dialog.h +FileName=src\resources\image.cpp CompileCpp=1 -Folder=gui +Folder=resources Compile=1 Link=1 Priority=1000 @@ -828,7 +818,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit82] -FileName=src\resources\image.cpp +FileName=src\resources\image.h CompileCpp=1 Folder=resources Compile=1 @@ -838,7 +828,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit84] -FileName=src\resources\resource.cpp +FileName=src\resources\resource.h CompileCpp=1 Folder=resources Compile=1 @@ -848,7 +838,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit83] -FileName=src\resources\image.h +FileName=src\resources\resource.cpp CompileCpp=1 Folder=resources Compile=1 @@ -858,7 +848,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit85] -FileName=src\resources\resource.h +FileName=src\resources\resourcemanager.cpp CompileCpp=1 Folder=resources Compile=1 @@ -868,7 +858,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit86] -FileName=src\resources\resourcemanager.cpp +FileName=src\resources\resourcemanager.h CompileCpp=1 Folder=resources Compile=1 @@ -878,9 +868,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit87] -FileName=src\resources\resourcemanager.h +FileName=src\graphic\spriteset.cpp CompileCpp=1 -Folder=resources +Folder=graphic Compile=1 Link=1 Priority=1000 @@ -888,7 +878,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit88] -FileName=src\graphic\spriteset.cpp +FileName=src\graphic\spriteset.h CompileCpp=1 Folder=graphic Compile=1 @@ -898,9 +888,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit89] -FileName=src\graphic\spriteset.h +FileName=src\gui\itemcontainer.h CompileCpp=1 -Folder=graphic +Folder=gui Compile=1 Link=1 Priority=1000 @@ -908,7 +898,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit90] -FileName=src\gui\itemcontainer.h +FileName=src\gui\itemcontainer.cpp CompileCpp=1 Folder=gui Compile=1 @@ -918,7 +908,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit91] -FileName=src\gui\itemcontainer.cpp +FileName=src\gui\minimap.h CompileCpp=1 Folder=gui Compile=1 @@ -928,7 +918,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit92] -FileName=src\gui\minimap.h +FileName=src\gui\minimap.cpp CompileCpp=1 Folder=gui Compile=1 @@ -938,7 +928,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit93] -FileName=src\gui\minimap.cpp +FileName=src\gui\equipment.h CompileCpp=1 Folder=gui Compile=1 @@ -948,7 +938,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit94] -FileName=src\gui\equipment.h +FileName=src\gui\equipment.cpp CompileCpp=1 Folder=gui Compile=1 @@ -958,9 +948,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit95] -FileName=src\gui\equipment.cpp +FileName=src\resources\mapreader.cpp CompileCpp=1 -Folder=gui +Folder=resources Compile=1 Link=1 Priority=1000 @@ -968,7 +958,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit96] -FileName=src\resources\mapreader.cpp +FileName=src\resources\mapreader.h CompileCpp=1 Folder=resources Compile=1 @@ -978,7 +968,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit42] -FileName=src\gui\button.h +FileName=src\gui\checkbox.cpp CompileCpp=1 Folder=gui Compile=1 @@ -988,7 +978,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit57] -FileName=src\gui\slider.cpp +FileName=src\gui\ok_dialog.h CompileCpp=1 Folder=gui Compile=1 @@ -998,9 +988,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit97] -FileName=src\resources\mapreader.h +FileName=src\gui\newskill.h CompileCpp=1 -Folder=resources +Folder=gui Compile=1 Link=1 Priority=1000 @@ -1008,7 +998,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit98] -FileName=src\gui\newskill.h +FileName=src\gui\newskill.cpp CompileCpp=1 Folder=gui Compile=1 @@ -1018,7 +1008,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit99] -FileName=src\gui\newskill.cpp +FileName=src\gui\chargedialog.h CompileCpp=1 Folder=gui Compile=1 @@ -1028,7 +1018,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit100] -FileName=src\gui\chargedialog.h +FileName=src\gui\chargedialog.cpp CompileCpp=1 Folder=gui Compile=1 @@ -1038,9 +1028,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit101] -FileName=src\gui\chargedialog.cpp +FileName=src\graphics.h CompileCpp=1 -Folder=gui +Folder=tmw Compile=1 Link=1 Priority=1000 @@ -1048,7 +1038,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit102] -FileName=src\graphics.h +FileName=src\base64.cpp CompileCpp=1 Folder=tmw Compile=1 @@ -1058,7 +1048,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit103] -FileName=src\base64.cpp +FileName=src\base64.h CompileCpp=1 Folder=tmw Compile=1 @@ -1068,7 +1058,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit104] -FileName=src\base64.h +FileName=src\engine.cpp CompileCpp=1 Folder=tmw Compile=1 @@ -1078,7 +1068,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit105] -FileName=src\engine.cpp +FileName=src\engine.h CompileCpp=1 Folder=tmw Compile=1 @@ -1088,7 +1078,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit106] -FileName=src\engine.h +FileName=src\floor_item.cpp CompileCpp=1 Folder=tmw Compile=1 @@ -1098,7 +1088,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit107] -FileName=src\floor_item.cpp +FileName=src\floor_item.h CompileCpp=1 Folder=tmw Compile=1 @@ -1108,7 +1098,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit108] -FileName=src\floor_item.h +FileName=src\graphics.cpp CompileCpp=1 Folder=tmw Compile=1 @@ -1118,9 +1108,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit109] -FileName=src\graphics.cpp +FileName=src\gui\item_amount.cpp CompileCpp=1 -Folder=tmw +Folder=gui Compile=1 Link=1 Priority=1000 @@ -1148,7 +1138,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit110] -FileName=src\gui\item_amount.cpp +FileName=src\gui\item_amount.h CompileCpp=1 Folder=gui Compile=1 @@ -1158,7 +1148,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit111] -FileName=src\gui\item_amount.h +FileName=src\gui\trade.cpp CompileCpp=1 Folder=gui Compile=1 @@ -1168,7 +1158,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit112] -FileName=src\gui\trade.cpp +FileName=src\gui\trade.h CompileCpp=1 Folder=gui Compile=1 @@ -1178,7 +1168,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit113] -FileName=src\gui\trade.h +FileName=src\gui\requesttrade.h CompileCpp=1 Folder=gui Link=1 @@ -1188,7 +1178,7 @@ BuildCmd= Compile=1 [Unit114] -FileName=src\gui\requesttrade.h +FileName=src\gui\requesttrade.cpp CompileCpp=1 Folder=gui Compile=1 @@ -1198,9 +1188,9 @@ OverrideBuildCmd=0 BuildCmd= [Unit115] -FileName=src\gui\requesttrade.cpp +FileName=src\resources\music.h CompileCpp=1 -Folder=gui +Folder=resources Compile=1 Link=1 Priority=1000 @@ -1208,7 +1198,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit116] -FileName=src\resources\music.h +FileName=src\resources\music.cpp CompileCpp=1 Folder=resources Compile=1 @@ -1218,7 +1208,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit117] -FileName=src\resources\music.cpp +FileName=src\resources\soundeffect.cpp CompileCpp=1 Folder=resources Compile=1 @@ -1228,7 +1218,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit118] -FileName=src\resources\soundeffect.cpp +FileName=src\resources\soundeffect.h CompileCpp=1 Folder=resources Compile=1 @@ -1238,7 +1228,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit119] -FileName=src\resources\soundeffect.h +FileName=src\resources\iteminfo.cpp CompileCpp=1 Folder=resources Compile=1 @@ -1248,7 +1238,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit120] -FileName=src\resources\iteminfo.cpp +FileName=src\resources\iteminfo.h CompileCpp=1 Folder=resources Compile=1 @@ -1258,7 +1248,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit121] -FileName=src\resources\iteminfo.h +FileName=src\resources\itemmanager.cpp CompileCpp=1 Folder=resources Compile=1 @@ -1268,7 +1258,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit122] -FileName=src\resources\itemmanager.cpp +FileName=src\resources\itemmanager.h CompileCpp=1 Folder=resources Compile=1 @@ -1287,3 +1277,13 @@ Priority=1000 OverrideBuildCmd=0 BuildCmd= +[Unit24] +FileName=src\gui\shop.h +CompileCpp=1 +Folder=gui +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + @@ -29,7 +29,6 @@ MODULES = src/sound.cpp \ src/gui/scrollarea.cpp \ src/gui/sell.cpp \ src/gui/setup.cpp \ - src/gui/shop.cpp \ src/gui/skill.cpp \ src/gui/slider.cpp \ src/gui/stats.cpp \ diff --git a/src/Makefile.am b/src/Makefile.am index 7b2da568..69a24f1c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,6 @@ tmw_SOURCES = graphic/spriteset.cpp \ gui/sell.h \ gui/setup.cpp \ gui/setup.h \ - gui/shop.cpp \ gui/shop.h \ gui/skill.cpp \ gui/skill.h \ diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 2da38c36..c26be5d3 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -102,12 +102,7 @@ void BuyDialog::addItem(short id, int price) { ITEM_SHOP item_shop; - if (id >= 501 && id <= 2301) { - sprintf(item_shop.name, "%s %i gp", item_db[id - 501], price); - } - else { - sprintf(item_shop.name, "Unknown item %i gp", price); - } + sprintf(item_shop.name, "%s %i gp", itemDb.getName(id).c_str(), price); item_shop.price = price; item_shop.id = id; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index d4bd1d8a..2c9e8745 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -93,12 +93,7 @@ void SellDialog::addItem(short index, int price) int id = inventoryWindow->items->getId(index); ITEM_SHOP item_shop; - if (id >= 501 && id <= 2301) { - sprintf(item_shop.name, "%s %i gp", item_db[id - 501], price); - } - else { - sprintf(item_shop.name, "Unknown item %i gp", price); - } + sprintf(item_shop.name, "%s %i gp", itemDb.getName(id).c_str(), price); item_shop.price = price; item_shop.index = index; item_shop.id = id; diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 09d99669..1dd498a8 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -23,122 +23,3 @@ #include "shop.h" -// TODO: replace it with item database - -char *item_db[] = { - "Cactus Drink", - "Cactus potion", - "Casino coins", - "Decor Candy", - "Maggot Slime", - "Candy Cane", - "Scorpion Stinger", - "Xmas Cake", - "Chocolate", - "Candy", - "Santa Hat", - "Ginger bread man", - "Slice of cake", - "Xmas candy cane", - "Purple present", - "Yellow present", - "Red scorpion stinger", - "Bug leg", - "Cherry cake", - "Easter Egg", - "Dagger", - "Sharp knife", - "Leather shirt", - "Fancy hat","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 601 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 701 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 801 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 901 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 1001 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - - // 1101 - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","Arrow","Bow", - - // 1201 - "Knife","Cotton Shirt","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", - "","","","","","","","","","", -}; diff --git a/src/gui/shop.h b/src/gui/shop.h index 635075a1..c3d85780 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -35,6 +35,4 @@ struct ITEM_SHOP { int quantity; }; -extern char *item_db[]; - #endif diff --git a/src/main.cpp b/src/main.cpp index f7340ff2..5c62700f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,6 @@ #include "sound.h" #include "graphics.h" #include "resources/resourcemanager.h" -#include "resources/itemmanager.h" #include "net/protocol.h" #include <iostream> @@ -29,6 +29,7 @@ #include "gui/skill.h" #include "graphic/spriteset.h" #include "resources/image.h" +#include "resources/itemmanager.h" #include "configuration.h" #include "game.h" #include "log.h" @@ -104,5 +105,5 @@ extern Map *tiledMap; extern Logger logger; extern int screenW, screenH, bitDepth, displayFlags; extern bool useOpenGL; - +extern ItemManager itemDb; #endif diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp index 5ad4e66d..4bb6555b 100644 --- a/src/resources/itemmanager.cpp +++ b/src/resources/itemmanager.cpp @@ -36,7 +36,8 @@ #define xmlFree(x) ; #endif -ItemManager::ItemManager() +ItemManager::ItemManager() : + minId(10000), maxId(0) { // Check that file exists before trying to parse it std::fstream dbFile; @@ -62,6 +63,8 @@ ItemManager::ItemManager() xmlChar *prop; prop = xmlGetProp(node, BAD_CAST "id"); int id = atoi((const char*)prop); + if (id < minId) minId = id; + if (id > maxId) maxId = id; xmlFree(prop); prop = xmlGetProp(node, BAD_CAST "image"); int image = atoi((const char*)prop); @@ -115,35 +118,56 @@ ItemManager::~ItemManager() short ItemManager::getImage(int id) { - return db[id]->getImage(); + if (id >= minId && id <= maxId) + return db[id]->getImage(); + else + return 0; } short ItemManager::getArt(int id) { - return db[id]->getArt(); + if (id >= minId && id <= maxId) + return db[id]->getArt(); + else + return 0; } std::string ItemManager::getName(int id) { - return db[id]->getName(); + if (id >= minId && id <= maxId) + return db[id]->getName(); + else + return "Unknown"; } std::string ItemManager::getDescription(int id) { - return db[id]->getDescription(); + if (id >= minId && id <= maxId) + return db[id]->getDescription(); + else + return ""; } short ItemManager::getType(int id) { - return db[id]->getType(); + if (id >= minId && id <= maxId) + return db[id]->getType(); + else + return 0; } short ItemManager::getWeight(int id) { - return db[id]->getWeight(); + if (id >= minId && id <= maxId) + return db[id]->getWeight(); + else + return 0; } char ItemManager::getSlot(int id) { - return db[id]->getSlot(); + if (id >= minId && id <= maxId) + return db[id]->getSlot(); + else + return 0; } diff --git a/src/resources/itemmanager.h b/src/resources/itemmanager.h index 0db5893f..3f014ad6 100644 --- a/src/resources/itemmanager.h +++ b/src/resources/itemmanager.h @@ -63,6 +63,7 @@ class ItemManager protected: // Items database std::map <int, ItemInfo *> db; + int minId, maxId; }; |