From 42f9456a97da0f1752caba108aa48f9e6321eb89 Mon Sep 17 00:00:00 2001 From: Major- Date: Fri, 27 Feb 2015 19:13:53 +0000 Subject: [PATCH] Raise errors if conversation or dialogues already exist. --- data/plugins/dialogue/dialogue.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/plugins/dialogue/dialogue.rb b/data/plugins/dialogue/dialogue.rb index 55b27531..8c954c0e 100644 --- a/data/plugins/dialogue/dialogue.rb +++ b/data/plugins/dialogue/dialogue.rb @@ -15,6 +15,8 @@ CONVERSATIONS = {} def conversation(name, &block) conversation = Conversation.new(name) conversation.instance_eval(&block) + + raise "Conversation named #{name} already exists." if CONVERSATIONS.has_key?(name) CONVERSATIONS[name] = conversation end @@ -35,6 +37,8 @@ class Conversation dialogue = Dialogue.new(name, self) dialogue.instance_eval(&block) dialogue.wrap + + raise "Conversations #{@name} already has a dialogue named #{name}." if @dialogues.has_key?(name) @dialogues[name] = dialogue if ((@dialogues.empty? || dialogue.has_precondition) && dialogue.type == :npc_speech)