MythTV master
TokenGroup.cpp
Go to the documentation of this file.
1/* TokenGroup.cpp
2
3 Copyright (C) David C. J. Matthews 2004 dm at prolingua.co.uk
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
18 Or, point your browser to http://www.gnu.org/copyleft/gpl.html
19
20*/
21
22
23#include "TokenGroup.h"
24
25#include <algorithm>
26
27#include "Presentable.h"
28#include "Ingredients.h"
29#include "Root.h"
30#include "BaseClasses.h"
31#include "ParseNode.h"
32#include "ASN1Codes.h"
33#include "Engine.h"
34
36{
37 // A pair consisting of an object reference and an optional action slot sequence.
38 m_Object.Initialise(p->GetSeqN(0), engine);
39
40 if (p->GetSeqCount() > 1)
41 {
42 MHParseNode *pSlots = p->GetSeqN(1);
43
44 for (int i = 0; i < pSlots->GetSeqCount(); i++)
45 {
46 MHParseNode *pAct = pSlots->GetSeqN(i);
47 auto *pActions = new MHActionSequence;
48 m_ActionSlots.Append(pActions);
49
50 // The action slot entry may be NULL.
52 {
53 pActions->Initialise(pAct, engine);
54 }
55 }
56 }
57}
58
59void MHTokenGroupItem::PrintMe(FILE *fd, int nTabs) const
60{
61 PrintTabs(fd, nTabs);
62 fprintf(fd, "( ");
63 m_Object.PrintMe(fd, nTabs + 1);
64 fprintf(fd, "\n");
65
66 if (m_ActionSlots.Size() != 0)
67 {
68 PrintTabs(fd, nTabs + 1);
69 fprintf(fd, ":ActionSlots (\n");
70
71 for (int i = 0; i < m_ActionSlots.Size(); i++)
72 {
73 PrintTabs(fd, nTabs + 2);
74 fprintf(fd, "( // slot %d\n", i);
76
77 if (pActions->Size() == 0)
78 {
79 PrintTabs(fd, nTabs + 2);
80 fprintf(fd, "NULL\n");
81 }
82 else
83 {
84 pActions->PrintMe(fd, nTabs + 2);
85 }
86
87 PrintTabs(fd, nTabs + 2);
88 fprintf(fd, ")\n");
89 }
90
91 PrintTabs(fd, nTabs + 1);
92 fprintf(fd, ")\n");
93 }
94
95 PrintTabs(fd, nTabs);
96 fprintf(fd, ")\n");
97}
98
100{
101 for (int i = 0; i < p->GetSeqCount(); i++)
102 {
103 m_movement.Append(p->GetSeqN(i)->GetIntValue());
104 }
105}
106
107void MHMovement::PrintMe(FILE *fd, int nTabs) const
108{
109 PrintTabs(fd, nTabs);
110 fprintf(fd, "( ");
111
112 for (int i = 0; i < m_movement.Size(); i++)
113 {
114 fprintf(fd, "%d ", m_movement.GetAt(i));
115 }
116
117 fprintf(fd, ")\n");
118}
119
121{
123 MHParseNode *pMovements = p->GetNamedArg(C_MOVEMENT_TABLE);
124
125 if (pMovements)
126 {
127 for (int i = 0; i < pMovements->GetArgCount(); i++)
128 {
129 auto *pMove = new MHMovement;
130 m_movementTable.Append(pMove);
131 pMove->Initialise(pMovements->GetArgN(i), engine);
132 }
133 }
134
135 MHParseNode *pTokenGrp = p->GetNamedArg(C_TOKEN_GROUP_ITEMS);
136
137 if (pTokenGrp)
138 {
139 for (int i = 0; i < pTokenGrp->GetArgCount(); i++)
140 {
141 auto *pToken = new MHTokenGroupItem;
142 m_tokenGrpItems.Append(pToken);
143 pToken->Initialise(pTokenGrp->GetArgN(i), engine);
144 }
145 }
146
147 MHParseNode *pNoToken = p->GetNamedArg(C_NO_TOKEN_ACTION_SLOTS);
148
149 if (pNoToken)
150 {
151 for (int i = 0; i < pNoToken->GetArgCount(); i++)
152 {
153 MHParseNode *pAct = pNoToken->GetArgN(i);
154 auto *pActions = new MHActionSequence;
156
157 // The action slot entry may be NULL.
158 if (pAct->m_nNodeType != MHParseNode::PNNull)
159 {
160 pActions->Initialise(pAct, engine);
161 }
162 }
163 }
164}
165
166// This is used to print the contents of the token group.
167void MHTokenGroup::PrintContents(FILE *fd, int nTabs) const
168{
169 MHPresentable::PrintMe(fd, nTabs + 1);
170
171 if (m_movementTable.Size() != 0)
172 {
173 PrintTabs(fd, nTabs + 1);
174 fprintf(fd, ":MovementTable (\n");
175
176 for (int i = 0; i < m_movementTable.Size(); i++)
177 {
178 m_movementTable.GetAt(i)->PrintMe(fd, nTabs + 2);
179 }
180
181 PrintTabs(fd, nTabs + 1);
182 fprintf(fd, ")\n");
183 }
184
185 if (m_tokenGrpItems.Size() != 0)
186 {
187 PrintTabs(fd, nTabs + 1);
188 fprintf(fd, ":TokenGroupItems (\n");
189
190 for (int i = 0; i < m_tokenGrpItems.Size(); i++)
191 {
192 m_tokenGrpItems.GetAt(i)->PrintMe(fd, nTabs + 2);
193 }
194
195 PrintTabs(fd, nTabs + 1);
196 fprintf(fd, ")\n");
197 }
198
199 if (m_noTokenActionSlots.Size() != 0)
200 {
201 PrintTabs(fd, nTabs + 1);
202 fprintf(fd, ":NoTokenActionSlots (\n");
203
204 for (int i = 0; i < m_noTokenActionSlots.Size(); i++)
205 {
207
208 if (pActions->Size() == 0)
209 {
210 PrintTabs(fd, nTabs + 2);
211 fprintf(fd, "NULL ");
212 }
213 else
214 {
215 pActions->PrintMe(fd, nTabs + 2);
216 }
217 }
218
219 PrintTabs(fd, nTabs + 1);
220 fprintf(fd, ")\n");
221 }
222
223}
224
225void MHTokenGroup::PrintMe(FILE *fd, int nTabs) const
226{
227 PrintTabs(fd, nTabs);
228 fprintf(fd, "{:TokenGroup ");
229 PrintContents(fd, nTabs);
230 PrintTabs(fd, nTabs);
231 fprintf(fd, "}\n");
232}
233
234// Activate the token group following the standard.
236{
237 if (m_fRunning)
238 {
239 return;
240 }
241
243
244 // We're supposed to apply Activation to each of the "items" but it isn't clear
245 // exactly what that means. Assume it means each of the visibles.
246 for (int i = 0; i < m_tokenGrpItems.Size(); i++)
247 {
249
250 // The object reference may be the null reference.
251 // Worse: it seems that sometimes in BBC's MHEG the reference simply doesn't exist.
252 if (pObject->IsSet())
253 {
254 try
255 {
256 engine->FindObject(m_tokenGrpItems.GetAt(i)->m_Object)->Activation(engine);
257 }
258 catch(const std::exception& ex)
259 {
260 MHLOG(MHLogDetail, QString("MHTokenGroup::Activation - threw %1").arg(ex.what()));
261 }
262 catch(char const *e)
263 {
264 // Ignore null objects
265 if (strcmp(e, "FindObject failed") != 0)
266 MHLOG(MHLogDetail, QString("MHTokenGroup::Activation - threw '%1'").arg(e));
267 }
268 catch(...)
269 {
270 MHLOG(MHLogDetail, QString("MHTokenGroup::Activation - threw unknown"));
271 }
272 }
273 }
274
276 m_fRunning = true;
277 engine->EventTriggered(this, EventIsRunning);
278}
279
281{
282 if (! m_fRunning)
283 {
284 return;
285 }
286
289}
290
291// Internal function to generate the appropriate events.
292void MHTokenGroup::TransferToken(int newPos, MHEngine *engine)
293{
294 if (newPos != m_nTokenPosition)
295 {
297 m_nTokenPosition = newPos;
299 }
300}
301
302// Perform the actions depending on where the token is.
304{
305 if (m_nTokenPosition == 0) // No slot has the token.
306 {
307 if (n > 0 && n <= m_noTokenActionSlots.Size())
308 {
309 engine->AddActions(*(m_noTokenActionSlots.GetAt(n - 1)));
310 }
311 }
312 else
313 {
315 {
317
318 if (n > 0 && n <= pGroup->m_ActionSlots.Size())
319 {
320 engine->AddActions(*(pGroup->m_ActionSlots.GetAt(n - 1)));
321 }
322 }
323 }
324}
325
326void MHTokenGroup::Move(int n, MHEngine *engine)
327{
328 if (m_nTokenPosition == 0 || n < 1 || n > m_movementTable.Size())
329 {
330 TransferToken(0, engine); // Not in the standard
331 }
332 else
333 {
335 }
336}
337
338// ListGroup. This is a complex class and the description was extensively revised in the MHEG corrigendum.
339// It doesn't seem to be used a great deal in practice and quite a few of the actions haven't been tested.
340
342{
343 while (!m_itemList.isEmpty())
344 {
345 delete m_itemList.takeFirst();
346 }
347}
348
350{
352 MHParseNode *pPositions = p->GetNamedArg(C_POSITIONS);
353
354 if (pPositions)
355 {
356 for (int i = 0; i < pPositions->GetArgCount(); i++)
357 {
358 MHParseNode *pPos = pPositions->GetArgN(i);
359 QPoint pos(pPos->GetSeqN(0)->GetIntValue(), pPos->GetSeqN(1)->GetIntValue());
360 m_positions.Append(pos);
361 }
362 }
363
364 MHParseNode *pWrap = p->GetNamedArg(C_WRAP_AROUND);
365
366 if (pWrap)
367 {
368 m_fWrapAround = pWrap->GetArgN(0)->GetBoolValue();
369 }
370
371 MHParseNode *pMultiple = p->GetNamedArg(C_WRAP_AROUND);
372
373 if (pMultiple)
374 {
375 m_fMultipleSelection = pMultiple->GetArgN(0)->GetBoolValue();
376 }
377}
378
379void MHListGroup::PrintMe(FILE *fd, int nTabs) const
380{
381 PrintTabs(fd, nTabs);
382 fprintf(fd, "{:ListGroup ");
384 PrintTabs(fd, nTabs + 1);
385 fprintf(fd, ":Positions (");
386
387 for (int i = 0; i < m_positions.Size(); i++)
388 {
389 fprintf(fd, " ( %d %d )", m_positions.GetAt(i).x(), m_positions.GetAt(i).y());
390 }
391
392 fprintf(fd, ")\n");
393
394 if (m_fWrapAround)
395 {
396 PrintTabs(fd, nTabs + 1);
397 fprintf(fd, ":WrapAround true\n");
398 }
399
401 {
402 PrintTabs(fd, nTabs + 1);
403 fprintf(fd, ":MultipleSelection true\n");
404 }
405
406 PrintTabs(fd, nTabs);
407 fprintf(fd, "}\n");
408}
409
411{
413
414 for (int i = 0; i < m_tokenGrpItems.Size(); i++)
415 {
416 // Find the item and add it to the list if it isn't already there.
417 try
418 {
419 MHRoot *pItem = engine->FindObject(m_tokenGrpItems.GetAt(i)->m_Object);
420 MHListItem *p = nullptr;
421
422 for (auto *item : std::as_const(m_itemList))
423 {
424 p = item;
425
426 if (p->m_pVisible == pItem)
427 {
428 break;
429 }
430 }
431
432 if (!p)
433 {
434 m_itemList.append(new MHListItem(pItem));
435 }
436 }
437 catch(const std::exception& ex)
438 {
439 MHLOG(MHLogDetail, QString("MHListGroup::Preparation - threw %1").arg(ex.what()));
440 }
441 catch(char const *e)
442 {
443 // Ignore null objects
444 if (strcmp(e, "FindObject failed") != 0)
445 MHLOG(MHLogDetail, QString("MHListGroup::Preparation - threw '%1'").arg(e));
446 }
447 catch(...)
448 {
449 MHLOG(MHLogDetail, QString("MHListGroup::Preparation - threw unknown"));
450 }
451 }
452}
453
455{
456 // Reset the positions of the visibles.
457 for (auto *item : std::as_const(m_itemList))
458 item->m_pVisible->ResetPosition();
459
461}
462
464{
467 Update(engine);
468}
469
470
472{
473 // Deactivate the visibles.
474 for (auto *item : std::as_const(m_itemList))
475 item->m_pVisible->Deactivation(engine);
476
478}
479
480// Update action - set the position of the cells to be displayed and deactivate those
481// which aren't.
483{
484 if (m_itemList.isEmpty()) // Special cases when the list becomes empty
485 {
487 {
488 m_fFirstItemDisplayed = false;
489 engine->EventTriggered(this, EventFirstItemPresented, false);
490 }
491
493 {
494 m_fLastItemDisplayed = false;
495 engine->EventTriggered(this, EventLastItemPresented, false);
496 }
497 }
498 else // Usual case.
499 {
500 for (int i = 0; i < m_itemList.size(); i++)
501 {
502 MHRoot *pVis = m_itemList.at(i)->m_pVisible;
503 int nCell = i + 1 - m_nFirstItem; // Which cell does this item map onto?
504
505 if (nCell >= 0 && nCell < m_positions.Size())
506 {
507 if (i == 0 && ! m_fFirstItemDisplayed)
508 {
510 engine->EventTriggered(this, EventFirstItemPresented, true);
511 }
512
513 if (i == m_itemList.size() - 1 && ! m_fLastItemDisplayed)
514 {
516 engine->EventTriggered(this, EventLastItemPresented, true);
517 }
518
519 try
520 {
521 pVis->SetPosition(m_positions.GetAt(i - m_nFirstItem + 1).x(), m_positions.GetAt(i - m_nFirstItem + 1).y(), engine);
522 }
523 catch(const std::exception& ex)
524 {
525 MHLOG(MHLogDetail, QString("MHListGroup::Update - threw %1").arg(ex.what()));
526 }
527 catch(...)
528 {
529 MHLOG(MHLogDetail, QString("MHListGroup::Update - threw unknown"));
530 }
531
532 if (! pVis->GetRunningStatus())
533 {
534 pVis->Activation(engine);
535 }
536 }
537 else
538 {
539 if (i == 0 && m_fFirstItemDisplayed)
540 {
541 m_fFirstItemDisplayed = false;
542 engine->EventTriggered(this, EventFirstItemPresented, false);
543 }
544
545 if (i == m_itemList.size() - 1 && m_fLastItemDisplayed)
546 {
547 m_fLastItemDisplayed = false;
548 engine->EventTriggered(this, EventLastItemPresented, false);
549 }
550
551 if (pVis->GetRunningStatus())
552 {
553 pVis->Deactivation(engine);
554 pVis->ResetPosition();
555 }
556 }
557 }
558 }
559
560 // Generate the HeadItems and TailItems events. Even in the MHEG corrigendum this is unclear.
561 // I'm not at all sure this is right.
563 {
565 }
566
568 {
569 engine->EventTriggered(this, EventTailItems,
570#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
571 (m_itemList.size()) - m_nFirstItem);
572#else
573 static_cast<int>(m_itemList.size()) - m_nFirstItem);
574#endif
575 }
576
577 m_nLastCount = m_itemList.size();
579}
580
581// Add an item to the list
582void MHListGroup::AddItem(int nIndex, MHRoot *pItem, MHEngine *engine)
583{
584 // See if the item is already there and ignore this if it is.
585 for (auto *item : std::as_const(m_itemList))
586 {
587 if (item->m_pVisible == pItem)
588 {
589 return;
590 }
591 }
592
593 // Ignore this if the index is out of range
594 if (nIndex < 1 || nIndex > m_itemList.size() + 1)
595 {
596 return;
597 }
598
599 // Insert it at the appropriate position (MHEG indexes count from 1).
600 m_itemList.insert(nIndex - 1, new MHListItem(pItem));
601
602 if (nIndex <= m_nFirstItem && m_nFirstItem < m_itemList.size())
603 {
604 m_nFirstItem++;
605 }
606
607 Update(engine); // Apply the update behaviour
608}
609
610// Remove an item from the list
611void MHListGroup::DelItem(MHRoot *pItem, MHEngine * /*engine*/)
612{
613 // See if the item is already there and ignore this if it is.
614 for (int i = 0; i < m_itemList.size(); i++)
615 {
616 if (m_itemList.at(i)->m_pVisible == pItem) // Found it - remove it from the list and reset the posn.
617 {
618 delete m_itemList.takeAt(i);
619 pItem->ResetPosition();
620
621 if (i + 1 < m_nFirstItem && m_nFirstItem > 1)
622 {
623 m_nFirstItem--;
624 }
625
626 return;
627 }
628 }
629}
630
631// Set the selection status of the item to true
632void MHListGroup::Select(int nIndex, MHEngine *engine)
633{
634 MHListItem *pListItem = m_itemList.at(nIndex - 1);
635
636 if (pListItem == nullptr || pListItem->m_fSelected)
637 {
638 return; // Ignore if already selected.
639 }
640
642 {
643 // Deselect any existing selections.
644 for (int i = 0; i < m_itemList.size(); i++)
645 {
646 if (m_itemList.at(i)->m_fSelected)
647 {
648 Deselect(i + 1, engine);
649 }
650 }
651 }
652
653 pListItem->m_fSelected = true;
654 engine->EventTriggered(this, EventItemSelected, nIndex);
655}
656
657// Set the selection status of the item to false
658void MHListGroup::Deselect(int nIndex, MHEngine *engine)
659{
660 MHListItem *pListItem = m_itemList.at(nIndex - 1);
661
662 if (pListItem == nullptr || ! pListItem->m_fSelected)
663 {
664 return; // Ignore if not selected.
665 }
666
667 pListItem->m_fSelected = false;
668 engine->EventTriggered(this, EventItemDeselected, nIndex);
669}
670
671// Return the reference to the visible at the particular position.
672void MHListGroup::GetCellItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
673{
674 nCell = std::clamp(nCell, 1, m_positions.Size());
675
676 int nVisIndex = nCell + m_nFirstItem - 2;
677
678 if (nVisIndex >= 0 && nVisIndex < m_itemList.size())
679 {
680 MHRoot *pVis = m_itemList.at(nVisIndex)->m_pVisible;
681 engine->FindObject(itemDest)->SetVariableValue(pVis->m_ObjectReference);
682 }
683 else
684 {
686 }
687}
688
689int MHListGroup::AdjustIndex(int nIndex) // Added in the MHEG corrigendum
690{
691 int nItems = m_itemList.size();
692
693 if (nItems == 0)
694 {
695 return 1;
696 }
697
698 if (nIndex > nItems)
699 {
700 return ((nIndex - 1) % nItems) + 1;
701 }
702 if (nIndex < 0)
703 {
704 return nItems - ((-nIndex) % nItems);
705 }
706 return nIndex;
707}
708
709void MHListGroup::GetListItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
710{
711 if (m_fWrapAround)
712 {
713 nCell = AdjustIndex(nCell);
714 }
715
716 if (nCell < 1 || nCell > m_itemList.size())
717 {
718 return; // Ignore it if it's out of range and not wrapping
719 }
720
721 engine->FindObject(itemDest)->SetVariableValue(m_itemList.at(nCell - 1)->m_pVisible->m_ObjectReference);
722}
723
724void MHListGroup::GetItemStatus(int nCell, const MHObjectRef &itemDest, MHEngine *engine)
725{
726 if (m_fWrapAround)
727 {
728 nCell = AdjustIndex(nCell);
729 }
730
731 if (nCell < 1 || nCell > m_itemList.size())
732 {
733 return;
734 }
735
736 engine->FindObject(itemDest)->SetVariableValue(m_itemList.at(nCell - 1)->m_fSelected);
737}
738
739void MHListGroup::SelectItem(int nCell, MHEngine *engine)
740{
741 if (m_fWrapAround)
742 {
743 nCell = AdjustIndex(nCell);
744 }
745
746 if (nCell < 1 || nCell > m_itemList.size())
747 {
748 return;
749 }
750
751 Select(nCell, engine);
752}
753
754void MHListGroup::DeselectItem(int nCell, MHEngine *engine)
755{
756 if (m_fWrapAround)
757 {
758 nCell = AdjustIndex(nCell);
759 }
760
761 if (nCell < 1 || nCell > m_itemList.size())
762 {
763 return;
764 }
765
766 Deselect(nCell, engine);
767}
768
769void MHListGroup::ToggleItem(int nCell, MHEngine *engine)
770{
771 if (m_fWrapAround)
772 {
773 nCell = AdjustIndex(nCell);
774 }
775
776 if (nCell < 1 || nCell > m_itemList.size())
777 {
778 return;
779 }
780
781 if (m_itemList.at(nCell - 1)->m_fSelected)
782 {
783 Deselect(nCell, engine);
784 }
785 else
786 {
787 Select(nCell, engine);
788 }
789}
790
791void MHListGroup::ScrollItems(int nCell, MHEngine *engine)
792{
793 nCell += m_nFirstItem;
794
795 if (m_fWrapAround)
796 {
797 nCell = AdjustIndex(nCell);
798 }
799
800 if (nCell < 1 || nCell > m_itemList.size())
801 {
802 return;
803 }
804
805 m_nFirstItem = nCell;
806 Update(engine);
807}
808
809void MHListGroup::SetFirstItem(int nCell, MHEngine *engine)
810{
811 if (m_fWrapAround)
812 {
813 nCell = AdjustIndex(nCell);
814 }
815
816 if (nCell < 1 || nCell > m_itemList.size())
817 {
818 return;
819 }
820
821 m_nFirstItem = nCell;
822 Update(engine);
823}
824
825
826
827// Actions
829{
831 m_index.Initialise(p->GetArgN(1), engine);
832 m_item.Initialise(p->GetArgN(2), engine);
833}
834
835void MHAddItem::PrintArgs(FILE *fd, int /*nTabs*/) const
836{
837 m_index.PrintMe(fd, 0);
838 m_item.PrintMe(fd, 0);
839}
840
842{
843 MHObjectRef item;
844 m_item.GetValue(item, engine);
845 Target(engine)->AddItem(m_index.GetValue(engine), engine->FindObject(item), engine);
846}
847
849{
851 m_index.Initialise(p->GetArgN(1), engine);
852 m_result.Initialise(p->GetArgN(2), engine);
853}
854
855void MHGetListActionData::PrintArgs(FILE *fd, int /*nTabs*/) const
856{
857 m_index.PrintMe(fd, 0);
858 m_result.PrintMe(fd, 0);
859}
@ C_TOKEN_GROUP_ITEMS
Definition: ASN1Codes.h:107
@ C_WRAP_AROUND
Definition: ASN1Codes.h:110
@ C_MOVEMENT_TABLE
Definition: ASN1Codes.h:106
@ C_NO_TOKEN_ACTION_SLOTS
Definition: ASN1Codes.h:108
@ C_POSITIONS
Definition: ASN1Codes.h:109
#define MHLOG(__level, __text)
Definition: Logging.h:36
void PrintTabs(FILE *fd, int n)
Definition: ParseNode.cpp:34
@ EventFirstItemPresented
Definition: Root.h:38
@ EventTailItems
Definition: Root.h:39
@ EventItemSelected
Definition: Root.h:39
@ EventLastItemPresented
Definition: Root.h:38
@ EventHeadItems
Definition: Root.h:39
@ EventItemDeselected
Definition: Root.h:39
@ EventIsRunning
Definition: Root.h:34
@ EventTokenMovedFrom
Definition: Root.h:36
@ EventTokenMovedTo
Definition: Root.h:36
virtual void PrintMe(FILE *fd, int nTabs) const
Definition: Actions.cpp:456
void Perform(MHEngine *engine) override
Definition: TokenGroup.cpp:841
MHGenericInteger m_index
Definition: TokenGroup.h:196
void PrintArgs(FILE *fd, int) const override
Definition: TokenGroup.cpp:835
MHGenericObjectRef m_item
Definition: TokenGroup.h:197
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:828
MHRoot * Target(MHEngine *engine)
Definition: BaseActions.cpp:46
virtual void Initialise(MHParseNode *p, MHEngine *engine)
Definition: BaseActions.cpp:31
MHRoot * FindObject(const MHObjectRef &oRef, bool failOnNotFound=true)
Definition: Engine.cpp:574
void EventTriggered(MHRoot *pSource, enum EventType ev)
Definition: Engine.h:94
void AddActions(const MHActionSequence &actions)
Definition: Engine.cpp:729
void Initialise(MHParseNode *p, MHEngine *engine)
int GetValue(MHEngine *engine) const
void PrintMe(FILE *fd, int nTabs) const
void Initialise(MHParseNode *p, MHEngine *engine)
void PrintMe(FILE *fd, int nTabs) const
void GetValue(MHObjectRef &ref, MHEngine *engine) const
void PrintArgs(FILE *fd, int) const override
Definition: TokenGroup.cpp:855
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:848
MHObjectRef m_result
Definition: TokenGroup.h:216
MHGenericInteger m_index
Definition: TokenGroup.h:215
void Destruction(MHEngine *engine) override
void Preparation(MHEngine *engine) override
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: Ingredients.cpp:50
void PrintMe(FILE *fd, int nTabs) const override
void AddItem(int nIndex, MHRoot *pItem, MHEngine *engine) override
Definition: TokenGroup.cpp:582
QList< MHListItem * > m_itemList
Definition: TokenGroup.h:147
int m_nFirstItem
Definition: TokenGroup.h:148
void GetCellItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:672
void Activation(MHEngine *engine) override
Definition: TokenGroup.cpp:463
void Update(MHEngine *engine)
Definition: TokenGroup.cpp:482
void GetItemStatus(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:724
void DeselectItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:754
bool m_fFirstItemDisplayed
Definition: TokenGroup.h:149
void Destruction(MHEngine *engine) override
Definition: TokenGroup.cpp:454
void SetFirstItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:809
void Deselect(int nIndex, MHEngine *engine)
Definition: TokenGroup.cpp:658
MHSequence< QPoint > m_positions
Definition: TokenGroup.h:143
void Deactivation(MHEngine *engine) override
Definition: TokenGroup.cpp:471
void DelItem(MHRoot *pItem, MHEngine *engine) override
Definition: TokenGroup.cpp:611
int AdjustIndex(int nIndex)
Definition: TokenGroup.cpp:689
void SelectItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:739
void Preparation(MHEngine *engine) override
Definition: TokenGroup.cpp:410
int m_nLastFirstItem
Definition: TokenGroup.h:152
bool m_fWrapAround
Definition: TokenGroup.h:144
void GetListItem(int nCell, const MHObjectRef &itemDest, MHEngine *engine) override
Definition: TokenGroup.cpp:709
bool m_fLastItemDisplayed
Definition: TokenGroup.h:150
int m_nLastCount
Definition: TokenGroup.h:151
void PrintMe(FILE *fd, int nTabs) const override
Definition: TokenGroup.cpp:379
~MHListGroup() override
Definition: TokenGroup.cpp:341
void ToggleItem(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:769
void Select(int nIndex, MHEngine *engine)
Definition: TokenGroup.cpp:632
bool m_fMultipleSelection
Definition: TokenGroup.h:145
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:349
void ScrollItems(int nCell, MHEngine *engine) override
Definition: TokenGroup.cpp:791
bool m_fSelected
Definition: TokenGroup.h:98
MHSequence< int > m_movement
Definition: TokenGroup.h:54
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: TokenGroup.cpp:99
void PrintMe(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:107
bool IsSet() const
Definition: BaseClasses.h:164
void PrintMe(FILE *fd, int nTabs) const
static MHObjectRef Null
Definition: BaseClasses.h:159
void Initialise(MHParseNode *p, MHEngine *engine)
MHParseNode * GetSeqN(int n)
Definition: ParseNode.cpp:152
MHParseNode * GetArgN(int n)
Definition: ParseNode.cpp:78
int GetArgCount()
Definition: ParseNode.cpp:60
bool GetBoolValue()
Definition: ParseNode.cpp:192
int GetSeqCount()
Definition: ParseNode.cpp:141
enum NodeType m_nNodeType
Definition: ParseNode.h:46
int GetIntValue()
Definition: ParseNode.cpp:170
Definition: Root.h:45
virtual void Activation(MHEngine *engine)
Definition: Root.cpp:70
virtual void ResetPosition()
Definition: Root.h:172
virtual bool GetRunningStatus()
Definition: Root.h:77
MHObjectRef m_ObjectReference
Definition: Root.h:248
virtual void Deactivation(MHEngine *engine)
Definition: Root.cpp:86
virtual void AddItem(int, MHRoot *, MHEngine *)
Definition: Root.h:139
bool m_fRunning
Definition: Root.h:253
virtual void SetPosition(int, int, MHEngine *)
Definition: Root.h:158
virtual void SetVariableValue(const MHUnion &)
Definition: Root.h:109
int Size() const
Definition: BaseClasses.h:47
void Append(BASE b)
Definition: BaseClasses.h:64
BASE GetAt(int i) const
Definition: BaseClasses.h:49
void PrintMe(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:59
void Initialise(MHParseNode *p, MHEngine *engine)
Definition: TokenGroup.cpp:35
MHObjectRef m_Object
Definition: TokenGroup.h:45
MHOwnPtrSequence< MHActionSequence > m_ActionSlots
Definition: TokenGroup.h:46
MHOwnPtrSequence< MHMovement > m_movementTable
Definition: TokenGroup.h:83
void Activation(MHEngine *engine) override
Definition: TokenGroup.cpp:235
MHOwnPtrSequence< MHActionSequence > m_noTokenActionSlots
Definition: TokenGroup.h:85
void Deactivation(MHEngine *engine) override
Definition: TokenGroup.cpp:280
void Initialise(MHParseNode *p, MHEngine *engine) override
Definition: TokenGroup.cpp:120
MHOwnPtrSequence< MHTokenGroupItem > m_tokenGrpItems
Definition: TokenGroup.h:84
void Move(int n, MHEngine *engine) override
Definition: TokenGroup.cpp:326
int m_nTokenPosition
Definition: TokenGroup.h:88
void PrintMe(FILE *fd, int nTabs) const override
Definition: TokenGroup.cpp:225
void CallActionSlot(int n, MHEngine *engine) override
Definition: TokenGroup.cpp:303
void PrintContents(FILE *fd, int nTabs) const
Definition: TokenGroup.cpp:167
void TransferToken(int newPos, MHEngine *engine)
Definition: TokenGroup.cpp:292
@ MHLogDetail
Definition: freemheg.h:83
int FILE
Definition: mythburn.py:138
static eu8 clamp(eu8 value, eu8 low, eu8 high)
Definition: pxsup2dast.c:206