[Fix] Bug in ze missionz
This commit is contained in:
parent
9cebbe7f7a
commit
83d3fbf07c
@ -13,7 +13,7 @@ function create()
|
|||||||
|
|
||||||
-- Missions generic.
|
-- Missions generic.
|
||||||
misn_type = "Cargo"
|
misn_type = "Cargo"
|
||||||
i = rnd.int(0, 3)
|
i = rnd.int(3)
|
||||||
if i == 0 then
|
if i == 0 then
|
||||||
misn.setTitle("Cargo Delivery to " .. planet)
|
misn.setTitle("Cargo Delivery to " .. planet)
|
||||||
elseif i == 1 then
|
elseif i == 1 then
|
||||||
@ -26,11 +26,14 @@ function create()
|
|||||||
|
|
||||||
-- More mission specifics.
|
-- More mission specifics.
|
||||||
carg_mass = rnd.int(10, 30)
|
carg_mass = rnd.int(10, 30)
|
||||||
carg_type = "Food"
|
i = rnd.int(1)
|
||||||
|
if i == 0 then carg_type = "Food"
|
||||||
|
elseif i == 1 then carg_type = "Ore"
|
||||||
|
end
|
||||||
misn.setDesc(string.format(
|
misn.setDesc(string.format(
|
||||||
"%s needs a rush delivery of %d tons of %s by %s.",
|
"%s needs a delivery of %d tons of %s.",
|
||||||
planet, carg_mass, carg_type, "SOMEDAY"))
|
planet, carg_mass, carg_type))
|
||||||
misn_reward = carg_mass * 1000 + rnd.int(0, 5000)
|
misn_reward = carg_mass * (750 + rnd.int(250)) + rnd.int(5000)
|
||||||
misn.setReward(string.format("%d Scred", misn_reward))
|
misn.setReward(string.format("%d Scred", misn_reward))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ static int space_getPlanet(lua_State* L) {
|
|||||||
free(planets);
|
free(planets);
|
||||||
return 0;;
|
return 0;;
|
||||||
}
|
}
|
||||||
rndplanet = planets[RNG(0, nplanets)];
|
rndplanet = planets[RNG(0, nplanets-1)];
|
||||||
free(planets);
|
free(planets);
|
||||||
|
|
||||||
lua_pushstring(L, rndplanet);
|
lua_pushstring(L, rndplanet);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define RNG(L,H) ((int)L + (int)((double)(H-L) * randfp())) // L <= RNG <= H
|
#define RNG(L,H) ((int)L + (int)((double)(H-L+1) * randfp())) // L <= RNG <= H
|
||||||
#define RNGF() (randfp())
|
#define RNGF() (randfp())
|
||||||
|
|
||||||
void rng_init(void);
|
void rng_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user