Files
Sun1602/Server/ShopServer/CashShopHeader.cpp
T
2022-10-26 12:25:11 +08:00

100 lines
3.5 KiB
C++

#include "StdAfx.h"
#include "CashShopHeader.h"
#include <SLM/ShopList.h>
#include <SLM/ListManager.h>
#include "ProductInfo.h"
#include "ProductItem.h"
#include "CashShop.h"
namespace ConvenienceStore
{
Define::ShopProductType GetProductType(IN CShopProduct* const shop_product)
{
if (shop_product->ProductType == Define::kProductType[Define::kShopProduct_Waste]) return Define::kShopProduct_Waste;
if (shop_product->ProductType == Define::kProductType[Define::kShopProduct_Infinite]) return Define::kShopProduct_Infinite;
if (shop_product->ProductType == Define::kProductType[Define::kShopProduct_Date]) return Define::kShopProduct_Date;
return Define::kShopProduct_Size;
}
//------------------------------------------------------------------------------
CShopCategoryList* category_list()
{
if( CShopListManager* shop_list_manager = CashShop::instance()->GetShopListManager() )
{
return shop_list_manager->GetListPtr()->GetCategoryListPtr();
}
return NULL;
}
//------------------------------------------------------------------------------
CShopPackageList* package_list()
{
if( CShopListManager* shop_list_manager = CashShop::instance()->GetShopListManager() )
{
return shop_list_manager->GetListPtr()->GetPackageListPtr();
}
return NULL;
}
//------------------------------------------------------------------------------
CShopProductList* product_list()
{
if( CShopListManager* shop_list_manager = CashShop::instance()->GetShopListManager() )
{
return shop_list_manager->GetListPtr()->GetProductListPtr();
}
return NULL;
}
//------------------------------------------------------------------------------
CShopPropertyList* property_list()
{
if( CShopListManager* shop_list_manager = CashShop::instance()->GetShopListManager() )
{
return shop_list_manager->GetListPtr()->GetPropertyListPtr();
}
return NULL;
}
//------------------------------------------------------------------------------
CShopProductLinkList* productlink_list()
{
if( CShopListManager* shop_list_manager = CashShop::instance()->GetShopListManager() )
{
return shop_list_manager->GetListPtr()->GetProductLinkListPtr();
}
return NULL;
}
//------------------------------------------------------------------------------
Define::CashType GetCashType(BYTE basket_type /*uiConvenienceStore_Basket::BasketType*/)
{
return Define::kCashType_Cash;
}
//------------------------------------------------------------------------------
bool FindShopProduct(CShopPackage* shop_package, int price_seq,
OUT CShopProduct*& shop_product,
OUT CShopProductLink*& shop_product_link)
{
if (1 < shop_package->GetProductCount())
{
return false;
}
int shop_product_seq = 0;
if (shop_package->GetProductSeqFirst(shop_product_seq) == false)
{
return false;
}
if (ConvenienceStore::product_list()->GetValueByKey(shop_product_seq, OUT shop_product) == false)
{
return false;
}
productlink_list()->SetProductFirst(shop_product->ProductSeq, price_seq);
if (productlink_list()->GetProductNext(shop_product_link) == false)
{
return false;
}
return true;
}
};