瀏覽代碼

Enfore limits on ParticleSystem:setSizeVariation (issue #545)

Bart van Strien 12 年之前
父節點
當前提交
4221d55468
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/modules/graphics/opengl/wrap_ParticleSystem.cpp

+ 3 - 0
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -192,6 +192,9 @@ int w_ParticleSystem_setSizeVariation(lua_State *L)
 {
 	ParticleSystem *t = luax_checkparticlesystem(L, 1);
 	float arg1 = (float)luaL_checknumber(L, 2);
+	if (arg1 < 0.0f || arg1 > 1.0f)
+		return luaL_error(L, "Size variation has to be between 0 and 1, inclusive.");
+
 	t->setSizeVariation(arg1);
 	return 0;
 }