//************************************ // Method: CreateTicket // FullName: BSSlotsContainer::BuildTicket // Access: public // Returns: void // Qualifier: based on real slot symbols to build fake tickets to all reels; Fake reels(top & bottom invisible) // Parameter: GTArray<int> slotSymbols : //************************************ void BSSlotsContainer::BuildTicket(GTArray<int> slotSymbols) { #ifdef GT_DEBUG GTLogManager::SLogFormatComment("<------------- slot symbols (visible part current 3X5 reels)----------->"); GTLogManager::SLogFormatComment(slotSymbols.ToString()); #endif //based on real slot symbols to create fake tickets to all reels; //make Fake reels(top & bottom invisible) //for exmaple: // 2, 3, 5, 6, 5, // 5, 5, 5, 8, 1, // 4, 3, 3, 3, 3 // make 5 reels // reel1: 0, 2, 5, 4, 0 // reel2: 0, 3, 5, 3, 0 // and so on GTDictionary<int, GTArray<int>* > reeltickets; //initialize for(int reelIndex = 0; reelIndex < m_reelColumns.Count(); reelIndex++) { GTArray<int>* pTickets = new GTArray<int>(); pTickets->AddToTail(0); //make fake symbols for top invisible symbols reeltickets.Add(reelIndex, pTickets); } //add reel symbols; for(int i = 0; i < slotSymbols.Length(); i++) { int reelID = i % m_reelColumns.Count(); int slotSymbolValue = slotSymbols[i]; GTArray<int>* pTickets = NULL; reeltickets.GetValueByKey(reelID, pTickets); pTickets->AddToTail(slotSymbolValue); } //make fake symbols for top and bottom invisible symbols; for(int reelIndex = 0; reelIndex < m_reelColumns.Count(); reelIndex++) { GTArray<int>* pTickets; reeltickets.GetValueByKey(reelIndex, pTickets); pTickets->AddToTail(0); //make fake symbols for bottom invisible symbols m_reelColumns[reelIndex]->SetTicket(*pTickets); //send it to every reel; delete pTickets; } m_slotsSymbols = slotSymbols; }
//************************************ // Method: GetReelWinSlotsForWinlines // FullName: BSSlotsContainer::GetReelWinSlotsForWinlines // Access: protected // Returns: GTDictionary<int, GTArray<GTVector2>* > key = winlineID, value = (reelID, slotID) // Qualifier: based on finalWinlineRes and winline define, match to every win slot position in every reel; and get (reel and win slots in this reel) for all winline // Parameter: GTDictionary<int, WinlineValue> finalWinlineRes : key = winlineID, value = winlineValue; //************************************ void BSSlotsContainer::GetReelWinSlotsForWinlines(GTDictionary<int, WinlineValue>* pFinalWinlineRes) { //get winline define; GTDictionary<int, GTArray<int> >* pSourceWinlines = WinlineAlgorithm::GetWinlines(); // based on finalWinlineRes and winline define, match to every win slot position in every slot; for(GTDictionary<int,WinlineValue>::ObjectTypeIterator it= pFinalWinlineRes->Begin(); it != pFinalWinlineRes->End(); it++) { int winlineID = it->first; WinlineValue value = it->second; int winCount = value.WinCount; GTArray<int> winline; pSourceWinlines->GetValueByKey(winlineID, winline); //get winline; for(int i = 0; i < winCount; i++) { int winSlot = winline[i]; int reelID = winSlot % m_reelColumnCount; //get reelID; int realSlotPosInReel = winSlot / m_reelColumnCount; //realSlotPostion int slotPosInReel = realSlotPosInReel + 1; // because we had one fake slot (invisible) GTVector2 reelWinSlotValue(reelID, slotPosInReel); //value = (reelID, slotPosInReel) in reel; GTArray<GTVector2>* winReelSlots = NULL; //add winline slot into reelWinSlotsDict; if(m_winlineReelSlotsDict.KeyExists(winlineID)) { m_winlineReelSlotsDict.GetValueByKey(winlineID, winReelSlots); } else { winReelSlots = new GTArray<GTVector2>(); } winReelSlots->AddToTail(reelWinSlotValue); m_winlineReelSlotsDict.Add(winlineID, winReelSlots); //save winlineid as key, value is reel slot value to dict } } }