Ticket #3578: patch2.patch

File patch2.patch, 2.3 KB (added by Thomas, 9 years ago)

patch2

  • source/lib/rand.cpp

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2015 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    77 * distribute, sublicense, and/or sell copies of the Software, and to
    88 * permit persons to whom the Software is furnished to do so, subject to
    99 * the following conditions:
    10  * 
     10 *
    1111 * The above copyright notice and this permission notice shall be included
    1212 * in all copies or substantial portions of the Software.
    13  * 
     13 *
    1414 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1515 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1616 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     
    7272        x = xrand();
    7373    }
    7474    while(x >= range * inv_range);
    75     x /= inv_range;
     75    x %= range;
    7676
    7777    x += min_inclusive;
    7878    ENSURE(x < max_exclusive);
  • source/soundmanager/scripting/SoundGroup.cpp

     
    3939#include "soundmanager/items/ISoundItem.h"
    4040#include "soundmanager/SoundManager.h"
    4141
     42#include "simulation2/system/Component.h"
     43#include "simulation2/components/ICmpVisual.h"
     44
    4245#include <algorithm>
    4346
    4447
     
    203206        hSound->SetRollOff(itemRollOff);
    204207    }
    205208
     209    if (TestFlag(eRandPitch) || TestFlag(eRandGain)) {
     210        CmpPtr<ICmpVisual> cmpVisual(*g_Game->GetSimulation2(), source);
     211        if (cmpVisual)
     212            srand(cmpVisual->GetActorSeed());
     213    }
     214
    206215    if (TestFlag(eRandPitch))
    207216        hSound->SetPitch(RandFloat(m_PitchLower, m_PitchUpper));
    208217    else