diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-03 15:50:07 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-03 15:50:07 -0500 |
commit | dd6d1e79df7d48e93ba22551b8858d77d041c197 (patch) | |
tree | 08cd205eae4d148d855a088efb1cdf1f7a3822d6 /src/entities.cpp | |
parent | 3c8140152bcf72eb1d64b580bb9c1e139bcbe191 (diff) |
enabled werror, wall and wextra (\!)
Diffstat (limited to 'src/entities.cpp')
-rw-r--r-- | src/entities.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 7f78637..a2bff3c 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -12,7 +12,7 @@ extern const char *itemName; void getRandomName(Entity *e){ int tempNum,max=0; - char buf,*bufs; + char *bufs; rewind(names); @@ -358,38 +358,35 @@ void Object::interact(void){ * void spawn points for large amounts of entities. This would allow for the spawn * point to have non-normal traits so it could be invisible or invincible... */ -unsigned int Structures::spawn(_TYPE t, float x, float y){ //spawns a structure based off of type and coords + +unsigned int Structures::spawn(_TYPE t, float x, float y){ loc.x = x; loc.y = y; type = t; alive = true; - /*VILLAGE*/ - switch(type){ - case STRUCTURET: - width = 50 * HLINE; - height = 40 * HLINE; + width = 50 * HLINE; + height = 40 * HLINE; + /* + * tempN is the amount of entities that will be spawned in the village. Currently the village + * will spawn bewteen 2 and 7 villagers for the starting hut. + */ + + unsigned int tempN = (getRand() % 5 + 2); + + while(--tempN){ + /* - * tempN is the amount of entities that will be spawned in the village. Currently the village - * will spawn bewteen 2 and 7 villagers for the starting hut. + * This is where the entities actually spawn. A new entity is created + * with type NPC. */ - unsigned int tempN = (getRand() % 5 + 2); + currentWorld->addNPC(loc.x + (tempN - 5),100); - for(int i=0;i<tempN;i++){ - - /* - * This is where the entities actually spawn. A new entity is created - * with type NPC by using polymorphism. - */ - - currentWorld->addNPC(loc.x+(i-5),100); - - } - break; } + return 0; } |