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"
|
||||
VendorName="SlickEdit"
|
||||
TemplateName="GNU C/C++"
|
||||
WorkingDir="."
|
||||
WorkingDir="../"
|
||||
BuildSystem="vsbuild">
|
||||
<Config
|
||||
Name="Debug"
|
||||
|
@ -69,7 +69,9 @@
|
|||
Deletable="0"
|
||||
SaveOption="SaveNone"
|
||||
RunFromDir="%rw">
|
||||
<Exec CmdLine='vsdebugio -prog "%o"'/>
|
||||
<Exec
|
||||
CmdLine='vsdebugio -prog "%o" %~other'
|
||||
OtherOptions="scripts/runtests.lua"/>
|
||||
</Target>
|
||||
<Target
|
||||
Name="Execute"
|
||||
|
@ -79,9 +81,10 @@
|
|||
CaptureOutputWith="ProcessBuffer"
|
||||
Deletable="0"
|
||||
SaveOption="SaveWorkspaceFiles"
|
||||
RunFromDir="%rw"
|
||||
RunInXterm="1">
|
||||
<Exec CmdLine='"%o"'/>
|
||||
RunFromDir="%rw">
|
||||
<Exec
|
||||
CmdLine='"%o" %~other'
|
||||
OtherOptions="scripts/runtests.lua"/>
|
||||
</Target>
|
||||
<Target
|
||||
Name="dash"
|
||||
|
@ -194,7 +197,9 @@
|
|||
Deletable="0"
|
||||
SaveOption="SaveNone"
|
||||
RunFromDir="%rw">
|
||||
<Exec CmdLine='vsdebugio -prog "%o"'/>
|
||||
<Exec
|
||||
CmdLine='vsdebugio -prog "%o" %~other'
|
||||
OtherOptions="scripts/runtests.lua"/>
|
||||
</Target>
|
||||
<Target
|
||||
Name="Execute"
|
||||
|
@ -204,9 +209,10 @@
|
|||
CaptureOutputWith="ProcessBuffer"
|
||||
Deletable="0"
|
||||
SaveOption="SaveWorkspaceFiles"
|
||||
RunFromDir="%rw"
|
||||
RunInXterm="1">
|
||||
<Exec CmdLine='"%o"'/>
|
||||
RunFromDir="%rw">
|
||||
<Exec
|
||||
CmdLine='"%o" %~other'
|
||||
OtherOptions="scripts/runtests.lua"/>
|
||||
</Target>
|
||||
<Target
|
||||
Name="dash"
|
||||
|
@ -282,6 +288,7 @@
|
|||
<F N="../src/config.pkg.c"/>
|
||||
<F N="../src/console.c"/>
|
||||
<F N="../src/eressea.pkg.c"/>
|
||||
<F N="../src/game.pkg.c"/>
|
||||
<F N="../src/gmtool.c"/>
|
||||
<F N="../src/helpers.c"/>
|
||||
<F N="../src/listbox.c"/>
|
||||
|
|
|
@ -2103,7 +2103,7 @@ bool faction_id_is_unused(int id)
|
|||
|
||||
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);
|
||||
item *itm;
|
||||
|
||||
|
@ -2120,8 +2120,8 @@ int weight(const unit * u)
|
|||
if (rtype) {
|
||||
w = i_get(u->items, rtype->itype) * BAGCAPACITY;
|
||||
if (w > in_bag) w = in_bag;
|
||||
n -= w;
|
||||
}
|
||||
n -= w;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ end
|
|||
function test_walk_to_land()
|
||||
local r1 = region.create(0, 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)
|
||||
u:add_order("NACH O")
|
||||
process_orders()
|
||||
|
|
Loading…
Reference in New Issue