1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +01:00

Fix [amc] division by 0

This commit is contained in:
Dorian Wouters 2015-12-17 18:45:15 +01:00
parent adf23e10b0
commit e2244f44b1

View File

@ -26,7 +26,8 @@ predefined = {
"^flowers:geranium": {'r': 75, 'g': 101, 'b': 84},
"^flowers:rose": {'r': 153, 'g': 9, 'b': 0},
"^flowers:tulip": {'r': 175, 'g': 114, 'b': 0},
"^flowers:viola": {'r': 84, 'g': 90, 'b': 64}
"^flowers:viola": {'r': 84, 'g': 90, 'b': 64},
"^glass_arena:wall": {'r': 255, 'g': 0, 'b': 0}
}
predef_compiled = {}
@ -89,9 +90,10 @@ else:
ccumul[1] += (pxl[1]*pxl[3])/255
ccumul[2] += (pxl[2]*pxl[3])/255
ccumul[3] += pxl[3]
if ccumul[3] > 0:
a = ccumul[3]/255
if a > 0:
for i in range(3):
ccumul[i] /= ccumul[3]/255
ccumul[i] /= a
if r_override is not None:
ccumul[0] = r_override
if g_override is not None: