Mahlzeit,
Ich baue aktuell das ShopEx System bei MartyFiles ein.
Es gibt ein Problem mit Arrays im allgemeinen.
Folgende Ausgabe habe ich in "AddGuest"
CShopEx::AddGuest: vnum 12019
CShopEx::AddGuest: count 1
CShopEx::AddGuest: price 200
CShopEx::AddGuest: price_type 3
CShopEx::AddGuest: price_vnum 50011
CShopEx::AddGuest: aAttr 5214362
CShopEx::AddGuest: alSockets 5214350
CShopEx::AddGuest: vnum 279
CShopEx::AddGuest: count 1
CShopEx::AddGuest: price 25000
CShopEx::AddGuest: price_type 4
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5214495
CShopEx::AddGuest: alSockets 5214483
CShopEx::AddGuest: vnum 0
CShopEx::AddGuest: count 0
CShopEx::AddGuest: price 0
CShopEx::AddGuest: price_type 1
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5214628
CShopEx::AddGuest: alSockets 5214616
CShopEx::AddGuest: vnum 0
CShopEx::AddGuest: count 0
CShopEx::AddGuest: price 0
CShopEx::AddGuest: price_type 1
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5214761
CShopEx::AddGuest: alSockets 5214749
CShopEx::AddGuest: vnum 0
CShopEx::AddGuest: count 0
CShopEx::AddGuest: price 0
CShopEx::AddGuest: price_type 1
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5214894
CShopEx::AddGuest: alSockets 5214882
CShopEx::AddGuest: vnum 0
CShopEx::AddGuest: count 0
CShopEx::AddGuest: price 0
CShopEx::AddGuest: price_type 1
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5215027
CShopEx::AddGuest: alSockets 5215015
CShopEx::AddGuest: vnum 0
CShopEx::AddGuest: count 0
CShopEx::AddGuest: price 0
CShopEx::AddGuest: price_type 1
CShopEx::AddGuest: price_vnum 0
CShopEx::AddGuest: aAttr 5215160
CShopEx::AddGuest: alSockets 5215148
Er haut mir bei den Sockets und Attr immer ne riesige Zahl rein.
Die Funktion zum auslesen der shop_table_ex.txt file heißt "ConvertToShopItemTable"
Um das mit den falschen Werten zu umgehen habe ich extra das dort eingebaut:
- for (int j = 0; j < ITEM_SOCKET_MAX_NUM; j++) {
- snprintf(getval, sizeof(getval), "socket%d", j);
- if (!pItemGroup->GetValue(i, getval, shopItems[i].alSockets[j])) {
- sys_err("row(%d) stage %d of group items of group %s does not have socket column", i, j, pNode->GetNodeName().c_str());
- return false;
- }
- if (shopItems[i].alSockets[j] > 100000)
- shopItems[i].alSockets[j] = 0;
- }
- memset(&getval, 0, sizeof(getval));
- for (int j = 0; j < ITEM_ATTRIBUTE_MAX_NUM; j++) {
- snprintf(getval, sizeof(getval), "attr_type%d", j);
- if (!pItemGroup->GetValue(i, getval, shopItems[i].aAttr[j].bType)) {
- sys_err("row(%d) stage %d of group items of group %s does not have attr_type column", i, j, pNode->GetNodeName().c_str());
- return false;
- }
- if (shopItems[i].aAttr[j].bType > 100000)
- shopItems[i].aAttr[j].bType = 0;
- if (!pItemGroup->GetValue(i, getval, shopItems[i].aAttr[j].sValue)) {
- sys_err("row(%d) stage %d of group items of group %s does not have attr_value column", i, j, pNode->GetNodeName().c_str());
- return false;
- }
- if (shopItems[i].aAttr[j].sValue > 100000)
- shopItems[i].aAttr[j].sValue = 0;
- }
zusätzlich habe ich beim erstellen der Struktur alle Werte extra auf 0 gesetzt:
- typedef struct SShopItemTable
- {
- DWORD vnum=0;
- #ifdef MAX_STACK
- DWORD count=0;
- #else
- BYTE count = 0;
- #endif
- TItemPos pos; // PC
- #ifdef FULL_YANG
- long long price = 0; // PC, shop_table_ex.txt
- #else
- DWORD price = 0; // PC, shop_table_ex.txt
- #endif
- BYTE display_pos = 0; // PC, shop_table_ex.txt
- #ifdef __CHANGE_LOOK_SYSTEM__
- DWORD dwLookVnum = 0;
- #endif
- #ifdef ENABLE_RENEWAL_SHOPEX
- long alSockets[ITEM_SOCKET_MAX_NUM];
- TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
- DWORD price_type = 1;
- DWORD price_vnum = 0;
- SShopItemTable() {
- memset(&alSockets, 0, sizeof(alSockets));
- memset(&aAttr, 0, sizeof(aAttr));
- }
- #endif
- } TShopItemTable;
Trotzdem haut er mit hier in AddGuest die Ausgabe von Oben rein:
- thecore_memcpy(pack_tab.items[i].aAttr, shop_tab.items[i].aAttr, sizeof(pack_tab.items[i].aAttr));
- thecore_memcpy(pack_tab.items[i].alSockets, shop_tab.items[i].alSockets, sizeof(pack_tab.items[i].alSockets));
- sys_err("aAttr %d", pack_tab.items[i].aAttr);
- sys_err("alSockets %d", pack_tab.items[i].alSockets);
Das kommt auch, wenn ich in AddGuest
mache.
Kennt sich jmd damit aus ?
Danke =)
wenn ich es ohne changes einbaue kommt das:
Bitte melden Sie sich an, um diesen Link zu sehen.
Lösung:
char temp[16384] = { 0 };
in shopEx.cpp->CShopEx::AddGuest()