struct Unit change. make_shared fix.

CorrectiveAction
sigonasr2 1 year ago
parent 1493faa8e5
commit 54435247e3
  1. 2
      olcCodeJam2023Entry/CollectionPoint.h
  2. 6
      olcCodeJam2023Entry/VirusAttack.cpp

@ -2,7 +2,7 @@
#include "olcPixelGameEngine.h" #include "olcPixelGameEngine.h"
#include "MemoryType.h" #include "MemoryType.h"
class Unit; struct Unit;
class CollectionPoint{ class CollectionPoint{
public: public:

@ -5,7 +5,7 @@
#define AUDIO_SOURCE_IMPLEMENTATION #define AUDIO_SOURCE_IMPLEMENTATION
#define OLC_PGEX_QUICKGUI #define OLC_PGEX_QUICKGUI
//#define SPLASH_ENABLED #define SPLASH_ENABLED
#ifdef SPLASH_ENABLED #ifdef SPLASH_ENABLED
#define OLC_PGEX_SPLASHSCREEN #define OLC_PGEX_SPLASHSCREEN
#endif #endif
@ -196,7 +196,7 @@ void VirusAttack::LoadLevel(LevelName level){
for(auto&u:selectedLevel.unitPlacement){ for(auto&u:selectedLevel.unitPlacement){
#define TranslateUnit(type) \ #define TranslateUnit(type) \
case UnitType::type:{ \ case UnitType::type:{ \
units.push_back(std::make_unique<type>(this,u.pos,IMAGES,u.friendly)); \ units.push_back(std::make_shared<type>(this,u.pos,IMAGES,u.friendly)); \
}break; }break;
switch(u.type){ switch(u.type){
@ -218,7 +218,7 @@ void VirusAttack::LoadLevel(LevelName level){
} }
} }
for(auto&cp:selectedLevel.cpPlacement){ for(auto&cp:selectedLevel.cpPlacement){
collectionPoints.push_back(std::make_unique<CollectionPoint>(this,cp.pos,cp.rot,*IMAGES[MEMORY_COLLECTION_POINT],cp.type)); collectionPoints.push_back(std::make_shared<CollectionPoint>(this,cp.pos,cp.rot,*IMAGES[MEMORY_COLLECTION_POINT],cp.type));
} }
randomBackgroundOffset={util::random(128),util::random(128)}; randomBackgroundOffset={util::random(128),util::random(128)};

Loading…
Cancel
Save