better room ID handling (needs testing)
This commit is contained in:
parent
341f27ac11
commit
25c0e53696
|
@ -495,9 +495,13 @@ $(document).ready(function() {
|
|||
// handle rooms
|
||||
|
||||
// need to import IDs so we don't give the new room a conflicting ID
|
||||
var roomNames = newGameData.match(/ROOM \d+/g);
|
||||
var roomIds = newGameData.match(/ROOM \d+\n/g);
|
||||
|
||||
var newRoomId = parseInt(_.last(roomNames).replace(/[^\d]+/g, "")) + 1;
|
||||
roomIds = _.map(roomIds, function(roomId) {
|
||||
return parseInt(roomId.replace(/[^\d]+/g, ""));
|
||||
});
|
||||
|
||||
var newRoomId = _.max(roomIds) + 1;
|
||||
|
||||
var newRoomName = $('#roomName').val();
|
||||
// remove invalid chars? what's invalid? newlines? are those possible?
|
||||
|
|
Loading…
Reference in New Issue