 				result: 'fail'
 				reason: "character ##{character_id} is in battle ##{res.rows[0].battle}"
 			}
-	
+
 	game.goEscape.sync(null, tx, character_id)
 
 	# if the character we delete is active, unselect it


sync = require 'sync'
transaction = require 'any-db-transaction'
game = require './lib/game'


# Check if a character with the given name exists.

# Removes character
exports.deleteCharacter = ((dbConnection, user_id, character_id, force=false) ->
	tx = transaction dbConnection

	res = tx.query.sync(tx,
		"DELETE FROM characters WHERE id = $1 AND player = $2",
		[ character_id, user_id ])
