Added /#time <int> command to server for changing the time of day
authorPerttu Ahola <celeron55@gmail.com>
Mon, 25 Apr 2011 08:55:07 +0000 (11:55 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 25 Apr 2011 08:55:07 +0000 (11:55 +0300)
src/server.cpp

index 20a14fca3ffffff87fe0e82fb942770f1fb22479..9c02389e23cb7943efe9a9608190be89cc280530 100644 (file)
@@ -2833,7 +2833,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                                line += L"status ";
                                if(is_operator)
                                {
-                                       line += L"shutdown setting ";
+                                       line += L"shutdown setting time ";
                                }
                                else
                                {
@@ -2867,6 +2867,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                                        send_to_sender = true;
                                        valid_command = true;
                                }
+                               else if(message_s.substr(0,5) == "time ")
+                               {
+                                       u32 time = stoi(message_s.substr(5));
+                                       m_time_of_day.set(time);
+                                       m_time_of_day_send_timer = 0;
+                                       line += L"-!- time_of_day changed.";
+                                       send_to_sender = true;
+                                       valid_command = true;
+                               }
                        }
                        
                        if(valid_command == false)