forked from github/server
fix weight calculation, uninitialized value
This commit is contained in:
parent
dba51bf0f7
commit
5e835618f3
|
@ -3,7 +3,7 @@
|
||||||
Version="10.0"
|
Version="10.0"
|
||||||
VendorName="SlickEdit"
|
VendorName="SlickEdit"
|
||||||
TemplateName="GNU C/C++"
|
TemplateName="GNU C/C++"
|
||||||
WorkingDir="."
|
WorkingDir="../"
|
||||||
BuildSystem="vsbuild">
|
BuildSystem="vsbuild">
|
||||||
<Config
|
<Config
|
||||||
Name="Debug"
|
Name="Debug"
|
||||||
|
@ -69,7 +69,9 @@
|
||||||
Deletable="0"
|
Deletable="0"
|
||||||
SaveOption="SaveNone"
|
SaveOption="SaveNone"
|
||||||
RunFromDir="%rw">
|
RunFromDir="%rw">
|
||||||
<Exec CmdLine='vsdebugio -prog "%o"'/>
|
<Exec
|
||||||
|
CmdLine='vsdebugio -prog "%o" %~other'
|
||||||
|
OtherOptions="scripts/runtests.lua"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target
|
<Target
|
||||||
Name="Execute"
|
Name="Execute"
|
||||||
|
@ -79,9 +81,10 @@
|
||||||
CaptureOutputWith="ProcessBuffer"
|
CaptureOutputWith="ProcessBuffer"
|
||||||
Deletable="0"
|
Deletable="0"
|
||||||
SaveOption="SaveWorkspaceFiles"
|
SaveOption="SaveWorkspaceFiles"
|
||||||
RunFromDir="%rw"
|
RunFromDir="%rw">
|
||||||
RunInXterm="1">
|
<Exec
|
||||||
<Exec CmdLine='"%o"'/>
|
CmdLine='"%o" %~other'
|
||||||
|
OtherOptions="scripts/runtests.lua"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target
|
<Target
|
||||||
Name="dash"
|
Name="dash"
|
||||||
|
@ -194,7 +197,9 @@
|
||||||
Deletable="0"
|
Deletable="0"
|
||||||
SaveOption="SaveNone"
|
SaveOption="SaveNone"
|
||||||
RunFromDir="%rw">
|
RunFromDir="%rw">
|
||||||
<Exec CmdLine='vsdebugio -prog "%o"'/>
|
<Exec
|
||||||
|
CmdLine='vsdebugio -prog "%o" %~other'
|
||||||
|
OtherOptions="scripts/runtests.lua"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target
|
<Target
|
||||||
Name="Execute"
|
Name="Execute"
|
||||||
|
@ -204,9 +209,10 @@
|
||||||
CaptureOutputWith="ProcessBuffer"
|
CaptureOutputWith="ProcessBuffer"
|
||||||
Deletable="0"
|
Deletable="0"
|
||||||
SaveOption="SaveWorkspaceFiles"
|
SaveOption="SaveWorkspaceFiles"
|
||||||
RunFromDir="%rw"
|
RunFromDir="%rw">
|
||||||
RunInXterm="1">
|
<Exec
|
||||||
<Exec CmdLine='"%o"'/>
|
CmdLine='"%o" %~other'
|
||||||
|
OtherOptions="scripts/runtests.lua"/>
|
||||||
</Target>
|
</Target>
|
||||||
<Target
|
<Target
|
||||||
Name="dash"
|
Name="dash"
|
||||||
|
@ -282,6 +288,7 @@
|
||||||
<F N="../src/config.pkg.c"/>
|
<F N="../src/config.pkg.c"/>
|
||||||
<F N="../src/console.c"/>
|
<F N="../src/console.c"/>
|
||||||
<F N="../src/eressea.pkg.c"/>
|
<F N="../src/eressea.pkg.c"/>
|
||||||
|
<F N="../src/game.pkg.c"/>
|
||||||
<F N="../src/gmtool.c"/>
|
<F N="../src/gmtool.c"/>
|
||||||
<F N="../src/helpers.c"/>
|
<F N="../src/helpers.c"/>
|
||||||
<F N="../src/listbox.c"/>
|
<F N="../src/listbox.c"/>
|
||||||
|
|
|
@ -2103,7 +2103,7 @@ bool faction_id_is_unused(int id)
|
||||||
|
|
||||||
int weight(const unit * u)
|
int weight(const unit * u)
|
||||||
{
|
{
|
||||||
int w, n = 0, in_bag = 0;
|
int w = 0, n = 0, in_bag = 0;
|
||||||
const resource_type *rtype = get_resourcetype(R_SACK_OF_CONSERVATION);
|
const resource_type *rtype = get_resourcetype(R_SACK_OF_CONSERVATION);
|
||||||
item *itm;
|
item *itm;
|
||||||
|
|
||||||
|
@ -2120,8 +2120,8 @@ int weight(const unit * u)
|
||||||
if (rtype) {
|
if (rtype) {
|
||||||
w = i_get(u->items, rtype->itype) * BAGCAPACITY;
|
w = i_get(u->items, rtype->itype) * BAGCAPACITY;
|
||||||
if (w > in_bag) w = in_bag;
|
if (w > in_bag) w = in_bag;
|
||||||
}
|
|
||||||
n -= w;
|
n -= w;
|
||||||
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ end
|
||||||
function test_walk_to_land()
|
function test_walk_to_land()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("walk@example.com", "human", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_order("NACH O")
|
u:add_order("NACH O")
|
||||||
process_orders()
|
process_orders()
|
||||||
|
|
Loading…
Reference in New Issue