]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Clyne is gay
authordrumsetmonkey <abelleisle@roadrunner.com>
Wed, 2 Mar 2016 15:11:54 +0000 (10:11 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Wed, 2 Mar 2016 15:11:54 +0000 (10:11 -0500)
include/entities.h
src/world.cpp
xml/playerSpawnHill1.xml

index 545f0a4dfc8cb5e52dc2d33a9b677bacd51fe5f1..a1723ee629606792430b5c58c9b466c0da62cbca 100644 (file)
@@ -55,19 +55,35 @@ enum BUILD_SUB{
 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;
index 80ddc5a27a0ae8484173ab8aa2036cc45b685cc7..32a3153a58c3adbe6e633a0ddb7df9fa25931262 100644 (file)
@@ -1446,6 +1446,7 @@ World *loadWorldFromXMLNoSave(const char *path){
        while(vil){
                name = vil->Name();
                randx = 0;
+               //static BuySell bs;
 
                /**
                 *      READS DATA ABOUT STRUCTURE CONTAINED IN VILLAGE
@@ -1469,10 +1470,17 @@ World *loadWorldFromXMLNoSave(const char *path){
                                                           (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");
 
index 2cac7430ea1d4921aac80dc745b9a2530f62deef..370cc03dd0df997956a18f4b388bb6aaa89e62ab 100644 (file)
@@ -17,8 +17,6 @@
                <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>