@BuilderClass.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class BuilderClass
  4. {
  5. static void Process (AreaBuild &area, BuilderClass &builder, int thread_index);
  6. static void ProcessPath(AreaBuild &area, BuilderClass &builder, int thread_index);
  7. static bool IOFunc(Thread &thread);
  8. bool ioFunc( );
  9. bool finished_processing, background;
  10. PathSettings path_settings;
  11. Str game_path, edit_path;
  12. SyncLock lock; // we need to operate on separate 'SyncLock' (and not 'areas.lock') because we use 'Swap' for 'areas' and thus we would operate on 2 'SyncLock's
  13. ThreadSafeMap<VecI2, AreaBuild> areas; // areas currently being processed, make thread-safe just in case
  14. Memc<EmbedObj> embed_objs; // embedded objects loaded for desired areas
  15. Memc<WaterMesh> waters; // waters loaded for desired areas
  16. RectI embed_objs_rect, water_rect;
  17. WorldVer *world_ver;
  18. Thread io_thread;
  19. SyncEvent io_wait;
  20. ~BuilderClass(); // delete thread before other members
  21. // get
  22. bool processing( ); // if we're currently processing some areas
  23. bool finished (C UID *world_id=null); // if builded all areas for rebuilt
  24. // operations
  25. void stop();
  26. bool process(WorldVer &world_ver, C ElmWorld &world_data, VecI2 area_xy);
  27. void update(bool background, C UID *priority_world_id=null);
  28. public:
  29. BuilderClass();
  30. };
  31. /******************************************************************************/
  32. /******************************************************************************/
  33. extern BuilderClass Builder;
  34. /******************************************************************************/