class BuySell{
public:
int member;
+ // 0 = Buy/Sell
+ // 1 = Trade
union{
struct{
- std::string item1;
- std::string item2;
+ std::string item;
+ std::string itemt;
}trade;
struct{
- enum type{BUY,SELL};
+ int type;
+ // 0 = buy
+ // 1 = sell
std::string item;
int price;
}cost;
};
- BuySell(){}
+ BuySell(int typ, std::string itm, int prc){
+ this->cost.type = typ;
+ this->cost.item = itm;
+ this->cost.price = prc;
+ this->member = 0;
+ }
+ BuySell(std::string itm, std::string itmt){
+ this->trade.item = itm;
+ this->trade.itemt = itmt;
+ this->member = 1;
+ }
~BuySell(){}
+ BuySell(const BuySell&){}
+ BuySell(){}
};
class World;
while(vil){
name = vil->Name();
randx = 0;
+ //static BuySell bs;
/**
* READS DATA ABOUT STRUCTURE CONTAINED IN VILLAGE
(char*)vil->Attribute("texture"),
ptr);
tmp->addMerchant(0,100);
- if(!strcmp(name,"buy")){
- std::cout << "Buying";
- }else if(!strcmp(name,"sell")){
- std::cout << "Selling";
+ if(vil->FirstChildElement("buy")){
+ std::cout << "Buy" << std::endl;
+ /*bs.member = 0;
+ bs.cost.type = 0;
+ bs.cost.item = vil->FirstChildElement("buy")->Attribute("item");
+ bs.cost.price =vil->FirstChildElement("buy")->IntAttribute("cost");*/
+ tmp->merchant.back()->bsinv.push_back({0,"Dank MayMay",420});
+ }if(vil->FirstChildElement("sell")){
+ std::cout << "Sell" << std::endl;
+ }if(vil->FirstChildElement("trade")){
+ std::cout << "Trade" << std::endl;
}
strcpy(tmp->merchant.back()->name,"meme");
<stall type="market" texture="assets/style/classic/stall.png">
<buy item="Dank MayMay" cost="420"/>
<sell item="Dank MayMay" cost="666"/>
- </stall>
- <stall type="trader" texture="assets/style/classic/stall.png">
<trade item="Dank MayMay" item1="Sword"/>
</stall>
</village>