Fixed spaceship pre-build event

Also fixed some cppcheck warnings.