asumagic / kag-staging

Issue tracker for the KAG staging build
6 stars 0 forks source link

Dictionary .get corrupts variable on failure #176

Open asumagic opened 1 year ago

asumagic commented 1 year ago

Not 100% sure as I didn't diagnose in too deep but it seemed to be what caused #167.

See:

s32 ReadCost(ConfigFile cfg, dictionary@ costs, const string &in cost_name, s32 &in cost)
{
    if (!costs.get(cost_name, cost) && cfg.exists(cost_name))
    {
        cost = cfg.read_s32(cost_name, cost);
        costs.set(cost_name, cost);
    }

    return cost;
}

Changing the type of cost to s32 (instead of s32 &in) did not help.

asumagic commented 1 year ago

repro: int test = 123; dictionary foo; foo.get("foo", test); print(''+test) 80

asumagic commented 4 months ago

Not solved by AS update