rpms/scorched3d/FC-4 scorched3d-64bit.patch, NONE, 1.1 scorched3d-HTML-injection.patch, NONE, 1.1 scorched3d-XML-injection.patch, NONE, 1.1 scorched3d-aclocal18.patch, NONE, 1.1 scorched3d-cvs-20050929.patch, NONE, 1.1 scorched3d-formatstring.patch, NONE, 1.1 scorched3d-gcc41.patch, NONE, 1.1 scorched3d-help.patch, NONE, 1.1 scorched3d-negint.patch, NONE, 1.1 scorched3d-openal.patch, NONE, 1.1 scorched3d-opengl-without-context.patch, NONE, 1.1 scorched3d-pgsql.patch, NONE, 1.1 scorched3d-sprintf.patch, NONE, 1.1 scorched3d-strxxx.patch, NONE, 1.1
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Tue Feb 14 22:02:55 UTC 2006
- Previous message: rpms/scorched3d/FC-4 scorched3d-syslibs.patch, 1.1, 1.2 scorched3d.spec, 1.5, 1.6
- Next message: rpms/apcupsd/FC-4 .cvsignore, 1.3, 1.4 apcupsd.spec, 1.4, 1.5 sources, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jwrdegoede
Update of /cvs/extras/rpms/scorched3d/FC-4
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30712
Added Files:
scorched3d-64bit.patch scorched3d-HTML-injection.patch
scorched3d-XML-injection.patch scorched3d-aclocal18.patch
scorched3d-cvs-20050929.patch scorched3d-formatstring.patch
scorched3d-gcc41.patch scorched3d-help.patch
scorched3d-negint.patch scorched3d-openal.patch
scorched3d-opengl-without-context.patch scorched3d-pgsql.patch
scorched3d-sprintf.patch scorched3d-strxxx.patch
Log Message:
* Mon Feb 13 2006 Hans de Goede <j.w.r.degoede at hhs.nl> - 39.1-4
- Bump release and rebuild for new gcc4.1 and glibc.
* Sun Feb 12 2006 <j.w.r.degoede at hhs.nl> - 39.1-3
- fix server crashing with certain landscape types (patch 13)
* Sat Feb 11 2006 <j.w.r.degoede at hhs.nl> - 39.1-2
- upgrade to CVS snapshot of 20050929, as Debian does, but not to
the newer apoc version as this causes problems playing online (patch 0)
- fix gcc41 compilation (patch 3)
- fix 64 bit compilation (bz 158646) (patch 4)
- fix compile with openal-0.9 (patch 5)
- use htmlview for helpfile viewing instead of hardcoded mozilla,
run this in background so the game doesn't freeze (patch 6)
- fix all the security issues reported on the fulldisclosure mailinglist:
http://seclists.org/lists/fulldisclosure/2005/Nov/0079.html
(bz 161694) (patch 7, 8, 9, 10)
- fix 2 additonal security issues found while fixing the above (patch 11, 12)
- this release also fixes bz 161694
* Sat Oct 8 2005 Ville Skyttä <ville.skytta at iki.fi> - 39.1-1
- 39.1.
- Avoid aclocal >= 1.8 warnings.
- Install icon into icons/hicolor.
- Clean up build dependencies.
scorched3d-64bit.patch:
--- NEW FILE scorched3d-64bit.patch ---
diff -ur scorched.orig/src/client/ClientConnectionAcceptHandler.cpp scorched/src/client/ClientConnectionAcceptHandler.cpp
--- scorched.orig/src/client/ClientConnectionAcceptHandler.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/client/ClientConnectionAcceptHandler.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -66,7 +66,9 @@
if (OptionsParam::instance()->getConnectedToServer())
{
- unsigned int ip = NetServer::getIpAddress((TCPsocket) id);
+ NetServer *netServer = (NetServer *)
+ ScorchedClient::instance()->getContext().netInterface;
+ unsigned int ip = netServer->getIpAddress(id);
if (!ConnectDialog::instance()->getIdStore().saveUniqueId(
ip, message.getUniqueId(), message.getPublishAddress()))
{
diff -ur scorched.orig/src/client/ServerBrowser.cpp scorched/src/client/ServerBrowser.cpp
--- scorched.orig/src/client/ServerBrowser.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/client/ServerBrowser.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -50,7 +50,7 @@
int ServerBrowser::threadFunc(void *var)
{
- bool lan = (bool) (int(var)==1);
+ bool lan = (bool) (long(var)==1);
bool result = false;
if (lan) result = instance_->serverList_.fetchLANList();
else result = instance_->serverList_.fetchServerList();
diff -ur scorched.orig/src/coms/NetServer.cpp scorched/src/coms/NetServer.cpp
--- scorched.orig/src/coms/NetServer.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServer.cpp 2006-02-09 16:48:09.000000000 +0100
@@ -33,6 +33,7 @@
{
sockSet_ = SDLNet_AllocSocketSet(1);
setMutex_ = SDL_CreateMutex();
+ lastId_ = 0;
SDL_CreateThread(NetServer::threadFunc, (void *) this);
}
@@ -66,7 +67,8 @@
{
NetMessage *message = (delayedMessages_.front()).second;
delayedMessages_.pop_front();
- sendMessage((TCPsocket) message->getDestinationId(), message);
+ sendMessage(getServerRead(message->getDestinationId()),
+ message);
}
}
@@ -184,27 +185,25 @@
bool NetServer::pollDeleted()
{
SDL_LockMutex(setMutex_);
- std::list<TCPsocket> remove;
- std::map<TCPsocket, NetServerRead *>::iterator itor;
+ std::list<unsigned int> remove;
+ std::map<unsigned int, NetServerRead *>::iterator itor;
for (itor = connections_.begin();
itor != connections_.end();
itor++)
{
NetServerRead *serverRead = (*itor).second;
- TCPsocket socket = (*itor).first;
if (serverRead->getDisconnect())
{
delete serverRead;
- remove.push_back(socket);
+ remove.push_back((*itor).first);
}
}
- std::list<TCPsocket>::iterator itor2;
+ std::list<unsigned int>::iterator itor2;
for (itor2 = remove.begin();
itor2 != remove.end();
itor2++)
{
- TCPsocket socket = (*itor2);
- connections_.erase(socket);
+ connections_.erase((*itor2));
}
SDL_UnlockMutex(setMutex_);
return true;
@@ -212,13 +211,25 @@
void NetServer::addClient(TCPsocket client)
{
+ std::map<unsigned int, NetServerRead *>::iterator itor;
+
+ // Find a free ID
+ SDL_LockMutex(setMutex_);
+ do {
+ lastId_++;
+ /* ID 0 == broadcast so don't use it */
+ if (lastId_ == 0)
+ lastId_++;
+ itor = connections_.find(lastId_);
+ } while (itor != connections_.end());
+
// Create the thread to read this socket
- NetServerRead *serverRead = new NetServerRead(
- client, protocol_, &messageHandler_, &checkDeleted_, sentNotification_);
+ NetServerRead *serverRead = new NetServerRead(client, lastId_,
+ protocol_, &messageHandler_, &checkDeleted_,
+ sentNotification_);
// Add this to the collection of sockets (connections)
- SDL_LockMutex(setMutex_);
- connections_[client] = serverRead;
+ connections_[lastId_] = serverRead;
firstDestination_ = (*connections_.begin()).first;
SDL_UnlockMutex(setMutex_);
@@ -228,27 +238,23 @@
void NetServer::disconnectAllClients()
{
+ std::map<unsigned int, NetServerRead *>::iterator itor;
SDL_LockMutex(setMutex_);
- std::map<TCPsocket, NetServerRead *>::iterator itor;
for (itor = connections_.begin();
itor != connections_.end();
itor++)
{
- TCPsocket sock = (*itor).first;
- disconnectClient((unsigned int) sock);
+ disconnectClient((*itor).first);
}
SDL_UnlockMutex(setMutex_);
}
void NetServer::disconnectClient(unsigned int dest, bool delayed)
{
- TCPsocket client = (TCPsocket) dest;
- DIALOG_ASSERT(client);
-
+ NetServerRead *serverRead = getServerRead(dest);
NetMessage *message = NetMessagePool::instance()->
getFromPool(NetMessage::DisconnectMessage,
- (unsigned int) client,
- getIpAddress(client));
+ dest, getIpAddress(serverRead));
if (delayed)
{
@@ -258,26 +264,22 @@
else
{
// Add the message to the list of out going
- sendMessage(client, message);
+ sendMessage(serverRead, message);
}
}
void NetServer::sendMessage(NetBuffer &buffer)
{
- sendMessage(buffer, (unsigned int) firstDestination_);
+ sendMessage(buffer, firstDestination_);
}
void NetServer::sendMessage(NetBuffer &buffer, unsigned int dest)
-
{
- TCPsocket destination = (TCPsocket) dest;
- DIALOG_ASSERT(destination);
-
+ NetServerRead *serverRead = getServerRead(dest);
// Get a new buffer from the pool
NetMessage *message = NetMessagePool::instance()->
- getFromPool(NetMessage::NoMessage,
- (unsigned int) destination,
- getIpAddress(destination));
+ getFromPool(NetMessage::NoMessage, dest,
+ getIpAddress(serverRead));
// Add message to new buffer
message->getBuffer().allocate(buffer.getBufferUsed());
@@ -286,28 +288,37 @@
message->getBuffer().setBufferUsed(buffer.getBufferUsed());
// Send Mesage
- sendMessage(destination, message);
+ sendMessage(serverRead, message);
}
-void NetServer::sendMessage(TCPsocket client, NetMessage *message)
+void NetServer::sendMessage(NetServerRead *serverRead, NetMessage *message)
{
- // Find the client
- SDL_LockMutex(setMutex_);
- std::map<TCPsocket, NetServerRead *>::iterator itor =
- connections_.find(client);
- if (itor != connections_.end())
+ if (serverRead)
{
// Add the message to the list of out going
- NetServerRead *serverRead = (*itor).second;
serverRead->addMessage(message);
}
else
- {
NetMessagePool::instance()->addToPool(message);
- Logger::log( "Unknown sendMessage destination %i",
- (int) client);
+}
+
+NetServerRead *NetServer::getServerRead(unsigned int dest)
+{
+ NetServerRead *serverRead = 0;
+
+ if (dest)
+ {
+ SDL_LockMutex(setMutex_);
+ std::map<unsigned int, NetServerRead *>::iterator itor =
+ connections_.find(dest);
+ if (itor != connections_.end())
+ serverRead = (*itor).second;
+ else
+ Logger::log( "Unknown destination %u", dest);
+ SDL_UnlockMutex(setMutex_);
}
- SDL_UnlockMutex(setMutex_);
+
+ return serverRead;
}
unsigned int NetServer::getIpAddress(TCPsocket destination)
@@ -324,3 +335,14 @@
return addr;
}
+unsigned int NetServer::getIpAddress(NetServerRead *serverRead)
+{
+ if (serverRead == 0) return 0;
+
+ return getIpAddress(serverRead->getSocket());
+}
+
+unsigned int NetServer::getIpAddress(unsigned int destination)
+{
+ return getIpAddress(getServerRead(destination));
+}
diff -ur scorched.orig/src/coms/NetServer.h scorched/src/coms/NetServer.h
--- scorched.orig/src/coms/NetServer.h 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServer.h 2006-02-09 16:48:14.000000000 +0100
@@ -47,28 +47,32 @@
virtual void sendMessage(NetBuffer &buffer, unsigned int destination);
void setSentNotification() { sentNotification_ = true; }
+ unsigned int getIpAddress(unsigned int destination);
static unsigned int getIpAddress(TCPsocket destination);
protected:
NetServerProtocol *protocol_;
TCPsocket server_;
- TCPsocket firstDestination_;
+ unsigned int firstDestination_;
SDLNet_SocketSet sockSet_;
- std::map<TCPsocket, NetServerRead *> connections_;
+ std::map<unsigned int, NetServerRead *> connections_;
std::list<std::pair<float, NetMessage *> > delayedMessages_;
Clock delayedClock_;
SDL_mutex *setMutex_;
NetMessageHandler messageHandler_;
bool checkDeleted_;
bool sentNotification_;
+ unsigned int lastId_;
static int threadFunc(void *);
bool pollIncoming();
bool pollDeleted();
void addClient(TCPsocket client);
- void sendMessage(TCPsocket client, NetMessage *message);
-
+ void sendMessage(NetServerRead *serverRead, NetMessage *message);
+ NetServerRead *getServerRead(unsigned int dest);
+ unsigned int getIpAddress(NetServerRead *serverRead);
+
private:
NetServer(const NetServer &);
Only in scorched/src/coms: NetServer.h~
diff -ur scorched.orig/src/coms/NetServerProtocol.cpp scorched/src/coms/NetServerProtocol.cpp
--- scorched.orig/src/coms/NetServerProtocol.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServerProtocol.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -40,7 +40,8 @@
{
}
-bool NetServerScorchedProtocol::sendBuffer(NetBuffer &buffer, TCPsocket socket)
+bool NetServerScorchedProtocol::sendBuffer(NetBuffer &buffer,
+ TCPsocket socket, unsigned int socketId)
{
Uint32 len = buffer.getBufferUsed();
Uint32 netlen=0;
@@ -94,7 +95,8 @@
return true;
}
-NetMessage *NetServerScorchedProtocol::readBuffer(TCPsocket socket)
+NetMessage *NetServerScorchedProtocol::readBuffer(TCPsocket socket,
+ unsigned int socketId)
{
// receive the length of the string message
char lenbuf[4];
@@ -125,8 +127,7 @@
// allocate the buffer memory
NetMessage *buffer = NetMessagePool::instance()->
getFromPool(NetMessage::BufferMessage,
- (unsigned int) socket,
- NetServer::getIpAddress(socket));
+ socketId, NetServer::getIpAddress(socket));
buffer->getBuffer().allocate(len);
buffer->getBuffer().setBufferUsed(len);
@@ -153,7 +154,8 @@
{
}
-bool NetServerCompressedProtocol::sendBuffer(NetBuffer &buffer, TCPsocket socket)
+bool NetServerCompressedProtocol::sendBuffer(NetBuffer &buffer,
+ TCPsocket socket, unsigned int socketId)
{
unsigned long destLen = buffer.getBufferUsed() * 2;
unsigned long srcLen = buffer.getBufferUsed();
@@ -161,8 +163,7 @@
// Allocate a new buffer
NetMessage *newMessage = NetMessagePool::instance()->
getFromPool(NetMessage::BufferMessage,
- (unsigned int) socket,
- NetServer::getIpAddress(socket));
+ socketId, NetServer::getIpAddress(socket));
NetBuffer &newBuffer = newMessage->getBuffer();
newBuffer.allocate(destLen);
@@ -185,7 +186,8 @@
//Logger::log( "Compressed %i->%i",
// buffer.getBufferUsed(), newBuffer.getBufferUsed());
- retVal = NetServerScorchedProtocol::sendBuffer(newBuffer, socket);
+ retVal = NetServerScorchedProtocol::sendBuffer(newBuffer,
+ socket, socketId);
}
else
{
@@ -197,10 +199,12 @@
return retVal;
}
-NetMessage *NetServerCompressedProtocol::readBuffer(TCPsocket socket)
+NetMessage *NetServerCompressedProtocol::readBuffer(TCPsocket socket,
+ unsigned int socketId)
{
// Read the message from the socket
- NetMessage *message = NetServerScorchedProtocol::readBuffer(socket);
+ NetMessage *message = NetServerScorchedProtocol::readBuffer(socket,
+ socketId);
if (message)
{
// Get the uncompressed size from the buffer
@@ -268,7 +272,8 @@
{
}
-bool NetServerHTTPProtocolSend::sendBuffer(NetBuffer &buffer, TCPsocket socket)
+bool NetServerHTTPProtocolSend::sendBuffer(NetBuffer &buffer,
+ TCPsocket socket, unsigned int socketId)
{
Uint32 len = buffer.getBufferUsed();
@@ -286,13 +291,13 @@
return true;
}
-NetMessage *NetServerHTTPProtocolSend::readBuffer(TCPsocket socket)
+NetMessage *NetServerHTTPProtocolSend::readBuffer(TCPsocket socket,
+ unsigned int socketId)
{
// allocate the buffer memory
NetMessage *netBuffer = NetMessagePool::instance()->
getFromPool(NetMessage::BufferMessage,
- (unsigned int) socket,
- NetServer::getIpAddress(socket));
+ socketId, NetServer::getIpAddress(socket));
netBuffer->getBuffer().reset();
// get the string buffer over the socket
@@ -331,7 +336,8 @@
{
}
-bool NetServerHTTPProtocolRecv::sendBuffer(NetBuffer &buffer, TCPsocket socket)
+bool NetServerHTTPProtocolRecv::sendBuffer(NetBuffer &buffer,
+ TCPsocket socket, unsigned int socketId)
{
Uint32 len = buffer.getBufferUsed();
@@ -349,13 +355,13 @@
return true;
}
-NetMessage *NetServerHTTPProtocolRecv::readBuffer(TCPsocket socket)
+NetMessage *NetServerHTTPProtocolRecv::readBuffer(TCPsocket socket,
+ unsigned int socketId)
{
// allocate the buffer memory
NetMessage *netBuffer = NetMessagePool::instance()->
getFromPool(NetMessage::BufferMessage,
- (unsigned int) socket,
- NetServer::getIpAddress(socket));
+ socketId, NetServer::getIpAddress(socket));
netBuffer->getBuffer().reset();
// get the string buffer over the socket
diff -ur scorched.orig/src/coms/NetServerProtocol.h scorched/src/coms/NetServerProtocol.h
--- scorched.orig/src/coms/NetServerProtocol.h 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServerProtocol.h 2006-02-09 14:47:28.000000000 +0100
@@ -29,8 +29,10 @@
NetServerProtocol();
virtual ~NetServerProtocol();
- virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket) = 0;
- virtual NetMessage *readBuffer(TCPsocket socket) = 0;
+ virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket,
+ unsigned int socketId) = 0;
+ virtual NetMessage *readBuffer(TCPsocket socket,
+ unsigned int socketId) = 0;
};
class NetServerScorchedProtocol : public NetServerProtocol
@@ -39,8 +41,10 @@
NetServerScorchedProtocol();
virtual ~NetServerScorchedProtocol();
- virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket);
- virtual NetMessage *readBuffer(TCPsocket socket);
+ virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket,
+ unsigned int socketId);
+ virtual NetMessage *readBuffer(TCPsocket socket,
+ unsigned int socketId);
};
class NetServerCompressedProtocol : public NetServerScorchedProtocol
@@ -49,8 +53,10 @@
NetServerCompressedProtocol();
virtual ~NetServerCompressedProtocol();
- virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket);
- virtual NetMessage *readBuffer(TCPsocket socket);
+ virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket,
+ unsigned int socketId);
+ virtual NetMessage *readBuffer(TCPsocket socket,
+ unsigned int socketId);
};
class NetServerHTTPProtocolSend : public NetServerProtocol
@@ -59,8 +65,10 @@
NetServerHTTPProtocolSend();
virtual ~NetServerHTTPProtocolSend();
- virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket);
- virtual NetMessage *readBuffer(TCPsocket socket);
+ virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket,
+ unsigned int socketId);
+ virtual NetMessage *readBuffer(TCPsocket socket,
+ unsigned int socketId);
};
class NetServerHTTPProtocolRecv : public NetServerProtocol
@@ -69,8 +77,10 @@
NetServerHTTPProtocolRecv();
virtual ~NetServerHTTPProtocolRecv();
- virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket);
- virtual NetMessage *readBuffer(TCPsocket socket);
+ virtual bool sendBuffer(NetBuffer &buffer, TCPsocket socket,
+ unsigned int socketId);
+ virtual NetMessage *readBuffer(TCPsocket socket,
+ unsigned int socketId);
};
#endif
diff -ur scorched.orig/src/coms/NetServerRead.cpp scorched/src/coms/NetServerRead.cpp
--- scorched.orig/src/coms/NetServerRead.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServerRead.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -26,11 +26,12 @@
#include <common/Defines.h>
NetServerRead::NetServerRead(TCPsocket socket,
+ unsigned int socketId,
NetServerProtocol *protocol,
NetMessageHandler *messageHandler,
bool *checkDeleted,
bool sentNotification) :
- socket_(socket), sockSet_(0), protocol_(protocol),
+ socket_(socket), socketId_(socketId), sockSet_(0), protocol_(protocol),
outgoingMessagesMutex_(0), checkDeleted_(checkDeleted),
disconnect_(false), messageHandler_(messageHandler),
sentDisconnect_(false), startCount_(0),
@@ -64,8 +65,7 @@
// Send the player connected notification
NetMessage *message = NetMessagePool::instance()->
getFromPool(NetMessage::ConnectMessage,
- (unsigned int) socket_,
- NetServer::getIpAddress(socket_));
+ socketId_, NetServer::getIpAddress(socket_));
messageHandler_->addMessage(message);
recvThread_ = SDL_CreateThread(
@@ -96,8 +96,7 @@
sentDisconnect_ = true;
NetMessage *message = NetMessagePool::instance()->
getFromPool(NetMessage::DisconnectMessage,
- (unsigned int) socket_,
- NetServer::getIpAddress(socket_));
+ socketId_, NetServer::getIpAddress(socket_));
messageHandler_->addMessage(message);
}
SDL_UnlockMutex(outgoingMessagesMutex_);
@@ -189,9 +188,9 @@
if (timeDiff > 15.0f)
{
Logger::log(
- "Warning: %s net loop took %.2f seconds, client %i",
+ "Warning: %s net loop took %.2f seconds, client %u",
(send?"Send":"Recv"),
- timeDiff, (unsigned int) socket_);
+ timeDiff, socketId_);
}
}
@@ -201,8 +200,7 @@
sentDisconnect_ = true;
NetMessage *message = NetMessagePool::instance()->
getFromPool(NetMessage::DisconnectMessage,
- (unsigned int) socket_,
- NetServer::getIpAddress(socket_));
+ socketId_, NetServer::getIpAddress(socket_));
messageHandler_->addMessage(message);
}
SDL_UnlockMutex(outgoingMessagesMutex_);
@@ -220,7 +218,8 @@
if(SDLNet_SocketReady(socket_))
{
- NetMessage *message = protocol_->readBuffer(socket_);
+ NetMessage *message = protocol_->readBuffer(socket_,
+ socketId_);
if (!message)
{
Logger::log( "Client socket has been closed.");
@@ -263,7 +262,8 @@
}
else
{
- if (!protocol_->sendBuffer(message->getBuffer(), socket_))
+ if (!protocol_->sendBuffer(message->getBuffer(),
+ socket_, socketId_))
{
Logger::log( "Failed to send message to client");
result = false;
@@ -276,7 +276,7 @@
{
NetMessage *notification = NetMessagePool::instance()->
getFromPool(NetMessage::SentMessage,
- (unsigned int) socket_,
+ socketId_,
NetServer::getIpAddress(socket_));
messageHandler_->addMessage(notification);
}
diff -ur scorched.orig/src/coms/NetServerRead.h scorched/src/coms/NetServerRead.h
--- scorched.orig/src/coms/NetServerRead.h 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/coms/NetServerRead.h 2006-02-09 14:47:28.000000000 +0100
@@ -28,6 +28,7 @@
{
public:
NetServerRead(TCPsocket socket,
+ unsigned int socketId,
NetServerProtocol *protocol,
NetMessageHandler *messageHandler,
bool *checkDeleted,
@@ -37,12 +38,14 @@
void start();
bool getDisconnect();
void addMessage(NetMessage *message);
+ TCPsocket getSocket() { return socket_; }
protected:
bool *checkDeleted_;
bool disconnect_, sentDisconnect_;
bool sentNotification_;
TCPsocket socket_;
+ unsigned int socketId_;
SDLNet_SocketSet sockSet_;
NetServerProtocol *protocol_;
NetMessageHandler *messageHandler_;
diff -ur scorched.orig/src/dialogs/HelpButtonDialog.cpp scorched/src/dialogs/HelpButtonDialog.cpp
--- scorched.orig/src/dialogs/HelpButtonDialog.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/dialogs/HelpButtonDialog.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -160,7 +160,7 @@
void HelpButtonDialog::itemSelected(GLWSelectorEntry *entry, int position)
{
- int data = (int) entry->getUserData();
+ long data = (long) entry->getUserData();
if (data != -1)
{
int volume = int(float(data) * 12.8f);
diff -ur scorched.orig/src/engine/ScorchedCollisionHandler.cpp scorched/src/engine/ScorchedCollisionHandler.cpp
--- scorched.orig/src/engine/ScorchedCollisionHandler.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/engine/ScorchedCollisionHandler.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -93,7 +93,7 @@
}
ShotBounce *particle = (ShotBounce *) bounceInfo->data;
- unsigned int id = (unsigned int) otherInfo->data;
+ unsigned int id = (unsigned long) otherInfo->data;
// only collide with the ground, walls or landscape,
// or iteself
@@ -217,7 +217,7 @@
otherInfo = (ScorchedCollisionInfo *) dGeomGetData(o1);
}
- unsigned int id = (unsigned int) otherInfo->data;
+ unsigned int id = (unsigned long) otherInfo->data;
ShotProjectile *shot = (ShotProjectile *) particleInfo->data;
shot->incLandedCounter();
Vector particlePositionV(
diff -ur scorched.orig/src/ode/config.h scorched/src/ode/config.h
--- scorched.orig/src/ode/config.h 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/ode/config.h 2006-02-09 14:47:28.000000000 +0100
@@ -81,7 +81,7 @@
/* an integer type that we can safely cast a pointer to and from without
* loss of bits.
*/
-typedef unsigned int intP;
+typedef unsigned long intP;
/* if we're compiling on a pentium, we may need to know the clock rate so
diff -ur scorched.orig/src/scorched/SettingsDialog.cpp scorched/src/scorched/SettingsDialog.cpp
--- scorched.orig/src/scorched/SettingsDialog.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/scorched/SettingsDialog.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -748,44 +748,44 @@
// Env
{
- context_.setWindForce((OptionsGame::WindForce) (int)
+ context_.setWindForce((OptionsGame::WindForce) (long)
SettingsEnv::IDC_COMBO_FORCE_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_FORCE_CTRL->GetSelection()));
- context_.setWindType((OptionsGame::WindType) (int)
+ context_.setWindType((OptionsGame::WindType) (long)
SettingsEnv::IDC_COMBO_WINDCHANGES_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_WINDCHANGES_CTRL->GetSelection()));
- context_.setWallType((OptionsGame::WallType) (int)
+ context_.setWallType((OptionsGame::WallType) (long)
SettingsEnv::IDC_COMBO_WALLTYPE_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_WALLTYPE_CTRL->GetSelection()));
- context_.setWeapScale((OptionsGame::WeapScale) (int)
+ context_.setWeapScale((OptionsGame::WeapScale) (long)
SettingsEnv::IDC_COMBO_WEAPONSCALE_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_WEAPONSCALE_CTRL->GetSelection()));
- context_.setStartArmsLevel((int)
+ context_.setStartArmsLevel((long)
SettingsEnv::IDC_COMBO_STARTARMSLEVEL_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_STARTARMSLEVEL_CTRL->GetSelection()));
- context_.setEndArmsLevel((int)
+ context_.setEndArmsLevel((long)
SettingsEnv::IDC_COMBO_ENDARMSLEVEL_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_ENDARMSLEVEL_CTRL->GetSelection()));
- context_.setMinFallingDistance((int)
+ context_.setMinFallingDistance((long)
SettingsEnv::IDC_COMBO_FALLINGDISTANCE_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_FALLINGDISTANCE_CTRL->GetSelection()));
- context_.setMaxClimbingDistance((int)
+ context_.setMaxClimbingDistance((long)
SettingsEnv::IDC_COMBO_CLIMBINGDISTANCE_CTRL->GetClientData(
SettingsEnv::IDC_COMBO_CLIMBINGDISTANCE_CTRL->GetSelection()));
context_.setGiveAllWeapons(
SettingsEnv::IDC_GIVEALLWEAPONS_CTRL->GetValue());
- context_.setResignMode((OptionsGame::ResignType) (int)
+ context_.setResignMode((OptionsGame::ResignType) (long)
SettingsEnv::IDC_RESIGNENDROUND_CTRL->GetClientData(
SettingsEnv::IDC_RESIGNENDROUND_CTRL->GetSelection()));
- context_.setMovementRestriction((OptionsGame::MovementRestrictionType) (int)
+ context_.setMovementRestriction((OptionsGame::MovementRestrictionType) (long)
SettingsEnv::IDC_MOVEMENTRESTRICTION_CTRL->GetClientData(
SettingsEnv::IDC_MOVEMENTRESTRICTION_CTRL->GetSelection()));
}
@@ -809,10 +809,10 @@
int downloadSpeed = 0;
int keepAliveTime = 0;
- context_.setTurnType((OptionsGame::TurnType) (int)
+ context_.setTurnType((OptionsGame::TurnType) (long)
SettingsMain::IDC_TYPE_CTRL->GetClientData(
SettingsMain::IDC_TYPE_CTRL->GetSelection()));
- context_.setTeamBallance((OptionsGame::TeamBallanceType) (int)
+ context_.setTeamBallance((OptionsGame::TeamBallanceType) (long)
SettingsMain::IDC_TEAMBALLANCE_CTRL->GetClientData(
SettingsMain::IDC_TEAMBALLANCE_CTRL->GetSelection()));
context_.setTeams((int) SettingsMain::IDC_TEAMS_CTRL->GetSelection() + 1);
diff -ur scorched.orig/src/server/ServerConnectHandler.cpp scorched/src/server/ServerConnectHandler.cpp
--- scorched.orig/src/server/ServerConnectHandler.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/server/ServerConnectHandler.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -87,7 +87,9 @@
}
// Get the ip address
- ipAddress = NetServer::getIpAddress((TCPsocket) destinationId);
+ NetServer *netServer = (NetServer *)
+ ScorchedServer::instance()->getContext().netInterface;
+ ipAddress = netServer->getIpAddress(destinationId);
}
// Decode the connect message
diff -ur scorched.orig/src/tankgraph/GLWTankTip.cpp scorched/src/tankgraph/GLWTankTip.cpp
--- scorched.orig/src/tankgraph/GLWTankTip.cpp 2006-02-09 14:52:14.000000000 +0100
+++ scorched/src/tankgraph/GLWTankTip.cpp 2006-02-09 14:47:28.000000000 +0100
@@ -66,7 +66,7 @@
void TankUndoMenu::itemSelected(GLWSelectorEntry *entry, int position)
{
- tank_->getPhysics().revertSettings((unsigned int) entry->getUserData());
+ tank_->getPhysics().revertSettings((unsigned long) entry->getUserData());
}
TankFuelTip::TankFuelTip(Tank *tank) :
@@ -170,7 +170,7 @@
void TankBatteryTip::itemSelected(GLWSelectorEntry *entry, int position)
{
TankAIHuman *tankAI = (TankAIHuman *) tank_->getTankAI();
- for (int i=1; i<=(int) entry->getUserData(); i++)
+ for (int i=1; i<=(long) entry->getUserData(); i++)
{
if (tank_->getState().getLife() < 100.0f)
{
scorched3d-HTML-injection.patch:
--- NEW FILE scorched3d-HTML-injection.patch ---
--- scorched/src/server/ServerWebHandler.cpp.injection 2006-02-11 18:43:38.000000000 +0100
+++ scorched/src/server/ServerWebHandler.cpp 2006-02-11 19:05:51.000000000 +0100
@@ -33,6 +33,7 @@
#include <tank/TankContainer.h>
#include <tankai/TankAIStore.h>
#include <tankai/TankAIAdder.h>
+#include <XML/XMLParser.h>
static const char *getField(std::map<std::string, std::string> &fields, const char *field)
{
@@ -117,6 +118,9 @@
for (itor = tanks.begin(); itor != tanks.end(); itor++)
{
Tank *tank = (*itor).second;
+ std::string cleanName;
+ std::string dirtyName(tank->getName());
+ XMLParser::removeSpecialChars(dirtyName, cleanName);
players += formatString(
"<tr>"
"<td>dest=%i ip=%s id=%i</td>" // Id
@@ -129,7 +133,7 @@
"<td><input type=\"checkbox\" name=\"player-%u\"></td>" // Select
"</tr>\n",
tank->getDestinationId(), NetInterface::getIpName(tank->getIpAddress()), tank->getPlayerId(),
- tank->getName(),
+ cleanName.c_str(),
tank->getTankAI()?tank->getTankAI()->getName():"Human",
tank->getScore().getTimePlayedString(),
tank->getScore().getScoreString(),
@@ -178,13 +182,15 @@
int max = MIN((int) entries.size(), start + pagesize);
for (int i=min; i<max; i++)
{
+ std::string cleanText;
+ XMLParser::removeSpecialChars(entries[i].text, cleanText);
log += formatString(
"<tr>"
"<td><font size=-2>%u</font></td>"
"<td><font size=-2>%s</font></td>"
"</tr>\n",
i,
- entries[i].text.c_str());
+ cleanText.c_str());
}
fields["LOG"] = log;
@@ -335,7 +341,9 @@
textsListItor != textsList.end();
textsListItor++)
{
- texts += (*textsListItor);
+ std::string cleanText;
+ XMLParser::removeSpecialChars((*textsListItor), cleanText);
+ texts += cleanText;
texts += "<br>\n";
}
fields["TEXTS"] = texts;
@@ -375,11 +383,13 @@
if (selected && 0 == strcmp(selected, ipName.c_str()))
entry.type = ServerBanned::NotBanned;
+ std::string cleanName;
+ XMLParser::removeSpecialChars(entry.name, cleanName);
banned += formatString("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>"
"<td><input type=\"checkbox\" name=\"selected\" value=\"%s\"></td>" // Select
"</tr>",
(entry.bantime?ctime(&entry.bantime):""),
- entry.name.c_str(),
+ cleanName.c_str(),
entry.uniqueid.c_str(),
ServerBanned::getBannedTypeStr(entry.type),
ipName.c_str(), mask.c_str(),
@@ -407,8 +417,11 @@
itor++)
{
ModFileEntry *entry = (*itor).second;
+ std::string cleanFileName;
+ std::string dirtyFileName(entry->getFileName());
+ XMLParser::removeSpecialChars(dirtyFileName, cleanFileName);
modfiles += formatString("<tr><td>%s</td><td>%u</td><td>%u</td><td>%u</td></tr>",
- entry->getFileName(),
+ cleanFileName.c_str(),
entry->getCompressedSize(),
entry->getCompressedCrc(),
entry->getUncompressedSize());
scorched3d-XML-injection.patch:
--- NEW FILE scorched3d-XML-injection.patch ---
diff -ur scorched.orig/src/GLEXT/GLConsoleFileReader.cpp scorched/src/GLEXT/GLConsoleFileReader.cpp
--- scorched.orig/src/GLEXT/GLConsoleFileReader.cpp 2006-02-11 15:40:45.000000000 +0100
+++ scorched/src/GLEXT/GLConsoleFileReader.cpp 2006-02-11 15:45:05.000000000 +0100
@@ -23,6 +23,7 @@
#include <GLEXT/GLConsole.h>
#include <common/FileLines.h>
#include <XML/XMLFile.h>
+#include <XML/XMLParser.h>
#include <stdio.h>
bool GLConsoleFileReader::loadFileIntoConsole(const char *fileName,
@@ -62,15 +63,18 @@
itor != lines.end();
itor++)
{
- std::string string;
- const char *line = (*itor)->getLine();
+ std::string cleanLine;
+ std::string dirtyLine((*itor)->getLine());
+ XMLParser::removeSpecialChars(dirtyLine, cleanLine);
if ((*itor)->getLineType() != GLConsoleLine::eNone)
{
- filelines.addLine(" <command>%s</command>", line);
+ filelines.addLine(" <command>%s</command>",
+ cleanLine.c_str());
}
else
{
- filelines.addLine(" <!-- %s -->", line);
+ filelines.addLine(" <!-- %s -->",
+ cleanLine.c_str());
}
}
Only in scorched/src/GLEXT: GLConsoleFileReader.cpp~
diff -ur scorched.orig/src/XML/XMLParser.cpp scorched/src/XML/XMLParser.cpp
--- scorched.orig/src/XML/XMLParser.cpp 2006-02-11 15:40:45.000000000 +0100
+++ scorched/src/XML/XMLParser.cpp 2006-02-11 15:39:50.000000000 +0100
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <stdio.h>
-static void removeSpecialChars(std::string &content, std::string &result)
+void XMLParser::removeSpecialChars(std::string &content, std::string &result)
{
result = "";
for (char *c=(char *) content.c_str(); *c; c++)
@@ -174,7 +174,7 @@
DIALOG_ASSERT(node->type_ == XMLParameterType);
std::string newContent;
- removeSpecialChars(node->content_, newContent);
+ XMLParser::removeSpecialChars(node->content_, newContent);
params += " " + node->name_ + "='" + newContent + "'";
}
@@ -182,7 +182,7 @@
if (children_.empty())
{
std::string newContent;
- removeSpecialChars(content_, newContent);
+ XMLParser::removeSpecialChars(content_, newContent);
lines.addLine("%s<%s%s>%s</%s>",
getSpacer(spacing),
diff -ur scorched.orig/src/XML/XMLParser.h scorched/src/XML/XMLParser.h
--- scorched.orig/src/XML/XMLParser.h 2006-02-11 15:40:45.000000000 +0100
+++ scorched/src/XML/XMLParser.h 2006-02-11 15:39:50.000000000 +0100
@@ -121,6 +121,9 @@
void setSource(const char *source) { source_ = source; }
XMLNode *getRoot() { return root_; }
+ static void removeSpecialChars(std::string &content,
+ std::string &result);
+
protected:
XMLNode *root_;
XMLNode *current_;
diff -ur scorched.orig/src/weapons/EconomyFreeMarket.cpp scorched/src/weapons/EconomyFreeMarket.cpp
--- scorched.orig/src/weapons/EconomyFreeMarket.cpp 2006-02-11 15:40:45.000000000 +0100
+++ scorched/src/weapons/EconomyFreeMarket.cpp 2006-02-11 15:48:19.000000000 +0100
@@ -26,6 +26,7 @@
#include <common/OptionsGame.h>
#include <common/Logger.h>
#include <XML/XMLFile.h>
+#include <XML/XMLParser.h>
#include <tank/Tank.h>
#include <stdlib.h>
@@ -123,8 +124,11 @@
accessory->getStartingNumber() != -1 &&
accessory->getType() == AccessoryPart::AccessoryWeapon)
{
+ std::string cleanName;
+ std::string dirtyName(accessory->getName());
+ XMLParser::removeSpecialChars(dirtyName, cleanName);
file.addLine(" <accessory>");
- file.addLine(" <name>%s</name>", accessory->getName());
+ file.addLine(" <name>%s</name>", cleanName.c_str());
file.addLine(" <buyprice>%i</buyprice>", accessory->getPrice());
file.addLine(" </accessory>");
}
Only in scorched/src/weapons: EconomyFreeMarket.cpp~
scorched3d-aclocal18.patch:
--- NEW FILE scorched3d-aclocal18.patch ---
--- acinclude.m4~ 2004-05-26 15:01:15.000000000 +0300
+++ acinclude.m4 2005-10-08 00:45:36.000000000 +0300
@@ -8,7 +8,7 @@
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
dnl
-AC_DEFUN(AM_PATH_SDL,
+AC_DEFUN([AM_PATH_SDL],
[dnl
dnl Get the cflags and libraries from the sdl-config script
dnl
@@ -220,7 +220,7 @@
dnl command line options
dnl ---------------------------------------------------------------------------
-AC_DEFUN(AM_OPTIONS_WXCONFIG,
+AC_DEFUN([AM_OPTIONS_WXCONFIG],
[
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="")
@@ -243,7 +243,7 @@
dnl
dnl Get the cflags and libraries from the wx-config script
dnl
-AC_DEFUN(AM_PATH_WXCONFIG,
+AC_DEFUN([AM_PATH_WXCONFIG],
[
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
if test x${WX_CONFIG_NAME+set} != xset ; then
scorched3d-cvs-20050929.patch:
--- NEW FILE scorched3d-cvs-20050929.patch ---
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/autogen.sh scorched-cvs/autogen.sh
--- scorched/autogen.sh 2003-08-03 23:57:10.000000000 +0200
+++ scorched-cvs/autogen.sh 2005-09-29 17:28:35.000000000 +0200
@@ -2,4 +2,4 @@
aclocal
automake --foreign
autoconf
-./configure $*
+#./configure $*
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/3dsparse/MSModelFactory.cpp scorched-cvs/src/3dsparse/MSModelFactory.cpp
--- scorched/src/3dsparse/MSModelFactory.cpp 2005-04-12 00:19:08.000000000 +0200
+++ scorched-cvs/src/3dsparse/MSModelFactory.cpp 2005-09-22 17:14:27.000000000 +0200
@@ -304,7 +304,7 @@
if (textureName[1]) // as the string starts with a "
{
mesh->setTextureName(fullTextureName);
- if (!fileExists(fullTextureName))
+ if (!DefinesUtil::fileExists(fullTextureName))
{
returnError(fileName,
formatString("Failed to find texture \"%s\"",
@@ -314,7 +314,7 @@
if (textureNameAlpha[1])
{
mesh->setATextureName(fullTextureAlphaName);
- if (!fileExists(fullTextureAlphaName))
+ if (!DefinesUtil::fileExists(fullTextureAlphaName))
{
returnError(fileName,
formatString("Failed to find alpha texture \"%s\"",
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/3dsparse/ModelID.cpp scorched-cvs/src/3dsparse/ModelID.cpp
--- scorched/src/3dsparse/ModelID.cpp 2005-04-12 00:19:08.000000000 +0200
+++ scorched-cvs/src/3dsparse/ModelID.cpp 2005-09-22 17:14:27.000000000 +0200
@@ -76,7 +76,7 @@
const char *meshNameContent = meshNode->getContent();
static char meshName[1024];
sprintf(meshName, "%s/%s", directory, meshNameContent);
- if (!::wxFileExists(getDataFile(meshName)))
+ if (!DefinesUtil::fileExists(getDataFile(meshName)))
{
dialogMessage("Scorched Models",
"Mesh file \"%s\"does not exist",
@@ -90,7 +90,7 @@
if (strcmp(skinNameContent, "none") != 0)
{
sprintf(skinName, "%s/%s", directory, skinNameContent);
- if (!::wxFileExists(getDataFile(skinName)))
+ if (!DefinesUtil::fileExists(getDataFile(skinName)))
{
dialogMessage("Scorched Models",
"Skin file \"%s\" does not exist",
@@ -112,7 +112,7 @@
static char meshName[1024];
sprintf(meshName, "%s/%s", directory, meshNameContent);
- if (!::wxFileExists(getDataFile(meshName)))
+ if (!DefinesUtil::fileExists(getDataFile(meshName)))
{
dialogMessage("Scorched Models",
"Mesh file \"%s\"does not exist",
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/GLEXT/GLGif.cpp scorched-cvs/src/GLEXT/GLGif.cpp
--- scorched/src/GLEXT/GLGif.cpp 2005-07-13 14:51:49.000000000 +0200
+++ scorched-cvs/src/GLEXT/GLGif.cpp 2005-09-22 17:14:27.000000000 +0200
@@ -47,7 +47,7 @@
bool GLGif::loadFromFile(const char * filename)
{
- wxString file(filename);
+ wxString file(filename, wxConvUTF8);
wxFileInputStream ifStream(file);
if (!ifStream.Ok()) return false;
return loadFromStream(&ifStream);
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/GLEXT/GLState.h scorched-cvs/src/GLEXT/GLState.h
--- scorched/src/GLEXT/GLState.h 2005-06-07 23:50:43.000000000 +0200
+++ scorched-cvs/src/GLEXT/GLState.h 2005-09-18 11:59:33.000000000 +0200
@@ -27,6 +27,7 @@
#define AFX_GLSTATE_H__32B0E2D0_566D_4438_94E4_B12FE82430B1__INCLUDED_
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#undef __MACH__
#include <SDL/SDL_opengl.h>
#include <common/Defines.h>
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/GLW/GLWPlanView.cpp scorched-cvs/src/GLW/GLWPlanView.cpp
--- scorched/src/GLW/GLWPlanView.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched-cvs/src/GLW/GLWPlanView.cpp 2005-09-22 17:14:27.000000000 +0200
@@ -244,7 +244,9 @@
// Draw a line pointing where the current tank is looking
glBegin(GL_LINES);
glVertex2f(0.0f, 0.0f);
- glVertex2f(getFastSin(rot) * 0.07f, getFastCos(rot) * 0.07f);
+ glVertex2f(
+ DefinesUtil::getFastSin(rot) * 0.07f,
+ DefinesUtil::getFastCos(rot) * 0.07f);
glEnd();
glPopMatrix();
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/actions/Explosion.cpp scorched-cvs/src/actions/Explosion.cpp
--- scorched/src/actions/Explosion.cpp 2005-08-20 22:17:58.000000000 +0200
+++ scorched-cvs/src/actions/Explosion.cpp 2005-09-18 12:39:34.000000000 +0200
@@ -197,8 +197,6 @@
if (0 != strcmp(weapon_->getParent()->getName(), "Death's Head") || // Ooo nasty
RAND < 0.2f)
{
- Logger::log("Death...");
-
context_->actionController->addAction(
new SpriteAction(
new ExplosionNukeRenderer(position_, weapon_->getSize() - 2.0f)));
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/actions/TankResign.cpp scorched-cvs/src/actions/TankResign.cpp
--- scorched/src/actions/TankResign.cpp 2005-04-05 00:35:23.000000000 +0200
+++ scorched-cvs/src/actions/TankResign.cpp 2005-09-18 12:39:34.000000000 +0200
@@ -23,6 +23,7 @@
#include <tank/TankContainer.h>
#include <common/Defines.h>
#include <common/Logger.h>
+#include <common/LoggerI.h>
#include <common/OptionsParam.h>
REGISTER_ACTION_SOURCE(TankResign);
@@ -60,8 +61,10 @@
if (!context_->serverMode ||
OptionsParam::instance()->getDedicatedServer())
{
- Logger::log(
- "\"%s\" resigned from round", tank->getName());
+ LoggerInfo info(LoggerInfo::TypeDeath,
+ formatString("\"%s\" resigned from round", tank->getName()));
+ info.setPlayerId(playerId_);
+ Logger::log(info);
}
}
}
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/client/ClientConnectionAcceptHandler.cpp scorched-cvs/src/client/ClientConnectionAcceptHandler.cpp
--- scorched/src/client/ClientConnectionAcceptHandler.cpp 2005-06-27 02:55:47.000000000 +0200
+++ scorched-cvs/src/client/ClientConnectionAcceptHandler.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -109,7 +109,7 @@
}
// Set the mod
- setDataFileMod(
+ DefinesUtil::setDataFileMod(
ScorchedClient::instance()->getOptionsGame().getMod());
// Load any mod files we currently have for the mod
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/client/ClientKeepAliveSender.cpp scorched-cvs/src/client/ClientKeepAliveSender.cpp
--- scorched/src/client/ClientKeepAliveSender.cpp 2005-04-03 14:46:43.000000000 +0200
+++ scorched-cvs/src/client/ClientKeepAliveSender.cpp 2005-09-18 12:39:34.000000000 +0200
@@ -56,7 +56,7 @@
ScorchedClient::instance()->getOptionsGame().getKeepAliveTime();
unsigned int theTime = (unsigned int) time(0);
- if (theTime - lastSendTime_ > sendTime)
+ if (theTime - lastSendTime_ >= sendTime)
{
ComsKeepAliveMessage message;
ComsMessageSender::sendToServer(message);
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/client/ClientRmPlayerHandler.cpp scorched-cvs/src/client/ClientRmPlayerHandler.cpp
--- scorched/src/client/ClientRmPlayerHandler.cpp 2005-04-05 00:35:23.000000000 +0200
+++ scorched-cvs/src/client/ClientRmPlayerHandler.cpp 2005-09-18 12:39:34.000000000 +0200
@@ -61,12 +61,6 @@
{
Logger::log( "Failed to find player to remove");
}
- else
- {
- // Print out info about removed tank
- Logger::log( "Player disconnected \"%s\"",
- tank->getName());
- }
delete tank;
return true;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/client/ClientSave.cpp scorched-cvs/src/client/ClientSave.cpp
--- scorched/src/client/ClientSave.cpp 2005-08-20 22:17:58.000000000 +0200
+++ scorched-cvs/src/client/ClientSave.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -112,7 +112,9 @@
if (0 != strcmp(version.c_str(), ScorchedProtocolVersion))
{
dialogMessage("LoadGame",
- "ERROR: Saved file version %s does not match game version %s",
+ "ERROR: Saved file version does not match game version.\n"
+ "Saved version : %s\n"
+ "Current version : %s\n",
version.c_str(),
ScorchedProtocolVersion);
return false;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/client/TargetCamera.cpp scorched-cvs/src/client/TargetCamera.cpp
--- scorched/src/client/TargetCamera.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched-cvs/src/client/TargetCamera.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -304,8 +304,8 @@
case CamTank:
{
Vector newPos(
- getFastSin(currentRotation) * 8.0f,
- getFastCos(currentRotation) * 8.0f,
+ DefinesUtil::getFastSin(currentRotation) * 8.0f,
+ DefinesUtil::getFastCos(currentRotation) * 8.0f,
0.0f);
[...4288 lines suppressed...]
--- scorched/src/server/ServerBrowserInfo.cpp 2005-08-08 11:37:24.000000000 +0200
+++ scorched-cvs/src/server/ServerBrowserInfo.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -166,7 +166,7 @@
reply.push_back(addTag("round", formatString("%i/%i",
ScorchedServer::instance()->getOptionsTransient().getCurrentRoundNo(),
ScorchedServer::instance()->getOptionsGame().getNoRounds())));
- reply.push_back(addTag("os", osDesc.c_str()));
+ reply.push_back(addTag("os", osDesc.mb_str(wxConvUTF8)));
}
void ServerBrowserInfo::processInfoMessage(std::list<std::string> &reply)
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/server/ServerMain.cpp scorched-cvs/src/server/ServerMain.cpp
--- scorched/src/server/ServerMain.cpp 2005-06-20 02:35:08.000000000 +0200
+++ scorched-cvs/src/server/ServerMain.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -121,7 +121,7 @@
ServerDefenseHandler::instance();
// Set the mod
- setDataFileMod(
+ DefinesUtil::setDataFileMod(
ScorchedServer::instance()->getOptionsGame().getMod());
// Load mod
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/server/ServerMessageHandler.cpp scorched-cvs/src/server/ServerMessageHandler.cpp
--- scorched/src/server/ServerMessageHandler.cpp 2005-06-20 02:35:08.000000000 +0200
+++ scorched-cvs/src/server/ServerMessageHandler.cpp 2005-09-18 12:39:34.000000000 +0200
@@ -115,6 +115,8 @@
"Player disconnected dest=\"%i\" id=\"%i\" name=\"%s\"",
tank->getDestinationId(),
tankId, tank->getName());
+ ServerCommon::sendString(0, "Player disconnected \"%s\"",
+ tank->getName());
StatsLogger::instance()->tankDisconnected(tank);
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/server/ServerTextFilter.cpp scorched-cvs/src/server/ServerTextFilter.cpp
--- scorched/src/server/ServerTextFilter.cpp 2005-08-14 21:11:42.000000000 +0200
+++ scorched-cvs/src/server/ServerTextFilter.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -86,7 +86,7 @@
for (witor = words_.begin(); witor != words_.end(); witor++)
{
const char *word = (*witor).c_str();
- char *pos = my_stristr(text, word);
+ char *pos = DefinesUtil::my_stristr(text, word);
if (pos)
{
// If they do then * out the word
@@ -149,9 +149,9 @@
const char *filename =
getSettingsFile("filter-%i.txt",
ScorchedServer::instance()->getOptionsGame().getPortNo());
- if (!::wxFileExists(filename)) return;
+ if (!::DefinesUtil::fileExists(filename)) return;
- time_t fileTime = ::wxFileModificationTime(filename);
+ time_t fileTime = ::wxFileModificationTime(wxString(filename, wxConvUTF8));
if (fileTime == lastReadTime_) return;
FileLines lines;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/server/ServerTimedMessage.cpp scorched-cvs/src/server/ServerTimedMessage.cpp
--- scorched/src/server/ServerTimedMessage.cpp 2005-06-20 02:35:08.000000000 +0200
+++ scorched-cvs/src/server/ServerTimedMessage.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -76,9 +76,9 @@
const char *filename =
getSettingsFile("messages-%i.xml",
ScorchedServer::instance()->getOptionsGame().getPortNo());
- if (!::wxFileExists(filename)) return true;
+ if (!DefinesUtil::fileExists(filename)) return true;
- time_t fileTime = ::wxFileModificationTime(filename);
+ time_t fileTime = ::wxFileModificationTime(wxString(filename, wxConvUTF8));
if (fileTime == lastReadTime_) return true;
XMLFile file;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/sound/Sound.cpp scorched-cvs/src/sound/Sound.cpp
--- scorched/src/sound/Sound.cpp 2005-08-10 14:39:31.000000000 +0200
+++ scorched-cvs/src/sound/Sound.cpp 2005-09-18 11:59:33.000000000 +0200
@@ -86,6 +86,11 @@
instance_ = 0;
}
+static char *checkString(char *x)
+{
+ return (char *)(x?x:"null");
+}
+
bool Sound::init(int channels)
{
ALCdevice *soundDevice = alcOpenDevice(0);
@@ -113,16 +118,20 @@
alDistanceModel(AL_INVERSE_DISTANCE);
GLConsole::instance()->addLine(false, "AL_VENDOR:");
- GLConsole::instance()->addLine(false, (char *) alGetString(AL_VENDOR));
+ GLConsole::instance()->addLine(false,
+ checkString((char *) alGetString(AL_VENDOR)));
GLConsole::instance()->addLine(false, "AL_VERSION:");
- GLConsole::instance()->addLine(false, (char *) alGetString(AL_VERSION));
+ GLConsole::instance()->addLine(false,
+ checkString((char *) alGetString(AL_VERSION)));
GLConsole::instance()->addLine(false, "AL_RENDERER:");
- GLConsole::instance()->addLine(false, (char *) alGetString(AL_RENDERER));
+ GLConsole::instance()->addLine(false,
+ checkString((char *) alGetString(AL_RENDERER)));
GLConsole::instance()->addLine(false, "AL_EXTENSIONS:");
- GLConsole::instance()->addLine(false, (char *) alGetString(AL_EXTENSIONS));
+ GLConsole::instance()->addLine(false,
+ checkString((char *) alGetString(AL_EXTENSIONS)));
GLConsole::instance()->addLine(false, "ALC_DEVICE_SPECIFIER:");
- GLConsole::instance()->addLine(false, (char *)
- alcGetString(soundDevice, ALC_DEVICE_SPECIFIER));
+ GLConsole::instance()->addLine(false,
+ checkString((char *) alcGetString(soundDevice, ALC_DEVICE_SPECIFIER)));
// Create all sound channels
for (int i=1; i<=OptionsDisplay::instance()->getSoundChannels(); i++)
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/sound/SoundBuffer.cpp scorched-cvs/src/sound/SoundBuffer.cpp
--- scorched/src/sound/SoundBuffer.cpp 2005-07-18 00:27:13.000000000 +0200
+++ scorched-cvs/src/sound/SoundBuffer.cpp 2005-09-18 11:59:33.000000000 +0200
@@ -55,7 +55,13 @@
ALsizei size;
ALsizei freq;
ALboolean loop;
+
+#ifdef __DARWIN__
+ alutLoadWAVFile((ALbyte*) wavFileName,&format,&data,&size,&freq);
+#else
alutLoadWAVFile((ALbyte*) wavFileName,&format,&data,&size,&freq,&loop);
+#endif
+
if ((error_ = alGetError()) != AL_NO_ERROR)
{
return false;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/sprites/ExplosionNukeRenderer.cpp scorched-cvs/src/sprites/ExplosionNukeRenderer.cpp
--- scorched/src/sprites/ExplosionNukeRenderer.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched-cvs/src/sprites/ExplosionNukeRenderer.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -38,8 +38,8 @@
float width = RAND * 0.5f + 1.0f;
cloudRotation_ = RAND * 360.0f;
- rotation_[0] = getFastSin(rot) * width;
- rotation_[1] = getFastCos(rot) * width;
+ rotation_[0] = DefinesUtil::getFastSin(rot) * width;
+ rotation_[1] = DefinesUtil::getFastCos(rot) * width;
}
ExplosionNukeRendererEntry::~ExplosionNukeRendererEntry()
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/sprites/ExplosionTextures.cpp scorched-cvs/src/sprites/ExplosionTextures.cpp
--- scorched/src/sprites/ExplosionTextures.cpp 2004-11-22 22:30:40.000000000 +0100
+++ scorched-cvs/src/sprites/ExplosionTextures.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -194,7 +194,7 @@
}
const char *fileName = getDataFile(name);
- if (fileExists(fileName))
+ if (DefinesUtil::fileExists(fileName))
{
GLBitmap *map = new GLBitmap;
if (map->loadFromFile(fileName, false))
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/tankgraph/MissileMesh.cpp scorched-cvs/src/tankgraph/MissileMesh.cpp
--- scorched/src/tankgraph/MissileMesh.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched-cvs/src/tankgraph/MissileMesh.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -103,11 +103,19 @@
Vector &fpos = (*flareItor);
float newX = fpos[0];
- float newY = (fpos[1] * getFastCos(angYZRad)) - (fpos[2] * getFastSin(angYZRad));
- float newZ = (fpos[1] * getFastSin(angYZRad)) + (fpos[2] * getFastCos(angYZRad));
+ float newY =
+ (fpos[1] * DefinesUtil::getFastCos(angYZRad)) -
+ (fpos[2] * DefinesUtil::getFastSin(angYZRad));
+ float newZ =
+ (fpos[1] * DefinesUtil::getFastSin(angYZRad)) +
+ (fpos[2] * DefinesUtil::getFastCos(angYZRad));
- float newX2 = (newX * getFastCos(angXYRad)) - (newY * getFastSin(angXYRad));
- float newY2 = (newX * getFastSin(angXYRad)) + (newY * getFastCos(angXYRad));
+ float newX2 =
+ (newX * DefinesUtil::getFastCos(angXYRad)) -
+ (newY * DefinesUtil::getFastSin(angXYRad));
+ float newY2 =
+ (newX * DefinesUtil::getFastSin(angXYRad)) +
+ (newY * DefinesUtil::getFastCos(angXYRad));
float newZ2 = newZ;
Vector newPos;
diff -urN --exclude=CVS --exclude=Makefile --exclude=Makefile.in --exclude=autom4te.cache --exclude=aclocal.m4 --exclude=configure --exclude=config.status --exclude=borland --exclude=config.log --exclude=.deps scorched/src/weapons/WeaponTeleport.cpp scorched-cvs/src/weapons/WeaponTeleport.cpp
--- scorched/src/weapons/WeaponTeleport.cpp 2005-06-11 18:53:41.000000000 +0200
+++ scorched-cvs/src/weapons/WeaponTeleport.cpp 2005-09-22 17:14:28.000000000 +0200
@@ -65,8 +65,8 @@
bool found = false;
while (!found)
{
- position[0] = RAND * 255.0f;
- position[1] = RAND * 255.0f;
+ position[0] = RAND * 235.0f + 10.0f;
+ position[1] = RAND * 235.0f + 10.0f;
float height = context.landscapeMaps->getHMap().getInterpHeight(
position[0], position[1]);
if (height > allowedHeight) break;
scorched3d-formatstring.patch:
--- NEW FILE scorched3d-formatstring.patch ---
diff -ur scorched.orig/src/3dsparse/ModelID.cpp scorched/src/3dsparse/ModelID.cpp
--- scorched.orig/src/3dsparse/ModelID.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/3dsparse/ModelID.cpp 2006-02-11 15:21:36.000000000 +0100
@@ -77,7 +77,7 @@
static char meshName[1024];
snprintf(meshName, sizeof(meshName), "%s/%s", directory,
meshNameContent);
- if (!DefinesUtil::fileExists(getDataFile(meshName)))
+ if (!DefinesUtil::fileExists(getDataFile("%s", meshName)))
{
dialogMessage("Scorched Models",
"Mesh file \"%s\"does not exist",
@@ -92,7 +92,7 @@
{
snprintf(skinName, sizeof(skinName), "%s/%s",
directory, skinNameContent);
- if (!DefinesUtil::fileExists(getDataFile(skinName)))
+ if (!DefinesUtil::fileExists(getDataFile("%s", skinName)))
{
dialogMessage("Scorched Models",
"Skin file \"%s\" does not exist",
@@ -116,7 +116,7 @@
snprintf(meshName, sizeof(meshName), "%s/%s", directory,
meshNameContent);
- if (!DefinesUtil::fileExists(getDataFile(meshName)))
+ if (!DefinesUtil::fileExists(getDataFile("%s", meshName)))
{
dialogMessage("Scorched Models",
"Mesh file \"%s\"does not exist",
Only in scorched/src/3dsparse: ModelID.cpp~
diff -ur scorched.orig/src/3dsparse/ModelStore.cpp scorched/src/3dsparse/ModelStore.cpp
--- scorched.orig/src/3dsparse/ModelStore.cpp 2005-04-12 00:19:08.000000000 +0200
+++ scorched/src/3dsparse/ModelStore.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -134,18 +134,18 @@
if (0 == strcmp(id.getType(), "ase"))
{
// Load the ASEFile containing the tank definitions
- std::string meshName(getDataFile(id.getMeshName()));
+ std::string meshName(getDataFile("%s", id.getMeshName()));
bool noSkin =
(0 == strcmp("none", id.getSkinName()));
ASEModelFactory factory;
model = factory.createModel(meshName.c_str(),
- (noSkin?"":getDataFile(id.getSkinName())));
+ (noSkin?"":getDataFile("%s", id.getSkinName())));
}
else
{
// Load the Milkshape containing the tank definitions
- std::string meshName(getDataFile(id.getMeshName()));
+ std::string meshName(getDataFile("%s", id.getMeshName()));
MSModelFactory factory;
model = factory.createModel(meshName.c_str());
}
diff -ur scorched.orig/src/3dsparse/aseFile.tab.cpp scorched/src/3dsparse/aseFile.tab.cpp
--- scorched.orig/src/3dsparse/aseFile.tab.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/3dsparse/aseFile.tab.cpp 2006-02-11 15:22:13.000000000 +0100
@@ -1057,7 +1057,7 @@
{
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, errmsg);
- dialogMessage("Lexer", buffer);
+ dialogMessage("Lexer", "%s", buffer);
return 0;
}
@@ -1065,7 +1065,7 @@
{
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, warningmsg);
- dialogMessage("Lexer", buffer);
+ dialogMessage("Lexer", "%s", buffer);
return 0;
}
@@ -1073,6 +1073,6 @@
{
char buffer[1024];
snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, debugmsg);
- dialogMessage("Lexer", buffer);
+ dialogMessage("Lexer", "%s", buffer);
return 0;
}
Only in scorched/src/3dsparse: aseFile.tab.cpp~
diff -ur scorched.orig/src/GLEXT/GLConsole.cpp scorched/src/GLEXT/GLConsole.cpp
--- scorched.orig/src/GLEXT/GLConsole.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/GLEXT/GLConsole.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -53,7 +53,7 @@
void GLConsole::logMessage(LoggerInfo &info)
{
- addLine(false, info.getMessage());
+ addLine(false, "%s", info.getMessage());
}
void GLConsole::keyboardCheck(const unsigned state, float frameTime,
@@ -111,7 +111,7 @@
itor != matches.end();
itor++)
{
- addLine(false, (*itor)->getName());
+ addLine(false, "%s", (*itor)->getName());
}
}
}
@@ -160,7 +160,7 @@
KeyboardKey *key = (*keyItor);
if (key->keyDown(buffer, keyState, false))
{
- addLine(true, key->getName());
+ addLine(true, "%s", key->getName());
}
}
}
diff -ur scorched.orig/src/GLEXT/GLConsoleFileReader.cpp scorched/src/GLEXT/GLConsoleFileReader.cpp
--- scorched.orig/src/GLEXT/GLConsoleFileReader.cpp 2005-04-12 19:06:13.000000000 +0200
+++ scorched/src/GLEXT/GLConsoleFileReader.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -45,7 +45,7 @@
XMLNode *currentNode = (*childrenItor);
if (strcmp(currentNode->getName(), "command")==0)
{
- GLConsole::instance()->addLine(true, currentNode->getContent());
+ GLConsole::instance()->addLine(true, "%s", currentNode->getContent());
}
}
return true;
diff -ur scorched.orig/src/GLEXT/GLStateExtension.cpp scorched/src/GLEXT/GLStateExtension.cpp
--- scorched.orig/src/GLEXT/GLStateExtension.cpp 2004-09-09 20:03:49.000000000 +0200
+++ scorched/src/GLEXT/GLStateExtension.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -122,13 +122,13 @@
// HACK for skin creator
#ifdef dDOUBLE
GLConsole::instance()->addLine(false, "GL_VENDOR:");
- GLConsole::instance()->addLine(false, (const char *) glGetString(GL_VENDOR));
+ GLConsole::instance()->addLine(false, "%s", (const char *) glGetString(GL_VENDOR));
GLConsole::instance()->addLine(false, "GL_RENDERER:");
- GLConsole::instance()->addLine(false, (const char *) glGetString(GL_RENDERER));
+ GLConsole::instance()->addLine(false, "%s", (const char *) glGetString(GL_RENDERER));
GLConsole::instance()->addLine(false, "GL_VERSION:");
- GLConsole::instance()->addLine(false, (const char *) glGetString(GL_VERSION));
+ GLConsole::instance()->addLine(false, "%s", (const char *) glGetString(GL_VERSION));
GLConsole::instance()->addLine(false, "GL_EXTENSIONS:");
- GLConsole::instance()->addLine(false, (const char *) glGetString(GL_EXTENSIONS));
+ GLConsole::instance()->addLine(false, "%s", (const char *) glGetString(GL_EXTENSIONS));
GLConsole::instance()->addLine(false, "TEXTURE_UNITS:");
GLConsole::instance()->addLine(false, "%s (%i units)", ((glActiveTextureARB_==0)?"Off":"On"),textureUnits_);
GLConsole::instance()->addLine(false, "VBO:");
diff -ur scorched.orig/src/GLW/GLWDropDown.cpp scorched/src/GLW/GLWDropDown.cpp
--- scorched.orig/src/GLW/GLWDropDown.cpp 2004-06-18 01:40:41.000000000 +0200
+++ scorched/src/GLW/GLWDropDown.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -122,7 +122,7 @@
GLWFont::instance()->getLargePtFont()->drawWidth(
(int) w_ - 25,
GLWFont::widgetFontColor, 14,
- x_ + 5.0f, y_ + 5.0f, 0.0f, text_.c_str());
+ x_ + 5.0f, y_ + 5.0f, 0.0f, "%s", text_.c_str());
}
void GLWDropDown::buttonDown(unsigned int id)
diff -ur scorched.orig/src/GLW/GLWIcon.cpp scorched/src/GLW/GLWIcon.cpp
--- scorched.orig/src/GLW/GLWIcon.cpp 2004-09-10 14:45:45.000000000 +0200
+++ scorched/src/GLW/GLWIcon.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -72,9 +72,9 @@
if (bitmapNode && bitmapANode)
{
std::string bitmapName =
- getDataFile(bitmapNode->getContent());
+ getDataFile("%s", bitmapNode->getContent());
std::string bitmapAName =
- getDataFile(bitmapANode->getContent());
+ getDataFile("%s", bitmapANode->getContent());
texture_ = ModelStore::instance()->loadTexture(
bitmapName.c_str(), bitmapAName.c_str(), invert);
diff -ur scorched.orig/src/GLW/GLWLabel.cpp scorched/src/GLW/GLWLabel.cpp
--- scorched.orig/src/GLW/GLWLabel.cpp 2005-06-20 15:15:39.000000000 +0200
+++ scorched/src/GLW/GLWLabel.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -56,7 +56,7 @@
void GLWLabel::calcWidth()
{
if (w_ == 0.0f) w_ = (float) GLWFont::instance()->getLargePtFont()->getWidth(
- size_, (char *) buttonText_.c_str());
+ size_, "%s", (char *) buttonText_.c_str());
}
void GLWLabel::draw()
@@ -67,5 +67,5 @@
calcWidth();
GLWFont::instance()->getLargePtFont()->draw(
color_, size_,
- x_, y_ + 6.0f, 0.0f, (char *) buttonText_.c_str());
+ x_, y_ + 6.0f, 0.0f, "%s", (char *) buttonText_.c_str());
}
diff -ur scorched.orig/src/GLW/GLWLoggerView.cpp scorched/src/GLW/GLWLoggerView.cpp
--- scorched.orig/src/GLW/GLWLoggerView.cpp 2005-07-11 22:40:38.000000000 +0200
+++ scorched/src/GLW/GLWLoggerView.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -133,14 +133,14 @@
{
// Figure texture width
float minus = GLWFont::instance()->getLargePtFont()->
- getWidth(fontSize_, entry.info.getMessage()) / 2.0f;
+ getWidth(fontSize_, "%s", entry.info.getMessage()) / 2.0f;
float x = x_ + w_ / 2.0f - minus - 1;
float y = start - i * lineDepth_ - 1;
// Draw outline
GLWFont::instance()->getSmallPtFontOutline()->
drawOutline(black, outlineFontSize_, fontSize_,
- x, y, 0.0f,
+ x, y, 0.0f, "%s",
entry.info.getMessage());
}
else
@@ -153,15 +153,15 @@
float x = x_ + w_ / 2.0f;
float y = start - i * lineDepth_;
float minusSource = (float) GLWFont::instance()->getLargePtFont()->
- getWidth(fontSize_, source->getName());
+ getWidth(fontSize_, "%s", source->getName());
GLWFont::instance()->getSmallPtFontOutline()->
drawOutline(black, outlineFontSize_, fontSize_,
- x - minusSource - outlineFontSize_ / 2.0f - 2.0f, y, 0.0f,
+ x - minusSource - outlineFontSize_ / 2.0f - 2.0f, y, 0.0f, "%s",
source->getName());
GLWFont::instance()->getSmallPtFontOutline()->
drawOutline(black, outlineFontSize_, fontSize_,
- x + outlineFontSize_ / 2.0f + 2.0f, y, 0.0f,
+ x + outlineFontSize_ / 2.0f + 2.0f, y, 0.0f, "%s",
dest->getName());
}
@@ -180,7 +180,7 @@
{
// Figure texture width
float minus = GLWFont::instance()->getLargePtFont()->
- getWidth(fontSize_, entry.info.getMessage()) / 2.0f;
+ getWidth(fontSize_, "%s", entry.info.getMessage()) / 2.0f;
float x = x_ + w_ / 2.0f - minus;
float y = start - i * lineDepth_;
@@ -220,19 +220,19 @@
GLWFont::instance()->getLargePtFont()->
drawSubStr(0, entry.info.getInfoLen(),
source?source->getColor():dColor, fontSize_,
- x, y, 0.0f,
+ x, y, 0.0f, "%s",
entry.info.getMessage());
GLWFont::instance()->getLargePtFont()->
drawSubStr(entry.info.getInfoLen(), entry.info.getMessageLen(),
dColor, fontSize_,
- x, y, 0.0f,
+ x, y, 0.0f, "%s",
entry.info.getMessage());
}
else
{
GLWFont::instance()->getLargePtFont()->
draw(dColor, fontSize_,
- x, y, 0.0f,
+ x, y, 0.0f, "%s",
entry.info.getMessage());
}
}
@@ -246,16 +246,16 @@
float x = x_ + w_ / 2.0f;
float y = start - i * lineDepth_;
float minusSource = (float) GLWFont::instance()->getLargePtFont()->
- getWidth(fontSize_, source->getName());
+ getWidth(fontSize_, "%s", source->getName());
GLWFont::instance()->getLargePtFont()->
draw(source?source->getColor():defaultColor, fontSize_,
x - minusSource - outlineFontSize_ / 2.0f - 4.0f, y, 0.0f,
- source->getName());
+ "%s", source->getName());
GLWFont::instance()->getLargePtFont()->
draw(dest?dest->getColor():defaultColor, fontSize_,
x + outlineFontSize_ / 2.0f + 4.0f, y, 0.0f,
- dest->getName());
+ "%s", dest->getName());
if (entry.info.getIcon())
{
diff -ur scorched.orig/src/GLW/GLWScorchedInfo.cpp scorched/src/GLW/GLWScorchedInfo.cpp
--- scorched.orig/src/GLW/GLWScorchedInfo.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/GLW/GLWScorchedInfo.cpp 2006-02-11 15:23:34.000000000 +0100
@@ -92,12 +92,12 @@
}
float windwidth = (float) GLWFont::instance()->
getSmallPtFont()->getWidth(
- fontSize_, buffer);
+ fontSize_, "%s", buffer);
float offSet = 0.0f;
if (!noCenter_) offSet = w_ / 2.0f - (windwidth / 2.0f);
GLWFont::instance()->getSmallPtFont()->draw(
*fontColor, fontSize_,
- x_ + offSet, y_, 0.0f,
+ x_ + offSet, y_, 0.0f, "%s",
buffer);
}
break;
@@ -125,12 +125,12 @@
{
setToolTip(&model->getTips()->nameTip);
float namewidth = (float) GLWFont::instance()->getSmallPtFont()->getWidth(
- fontSize_, current->getName());
+ fontSize_, "%s", current->getName());
float offSet = 0.0f;
if (!noCenter_) offSet = w_ / 2.0f - (namewidth / 2.0f);
GLWFont::instance()->getSmallPtFont()->draw(
current->getColor(), fontSize_,
- x_ + offSet, y_, 0.0f,
+ x_ + offSet, y_, 0.0f, "%s",
current->getName());
}
break;
@@ -157,7 +157,7 @@
setToolTip(&model->getTips()->nameTip);
GLWFont::instance()->getSmallPtFont()->draw(
current->getColor(), fontSize_,
- x_, y_, 0.0f,
+ x_, y_, 0.0f, "%s",
current->getScore().getStatsRank());
}
break;
@@ -165,7 +165,7 @@
setToolTip(&model->getTips()->autodTip);
GLWFont::instance()->getSmallPtFont()->draw(
*fontColor, fontSize_,
- x_, y_, 0.0f,
+ x_, y_, 0.0f, "%s",
(current->getAccessories().getAutoDefense().haveDefense()?"On":"Off"));
break;
case eParachuteCount:
@@ -240,13 +240,13 @@
snprintf(buffer, sizeof(buffer), "%s",
current->getAccessories().getWeapons().getCurrent()->getName());
float weaponWidth = (float) GLWFont::instance()->getSmallPtFont()->
- getWidth(fontSize_, buffer);
+ getWidth(fontSize_, "%s", buffer);
float offSet = 0.0f;
if (!noCenter_) offSet = w_ / 2.0f - (weaponWidth / 2.0f);
GLWFont::instance()->getSmallPtFont()->draw(
*fontColor, fontSize_,
- x_ + offSet, y_, 0.0f,
+ x_ + offSet, y_, 0.0f, "%s",
buffer);
}
break;
Only in scorched/src/GLW: GLWScorchedInfo.cpp~
diff -ur scorched.orig/src/GLW/GLWSelectorPart.cpp scorched/src/GLW/GLWSelectorPart.cpp
--- scorched.orig/src/GLW/GLWSelectorPart.cpp 2004-12-27 17:53:10.000000000 +0100
+++ scorched/src/GLW/GLWSelectorPart.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -62,7 +62,7 @@
// Get width
float currentwidth =
- (float) font.getWidth(12, (char *) item.getText()) + 20.0f;
+ (float) font.getWidth(12, "%s", (char *) item.getText()) + 20.0f;
if (item.getSelected()) selected_ = true;
if (item.getIcon()) icon_ = true;
if (currentwidth > selectedWidth) selectedWidth = currentwidth;
@@ -196,7 +196,7 @@
currentTop - 16.0f, 0.0f, "x");
}
font.draw(*c, 12, selectedX_ + selectedIndent_ + 10.0f,
- currentTop - 16.0f, 0.0f, (char *) item.getText());
+ currentTop - 16.0f, 0.0f, "%s", (char *) item.getText());
currentTop -= 18.0f;
}
}
Only in scorched/src/GLW: GLWSelectorPart.cpp.orig
diff -ur scorched.orig/src/GLW/GLWToolTip.cpp scorched/src/GLW/GLWToolTip.cpp
--- scorched.orig/src/GLW/GLWToolTip.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/GLW/GLWToolTip.cpp 2006-02-11 15:20:24.000000000 +0100
@@ -39,7 +39,7 @@
GLWTip::GLWTip(const char *tit, const char *tex)
: id_(++nextId_), x(0), y(0), w(0), h(0), handler_(0)
{
- setText(tit, tex);
+ setText(tit, "%s", tex);
}
GLWTip::~GLWTip()
@@ -84,12 +84,12 @@
for (itor = texts.begin(); itor != enditor; itor++)
{
float width = float(GLWFont::instance()->getSmallPtFont()->
- getWidth(9,(*itor))) + 10.0f;
+ getWidth(9, "%s", (*itor))) + 10.0f;
if (width > textWidth_) textWidth_ = width;
}
float width = float(GLWFont::instance()->getSmallPtFont()->
- getWidth(11,title_.c_str())) + 10.0f;
+ getWidth(11, "%s", title_.c_str())) + 10.0f;
if (width > textWidth_) textWidth_ = width;
}
@@ -262,7 +262,7 @@
float pos = posY + posH - 16.0f;
GLWFont::instance()->getSmallPtFont()->drawA(selectedColor, alpha, 11, posX + 3.0f,
- pos, 0.0f, lastTip_->getTitle());
+ pos, 0.0f, "%s", lastTip_->getTitle());
pos -= 2.0f;
std::list<char *> &texts = lastTip_->getTexts();
@@ -273,6 +273,6 @@
pos -= 10.0f;
GLWFont::instance()->getSmallPtFont()->drawA(color, alpha, 9, posX + 6.0f,
- pos, 0.0f, (*itor));
+ pos, 0.0f, "%s", (*itor));
}
}
Only in scorched/src/GLW: GLWToolTip.cpp~
diff -ur scorched.orig/src/GLW/GLWWindow.cpp scorched/src/GLW/GLWWindow.cpp
--- scorched.orig/src/GLW/GLWWindow.cpp 2005-06-13 10:24:36.000000000 +0200
+++ scorched/src/GLW/GLWWindow.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -457,7 +457,7 @@
// Desc
if (!node->getNamedChild("description", description_)) return false;
- toolTip_.setText(name_.c_str(), description_.c_str());
+ toolTip_.setText(name_.c_str(), "%s", description_.c_str());
// Disabled
XMLNode *disabled = 0;
diff -ur scorched.orig/src/actions/Lightning.cpp scorched/src/actions/Lightning.cpp
--- scorched.orig/src/actions/Lightning.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/actions/Lightning.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -92,7 +92,7 @@
{
SoundBuffer *expSound =
Sound::instance()->fetchOrCreateBuffer(
- (char *) getDataFile(weapon_->getSound()));
+ (char *) getDataFile("%s", weapon_->getSound()));
SoundUtils::playAbsoluteSound(VirtualSoundPriority::eAction,
expSound, position_);
}
diff -ur scorched.orig/src/actions/SoundAction.cpp scorched/src/actions/SoundAction.cpp
--- scorched.orig/src/actions/SoundAction.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/actions/SoundAction.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -45,7 +45,7 @@
{
SoundBuffer *activateSound =
Sound::instance()->fetchOrCreateBuffer((char *)
- getDataFile(weapon_->getSound()));
+ getDataFile("%s", weapon_->getSound()));
SoundUtils::playRelativeSound(VirtualSoundPriority::eAction,
activateSound);
}
diff -ur scorched.orig/src/actions/TankSay.cpp scorched/src/actions/TankSay.cpp
--- scorched.orig/src/actions/TankSay.cpp 2005-07-11 22:40:38.000000000 +0200
+++ scorched/src/actions/TankSay.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -70,7 +70,7 @@
}
else if (OptionsParam::instance()->getDedicatedServer())
{
- Logger::log(text_.c_str());
+ Logger::log("%s", text_.c_str());
}
}
}
diff -ur scorched.orig/src/actions/Teleport.cpp scorched/src/actions/Teleport.cpp
--- scorched.orig/src/actions/Teleport.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/actions/Teleport.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -77,7 +77,7 @@
{
SoundBuffer *activateSound =
Sound::instance()->fetchOrCreateBuffer((char *)
- getDataFile(weapon_->getSound()));
+ getDataFile("%s", weapon_->getSound()));
SoundUtils::playAbsoluteSound(VirtualSoundPriority::eAction,
activateSound, tank->getPhysics().getTankPosition());
}
diff -ur scorched.orig/src/boids/BoidWorld.cpp scorched/src/boids/BoidWorld.cpp
--- scorched.orig/src/boids/BoidWorld.cpp 2005-08-09 17:39:32.000000000 +0200
+++ scorched/src/boids/BoidWorld.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -123,7 +123,7 @@
const char *sound = (*itor).c_str();
SoundBuffer *buffer =
Sound::instance()->fetchOrCreateBuffer(
- (char *) getDataFile(sound));
+ (char *) getDataFile("%s", sound));
sounds_.push_back(buffer);
}
}
diff -ur scorched.orig/src/client/ClientMain.cpp scorched/src/client/ClientMain.cpp
--- scorched.orig/src/client/ClientMain.cpp 2005-07-19 23:45:36.000000000 +0200
+++ scorched/src/client/ClientMain.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -175,7 +175,8 @@
std::string errorString;
if (!GLConsoleFileReader::loadFileIntoConsole(getDataFile("data/autoexec.xml"), errorString))
{
- dialogMessage("Failed to parse data/autoexec.xml", errorString.c_str());
+ dialogMessage("Failed to parse data/autoexec.xml", "%s",
+ errorString.c_str());
return false;
}
return true;
diff -ur scorched.orig/src/client/ClientTextHandler.cpp scorched/src/client/ClientTextHandler.cpp
--- scorched.orig/src/client/ClientTextHandler.cpp 2005-07-11 22:40:39.000000000 +0200
+++ scorched/src/client/ClientTextHandler.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -65,7 +65,7 @@
MessageDisplay::instance()->clear();
MessageDisplay::instance()->addMessage(message.getText());
- Logger::log(message.getText());
+ Logger::log("%s", message.getText());
}
else
{
diff -ur scorched.orig/src/client/MessageDisplay.cpp scorched/src/client/MessageDisplay.cpp
--- scorched.orig/src/client/MessageDisplay.cpp 2005-08-16 22:23:59.000000000 +0200
+++ scorched/src/client/MessageDisplay.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -62,7 +62,7 @@
if (currentText_.size())
{
GLConsole::instance()->addLine(
- false, currentText_.c_str());
+ false, "%s", currentText_.c_str());
}
currentText_ = texts_.front();
texts_.pop_front();
@@ -86,7 +86,7 @@
float wHeight = (float) GLViewPort::getHeight();
float wWidth = (float) GLViewPort::getWidth();
float textWidth = float(GLWFont::instance()->getLargePtFont()->getWidth(
- 30, currentText_.c_str()));
+ 30, "%s", currentText_.c_str()));
float x = (wWidth/2.0f) - (textWidth / 2) - 10.0f;
float y = wHeight - 60.0f;
@@ -100,6 +100,6 @@
Vector white(0.9f, 0.9f, 1.0f);
GLWFont::instance()->getLargePtFont()->draw(
white, 30,
- x + 10.0f, y + 7.0f, 0.0f,
+ x + 10.0f, y + 7.0f, 0.0f,"%s",
currentText_.c_str());
}
diff -ur scorched.orig/src/client/SpeedChange.cpp scorched/src/client/SpeedChange.cpp
--- scorched.orig/src/client/SpeedChange.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/client/SpeedChange.cpp 2006-02-11 15:23:32.000000000 +0100
@@ -61,7 +61,7 @@
snprintf(buffer, sizeof(buffer), "%.1fX", speed);
static Vector fontColor(0.7f, 0.7f, 0.2f);
- GLWFont::instance()->getLargePtFont()->draw(fontColor, 20, 10.0f, 10.0f, 0.0f, buffer);
+ GLWFont::instance()->getLargePtFont()->draw(fontColor, 20, 10.0f, 10.0f, 0.0f, "%s", buffer);
}
}
Only in scorched/src/client: SpeedChange.cpp~
diff -ur scorched.orig/src/client/TargetCamera.cpp scorched/src/client/TargetCamera.cpp
--- scorched.orig/src/client/TargetCamera.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/client/TargetCamera.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -149,7 +149,7 @@
for (int i=0; i<noCameraDescriptions; i++)
{
cameraToolTips[i].setText(getCameraNames()[i],
- cameraDescriptions[i]);
+ "%s", cameraDescriptions[i]);
}
}
return cameraToolTips;
diff -ur scorched.orig/src/dialogs/LogDialog.cpp scorched/src/dialogs/LogDialog.cpp
--- scorched.orig/src/dialogs/LogDialog.cpp 2005-04-05 00:35:25.000000000 +0200
+++ scorched/src/dialogs/LogDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -58,7 +58,7 @@
void LogDialog::logMessage(LoggerInfo &info)
{
- listView_->addLine(info.getMessage());
+ listView_->addLine("%s", info.getMessage());
}
void LogDialog::draw()
diff -ur scorched.orig/src/dialogs/ProgressDialog.cpp scorched/src/dialogs/ProgressDialog.cpp
--- scorched.orig/src/dialogs/ProgressDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/dialogs/ProgressDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -127,7 +127,7 @@
Vector color(0.2f, 0.2f, 0.2f);
GLWFont::instance()->getLargePtFont()->draw(color,
- 14.0f, 20.0f, 33.0f, 0.0f,
+ 14.0f, 20.0f, 33.0f, 0.0f, "%s",
progressLabel_->getText());
HelpButtonDialog::instance()->getHelpTexture().draw();
@@ -148,10 +148,10 @@
Vector color2(0.4f, 0.4f, 0.4f);
GLWFont::instance()->getLargePtFont()->drawWidth(380,
- color2, 10.0f, 44.0f, 3.0f, 0.0f,
+ color2, 10.0f, 44.0f, 3.0f, 0.0f, "%s",
tip1_.c_str());
GLWFont::instance()->getLargePtFont()->drawWidth(380,
- color2, 10.0f, 44.0f, -12.0f, 0.0f,
+ color2, 10.0f, 44.0f, -12.0f, 0.0f, "%s",
tip2_.c_str());
glPopMatrix();
}
diff -ur scorched.orig/src/dialogs/RulesDialog.cpp scorched/src/dialogs/RulesDialog.cpp
--- scorched.orig/src/dialogs/RulesDialog.cpp 2005-06-27 02:55:48.000000000 +0200
+++ scorched/src/dialogs/RulesDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -74,7 +74,7 @@
while (found)
{
*found = '\0';
- listView_->addLine(start);
+ listView_->addLine("%s", start);
start = found;
start++;
@@ -82,12 +82,12 @@
}
if (start[0] != '\0')
{
- listView_->addLine(start);
+ listView_->addLine("%s", start);
}
}
else
{
- listView_->addLine(text);
+ listView_->addLine("%s", text);
}
}
diff -ur scorched.orig/src/dialogs/SaveDialog.cpp scorched/src/dialogs/SaveDialog.cpp
--- scorched.orig/src/dialogs/SaveDialog.cpp 2005-08-17 14:53:13.000000000 +0200
+++ scorched/src/dialogs/SaveDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -87,7 +87,7 @@
if (textBox_->getText()[0])
{
std::string saveFile = formatString("%s.s3d", textBox_->getText().c_str());
- if (ClientSave::saveClient(getSaveFile(saveFile.c_str())))
+ if (ClientSave::saveClient(getSaveFile("%s", saveFile.c_str())))
{
Logger::log(LoggerInfo(LoggerInfo::TypePerformance,
formatString("Saved as \"%s\"", saveFile.c_str())));
diff -ur scorched.orig/src/dialogs/ScoreDialog.cpp scorched/src/dialogs/ScoreDialog.cpp
--- scorched.orig/src/dialogs/ScoreDialog.cpp 2005-06-02 01:09:32.000000000 +0200
+++ scorched/src/dialogs/ScoreDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -137,7 +137,7 @@
405,
white,
20,
- x_ + 8.0f, y_ + h_ - 21.0f, 0.0f,
+ x_ + 8.0f, y_ + h_ - 21.0f, 0.0f, "%s",
ScorchedClient::instance()->getOptionsGame().getServerName());
}
else
@@ -165,11 +165,11 @@
moves);
int roundsWidth = GLWFont::instance()->getSmallPtFont()->getWidth(
- 10, rounds);
+ 10, "%s", rounds);
GLWFont::instance()->getSmallPtFont()->draw(
white,
10,
- x_ + 430 - roundsWidth, y_ + h_ - 40.0f, 0.0f,
+ x_ + 430 - roundsWidth, y_ + h_ - 40.0f, 0.0f, "%s",
rounds);
}
@@ -373,7 +373,7 @@
GLWFont::instance()->getSmallPtFont()->draw(
current->getColor(),
10,
- textX + nameLeft, textY, 0.0f,
+ textX + nameLeft, textY, 0.0f, "%s",
name);
GLWFont::instance()->getSmallPtFont()->draw(
current->getColor(),
diff -ur scorched.orig/src/engine/ModFiles.cpp scorched/src/engine/ModFiles.cpp
--- scorched.orig/src/engine/ModFiles.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/engine/ModFiles.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -82,7 +82,7 @@
{
{
// Get and check the user mod directory exists
- const char *modDir = getModFile(mod);
+ const char *modDir = getModFile("%s", mod);
if (DefinesUtil::dirExists(modDir))
{
if (!loadModDir(modDir, mod)) return false;
@@ -95,7 +95,7 @@
{
// Get and check global mod directory
- const char *modDir = getGlobalModFile(mod);
+ const char *modDir = getGlobalModFile("%s", mod);
if (DefinesUtil::dirExists(modDir))
{
if (!loadModDir(modDir, mod)) return false;
@@ -135,8 +135,8 @@
dialogMessage("Mod",
"Failed to find \"%s\" mod files in directories \"%s\" \"%s\"",
mod,
- getModFile(mod),
- getGlobalModFile(mod));
+ getModFile("%s", mod),
+ getGlobalModFile("%s", mod));
return false;
}
}
@@ -217,7 +217,7 @@
bool ModFiles::writeModFiles(const char *mod)
{
- const char *modDir = getModFile(mod);
+ const char *modDir = getModFile("%s", mod);
if (!DefinesUtil::dirExists(modDir))
{
DefinesUtil::dirMake(modDir);
diff -ur scorched.orig/src/landscape/HeightMapLoader.cpp scorched/src/landscape/HeightMapLoader.cpp
--- scorched.orig/src/landscape/HeightMapLoader.cpp 2004-11-13 13:39:53.000000000 +0100
+++ scorched/src/landscape/HeightMapLoader.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -110,7 +110,7 @@
// Load the landscape
levelSurround = file->levelsurround;
GLBitmap bitmap;
- const char *fileName = getDataFile(file->file.c_str());
+ const char *fileName = getDataFile("%s", file->file.c_str());
if (!bitmap.loadFromFile(fileName, false))
{
dialogMessage("HeightMapLoader",
diff -ur scorched.orig/src/landscape/HeightMapModifier.cpp scorched/src/landscape/HeightMapModifier.cpp
--- scorched.orig/src/landscape/HeightMapModifier.cpp 2005-08-15 12:22:29.000000000 +0200
+++ scorched/src/landscape/HeightMapModifier.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -185,7 +185,7 @@
// Check if we need to load a new mask
if (!defn.mask.empty())
{
- const char *fileName = getDataFile(defn.mask.c_str());
+ const char *fileName = getDataFile("%s", defn.mask.c_str());
if (!maskMap.loadFromFile(fileName, false))
{
dialogExit("Landscape",
diff -ur scorched.orig/src/landscape/Landscape.cpp scorched/src/landscape/Landscape.cpp
--- scorched.orig/src/landscape/Landscape.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/landscape/Landscape.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -202,15 +202,15 @@
LandscapeTexTextureGenerate *generate =
(LandscapeTexTextureGenerate *) tex->texture;
- GLBitmap texture0(getDataFile(generate->texture0.c_str()));
- GLBitmap texture1(getDataFile(generate->texture1.c_str()));
- GLBitmap texture2(getDataFile(generate->texture2.c_str()));
- GLBitmap texture3(getDataFile(generate->texture3.c_str()));
- GLBitmap texture4(getDataFile(generate->texture4.c_str()));
- GLBitmap bitmapShore(getDataFile(generate->shore.c_str()));
- GLBitmap bitmapRock(getDataFile(generate->rockside.c_str()));
- GLBitmap bitmapRoof(getDataFile(generate->roof.c_str()));
- GLBitmap bitmapSurround(getDataFile(generate->surround.c_str()));
+ GLBitmap texture0(getDataFile("%s", generate->texture0.c_str()));
+ GLBitmap texture1(getDataFile("%s", generate->texture1.c_str()));
+ GLBitmap texture2(getDataFile("%s", generate->texture2.c_str()));
+ GLBitmap texture3(getDataFile("%s", generate->texture3.c_str()));
+ GLBitmap texture4(getDataFile("%s", generate->texture4.c_str()));
+ GLBitmap bitmapShore(getDataFile("%s", generate->shore.c_str()));
+ GLBitmap bitmapRock(getDataFile("%s", generate->rockside.c_str()));
+ GLBitmap bitmapRoof(getDataFile("%s", generate->roof.c_str()));
+ GLBitmap bitmapSurround(getDataFile("%s", generate->surround.c_str()));
GLBitmap *bitmaps[5];
bitmaps[0] = &texture0;
bitmaps[1] = &texture1;
@@ -268,26 +268,26 @@
// Generate the scorch map for the landscape
std::string sprayMaskFile = getDataFile("data/textures/smoke01.bmp");
GLBitmap sprayMaskBitmap(sprayMaskFile.c_str(), sprayMaskFile.c_str(), false);
- scorchMap_.loadFromFile(getDataFile(tex->scorch.c_str()));
- GLBitmap scorchMap(getDataFile(tex->scorch.c_str()));
+ scorchMap_.loadFromFile(getDataFile("%s", tex->scorch.c_str()));
+ GLBitmap scorchMap(getDataFile("%s", tex->scorch.c_str()));
scorchMap.resize(sprayMaskBitmap.getWidth(), sprayMaskBitmap.getHeight());
GLBitmap texture1New(sprayMaskBitmap.getWidth(), sprayMaskBitmap.getHeight(), true);
GLBitmapModifier::makeBitmapTransparent(texture1New, scorchMap, sprayMaskBitmap);
landTex1_.replace(texture1New, GL_RGBA);
// Magma
- GLBitmap bitmapMagma(getDataFile(tex->magmasmall.c_str()));
+ GLBitmap bitmapMagma(getDataFile("%s", tex->magmasmall.c_str()));
DIALOG_ASSERT(magTexture_.replace(bitmapMagma));
// Sky
- std::string ctex(getDataFile(tex->skytexture.c_str()));
- std::string ctexm(getDataFile(tex->skytexturemask.c_str()));
+ std::string ctex(getDataFile("%s", tex->skytexture.c_str()));
+ std::string ctexm(getDataFile("%s", tex->skytexturemask.c_str()));
GLBitmap bitmapCloud(ctex.c_str(), ctexm.c_str(), false);
DIALOG_ASSERT(cloudTexture_.replace(bitmapCloud, GL_RGBA));
- skyColorsMap_.loadFromFile(getDataFile(tex->skycolormap.c_str()));
+ skyColorsMap_.loadFromFile(getDataFile("%s", tex->skycolormap.c_str()));
// Detail
- GLBitmap bitmapDetail(getDataFile(tex->detail.c_str()));
+ GLBitmap bitmapDetail(getDataFile("%s", tex->detail.c_str()));
DIALOG_ASSERT(detailTexture_.replace(bitmapDetail, GL_RGB, true));
// Create the plan textures (for the plan and wind dialogs)
diff -ur scorched.orig/src/landscape/LandscapeDefn.cpp scorched/src/landscape/LandscapeDefn.cpp
--- scorched.orig/src/landscape/LandscapeDefn.cpp 2005-01-17 22:39:35.000000000 +0100
+++ scorched/src/landscape/LandscapeDefn.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -104,7 +104,7 @@
startmask)) return false;
if (!startmask.empty())
{
- if (!checkDataFile(startmask.c_str())) return false;
+ if (!checkDataFile("%s", startmask.c_str())) return false;
}
return node->failChildren();
}
@@ -113,7 +113,7 @@
{
if (!node->getNamedChild("file", file)) return false;
if (!node->getNamedChild("levelsurround", levelsurround)) return false;
- if (!checkDataFile(file.c_str())) return false;
+ if (!checkDataFile("%s", file.c_str())) return false;
return node->failChildren();
}
@@ -137,7 +137,7 @@
if (!mask.empty())
{
- if (!checkDataFile(mask.c_str())) return false;
+ if (!checkDataFile("%s", mask.c_str())) return false;
}
return node->failChildren();
}
diff -ur scorched.orig/src/landscape/LandscapeObjectsPlacement.cpp scorched/src/landscape/LandscapeObjectsPlacement.cpp
--- scorched.orig/src/landscape/LandscapeObjectsPlacement.cpp 2005-07-18 00:27:13.000000000 +0200
+++ scorched/src/landscape/LandscapeObjectsPlacement.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -298,7 +298,7 @@
placement.objecttype.c_str());
}
- GLBitmap map(getDataFile(placement.mask.c_str()));
+ GLBitmap map(getDataFile("%s", placement.mask.c_str()));
if (!map.getBits())
{
dialogExit("LandscapeObjectPlacementMask",
diff -ur scorched.orig/src/landscape/LandscapeSoundManager.cpp scorched/src/landscape/LandscapeSoundManager.cpp
--- scorched.orig/src/landscape/LandscapeSoundManager.cpp 2005-07-13 14:51:49.000000000 +0200
+++ scorched/src/landscape/LandscapeSoundManager.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -67,7 +67,7 @@
entry.soundType = (*typeItor);
entry.soundBuffer =
Sound::instance()->fetchOrCreateBuffer((char *)
- getDataFile(entry.soundType->sound.c_str()));
+ getDataFile("%s", entry.soundType->sound.c_str()));
entry.timeLeft = entry.soundType->timing->getNextEventTime();
entry.soundSource = new VirtualSoundSource(
VirtualSoundPriority::eEnvironment, (entry.timeLeft < 0.0f), false);
diff -ur scorched.orig/src/landscape/LandscapeTex.cpp scorched/src/landscape/LandscapeTex.cpp
--- scorched.orig/src/landscape/LandscapeTex.cpp 2005-08-02 19:27:44.000000000 +0200
+++ scorched/src/landscape/LandscapeTex.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -164,7 +164,7 @@
if (!soundsNode->getNamedChild("volume", soundvolume)) return false;
while (soundsNode->getNamedChild("sound", sound, false))
{
- if (!checkDataFile(sound.c_str())) return false;
+ if (!checkDataFile("%s", sound.c_str())) return false;
sounds.push_back(sound);
}
if (!soundsNode->failChildren()) return false;
@@ -181,10 +181,10 @@
if (!node->getNamedChild("wavetexture1", wavetexture1)) return false;
if (!node->getNamedChild("wavetexture2", wavetexture2)) return false;
if (!node->getNamedChild("height", height)) return false;
- if (!checkDataFile(reflection.c_str())) return false;
- if (!checkDataFile(texture.c_str())) return false;
- if (!checkDataFile(wavetexture1.c_str())) return false;
- if (!checkDataFile(wavetexture2.c_str())) return false;
+ if (!checkDataFile("%s", reflection.c_str())) return false;
+ if (!checkDataFile("%s", texture.c_str())) return false;
+ if (!checkDataFile("%s", wavetexture1.c_str())) return false;
+ if (!checkDataFile("%s", wavetexture2.c_str())) return false;
return node->failChildren();
}
@@ -200,15 +200,15 @@
if (!node->getNamedChild("texture2", texture2)) return false;
if (!node->getNamedChild("texture3", texture3)) return false;
if (!node->getNamedChild("texture4", texture4)) return false;
- if (!checkDataFile(surround.c_str())) return false;
- if (!checkDataFile(roof.c_str())) return false;
- if (!checkDataFile(rockside.c_str())) return false;
- if (!checkDataFile(shore.c_str())) return false;
- if (!checkDataFile(texture0.c_str())) return false;
- if (!checkDataFile(texture1.c_str())) return false;
- if (!checkDataFile(texture2.c_str())) return false;
- if (!checkDataFile(texture3.c_str())) return false;
- if (!checkDataFile(texture4.c_str())) return false;
+ if (!checkDataFile("%s", surround.c_str())) return false;
+ if (!checkDataFile("%s", roof.c_str())) return false;
+ if (!checkDataFile("%s", rockside.c_str())) return false;
+ if (!checkDataFile("%s", shore.c_str())) return false;
+ if (!checkDataFile("%s", texture0.c_str())) return false;
+ if (!checkDataFile("%s", texture1.c_str())) return false;
+ if (!checkDataFile("%s", texture2.c_str())) return false;
+ if (!checkDataFile("%s", texture3.c_str())) return false;
+ if (!checkDataFile("%s", texture4.c_str())) return false;
return node->failChildren();
}
@@ -253,12 +253,12 @@
if (!node->getNamedChild("skydiffuse", skydiffuse)) return false;
if (!node->getNamedChild("skyambience", skyambience)) return false;
- if (!checkDataFile(detail.c_str())) return false;
- if (!checkDataFile(magmasmall.c_str())) return false;
- if (!checkDataFile(scorch.c_str())) return false;
- if (!checkDataFile(skytexture.c_str())) return false;
- if (!checkDataFile(skytexturemask.c_str())) return false;
- if (!checkDataFile(skycolormap.c_str())) return false;
+ if (!checkDataFile("%s", detail.c_str())) return false;
+ if (!checkDataFile("%s", magmasmall.c_str())) return false;
+ if (!checkDataFile("%s", scorch.c_str())) return false;
+ if (!checkDataFile("%s", skytexture.c_str())) return false;
+ if (!checkDataFile("%s", skytexturemask.c_str())) return false;
+ if (!checkDataFile("%s", skycolormap.c_str())) return false;
{
XMLNode *placementsNode;
diff -ur scorched.orig/src/landscape/Water.cpp scorched/src/landscape/Water.cpp
--- scorched.orig/src/landscape/Water.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/landscape/Water.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -113,23 +113,23 @@
height_ = water->height;
waterOn_ = true;
- const char *wave1 = getDataFile(
+ const char *wave1 = getDataFile("%s",
water->wavetexture1.c_str());
GLBitmap waves1Map(wave1, wave1, false);
- const char *wave2 = getDataFile(
+ const char *wave2 = getDataFile("%s",
water->wavetexture2.c_str());
GLBitmap waves2Map(wave2, wave2, false);
wWaves_.getWavesTexture1().replace(waves1Map, GL_RGBA);
wWaves_.getWavesTexture2().replace(waves2Map, GL_RGBA);
- bitmapWater_.loadFromFile(getDataFile(water->reflection.c_str()), false);
- GLBitmap bitmapWaterDetail(getDataFile(water->texture.c_str()));
+ bitmapWater_.loadFromFile(getDataFile("%s", water->reflection.c_str()), false);
+ GLBitmap bitmapWaterDetail(getDataFile("%s", water->texture.c_str()));
wMap_.getWaterDetail().replace(bitmapWaterDetail, GL_RGB, true);
wWaves_.getWavesColor() = water->wavecolor;
// Generate the water texture for the spray sprite
std::string sprayMaskFile = getDataFile("data/textures/smoke01.bmp");
GLBitmap sprayMaskBitmap(sprayMaskFile.c_str(), sprayMaskFile.c_str(), false);
- GLBitmap bitmapWater(getDataFile(water->reflection.c_str()));
+ GLBitmap bitmapWater(getDataFile("%s", water->reflection.c_str()));
bitmapWater.resize(
sprayMaskBitmap.getWidth(), sprayMaskBitmap.getHeight());
GLBitmap textureWaterNew(
Only in scorched/src/ode: error.cpp.orig
diff -ur scorched.orig/src/scorched/MainDialog.cpp scorched/src/scorched/MainDialog.cpp
--- scorched.orig/src/scorched/MainDialog.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/scorched/MainDialog.cpp 2006-02-11 15:18:07.000000000 +0100
@@ -171,7 +171,7 @@
{
wxButton *button = 0;
wxBitmap bitmap;
- const char *bitmapFile = getDataFile(bitmapName);
+ const char *bitmapFile = getDataFile("%s", bitmapName);
if (bitmap.LoadFile(wxString(bitmapFile, wxConvUTF8), wxBITMAP_TYPE_BMP) &&
bitmap.Ok())
{
Only in scorched/src/scorched: MainDialog.cpp~
diff -ur scorched.orig/src/scorched/NetDialog.cpp scorched/src/scorched/NetDialog.cpp
--- scorched.orig/src/scorched/NetDialog.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/scorched/NetDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -510,7 +510,7 @@
strcat(buffer, " -username ");
strcat(buffer, username.mb_str(wxConvUTF8));
}
- runScorched3D(buffer);
+ runScorched3D("%s", buffer);
}
return false;
}
diff -ur scorched.orig/src/scorched/ServerDialog.cpp scorched/src/scorched/ServerDialog.cpp
--- scorched.orig/src/scorched/ServerDialog.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/scorched/ServerDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -573,7 +573,7 @@
{
Logger::log( "Says \"%s\"",
entryDialog.GetValue().GetData());
- ServerCommon::sendString(0, entryDialog.GetValue().mb_str(wxConvUTF8));
+ ServerCommon::sendString(0, "%s", entryDialog.GetValue().mb_str(wxConvUTF8));
}
}
@@ -600,7 +600,7 @@
if (!tank->getTankAI())
{
ServerCommon::sendString(tank->getDestinationId(),
- entryDialog.GetValue().mb_str(wxConvUTF8));
+ "%s", entryDialog.GetValue().mb_str(wxConvUTF8));
}
}
}
diff -ur scorched.orig/src/scorched/SingleChoiceDialog.cpp scorched/src/scorched/SingleChoiceDialog.cpp
--- scorched.orig/src/scorched/SingleChoiceDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/SingleChoiceDialog.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -106,7 +106,7 @@
char *desc = (char *) entry.description.c_str();
wxObjectRefData *refData = new SingleChoiceFrameData(
- getDataFile(entry.gamefile.c_str()));
+ getDataFile("%s", entry.gamefile.c_str()));
addButtonToWindow(useId++,
desc, icon,
this, gridsizer, refData);
Only in scorched/src/scorched: SingleChoiceDialog.cpp.orig
diff -ur scorched.orig/src/scorched/SingleGames.cpp scorched/src/scorched/SingleGames.cpp
--- scorched.orig/src/scorched/SingleGames.cpp 2004-11-25 21:19:34.000000000 +0100
+++ scorched/src/scorched/SingleGames.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -56,7 +56,7 @@
if (!mainNode->getNamedChild("description", description)) return false;
if (!mainNode->getNamedChild("icon", icon)) return false;
if (!mainNode->getNamedChild("url", url)) return false;
- if (!checkDataFile(icon.c_str())) return false;
+ if (!checkDataFile("%s", icon.c_str())) return false;
XMLNode *gameNode = 0;
while (file.getRootNode()->getNamedChild("game", gameNode, false))
@@ -65,8 +65,8 @@
if (!gameNode->getNamedChild("description", entry.description)) return false;
if (!gameNode->getNamedChild("icon", entry.icon)) return false;
if (!gameNode->getNamedChild("gamefile", entry.gamefile)) return false;
- if (!checkDataFile(entry.icon.c_str())) return false;
- if (!checkDataFile(entry.gamefile.c_str())) return false;
+ if (!checkDataFile("%s", entry.icon.c_str())) return false;
+ if (!checkDataFile("%s", entry.gamefile.c_str())) return false;
if (!gameNode->failChildren()) return false;
entries.push_back(entry);
}
diff -ur scorched.orig/src/scorched/main.cpp scorched/src/scorched/main.cpp
--- scorched.orig/src/scorched/main.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/scorched/main.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -100,7 +100,7 @@
itor++)
{
const char *modDir = (*itor).c_str();
- std::string src = getModFile(modDir);
+ std::string src = getModFile("%s", modDir);
std::string dest = getSettingsFile("/oldmods/%s-%u", modDir, time(0));
if (DefinesUtil::dirExists(src.c_str()))
{
Only in scorched/src/scorched: main.cpp~
diff -ur scorched.orig/src/server/ServerAdminHandler.cpp scorched/src/server/ServerAdminHandler.cpp
--- scorched.orig/src/server/ServerAdminHandler.cpp 2005-06-20 02:35:08.000000000 +0200
+++ scorched/src/server/ServerAdminHandler.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -142,7 +142,7 @@
result +=
"-----------------------------------------------------\n";
- ServerCommon::sendString(destinationId, result.c_str());
+ ServerCommon::sendString(destinationId, "%s", result.c_str());
}
break;
case ComsAdminMessage::AdminLogout:
@@ -193,7 +193,7 @@
result +=
"-----------------------------------------------------\n";
- ServerCommon::sendString(destinationId, result.c_str());
+ ServerCommon::sendString(destinationId, "%s", result.c_str());
}
break;
case ComsAdminMessage::AdminShowAliases:
@@ -221,7 +221,7 @@
result +=
"-----------------------------------------------------\n";
- ServerCommon::sendString(destinationId, result.c_str());
+ ServerCommon::sendString(destinationId, "%s", result.c_str());
}
else ServerCommon::sendString(destinationId, "Unknown player for showaliases");
}
@@ -251,7 +251,7 @@
result +=
"-----------------------------------------------------\n";
- ServerCommon::sendString(destinationId, result.c_str());
+ ServerCommon::sendString(destinationId, "%s", result.c_str());
}
else ServerCommon::sendString(destinationId, "Unknown player for showipaliases");
}
@@ -391,21 +391,21 @@
adminTank->getName(),
message.getParam1());
- ServerCommon::sendString(0, message.getParam1());
+ ServerCommon::sendString(0, "%s", message.getParam1());
break;
case ComsAdminMessage::AdminAdminTalk:
ServerCommon::serverLog(0,
"\"%s\" admin admintalk \"%s\"",
adminTank->getName(),
message.getParam1());
- ServerCommon::sendStringAdmin(message.getParam1());
+ ServerCommon::sendStringAdmin("%s", message.getParam1());
break;
case ComsAdminMessage::AdminMessage:
ServerCommon::serverLog(0,
"\"%s\" admin message \"%s\"",
adminTank->getName(),
message.getParam1());
- ServerCommon::sendStringMessage(0, message.getParam1());
+ ServerCommon::sendStringMessage(0, "%s", message.getParam1());
break;
case ComsAdminMessage::AdminKillAll:
ServerCommon::serverLog(0,
diff -ur scorched.orig/src/server/ServerCommon.cpp scorched/src/server/ServerCommon.cpp
--- scorched.orig/src/server/ServerCommon.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/server/ServerCommon.cpp 2006-02-11 15:23:57.000000000 +0100
@@ -298,6 +298,6 @@
vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
- Logger::log(text);
+ Logger::log("%s", text);
}
}
Only in scorched/src/server: ServerCommon.cpp~
diff -ur scorched.orig/src/server/ServerNewGameState.cpp scorched/src/server/ServerNewGameState.cpp
--- scorched.orig/src/server/ServerNewGameState.cpp 2005-08-10 14:39:31.000000000 +0200
+++ scorched/src/server/ServerNewGameState.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -296,7 +296,7 @@
tankCloseness = height->startcloseness;
if (!height->startmask.empty())
{
- tankMask.loadFromFile(getDataFile(height->startmask.c_str()));
+ tankMask.loadFromFile(getDataFile("%s", height->startmask.c_str()));
DIALOG_ASSERT(tankMask.getBits());
}
}
diff -ur scorched.orig/src/server/ServerTimedMessage.cpp scorched/src/server/ServerTimedMessage.cpp
--- scorched.orig/src/server/ServerTimedMessage.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/server/ServerTimedMessage.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -61,6 +61,12 @@
entry.lastTime = currentTime;
std::string message = entry.messages.front();
+ /* Note message.c_str() is a user supplied printf format string
+ with possible a conversion specifier to display the ctime.
+ Since these messages are loaded from a local file this is
+ reasonable safe, although it would be better to just
+ always prefix times-messages with the ctime and to not
+ interpreted user supplied data this way. */
ServerCommon::sendString(0, message.c_str(), ctime(¤tTime));
Logger::log(message.c_str(), ctime(¤tTime));
entry.messages.pop_front();
diff -ur scorched.orig/src/server/ServerWebHandler.cpp scorched/src/server/ServerWebHandler.cpp
--- scorched.orig/src/server/ServerWebHandler.cpp 2005-08-14 21:11:42.000000000 +0200
+++ scorched/src/server/ServerWebHandler.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -312,17 +312,17 @@
const char *type = getField(fields, "type");
if (!type || 0 == strcmp(type, "all"))
{
- ServerCommon::sendString(0, say);
+ ServerCommon::sendString(0, "%s", say);
ServerCommon::serverLog(0, "Says : %s", say);
}
else if (0 == strcmp(type, "message"))
{
- ServerCommon::sendStringMessage(0, say);
+ ServerCommon::sendStringMessage(0, "%s", say);
ServerCommon::serverLog(0, "Messages : %s", say);
}
else if (0 == strcmp(type, "admin"))
{
- ServerCommon::sendStringAdmin(say);
+ ServerCommon::sendStringAdmin("%s", say);
ServerCommon::serverLog(0, "Admins Says : %s", say);
}
}
diff -ur scorched.orig/src/sound/Sound.cpp scorched/src/sound/Sound.cpp
--- scorched.orig/src/sound/Sound.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/sound/Sound.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -118,19 +118,19 @@
alDistanceModel(AL_INVERSE_DISTANCE);
GLConsole::instance()->addLine(false, "AL_VENDOR:");
- GLConsole::instance()->addLine(false,
+ GLConsole::instance()->addLine(false, "%s",
checkString((char *) alGetString(AL_VENDOR)));
GLConsole::instance()->addLine(false, "AL_VERSION:");
- GLConsole::instance()->addLine(false,
+ GLConsole::instance()->addLine(false, "%s",
checkString((char *) alGetString(AL_VERSION)));
GLConsole::instance()->addLine(false, "AL_RENDERER:");
- GLConsole::instance()->addLine(false,
+ GLConsole::instance()->addLine(false, "%s",
checkString((char *) alGetString(AL_RENDERER)));
GLConsole::instance()->addLine(false, "AL_EXTENSIONS:");
- GLConsole::instance()->addLine(false,
+ GLConsole::instance()->addLine(false, "%s",
checkString((char *) alGetString(AL_EXTENSIONS)));
GLConsole::instance()->addLine(false, "ALC_DEVICE_SPECIFIER:");
- GLConsole::instance()->addLine(false,
+ GLConsole::instance()->addLine(false, "%s",
checkString((char *) alcGetString(soundDevice, ALC_DEVICE_SPECIFIER)));
// Create all sound channels
diff -ur scorched.orig/src/sprites/ExplosionLaserBeamRenderer.cpp scorched/src/sprites/ExplosionLaserBeamRenderer.cpp
--- scorched.orig/src/sprites/ExplosionLaserBeamRenderer.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/sprites/ExplosionLaserBeamRenderer.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -49,7 +49,7 @@
{
SoundBuffer *firedSound =
Sound::instance()->fetchOrCreateBuffer( (char*)
- getDataFile(data));
+ getDataFile("%s", data));
SoundUtils::playAbsoluteSound(VirtualSoundPriority::eAction,
firedSound, position);
}
diff -ur scorched.orig/src/sprites/ExplosionTextures.cpp scorched/src/sprites/ExplosionTextures.cpp
--- scorched.orig/src/sprites/ExplosionTextures.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/sprites/ExplosionTextures.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -193,7 +193,7 @@
return *(*findItor).second;
}
- const char *fileName = getDataFile(name);
+ const char *fileName = getDataFile("%s", name);
if (DefinesUtil::fileExists(fileName))
{
GLBitmap *map = new GLBitmap;
diff -ur scorched.orig/src/sprites/MissileActionRenderer.cpp scorched/src/sprites/MissileActionRenderer.cpp
--- scorched.orig/src/sprites/MissileActionRenderer.cpp 2005-07-11 01:41:56.000000000 +0200
+++ scorched/src/sprites/MissileActionRenderer.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -92,7 +92,7 @@
if (0 != strcmp("none", engineSound))
{
SoundBuffer *rocket = Sound::instance()->fetchOrCreateBuffer(
- (char *) getDataFile(engineSound));
+ (char *) getDataFile("%s", engineSound));
sound_ = new VirtualSoundSource(VirtualSoundPriority::eMissile, true, false);
sound_->setPosition(shot->getCurrentPosition());
sound_->setGain(0.25f);
diff -ur scorched.orig/src/sprites/TextActionRenderer.cpp scorched/src/sprites/TextActionRenderer.cpp
--- scorched.orig/src/sprites/TextActionRenderer.cpp 2004-02-25 01:49:49.000000000 +0100
+++ scorched/src/sprites/TextActionRenderer.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -55,7 +55,7 @@
GLState currentState(GLState::DEPTH_ON | GLState::TEXTURE_ON);
glDepthMask(GL_FALSE);
GLWFont::instance()->getSmallPtFont()->drawBilboard(color_, 1.0f,
- position_[0], position_[1], position_[2],
+ position_[0], position_[1], position_[2], "%s",
text_.c_str());
glDepthMask(GL_TRUE);
diff -ur scorched.orig/src/tankgraph/GLWTankViewer.cpp scorched/src/tankgraph/GLWTankViewer.cpp
--- scorched.orig/src/tankgraph/GLWTankViewer.cpp 2005-06-04 03:56:53.000000000 +0200
+++ scorched/src/tankgraph/GLWTankViewer.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -215,6 +215,7 @@
{
toolTip_.setText(
"Model",
+ "%s",
models_[vectorPos]->getId().getModelName());
}
@@ -293,7 +294,7 @@
Vector color(0.3f, 0.3f, 0.3f);
GLWFont::instance()->getSmallPtFont()->
drawWidth(int(TankSquareSize * 2 + TankPadding),
- color, 10.0f, -70.0f, 75.0f, 0.0f,
+ color, 10.0f, -70.0f, 75.0f, 0.0f, "%s",
models_[pos]->getId().getModelName());
GLWFont::instance()->getSmallPtFont()->
drawWidth(int(TankSquareSize * 2 + TankPadding),
diff -ur scorched.orig/src/tankgraph/TankMenus.cpp scorched/src/tankgraph/TankMenus.cpp
--- scorched.orig/src/tankgraph/TankMenus.cpp 2006-02-11 15:14:43.000000000 +0100
+++ scorched/src/tankgraph/TankMenus.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -197,7 +197,7 @@
currentTank == tank?'>':' ',
description,
tank->getName(), modelId.getModelName());
- GLConsole::instance()->addLine(false, buffer);
+ GLConsole::instance()->addLine(false, "%s", buffer);
}
GLConsole::instance()->addLine(false,
diff -ur scorched.orig/src/tankgraph/TankModelRenderer.cpp scorched/src/tankgraph/TankModelRenderer.cpp
--- scorched.orig/src/tankgraph/TankModelRenderer.cpp 2005-07-19 23:45:37.000000000 +0200
+++ scorched/src/tankgraph/TankModelRenderer.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -170,14 +170,14 @@
{
Vector &bilX = GLCameraFrustum::instance()->getBilboardVectorX();
bilX *= 0.5f * (float) GLWFont::instance()->getSmallPtFont()->getWidth(
- 1, tank_->getName());
+ 1, "%s", tank_->getName());
glDepthMask(GL_FALSE);
GLWFont::instance()->getSmallPtFont()->drawBilboard(
tank_->getColor(), 1,
(float) tank_->getPhysics().getTankPosition()[0] - bilX[0],
(float) tank_->getPhysics().getTankPosition()[1] - bilX[1],
- (float) height + 8.0f,
+ (float) height + 8.0f, "%s",
tank_->getName());
glDepthMask(GL_TRUE);
}
@@ -188,7 +188,7 @@
if (OptionsDisplay::instance()->getDrawPlayerNames())
{
bilX *= 0.5f * (float) GLWFont::instance()->getSmallPtFont()->getWidth(
- 1, tank_->getName());
+ 1, "%s", tank_->getName());
bilX += bilX.Normalize() * 1.0f;
}
else
@@ -633,11 +633,11 @@
GLWFont::instance()->getSmallPtFont()->draw(
yellow, 10,
(float) posX_ + 47.0f, (float) posY_ - 4.0f, (float) posZ_,
- TankModelRendererHUD::getTextA());
+ "%s", TankModelRendererHUD::getTextA());
GLWFont::instance()->getSmallPtFont()->draw(
yellow, 10,
(float) posX_ + 47.0f, (float) posY_ - 15.0f, (float) posZ_,
- TankModelRendererHUD::getTextB());
+ "%s", TankModelRendererHUD::getTextB());
if (TankModelRendererHUD::getPercentage() >= 0.0f)
{
diff -ur scorched.orig/src/weapons/Accessory.cpp scorched/src/weapons/Accessory.cpp
--- scorched.orig/src/weapons/Accessory.cpp 2005-06-11 18:53:41.000000000 +0200
+++ scorched/src/weapons/Accessory.cpp 2006-02-11 15:14:55.000000000 +0100
@@ -65,7 +65,7 @@
// Get the accessory description
accessoryNode->getNamedChild("description", description_, false);
- toolTip_.setText(getName(), getDescription());
+ toolTip_.setText(getName(), "%s", getDescription());
// Get the accessory icon
if (accessoryNode->getNamedChild("icon", iconName_, false))
scorched3d-gcc41.patch:
--- NEW FILE scorched3d-gcc41.patch ---
--- scorched/src/landscape/LandscapePoints.h.gcc41 2006-02-05 20:16:45.000000000 +0100
+++ scorched/src/landscape/LandscapePoints.h 2006-02-05 20:16:58.000000000 +0100
@@ -41,7 +41,7 @@
int noPts_;
void createPoints(HeightMap &map, int width, int points);
- void LandscapePoints::findPoint(HeightMap &map, Position *pos, float x, float y);
+ void findPoint(HeightMap &map, Position *pos, float x, float y);
};
#endif
--- scorched/src/landscape/MovementMap.h.gcc41 2005-08-10 14:39:31.000000000 +0200
+++ scorched/src/landscape/MovementMap.h 2006-02-05 20:15:27.000000000 +0100
@@ -65,7 +65,7 @@
MovementMapEntry *entries_;
HeightMap &hMap_;
- unsigned int MovementMap::POINT_TO_UINT(unsigned int x, unsigned int y);
+ unsigned int POINT_TO_UINT(unsigned int x, unsigned int y);
void addPoint(unsigned int x, unsigned int y,
float height, float dist,
std::map<unsigned int, MovementMap::MovementMapEntry> &edgeMap,
scorched3d-help.patch:
--- NEW FILE scorched3d-help.patch ---
--- scorched/src/scorched/MainDialog.cpp.help 2006-02-06 12:24:58.000000000 +0100
+++ scorched/src/scorched/MainDialog.cpp 2006-02-06 12:25:42.000000000 +0100
@@ -131,8 +131,8 @@
#ifdef __DARWIN__
system(formatString("open %s", url));
#else
- system(formatString("mozilla %s", url));
- dialogMessage("Web site location", "%s", url);
+ system(formatString("htmlview %s&", url));
+ // dialogMessage("Web site location", "%s", url);
#endif // __DARWIN__
#endif // _WIN32
}
--- scorched/src/scorched/HtmlHelpDialog.cpp.help 2006-02-09 19:14:11.000000000 +0100
+++ scorched/src/scorched/HtmlHelpDialog.cpp 2006-02-09 19:14:49.000000000 +0100
@@ -137,13 +137,13 @@
void HelpFrame::onHome(wxCommandEvent &event)
{
html_->HistoryClear();
- html_->LoadPage(wxString(getDocFile("documentation/html/index.html"), wxConvUTF8));
+ html_->LoadPage(wxString(getDocFile("html/index.html"), wxConvUTF8));
}
void showHtmlHelpDialog()
{
// For the moment just show the documentation in the default web browser
- showURL(getDocFile("documentation/html/index.html"));
+ showURL(getDocFile("html/index.html"));
//HelpFrame *frame = new HelpFrame();
//frame->Show();
scorched3d-negint.patch:
--- NEW FILE scorched3d-negint.patch ---
--- scorched.orig/src/server/ServerConnectHandler.cpp.negint 2006-02-11 16:54:09.000000000 +0100
+++ scorched.orig/src/server/ServerConnectHandler.cpp 2006-02-11 16:58:06.000000000 +0100
@@ -121,9 +121,9 @@
}
// Check player availability
- if ((int) message.getNoPlayers() >
+ if (message.getNoPlayers() > (unsigned int)(
ScorchedServer::instance()->getOptionsGame().getNoMaxPlayers() -
- ScorchedServer::instance()->getTankContainer().getNoOfTanks())
+ ScorchedServer::instance()->getTankContainer().getNoOfTanks()))
{
ServerCommon::sendString(destinationId,
"--------------------------------------------------\n"
scorched3d-openal.patch:
--- NEW FILE scorched3d-openal.patch ---
--- scorched/configure.ac.openal 2006-02-06 10:55:19.000000000 +0100
+++ scorched/configure.ac 2006-02-06 10:55:31.000000000 +0100
@@ -114,7 +114,7 @@
if test x"$use_static_openal" = x"yes"; then
LIBS="$LIBS /usr/local/lib/libopenal.a"
else
- LIBS="$LIBS `$OPENAL_CONFIG --libs`"
+ LIBS="$LIBS `$OPENAL_CONFIG --libs` -lalut"
fi
CFLAGS="$CFLAGS `$OPENAL_CONFIG --cflags`"
scorched3d-opengl-without-context.patch:
--- NEW FILE scorched3d-opengl-without-context.patch ---
diff -ur scorched.orig/src/landscape/LandscapeMaps.cpp scorched/src/landscape/LandscapeMaps.cpp
--- scorched.orig/src/landscape/LandscapeMaps.cpp 2006-02-12 11:09:19.000000000 +0100
+++ scorched/src/landscape/LandscapeMaps.cpp 2006-02-12 10:27:33.000000000 +0100
@@ -92,7 +92,8 @@
void LandscapeMaps::generateObjects(
ScorchedContext &context,
- ProgressCounter *counter)
+ ProgressCounter *counter,
+ bool server)
{
LandscapeTex *tex = &getTex(context);
@@ -115,7 +114,7 @@
}
RandomGenerator objectsGenerator;
objectsGenerator.seed(getSeed());
- objects_.generate(objectsGenerator, *place, context, counter);
+ objects_.generate(objectsGenerator, *place, context, counter, server);
}
}
}
diff -ur scorched.orig/src/landscape/LandscapeMaps.h scorched/src/landscape/LandscapeMaps.h
--- scorched.orig/src/landscape/LandscapeMaps.h 2005-06-13 10:24:37.000000000 +0200
+++ scorched/src/landscape/LandscapeMaps.h 2006-02-12 10:23:51.000000000 +0100
@@ -57,7 +57,8 @@
LandscapeDefinition *hdef,
ProgressCounter *counter = 0);
void generateObjects(ScorchedContext &context,
- ProgressCounter *counter = 0);
+ ProgressCounter *counter = 0,
+ bool server = false);
// Compresses the level into a form that can be
// sent to the clients
diff -ur scorched.orig/src/landscape/LandscapeObjects.cpp scorched/src/landscape/LandscapeObjects.cpp
--- scorched.orig/src/landscape/LandscapeObjects.cpp 2005-07-17 13:32:05.000000000 +0200
+++ scorched/src/landscape/LandscapeObjects.cpp 2006-02-12 10:36:17.000000000 +0100
@@ -111,7 +111,8 @@
void LandscapeObjects::generate(RandomGenerator &generator,
LandscapePlace &place,
ScorchedContext &context,
- ProgressCounter *counter)
+ ProgressCounter *counter,
+ bool server)
{
if (counter) counter->setNewOp("Populating Landscape");
@@ -130,7 +131,7 @@
LandscapePlaceObjectsPlacementTree *placement =
(LandscapePlaceObjectsPlacementTree *)
place.objects[i];
- gen.generateObjects(generator, *placement, context, counter);
+ gen.generateObjects(generator, *placement, context, counter, server);
}
else if (0 == strcmp(placementtype.c_str(), "mask"))
{
@@ -139,7 +140,7 @@
LandscapePlaceObjectsPlacementMask *placement =
(LandscapePlaceObjectsPlacementMask *)
place.objects[i];
- gen.generateObjects(generator, *placement, context, counter);
+ gen.generateObjects(generator, *placement, context, counter, server);
}
else if (0 == strcmp(placementtype.c_str(), "direct"))
{
@@ -148,7 +149,7 @@
LandscapePlaceObjectsPlacementDirect *placement =
(LandscapePlaceObjectsPlacementDirect *)
place.objects[i];
- gen.generateObjects(generator, *placement, context, counter);
+ gen.generateObjects(generator, *placement, context, counter, server);
}
else
{
diff -ur scorched.orig/src/landscape/LandscapeObjects.h scorched/src/landscape/LandscapeObjects.h
--- scorched.orig/src/landscape/LandscapeObjects.h 2005-07-17 13:32:05.000000000 +0200
+++ scorched/src/landscape/LandscapeObjects.h 2006-02-12 10:28:11.000000000 +0100
@@ -40,7 +40,8 @@
void generate(RandomGenerator &generator,
LandscapePlace &place,
ScorchedContext &context,
- ProgressCounter *counter = 0);
+ ProgressCounter *counter = 0,
+ bool server = false);
void removeAllObjects();
void removeObjects(ScorchedContext &context,
diff -ur scorched.orig/src/landscape/LandscapeObjectsPlacement.cpp scorched/src/landscape/LandscapeObjectsPlacement.cpp
--- scorched.orig/src/landscape/LandscapeObjectsPlacement.cpp 2006-02-12 11:09:19.000000000 +0100
+++ scorched/src/landscape/LandscapeObjectsPlacement.cpp 2006-02-12 10:45:42.000000000 +0100
@@ -34,7 +34,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementTree &placement,
ScorchedContext &context,
- ProgressCounter *counter)
+ ProgressCounter *counter,
+ bool server)
{
// Generate a map of where the trees should go
unsigned char objectMap[64 * 64];
@@ -164,7 +165,12 @@
placement.objecttype.c_str());
}
- float mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
+ float mult;
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
LandscapeObjectsGroupEntry *group = 0;
if (placement.groupname.c_str()[0])
@@ -219,8 +226,12 @@
//Vector position(entry->posX, entry->posY, entry->posZ);
//DeformLandscape::flattenArea(context, position, 0);
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- lx * mult, ly * mult, modelSize * entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ lx * mult, ly * mult, modelSize * entry->size * mult, 1.0f);
}
else
{
@@ -237,8 +248,12 @@
entry->removeaction = placement.removeaction;
entry->burnaction = placement.burnaction;
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- lx * mult, ly * mult, entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ lx * mult, ly * mult, entry->size * mult, 1.0f);
}
context.landscapeMaps->getObjects().addObject(
@@ -260,7 +275,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementMask &placement,
ScorchedContext &context,
- ProgressCounter *counter)
+ ProgressCounter *counter,
+ bool server)
{
bool pine = true;
float snowHeight = 20.0f;
@@ -313,10 +329,14 @@
placement.groupname.c_str(), true);
}
- float mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
-
+ float mult;
const int NoIterations = placement.numobjects;
int objectCount = 0;
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
for (int i=0; i<NoIterations; i++)
{
if (i % 1000 == 0) if (counter)
@@ -402,8 +422,12 @@
//Vector position(entry->posX, entry->posY, entry->posZ);
//DeformLandscape::flattenArea(context, position, 0);
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- lx * mult, ly * mult, modelSize * entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ lx * mult, ly * mult, modelSize * entry->size * mult, 1.0f);
}
else
{
@@ -420,8 +444,12 @@
entry->removeaction = placement.removeaction;
entry->burnaction = placement.burnaction;
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- lx * mult, ly * mult, entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ lx * mult, ly * mult, entry->size * mult, 1.0f);
}
context.landscapeMaps->getObjects().addObject(
@@ -444,7 +472,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementDirect &placement,
ScorchedContext &context,
- ProgressCounter *counter)
+ ProgressCounter *counter,
+ bool server)
{
bool pine = true;
float snowHeight = 20.0f;
@@ -489,7 +518,12 @@
placement.groupname.c_str(), true);
}
- float mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
+ float mult;
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ mult = (float) Landscape::instance()->getMainMap().getWidth() / 256.0f;
std::list<LandscapePlaceObjectsPlacementDirect::Position>::iterator itor;
int i = 0;
@@ -526,9 +560,13 @@
//Vector position(entry->posX, entry->posY, entry->posZ);
//DeformLandscape::flattenArea(context, position, 0);
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- position.position[0] * mult, position.position[1] * mult,
- modelSize * entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ position.position[0] * mult, position.position[1] * mult,
+ modelSize * entry->size * mult, 1.0f);
}
else
{
@@ -545,9 +583,13 @@
entry->removeaction = placement.removeaction;
entry->burnaction = placement.burnaction;
- GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
- position.position[0] * mult, position.position[1] * mult,
- entry->size * mult, 1.0f);
+ // Do not draw/use Landscape::instance()->getMainMap() when running
+ // as server, because LandScape uses openGL functions and the server
+ // does not have an openGL context set.
+ if (!server)
+ GLBitmapModifier::addCircle(Landscape::instance()->getMainMap(),
+ position.position[0] * mult, position.position[1] * mult,
+ entry->size * mult, 1.0f);
}
context.landscapeMaps->getObjects().addObject(
diff -ur scorched.orig/src/landscape/LandscapeObjectsPlacement.h scorched/src/landscape/LandscapeObjectsPlacement.h
--- scorched.orig/src/landscape/LandscapeObjectsPlacement.h 2005-06-15 16:21:59.000000000 +0200
+++ scorched/src/landscape/LandscapeObjectsPlacement.h 2006-02-12 10:35:17.000000000 +0100
@@ -33,7 +33,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementTree &placement,
ScorchedContext &context,
- ProgressCounter *counter = 0);
+ ProgressCounter *counter = 0,
+ bool server = false);
};
class LandscapePlaceObjectsPlacementMask;
@@ -44,7 +45,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementMask &placement,
ScorchedContext &context,
- ProgressCounter *counter = 0);
+ ProgressCounter *counter = 0,
+ bool server = false);
};
class LandscapePlaceObjectsPlacementDirect;
@@ -55,7 +57,8 @@
RandomGenerator &generator,
LandscapePlaceObjectsPlacementDirect &placement,
ScorchedContext &context,
- ProgressCounter *counter = 0);
+ ProgressCounter *counter = 0,
+ bool server = false);
};
#endif // __INCLUDE_LandscapeObjectsPlacementh_INCLUDE__
diff -ur scorched.orig/src/server/ServerNewGameState.cpp scorched/src/server/ServerNewGameState.cpp
--- scorched.orig/src/server/ServerNewGameState.cpp 2006-02-12 11:09:19.000000000 +0100
+++ scorched/src/server/ServerNewGameState.cpp 2006-02-12 10:24:15.000000000 +0100
@@ -133,7 +133,7 @@
ScorchedServer::instance()->getContext().landscapeMaps->generateHMap(
ScorchedServer::instance()->getContext(), defn);
ScorchedServer::instance()->getContext().landscapeMaps->generateObjects(
- ScorchedServer::instance()->getContext());
+ ScorchedServer::instance()->getContext(), 0, 1);
// Set the start positions for the tanks
// Must be generated after the level as it alters the
scorched3d-pgsql.patch:
--- NEW FILE scorched3d-pgsql.patch ---
diff -ur scorched.orig/src/common/StatsLoggerPGSQL.cpp scorched/src/common/StatsLoggerPGSQL.cpp
--- scorched.orig/src/common/StatsLoggerPGSQL.cpp 2005-03-22 18:45:49.000000000 +0100
+++ scorched/src/common/StatsLoggerPGSQL.cpp 2006-02-10 11:50:42.000000000 +0100
@@ -72,8 +72,8 @@
int sqlLen = vsnprintf(text, SQL_BUFFER_SIZE, fmt, ap);
va_end(ap);
- if(sqlLen >= SQL_BUFFER_SIZE) {
- Logger::log(0, "pgsql: Query failed, too long.\n");
+ if(sqlLen >= SQL_BUFFER_SIZE || sqlLen < 0) {
+ Logger::log("pgsql: Query failed, too long.\n");
return false;
}
@@ -113,15 +113,15 @@
passwd.c_str());
if (pgsql_ && PQstatus(pgsql_) == CONNECTION_OK)
{
- Logger::log(0, "pgsql stats logger started");
+ Logger::log("pgsql stats logger started");
}
else
{
success_ = false;
- Logger::log(0, "pgsql stats logger failed to start. "
+ Logger::log("pgsql stats logger failed to start. "
"Error: %s",
PQerrorMessage(pgsql_));
- Logger::log(0, "pgsql params : host %s, user %s, passwd %s, db %s",
+ Logger::log("pgsql params : host %s, user %s, passwd %s, db %s",
host.c_str(), user.c_str(),
passwd.c_str(), db.c_str());
if(pgsql_) {
@@ -133,13 +133,13 @@
else
{
success_ = false;
- Logger::log(0, "Failed to parse %s settings file.", fileName);
+ Logger::log("Failed to parse %s settings file.", fileName);
}
}
else
{
success_ = false;
- Logger::log(0, "Failed to parse %s settings file. Error: %s",
+ Logger::log("Failed to parse %s settings file. Error: %s",
fileName,
file.getParserError());
}
@@ -618,11 +618,11 @@
if(lastresult_ && PQntuples(lastresult_) > 0) {
playerId = atoi(PQgetvalue(lastresult_,0,0));
}
- Logger::log(0, "Add new stats user \"%i\"", playerId);
+ Logger::log("Add new stats user \"%i\"", playerId);
}
else
{
- Logger::log(0, "Found stats user \"%i\"", playerId);
+ Logger::log("Found stats user \"%i\"", playerId);
}
// Store this new player id
scorched3d-sprintf.patch:
--- NEW FILE scorched3d-sprintf.patch ---
diff -ur scorched.orig/src/3dsparse/MSModelFactory.cpp scorched/src/3dsparse/MSModelFactory.cpp
--- scorched.orig/src/3dsparse/MSModelFactory.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/3dsparse/MSModelFactory.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -278,7 +278,8 @@
if (sscanf(buffer, "%s", textureName) != 1)
returnError(fileName, "No material texture format");
textureName[strlen(textureName)-1] = '\0';
- sprintf(fullTextureName, "%s/%s", filePath, &textureName[1]);
+ snprintf(fullTextureName, sizeof(fullTextureName), "%s/%s",
+ filePath, &textureName[1]);
while (sep=strchr(fullTextureName, '\\')) *sep = '/';
// alphamap
@@ -289,7 +290,8 @@
if (sscanf(buffer, "%s", textureNameAlpha) != 1)
returnError(fileName, "No material alpha texture format");
textureNameAlpha[strlen(textureNameAlpha)-1] = '\0';
- sprintf(fullTextureAlphaName, "%s/%s", filePath, &textureNameAlpha[1]);
+ snprintf(fullTextureAlphaName, sizeof(fullTextureAlphaName),
+ "%s/%s", filePath, &textureNameAlpha[1]);
while (sep=strchr(fullTextureAlphaName, '\\')) *sep = '/';
int modelIndex = 0;
diff -ur scorched.orig/src/3dsparse/ModelID.cpp scorched/src/3dsparse/ModelID.cpp
--- scorched.orig/src/3dsparse/ModelID.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/3dsparse/ModelID.cpp 2006-02-11 15:10:00.000000000 +0100
@@ -75,7 +75,8 @@
if (!modelNode->getNamedChild("mesh", meshNode)) return false;
const char *meshNameContent = meshNode->getContent();
static char meshName[1024];
- sprintf(meshName, "%s/%s", directory, meshNameContent);
+ snprintf(meshName, sizeof(meshName), "%s/%s", directory,
+ meshNameContent);
if (!DefinesUtil::fileExists(getDataFile(meshName)))
{
dialogMessage("Scorched Models",
@@ -89,7 +90,8 @@
static char skinName[1024];
if (strcmp(skinNameContent, "none") != 0)
{
- sprintf(skinName, "%s/%s", directory, skinNameContent);
+ snprintf(skinName, sizeof(skinName), "%s/%s",
+ directory, skinNameContent);
if (!DefinesUtil::fileExists(getDataFile(skinName)))
{
dialogMessage("Scorched Models",
@@ -100,7 +102,8 @@
}
else
{
- sprintf(skinName, "%s", skinNameContent);
+ snprintf(skinName, sizeof(skinName), "%s",
+ skinNameContent);
}
meshName_ = meshName;
@@ -110,7 +113,8 @@
{
const char *meshNameContent = modelNode->getContent();
static char meshName[1024];
- sprintf(meshName, "%s/%s", directory, meshNameContent);
+ snprintf(meshName, sizeof(meshName), "%s/%s", directory,
+ meshNameContent);
if (!DefinesUtil::fileExists(getDataFile(meshName)))
{
Only in scorched/src/3dsparse: ModelID.cpp~
diff -ur scorched.orig/src/3dsparse/aseFile.tab.cpp scorched/src/3dsparse/aseFile.tab.cpp
--- scorched.orig/src/3dsparse/aseFile.tab.cpp 2005-04-12 00:19:08.000000000 +0200
+++ scorched/src/3dsparse/aseFile.tab.cpp 2006-02-11 15:10:46.000000000 +0100
@@ -1056,7 +1056,7 @@
int aseerror(const char *errmsg)
{
char buffer[1024];
- sprintf(buffer, "%i:%s\n", aselineno, errmsg);
+ snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, errmsg);
dialogMessage("Lexer", buffer);
return 0;
}
@@ -1064,7 +1064,7 @@
int asewarning(const char *warningmsg)
{
char buffer[1024];
- sprintf(buffer, "%i:%s\n", aselineno, warningmsg);
+ snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, warningmsg);
dialogMessage("Lexer", buffer);
return 0;
}
@@ -1072,7 +1072,7 @@
int asedebug(const char *debugmsg)
{
char buffer[1024];
- sprintf(buffer, "%i:%s\n", aselineno, debugmsg);
+ snprintf(buffer, sizeof(buffer), "%i:%s\n", aselineno, debugmsg);
dialogMessage("Lexer", buffer);
return 0;
}
Only in scorched/src/3dsparse: aseFile.tab.cpp~
diff -ur scorched.orig/src/GLEXT/GLConsole.cpp scorched/src/GLEXT/GLConsole.cpp
--- scorched.orig/src/GLEXT/GLConsole.cpp 2005-04-05 00:35:23.000000000 +0200
+++ scorched/src/GLEXT/GLConsole.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -265,7 +265,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, TEXT_SIZE, fmt, ap);
va_end(ap);
DIALOG_ASSERT(strlen(text)<TEXT_SIZE);
diff -ur scorched.orig/src/GLEXT/GLConsoleRuleFn.cpp scorched/src/GLEXT/GLConsoleRuleFn.cpp
--- scorched.orig/src/GLEXT/GLConsoleRuleFn.cpp 2003-07-10 18:29:16.000000000 +0200
+++ scorched/src/GLEXT/GLConsoleRuleFn.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -136,7 +136,7 @@
break;
case GLConsoleRuleTypeNumber:
static char buffer[10];
- sprintf(buffer,"%.2f", user_->getNumberParam(name_.c_str()));
+ snprintf(buffer, sizeof(buffer), "%.2f", user_->getNumberParam(name_.c_str()));
value = buffer;
break;
case GLConsoleRuleTypeString:
diff -ur scorched.orig/src/GLEXT/GLFont2d.cpp scorched/src/GLEXT/GLFont2d.cpp
--- scorched.orig/src/GLEXT/GLFont2d.cpp 2005-07-11 22:40:36.000000000 +0200
+++ scorched/src/GLEXT/GLFont2d.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -56,7 +56,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
float width = 0.0f;
@@ -75,7 +75,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
drawString((GLsizei) strlen(text), color, 1.0f, size, x, y, z, text, false);
@@ -89,7 +89,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
drawString((GLsizei) strlen(text), color, alpha, size, x, y, z, text, false);
@@ -103,7 +103,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
drawString((GLsizei) strlen(text), color, 1.0f, size, x, y, z, text, false, size2);
@@ -118,7 +118,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
int s = start;
@@ -143,7 +143,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
int l = 0;
@@ -165,7 +165,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
drawString((GLsizei) strlen(text), color, 1.0f, size, x, y, z, text, true);
diff -ur scorched.orig/src/GLW/GLWListView.cpp scorched/src/GLW/GLWListView.cpp
--- scorched.orig/src/GLW/GLWListView.cpp 2005-06-20 02:35:07.000000000 +0200
+++ scorched/src/GLW/GLWListView.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -107,7 +107,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
lines_.push_back(text);
diff -ur scorched.orig/src/GLW/GLWScorchedInfo.cpp scorched/src/GLW/GLWScorchedInfo.cpp
--- scorched.orig/src/GLW/GLWScorchedInfo.cpp 2005-02-13 01:05:13.000000000 +0100
+++ scorched/src/GLW/GLWScorchedInfo.cpp 2006-02-11 15:11:46.000000000 +0100
@@ -86,7 +86,7 @@
}
else
{
- sprintf(buffer, "Force %.0f",
+ snprintf(buffer, sizeof(buffer), "Force %.0f",
ScorchedClient::instance()->
getOptionsTransient().getWindSpeed());
}
@@ -237,7 +237,7 @@
setToolTip(&model->getTips()->weaponTip);
static char buffer[256];
- sprintf(buffer, "%s",
+ snprintf(buffer, sizeof(buffer), "%s",
current->getAccessories().getWeapons().getCurrent()->getName());
float weaponWidth = (float) GLWFont::instance()->getSmallPtFont()->
getWidth(fontSize_, buffer);
Only in scorched/src/GLW: GLWScorchedInfo.cpp~
Only in scorched/src/GLW: GLWSelectorPart.cpp.orig
diff -ur scorched.orig/src/GLW/GLWToolTip.cpp scorched/src/GLW/GLWToolTip.cpp
--- scorched.orig/src/GLW/GLWToolTip.cpp 2005-08-12 16:20:11.000000000 +0200
+++ scorched/src/GLW/GLWToolTip.cpp 2006-02-11 15:07:49.000000000 +0100
@@ -58,7 +58,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, TEXT_SIZE, fmt, ap);
va_end(ap);
texts_.clear();
Only in scorched/src/GLW: GLWToolTip.cpp~
diff -ur scorched.orig/src/XML/XMLParser.cpp scorched/src/XML/XMLParser.cpp
--- scorched.orig/src/XML/XMLParser.cpp 2005-07-03 01:50:03.000000000 +0200
+++ scorched/src/XML/XMLParser.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -91,7 +91,7 @@
name_(name), parent_(0), type_(type)
{
char buffer[20];
- sprintf(buffer, "%.2f", content);
+ snprintf(buffer, sizeof(buffer), "%.2f", content);
content_ = buffer;
}
@@ -460,7 +460,8 @@
XML_Error errorCode = XML_GetErrorCode(p_);
static char message[1024];
- sprintf(message, "Parse Error, File %s: Line:%i Col:%i Error:%s",
+ snprintf(message, sizeof(message),
+ "Parse Error, File %s: Line:%i Col:%i Error:%s",
source_.c_str(),
XML_GetCurrentLineNumber(p_),
XML_GetCurrentColumnNumber(p_),
diff -ur scorched.orig/src/client/ServerBrowserServerList.cpp scorched/src/client/ServerBrowserServerList.cpp
--- scorched.orig/src/client/ServerBrowserServerList.cpp 2005-06-08 19:29:38.000000000 +0200
+++ scorched/src/client/ServerBrowserServerList.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -54,7 +54,7 @@
{
// Create the message that will be sent to the master server
static char buffer[1024];
- sprintf(buffer,
+ snprintf(buffer, sizeof(buffer),
"GET %s/servers.php HTTP/1.0\r\n"
"User-Agent: Scorched3D\r\n"
"Host: %s\r\n"
diff -ur scorched.orig/src/client/SpeedChange.cpp scorched/src/client/SpeedChange.cpp
--- scorched.orig/src/client/SpeedChange.cpp 2004-11-22 00:19:51.000000000 +0100
+++ scorched/src/client/SpeedChange.cpp 2006-02-11 15:12:44.000000000 +0100
@@ -58,7 +58,7 @@
{
GLState state(GLState::BLEND_ON | GLState::TEXTURE_OFF);
static char buffer[10];
- sprintf(buffer, "%.1fX", speed);
+ snprintf(buffer, sizeof(buffer), "%.1fX", speed);
static Vector fontColor(0.7f, 0.7f, 0.2f);
GLWFont::instance()->getLargePtFont()->draw(fontColor, 20, 10.0f, 10.0f, 0.0f, buffer);
Only in scorched/src/client: SpeedChange.cpp~
diff -ur scorched.orig/src/common/ARGParser.cpp scorched/src/common/ARGParser.cpp
--- scorched.orig/src/common/ARGParser.cpp 2005-07-24 21:34:00.000000000 +0200
+++ scorched/src/common/ARGParser.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -102,7 +102,7 @@
else
{
char buffer[255];
- sprintf(buffer, "ERROR: Unknown parameter : \"%s\"\n\n", firstCommand.c_str());
+ snprintf(buffer, sizeof(buffer), "ERROR: Unknown parameter : \"%s\"\n\n", firstCommand.c_str());
showArgs(buffer);
return false;
}
@@ -249,7 +249,7 @@
else if (itor->second.destI || itor->second.destInt) type = "<int>";
char buffer2[255];
- sprintf(buffer2, "\t%s %s", itor->first.c_str(), type);
+ snprintf(buffer2, sizeof(buffer2), "\t%s %s", itor->first.c_str(), type);
if (itor->second.help.size())
{
strcat(buffer2, std::string(abs(30 - int(strlen(buffer2))), ' ').c_str());
diff -ur scorched.orig/src/common/Defines.cpp scorched/src/common/Defines.cpp
--- scorched.orig/src/common/Defines.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/common/Defines.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -72,7 +72,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
#ifdef _WIN32
@@ -93,21 +93,14 @@
void dialogAssert(const char *lineText, const int line, const char *file)
{
- // Dont use formatString here as this method is called by formatString.
- char buffer[20048];
- sprintf(buffer, "%s\n%i:%s", lineText, line, file);
- dialogMessage("Program Assert", buffer);
+ dialogMessage("Program Assert", "%s\n%i:%s", lineText, line, file);
exit(64);
}
const char *formatStringList(const char *format, va_list ap)
{
static char buffer[20048];
- buffer[sizeof(buffer) - 1] = '\0';
- vsprintf(buffer, format, ap);
- if (buffer[sizeof(buffer) - 1] != 0)
- dialogAssert("buffer[sizeof(buffer) - 1] == 0", __LINE__, __FILE__);
-
+ vsnprintf(buffer, sizeof(buffer), format, ap);
return buffer;
}
@@ -160,18 +153,20 @@
static char buffer[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
- sprintf(buffer, getModFile("%s/%s", DefinesUtil::getDataFileMod(), filename));
+ snprintf(buffer, sizeof(buffer), "%s",
+ getModFile("%s/%s", DefinesUtil::getDataFileMod(), filename));
DefinesUtil::fileDos2Unix(buffer);
if (DefinesUtil::fileExists(buffer)) return buffer;
- sprintf(buffer, getGlobalModFile("%s/%s", DefinesUtil::getDataFileMod(), filename));
+ snprintf(buffer, sizeof(buffer), "%s",
+ getGlobalModFile("%s/%s", DefinesUtil::getDataFileMod(), filename));
DefinesUtil::fileDos2Unix(buffer);
if (DefinesUtil::fileExists(buffer)) return buffer;
- sprintf(buffer, S3D_DATADIR "/%s", filename);
+ snprintf(buffer, sizeof(buffer), S3D_DATADIR "/%s", filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
@@ -182,7 +177,7 @@
static char filename[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
const char *dataFileName = getDataFile(filename);
@@ -205,9 +200,9 @@
static char buffer[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
- sprintf(buffer, S3D_DOCDIR "/%s", filename);
+ snprintf(buffer, sizeof(buffer), S3D_DOCDIR "/%s", filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -217,7 +212,7 @@
static char filename[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
static std::string homeDir;
@@ -231,7 +226,7 @@
}
static char buffer[1024];
- sprintf(buffer, "%s/%s", homeDir.c_str(), filename);
+ snprintf(buffer, sizeof(buffer), "%s/%s", homeDir.c_str(), filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -242,7 +237,7 @@
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
static std::string homeDir;
@@ -261,7 +256,7 @@
}
static char buffer[1024];
- sprintf(buffer, "%s/%s", homeDir.c_str(), filename);
+ snprintf(buffer, sizeof(buffer), "%s/%s", homeDir.c_str(), filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -272,7 +267,7 @@
static char buffer[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
const char *homeDirStr = getSettingsFile("");
@@ -280,7 +275,7 @@
if (DefinesUtil::dirExists(newDir.c_str())) homeDirStr = newDir.c_str();
else if (DefinesUtil::dirMake(newDir.c_str())) homeDirStr = newDir.c_str();
- sprintf(buffer, "%s/%s", homeDirStr, filename);
+ snprintf(buffer, sizeof(buffer), "%s/%s", homeDirStr, filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -290,7 +285,7 @@
static char filename[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
static char buffer[1024];
@@ -299,7 +294,7 @@
if (DefinesUtil::dirExists(newDir.c_str())) homeDirStr = newDir.c_str();
else if (DefinesUtil::dirMake(newDir.c_str())) homeDirStr = newDir.c_str();
- sprintf(buffer, "%s/%s", homeDirStr, filename);
+ snprintf(buffer, sizeof(buffer), "%s/%s", homeDirStr, filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -309,7 +304,7 @@
static char filename[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
static std::string modDir;
@@ -324,7 +319,7 @@
}
static char buffer[1024];
- sprintf(buffer, "%s/%s", modDir.c_str(), filename);
+ snprintf(buffer, sizeof(buffer), "%s/%s", modDir.c_str(), filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
@@ -334,11 +329,11 @@
static char filename[1024];
va_list ap;
va_start(ap, file);
- vsprintf(filename, file, ap);
+ vsnprintf(filename, sizeof(filename), file, ap);
va_end(ap);
static char buffer[1024];
- sprintf(buffer, S3D_DATADIR "/data/globalmods/%s", filename);
+ snprintf(buffer, sizeof(buffer), S3D_DATADIR "/data/globalmods/%s", filename);
DefinesUtil::fileDos2Unix(buffer);
return buffer;
}
diff -ur scorched.orig/src/common/FileLines.cpp scorched/src/common/FileLines.cpp
--- scorched.orig/src/common/FileLines.cpp 2004-11-09 00:43:23.000000000 +0100
+++ scorched/src/common/FileLines.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -96,7 +96,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
fileLines_.push_back(text);
diff -ur scorched.orig/src/common/Logger.cpp scorched/src/common/Logger.cpp
--- scorched.orig/src/common/Logger.cpp 2005-06-20 02:35:08.000000000 +0200
+++ scorched/src/common/Logger.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -87,7 +87,7 @@
static char text[2048];
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
LoggerInfo info;
diff -ur scorched.orig/src/common/StatsLoggerFile.cpp scorched/src/common/StatsLoggerFile.cpp
--- scorched.orig/src/common/StatsLoggerFile.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/common/StatsLoggerFile.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -124,7 +124,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "fired \"%s\" [%s] \"%s\"",
+ snprintf(message, sizeof(message), "fired \"%s\" [%s] \"%s\"",
firedTank->getName(), firedTank->getUniqueId(),
weapon->getParent()->getName());
@@ -143,7 +143,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "resigined \"%s\" [%s]",
+ snprintf(message, sizeof(message), "resigined \"%s\" [%s]",
resignedTank->getName(), resignedTank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -160,7 +160,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "joined \"%s\" [%s]",
+ snprintf(message, sizeof(message), "joined \"%s\" [%s]",
tank->getName(), tank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -177,7 +177,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "connected \"%s\" [%s]",
+ snprintf(message, sizeof(message), "connected \"%s\" [%s]",
tank->getName(), tank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -194,7 +194,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "disconnected \"%s\" [%s]",
+ snprintf(message, sizeof(message), "disconnected \"%s\" [%s]",
tank->getName(), tank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -211,7 +211,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "killed \"%s\" [%s] \"%s\" [%s] \"%s\"",
+ snprintf(message, sizeof(message), "killed \"%s\" [%s] \"%s\" [%s] \"%s\"",
firedTank->getName(), firedTank->getUniqueId(),
deadTank->getName(), deadTank->getUniqueId(),
weapon->getParent()->getName());
@@ -230,7 +230,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "teamkilled \"%s\" [%s] \"%s\" [%s] \"%s\"",
+ snprintf(message, sizeof(message), "teamkilled \"%s\" [%s] \"%s\" [%s] \"%s\"",
firedTank->getName(), firedTank->getUniqueId(),
deadTank->getName(), deadTank->getUniqueId(),
weapon->getParent()->getName());
@@ -249,7 +249,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "selfkilled \"%s\" [%s] \"%s\"",
+ snprintf(message, sizeof(message), "selfkilled \"%s\" [%s] \"%s\"",
firedTank->getName(), firedTank->getUniqueId(),
weapon->getParent()->getName());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
@@ -267,7 +267,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "won \"%s\" [%s]",
+ snprintf(message, sizeof(message), "won \"%s\" [%s]",
tank->getName(), tank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -284,7 +284,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "overallwinner \"%s\" [%s]",
+ snprintf(message, sizeof(message), "overallwinner \"%s\" [%s]",
tank->getName(), tank->getUniqueId());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
@@ -301,7 +301,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "weaponfired \"%s\"", weapon->getParent()->getName());
+ snprintf(message, sizeof(message), "weaponfired \"%s\"", weapon->getParent()->getName());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
}
@@ -317,7 +317,7 @@
if (nl) *nl = '\0';
char message[1024];
- sprintf(message, "weaponkilled \"%s\"", weapon->getParent()->getName());
+ snprintf(message, sizeof(message), "weaponkilled \"%s\"", weapon->getParent()->getName());
LoggerInfo info(LoggerInfo::TypeNormal, message, time);
statsLogger_->logMessage(info);
}
diff -ur scorched.orig/src/common/StatsLoggerMySQL.cpp scorched/src/common/StatsLoggerMySQL.cpp
--- scorched.orig/src/common/StatsLoggerMySQL.cpp 2005-08-08 11:37:24.000000000 +0200
+++ scorched/src/common/StatsLoggerMySQL.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -63,7 +63,7 @@
static char text[50000];
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
return (mysql_real_query(mysql_, text, strlen(text)) == 0);
diff -ur scorched.orig/src/coms/ComsConnectMessage.h scorched/src/coms/ComsConnectMessage.h
--- scorched.orig/src/coms/ComsConnectMessage.h 2005-07-21 22:34:24.000000000 +0200
+++ scorched/src/coms/ComsConnectMessage.h 2006-02-11 15:02:03.000000000 +0100
@@ -47,7 +47,7 @@
void setUniqueId(const char *uid) { setValue("uid", uid); }
void setHostDesc(const char *host) { setValue("host", host); }
void setNoPlayers(unsigned int players) {
- char buf[10]; sprintf(buf, "%i", players); setValue("numplayers", buf); }
+ char buf[11]; sprintf(buf, "%u", players); setValue("numplayers", buf); }
const char *getVersion() { return getValue("version"); }
const char *getProtocolVersion() { return getValue("pversion"); }
diff -ur scorched.orig/src/coms/ComsMessageHandler.cpp scorched/src/coms/ComsMessageHandler.cpp
--- scorched.orig/src/coms/ComsMessageHandler.cpp 2005-04-05 00:35:25.000000000 +0200
+++ scorched/src/coms/ComsMessageHandler.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -114,7 +114,8 @@
if (itor == handlerMap_.end())
{
char buffer[1024];
- sprintf(buffer, "Failed to find message type handler \"%s\"",
+ snprintf(buffer, sizeof(buffer),
+ "Failed to find message type handler \"%s\"",
messageType.c_str());
if (connectionHandler_)
@@ -129,7 +130,8 @@
messageTypeStr, reader))
{
char buffer[1024];
- sprintf(buffer, "Failed to handle message type \"%s\"",
+ snprintf(buffer, sizeof(buffer),
+ "Failed to handle message type \"%s\"",
messageType.c_str());
if (connectionHandler_)
diff -ur scorched.orig/src/dialogs/AutoDefenseDialog.cpp scorched/src/dialogs/AutoDefenseDialog.cpp
--- scorched.orig/src/dialogs/AutoDefenseDialog.cpp 2005-07-19 23:45:36.000000000 +0200
+++ scorched/src/dialogs/AutoDefenseDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -173,13 +173,13 @@
char buffer[256];
if (shieldcount > 0)
{
- sprintf(buffer, "%s (%i)",
+ snprintf(buffer, sizeof(buffer), "%s (%i)",
shield->getName(),
shieldcount);
}
else
{
- sprintf(buffer, "%s (In)",
+ snprintf(buffer, sizeof(buffer), "%s (In)",
shield->getName());
}
ddshields_->addText(GLWSelectorEntry(buffer,
@@ -215,13 +215,13 @@
char buffer[256];
if (tank->getAccessories().getShields().getShieldCount(currentShield) > 0)
{
- sprintf(buffer, "%s (%i)",
+ snprintf(buffer, sizeof(buffer), "%s (%i)",
currentShield->getName(),
tank->getAccessories().getShields().getShieldCount(currentShield));
}
else
{
- sprintf(buffer, "%s (In)",
+ snprintf(buffer, sizeof(buffer), "%s (In)",
currentShield->getName());
}
ddshields_->setText(buffer);
diff -ur scorched.orig/src/ode/error.cpp scorched/src/ode/error.cpp
--- scorched.orig/src/ode/error.cpp 2004-09-15 00:10:04.000000000 +0200
+++ scorched/src/ode/error.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -129,7 +129,7 @@
else {
char s[1000],title[100];
sprintf (title,"ODE Error %d",num);
- vsprintf (s,msg,ap);
+ vsnprintf (s,sizeof(s),msg,ap);
s[sizeof(s)-1] = 0;
MessageBox(0,s,title,MB_OK | MB_ICONWARNING);
}
@@ -145,7 +145,7 @@
else {
char s[1000],title[100];
sprintf (title,"ODE INTERNAL ERROR %d",num);
- vsprintf (s,msg,ap);
+ vsnprintf (s,sizeof(s),msg,ap);
s[sizeof(s)-1] = 0;
MessageBox(0,s,title,MB_OK | MB_ICONSTOP);
}
diff -ur scorched.orig/src/ode/testing.cpp scorched/src/ode/testing.cpp
--- scorched.orig/src/ode/testing.cpp 2003-07-10 18:30:19.000000000 +0200
+++ scorched/src/ode/testing.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -72,7 +72,7 @@
va_list ap;
va_start (ap,name);
- vsprintf (mi->name,name,ap);
+ vsnprintf (mi->name, sizeof(mi->name), name, ap);
if (strlen(mi->name) >= sizeof (mi->name)) dDebug (0,"name too long");
mat.push (mi);
@@ -88,7 +88,7 @@
dMatInfo mi;
va_list ap;
va_start (ap,name);
- vsprintf (mi.name,name,ap);
+ vsnprintf (mi.name, sizeof(mi.name), name, ap);
if (strlen(mi.name) >= sizeof (mi.name)) dDebug (0,"name too long");
if (strcmp(mp->name,mi.name) != 0)
diff -ur scorched.orig/src/scorched/DisplayDialog.cpp scorched/src/scorched/DisplayDialog.cpp
--- scorched.orig/src/scorched/DisplayDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/DisplayDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -265,8 +265,8 @@
const char *stateName = "";
KeyboardKey::translateKeyNameValue(key->getKeys()[position].key, keyName);
KeyboardKey::translateKeyStateValue(key->getKeys()[position].state, stateName);
- if (strcmp(stateName, "NONE") == 0) sprintf(buffer, "%s", keyName);
- else sprintf(buffer, "<%s> %s", stateName, keyName);
+ if (strcmp(stateName, "NONE") == 0) snprintf(buffer, sizeof(buffer), "%s", keyName);
+ else snprintf(buffer, sizeof(buffer), "<%s> %s", stateName, keyName);
}
button->SetLabel(wxString(buffer, wxConvUTF8));
}
diff -ur scorched.orig/src/scorched/MainDialog.cpp scorched/src/scorched/MainDialog.cpp
--- scorched.orig/src/scorched/MainDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/MainDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -143,11 +143,11 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
char path[1024];
- sprintf(path, "%s %s", exeName, text);
+ snprintf(path, sizeof(path), "%s %s", exeName, text);
ScorchedProcess *process = new ScorchedProcess();
long result = ::wxExecute(wxString(path, wxConvUTF8), wxEXEC_ASYNC, process);
diff -ur scorched.orig/src/scorched/NetDialog.cpp scorched/src/scorched/NetDialog.cpp
--- scorched.orig/src/scorched/NetDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/NetDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -127,7 +127,7 @@
ServerBrowser::instance()->getServerList().
getEntryValue(item, "maxplayers");
char text[256];
- sprintf(text, "%s/%s", clients.c_str(), maxclients.c_str());
+ snprintf(text, sizeof(text), "%s/%s", clients.c_str(), maxclients.c_str());
return wxString(text, wxConvUTF8);
}
@@ -498,7 +498,7 @@
wxString username = IDC_EDIT_NAME_CTRL->GetValue();
char buffer[1024];
- sprintf(buffer, "-connect \"%s\"", (const char *) value.mb_str(wxConvUTF8));
+ snprintf(buffer, sizeof(buffer), "-connect \"%s\"", (const char *) value.mb_str(wxConvUTF8));
if (!password.empty())
{
diff -ur scorched.orig/src/scorched/ServerDialog.cpp scorched/src/scorched/ServerDialog.cpp
--- scorched.orig/src/scorched/ServerDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/ServerDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -402,7 +402,7 @@
{
TankAI *ai = (*aiitor);
char buffer[256];
- sprintf(buffer, "Add %s", ai->getName());
+ snprintf(buffer, sizeof(buffer), "Add %s", ai->getName());
menuAddPlayer->Append(IDC_MENU_PLAYERADD_1 + aicount, wxString(buffer, wxConvUTF8));
}
@@ -841,7 +841,8 @@
void showServerDialog()
{
char serverName[1024];
- sprintf(serverName, "Scorched 3D Dedicated Server [ %s : %i ] [%s]",
+ snprintf(serverName, sizeof(serverName),
+ "Scorched 3D Dedicated Server [ %s : %i ] [%s]",
ScorchedServer::instance()->getOptionsGame().getServerName(),
ScorchedServer::instance()->getOptionsGame().getPortNo(),
(ScorchedServer::instance()->getOptionsGame().getPublishServer()?"Published":"Not Published"));
diff -ur scorched.orig/src/scorched/SettingsDialog.cpp scorched/src/scorched/SettingsDialog.cpp
--- scorched.orig/src/scorched/SettingsDialog.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/SettingsDialog.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -417,7 +417,7 @@
(void *) (OptionsGame::WindRandom));
for (int i=0; i<=5; i++)
{
- char buffer[25];
+ char buffer[30];
sprintf(buffer, "Force %i%s", i, ((i==0)?" (No Wind)":""));
SettingsEnv::IDC_COMBO_FORCE_CTRL->Append(
wxString(buffer, wxConvUTF8), (void *) (i+1));
@@ -471,7 +471,7 @@
for (int i=0; i<=20; i++)
{
char buffer[25];
- sprintf(buffer, "%i", i, i);
+ sprintf(buffer, "%i", i);
if (i<=10)
{
SettingsEnv::IDC_COMBO_STARTARMSLEVEL_CTRL->Append(wxString(buffer, wxConvUTF8), (void *) i);
Only in scorched/src/scorched: SingleChoiceDialog.cpp.orig
diff -ur scorched.orig/src/scorched/main.cpp scorched/src/scorched/main.cpp
--- scorched.orig/src/scorched/main.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/scorched/main.cpp 2006-02-11 15:06:24.000000000 +0100
@@ -145,7 +145,8 @@
int main(int argc, char *argv[])
{
// Generate the version
- sprintf(scorched3dAppName, "Scorched3D - Version %s (%s)",
+ snprintf(scorched3dAppName, sizeof(scorched3dAppName),
+ "Scorched3D - Version %s (%s)",
ScorchedVersion, ScorchedProtocolVersion);
srand((unsigned)time(0));
Only in scorched/src/scorched: main.cpp~
diff -ur scorched.orig/src/server/ServerBrowserInfo.cpp scorched/src/server/ServerBrowserInfo.cpp
--- scorched.orig/src/server/ServerBrowserInfo.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/server/ServerBrowserInfo.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -138,7 +138,7 @@
{
char *serverName = (char *) ScorchedServer::instance()->getOptionsGame().getServerName();
char version[256];
- sprintf(version, "%s (%s)", ScorchedVersion, ScorchedProtocolVersion);
+ snprintf(version, sizeof(version), "%s (%s)", ScorchedVersion, ScorchedProtocolVersion);
unsigned currentState = ScorchedServer::instance()->getGameState().getState();
bool started = !ServerTooFewPlayersStimulus::instance()->acceptStateChange(0, 0, 0.0f);
char players[25];
@@ -146,7 +146,7 @@
char maxplayers[25];
sprintf(maxplayers, "%i", ScorchedServer::instance()->getOptionsGame().getNoMaxPlayers());
char type[100];
- sprintf(type, "%s (%s)",
+ snprintf(type, sizeof(type), "%s (%s)",
ScorchedServer::instance()->getOptionsTransient().getGameType(),
((ScorchedServer::instance()->getOptionsGame().getTeams() > 1)?"Teams":"No Teams"));
wxString osDesc = ::wxGetOsDescription();
diff -ur scorched.orig/src/server/ServerCommon.cpp scorched/src/server/ServerCommon.cpp
--- scorched.orig/src/server/ServerCommon.cpp 2005-08-14 21:11:42.000000000 +0200
+++ scorched/src/server/ServerCommon.cpp 2006-02-11 15:12:42.000000000 +0100
@@ -63,7 +63,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
ComsTextMessage message(text, 0, true);
@@ -83,7 +83,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
ComsTextMessage message(text);
@@ -104,7 +104,7 @@
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
std::map<unsigned int, Tank *> &tanks =
@@ -295,7 +295,7 @@
// Add the actual log message
va_list ap;
va_start(ap, fmt);
- vsprintf(text, fmt, ap);
+ vsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
Logger::log(text);
Only in scorched/src/server: ServerCommon.cpp~
diff -ur scorched.orig/src/server/ServerRegistration.cpp scorched/src/server/ServerRegistration.cpp
--- scorched.orig/src/server/ServerRegistration.cpp 2005-06-08 19:29:38.000000000 +0200
+++ scorched/src/server/ServerRegistration.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -39,7 +39,7 @@
netServer_(new NetServerHTTPProtocolSend)
{
static char buffer[1024];
- sprintf(buffer,
+ snprintf(buffer, sizeof(buffer),
"GET %s/servers.php?register=%s&port=%i HTTP/1.0\r\n"
"User-Agent: Scorched3D\r\n"
"Host: %s\r\n"
diff -ur scorched.orig/src/tank/TankPhysics.cpp scorched/src/tank/TankPhysics.cpp
--- scorched.orig/src/tank/TankPhysics.cpp 2005-06-11 18:53:41.000000000 +0200
+++ scorched/src/tank/TankPhysics.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -248,13 +248,13 @@
if (OptionsDisplay::instance()->getUseHexidecimal())
{
- sprintf(messageBuffer, "0x%x (0x%x)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "0x%x (0x%x)",
int(360.0f - getRotationGunXY()),
int(rotDiff));
}
else
{
- sprintf(messageBuffer, "%.1f (%+.1f)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "%.1f (%+.1f)",
360.0f - getRotationGunXY(),
rotDiff);
}
@@ -269,13 +269,13 @@
if (OptionsDisplay::instance()->getUseHexidecimal())
{
- sprintf(messageBuffer, "0x%x (0X%x)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "0x%x (0X%x)",
int(getRotationGunYZ()),
int(rotDiff));
}
else
{
- sprintf(messageBuffer, "%.1f (%+.1f)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "%.1f (%+.1f)",
getRotationGunYZ(),
rotDiff);
}
@@ -289,13 +289,13 @@
if (OptionsDisplay::instance()->getUseHexidecimal())
{
- sprintf(messageBuffer, "0X%x (0X%x)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "0X%x (0X%x)",
int(getPower()),
int(powDiff));
}
else
{
- sprintf(messageBuffer, "%.1f (%+.1f)",
+ snprintf(messageBuffer, sizeof(messageBuffer), "%.1f (%+.1f)",
getPower(),
powDiff);
}
diff -ur scorched.orig/src/tank/TankState.cpp scorched/src/tank/TankState.cpp
--- scorched.orig/src/tank/TankState.cpp 2005-07-17 13:32:05.000000000 +0200
+++ scorched/src/tank/TankState.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -88,7 +88,7 @@
const char *TankState::getStateString()
{
static char string[1024];
- sprintf(string, "%s - %s %s(%i hp)",
+ snprintf(string, sizeof(string), "%s - %s %s(%i hp)",
((readyState_==sReady)?"Rdy":"Wait"),
getSmallStateString(),
(muted_?"muted ":""),
diff -ur scorched.orig/src/tank/TankWeapon.cpp scorched/src/tank/TankWeapon.cpp
--- scorched.orig/src/tank/TankWeapon.cpp 2005-07-27 01:51:21.000000000 +0200
+++ scorched/src/tank/TankWeapon.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -206,7 +206,7 @@
{
static char buffer[256];
int count = getWeaponCount(getCurrent());
- sprintf(buffer, ((count>0)?"%s (%i)":"%s (In)"),
+ snprintf(buffer, sizeof(buffer), ((count>0)?"%s (%i)":"%s (In)"),
getCurrent()->getName(), count);
return buffer;
}
diff -ur scorched.orig/src/tankai/TankAIAdder.cpp scorched/src/tankai/TankAIAdder.cpp
--- scorched.orig/src/tankai/TankAIAdder.cpp 2005-04-05 00:35:25.000000000 +0200
+++ scorched/src/tankai/TankAIAdder.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -72,7 +72,7 @@
char uniqueId[256];
{
std::set<int> usedIds;
- sprintf(uniqueId, "%s - computer - %%i", aiName);
+ snprintf(uniqueId, sizeof(uniqueId), "%s - computer - %%i", aiName);
std::map<unsigned int, Tank *> &playingTanks =
context.getTankContainer().getPlayingTanks();
std::map<unsigned int, Tank *>::iterator playingItor;
@@ -94,7 +94,7 @@
int uniqueIdCount = 1;
while (usedIds.find(uniqueIdCount) != usedIds.end()) uniqueIdCount++;
- sprintf(uniqueId, "%s - computer - %i", aiName, uniqueIdCount);
+ snprintf(uniqueId, sizeof(uniqueId), "%s - computer - %i", aiName, uniqueIdCount);
}
std::string newname = name;
diff -ur scorched.orig/src/tankgraph/GLWTankTip.cpp scorched/src/tankgraph/GLWTankTip.cpp
--- scorched.orig/src/tankgraph/GLWTankTip.cpp 2006-02-11 15:02:47.000000000 +0100
+++ scorched/src/tankgraph/GLWTankTip.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -50,7 +50,7 @@
for (int i=0; i<(int) oldShots.size(); i++)
{
char buffer[128];
- sprintf(buffer, "%s%i: Pwr:%.1f Ele:%.1f Rot:%.1f",
+ snprintf(buffer, sizeof(buffer), "%s%i: Pwr:%.1f Ele:%.1f Rot:%.1f",
(oldShots[i].current?"* ":" "),
i, oldShots[i].power, oldShots[i].ele,
(360.0f - oldShots[i].rot));
@@ -211,13 +211,13 @@
char buffer[128];
if (count >= 0)
{
- sprintf(buffer, "%s (%i)",
+ snprintf(buffer, sizeof(buffer), "%s (%i)",
current->getName(),
count);
}
else
{
- sprintf(buffer, "%s (In)",
+ snprintf(buffer, sizeof(buffer), "%s (In)",
current->getName());
}
entries.push_back(GLWSelectorEntry(buffer, ¤t->getToolTip(),
@@ -432,13 +432,13 @@
char buffer[128];
if (count > 0)
{
- sprintf(buffer, "%s (%i)",
+ snprintf(buffer, sizeof(buffer), "%s (%i)",
weapon->getName(),
count);
}
else
{
- sprintf(buffer, "%s (In)",
+ snprintf(buffer, sizeof(buffer), "%s (In)",
weapon->getName());
}
entries.push_back(GLWSelectorEntry(buffer, &weapon->getToolTip(),
diff -ur scorched.orig/src/tankgraph/TankMenus.cpp scorched/src/tankgraph/TankMenus.cpp
--- scorched.orig/src/tankgraph/TankMenus.cpp 2005-07-19 23:45:37.000000000 +0200
+++ scorched/src/tankgraph/TankMenus.cpp 2006-02-11 15:02:03.000000000 +0100
@@ -193,7 +193,7 @@
}
char buffer[1024];
- sprintf(buffer, "%c %8s - \"%10s\" (%s)",
+ snprintf(buffer, 1024, "%c %8s - \"%10s\" (%s)",
currentTank == tank?'>':' ',
description,
tank->getName(), modelId.getModelName());
@@ -394,12 +394,12 @@
static char buffer[1024];
if (accessoryCount > 0)
{
- sprintf(buffer, "%s (%i)",
+ snprintf(buffer, sizeof(buffer), "%s (%i)",
accessory->getName(), accessoryCount);
}
else
{
- sprintf(buffer, "%s (In)",
+ snprintf(buffer, sizeof(buffer), "%s (In)",
accessory->getName());
}
menuItems_.push_back(accessory);
scorched3d-strxxx.patch:
--- NEW FILE scorched3d-strxxx.patch ---
Only in scorched: aap
diff -ur scorched.orig/src/3dsparse/MSModelFactory.cpp scorched/src/3dsparse/MSModelFactory.cpp
--- scorched.orig/src/3dsparse/MSModelFactory.cpp 2006-02-11 15:32:18.000000000 +0100
+++ scorched/src/3dsparse/MSModelFactory.cpp 2006-02-11 16:10:25.000000000 +0100
@@ -80,7 +80,7 @@
void MSModelFactory::loadFile(FILE *in, const char *fileName, Model *model)
{
char filePath[256];
- strcpy(filePath, fileName);
+ snprintf(filePath, sizeof(filePath), "%s", fileName);
char *sep;
while (sep=strchr(filePath, '\\')) *sep = '/';
diff -ur scorched.orig/src/3dsparse/aseFile.lex.cpp scorched/src/3dsparse/aseFile.lex.cpp
--- scorched.orig/src/3dsparse/aseFile.lex.cpp 2004-03-01 18:48:17.000000000 +0100
+++ scorched/src/3dsparse/aseFile.lex.cpp 2006-02-11 16:13:01.000000000 +0100
@@ -873,7 +873,7 @@
YY_BREAK
case 6:
YY_RULE_SETUP
-{ strcpy(aseString, asetext ); return MAX_STRING; }
+{ snprintf(aseString, sizeof(aseString), "%s", asetext ); return MAX_STRING; }
YY_BREAK
case 7:
YY_RULE_SETUP
Only in scorched/src/3dsparse: aseFile.lex.cpp~
diff -ur scorched.orig/src/GLEXT/GLConsoleRules.cpp scorched/src/GLEXT/GLConsoleRules.cpp
--- scorched.orig/src/GLEXT/GLConsoleRules.cpp 2003-08-01 00:37:11.000000000 +0200
+++ scorched/src/GLEXT/GLConsoleRules.cpp 2006-02-11 16:22:14.000000000 +0100
@@ -73,7 +73,7 @@
if (matches.size() == 1) return matches.front()->getName();
static char buffer[1024];
- strcpy(buffer, line);
+ snprintf(buffer, sizeof(buffer), "%s", line);
int pos = (int) strlen(line);
while (true)
Only in scorched/src/GLEXT: GLConsoleRules.cpp~
diff -ur scorched.orig/src/GLEXT/GLState.cpp scorched/src/GLEXT/GLState.cpp
--- scorched.orig/src/GLEXT/GLState.cpp 2004-09-07 14:29:13.000000000 +0200
+++ scorched/src/GLEXT/GLState.cpp 2006-02-11 16:29:28.000000000 +0100
@@ -105,15 +105,16 @@
{
static char buffer[1024];
buffer[0] = '\0';
-
- if (currentState_ & TEXTURE_ON) strcat(buffer, "TEXTURE_ON\n");
- if (currentState_ & TEXTURE_OFF) strcat(buffer, "TEXTURE_ON\n");
- if (currentState_ & DEPTH_ON) strcat(buffer, "DEPTH_ON\n");
- if (currentState_ & DEPTH_OFF) strcat(buffer, "DEPTH_OFF\n");
- if (currentState_ & BLEND_ON) strcat(buffer, "BLEND_ON\n");
- if (currentState_ & BLEND_OFF) strcat(buffer, "BLEND_OFF\n");
- if (currentState_ & CUBEMAP_ON) strcat(buffer, "CUBEMAP_ON\n");
- if (currentState_ & CUBEMAP_OFF) strcat(buffer, "CUBEMAP_OFF\n");
+
+ snprintf(buffer, sizeof(buffer), "%s%s%s%s%s%s%s%s",
+ (currentState_ & TEXTURE_ON)? "TEXTURE_ON\n":"",
+ (currentState_ & TEXTURE_OFF)? "TEXTURE_ON\n":"",
+ (currentState_ & DEPTH_ON)? "DEPTH_ON\n":"",
+ (currentState_ & DEPTH_OFF)? "DEPTH_OFF\n":"",
+ (currentState_ & BLEND_ON)? "BLEND_ON\n":"",
+ (currentState_ & BLEND_OFF)? "BLEND_OFF\n":"",
+ (currentState_ & CUBEMAP_ON)? "CUBEMAP_ON\n":"",
+ (currentState_ & CUBEMAP_OFF)? "CUBEMAP_OFF\n":"");
return buffer;
}
Only in scorched/src/GLEXT: GLState.cpp~
diff -ur scorched.orig/src/client/ServerBrowserRefresh.cpp scorched/src/client/ServerBrowserRefresh.cpp
--- scorched.orig/src/client/ServerBrowserRefresh.cpp 2003-10-17 12:38:00.000000000 +0200
+++ scorched/src/client/ServerBrowserRefresh.cpp 2006-02-11 16:15:52.000000000 +0100
@@ -72,7 +72,7 @@
if (!name[0]) return;
static char buffer[256];
- strcpy(buffer, name);
+ snprintf(buffer, sizeof(buffer), "%s", name);
char *port = strchr(buffer, ':');
if (!port) return;
*port = '\0';
Only in scorched/src/client: ServerBrowserRefresh.cpp~
diff -ur scorched.orig/src/client/ServerBrowserServerList.cpp scorched/src/client/ServerBrowserServerList.cpp
--- scorched.orig/src/client/ServerBrowserServerList.cpp 2006-02-11 15:32:18.000000000 +0100
+++ scorched/src/client/ServerBrowserServerList.cpp 2006-02-11 16:13:53.000000000 +0100
@@ -239,7 +239,7 @@
SDL_LockMutex(vectorMutex_);
ServerBrowserEntry &entry = getEntry(pos);
static char buffer[256];
- strcpy(buffer, entry.getAttribute(name));
+ snprintf(buffer, sizeof(buffer), "%s", entry.getAttribute(name));
SDL_UnlockMutex(vectorMutex_);
return buffer;
diff -ur scorched.orig/src/scorched/MainDialog.cpp scorched/src/scorched/MainDialog.cpp
--- scorched.orig/src/scorched/MainDialog.cpp 2006-02-11 15:32:18.000000000 +0100
+++ scorched/src/scorched/MainDialog.cpp 2006-02-11 16:17:37.000000000 +0100
@@ -77,11 +77,8 @@
void setExeName(const char *name, bool allowExceptions)
{
- strcpy(exeName, name);
- if (allowExceptions)
- {
- strcat(exeName, " -allowexceptions");
- }
+ snprintf(exeName, sizeof(exeName), "%s%s", name,
+ allowExceptions? " -allowexceptions":"");
}
static SDL_mutex *messageMutex_ = 0;
diff -ur scorched.orig/src/scorched/main.cpp scorched/src/scorched/main.cpp
--- scorched.orig/src/scorched/main.cpp 2006-02-11 15:32:18.000000000 +0100
+++ scorched/src/scorched/main.cpp 2006-02-11 16:18:13.000000000 +0100
@@ -159,7 +159,7 @@
{
// Perhaps we can get the directory from the executables path name
char path[1024];
- strcpy(path, argv[0]);
+ snprintf(path, sizeof(path), "%s", argv[0]);
char *sep = strrchr(path, '/');
if (sep)
{
diff -ur scorched.orig/src/server/ServerBrowserInfo.cpp scorched/src/server/ServerBrowserInfo.cpp
--- scorched.orig/src/server/ServerBrowserInfo.cpp 2006-02-11 15:32:18.000000000 +0100
+++ scorched/src/server/ServerBrowserInfo.cpp 2006-02-11 16:21:52.000000000 +0100
@@ -232,7 +232,7 @@
{
static char buffer[10000];
static char newvalue[10000];
- strcpy(newvalue, value);
+ snprintf(newvalue, sizeof(newvalue), "%s", value);
for (char *a=newvalue; *a; a++)
{
if (*a == '\'') *a='\"';
@@ -240,7 +240,6 @@
else if (*a == '<') *a=' ';
}
- strcpy(buffer, name); strcat(buffer, "='");
- strcat(buffer, newvalue); strcat(buffer, "' ");
+ snprintf(buffer, sizeof(buffer), "%s='%s' ", name, newvalue);
return buffer;
}
diff -ur scorched.orig/src/skincreator/main.cpp scorched/src/skincreator/main.cpp
--- scorched.orig/src/skincreator/main.cpp 2003-08-31 13:30:48.000000000 +0200
+++ scorched/src/skincreator/main.cpp 2006-02-11 16:22:37.000000000 +0100
@@ -62,7 +62,7 @@
GLBitmap bitmap;
bitmap.grabScreen();
char buffer[1024];
- strcpy(buffer, argv[1]);
+ snprintf(buffer, sizeof(buffer), "%s", argv[1]);
char *pos = strrchr(buffer, '.');
if (pos)
{
--- scorched/src/dialogs/ScoreDialog.cpp~ 2006-02-11 20:05:20.000000000 +0100
+++ scorched/src/dialogs/ScoreDialog.cpp 2006-02-11 20:05:20.000000000 +0100
@@ -347,7 +347,8 @@
// Form the name
static char name[256];
- strcpy(name, current->getName());
+ // Max strcat usage 12
+ snprintf(name, sizeof(name) - 12, "%s", current->getName());
if (finished && ! OptionsParam::instance()->getConnectedToServer())
{
strcat(name, " (");
- Previous message: rpms/scorched3d/FC-4 scorched3d-syslibs.patch, 1.1, 1.2 scorched3d.spec, 1.5, 1.6
- Next message: rpms/apcupsd/FC-4 .cvsignore, 1.3, 1.4 apcupsd.spec, 1.4, 1.5 sources, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the scm-commits
mailing list