diff options
author | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 15:50:55 +0000 |
---|---|---|
committer | Simon Edwardsson <simon@crossnet.se> | 2004-10-02 15:50:55 +0000 |
commit | 91fbf564fe4a28a93122d6a8a6a1df9d119dce91 (patch) | |
tree | e1c8025714fb70c40f4e2e63117e1a86246f8b17 | |
parent | 572f377ea2eca51469e06109503e9f4bcb198166 (diff) | |
download | mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.gz mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.bz2 mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.tar.xz mana-client-91fbf564fe4a28a93122d6a8a6a1df9d119dce91.zip |
Sell in shops does now works, and you can choose amount :) (hope I don't break anything)
-rw-r--r-- | makefile.macosx | 33 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 21 | ||||
-rw-r--r-- | src/gui/inventory.h | 1 | ||||
-rw-r--r-- | src/gui/shop.cpp | 28 | ||||
-rw-r--r-- | src/gui/shop.h | 10 | ||||
-rw-r--r-- | tmw.ini | 4 |
6 files changed, 60 insertions, 37 deletions
diff --git a/makefile.macosx b/makefile.macosx index 6a374c7f..c6f41c2a 100644 --- a/makefile.macosx +++ b/makefile.macosx @@ -19,32 +19,11 @@ tmw: $(OBJS) @echo - @echo "TYPE ./tmw TO LAUCH THE GAME" -tmw-app: $(OBJS) - $(CXX) -o tmw-app $(OBJS) $(CFLAGS) -DMACOSX_APP - -app: tmw-app - rm -rf tmw.app - mkdir tmw.app - mkdir tmw.app/Contents - mkdir tmw.app/Contents/Resources - mkdir tmw.app/Contents/MacOS - cp tmw-app tmw.app/Contents/MacOS/ - cp *.dat tmw.app/Contents/Resources/ - cp -R Sound tmw.app/Contents/Resources/ - cp -R items tmw.app/Contents/Resources/ - cp -R Graphic tmw.app/Contents/Resources/ - cp -R Aqua tmw.app/Contents/Resources/ - cp -R Maps tmw.app/Contents/Resources/ - cp aqua.skin tmw.app/Contents/Resources/ - cp tmw.ini tmw.app/Contents/Resources/ - mv tmw.app tmw.app2 - mv tmw.app2 tmw.app - clean: - - rm -fv *.o - - rm -fv Net/*.o - - rm -fv Gui/*.o - - rm -fv Sound/*.o - - rm -fv Graphic/*.o + - rm -fv src/*.o + - rm -fv src/Net/*.o + - rm -fv src/Gui/*.o + - rm -fv src/Sound/*.o + - rm -fv src/Graphic/*.o - rm -fv tmw - - rm -rf tmw.app + diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 1640d7af..027723cf 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -43,6 +43,8 @@ BITMAP *buffer, *double_buffer, *chat_background; DATAFILE *tileset; +//extern char* itemCurrenyQ; +char itemCurrenyQ[10] = "0"; char page_num; int map_x, map_y, camera_x, camera_y; DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player; @@ -82,13 +84,15 @@ DIALOG buy_dialog[] = { DIALOG sell_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ - { tmw_dialog_proc, 300, 200, 260, 150, 0, 0, 0, 0, 0, 0, (char *)"Sell", NULL, NULL }, - { tmw_button_proc, 450, 326, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL }, - { tmw_button_proc, 508, 326, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL }, + { tmw_dialog_proc, 300, 200, 260, 175, 0, 0, 0, 0, 0, 0, (char *)"Sell", NULL, NULL }, + { tmw_button_proc, 450, 326+25, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL }, + { tmw_button_proc, 508, 326+25, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL }, + { tmw_slider_proc, 304, 326, 200, 20, 255, 0, 0, 0, 10, 0, NULL, (void *)changeQ, NULL }, { tmw_list_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, (char *)shop_list, NULL, NULL }, + { tmw_text_proc, 514, 326, 40, 100, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; - + DIALOG chat_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { tmw_edit_proc, 0, 574, 592, 25, 0, 0, 'c', 0, 90, 0, speech, NULL, NULL }, @@ -166,7 +170,8 @@ void do_graphic(void) { int offset_y = map_y & 15; sort(); - + + for(int j=0;j<20;j++) for(int i=0;i<26;i++) { if( /* get_tile(i+camera_x, j+camera_y, 0) >= 0 && */ get_tile(i+camera_x, j+camera_y, 0) < 600) @@ -308,13 +313,15 @@ void do_graphic(void) { break; case 4: dialog_message(sell_dialog, MSG_DRAW, 0, 0); + sell_dialog[3].d1 = get_item_quantity(sell_dialog[4].d1); if(!gui_update(sell_player)) { show_npc_dialog = shutdown_dialog(sell_player); + if(show_npc_dialog==1) { WFIFOW(0) = net_w_value(0x00c9); WFIFOW(2) = net_w_value(8); - WFIFOW(4) = net_w_value(1); - WFIFOW(6) = net_w_value(get_item_id(sell_dialog[3].d1)); + WFIFOW(4) = net_w_value(get_item_index(sell_dialog[4].d1)); + WFIFOW(6) = net_w_value(sell_dialog[3].d2); WFIFOSET(8); } show_npc_dialog = 0; diff --git a/src/gui/inventory.h b/src/gui/inventory.h index ee16d56b..0a8fd600 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -60,6 +60,7 @@ class TmwInventory { int change_quantity(int index, int quantity); // change number of a item int increase_quantity(int index, int quantity); // increase quantity of a item int use_item(int index, int id); + int quantityForIndex(int index) { return items[index].quantity; } //END API itemHolder items[INVENTORY_SIZE]; // this is the holder of items diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3065f8ea..487465b6 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -26,6 +26,7 @@ #include "shop.h" int n_items; +char* selectedItem = "You got 4"; ITEM_SHOP *shop = NULL; char *item_db[] = { @@ -75,7 +76,9 @@ void add_sell_item(short index, int price) { else sprintf(item_shop->name, "Unknown item %i gp", price); item_shop->price = price; + item_shop->index = index; item_shop->id = id; + item_shop->quantity = inventory.items[index].quantity; item_shop->next = NULL; if(shop==NULL) shop = item_shop; @@ -107,3 +110,28 @@ short get_item_id(int index) { } return item_shop->id; } + +int get_item_quantity(int index) { + int iterator = 0; + ITEM_SHOP *item_shop = shop; + while(iterator<index) { + item_shop = item_shop->next; + iterator++; + } + return item_shop->quantity; +} +int get_item_index(int index) { + int iterator = 0; + ITEM_SHOP *item_shop = shop; + while(iterator<index) { + item_shop = item_shop->next; + iterator++; + } + return item_shop->index; +} + +void changeQ(void *dp3, int d2) +{ +sprintf(itemCurrenyQ,"%i",d2); +printf("%s\n",itemCurrenyQ); +}
\ No newline at end of file diff --git a/src/gui/shop.h b/src/gui/shop.h index 5aa8548a..8c3869d0 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -30,20 +30,28 @@ #include <stdio.h> #include "../graphic/graphic.h" +#include "inventory.h" + struct ITEM_SHOP { char name[30]; int price; short id; + int index; + int quantity; ITEM_SHOP *next; }; extern int n_items; +extern char* selectedItem; +extern char itemCurrenyQ[10]; char *shop_list(int index, int *list_size); void add_buy_item(short id, int price); void add_sell_item(short index, int price); +void changeQ(void *dp3, int d2); void close_shop(); short get_item_id(int index); - +int get_item_quantity(int index); +int get_item_index(int index); #endif @@ -18,7 +18,7 @@ screen = 2 ; = Sound: ; = 1 enabled ; = 0 disabled -sound = 1 +sound = 0 ; = Chat logfile location: chatlog = chatlog.txt ; = Display strecth mode: @@ -29,4 +29,4 @@ stretch = 1 [login] remember = 1 -username = elven +username = test2 |