Pass strings by reference instead of copying them everywhere

The title says it all. No changes to the game logic. Surprisingly, these changes alone reduced the executable size by ~2%.