Ticket #6888: locate_issue.diff

File locate_issue.diff, 2.9 KB (added by Vladislav Belov, 3 months ago)

Patch by elexis to be able to reproduce the preview bug and get a stack

  • binaries/data/mods/public/globalscripts/random.js

    diff --git a/binaries/data/mods/public/globalscripts/random.js b/binaries/data/mods/public/globalscripts/random.js
    index a581f13fb5..24398f2470 100644
    a b  
     1var oldrandom = Math.random;
     2
     3Math.random = () => {
     4    warn(new Error().stack);
     5    return Math.random2 ? Math.random2() : oldrandom();
     6};
    17/**
    28 * Returns a pair of independent and normally distributed (zero mean, variance 1) random numbers.
    39 * Uses the Polar-Rejection method.
  • binaries/data/mods/public/simulation/templates/units/rome/support_female_citizen.xml

    diff --git a/binaries/data/mods/public/simulation/templates/units/rome/support_female_citizen.xml b/binaries/data/mods/public/simulation/templates/units/rome/support_female_citizen.xml
    index 3b1c326a43..a2d3317af1 100644
    a b  
    44    <Entities datatype="tokens">
    55      structures/rome/army_camp
    66      structures/rome/temple_vesta
     7      units/rome/support_female_citizen
    78    </Entities>
    89  </Builder>
     10  <BuildRestrictions>
     11    <PlacementType>land</PlacementType>
     12    <Territory>own</Territory>
     13    <Category>Structure</Category>
     14  </BuildRestrictions>
    915  <Identity>
    1016    <Civ>rome</Civ>
    1117    <Lang>latin</Lang>
  • source/scriptinterface/ScriptInterface.cpp

    diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp
    index e4057ac6a9..0f68d43504 100644
    a b bool ScriptInterface::MathRandom(double& nbr) const  
    286286    if (m->m_rng == nullptr)
    287287        return false;
    288288    nbr = generate_uniform_real(*(m->m_rng), 0.0, 1.0);
     289    debug_printf("RANDOM %f\n", nbr);
    289290    return true;
    290291}
    291292
    bool ScriptInterface::ReplaceNondeterministicRNG(boost::rand48& rng)  
    442443    if (JS_GetProperty(rq.cx, global, "Math", &math) && math.isObject())
    443444    {
    444445        JS::RootedObject mathObj(rq.cx, &math.toObject());
    445         JS::RootedFunction random(rq.cx, JS_DefineFunction(rq.cx, mathObj, "random", Math_random, 0,
     446        JS::RootedFunction random(rq.cx, JS_DefineFunction(rq.cx, mathObj, "random2", Math_random, 0,
    446447            JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT));
    447448        if (random)
    448449        {
  • source/simulation2/system/ComponentManager.cpp

    diff --git a/source/simulation2/system/ComponentManager.cpp b/source/simulation2/system/ComponentManager.cpp
    index 3f15d08522..e744e2c596 100644
    a b void CComponentManager::InitSystemEntity()  
    830830
    831831entity_id_t CComponentManager::AddEntity(const std::wstring& templateName, entity_id_t ent)
    832832{
     833    LOGWARNING("AddEntity %d\n", ent);
     834
    833835    ICmpTemplateManager *cmpTemplateManager = static_cast<ICmpTemplateManager*> (QueryInterface(SYSTEM_ENTITY, IID_TemplateManager));
    834836    if (!cmpTemplateManager)
    835837    {