• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Commit MetaInfo

Revision9c10091ded711f53b225362a6bbeebf926f3468d (tree)
Zeit2012-09-14 00:50:13
Autorh2so5 <h2so5@git....>
Commiterh2so5

Log Message

コマンド受信時に落ちる問題が直っていなかったのを修正
チャットコマンドにダイス機能を追加

Ändern Zusammenfassung

Diff

--- a/client/Client.cpp
+++ b/client/Client.cpp
@@ -250,12 +250,13 @@ void Client::Close()
250250 std::shared_ptr<Command> Client::PopCommand()
251251 {
252252 boost::mutex::scoped_lock lock(mutex_);
253- std::shared_ptr<Command> command;
253+ std::shared_ptr<Command> command_ptr;
254254 if (!command_queue_.empty()) {
255- command = std::make_shared<Command>(command_queue_.front());
255+ Command command = command_queue_.front();
256+ command_ptr = std::make_shared<Command>(command);
256257 command_queue_.pop();
257258 }
258- return command;
259+ return command_ptr;
259260 }
260261
261262 bool Client::command_empty()
--- a/client/bin/cards/textchat/main.js
+++ b/client/bin/cards/textchat/main.js
@@ -94,6 +94,21 @@ Player.onLogout = function(player) {
9494 // チャットメッセージ送信
9595 InputBox.onEnter = function (text) {
9696
97+ //サイコロ用
98+ var dice_parsed_text = text.match(/^\/(\d+)[Dd](\d+)/)
99+ if (dice_parsed_text) {
100+ var time = dice_parsed_text[1]
101+ var size = dice_parsed_text[2]
102+ var msg = "【ダイス /" + time + "D" + size + "】\n "
103+ for (var i = 0; i < time; i++) {
104+ msg += Number.random(1, size) + ", "
105+ }
106+
107+ var msgObject = { body: msg };
108+ Network.sendAll(msgObject);
109+ return;
110+ }
111+
97112 // コマンドを解析
98113 var parsed_text = text.match(/^\/(\w{1,8})\s?(\S*)/)
99114 if (parsed_text) {
@@ -117,13 +132,19 @@ InputBox.onEnter = function (text) {
117132 case "escape":
118133 Player.escape();
119134 break;
135+
136+ // リロード
120137 case "reload":
121138 Model.rebuild();
122139 break;
140+
141+ // システム
123142 case "system":
124143 var msgObject = { system: args.trim() };
125144 Network.sendAll(msgObject);
126145 break;
146+
147+ // プライベート
127148 case "private":
128149 args.trim();
129150 var tok = args.split(" ");