From cf8ed3fe2dfb2e5f569e1dbb3fd19c2673bd4b53 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 13 Oct 2015 08:47:09 -0400 Subject: quest debug --- src/Quest.cpp | 27 +++++++++++++++++++++++---- src/common.cpp | 4 ++-- src/gameplay.cpp | 14 ++++---------- 3 files changed, 29 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/Quest.cpp b/src/Quest.cpp index c331e32..5d19795 100644 --- a/src/Quest.cpp +++ b/src/Quest.cpp @@ -1,5 +1,6 @@ -#include -#include +#include +//#include +//#include const Quest QuestList[TOTAL_QUESTS]={ Quest("Test","A test quest",(struct item_t){1,TEST_ITEM}) @@ -22,17 +23,26 @@ Quest::~Quest(){ int QuestHandler::assign(const char *t){ unsigned char i; - for(i=0;ititle,t)){ +#ifdef DEBUG + DEBUG_printf("The QuestHandler already has this quest: %s\n",t); +#endif // DEBUG return -2; } } - for(i=0;ititle,t)){ +#ifdef DEBUG + DEBUG_printf("Completing quest %s.\n",t); +#endif // DEBUG ((Entity *)completer)->inv->addItem(current[i]->reward.id,current[i]->reward.count); current.erase(current.begin()+i); +#ifdef DEBUG + DEBUG_printf("QuestHandler now has %u active quests.\n",current.size()); +#endif // DEBUG return 0; } } +#ifdef DEBUG + DEBUG_printf("QuestHandler never had quest %s.\n",t); +#endif // DEBUG return -1; } diff --git a/src/common.cpp b/src/common.cpp index 80488eb..8dcbd11 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -4,9 +4,9 @@ GLuint loadTexture(const char *fileName){ SDL_Surface *image = IMG_Load(fileName); if(!image)return 0; - #ifdef DEBUG +#ifdef DEBUG DEBUG_printf("Loaded image file: %s\n", fileName); - #endif // DEBUG +#endif // DEBUG unsigned object = 0; //creates a new unsigned variable for the texture glGenTextures(1, &object); //turns "object" into a texture diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 5ffe5a6..17a7bed 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -20,15 +20,8 @@ int compTestQuest(NPC *speaker){ } int giveTestQuest(NPC *speaker){ - static bool done=false; - if(!done){ - ui::dialogBox(speaker->name,"Here, have a quest!"); - player->qh.assign("Test"); - done=true; - } - /*while(ui::dialogBoxExists){ - mainLoop(); - }*/ + ui::dialogBox(speaker->name,"Here, have a quest!"); + player->qh.assign("Test"); NPCp(entity[2])->addAIFunc(compTestQuest); return 0; } @@ -70,9 +63,10 @@ void initEverything(void){ entity[entity.size()-1]->spawn(200,100); //sets the position of the villager around the village entity.pop_back(); + + NPCp(entity[1])->addAIFunc(giveStuff); NPCp(entity[1])->addAIFunc(giveTestQuest); for(i=0;iinWorld=test; - if(entity[i]->type==NPCT&&i>1)NPCp(entity[i])->addAIFunc(giveStuff); } } -- cgit v1.2.3