[Orxonox-commit 1981] r6698 - in code/branches/chat/src/orxonox: . graphics
smerkli at orxonox.net
smerkli at orxonox.net
Mon Apr 12 17:08:27 CEST 2010
Author: smerkli
Date: 2010-04-12 17:08:27 +0200 (Mon, 12 Apr 2010)
New Revision: 6698
Modified:
code/branches/chat/src/orxonox/CMakeLists.txt
code/branches/chat/src/orxonox/ChatHistory.cc
code/branches/chat/src/orxonox/ChatHistory.h
code/branches/chat/src/orxonox/graphics/CMakeLists.txt
Log:
ChatHistory is not being constructed, no idea why.
Modified: code/branches/chat/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/chat/src/orxonox/CMakeLists.txt 2010-04-12 15:04:07 UTC (rev 6697)
+++ code/branches/chat/src/orxonox/CMakeLists.txt 2010-04-12 15:08:27 UTC (rev 6698)
@@ -31,6 +31,7 @@
PawnManager.cc
PlayerManager.cc
Radar.cc
+ ChatHistory.cc
COMPILATION_BEGIN SceneCompilation.cc
CameraManager.cc
Scene.cc
Modified: code/branches/chat/src/orxonox/ChatHistory.cc
===================================================================
--- code/branches/chat/src/orxonox/ChatHistory.cc 2010-04-12 15:04:07 UTC (rev 6697)
+++ code/branches/chat/src/orxonox/ChatHistory.cc 2010-04-12 15:08:27 UTC (rev 6698)
@@ -27,21 +27,24 @@
*/
#include "ChatHistory.h"
+#include "core/ScopedSingletonManager.h"
-#ifndef TEST
+#ifndef CHATTEST
namespace orxonox
{
+ /* singleton */
+ ManageScopedSingleton( ChatHistory, ScopeID::Root, false );
#endif
/* constructor */
-#ifndef TEST
+#ifndef CHATTEST
ChatHistory(BaseObject* creator) : BaseObject(creator)
#else
ChatHistory::ChatHistory()
#endif
{
/* register the object */
-#ifndef TEST
+#ifndef CHATTEST
RegisterObject(ChatHistory);
#endif
@@ -55,6 +58,8 @@
this->chat_hist_logline( "--- Logfile opened ---" );
}
+ assert(0);
+
/* Read setting for maximum number of lines and set limit */
this->hist_maxlines = 200; /* NOTE to be changed, 200 is just for testing */
}
@@ -75,7 +80,9 @@
/* --> a) look up the actual name of the sender */
std::string text;
-#ifndef TEST
+ COUT(0) << "Meow.\n";
+
+#ifndef CHATTEST
if (senderID != CLIENTID_UNKNOWN)
{
std::string name = "unknown";
@@ -103,6 +110,7 @@
{
//if( this->hist_logfile )
//this->hist_logfile.sync();
+ return 0;
}
/* add a line to this history */
@@ -114,6 +122,7 @@
/* push to the front of the history */
this->hist_buffer.push_back( toadd );
+ return 0;
}
/* log a line to a logfile */
@@ -122,6 +131,7 @@
/* output the line to the file if logging is enabled */
if( this->hist_log_enabled )
this->hist_logfile << toadd << std::endl;
+ return 0;
}
/* open logfile */
@@ -130,7 +140,7 @@
/* TODO: find out the name of the file to log to via settings
* and set the this->hist_logfile_path variable to it
*/
-#ifndef TEST
+#ifndef CHATTEST
this->hist_logfile.open( PathConfig::getInstance().getLogPathString() +
"chatlog.log",
std::fstream::out | std::fstream::app );
@@ -142,7 +152,7 @@
/* TODO check whether this works (not sure how you'd like it?) */
if( !this->hist_logfile )
{ this->hist_log_enabled = false;
-#ifndef TEST
+#ifndef CHATTEST
COUT(2) << "Warning: Could not open logfile." << std::endl;
#endif
}
@@ -175,6 +185,6 @@
std::cout << "Size: " << hist_buffer.size() << std::endl;
}
-#ifndef TEST
+#ifndef CHATTEST
}
#endif
Modified: code/branches/chat/src/orxonox/ChatHistory.h
===================================================================
--- code/branches/chat/src/orxonox/ChatHistory.h 2010-04-12 15:04:07 UTC (rev 6697)
+++ code/branches/chat/src/orxonox/ChatHistory.h 2010-04-12 15:08:27 UTC (rev 6698)
@@ -30,13 +30,15 @@
#include <string>
#include <fstream>
#include <iostream>
+#include <cassert>
/* define this if you're unit testing */
-#define TEST 1
+#define CHATTEST 0
-#ifndef TEST
+#ifndef CHATTEST
#include <core/BaseObject.h>
#include <core/PathConfig.h>
+#include <Singleton.h>
#endif
#ifndef _ChatHistory_H__
@@ -44,22 +46,25 @@
/* Class to implement chat history */
-#ifndef TEST
+#ifndef CHATTEST
namespace orxonox
{
#endif
/* constructor */
-#ifndef TEST
- class _OrxonoxExport ChatHistory : public BaseObject, public ChatListener
+#ifndef CHATTEST
+ class _OrxonoxExport ChatHistory : public BaseObject, public ChatListener,
+ public Singleton<ChatHistory>
+
#else
class ChatHistory
#endif
{
public:
/* constructors, destructors */
-#ifndef TEST
+#ifndef CHATTEST
ChatHistory(BaseObject* creator);
+ friend class Singleton<ChatHistory>;
#else
ChatHistory();
#endif
@@ -101,6 +106,9 @@
/** Output file stream for logfile */
std::ofstream hist_logfile;
+#ifndef CHATTEST
+ static ChatHistory* singletonPtr_s;
+#endif
@@ -130,7 +138,7 @@
void chat_hist_closelog();
};
-#ifndef TEST
+#ifndef CHATTEST
}
#endif
Modified: code/branches/chat/src/orxonox/graphics/CMakeLists.txt
===================================================================
--- code/branches/chat/src/orxonox/graphics/CMakeLists.txt 2010-04-12 15:04:07 UTC (rev 6697)
+++ code/branches/chat/src/orxonox/graphics/CMakeLists.txt 2010-04-12 15:08:27 UTC (rev 6698)
@@ -1,7 +1,6 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
Billboard.cc
BlinkingBillboard.cc
- ChatBox.cc
FadingBillboard.cc
GlobalShader.cc
Model.cc
More information about the Orxonox-commit
mailing list