Ticket #1712: 1712.patch

File 1712.patch, 3.0 KB (added by trompetin17, 10 years ago)
  • source/simulation2/components/CCmpSoundManager.cpp

     
    1 /* Copyright (C) 2012 Wildfire Games.
     1/* Copyright (C) 2014 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    8585        }
    8686    }
    8787
     88    virtual void Reset()
     89    {
     90        if (!g_SoundManager)
     91            return;
     92
     93        g_SoundManager->Pause(true);
     94    }
     95
    8896};
    8997
    9098REGISTER_COMPONENT_TYPE(SoundManager)
  • source/simulation2/components/ICmpSoundManager.cpp

     
    1 /* Copyright (C) 2010 Wildfire Games.
     1/* Copyright (C) 2014 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    2323
    2424BEGIN_INTERFACE_WRAPPER(SoundManager)
    2525DEFINE_INTERFACE_METHOD_2("PlaySoundGroup", void, ICmpSoundManager, PlaySoundGroup, std::wstring, entity_id_t)
     26DEFINE_INTERFACE_METHOD_0("Reset", void, ICmpSoundManager, Reset)
    2627END_INTERFACE_WRAPPER(SoundManager)
  • source/simulation2/components/ICmpSoundManager.h

     
    1 /* Copyright (C) 2010 Wildfire Games.
     1/* Copyright (C) 2014 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    3333     */
    3434    virtual void PlaySoundGroup(std::wstring name, entity_id_t source) = 0;
    3535
     36    virtual void Reset() = 0;
     37
    3638    DECLARE_INTERFACE_TYPE(SoundManager)
    3739};
    3840
  • source/tools/atlas/GameInterface/Handlers/MiscHandlers.cpp

     
    1 /* Copyright (C) 2013 Wildfire Games.
     1/* Copyright (C) 2014 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    3434#include "ps/GameSetup/Config.h"
    3535#include "ps/GameSetup/GameSetup.h"
    3636#include "renderer/Renderer.h"
     37#include "simulation2/Simulation2.h"
     38#include "simulation2/components/ICmpSoundManager.h"
    3739
    3840extern void (*Atlas_GLSwapBuffers)(void* context);
    3941
     
    133135
    134136MESSAGEHANDLER(SimStateRestore)
    135137{
     138    CmpPtr<ICmpSoundManager> cmpSoundManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
     139    if (cmpSoundManager)
     140        cmpSoundManager->Reset();
     141
    136142    AtlasView::GetView_Game()->RestoreState(*msg->label);
    137143}