Revisión | 5eab267ee43429e16941ae659ee563ca0a225744 (tree) |
---|---|
Tiempo | 2012-10-27 15:13:18 |
Autor | h2so5 <h2so5@git....> |
Commiter | h2so5 |
ChannelChangeの途中で古いStageのインスタンスを削除するように変更
ResourceManagerの文字コードを変更
@@ -32,6 +32,8 @@ class PlayerManager : public std::enable_shared_from_this<PlayerManager> { | ||
32 | 32 | void Update(); |
33 | 33 | void Draw(); |
34 | 34 | |
35 | + void ResetStage(); | |
36 | + | |
35 | 37 | uint32_t GetCurrentUserRevision(uint32_t user_id); |
36 | 38 | void ApplyRevisionPatch(const std::string& patch); |
37 | 39 |
@@ -1,4 +1,4 @@ | ||
1 | -// | |
1 | +// | |
2 | 2 | // ResourceManager.hpp |
3 | 3 | // |
4 | 4 |
@@ -16,16 +16,10 @@ ChannelChange::ChannelChange(unsigned char channel, const ManagerAccessorPtr& ma | ||
16 | 16 | command_manager_(manager_accessor->command_manager().lock()), |
17 | 17 | account_manager_(manager_accessor->account_manager().lock()), |
18 | 18 | config_manager_(manager_accessor->config_manager().lock()), |
19 | - player_manager_(manager_accessor->player_manager().lock()) | |
19 | + player_manager_(manager_accessor->player_manager().lock()), | |
20 | + channel_(channel) | |
20 | 21 | { |
21 | 22 | |
22 | - auto channel_str = (unsigned char)channel; | |
23 | - command_manager_->Write(network::ServerUpdateAccountProperty(CHANNEL, network::Utils::Serialize(channel_str))); | |
24 | - | |
25 | - auto channel_ptr = command_manager_->channels().at(channel); | |
26 | - StagePtr stage = std::make_shared<Stage>(channel_ptr,manager_accessor->config_manager().lock()); | |
27 | - world_manager_ = std::make_shared<WorldManager>(stage, manager_accessor); | |
28 | - manager_accessor_->set_world_manager(world_manager_); | |
29 | 23 | } |
30 | 24 | |
31 | 25 | ChannelChange::~ChannelChange() |
@@ -34,7 +28,16 @@ ChannelChange::~ChannelChange() | ||
34 | 28 | |
35 | 29 | void ChannelChange::Begin() |
36 | 30 | { |
31 | + // 古いステージを削除 | |
32 | + player_manager_->ResetStage(); | |
33 | + manager_accessor_->set_world_manager(WorldManagerPtr()); | |
37 | 34 | |
35 | + command_manager_->Write(network::ServerUpdateAccountProperty(CHANNEL, network::Utils::Serialize(channel_))); | |
36 | + | |
37 | + auto channel_ptr = command_manager_->channels().at(channel_); | |
38 | + StagePtr stage = std::make_shared<Stage>(channel_ptr,manager_accessor_->config_manager().lock()); | |
39 | + world_manager_ = std::make_shared<WorldManager>(stage, manager_accessor_); | |
40 | + manager_accessor_->set_world_manager(world_manager_); | |
38 | 41 | } |
39 | 42 | |
40 | 43 | void ChannelChange::End() |
@@ -29,6 +29,8 @@ class ChannelChange : public Base{ | ||
29 | 29 | ConfigManagerPtr config_manager_; |
30 | 30 | WorldManagerPtr world_manager_; |
31 | 31 | PlayerManagerPtr player_manager_; |
32 | + | |
33 | + unsigned char channel_; | |
32 | 34 | }; |
33 | 35 | |
34 | 36 | } |
\ No newline at end of file |