Add trimesh to reference count
This commit is contained in:
		
							parent
							
								
									53a3f0af71
								
							
						
					
					
						commit
						1c165601c2
					
				| @ -254,7 +254,14 @@ static int game_addentity(lua_State *L) { | |||||||
| 			if(lua_type(L, -1) == LUA_TSTRING) { | 			if(lua_type(L, -1) == LUA_TSTRING) { | ||||||
| 				strncpy(c.trimesh.name, lua_tostring(L, -1), sizeof(c.trimesh.name) - 1); | 				strncpy(c.trimesh.name, lua_tostring(L, -1), sizeof(c.trimesh.name) - 1); | ||||||
| 			} else { | 			} else { | ||||||
| 				c.trimesh.cache = *(struct TrimeshData**) luaL_checkudata(L, -1, "k3physics"); | 				struct TrimeshData *tmd = *(struct TrimeshData**) luaL_checkudata(L, -1, "k3physics"); | ||||||
|  | 				 | ||||||
|  | 				struct ResManRes *res = resman_rev(tmd); | ||||||
|  | 				if(res) { | ||||||
|  | 					res->refs++; | ||||||
|  | 				} | ||||||
|  | 				 | ||||||
|  | 				c.trimesh.cache = tmd; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		lua_pop(L, 1); | 		lua_pop(L, 1); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 mid
						mid