fix prefetch options
This commit is contained in:
@@ -19,23 +19,27 @@ int AIPlayer::totalAIDecks = -1;
|
|||||||
AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
|
AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
|
||||||
: owner(owner), ability(NULL), player(NULL), click(c), target(t)
|
: owner(owner), ability(NULL), player(NULL), click(c), target(t)
|
||||||
{
|
{
|
||||||
// useability tweak - assume that the user is probably going to want to see the full res card,
|
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||||
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
|
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||||
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
|
|
||||||
// This is a good intercept point, as the AI has committed to using this card.
|
|
||||||
|
|
||||||
// if we're not in text mode, always get the thumb
|
|
||||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
|
|
||||||
{
|
{
|
||||||
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
|
// useability tweak - assume that the user is probably going to want to see the full res card,
|
||||||
if(owner->getObserver()->getResourceManager())
|
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
|
||||||
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
|
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
|
||||||
|
// This is a good intercept point, as the AI has committed to using this card.
|
||||||
// also cache the large image if we're using kNormal mode
|
|
||||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
// if we're not in text mode, always get the thumb
|
||||||
|
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
|
||||||
{
|
{
|
||||||
|
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
|
||||||
if(owner->getObserver()->getResourceManager())
|
if(owner->getObserver()->getResourceManager())
|
||||||
owner->getObserver()->getResourceManager()->RetrieveCard(c);
|
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
|
||||||
|
|
||||||
|
// also cache the large image if we're using kNormal mode
|
||||||
|
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||||
|
{
|
||||||
|
if(owner->getObserver()->getResourceManager())
|
||||||
|
owner->getObserver()->getResourceManager()->RetrieveCard(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void CarouselDeckView::Render()
|
|||||||
{
|
{
|
||||||
// even though we want to draw the cards in a particular z order for layering, we want to prefetch them
|
// even though we want to draw the cards in a particular z order for layering, we want to prefetch them
|
||||||
// in a different order, ie the center card should appear first, then the adjacent ones
|
// in a different order, ie the center card should appear first, then the adjacent ones
|
||||||
bool prefetch = options[Options::CARDPREFETCHING].number?false:true;
|
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||||
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||||
{
|
{
|
||||||
WResourceManager::Instance()->RetrieveCard(mCards[0].card);
|
WResourceManager::Instance()->RetrieveCard(mCards[0].card);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void GridDeckView::Render()
|
|||||||
int firstVisibleCard = 2;
|
int firstVisibleCard = 2;
|
||||||
int lastVisibleCard = mCards.size() - 2;
|
int lastVisibleCard = mCards.size() - 2;
|
||||||
bool mode = options[Options::GDVLARGEIMAGE].number?false:true;
|
bool mode = options[Options::GDVLARGEIMAGE].number?false:true;
|
||||||
bool prefetch = options[Options::CARDPREFETCHING].number?false:true;
|
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||||
|
|
||||||
if(!mScrollEasing.finished())
|
if(!mScrollEasing.finished())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -249,27 +249,31 @@ void MTGPlayerCards::drawFromLibrary()
|
|||||||
toMove->miracle = true;
|
toMove->miracle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// useability tweak - assume that the user is probably going to want to see the new card,
|
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||||
// so prefetch it.
|
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||||
|
|
||||||
// if we're not in text mode, always get the thumb
|
|
||||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
|
|
||||||
&& library->owner->getObserver()->getResourceManager())
|
|
||||||
{
|
{
|
||||||
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
|
// useability tweak - assume that the user is probably going to want to see the new card,
|
||||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
|
// so prefetch it.
|
||||||
|
|
||||||
// also cache the large image if we're using kNormal mode
|
// if we're not in text mode, always get the thumb
|
||||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
|
||||||
|
&& library->owner->getObserver()->getResourceManager())
|
||||||
{
|
{
|
||||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
|
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
|
||||||
|
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
|
||||||
|
|
||||||
|
// also cache the large image if we're using kNormal mode
|
||||||
|
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||||
|
{
|
||||||
|
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(putInZone(toMove, library, hand))
|
if(putInZone(toMove, library, hand))
|
||||||
{
|
{
|
||||||
toMove->currentZone = hand;
|
toMove->currentZone = hand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGPlayerCards::resetLibrary()
|
void MTGPlayerCards::resetLibrary()
|
||||||
|
|||||||
Reference in New Issue
Block a user