Given a handle, frees the lightmap memory and flags this lightmap as unused
| 147 | |
| 148 | // Given a handle, frees the lightmap memory and flags this lightmap as unused |
| 149 | void FreeLightmapInfo(int handle) { |
| 150 | ASSERT(handle >= 0 && handle <= MAX_LIGHTMAP_INFOS); |
| 151 | |
| 152 | if (Dedicated_server) |
| 153 | return; |
| 154 | |
| 155 | // when we free up our rooms, which frees up lightmaps, the lightmap array |
| 156 | // may already be freed |
| 157 | if (!LightmapInfo) |
| 158 | return; |
| 159 | |
| 160 | if (LightmapInfo[handle].used < 1) |
| 161 | return; |
| 162 | |
| 163 | LightmapInfo[handle].used--; |
| 164 | |
| 165 | if (LightmapInfo[handle].used == 0) { |
| 166 | if (!Dedicated_server) |
| 167 | rend_FreePreUploadedTexture(LightmapInfo[handle].lm_handle, MAP_TYPE_LIGHTMAP); |
| 168 | lm_FreeLightmap(LightmapInfo[handle].lm_handle); |
| 169 | |
| 170 | Free_lmi_list[--Num_of_lightmap_info] = handle; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | // Gets the width of this lightmap_info handle |
| 175 | int lmi_w(int handle) { |
no test coverage detected