-
-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates rust_g; adds rustg-based icon_states; fixes unit tests (#5644)
~~so back when i did inventory slot refactor i added this thing called a render state cache it basically allows for lazy people to default when needed and don't default when not needed~~ ~~problem is to facilitate this we need to icon_states which seems to be using just an exorbitant amount of memory.~~ byond icon_states bad replaced with rustg icon states there's a massive footgun in that it's obviously going to be slow due to the fcopy() but for the use case of inventory it should be fine. frees about 400MB. also fixes us just having bad shuttle paths --------- Co-authored-by: silicons <[email protected]>
- Loading branch information
Showing
11 changed files
with
194 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* icon_states() but doesn't leak memory out the ass | ||
* | ||
* warning: this is actually pretty slow on runtime loaded or created /file and /icon objects. | ||
* try not to use this on those. | ||
*/ | ||
/proc/fast_icon_states(what) | ||
#define TEMPORARY_FILE "data/tmp/rustg_icon_states.dmi" | ||
if(isfile(what)) | ||
var/into_path = "[what]" | ||
if(length(into_path)) | ||
// compiled | ||
. = rustg_dmi_icon_states(into_path) | ||
else | ||
// runtime | ||
if(!fcopy(what, TEMPORARY_FILE)) | ||
CRASH("failed to fcopy") | ||
. = rustg_dmi_icon_states(TEMPORARY_FILE) | ||
if(!fdel(TEMPORARY_FILE)) | ||
CRASH("failed to fdel") | ||
else if(isicon(what)) | ||
// always runtime | ||
if(!fcopy(what, TEMPORARY_FILE)) | ||
CRASH("failed to fcopy") | ||
. = rustg_dmi_icon_states(TEMPORARY_FILE) | ||
if(!fdel(TEMPORARY_FILE)) | ||
CRASH("failed to fdel") | ||
else if(istext(what)) | ||
// assume path on server | ||
. = rustg_dmi_icon_states(what) | ||
if(!length(.)) | ||
. = list() | ||
CRASH("failed to run icon states; please check the input / source.") | ||
. = json_decode(.) | ||
#undef TEMPORARY_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters