ID:1377868
 
Resolved
browse() and browse_rsc() didn't work for /icon datums.
BYOND Version:500.1207
Operating System:Windows 7 Pro 64-bit
Web Browser:Chrome 29.0.1547.66
Applies to:Dream Daemon
Status: Resolved (500.1208)

This issue has been resolved.
Descriptive Problem Summary:

Using browse_rsc() on an icon variable causes a "bad resource" runtime.

Numbered Steps to Reproduce Problem:
1. Use the code snippet below on a stable version.
2. Test it and trigger the verb.
3. Notice the verb works, brings up a window with the "test.png" icon and doesn't produce a runtime error.
4. Update to the latest beta version (currently 500.1207) and re-compile and test again.
5. Notice that you receive a runtime error like this one.

runtime error: bad resource file
proc name: test (/client/verb/test)
source file: preferences.dm,21
usr: Giacomand (/mob/new_player)
src: Giacomand (/client)
call stack:
Giacomand (/client): test()


Code Snippet (if applicable) to Reproduce Problem:

Code works in 499, not in 500.

/client/verb/test()
var/icon/I = new('icons/test.png')
src << browse_rsc(I, "test.png")
src << browse("<p><img src=test.png></p>", "window=preferences;size=560x560")


Expected Results:

For the a new window to appear with the "test.png" image.

Actual Results:

In version 500, it runtimes. In version 499 it doesn't and works perfectly.


Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Code works fine in 499.1204.

Workarounds:

Not sure.
I use my method so that I can preview icons to players in the character selection screen, so it needs to be an icon.
I have a feeling you have to combine fcopy_rsc into browse_rsc. I've never really used browse_rsc.

Reason being, browse_rsc expects a resource file, which an /icon object can be converted into using fcopy_rsc.
Lummox JR resolved issue with message:
browse() and browse_rsc() didn't work for /icon datums.