• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisión51a447f63de926e283a91174baf9751226018999 (tree)
Tiempo2012-09-16 22:35:37
Autorh2so5 <h2so5@git....>
Commiterh2so5

Log Message

ステージ名をサーバー経由で受信するように変更

Cambiar Resumen

Diferencia incremental

--- a/client/3d/FieldPlayer.cpp
+++ b/client/3d/FieldPlayer.cpp
@@ -377,11 +377,13 @@ void FieldPlayer::InputFromUser()
377377 : prev_stat_.motion == motion.run_ ? 180.0f
378378 : 90.0f) * PHI_F / 180;
379379
380+ /*
380381 auto warp_chk = stage_->CheckWarpPoint(current_stat_.pos);
381382 if (warp_chk.first && input.GetKeyCount(InputManager::KEYBIND_ENTER) > 0 )
382383 {
383384 stage_->SetHostChangeFlag(warp_chk);
384385 }
386+ */
385387
386388 int move_dir = 0;
387389 if (input.GetKeyCount(InputManager::KEYBIND_FORWARD) > 0)
--- a/client/CommandManager.cpp
+++ b/client/CommandManager.cpp
@@ -24,7 +24,7 @@ void CommandManager::Update()
2424 if (client_)
2525 {
2626 auto command = client_->PopCommand();
27-
27+
2828 if (command) {
2929 unsigned int header = command->header();
3030
@@ -47,6 +47,14 @@ void CommandManager::Update()
4747 }
4848 break;
4949
50+ // サーバーデータ受信
51+ case ClientReceiveServerInfo:
52+ {
53+ network::Utils::Deserialize(command->body(), & stage_);
54+ status_ = STATUS_READY;
55+ }
56+ break;
57+
5058 case ClientReceiveJSON:
5159 // case ClientReceiveChatLog:
5260 {
@@ -104,7 +112,7 @@ void CommandManager::Update()
104112 void CommandManager::set_client(ClientUniqPtr client)
105113 {
106114 client_= std::move(client);
107- status_ = STATUS_CONNECTING;
115+ // status_ = STATUS_CONNECTING;
108116 }
109117
110118
@@ -141,7 +149,12 @@ void CommandManager::SendJSON(const std::string& msg) {
141149 }
142150 }
143151
144-Status CommandManager::status() const
152+CommandManager::Status CommandManager::status() const
145153 {
146154 return status_;
147155 }
156+
157+std::string CommandManager::stage() const
158+{
159+ return stage_;
160+}
\ No newline at end of file
--- a/client/CommandManager.hpp
+++ b/client/CommandManager.hpp
@@ -33,6 +33,7 @@ class CommandManager {
3333
3434 void set_client(ClientUniqPtr client);
3535 unsigned int user_id();
36+ std::string stage() const;
3637
3738 Status status() const;
3839
@@ -40,6 +41,7 @@ class CommandManager {
4041 ManagerAccessorPtr manager_accessor_;
4142 ClientUniqPtr client_;
4243 Status status_;
44+ std::string stage_;
4345 };
4446
4547 typedef std::shared_ptr<CommandManager> CommandManagerPtr;
Binary files a/client/WorldManager.cpp and b/client/WorldManager.cpp differ
--- a/client/scene/MainLoop.cpp
+++ b/client/scene/MainLoop.cpp
@@ -15,7 +15,7 @@ MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) :
1515 manager_accessor_(manager_accessor),
1616 player_manager_(std::make_shared<PlayerManager>(manager_accessor_)),
1717 card_manager_(manager_accessor->card_manager().lock()),
18- command_manager_(std::make_shared<CommandManager>(manager_accessor_)),
18+ command_manager_(manager_accessor->command_manager().lock()),
1919 world_manager_(std::make_shared<WorldManager>(manager_accessor_)),
2020 account_manager_(manager_accessor->account_manager().lock()),
2121 config_manager_(manager_accessor->config_manager().lock()),
@@ -24,25 +24,10 @@ MainLoop::MainLoop(const ManagerAccessorPtr& manager_accessor) :
2424 snapshot_number_(0)
2525 {
2626 manager_accessor_->set_player_manager(player_manager_);
27- manager_accessor_->set_command_manager(command_manager_);
2827 manager_accessor_->set_world_manager(world_manager_);
2928
3029 inputbox_.ReloadTabs();
3130
32- command_manager_->set_client(
33- ClientUniqPtr(
34- new network::Client(
35- account_manager_->host(),
36- config_manager_->port(),
37- (uint16_t)config_manager_->udp_port(),
38- account_manager_->public_key(),
39- account_manager_->private_key(),
40- "server_key.pub",
41- config_manager_->upnp()
42- )
43- )
44- );
45-
4631 minimap_.UIPlacement(config_manager_->screen_width() - MINIMAP_MINSIZE - 12, 12);
4732 player_manager_->Init();
4833 world_manager_->Init();
Binary files a/client/scene/Title.cpp and b/client/scene/Title.cpp differ
--- a/common/network/Command.cpp
+++ b/common/network/Command.cpp
@@ -151,4 +151,10 @@ ClientReceiveJSON::ClientReceiveJSON(const std::string& info_json, const std::st
151151 {
152152 }
153153
154+ClientReceiveServerInfo::ClientReceiveServerInfo(const std::string& stage) :
155+ Command(header::ClientReceiveServerInfo, Utils::Serialize(stage))
156+{
157+
158+}
159+
154160 }
--- a/common/network/Command.hpp
+++ b/common/network/Command.hpp
@@ -158,4 +158,9 @@ typedef boost::weak_ptr<Session> SessionWeakPtr;
158158 ClientReceiveJSON(const std::string& info_json, const std::string& message_json);
159159 };
160160
161+ class ClientReceiveServerInfo : public Command {
162+ public:
163+ ClientReceiveServerInfo(const std::string& stage);
164+ };
165+
161166 }
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
4545 network::Server server(config);
4646
4747 auto callback = std::make_shared<std::function<void(network::Command)>>(
48- [&server, &account, &sign](network::Command c){
48+ [&server, &account, &sign, &config](network::Command c){
4949
5050 // ログを出力
5151 auto msg = (boost::format("Receive: 0x%08x %dbyte") % c.header() % c.body().size()).str();
@@ -186,6 +186,9 @@ int main(int argc, char* argv[])
186186 case network::header::ServerStartEncryptedSession:
187187 {
188188 if (auto session = c.session().lock()) {
189+
190+ session->Send(network::ClientReceiveServerInfo(config.stage()));
191+
189192 session->Send(network::ClientStartEncryptedSession());
190193 session->EnableEncryption();
191194