ID:1978151
 
Resolved
Certain atoms used within "in world" verbs did not parse properly on the server end, notably when using formatting characters in the atom's name.
BYOND Version:509.1312
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Firefox 41.0
Applies to:Dream Daemon
Status: Resolved (509.1313)

This issue has been resolved.
Descriptive Problem Summary:
This is a rather odd one; I have two distinct problems, the only similarity of which seem to be using the 'in world' operator. These are both with SS13 specifically.

First off, these are both client procs- Administrators have them added to their client.verbs list when they join.

So, there is a command called "Jump To Area", it looks like this:
/client/proc/Jump(area/A in return_sorted_areas())
set name = "Jump to Area"
set desc = "Area to jump to"
set category = "Admin"

if(!check_rights(R_ADMIN))
return

if(!A)
return

var/list/turfs = list()
for(var/turf/T in A)
if(T.density)
continue
if(locate(/obj/structure/grille, T)) // Quick check to not spawn in windows
continue
turfs.Add(T)

var/turf/T = pick_n_take(turfs)
if(!T)
src << "Nowhere to jump to!"
return

admin_forcemove(usr, T)
log_admin("[key_name(usr)] jumped to [A]")
message_admins("[key_name_admin(usr)] jumped to [A]")
feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
This proc, when used, is supposed to pop up an input list of every area returned by 'return_sorted_areas()', which looks like this,
//Returns: all the areas in the world
/proc/return_areas()
var/list/area/areas = list()
for(var/area/A in world)
areas += A
return areas

//Returns: all the areas in the world, sorted.
/proc/return_sorted_areas()
return sortAtom(return_areas())

The wrong/weird thing here, is, this functions perfectly fine in 508, every area in the (255x255x7) world shows up in the list. However, in 509, only about, maybe 20 areas out of the 300-400 available actually show up in the list- I can't actually see a difference between the areas it ignores and the areas it shows.

Next is something strange revolving around a very specific turf path, "/turf/space". Most admin verbs stop functioning entirely with space. Attempting to interact with it from any of the multiple right click verbs throws the same generic output error,
Sorry, the following is not valid: space.0x1005404
usage: Jump-to-Turf turf in world
Sorry, the following is not valid: space.0x10160f6
usage: View-Variables mob|obj|turf|area in world

This only happens with "/turf/space", the other two turf types in the game, "/turf/simulated" and "/turf/unsimulated" both work fine.
The thing is, there isn't that much of a difference between "/turf/space" and "/turf/unsimulated"- the difference is mostly in subprocs, not the primary definitions of them.

I have tried reproducing this in a test project, but everything I tried with a test project functioned completely fine- I have a suspicion it only happens on high instance-count worlds.

Sorry for not being able to produce many more details, most of the tests I could think to try really didn't yield any more information than "this was working, now it's not".

Expected Results:
Client verbs would function correctly, the same as they do with 508.

Actual Results:
They do not function correctly, as described above.

Does the problem occur:
Every time? Or how often? It consistently happens with SS13.
In other games? As mentioned, I can't reproduce this in a test case, but I suspect it's from a very high instance count.
In other user accounts? Yes.
On other computers? Not able to test this at the moment.

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.) 508 and below works fine.

Workarounds: None known.

Can you give the test project a high instance count as well?

Short of that, I think it'd help if you could package up the exact source you're working on and send that to me. Let me know what files I need to change to get the admin verbs you're using, and if you can provide a step-by-step guide (down to things like which turfs to click on, etc.) to reproduce either of these issues, I think I can possibly work with that.
In response to Lummox JR
I'll try to make a high-instance test project,

The exact source I am using is available here: https://github.com/ParadiseSS13/Paradise/archive/master.zip
To get admin verbs, you would need to
copy config/example/admins.txt to config/admins.txt
copy config/example/admin_ranks.txt to config/admin_ranks.txt
Then add your ckey to admins.txt, in the format of
(Ckey) - Host

