修订版 | 8b758e5dfb3e33bdd34068906a7bdc015bda817b (tree) |
---|---|
时间 | 2012-09-30 03:00:28 |
作者 | h2so5 <h2so5@git....> |
Commiter | h2so5 |
チャンネル機能を仮実装
@@ -18,6 +18,7 @@ | ||
18 | 18 | #include "ResourceManager.hpp" |
19 | 19 | #include "../common/unicode.hpp" |
20 | 20 | #include "../common/network/Command.hpp" |
21 | +#include "../common/network/Utils.hpp" | |
21 | 22 | #include "../common/database/AccountProperty.hpp" |
22 | 23 | #include "Profiler.hpp" |
23 | 24 | #include "GenerateJSON.hpp" |
@@ -403,6 +404,42 @@ Handle<Value> Card::Function_Account_updateTrip(const Arguments& args) | ||
403 | 404 | return Undefined(); |
404 | 405 | } |
405 | 406 | |
407 | +Handle<Value> Card::Function_Account_channel(const Arguments& args) | |
408 | +{ | |
409 | + auto self = static_cast<Card*>(args.Holder()->GetPointerFromInternalField(0)); | |
410 | + | |
411 | + int id = 0; | |
412 | + if (auto command_manager = self->manager_accessor_->command_manager().lock()) { | |
413 | + id = command_manager->user_id(); | |
414 | + } | |
415 | + if (auto player_manager = self->manager_accessor_->player_manager().lock()) { | |
416 | + if (auto player = player_manager->GetFromId(id)) { | |
417 | + return Integer::New(player->channel()); | |
418 | + } | |
419 | + } | |
420 | + | |
421 | + return Undefined(); | |
422 | +} | |
423 | + | |
424 | +Handle<Value> Card::Function_Account_updateChannel(const Arguments& args) | |
425 | +{ | |
426 | + auto self = static_cast<Card*>(args.Holder()->GetPointerFromInternalField(0)); | |
427 | + | |
428 | + if (args.Length() >= 1 && args[0]->IsNumber()) { | |
429 | + | |
430 | + int channel = args[0]->ToInteger()->Int32Value(); | |
431 | + | |
432 | + if (channel >= 0 && channel <= UCHAR_MAX) { | |
433 | + if (auto command_manager = self->manager_accessor_->command_manager().lock()) { | |
434 | + auto channel_str = network::Utils::Serialize((unsigned char)channel); | |
435 | + command_manager->Write(network::ServerUpdateAccountProperty(CHANNEL, channel_str)); | |
436 | + } | |
437 | + } | |
438 | + } | |
439 | + | |
440 | + return Undefined(); | |
441 | +} | |
442 | + | |
406 | 443 | |
407 | 444 | Handle<Value> Card::Function_Screen_width(const Arguments& args) |
408 | 445 | { |
@@ -931,6 +968,26 @@ void Card::SetFunctions() | ||
931 | 968 | script_.SetFunction("Account.updateTrip", Function_Account_updateTrip); |
932 | 969 | |
933 | 970 | /** |
971 | + * 現在のチャンネルを返します | |
972 | + * | |
973 | + * @method channel | |
974 | + * @return {Integer} チャンネル | |
975 | + * | |
976 | + * @static | |
977 | + */ | |
978 | + script_.SetFunction("Account.channel", Function_Account_channel); | |
979 | + | |
980 | + /** | |
981 | + * 現在のチャンネルを設定します | |
982 | + * | |
983 | + * @method updateChannel | |
984 | + * @param {Integer} channel チャンネル | |
985 | + * | |
986 | + * @static | |
987 | + */ | |
988 | + script_.SetFunction("Account.updateChannel", Function_Account_updateChannel); | |
989 | + | |
990 | + /** | |
934 | 991 | * カード |
935 | 992 | * |
936 | 993 | * @class Card |
@@ -33,6 +33,7 @@ id_(id), | ||
33 | 33 | name_(""), |
34 | 34 | model_name_(""), |
35 | 35 | login_(false), |
36 | +channel_(0), | |
36 | 37 | revision_(0) |
37 | 38 | { |
38 | 39 | name_tip_image_handle_ = ResourceManager::LoadCachedDivGraph<4>( |
@@ -291,6 +292,14 @@ Handle<Value> Player::Function_Player_login(const Arguments& args) | ||
291 | 292 | return Boolean::New(self->login_); |
292 | 293 | } |
293 | 294 | |
295 | +Handle<Value> Player::Function_Player_channel(const Arguments& args) | |
296 | +{ | |
297 | + assert(args.This()->InternalFieldCount() > 0); | |
298 | + auto self = *static_cast<PlayerPtr*>(args.This()->GetPointerFromInternalField(0)); | |
299 | + assert(self); | |
300 | + return Integer::New(self->channel_); | |
301 | +} | |
302 | + | |
294 | 303 | Handle<Value> Player::Function_Player_setBalloonContent(const Arguments& args) |
295 | 304 | { |
296 | 305 |
@@ -386,6 +395,13 @@ void Player::RegisterFunctionTemplate(Handle<FunctionTemplate>& func) | ||
386 | 395 | */ |
387 | 396 | object->Set(String::New("login"), FunctionTemplate::New(Function_Player_login)); |
388 | 397 | |
398 | + /** | |
399 | + * プレイヤーチャンネルを返します | |
400 | + * | |
401 | + * @method channel | |
402 | + * @return {Integer} ログインしている時trueを返します | |
403 | + */ | |
404 | + object->Set(String::New("channel"), FunctionTemplate::New(Function_Player_channel)); | |
389 | 405 | |
390 | 406 | /** |
391 | 407 | * プレイヤーの頭上の吹き出しに表示する内容を設定します |
@@ -541,6 +557,16 @@ void Player::set_model_name(const std::string& trip) | ||
541 | 557 | model_name_ = trip; |
542 | 558 | } |
543 | 559 | |
560 | +std::string Player::current_model_name() const | |
561 | +{ | |
562 | + return current_model_name_; | |
563 | +} | |
564 | + | |
565 | +void Player::set_current_model_name(const std::string& model_name) | |
566 | +{ | |
567 | + current_model_name_ = model_name; | |
568 | +} | |
569 | + | |
544 | 570 | bool Player::login() const |
545 | 571 | { |
546 | 572 | return login_; |
@@ -551,6 +577,16 @@ void Player::set_login(bool login) | ||
551 | 577 | login_ = login; |
552 | 578 | } |
553 | 579 | |
580 | +unsigned char Player::channel() const | |
581 | +{ | |
582 | + return channel_; | |
583 | +} | |
584 | + | |
585 | +void Player::set_channel(unsigned char channel) | |
586 | +{ | |
587 | + channel_ = channel; | |
588 | +} | |
589 | + | |
554 | 590 | uint32_t Player::revision() const |
555 | 591 | { |
556 | 592 | return revision_; |
@@ -52,6 +52,7 @@ class Player : public std::enable_shared_from_this<Player> { | ||
52 | 52 | static Handle<Value> Function_Player_name(const Arguments& args); |
53 | 53 | static Handle<Value> Function_Player_trip(const Arguments& args); |
54 | 54 | static Handle<Value> Function_Player_login(const Arguments& args); |
55 | + static Handle<Value> Function_Player_channel(const Arguments& args); | |
55 | 56 | static Handle<Value> Function_Player_setBalloonContent(const Arguments& args); |
56 | 57 | static Handle<Value> Function_Player_position(const Arguments& args); |
57 | 58 |
@@ -65,12 +66,19 @@ class Player : public std::enable_shared_from_this<Player> { | ||
65 | 66 | void set_trip(const std::string& trip); |
66 | 67 | std::string model_name() const; |
67 | 68 | void set_model_name(const std::string& model_name); |
69 | + | |
68 | 70 | bool login() const; |
69 | 71 | void set_login(bool login); |
72 | + unsigned char channel() const; | |
73 | + void set_channel(unsigned char channel); | |
74 | + | |
70 | 75 | uint32_t revision() const; |
71 | 76 | void set_revision(uint32_t revision); |
72 | 77 | const PlayerPosition& position() const; |
73 | 78 | void set_position(const PlayerPosition& pos); |
79 | + | |
80 | + std::string current_model_name() const; | |
81 | + void set_current_model_name(const std::string& model_name); | |
74 | 82 | |
75 | 83 | std::string ip_address() const; |
76 | 84 | void set_ip_address(const std::string& ip_address); |
@@ -88,8 +96,9 @@ class Player : public std::enable_shared_from_this<Player> { | ||
88 | 96 | unsigned int id_; |
89 | 97 | std::string name_; |
90 | 98 | std::string trip_; |
91 | - std::string model_name_; | |
99 | + std::string model_name_, current_model_name_; | |
92 | 100 | bool login_; |
101 | + unsigned char channel_; | |
93 | 102 | unsigned int revision_; |
94 | 103 | PlayerPosition pos_; |
95 | 104 |
@@ -49,7 +49,7 @@ Handle<Value> UIList::Function_addItem(const Arguments& args) | ||
49 | 49 | if (args.This() != child) { |
50 | 50 | UIBasePtr child_ptr = *static_cast<UIBasePtr*>(child->GetPointerFromInternalField(0)); |
51 | 51 | child_ptr->set_parent(args.This()); |
52 | - self->items_.push_back(Persistent<Object>::New(child)); | |
52 | + self->items_.push_back(child_ptr); | |
53 | 53 | } |
54 | 54 | } |
55 | 55 | return args.This(); |
@@ -64,10 +64,9 @@ Handle<Value> UIList::Function_removeItem(const Arguments& args) | ||
64 | 64 | assert(self); |
65 | 65 | |
66 | 66 | if (args.Length() > 0 && args[0]->IsObject()) { |
67 | - auto child = args[0]->ToObject(); | |
68 | - auto it = std::find(self->items_.begin(), self->items_.end(), child); | |
67 | + auto it = std::find(self->items_.begin(), self->items_.end(), self); | |
69 | 68 | if (it != self->items_.end()) { |
70 | - UIBasePtr chid_ptr = *static_cast<UIBasePtr*>((*it)->GetPointerFromInternalField(0)); | |
69 | + UIBasePtr chid_ptr = *it; | |
71 | 70 | chid_ptr->set_parent(Handle<Object>()); |
72 | 71 | self->items_.erase(it); |
73 | 72 | } |
@@ -84,7 +83,7 @@ Handle<Value> UIList::Function_clearItems(const Arguments& args) | ||
84 | 83 | assert(self); |
85 | 84 | |
86 | 85 | BOOST_FOREACH(auto it, self->items_) { |
87 | - UIBasePtr chid_ptr = *static_cast<UIBasePtr*>(it->GetPointerFromInternalField(0)); | |
86 | + UIBasePtr chid_ptr = it; | |
88 | 87 | chid_ptr->set_parent(Handle<Object>()); |
89 | 88 | } |
90 | 89 | self->items_.clear(); |
@@ -159,9 +158,7 @@ void UIList::DefineInstanceTemplate(Handle<ObjectTemplate>* object) | ||
159 | 158 | |
160 | 159 | void UIList::ProcessInput(InputManager* input) |
161 | 160 | { |
162 | - for (auto it = items_.begin(); it != items_.end(); ++it) { | |
163 | - auto item = *it; | |
164 | - UIBasePtr item_ptr = *static_cast<UIBasePtr*>(item->GetPointerFromInternalField(0)); | |
161 | + BOOST_FOREACH (UIBasePtr& item_ptr, items_) { | |
165 | 162 | if (input->GetMousePos().second > absolute_y() && |
166 | 163 | input->GetMousePos().second < absolute_y() + absolute_height()) { |
167 | 164 | item_ptr->ProcessInput(input); |
@@ -226,9 +223,7 @@ void UIList::Update() | ||
226 | 223 | |
227 | 224 | int content_height = 0; |
228 | 225 | int index = 0; |
229 | - for (auto it = items_.begin(); it != items_.end(); ++it) { | |
230 | - auto item = *it; | |
231 | - UIBasePtr item_ptr = *static_cast<UIBasePtr*>(item->GetPointerFromInternalField(0)); | |
226 | + BOOST_FOREACH (UIBasePtr& item_ptr, items_) { | |
232 | 227 | item_ptr->set_offset_y(offset_y - BASE_BLOCK_SIZE); |
233 | 228 | // item_ptr->set_offset_width(-18); |
234 | 229 | item_ptr->Update(); |
@@ -271,8 +266,7 @@ void UIList::Draw() | ||
271 | 266 | SetDrawArea(absolute_x(), absolute_y(), |
272 | 267 | absolute_x() + absolute_width(), absolute_y() + absolute_height()); |
273 | 268 | if (item_start_ >= 0) { |
274 | - for (int i = item_start_; i <= item_end_; i++) { | |
275 | - UIBasePtr item_ptr = *static_cast<UIBasePtr*>(items_[i]->GetPointerFromInternalField(0)); | |
269 | + BOOST_FOREACH (UIBasePtr& item_ptr, items_) { | |
276 | 270 | item_ptr->Draw(); |
277 | 271 | } |
278 | 272 | } |
@@ -33,7 +33,7 @@ class UIList : public UIBase { | ||
33 | 33 | private: |
34 | 34 | std::array<ImageHandlePtr,4> scrollbar_base_image_handle_; |
35 | 35 | |
36 | - std::vector<Persistent<Object>> items_; | |
36 | + std::vector<UIBasePtr> items_; | |
37 | 37 | |
38 | 38 | int scroll_y_, max_scroll_y_, scroll_y_target_; |
39 | 39 | int scrollbar_height_, scrollbar_y_; |
@@ -8,6 +8,7 @@ enum AccountProperty { | ||
8 | 8 | REVISION = 0x0, |
9 | 9 | PUBLIC_KEY = 0x1, |
10 | 10 | LOGIN = 0x2, |
11 | + CHANNEL = 0x3, | |
11 | 12 | NAME = 0xA3, |
12 | 13 | TRIP = 0xA4, |
13 | 14 | MODEL_NAME = 0xA5, |
@@ -136,7 +136,7 @@ ServerReceiveAccountInitializeData::ServerReceiveAccountInitializeData(const std | ||
136 | 136 | } |
137 | 137 | |
138 | 138 | ServerUpdateAccountProperty::ServerUpdateAccountProperty(AccountProperty property, const std::string& value) : |
139 | -Command(header::ServerUpdateAccountProperty, Utils::Serialize(property, value)) | |
139 | +Command(header::ServerUpdateAccountProperty, Utils::Serialize(property) + value) | |
140 | 140 | { |
141 | 141 | |
142 | 142 | } |
@@ -25,7 +25,8 @@ namespace network { | ||
25 | 25 | serialized_byte_sum_(0), |
26 | 26 | compressed_byte_sum_(0), |
27 | 27 | write_average_limit_(999999), |
28 | - id_(0) | |
28 | + id_(0), | |
29 | + channel_(0) | |
29 | 30 | { |
30 | 31 | |
31 | 32 | } |
@@ -129,6 +130,16 @@ namespace network { | ||
129 | 130 | id_ = id; |
130 | 131 | } |
131 | 132 | |
133 | + unsigned char Session::channel() const | |
134 | + { | |
135 | + return channel_; | |
136 | + } | |
137 | + | |
138 | + void Session::set_channel(unsigned char channel) | |
139 | + { | |
140 | + channel_ = channel; | |
141 | + } | |
142 | + | |
132 | 143 | bool Session::online() const |
133 | 144 | { |
134 | 145 | return online_; |
@@ -60,6 +60,9 @@ namespace network { | ||
60 | 60 | void set_id(UserID id); |
61 | 61 | bool online() const; |
62 | 62 | |
63 | + unsigned char channel() const; | |
64 | + void set_channel(unsigned char channel); | |
65 | + | |
63 | 66 | std::string global_ip() const; |
64 | 67 | uint16_t udp_port() const; |
65 | 68 | void set_global_ip(const std::string& global_ip); |
@@ -118,6 +121,7 @@ namespace network { | ||
118 | 121 | int write_average_limit_; |
119 | 122 | |
120 | 123 | UserID id_; |
124 | + unsigned char channel_; | |
121 | 125 | }; |
122 | 126 | |
123 | 127 | } |
@@ -78,9 +78,9 @@ std::string Account::GetUserRevisionPatch(UserID user_id, uint32_t revision) | ||
78 | 78 | |
79 | 79 | PropertyMap& property_map = usermap_it->second; |
80 | 80 | |
81 | - for (auto it = property_map.begin(); it != property_map.end(); ++it) { | |
82 | - if (it->second.revision > revision) { | |
83 | - patch += network::Utils::Serialize((uint16_t)it->first) + it->second.value; | |
81 | + BOOST_FOREACH (auto& property, property_map) { | |
82 | + if (property.second.revision > revision) { | |
83 | + patch += network::Utils::Serialize((uint16_t)property.first) + property.second.value; | |
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -261,6 +261,18 @@ uint32_t Account::GetUserRevision(UserID user_id) const | ||
261 | 261 | return revision; |
262 | 262 | } |
263 | 263 | |
264 | +void Account::SetUserChannel(UserID user_id, unsigned char channel) | |
265 | +{ | |
266 | + Set(user_id, CHANNEL, channel); | |
267 | +} | |
268 | + | |
269 | +unsigned char Account::GetUserChannel(UserID user_id) const | |
270 | +{ | |
271 | + unsigned char channel = 0; | |
272 | + Get(user_id, CHANNEL, &channel); | |
273 | + return channel; | |
274 | +} | |
275 | + | |
264 | 276 | void Account::SetUserPosition(UserID user_id, const PlayerPosition& pos) |
265 | 277 | { |
266 | 278 | auto it = position_map_.find(user_id); |
@@ -48,6 +48,9 @@ class Account { | ||
48 | 48 | uint16_t GetUserUDPPort(UserID) const; |
49 | 49 | void SetUserUDPPort(UserID, uint16_t); |
50 | 50 | uint32_t GetUserRevision(UserID) const; |
51 | + | |
52 | + void SetUserChannel(UserID, unsigned char); | |
53 | + unsigned char GetUserChannel(UserID) const; | |
51 | 54 | |
52 | 55 | void SetUserPosition(UserID, const PlayerPosition&); |
53 | 56 | PlayerPosition GetUserPosition(UserID) const; |
@@ -153,21 +153,29 @@ namespace network { | ||
153 | 153 | Logger::Info("Active connection: %d", GetUserCount()); |
154 | 154 | } |
155 | 155 | |
156 | - void Server::SendAll(const Command& command) | |
156 | + void Server::SendAll(const Command& command, int channel, bool limited) | |
157 | 157 | { |
158 | 158 | BOOST_FOREACH(SessionWeakPtr& ptr, sessions_) { |
159 | 159 | if (auto session = ptr.lock()) { |
160 | - session->Send(command); | |
160 | + if (channel < 0 || (channel >= 0 && session->channel() == channel)) { | |
161 | + if (!limited || session->write_average_limit() > session->GetWriteByteAverage()) { | |
162 | + session->Send(command); | |
163 | + } | |
164 | + } | |
161 | 165 | } |
162 | 166 | } |
163 | 167 | } |
164 | 168 | |
165 | - void Server::SendAllLimited(const Command& command) | |
169 | + void Server::SendOthers(const Command& command, uint32_t self_id, int channel, bool limited) | |
166 | 170 | { |
167 | 171 | BOOST_FOREACH(SessionWeakPtr& ptr, sessions_) { |
168 | 172 | if (auto session = ptr.lock()) { |
169 | - if (session->write_average_limit() > session->GetWriteByteAverage()) { | |
170 | - session->Send(command); | |
173 | + if (channel < 0 || (channel >= 0 && session->channel() == channel)) { | |
174 | + if (!limited || session->write_average_limit() > session->GetWriteByteAverage()) { | |
175 | + if (session->id() != self_id) { | |
176 | + session->Send(command); | |
177 | + } | |
178 | + } | |
171 | 179 | } |
172 | 180 | } |
173 | 181 | } |
@@ -185,34 +193,6 @@ namespace network { | ||
185 | 193 | } |
186 | 194 | } |
187 | 195 | |
188 | - void Server::SendOthers(const Command& command, SessionWeakPtr self_ptr) | |
189 | - { | |
190 | - BOOST_FOREACH(SessionWeakPtr& ptr, sessions_) { | |
191 | - if (auto session = ptr.lock()) { | |
192 | - if (auto self = self_ptr.lock()) { | |
193 | - if (*session != *self) { | |
194 | - session->Send(command); | |
195 | - } | |
196 | - } | |
197 | - } | |
198 | - } | |
199 | - } | |
200 | - | |
201 | - void Server::SendOthersLimited(const Command& command, SessionWeakPtr self_ptr) | |
202 | - { | |
203 | - BOOST_FOREACH(SessionWeakPtr& ptr, sessions_) { | |
204 | - if (auto session = ptr.lock()) { | |
205 | - if (auto self = self_ptr.lock()) { | |
206 | - if (*session != *self) { | |
207 | - if (session->write_average_limit() > session->GetWriteByteAverage()) { | |
208 | - session->Send(command); | |
209 | - } | |
210 | - } | |
211 | - } | |
212 | - } | |
213 | - } | |
214 | - } | |
215 | - | |
216 | 196 | void Server::SendUDPTestPacket(const std::string& ip_address, uint16_t port) |
217 | 197 | { |
218 | 198 | using boost::asio::ip::udp; |
@@ -30,11 +30,10 @@ class Server { | ||
30 | 30 | void Start(CallbackFuncPtr callback); |
31 | 31 | void Stop(); |
32 | 32 | void Stop(int interrupt_type); |
33 | - void SendAll(const Command&); | |
34 | - void SendAllLimited(const Command& command); | |
33 | + | |
34 | + void SendAll(const Command&, int channel = -1, bool limited = false); | |
35 | + void SendOthers(const Command&, uint32_t self_id, int channel = -1, bool limited = false); | |
35 | 36 | void SendTo(const Command&, uint32_t); |
36 | - void SendOthers(const Command&, SessionWeakPtr); | |
37 | - void SendOthersLimited(const Command&, SessionWeakPtr); | |
38 | 37 | |
39 | 38 | bool Empty() const; |
40 | 39 | std::string GetStatusJSON() const; |
@@ -108,7 +108,7 @@ int main(int argc, char* argv[]) | ||
108 | 108 | server.SendTo(send_command, user_id); |
109 | 109 | } |
110 | 110 | } else { |
111 | - server.SendAll(send_command); | |
111 | + server.SendAll(send_command, session->channel()); | |
112 | 112 | } |
113 | 113 | |
114 | 114 | Logger::Info("Receive JSON: %s", message_json.str()); |
@@ -124,8 +124,8 @@ int main(int argc, char* argv[]) | ||
124 | 124 | PlayerPosition pos; |
125 | 125 | network::Utils::Deserialize(c.body(), &pos.x, &pos.y, &pos.z, &pos.theta, &pos.vy); |
126 | 126 | account.SetUserPosition(session->id(), pos); |
127 | - server.SendOthersLimited(network::ClientUpdatePlayerPosition(session->id(), | |
128 | - pos.x,pos.y,pos.z,pos.theta, pos.vy), c.session()); | |
127 | + server.SendOthers(network::ClientUpdatePlayerPosition(session->id(), | |
128 | + pos.x,pos.y,pos.z,pos.theta, pos.vy), session->id(), session->channel(), true); | |
129 | 129 | } |
130 | 130 | } |
131 | 131 | break; |
@@ -237,7 +237,7 @@ int main(int argc, char* argv[]) | ||
237 | 237 | |
238 | 238 | server.SendOthers( |
239 | 239 | network::ClientReceiveAccountRevisionUpdateNotify(session->id(), |
240 | - account.GetUserRevision(session->id())), c.session()); | |
240 | + account.GetUserRevision(session->id())), session->id()); | |
241 | 241 | |
242 | 242 | Logger::Info(msg); |
243 | 243 | } |
@@ -265,8 +265,8 @@ int main(int argc, char* argv[]) | ||
265 | 265 | { |
266 | 266 | if (auto session = c.session().lock()) { |
267 | 267 | AccountProperty property; |
268 | - std::string value; | |
269 | - network::Utils::Deserialize(c.body(), &property, &value); | |
268 | + std::string buffer = c.body().substr(sizeof(AccountProperty)); | |
269 | + network::Utils::Deserialize(c.body(), &property); | |
270 | 270 | |
271 | 271 | auto old_revision = account.GetUserRevision(session->id()); |
272 | 272 |
@@ -274,17 +274,24 @@ int main(int argc, char* argv[]) | ||
274 | 274 | |
275 | 275 | case NAME: |
276 | 276 | { |
277 | - account.SetUserName(session->id(), value); | |
277 | + account.SetUserName(session->id(), buffer); | |
278 | 278 | } |
279 | 279 | break; |
280 | 280 | case TRIP: |
281 | 281 | { |
282 | - account.SetUserTrip(session->id(), value); | |
282 | + account.SetUserTrip(session->id(), buffer); | |
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case MODEL_NAME: |
286 | 286 | { |
287 | - account.SetUserModelName(session->id(), value); | |
287 | + account.SetUserModelName(session->id(), buffer); | |
288 | + } | |
289 | + break; | |
290 | + case CHANNEL: | |
291 | + { | |
292 | + unsigned char value; | |
293 | + network::Utils::Deserialize(buffer, &value); | |
294 | + account.SetUserChannel(session->id(), value); | |
288 | 295 | } |
289 | 296 | break; |
290 | 297 | default: |
@@ -8,10 +8,10 @@ | ||
8 | 8 | #define MMO_VERSION_TOSTRING(val) MMO_VERSION_TOSTRING_(val) |
9 | 9 | |
10 | 10 | #define MMO_VERSION_MAJOR 0 |
11 | -#define MMO_VERSION_MINOR 1 | |
12 | -#define MMO_VERSION_REVISION 9 | |
11 | +#define MMO_VERSION_MINOR 2 | |
12 | +#define MMO_VERSION_REVISION 0 | |
13 | 13 | |
14 | -#define MMO_PROTOCOL_VERSION 2 | |
14 | +#define MMO_PROTOCOL_VERSION 3 | |
15 | 15 | |
16 | 16 | #ifdef MMO_VERSION_BUILD |
17 | 17 | #define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD) |