mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 17:32:13 +00:00
a00f411b3b
Also, rewrite the mapastats iterator and the LIZTROOP hitscan timing in terms of that. git-svn-id: https://svn.eduke32.com/eduke32@2858 1a8010ca-5511-0410-912e-c29ae57300e0
46 lines
849 B
Lua
46 lines
849 B
Lua
|
|
-- Print out some aggregate statistics for passed BUILD maps,
|
|
-- foreachmap module.
|
|
|
|
local string = require "string"
|
|
local math = require "math"
|
|
|
|
local print = print
|
|
local type = type
|
|
|
|
local stat = require "stat"
|
|
|
|
|
|
module(...)
|
|
|
|
|
|
local function printf(fmt, ...)
|
|
print(string.format(fmt, ...))
|
|
end
|
|
|
|
local sumnumsectors = 0
|
|
local sumnumwalls = 0
|
|
|
|
local s = stat.new()
|
|
|
|
function success(map, fn)
|
|
local ns = map.numsectors
|
|
local nw = map.numwalls
|
|
|
|
s:add(nw/ns)
|
|
|
|
sumnumsectors = sumnumsectors+ns
|
|
sumnumwalls = sumnumwalls+nw
|
|
end
|
|
|
|
function finish()
|
|
res = s:getstats()
|
|
|
|
printf("%d maps\n", res.n)
|
|
printf("total sectors: %d", sumnumsectors)
|
|
printf("total walls: %d", sumnumwalls)
|
|
printf("total walls / total sectors: %.02f", sumnumwalls/sumnumsectors)
|
|
printf("")
|
|
printf("Walls/sector")
|
|
print(res)
|
|
end
|