Enable decorations in renderer for local save items, disable for server save previews.
This commit is contained in:
parent
ebc4116675
commit
0ca680f4c8
@ -54,11 +54,12 @@ class ThumbnailBroker::ThumbRenderRequest
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int Width, Height;
|
int Width, Height;
|
||||||
|
bool Decorations;
|
||||||
GameSave * Save;
|
GameSave * Save;
|
||||||
ThumbnailListener * CompletedListener;
|
ThumbnailListener * CompletedListener;
|
||||||
ThumbRenderRequest(GameSave * save, int width, int height, ThumbnailListener * completedListener) :
|
ThumbRenderRequest(GameSave * save, bool decorations, int width, int height, ThumbnailListener * completedListener) :
|
||||||
Save(save), Width(width), Height(height), CompletedListener(completedListener) {}
|
Save(save), Width(width), Height(height), CompletedListener(completedListener), Decorations(decorations) {}
|
||||||
ThumbRenderRequest() : Save(0), Width(0), Height(0), CompletedListener(NULL) {}
|
ThumbRenderRequest() : Save(0), Decorations(true), Width(0), Height(0), CompletedListener(NULL) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
ThumbnailBroker::ThumbnailBroker()
|
ThumbnailBroker::ThumbnailBroker()
|
||||||
@ -77,12 +78,17 @@ ThumbnailBroker::~ThumbnailBroker()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener)
|
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener)
|
||||||
|
{
|
||||||
|
RenderThumbnail(gameSave, true, width, height, tListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThumbnailBroker::RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener)
|
||||||
{
|
{
|
||||||
AttachThumbnailListener(tListener);
|
AttachThumbnailListener(tListener);
|
||||||
pthread_mutex_lock(&thumbnailQueueMutex);
|
pthread_mutex_lock(&thumbnailQueueMutex);
|
||||||
bool running = thumbnailQueueRunning;
|
bool running = thumbnailQueueRunning;
|
||||||
thumbnailQueueRunning = true;
|
thumbnailQueueRunning = true;
|
||||||
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), width, height, tListener));
|
renderRequests.push_back(ThumbRenderRequest(new GameSave(*gameSave), decorations, width, height, tListener));
|
||||||
pthread_mutex_unlock(&thumbnailQueueMutex);
|
pthread_mutex_unlock(&thumbnailQueueMutex);
|
||||||
|
|
||||||
if(!running)
|
if(!running)
|
||||||
@ -167,7 +173,7 @@ void ThumbnailBroker::thumbnailQueueProcessTH()
|
|||||||
std::cout << typeid(*this).name() << " Processing render request" << std::endl;
|
std::cout << typeid(*this).name() << " Processing render request" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save);
|
Thumbnail * thumbnail = SaveRenderer::Ref().Render(req.Save, req.Decorations);
|
||||||
delete req.Save;
|
delete req.Save;
|
||||||
|
|
||||||
if(thumbnail)
|
if(thumbnail)
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
virtual ~ThumbnailBroker();
|
virtual ~ThumbnailBroker();
|
||||||
|
|
||||||
void FlushThumbQueue();
|
void FlushThumbQueue();
|
||||||
|
void RenderThumbnail(GameSave * gameSave, bool decorations, int width, int height, ThumbnailListener * tListener);
|
||||||
void RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener);
|
void RenderThumbnail(GameSave * gameSave, int width, int height, ThumbnailListener * tListener);
|
||||||
void RetrieveThumbnail(int saveID, int saveDate, int width, int height, ThumbnailListener * tListener);
|
void RetrieveThumbnail(int saveID, int saveDate, int width, int height, ThumbnailListener * tListener);
|
||||||
void RetrieveThumbnail(int saveID, int width, int height, ThumbnailListener * tListener);
|
void RetrieveThumbnail(int saveID, int width, int height, ThumbnailListener * tListener);
|
||||||
|
@ -356,7 +356,7 @@ void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
|||||||
|
|
||||||
if(save->GetGameSave())
|
if(save->GetGameSave())
|
||||||
{
|
{
|
||||||
savePreview = SaveRenderer::Ref().Render(save->GetGameSave());
|
savePreview = SaveRenderer::Ref().Render(save->GetGameSave(), false);
|
||||||
|
|
||||||
if(savePreview && savePreview->Data && !(savePreview->Size.X == XRES/2 && savePreview->Size.Y == YRES/2))
|
if(savePreview && savePreview->Data && !(savePreview->Size.X == XRES/2 && savePreview->Size.Y == YRES/2))
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUp
|
|||||||
SetOkayButton(okayButton);
|
SetOkayButton(okayButton);
|
||||||
|
|
||||||
if(save.GetGameSave())
|
if(save.GetGameSave())
|
||||||
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), (Size.X/2)-16, -1, this);
|
ThumbnailBroker::Ref().RenderThumbnail(save.GetGameSave(), false, (Size.X/2)-16, -1, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :
|
ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :
|
||||||
|
@ -38,7 +38,7 @@ SaveRenderer::SaveRenderer(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Thumbnail * SaveRenderer::Render(GameSave * save)
|
Thumbnail * SaveRenderer::Render(GameSave * save, bool decorations)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
Thumbnail * tempThumb;
|
Thumbnail * tempThumb;
|
||||||
@ -52,7 +52,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save)
|
|||||||
|
|
||||||
if(!sim->Load(save))
|
if(!sim->Load(save))
|
||||||
{
|
{
|
||||||
ren->decorations_enable = false;
|
ren->decorations_enable = decorations;
|
||||||
#if defined(OGLR) || defined(OGLI)
|
#if defined(OGLR) || defined(OGLI)
|
||||||
pixel * pData = NULL;
|
pixel * pData = NULL;
|
||||||
unsigned char * texData = NULL;
|
unsigned char * texData = NULL;
|
||||||
@ -123,7 +123,7 @@ Thumbnail * SaveRenderer::Render(GameSave * save)
|
|||||||
return tempThumb;
|
return tempThumb;
|
||||||
}
|
}
|
||||||
|
|
||||||
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize)
|
Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize, bool decorations)
|
||||||
{
|
{
|
||||||
GameSave * tempSave;
|
GameSave * tempSave;
|
||||||
try {
|
try {
|
||||||
@ -138,7 +138,7 @@ Thumbnail * SaveRenderer::Render(unsigned char * saveData, int dataSize)
|
|||||||
|
|
||||||
return thumb;
|
return thumb;
|
||||||
}
|
}
|
||||||
Thumbnail * thumb = Render(tempSave);
|
Thumbnail * thumb = Render(tempSave, decorations);
|
||||||
delete tempSave;
|
delete tempSave;
|
||||||
return thumb;
|
return thumb;
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ class SaveRenderer: public Singleton<SaveRenderer> {
|
|||||||
Renderer * ren;
|
Renderer * ren;
|
||||||
public:
|
public:
|
||||||
SaveRenderer();
|
SaveRenderer();
|
||||||
Thumbnail * Render(GameSave * save);
|
Thumbnail * Render(GameSave * save, bool decorations = true);
|
||||||
Thumbnail * Render(unsigned char * saveData, int saveDataSize);
|
Thumbnail * Render(unsigned char * saveData, int saveDataSize, bool decorations = true);
|
||||||
virtual ~SaveRenderer();
|
virtual ~SaveRenderer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -238,6 +238,7 @@ Snapshot * Simulation::CreateSnapshot()
|
|||||||
|
|
||||||
void Simulation::Restore(const Snapshot & snap)
|
void Simulation::Restore(const Snapshot & snap)
|
||||||
{
|
{
|
||||||
|
parts_lastActiveIndex = NPART-1;
|
||||||
std::copy(snap.AirPressure.begin(), snap.AirPressure.end(), &pv[0][0]);
|
std::copy(snap.AirPressure.begin(), snap.AirPressure.end(), &pv[0][0]);
|
||||||
std::copy(snap.AirVelocityX.begin(), snap.AirVelocityX.end(), &vx[0][0]);
|
std::copy(snap.AirVelocityX.begin(), snap.AirVelocityX.end(), &vx[0][0]);
|
||||||
std::copy(snap.AirVelocityY.begin(), snap.AirVelocityY.end(), &vy[0][0]);
|
std::copy(snap.AirVelocityY.begin(), snap.AirVelocityY.end(), &vy[0][0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user