The exact way I am able to replicate the area bug is by going to the 'admin' tab in the stats menu, and hitting "Jump To Area".
In order to see the issue with space, you need to find a window on the map (you spawn inside of a space station, there are windows scattered around), space is primarily black, with different star textures for each turf.
In response to Lummox JR
It appears I was incorrect about it being related to instances, as I have made a demo that creates 100,000+ instances, plus 1000 different areas, and neither bug is present.
https://dl.dropboxusercontent.com/s/lhpk0c2hd1c4jk5/ instancetest.zip?dl=0
I forgot to ask which BYOND build you're using. You ignored the template when it said to specify the minor build (the 509 option is only in there as a reminder to use the full build), and I need that info too. There were earlier 509 builds where things like looping through areas didn't work.
Both of these issues exist on /tg/.

I had assumed the first was the & operator bug since it messes up the sorting as well, and it wouldn't shock me if timsort uses that, but we get it in 1311, which is suppose to have that fixed.

I'll make a test project in ss13 set to give all players full admin rights so you can see them in action.

https://github.com/MrStonedOne/-tg-station/archive/ forlumtoshownewbugs.zip

It should give anybody who runs this project in DD or DS full admin right off the bat. It's a separate branch just for this so you don't have to worry about it changing unless I were to modify that branch.

I also have it set to echo the pre-sort and post sort area lists as it generates them to world.log. It works slightly differently from tiger's code base, we generate the area list on world.New() once then update it as needed for the few ways areas can get created or changed mid game.

I'm compiling and running it now so no idea what it will show.

Edit: I used our text2list proc, rather then our list2text proc, to echo the list, fixed it in the branch.
In response to MrStonedOne
MrStonedOne wrote:
Both of these issues exist on /tg/.

I had assumed the first was the & operator bug since it messes up the sorting as well, and it wouldn't shock me if timsort uses that, but we get it in 1311, which is suppose to have that fixed.

Compiling in 1311 or running in 1311? The & operator issue was a compiler error, which fell out of an earlier report that the bitwise operators were being too aggressively optimized when constants were in play. (It took a few mistakes along the way to get it all right.)
All byond updates trigger a full update and clean recompile (as in, in our system, that happens. We delete the entire local copy of code base, re-download it (so it has no dmb or rsc) and re-symlink the data and config folders, then run the compiler before re-launching DD) (side note, because of the map rotation system, on the avg day the code gets recompiled 12 times)
So i'm looking at this, and it seems almost all of the areas show up for us, but a few are randomly out of place in the client's pick window, while being properly sorted in the base list. And like 3 or 2 aren't showing in the client pick window, but exist in the base list.

How ever attempting to use most turf verbs on the default turf fail. Some verbs randomly don't.
In response to Lummox JR
Lummox JR wrote:
I forgot to ask which BYOND build you're using. You ignored the template when it said to specify the minor build (the 509 option is only in there as a reminder to use the full build), and I need that info too. There were earlier 509 builds where things like looping through areas didn't work.

They put 1312 in the applies to section.
In response to MrStonedOne
MrStonedOne wrote:
They put 1312 in the applies to section.

Argh. That's not what that section is for.
In response to Lummox JR
Lummox JR wrote:
MrStonedOne wrote:
They put 1312 in the applies to section.

Argh. That's not what that section is for.

Oh. I only now see the "Other..." option in the BYOND Version drop down menu, I thought the only "Other..." was in Applies to. Sorry.
I wonder if there are too many versions in the list. I should shorten that up, because frankly I'm not even entertaining bug reports from the 400 series at this point.
MSO, I don't seem to have the Jump verb (for areas) in your project. I'm not sure what I should be looking at for turfs.
it should be under the admin tab, jump to are-... oh god damn it.

go to config/config.txt and uncomment out the very last line then reboot world.

(or re-download and re-compile, I fixed it at the link)

I messed up the config option to make everybody an admin with all permissions. I gave it the rank but didn't uncomment it.
Lummox JR resolved issue with message:
Certain atoms used within "in world" verbs did not parse properly on the server end, notably when using formatting characters in the atom's name.