111 lines
2.6 KiB
Plaintext
111 lines
2.6 KiB
Plaintext
$OpenBSD: patch-Game_cpp,v 1.2 2011/01/14 12:01:18 dcoppa Exp $
|
|
--- Game.cpp.orig Tue Nov 11 17:54:38 2008
|
|
+++ Game.cpp Thu Jan 13 10:48:15 2011
|
|
@@ -22,18 +22,17 @@
|
|
#include "Path.h"
|
|
#include "Canvas.h"
|
|
#include "Levels.h"
|
|
-#include "Http.h"
|
|
#include "Os.h"
|
|
|
|
#include <SDL/SDL.h>
|
|
#include <SDL/SDL_image.h>
|
|
|
|
#include <cstdio>
|
|
+#include <cerrno>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <fstream>
|
|
#include <memory.h>
|
|
-#include <errno.h>
|
|
#include <sys/stat.h>
|
|
|
|
using namespace std;
|
|
@@ -80,7 +79,7 @@ class Transform (public)
|
|
}
|
|
}
|
|
private:
|
|
- Transform() {}
|
|
+ Transform() : m_bypass(false) {}
|
|
bool m_bypass;
|
|
b2Mat22 m_rot;
|
|
b2Mat22 m_invrot;
|
|
@@ -176,6 +175,7 @@ class Stroke (public)
|
|
m_attributes = 0;
|
|
m_origin = m_rawPath.point(0);
|
|
m_rawPath.translate( -m_origin );
|
|
+ m_body = NULL;
|
|
reset();
|
|
}
|
|
|
|
@@ -185,6 +185,7 @@ class Stroke (public)
|
|
m_colour = brushColours[DEFAULT_BRUSH];
|
|
m_attributes = 0;
|
|
m_origin = Vec2(400,240);
|
|
+ m_body = NULL;
|
|
reset();
|
|
const char *s = str.c_str();
|
|
while ( *s && *s!=':' && *s!='\n' ) {
|
|
@@ -866,7 +867,7 @@ class DemoLog : public Array<DemoEntry> (public)
|
|
void appendFromString( const std::string& str )
|
|
{
|
|
const char *s = str.c_str();
|
|
- int t, o, v1, v2, v3;
|
|
+ int t, o = 0, v1, v2, v3;
|
|
char c;
|
|
SDL_Event ev = {0};
|
|
ev.type = 0xff;
|
|
@@ -944,6 +945,12 @@ class DemoRecorder (private)
|
|
class DemoPlayer
|
|
{
|
|
public:
|
|
+ DemoPlayer()
|
|
+ : m_playing(false),
|
|
+ m_log(0),
|
|
+ m_index(0),
|
|
+ m_lastTick(0),
|
|
+ m_lastTickTime(0) {}
|
|
|
|
void start( const DemoLog* log )
|
|
{
|
|
@@ -1076,26 +1083,6 @@ class Game : public GameControl (public)
|
|
return false;
|
|
}
|
|
|
|
- bool send()
|
|
- {
|
|
- if ( save( SEND_TEMP_FILE ) ) {
|
|
- Http h;
|
|
- if ( h.post( Config::planetRoot().c_str(), "upload", SEND_TEMP_FILE ) ) {
|
|
- std::string id = h.getHeader("NP-Upload-Id");
|
|
- if ( id.length() > 0 ) {
|
|
- if ( !m_os->openBrowser((Config::planetRoot()+"?level="+id).c_str()) ) {
|
|
- showMessage("Unable to launch browser");
|
|
- }
|
|
- } else {
|
|
- showMessage("UploadFailed: unknown error");
|
|
- }
|
|
- } else {
|
|
- showMessage(std::string("UploadFailed: ")+h.errorMessage());
|
|
- }
|
|
- }
|
|
- return false;
|
|
- }
|
|
-
|
|
void setTool( int t )
|
|
{
|
|
m_colour = t;
|
|
@@ -1555,11 +1542,7 @@ int npmain(int argc, char** argv)
|
|
}
|
|
} else {
|
|
struct stat st;
|
|
- if ( stat("Game.cpp",&st)==0 ) {
|
|
- game.levels().addPath( "data" );
|
|
- } else {
|
|
- game.levels().addPath( DEFAULT_LEVEL_PATH );
|
|
- }
|
|
+ game.levels().addPath( DEFAULT_LEVEL_PATH );
|
|
game.levels().addPath( Config::userDataDir().c_str() );
|
|
}
|
|
game.gotoLevel(0);
|