aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-03-03 15:45:10 -0500
committerClyne Sullivan <tullivan99@gmail.com>2016-03-03 15:45:10 -0500
commitfe5ea7fe415857f49d6630f2b0f50e1246c38eee (patch)
tree8a14040bb753143bdd583f813578df4c83191557 /src/entities.cpp
parent90f3d2ff9fe7297dae0bdcee9c441e53177a0fb7 (diff)
c++'d more stuff
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index 4291b0a..5c60386 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -241,18 +241,11 @@ Object::Object(){
inv = NULL;
}
-Object::Object(std::string in, const char *pd){
+Object::Object(std::string in, std::string pd){
iname = in;
- if(pd){
- pickupDialog = new char[strlen(pd)+1];
- strcpy(pickupDialog,pd);
- questObject = true;
- }else{
- pickupDialog = new char[1];
- *pickupDialog = '\0';
- questObject = false;
- }
+ pickupDialog = pd;
+ questObject = !pd.empty();
type = OBJECTT;
alive = true;
@@ -265,7 +258,6 @@ Object::Object(std::string in, const char *pd){
inv = NULL;
}
Object::~Object(){
- delete[] pickupDialog;
delete tex;
delete[] name;
}
@@ -464,10 +456,10 @@ void Merchant::interact(){
void Object::interact(void){
if(questObject && alive){
- ui::dialogBox(player->name,":Yes:No",false,pickupDialog);
+ ui::dialogBox( player->name, ":Yes:No", false, pickupDialog.c_str());
ui::waitForDialog();
if(ui::dialogOptChosen == 1){
- player->inv->addItem(/*(ITEM_ID)(identifier)*/iname, 1);
+ player->inv->addItem( iname, 1 );
alive = false;
}
}else{
@@ -523,6 +515,7 @@ unsigned int Structures::spawn(BUILD_SUB sub, float x, float y){
inv = NULL;
break;
}
+
return 0;
}
@@ -541,7 +534,7 @@ void Mob::wander(int timeRun){
player->loc.x + (width / 2) > loc.x && player->loc.x + (width / 2) < loc.x + width &&
player->loc.y + (height / 3) > loc.y && player->loc.y + (height / 3) < loc.y + height ){
Arena *a = new Arena(currentWorld,player,this);
- a->setBackground(BG_FOREST);
+ a->setBackground( WorldBGType::Forest );
a->setBGM("assets/music/embark.wav");
ui::toggleWhiteFast();
YAYA = true;