commit
45bf0dfcdb
@ -253,7 +253,7 @@ if GetOption("toolprefix"):
|
||||
# make sure the compiler can find the source data and generated files. enable warnings, set C++ flavor, and keep inline functions
|
||||
|
||||
env.Append(CPPPATH=['src/', 'data/', 'generated/'])
|
||||
env.Append(CCFLAGS=['-w', '-std=c++98', '-fkeep-inline-functions'])
|
||||
env.Append(CXXFLAGS=['-std=c++98'])
|
||||
env.Append(LIBS=['pthread', 'm'])
|
||||
env.Append(CPPDEFINES=["_GNU_SOURCE", "USE_STDINT", "_POSIX_C_SOURCE=200112L"])
|
||||
|
||||
|
@ -181,13 +181,10 @@ extern unsigned char ZSIZE;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define TPT_INLINE _inline
|
||||
#define TPT_NO_INLINE
|
||||
#elif defined(__llvm__)
|
||||
#define TPT_INLINE
|
||||
#define TPT_NO_INLINE
|
||||
#else
|
||||
#define TPT_INLINE inline
|
||||
#define TPT_NO_INLINE inline
|
||||
#endif
|
||||
|
||||
#define SDEUT
|
||||
|
@ -73,7 +73,7 @@ std::string format::UnixtimeToDateMini(time_t unixtime)
|
||||
|
||||
std::string format::CleanString(std::string dirtyString, int maxStringLength)
|
||||
{
|
||||
return CleanString(dirtyString, std::string::npos, maxStringLength);
|
||||
return CleanString(dirtyString, (int)std::string::npos, maxStringLength);
|
||||
}
|
||||
|
||||
std::string format::CleanString(std::string dirtyString, int maxVisualSize, int maxStringLength)
|
||||
@ -97,7 +97,7 @@ std::string format::CleanString(std::string dirtyString, int maxVisualSize, int
|
||||
|
||||
std::string format::CleanString(char * dirtyData, int maxStringLength)
|
||||
{
|
||||
return CleanString(dirtyData, std::string::npos, maxStringLength);
|
||||
return CleanString(dirtyData, (int)std::string::npos, maxStringLength);
|
||||
}
|
||||
|
||||
std::string format::CleanString(char * dirtyData, int maxVisualSize, int maxStringLength)
|
||||
|
14
src/Misc.cpp
14
src/Misc.cpp
@ -101,7 +101,7 @@ int isign(float i) //TODO: INline or macro
|
||||
return 0;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE unsigned clamp_flt(float f, float min, float max) //TODO: Also inline/macro
|
||||
unsigned clamp_flt(float f, float min, float max) //TODO: Also inline/macro
|
||||
{
|
||||
if (f<min)
|
||||
return 0;
|
||||
@ -110,7 +110,7 @@ TPT_NO_INLINE unsigned clamp_flt(float f, float min, float max) //TODO: Also inl
|
||||
return (int)(255.0f*(f-min)/(max-min));
|
||||
}
|
||||
|
||||
TPT_NO_INLINE float restrict_flt(float f, float min, float max) //TODO Inline or macro or something
|
||||
float restrict_flt(float f, float min, float max) //TODO Inline or macro or something
|
||||
{
|
||||
if (f<min)
|
||||
return min;
|
||||
@ -119,7 +119,7 @@ TPT_NO_INLINE float restrict_flt(float f, float min, float max) //TODO Inline or
|
||||
return f;
|
||||
}
|
||||
|
||||
char *mystrdup(char *s)
|
||||
char *mystrdup(const char *s)
|
||||
{
|
||||
char *x;
|
||||
if (s)
|
||||
@ -128,7 +128,7 @@ char *mystrdup(char *s)
|
||||
strcpy(x, s);
|
||||
return x;
|
||||
}
|
||||
return s;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void strlist_add(struct strlist **list, char *str)
|
||||
@ -221,7 +221,7 @@ void strcaturl(char *dst, char *src)
|
||||
*d = 0;
|
||||
}
|
||||
|
||||
void strappend(char *dst, char *src)
|
||||
void strappend(char *dst, const char *src)
|
||||
{
|
||||
char *d;
|
||||
unsigned char *s;
|
||||
@ -465,7 +465,7 @@ int register_extension()
|
||||
#elif defined(LIN)
|
||||
char *currentfilename = exe_name();
|
||||
FILE *f;
|
||||
char *mimedata =
|
||||
const char *mimedata =
|
||||
"<?xml version=\"1.0\"?>\n"
|
||||
" <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>\n"
|
||||
" <mime-type type=\"application/vnd.powdertoy.save\">\n"
|
||||
@ -480,7 +480,7 @@ int register_extension()
|
||||
fwrite(mimedata, 1, strlen(mimedata), f);
|
||||
fclose(f);
|
||||
|
||||
char *desktopfiledata_tmp =
|
||||
const char *desktopfiledata_tmp =
|
||||
"[Desktop Entry]\n"
|
||||
"Type=Application\n"
|
||||
"Name=Powder Toy\n"
|
||||
|
@ -40,7 +40,7 @@ unsigned clamp_flt(float f, float min, float max);
|
||||
|
||||
float restrict_flt(float f, float min, float max);
|
||||
|
||||
char *mystrdup(char *s);
|
||||
char *mystrdup(const char *s);
|
||||
|
||||
struct strlist
|
||||
{
|
||||
@ -64,11 +64,11 @@ void save_string(FILE *f, char *str);
|
||||
|
||||
int load_string(FILE *f, char *str, int max);
|
||||
|
||||
void strcaturl(char *dst, char *src);
|
||||
void strcaturl(char *dst, const char *src);
|
||||
|
||||
std::string URLEscape(std::string source);
|
||||
|
||||
void strappend(char *dst, char *src);
|
||||
void strappend(char *dst, const char *src);
|
||||
|
||||
void *file_load(char *fn, int *size);
|
||||
|
||||
|
@ -687,7 +687,7 @@ bool SaveWindowPosition()
|
||||
|
||||
#endif
|
||||
|
||||
void BlueScreen(char * detailMessage){
|
||||
void BlueScreen(const char * detailMessage){
|
||||
ui::Engine * engine = &ui::Engine::Ref();
|
||||
engine->g->fillrect(0, 0, engine->GetWidth(), engine->GetHeight(), 17, 114, 169, 210);
|
||||
|
||||
|
@ -48,7 +48,7 @@ static int ( *oid_inc_func )( void ) = NULL;
|
||||
------------------------------ */
|
||||
|
||||
bson *bson_empty( bson *obj ) {
|
||||
static char *data = "\005\0\0\0\0";
|
||||
static char data[] = "\005\0\0\0\0";
|
||||
bson_init_data( obj, data );
|
||||
obj->finished = 1;
|
||||
obj->err = 0;
|
||||
|
@ -44,7 +44,7 @@ namespace json
|
||||
{
|
||||
|
||||
|
||||
TPT_NO_INLINE Exception::Exception(const std::string& sMessage) :
|
||||
Exception::Exception(const std::string& sMessage) :
|
||||
std::runtime_error(sMessage) {}
|
||||
|
||||
|
||||
@ -129,32 +129,32 @@ public:
|
||||
|
||||
|
||||
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement() : m_pImp( new Imp_T<Null>( Null() ) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const UnknownElement& unknown) : m_pImp( unknown.m_pImp->Clone()) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T<Object>(object) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T<Array>(array) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T<Number>(number) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T<Boolean>(boolean) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T<String>(string) ) {}
|
||||
TPT_NO_INLINE UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T<Null>(null) ) {}
|
||||
UnknownElement::UnknownElement() : m_pImp( new Imp_T<Null>( Null() ) ) {}
|
||||
UnknownElement::UnknownElement(const UnknownElement& unknown) : m_pImp( unknown.m_pImp->Clone()) {}
|
||||
UnknownElement::UnknownElement(const Object& object) : m_pImp( new Imp_T<Object>(object) ) {}
|
||||
UnknownElement::UnknownElement(const Array& array) : m_pImp( new Imp_T<Array>(array) ) {}
|
||||
UnknownElement::UnknownElement(const Number& number) : m_pImp( new Imp_T<Number>(number) ) {}
|
||||
UnknownElement::UnknownElement(const Boolean& boolean) : m_pImp( new Imp_T<Boolean>(boolean) ) {}
|
||||
UnknownElement::UnknownElement(const String& string) : m_pImp( new Imp_T<String>(string) ) {}
|
||||
UnknownElement::UnknownElement(const Null& null) : m_pImp( new Imp_T<Null>(null) ) {}
|
||||
|
||||
TPT_NO_INLINE UnknownElement::~UnknownElement() { delete m_pImp; }
|
||||
UnknownElement::~UnknownElement() { delete m_pImp; }
|
||||
|
||||
TPT_NO_INLINE UnknownElement::operator const Object& () const { return CastTo<Object>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator const Array& () const { return CastTo<Array>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator const Number& () const { return CastTo<Number>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator const Boolean& () const { return CastTo<Boolean>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator const String& () const { return CastTo<String>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator const Null& () const { return CastTo<Null>(); }
|
||||
UnknownElement::operator const Object& () const { return CastTo<Object>(); }
|
||||
UnknownElement::operator const Array& () const { return CastTo<Array>(); }
|
||||
UnknownElement::operator const Number& () const { return CastTo<Number>(); }
|
||||
UnknownElement::operator const Boolean& () const { return CastTo<Boolean>(); }
|
||||
UnknownElement::operator const String& () const { return CastTo<String>(); }
|
||||
UnknownElement::operator const Null& () const { return CastTo<Null>(); }
|
||||
|
||||
TPT_NO_INLINE UnknownElement::operator Object& () { return ConvertTo<Object>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator Array& () { return ConvertTo<Array>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator Number& () { return ConvertTo<Number>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator Boolean& () { return ConvertTo<Boolean>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator String& () { return ConvertTo<String>(); }
|
||||
TPT_NO_INLINE UnknownElement::operator Null& () { return ConvertTo<Null>(); }
|
||||
UnknownElement::operator Object& () { return ConvertTo<Object>(); }
|
||||
UnknownElement::operator Array& () { return ConvertTo<Array>(); }
|
||||
UnknownElement::operator Number& () { return ConvertTo<Number>(); }
|
||||
UnknownElement::operator Boolean& () { return ConvertTo<Boolean>(); }
|
||||
UnknownElement::operator String& () { return ConvertTo<String>(); }
|
||||
UnknownElement::operator Null& () { return ConvertTo<Null>(); }
|
||||
|
||||
TPT_NO_INLINE UnknownElement& UnknownElement::operator = (const UnknownElement& unknown)
|
||||
UnknownElement& UnknownElement::operator = (const UnknownElement& unknown)
|
||||
{
|
||||
// always check for this
|
||||
if (&unknown != this)
|
||||
@ -170,28 +170,28 @@ TPT_NO_INLINE UnknownElement& UnknownElement::operator = (const UnknownElement&
|
||||
return *this;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE UnknownElement& UnknownElement::operator[] (const std::string& key)
|
||||
UnknownElement& UnknownElement::operator[] (const std::string& key)
|
||||
{
|
||||
// the people want an object. make us one if we aren't already
|
||||
Object& object = ConvertTo<Object>();
|
||||
return object[key];
|
||||
}
|
||||
|
||||
TPT_NO_INLINE const UnknownElement& UnknownElement::operator[] (const std::string& key) const
|
||||
const UnknownElement& UnknownElement::operator[] (const std::string& key) const
|
||||
{
|
||||
// throws if we aren't an object
|
||||
const Object& object = CastTo<Object>();
|
||||
return object[key];
|
||||
}
|
||||
|
||||
TPT_NO_INLINE UnknownElement& UnknownElement::operator[] (size_t index)
|
||||
UnknownElement& UnknownElement::operator[] (size_t index)
|
||||
{
|
||||
// the people want an array. make us one if we aren't already
|
||||
Array& array = ConvertTo<Array>();
|
||||
return array[index];
|
||||
}
|
||||
|
||||
TPT_NO_INLINE const UnknownElement& UnknownElement::operator[] (size_t index) const
|
||||
const UnknownElement& UnknownElement::operator[] (size_t index) const
|
||||
{
|
||||
// throws if we aren't an array
|
||||
const Array& array = CastTo<Array>();
|
||||
@ -227,11 +227,11 @@ ElementTypeT& UnknownElement::ConvertTo()
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void UnknownElement::Accept(ConstVisitor& visitor) const { m_pImp->Accept(visitor); }
|
||||
TPT_NO_INLINE void UnknownElement::Accept(Visitor& visitor) { m_pImp->Accept(visitor); }
|
||||
void UnknownElement::Accept(ConstVisitor& visitor) const { m_pImp->Accept(visitor); }
|
||||
void UnknownElement::Accept(Visitor& visitor) { m_pImp->Accept(visitor); }
|
||||
|
||||
|
||||
TPT_NO_INLINE bool UnknownElement::operator == (const UnknownElement& element) const
|
||||
bool UnknownElement::operator == (const UnknownElement& element) const
|
||||
{
|
||||
return m_pImp->Compare(*element.m_pImp);
|
||||
}
|
||||
@ -242,10 +242,10 @@ TPT_NO_INLINE bool UnknownElement::operator == (const UnknownElement& element) c
|
||||
// Object members
|
||||
|
||||
|
||||
TPT_NO_INLINE Object::Member::Member(const std::string& nameIn, const UnknownElement& elementIn) :
|
||||
Object::Member::Member(const std::string& nameIn, const UnknownElement& elementIn) :
|
||||
name(nameIn), element(elementIn) {}
|
||||
|
||||
TPT_NO_INLINE bool Object::Member::operator == (const Member& member) const
|
||||
bool Object::Member::operator == (const Member& member) const
|
||||
{
|
||||
return name == member.name &&
|
||||
element == member.element;
|
||||
@ -265,30 +265,30 @@ private:
|
||||
|
||||
|
||||
|
||||
TPT_NO_INLINE Object::iterator Object::Begin() { return m_Members.begin(); }
|
||||
TPT_NO_INLINE Object::iterator Object::End() { return m_Members.end(); }
|
||||
TPT_NO_INLINE Object::const_iterator Object::Begin() const { return m_Members.begin(); }
|
||||
TPT_NO_INLINE Object::const_iterator Object::End() const { return m_Members.end(); }
|
||||
Object::iterator Object::Begin() { return m_Members.begin(); }
|
||||
Object::iterator Object::End() { return m_Members.end(); }
|
||||
Object::const_iterator Object::Begin() const { return m_Members.begin(); }
|
||||
Object::const_iterator Object::End() const { return m_Members.end(); }
|
||||
|
||||
TPT_NO_INLINE size_t Object::Size() const { return m_Members.size(); }
|
||||
TPT_NO_INLINE bool Object::Empty() const { return m_Members.empty(); }
|
||||
size_t Object::Size() const { return m_Members.size(); }
|
||||
bool Object::Empty() const { return m_Members.empty(); }
|
||||
|
||||
TPT_NO_INLINE Object::iterator Object::Find(const std::string& name)
|
||||
Object::iterator Object::Find(const std::string& name)
|
||||
{
|
||||
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Object::const_iterator Object::Find(const std::string& name) const
|
||||
Object::const_iterator Object::Find(const std::string& name) const
|
||||
{
|
||||
return std::find_if(m_Members.begin(), m_Members.end(), Finder(name));
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Object::iterator Object::Insert(const Member& member)
|
||||
Object::iterator Object::Insert(const Member& member)
|
||||
{
|
||||
return Insert(member, End());
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Object::iterator Object::Insert(const Member& member, iterator itWhere)
|
||||
Object::iterator Object::Insert(const Member& member, iterator itWhere)
|
||||
{
|
||||
iterator it = Find(member.name);
|
||||
if (it != m_Members.end())
|
||||
@ -298,12 +298,12 @@ TPT_NO_INLINE Object::iterator Object::Insert(const Member& member, iterator itW
|
||||
return it;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Object::iterator Object::Erase(iterator itWhere)
|
||||
Object::iterator Object::Erase(iterator itWhere)
|
||||
{
|
||||
return m_Members.erase(itWhere);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE UnknownElement& Object::operator [](const std::string& name)
|
||||
UnknownElement& Object::operator [](const std::string& name)
|
||||
{
|
||||
|
||||
iterator it = Find(name);
|
||||
@ -315,7 +315,7 @@ TPT_NO_INLINE UnknownElement& Object::operator [](const std::string& name)
|
||||
return it->element;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE const UnknownElement& Object::operator [](const std::string& name) const
|
||||
const UnknownElement& Object::operator [](const std::string& name) const
|
||||
{
|
||||
const_iterator it = Find(name);
|
||||
if (it == End())
|
||||
@ -323,12 +323,12 @@ TPT_NO_INLINE const UnknownElement& Object::operator [](const std::string& name)
|
||||
return it->element;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Object::Clear()
|
||||
void Object::Clear()
|
||||
{
|
||||
m_Members.clear();
|
||||
}
|
||||
|
||||
TPT_NO_INLINE bool Object::operator == (const Object& object) const
|
||||
bool Object::operator == (const Object& object) const
|
||||
{
|
||||
return m_Members == object.m_Members;
|
||||
}
|
||||
@ -337,35 +337,35 @@ TPT_NO_INLINE bool Object::operator == (const Object& object) const
|
||||
/////////////////
|
||||
// Array members
|
||||
|
||||
TPT_NO_INLINE Array::iterator Array::Begin() { return m_Elements.begin(); }
|
||||
TPT_NO_INLINE Array::iterator Array::End() { return m_Elements.end(); }
|
||||
TPT_NO_INLINE Array::const_iterator Array::Begin() const { return m_Elements.begin(); }
|
||||
TPT_NO_INLINE Array::const_iterator Array::End() const { return m_Elements.end(); }
|
||||
Array::iterator Array::Begin() { return m_Elements.begin(); }
|
||||
Array::iterator Array::End() { return m_Elements.end(); }
|
||||
Array::const_iterator Array::Begin() const { return m_Elements.begin(); }
|
||||
Array::const_iterator Array::End() const { return m_Elements.end(); }
|
||||
|
||||
TPT_NO_INLINE Array::iterator Array::Insert(const UnknownElement& element, iterator itWhere)
|
||||
Array::iterator Array::Insert(const UnknownElement& element, iterator itWhere)
|
||||
{
|
||||
return m_Elements.insert(itWhere, element);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Array::iterator Array::Insert(const UnknownElement& element)
|
||||
Array::iterator Array::Insert(const UnknownElement& element)
|
||||
{
|
||||
return Insert(element, End());
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Array::iterator Array::Erase(iterator itWhere)
|
||||
Array::iterator Array::Erase(iterator itWhere)
|
||||
{
|
||||
return m_Elements.erase(itWhere);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Array::Resize(size_t newSize)
|
||||
void Array::Resize(size_t newSize)
|
||||
{
|
||||
m_Elements.resize(newSize);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE size_t Array::Size() const { return m_Elements.size(); }
|
||||
TPT_NO_INLINE bool Array::Empty() const { return m_Elements.empty(); }
|
||||
size_t Array::Size() const { return m_Elements.size(); }
|
||||
bool Array::Empty() const { return m_Elements.empty(); }
|
||||
|
||||
TPT_NO_INLINE UnknownElement& Array::operator[] (size_t index)
|
||||
UnknownElement& Array::operator[] (size_t index)
|
||||
{
|
||||
size_t nMinSize = index + 1; // zero indexed
|
||||
if (m_Elements.size() < nMinSize)
|
||||
@ -373,18 +373,18 @@ TPT_NO_INLINE UnknownElement& Array::operator[] (size_t index)
|
||||
return m_Elements[index];
|
||||
}
|
||||
|
||||
TPT_NO_INLINE const UnknownElement& Array::operator[] (size_t index) const
|
||||
const UnknownElement& Array::operator[] (size_t index) const
|
||||
{
|
||||
if (index >= m_Elements.size())
|
||||
throw Exception("Array out of bounds");
|
||||
return m_Elements[index];
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Array::Clear() {
|
||||
void Array::Clear() {
|
||||
m_Elements.clear();
|
||||
}
|
||||
|
||||
TPT_NO_INLINE bool Array::operator == (const Array& array) const
|
||||
bool Array::operator == (const Array& array) const
|
||||
{
|
||||
return m_Elements == array.m_Elements;
|
||||
}
|
||||
@ -393,7 +393,7 @@ TPT_NO_INLINE bool Array::operator == (const Array& array) const
|
||||
//////////////////
|
||||
// Null members
|
||||
|
||||
TPT_NO_INLINE bool Null::operator == (const Null& trivial) const
|
||||
bool Null::operator == (const Null& trivial) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -43,12 +43,12 @@ TODO:
|
||||
namespace json
|
||||
{
|
||||
|
||||
TPT_NO_INLINE std::istream& operator >> (std::istream& istr, UnknownElement& elementRoot) {
|
||||
std::istream& operator >> (std::istream& istr, UnknownElement& elementRoot) {
|
||||
Reader::Read(elementRoot, istr);
|
||||
return istr;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE Reader::Location::Location() :
|
||||
Reader::Location::Location() :
|
||||
m_nLine(0),
|
||||
m_nLineOffset(0),
|
||||
m_nDocOffset(0)
|
||||
@ -84,7 +84,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
TPT_NO_INLINE char Reader::InputStream::Get()
|
||||
char Reader::InputStream::Get()
|
||||
{
|
||||
assert(m_iStr.eof() == false); // enforce reading of only valid stream data
|
||||
char c = m_iStr.get();
|
||||
@ -122,12 +122,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
TPT_NO_INLINE Reader::TokenStream::TokenStream(const Tokens& tokens) :
|
||||
Reader::TokenStream::TokenStream(const Tokens& tokens) :
|
||||
m_Tokens(tokens),
|
||||
m_itCurrent(tokens.begin())
|
||||
{}
|
||||
|
||||
TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Peek() {
|
||||
const Reader::Token& Reader::TokenStream::Peek() {
|
||||
if (EOS())
|
||||
{
|
||||
const Token& lastToken = *m_Tokens.rbegin();
|
||||
@ -137,13 +137,13 @@ TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Peek() {
|
||||
return *(m_itCurrent);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE const Reader::Token& Reader::TokenStream::Get() {
|
||||
const Reader::Token& Reader::TokenStream::Get() {
|
||||
const Token& token = Peek();
|
||||
++m_itCurrent;
|
||||
return token;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE bool Reader::TokenStream::EOS() const {
|
||||
bool Reader::TokenStream::EOS() const {
|
||||
return m_itCurrent == m_Tokens.end();
|
||||
}
|
||||
|
||||
@ -151,13 +151,13 @@ TPT_NO_INLINE bool Reader::TokenStream::EOS() const {
|
||||
// Reader (finally)
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Read(Object& object, std::istream& istr) { Read_i(object, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(Array& array, std::istream& istr) { Read_i(array, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(String& string, std::istream& istr) { Read_i(string, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(Number& number, std::istream& istr) { Read_i(number, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(Boolean& boolean, std::istream& istr) { Read_i(boolean, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(Null& null, std::istream& istr) { Read_i(null, istr); }
|
||||
TPT_NO_INLINE void Reader::Read(UnknownElement& unknown, std::istream& istr) { Read_i(unknown, istr); }
|
||||
void Reader::Read(Object& object, std::istream& istr) { Read_i(object, istr); }
|
||||
void Reader::Read(Array& array, std::istream& istr) { Read_i(array, istr); }
|
||||
void Reader::Read(String& string, std::istream& istr) { Read_i(string, istr); }
|
||||
void Reader::Read(Number& number, std::istream& istr) { Read_i(number, istr); }
|
||||
void Reader::Read(Boolean& boolean, std::istream& istr) { Read_i(boolean, istr); }
|
||||
void Reader::Read(Null& null, std::istream& istr) { Read_i(null, istr); }
|
||||
void Reader::Read(UnknownElement& unknown, std::istream& istr) { Read_i(unknown, istr); }
|
||||
|
||||
|
||||
template <typename ElementTypeT>
|
||||
@ -181,7 +181,7 @@ void Reader::Read_i(ElementTypeT& element, std::istream& istr)
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Scan(Tokens& tokens, InputStream& inputStream)
|
||||
void Reader::Scan(Tokens& tokens, InputStream& inputStream)
|
||||
{
|
||||
while (EatWhiteSpace(inputStream), // ignore any leading white space...
|
||||
inputStream.EOS() == false) // ...before checking for EOS
|
||||
@ -272,14 +272,14 @@ TPT_NO_INLINE void Reader::Scan(Tokens& tokens, InputStream& inputStream)
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::EatWhiteSpace(InputStream& inputStream)
|
||||
void Reader::EatWhiteSpace(InputStream& inputStream)
|
||||
{
|
||||
while (inputStream.EOS() == false &&
|
||||
::isspace(inputStream.Peek()))
|
||||
inputStream.Get();
|
||||
}
|
||||
|
||||
TPT_NO_INLINE std::string Reader::MatchExpectedString(InputStream& inputStream, const std::string& sExpected)
|
||||
std::string Reader::MatchExpectedString(InputStream& inputStream, const std::string& sExpected)
|
||||
{
|
||||
std::string::const_iterator it(sExpected.begin()),
|
||||
itEnd(sExpected.end());
|
||||
@ -297,7 +297,7 @@ TPT_NO_INLINE std::string Reader::MatchExpectedString(InputStream& inputStream,
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE std::string Reader::MatchString(InputStream& inputStream)
|
||||
std::string Reader::MatchString(InputStream& inputStream)
|
||||
{
|
||||
MatchExpectedString(inputStream, "\"");
|
||||
|
||||
@ -341,7 +341,7 @@ TPT_NO_INLINE std::string Reader::MatchString(InputStream& inputStream)
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE std::string Reader::MatchNumber(InputStream& inputStream)
|
||||
std::string Reader::MatchNumber(InputStream& inputStream)
|
||||
{
|
||||
const char sNumericChars[] = "0123456789.eE-+";
|
||||
std::set<char> numericChars;
|
||||
@ -358,7 +358,7 @@ TPT_NO_INLINE std::string Reader::MatchNumber(InputStream& inputStream)
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(UnknownElement& element, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(UnknownElement& element, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
const Token& token = tokenStream.Peek();
|
||||
switch (token.nType) {
|
||||
@ -414,7 +414,7 @@ TPT_NO_INLINE void Reader::Parse(UnknownElement& element, Reader::TokenStream& t
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(Object& object, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(Object& object, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
MatchExpectedToken(Token::TOKEN_OBJECT_BEGIN, tokenStream);
|
||||
|
||||
@ -456,7 +456,7 @@ TPT_NO_INLINE void Reader::Parse(Object& object, Reader::TokenStream& tokenStrea
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
MatchExpectedToken(Token::TOKEN_ARRAY_BEGIN, tokenStream);
|
||||
|
||||
@ -479,13 +479,13 @@ TPT_NO_INLINE void Reader::Parse(Array& array, Reader::TokenStream& tokenStream)
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(String& string, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(String& string, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
string = MatchExpectedToken(Token::TOKEN_STRING, tokenStream);
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(Number& number, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(Number& number, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
const Token& currentToken = tokenStream.Peek(); // might need this later for throwing exception
|
||||
const std::string& sValue = MatchExpectedToken(Token::TOKEN_NUMBER, tokenStream);
|
||||
@ -506,20 +506,20 @@ TPT_NO_INLINE void Reader::Parse(Number& number, Reader::TokenStream& tokenStrea
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(Boolean& boolean, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(Boolean& boolean, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
const std::string& sValue = MatchExpectedToken(Token::TOKEN_BOOLEAN, tokenStream);
|
||||
boolean = (sValue == "true" ? true : false);
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE void Reader::Parse(Null&, Reader::TokenStream& tokenStream)
|
||||
void Reader::Parse(Null&, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
MatchExpectedToken(Token::TOKEN_NULL, tokenStream);
|
||||
}
|
||||
|
||||
|
||||
TPT_NO_INLINE const std::string& Reader::MatchExpectedToken(Token::Type nExpected, Reader::TokenStream& tokenStream)
|
||||
const std::string& Reader::MatchExpectedToken(Token::Type nExpected, Reader::TokenStream& tokenStream)
|
||||
{
|
||||
const Token& token = tokenStream.Get();
|
||||
if (token.nType != nExpected)
|
||||
|
@ -43,16 +43,16 @@ namespace json
|
||||
{
|
||||
|
||||
|
||||
TPT_NO_INLINE void Writer::Write(const UnknownElement& elementRoot, std::ostream& ostr) { Write_i(elementRoot, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const Object& object, std::ostream& ostr) { Write_i(object, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const Array& array, std::ostream& ostr) { Write_i(array, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const Number& number, std::ostream& ostr) { Write_i(number, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const String& string, std::ostream& ostr) { Write_i(string, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const Boolean& boolean, std::ostream& ostr) { Write_i(boolean, ostr); }
|
||||
TPT_NO_INLINE void Writer::Write(const Null& null, std::ostream& ostr) { Write_i(null, ostr); }
|
||||
void Writer::Write(const UnknownElement& elementRoot, std::ostream& ostr) { Write_i(elementRoot, ostr); }
|
||||
void Writer::Write(const Object& object, std::ostream& ostr) { Write_i(object, ostr); }
|
||||
void Writer::Write(const Array& array, std::ostream& ostr) { Write_i(array, ostr); }
|
||||
void Writer::Write(const Number& number, std::ostream& ostr) { Write_i(number, ostr); }
|
||||
void Writer::Write(const String& string, std::ostream& ostr) { Write_i(string, ostr); }
|
||||
void Writer::Write(const Boolean& boolean, std::ostream& ostr) { Write_i(boolean, ostr); }
|
||||
void Writer::Write(const Null& null, std::ostream& ostr) { Write_i(null, ostr); }
|
||||
|
||||
|
||||
TPT_NO_INLINE Writer::Writer(std::ostream& ostr) :
|
||||
Writer::Writer(std::ostream& ostr) :
|
||||
m_ostr(ostr),
|
||||
m_nTabDepth(0)
|
||||
{}
|
||||
@ -65,7 +65,7 @@ void Writer::Write_i(const ElementTypeT& element, std::ostream& ostr)
|
||||
ostr.flush(); // all done
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const Array& array)
|
||||
void Writer::Write_i(const Array& array)
|
||||
{
|
||||
if (array.Empty())
|
||||
m_ostr << "[]";
|
||||
@ -91,7 +91,7 @@ TPT_NO_INLINE void Writer::Write_i(const Array& array)
|
||||
}
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const Object& object)
|
||||
void Writer::Write_i(const Object& object)
|
||||
{
|
||||
if (object.Empty())
|
||||
m_ostr << "{}";
|
||||
@ -120,17 +120,17 @@ TPT_NO_INLINE void Writer::Write_i(const Object& object)
|
||||
}
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const Number& numberElement)
|
||||
void Writer::Write_i(const Number& numberElement)
|
||||
{
|
||||
m_ostr << std::setprecision(20) << numberElement.Value();
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const Boolean& booleanElement)
|
||||
void Writer::Write_i(const Boolean& booleanElement)
|
||||
{
|
||||
m_ostr << (booleanElement.Value() ? "true" : "false");
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const String& stringElement)
|
||||
void Writer::Write_i(const String& stringElement)
|
||||
{
|
||||
m_ostr << '"';
|
||||
|
||||
@ -156,22 +156,22 @@ TPT_NO_INLINE void Writer::Write_i(const String& stringElement)
|
||||
m_ostr << '"';
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const Null& )
|
||||
void Writer::Write_i(const Null& )
|
||||
{
|
||||
m_ostr << "null";
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Write_i(const UnknownElement& unknown)
|
||||
void Writer::Write_i(const UnknownElement& unknown)
|
||||
{
|
||||
unknown.Accept(*this);
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Writer::Visit(const Array& array) { Write_i(array); }
|
||||
TPT_NO_INLINE void Writer::Visit(const Object& object) { Write_i(object); }
|
||||
TPT_NO_INLINE void Writer::Visit(const Number& number) { Write_i(number); }
|
||||
TPT_NO_INLINE void Writer::Visit(const String& string) { Write_i(string); }
|
||||
TPT_NO_INLINE void Writer::Visit(const Boolean& boolean) { Write_i(boolean); }
|
||||
TPT_NO_INLINE void Writer::Visit(const Null& null) { Write_i(null); }
|
||||
void Writer::Visit(const Array& array) { Write_i(array); }
|
||||
void Writer::Visit(const Object& object) { Write_i(object); }
|
||||
void Writer::Visit(const Number& number) { Write_i(number); }
|
||||
void Writer::Visit(const String& string) { Write_i(string); }
|
||||
void Writer::Visit(const Boolean& boolean) { Write_i(boolean); }
|
||||
void Writer::Visit(const Null& null) { Write_i(null); }
|
||||
|
||||
|
||||
|
||||
|
@ -650,7 +650,7 @@ int luacon_step(int mx, int my, std::string selectl, std::string selectr, std::s
|
||||
}
|
||||
|
||||
|
||||
int luacon_eval(char *command){
|
||||
int luacon_eval(const char *command){
|
||||
ui::Engine::Ref().LastTick(clock());
|
||||
return luaL_dostring (luacon_ci->l, command);
|
||||
}
|
||||
@ -1917,7 +1917,8 @@ int luatpt_setfpscap(lua_State* l)
|
||||
}
|
||||
int luatpt_getscript(lua_State* l)
|
||||
{
|
||||
char *filedata = NULL, *fileuri = NULL, *filename = NULL, *lastError = NULL, *luacommand = NULL;
|
||||
char *filedata = NULL, *fileuri = NULL, *filename = NULL, *luacommand = NULL;
|
||||
const char *lastError = NULL;
|
||||
std::string fileauthor = "", fileid = "";
|
||||
int len, ret,run_script;
|
||||
FILE * outputfile;
|
||||
@ -1998,7 +1999,10 @@ fin:
|
||||
if(luacommand) delete[] luacommand;
|
||||
luacommand = NULL;
|
||||
|
||||
if(lastError) return luaL_error(l, lastError);
|
||||
if(lastError)
|
||||
{
|
||||
return luaL_error(l, lastError);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ void luacon_hook(lua_State *L, lua_Debug *ar);
|
||||
int luacon_step(int mx, int my, std::string , std::string selectr, std::string selectedalt, int bsx, int bsy);
|
||||
int luacon_mouseevent(int mx, int my, int mb, int event, int mouse_wheel);
|
||||
int luacon_keyevent(int key, int modifier, int event);
|
||||
int luacon_eval(char *command);
|
||||
int luacon_eval(const char *command);
|
||||
char *luacon_geterror();
|
||||
void luacon_close();
|
||||
int luacon_partsread(lua_State* l);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <stdint.h>
|
||||
#include "TPTSTypes.h"
|
||||
|
||||
AnyType::AnyType(ValueType type_, void * value_):
|
||||
AnyType::AnyType(ValueType type_, ValueValue value_):
|
||||
type(type_),
|
||||
value(value_)
|
||||
{
|
||||
@ -19,13 +19,9 @@ AnyType::AnyType(const AnyType & v):
|
||||
value(v.value)
|
||||
{
|
||||
if(type == TypeString)
|
||||
{
|
||||
value = new std::string(*((std::string*)value));
|
||||
}
|
||||
value.str = new std::string(*(value.str));
|
||||
else if(type == TypePoint)
|
||||
{
|
||||
value = new ui::Point(*((ui::Point*)value));
|
||||
}
|
||||
value.pt = new ui::Point(*(value.pt));
|
||||
}
|
||||
|
||||
AnyType::operator NumberType()
|
||||
@ -33,7 +29,7 @@ AnyType::operator NumberType()
|
||||
if(type != TypeNumber)
|
||||
throw InvalidConversionException(type, TypeNumber);
|
||||
else
|
||||
return NumberType((intptr_t)value);
|
||||
return NumberType(value.num);
|
||||
}
|
||||
|
||||
AnyType::operator StringType()
|
||||
@ -41,16 +37,16 @@ AnyType::operator StringType()
|
||||
if(type == TypeNumber)
|
||||
{
|
||||
std::stringstream numberStream;
|
||||
numberStream << ((NumberType*)this)->Value();
|
||||
numberStream << ((NumberType *)this)->Value();
|
||||
return StringType(numberStream.str());
|
||||
}
|
||||
else if(type == TypeString && value)
|
||||
else if(type == TypeString && value.str)
|
||||
{
|
||||
return StringType(*((std::string*)value));
|
||||
return StringType(*(value.str));
|
||||
}
|
||||
else if (type == TypePoint && value)
|
||||
else if (type == TypePoint && value.pt)
|
||||
{
|
||||
ui::Point thisPoint = *((ui::Point*)value);
|
||||
ui::Point thisPoint = *(value.pt);
|
||||
std::stringstream pointStream;
|
||||
pointStream << thisPoint.X << "," << thisPoint.Y;
|
||||
return StringType(pointStream.str());
|
||||
@ -64,11 +60,11 @@ AnyType::operator PointType()
|
||||
{
|
||||
if(type == TypePoint)
|
||||
{
|
||||
return PointType(*((ui::Point*)value));
|
||||
return PointType(*(value.pt));
|
||||
}
|
||||
else if(type == TypeString)
|
||||
{
|
||||
std::stringstream pointStream(*((std::string*)value));
|
||||
std::stringstream pointStream(*(value.str));
|
||||
int x, y;
|
||||
char comma;
|
||||
pointStream >> x >> comma >> y;
|
||||
@ -82,35 +78,49 @@ AnyType::operator PointType()
|
||||
|
||||
AnyType::~AnyType()
|
||||
{
|
||||
if(type == TypeString || type == TypePoint)
|
||||
delete value;
|
||||
if(type == TypeString)
|
||||
delete value.str;
|
||||
else if(type == TypePoint)
|
||||
delete value.pt;
|
||||
}
|
||||
|
||||
//Number Type
|
||||
|
||||
NumberType::NumberType(int number): AnyType(TypeNumber, (void*)number) { }
|
||||
NumberType::NumberType(int number): AnyType(TypeNumber, ValueValue())
|
||||
{
|
||||
value.num = number;
|
||||
}
|
||||
|
||||
int NumberType::Value()
|
||||
{
|
||||
return (intptr_t)value;
|
||||
return value.num;
|
||||
}
|
||||
|
||||
//String type
|
||||
|
||||
StringType::StringType(std::string string): AnyType(TypeString, new std::string(string)) { }
|
||||
StringType::StringType(std::string string): AnyType(TypeString, ValueValue())
|
||||
{
|
||||
value.str = new std::string(string);
|
||||
}
|
||||
|
||||
std::string StringType::Value()
|
||||
{
|
||||
return std::string(*((std::string*)value));
|
||||
return *value.str;
|
||||
}
|
||||
|
||||
//Point type
|
||||
|
||||
PointType::PointType(ui::Point point): AnyType(TypePoint, new ui::Point(point)) { }
|
||||
PointType::PointType(ui::Point point): AnyType(TypePoint, ValueValue())
|
||||
{
|
||||
value.pt = new ui::Point(point);
|
||||
}
|
||||
|
||||
PointType::PointType(int pointX, int pointY): AnyType(TypePoint, new ui::Point(pointX, pointY)) { }
|
||||
PointType::PointType(int pointX, int pointY): AnyType(TypePoint, ValueValue())
|
||||
{
|
||||
value.pt = new ui::Point(pointX, pointY);
|
||||
}
|
||||
|
||||
ui::Point PointType::Value()
|
||||
{
|
||||
return ui::Point(*((ui::Point*)value));
|
||||
return *value.pt;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "gui/interface/Point.h"
|
||||
|
||||
enum ValueType { TypeNumber, TypePoint, TypeString, TypeNull, TypeFunction };
|
||||
typedef union { int num; std::string* str; ui::Point* pt; } ValueValue;
|
||||
|
||||
class GeneralException
|
||||
{
|
||||
@ -29,9 +30,9 @@ class AnyType
|
||||
{
|
||||
protected:
|
||||
ValueType type;
|
||||
void * value;
|
||||
ValueValue value;
|
||||
public:
|
||||
AnyType(ValueType type_, void * value_);
|
||||
AnyType(ValueType type_, ValueValue value_);
|
||||
AnyType(const AnyType & v);
|
||||
operator NumberType();
|
||||
operator StringType();
|
||||
|
@ -154,7 +154,7 @@ int TPTScriptInterface::parseNumber(char * stringData)
|
||||
AnyType TPTScriptInterface::eval(std::deque<std::string> * words)
|
||||
{
|
||||
if(words->size() < 1)
|
||||
return AnyType(TypeNull, NULL);
|
||||
return AnyType(TypeNull, ValueValue());
|
||||
std::string word = words->front(); words->pop_front();
|
||||
char * rawWord = (char *)word.c_str();
|
||||
ValueType wordType = testType(word);
|
||||
|
@ -333,7 +333,7 @@ bool Client::DoInstallation()
|
||||
|
||||
char *currentfilename = exe_name();
|
||||
FILE *f;
|
||||
char *mimedata =
|
||||
const char *mimedata =
|
||||
"<?xml version=\"1.0\"?>\n"
|
||||
" <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>\n"
|
||||
" <mime-type type=\"application/vnd.powdertoy.save\">\n"
|
||||
@ -348,7 +348,7 @@ bool Client::DoInstallation()
|
||||
fwrite(mimedata, 1, strlen(mimedata), f);
|
||||
fclose(f);
|
||||
|
||||
char *protocolfiledata_tmp =
|
||||
const char *protocolfiledata_tmp =
|
||||
"[Desktop Entry]\n"
|
||||
"Type=Application\n"
|
||||
"Name=Powder Toy\n"
|
||||
@ -367,7 +367,7 @@ bool Client::DoInstallation()
|
||||
fclose(f);
|
||||
system("xdg-desktop-menu install powdertoy-tpt-ptsave.desktop");
|
||||
|
||||
char *desktopfiledata_tmp =
|
||||
const char *desktopfiledata_tmp =
|
||||
"[Desktop Entry]\n"
|
||||
"Type=Application\n"
|
||||
"Name=Powder Toy\n"
|
||||
@ -893,8 +893,8 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
char *session = new char[authUser.SessionID.length() + 1];
|
||||
std::strcpy (session, authUser.SessionID.c_str());
|
||||
|
||||
char * postNames[] = { "Name", "Description", "Data:save.bin", "Publish", NULL };
|
||||
char * postDatas[] = { saveName, saveDescription, gameData, (char *)(save.GetPublished()?"Public":"Private") };
|
||||
const char *const postNames[] = { "Name", "Description", "Data:save.bin", "Publish", NULL };
|
||||
const char *const postDatas[] = { saveName, saveDescription, gameData, (char *)(save.GetPublished()?"Public":"Private") };
|
||||
int postLengths[] = { save.GetName().length(), save.GetDescription().length(), gameDataLength, save.GetPublished()?6:7 };
|
||||
//std::cout << postNames[0] << " " << postDatas[0] << " " << postLengths[0] << std::endl;
|
||||
data = http_multipart_post("http://" SERVER "/Save.api", postNames, postDatas, postLengths, userid, NULL, session, &dataStatus, &dataLength);
|
||||
@ -1120,8 +1120,8 @@ RequestStatus Client::ExecVote(int saveID, int direction)
|
||||
char *session = new char[authUser.SessionID.length() + 1];
|
||||
std::strcpy (session, authUser.SessionID.c_str());
|
||||
|
||||
char * postNames[] = { "ID", "Action", NULL };
|
||||
char * postDatas[] = { id, directionText };
|
||||
const char *const postNames[] = { "ID", "Action", NULL };
|
||||
const char *const postDatas[] = { id, directionText };
|
||||
int postLengths[] = { saveIDText.length(), strlen(directionText) };
|
||||
//std::cout << postNames[0] << " " << postDatas[0] << " " << postLengths[0] << std::endl;
|
||||
data = http_multipart_post("http://" SERVER "/Vote.api", postNames, postDatas, postLengths, userid, NULL, session, &dataStatus, &dataLength);
|
||||
@ -1221,9 +1221,7 @@ RequestBroker::Request * Client::SaveUserInfoAsync(UserInfo info)
|
||||
json::Reader::Read(objDocument, dataStream);
|
||||
json::Number tempStatus = objDocument["Status"];
|
||||
|
||||
bool returnValue = tempStatus.Value() == 1;
|
||||
|
||||
return (void*)(returnValue ? 1 : 0);
|
||||
return (void*)(tempStatus.Value() == 1);
|
||||
}
|
||||
catch (json::Exception &e)
|
||||
{
|
||||
@ -1303,8 +1301,8 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
|
||||
|
||||
char * data;
|
||||
int dataStatus, dataLength;
|
||||
char * postNames[] = { "Username", "Hash", NULL };
|
||||
char * postDatas[] = { (char*)username.c_str(), totalHash };
|
||||
const char *const postNames[] = { "Username", "Hash", NULL };
|
||||
const char *const postDatas[] = { (char*)username.c_str(), totalHash };
|
||||
int postLengths[] = { username.length(), 32 };
|
||||
data = http_multipart_post("http://" SERVER "/Login.json", postNames, postDatas, postLengths, NULL, NULL, NULL, &dataStatus, &dataLength);
|
||||
if(dataStatus == 200 && data)
|
||||
@ -1432,8 +1430,8 @@ RequestStatus Client::AddComment(int saveID, std::string comment)
|
||||
std::stringstream userIDStream;
|
||||
userIDStream << authUser.ID;
|
||||
|
||||
char * postNames[] = { "Comment", NULL };
|
||||
char * postDatas[] = { (char*)(comment.c_str()) };
|
||||
const char *const postNames[] = { "Comment", NULL };
|
||||
const char *const postDatas[] = { (char*)(comment.c_str()) };
|
||||
int postLengths[] = { comment.length() };
|
||||
data = http_multipart_post((char *)urlStream.str().c_str(), postNames, postDatas, postLengths, (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength);
|
||||
}
|
||||
@ -1548,8 +1546,8 @@ RequestStatus Client::ReportSave(int saveID, std::string message)
|
||||
std::stringstream userIDStream;
|
||||
userIDStream << authUser.ID;
|
||||
|
||||
char * postNames[] = { "Reason", NULL };
|
||||
char * postDatas[] = { (char*)(message.c_str()) };
|
||||
const char *const postNames[] = { "Reason", NULL };
|
||||
const char *const postDatas[] = { (char*)(message.c_str()) };
|
||||
int postLengths[] = { message.length() };
|
||||
data = http_multipart_post((char *)urlStream.str().c_str(), postNames, postDatas, postLengths, (char *)(userIDStream.str().c_str()), NULL, (char *)(authUser.SessionID.c_str()), &dataStatus, &dataLength);
|
||||
}
|
||||
|
@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#include "Config.h"
|
||||
#include "Misc.h"
|
||||
#include "HTTP.h"
|
||||
#include "MD5.h"
|
||||
|
||||
@ -87,34 +88,25 @@ static char * eatwhitespace(char * s)
|
||||
return s;
|
||||
}
|
||||
|
||||
static char *mystrdup(char *s)
|
||||
static int splituri(const char *uri, char **host, char **path)
|
||||
{
|
||||
char *x;
|
||||
if (s)
|
||||
{
|
||||
x = (char *)malloc(strlen(s)+1);
|
||||
strcpy(x, s);
|
||||
return x;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
static int splituri(char *uri, char **host, char **path)
|
||||
{
|
||||
char *p=uri,*q,*x,*y;
|
||||
if (!strncmp(p, "http://", 7))
|
||||
p += 7;
|
||||
q = strchr(p, '/');
|
||||
const char *q;
|
||||
char *x,*y;
|
||||
if (!strncmp(uri, "http://", 7))
|
||||
uri += 7;
|
||||
q = strchr(uri, '/');
|
||||
if (!q)
|
||||
q = p + strlen(p);
|
||||
x = (char *)malloc(q-p+1);
|
||||
q = uri + strlen(uri);
|
||||
x = (char *)malloc(q-uri+1);
|
||||
if (*q)
|
||||
y = mystrdup(q);
|
||||
else
|
||||
{
|
||||
y = mystrdup("/");
|
||||
strncpy(x, p, q-p);
|
||||
x[q-p] = 0;
|
||||
if (q==p || x[q-p-1]==':')
|
||||
}
|
||||
strncpy(x, uri, q-uri);
|
||||
x[q-uri] = 0;
|
||||
if (q==uri || x[q-uri-1]==':')
|
||||
{
|
||||
free(x);
|
||||
free(y);
|
||||
@ -244,7 +236,7 @@ struct http_ctx
|
||||
int fd;
|
||||
char *fdhost;
|
||||
};
|
||||
void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
|
||||
void *http_async_req_start(void *ctx, const char *uri, const char *data, int dlen, int keep)
|
||||
{
|
||||
struct http_ctx *cx = (http_ctx *)ctx;
|
||||
if (!ctx)
|
||||
@ -298,7 +290,7 @@ void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
|
||||
{
|
||||
if (!dlen)
|
||||
dlen = strlen(data);
|
||||
cx->txd = (char*)malloc(dlen);
|
||||
cx->txd = (char *)malloc(dlen);
|
||||
memcpy(cx->txd, data, dlen);
|
||||
cx->txdl = dlen;
|
||||
}
|
||||
@ -319,7 +311,7 @@ void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void http_async_add_header(void *ctx, char *name, char *data)
|
||||
void http_async_add_header(void *ctx, const char *name, const char *data)
|
||||
{
|
||||
struct http_ctx *cx = (http_ctx *)ctx;
|
||||
cx->thdr = (char *)realloc(cx->thdr, cx->thlen + strlen(name) + strlen(data) + 5);
|
||||
@ -694,7 +686,7 @@ void http_async_req_close(void *ctx)
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
char *http_simple_get(char *uri, int *ret, int *len)
|
||||
char *http_simple_get(const char *uri, int *ret, int *len)
|
||||
{
|
||||
void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0);
|
||||
if (!ctx)
|
||||
@ -707,7 +699,7 @@ char *http_simple_get(char *uri, int *ret, int *len)
|
||||
}
|
||||
return http_async_req_stop(ctx, ret, len);
|
||||
}
|
||||
void http_auth_headers(void *ctx, char *user, char *pass, char *session_id)
|
||||
void http_auth_headers(void *ctx, const char *user, const char *pass, const char *session_id)
|
||||
{
|
||||
char *tmp;
|
||||
int i;
|
||||
@ -747,7 +739,7 @@ void http_auth_headers(void *ctx, char *user, char *pass, char *session_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
char *http_auth_get(char *uri, char *user, char *pass, char *session_id, int *ret, int *len)
|
||||
char *http_auth_get(const char *uri, const char *user, const char *pass, const char *session_id, int *ret, int *len)
|
||||
{
|
||||
void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0);
|
||||
|
||||
@ -763,7 +755,7 @@ char *http_auth_get(char *uri, char *user, char *pass, char *session_id, int *re
|
||||
return http_async_req_stop(ctx, ret, len);
|
||||
}
|
||||
|
||||
char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len)
|
||||
char *http_simple_post(const char *uri, const char *data, int dlen, int *ret, int *len)
|
||||
{
|
||||
void *ctx = http_async_req_start(NULL, uri, data, dlen, 0);
|
||||
if (!ctx)
|
||||
@ -777,7 +769,7 @@ char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len)
|
||||
return http_async_req_stop(ctx, ret, len);
|
||||
}
|
||||
|
||||
char *http_ret_text(int ret)
|
||||
const char *http_ret_text(int ret)
|
||||
{
|
||||
switch (ret)
|
||||
{
|
||||
@ -914,10 +906,10 @@ char *http_ret_text(int ret)
|
||||
return "Unknown Status Code";
|
||||
}
|
||||
}
|
||||
char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, char *session_id, int *ret, int *len)
|
||||
char *http_multipart_post(const char *uri, const char *const *names, const char *const *parts, int *plens, const char *user, const char *pass, const char *session_id, int *ret, int *len)
|
||||
{
|
||||
void *ctx;
|
||||
char *data = NULL, *tmp, *p;
|
||||
char *data = NULL, *tmp;
|
||||
int dlen = 0, i, j;
|
||||
unsigned char hash[16];
|
||||
unsigned char boundary[32], ch;
|
||||
@ -987,12 +979,11 @@ retry:
|
||||
if (strchr(names[i], ':'))
|
||||
{
|
||||
tmp = mystrdup(names[i]);
|
||||
p = strchr(tmp, ':');
|
||||
char *p = strchr(tmp, ':');
|
||||
*p = 0;
|
||||
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"; ", tmp);
|
||||
free(tmp);
|
||||
p = strchr(names[i], ':');
|
||||
dlen += sprintf(data+dlen, "filename=\"%s\"\r\n\r\n", p+1);
|
||||
dlen += sprintf(data+dlen, "filename=\"%s\"\r\n\r\n", strchr(names[i], ':')+1);
|
||||
}
|
||||
else
|
||||
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"\r\n\r\n", names[i]);
|
||||
@ -1022,7 +1013,7 @@ retry:
|
||||
{
|
||||
//md5_update(&md5, (unsigned char *)parts[i], plens[i]); //WHY?
|
||||
//md5_update(&md5, (unsigned char *)"-", 1);
|
||||
p = strchr(names[i], ':');
|
||||
const char *p = strchr(names[i], ':');
|
||||
if (p)
|
||||
m += (p - names[i]) + 1;
|
||||
else
|
||||
@ -1033,7 +1024,7 @@ retry:
|
||||
m = 0;
|
||||
for (i=0; names[i]; i++)
|
||||
{
|
||||
p = strchr(names[i], ':');
|
||||
const char *p = strchr(names[i], ':');
|
||||
if (m)
|
||||
{
|
||||
tmp[m] = ' ';
|
||||
@ -1104,10 +1095,10 @@ fail:
|
||||
}
|
||||
|
||||
|
||||
void *http_multipart_post_async(char *uri, char **names, char **parts, int *plens, char *user, char *pass, char *session_id)
|
||||
void *http_multipart_post_async(const char *uri, const char *const *names, const char *const *parts, int *plens, const char *user, const char *pass, const char *session_id)
|
||||
{
|
||||
void *ctx;
|
||||
char *data = NULL, *tmp, *p;
|
||||
char *data = NULL, *tmp;
|
||||
int dlen = 0, i, j;
|
||||
unsigned char hash[16];
|
||||
unsigned char boundary[32], ch;
|
||||
@ -1177,12 +1168,11 @@ retry:
|
||||
if (strchr(names[i], ':'))
|
||||
{
|
||||
tmp = mystrdup(names[i]);
|
||||
p = strchr(tmp, ':');
|
||||
char *p = strchr(tmp, ':');
|
||||
*p = 0;
|
||||
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"; ", tmp);
|
||||
free(tmp);
|
||||
p = strchr(names[i], ':');
|
||||
dlen += sprintf(data+dlen, "filename=\"%s\"\r\n\r\n", p+1);
|
||||
dlen += sprintf(data+dlen, "filename=\"%s\"\r\n\r\n", strchr(names[i], ':')+1);
|
||||
}
|
||||
else
|
||||
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"\r\n\r\n", names[i]);
|
||||
@ -1212,7 +1202,7 @@ retry:
|
||||
{
|
||||
//md5_update(&md5, (unsigned char *)parts[i], plens[i]); //WHY?
|
||||
//md5_update(&md5, (unsigned char *)"-", 1);
|
||||
p = strchr(names[i], ':');
|
||||
const char *p = strchr(names[i], ':');
|
||||
if (p)
|
||||
m += (p - names[i]) + 1;
|
||||
else
|
||||
@ -1223,7 +1213,7 @@ retry:
|
||||
m = 0;
|
||||
for (i=0; names[i]; i++)
|
||||
{
|
||||
p = strchr(names[i], ':');
|
||||
const char *p = strchr(names[i], ':');
|
||||
if (m)
|
||||
{
|
||||
tmp[m] = ' ';
|
||||
|
@ -25,22 +25,22 @@ static char hexChars[] = "0123456789abcdef";
|
||||
void http_init(char *proxy);
|
||||
void http_done(void);
|
||||
|
||||
char *http_simple_get(char *uri, int *ret, int *len);
|
||||
char *http_auth_get(char *uri, char *user, char *pass, char * session_id, int *ret, int *len);
|
||||
char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len);
|
||||
char *http_simple_get(const char *uri, int *ret, int *len);
|
||||
char *http_auth_get(const char *uri, const char *user, const char *pass, const char *session_id, int *ret, int *len);
|
||||
char *http_simple_post(const char *uri, const char *data, int dlen, int *ret, int *len);
|
||||
|
||||
void http_auth_headers(void *ctx, char *user, char *pass, char * session_id);
|
||||
void http_auth_headers(void *ctx, const char *user, const char *pass, const char *session_id);
|
||||
|
||||
void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep);
|
||||
void http_async_add_header(void *ctx, char *name, char *data);
|
||||
void *http_async_req_start(void *ctx, const char *uri, const char *data, int dlen, int keep);
|
||||
void http_async_add_header(void *ctx, const char *name, const char *data);
|
||||
int http_async_req_status(void *ctx);
|
||||
void http_async_get_length(void *ctx, int *total, int *done);
|
||||
char *http_async_req_stop(void *ctx, int *ret, int *len);
|
||||
void http_async_req_close(void *ctx);
|
||||
|
||||
char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, char * session_id, int *ret, int *len);
|
||||
void *http_multipart_post_async(char *uri, char **names, char **parts, int *plens, char *user, char *pass, char * session_id);
|
||||
char *http_multipart_post(const char *uri, const char *const *names, const char *const *parts, int *plens, const char *user, const char *pass, const char * session_id, int *ret, int *len);
|
||||
void *http_multipart_post_async(const char *uri, const char *const *names, const char *const *parts, int *plens, const char *user, const char *pass, const char *session_id);
|
||||
|
||||
char *http_ret_text(int ret);
|
||||
const char *http_ret_text(int ret);
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#include "ElementPopulation.h"
|
||||
#include "gui/interface/Engine.h"
|
||||
#include "simulation/Simulation.h"
|
||||
|
@ -163,7 +163,7 @@ TPT_INLINE int PIXELMETHODS_CLASS::drawchar(int x, int y, int c, int r, int g, i
|
||||
return x + w;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
|
||||
int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
|
||||
{
|
||||
int i, j, w, bn = 0, ba = 0;
|
||||
char *rp = font_data + font_ptrs[c];
|
||||
|
@ -128,7 +128,7 @@ TPT_INLINE int PIXELMETHODS_CLASS::drawchar(int x, int y, int c, int r, int g, i
|
||||
return x + w;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
|
||||
int PIXELMETHODS_CLASS::addchar(int x, int y, int c, int r, int g, int b, int a)
|
||||
{
|
||||
int i, j, w, bn = 0, ba = 0;
|
||||
char *rp = font_data + font_ptrs[c];
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "client/Client.h"
|
||||
#include "client/GameSave.h"
|
||||
#include "gui/game/DecorationTool.h"
|
||||
#include "GameModelException.h"
|
||||
#include "QuickOptions.h"
|
||||
#include "GameModelException.h"
|
||||
#include "Format.h"
|
||||
|
||||
GameModel::GameModel():
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "Brush.h"
|
||||
#include "client/User.h"
|
||||
#include "Notification.h"
|
||||
|
||||
#include "QuickOption.h"
|
||||
#include "Tool.h"
|
||||
#include "Menu.h"
|
||||
|
||||
@ -23,7 +23,6 @@ class GameController;
|
||||
class Simulation;
|
||||
class Renderer;
|
||||
|
||||
class QuickOption;
|
||||
class ToolSelection
|
||||
{
|
||||
public:
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "simulation/SimulationData.h"
|
||||
#include "gui/dialogues/ConfirmPrompt.h"
|
||||
#include "Format.h"
|
||||
#include "QuickOption.h"
|
||||
#include "QuickOptions.h"
|
||||
#include "IntroText.h"
|
||||
#include "DecorationTool.h"
|
||||
|
||||
|
@ -59,12 +59,12 @@ bool Button::GetTogglable()
|
||||
return isTogglable;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE bool Button::GetToggleState()
|
||||
bool Button::GetToggleState()
|
||||
{
|
||||
return toggle;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Button::SetToggleState(bool state)
|
||||
void Button::SetToggleState(bool state)
|
||||
{
|
||||
toggle = state;
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
virtual void DoAltAction(); //action of button what ever it may be
|
||||
void SetTogglable(bool isTogglable);
|
||||
bool GetTogglable();
|
||||
TPT_NO_INLINE bool GetToggleState();
|
||||
TPT_NO_INLINE void SetToggleState(bool state);
|
||||
bool GetToggleState();
|
||||
void SetToggleState(bool state);
|
||||
void SetActionCallback(ButtonAction * action);
|
||||
ButtonAction * GetActionCallback() { return actionCallback; }
|
||||
void SetText(std::string buttonText);
|
||||
|
@ -63,7 +63,7 @@ namespace ui
|
||||
inline int GetMaxWidth() { return maxWidth; }
|
||||
inline int GetMaxHeight() { return maxHeight; }
|
||||
|
||||
TPT_NO_INLINE void SetMaxSize(int width, int height);
|
||||
void SetMaxSize(int width, int height);
|
||||
|
||||
inline void SetSize(int width, int height);
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
//#include "Platform.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <cmath>
|
||||
#include "PreviewModel.h"
|
||||
#include "client/Client.h"
|
||||
#include "client/GameSave.h";
|
||||
#include "client/GameSave.h"
|
||||
#include "PreviewModelException.h"
|
||||
|
||||
PreviewModel::PreviewModel():
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
struct menu_section
|
||||
{
|
||||
char *icon;
|
||||
const char *icon;
|
||||
const char *name;
|
||||
int itemcount;
|
||||
int doshow;
|
||||
|
@ -1663,7 +1663,7 @@ void *Simulation::transform_save(void *odata, int *size, matrix2d transform, vec
|
||||
return ndata;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Simulation::orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[])
|
||||
void Simulation::orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[])
|
||||
{
|
||||
resblock1[0] = (block1&0x000000FF);
|
||||
resblock1[1] = (block1&0x0000FF00)>>8;
|
||||
@ -1676,7 +1676,7 @@ TPT_NO_INLINE void Simulation::orbitalparts_get(int block1, int block2, int resb
|
||||
resblock2[3] = (block2&0xFF000000)>>24;
|
||||
}
|
||||
|
||||
TPT_NO_INLINE void Simulation::orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[])
|
||||
void Simulation::orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[])
|
||||
{
|
||||
int block1tmp = 0;
|
||||
int block2tmp = 0;
|
||||
|
@ -123,36 +123,36 @@ public:
|
||||
Snapshot * CreateSnapshot();
|
||||
void Restore(const Snapshot & snap);
|
||||
|
||||
TPT_NO_INLINE int is_blocking(int t, int x, int y);
|
||||
TPT_NO_INLINE int is_boundary(int pt, int x, int y);
|
||||
TPT_NO_INLINE int find_next_boundary(int pt, int *x, int *y, int dm, int *em);
|
||||
TPT_NO_INLINE int pn_junction_sprk(int x, int y, int pt);
|
||||
TPT_NO_INLINE void photoelectric_effect(int nx, int ny);
|
||||
TPT_NO_INLINE unsigned direction_to_map(float dx, float dy, int t);
|
||||
TPT_NO_INLINE int do_move(int i, int x, int y, float nxf, float nyf);
|
||||
TPT_NO_INLINE int try_move(int i, int x, int y, int nx, int ny);
|
||||
TPT_NO_INLINE int eval_move(int pt, int nx, int ny, unsigned *rr);
|
||||
int is_blocking(int t, int x, int y);
|
||||
int is_boundary(int pt, int x, int y);
|
||||
int find_next_boundary(int pt, int *x, int *y, int dm, int *em);
|
||||
int pn_junction_sprk(int x, int y, int pt);
|
||||
void photoelectric_effect(int nx, int ny);
|
||||
unsigned direction_to_map(float dx, float dy, int t);
|
||||
int do_move(int i, int x, int y, float nxf, float nyf);
|
||||
int try_move(int i, int x, int y, int nx, int ny);
|
||||
int eval_move(int pt, int nx, int ny, unsigned *rr);
|
||||
void init_can_move();
|
||||
bool IsWallBlocking(int x, int y, int type);
|
||||
void create_cherenkov_photon(int pp);
|
||||
void create_gain_photon(int pp);
|
||||
TPT_NO_INLINE void kill_part(int i);
|
||||
void kill_part(int i);
|
||||
bool FloodFillPmapCheck(int x, int y, int type);
|
||||
int flood_prop(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype);
|
||||
int flood_prop_2(int x, int y, size_t propoffset, void * propvalue, StructProperty::PropertyType proptype, int parttype, char * bitmap);
|
||||
int flood_water(int x, int y, int i, int originaly, int check);
|
||||
int FloodINST(int x, int y, int fullc, int cm);
|
||||
TPT_NO_INLINE void detach(int i);
|
||||
TPT_NO_INLINE void part_change_type(int i, int x, int y, int t);
|
||||
void detach(int i);
|
||||
void part_change_type(int i, int x, int y, int t);
|
||||
//int InCurrentBrush(int i, int j, int rx, int ry);
|
||||
//int get_brush_flags();
|
||||
TPT_NO_INLINE int create_part(int p, int x, int y, int t);
|
||||
TPT_NO_INLINE void delete_part(int x, int y);
|
||||
int create_part(int p, int x, int y, int t);
|
||||
void delete_part(int x, int y);
|
||||
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
|
||||
TPT_NO_INLINE int is_wire(int x, int y);
|
||||
TPT_NO_INLINE int is_wire_off(int x, int y);
|
||||
TPT_NO_INLINE void set_emap(int x, int y);
|
||||
TPT_NO_INLINE int parts_avg(int ci, int ni, int t);
|
||||
int is_wire(int x, int y);
|
||||
int is_wire_off(int x, int y);
|
||||
void set_emap(int x, int y);
|
||||
int parts_avg(int ci, int ni, int t);
|
||||
void create_arc(int sx, int sy, int dx, int dy, int midpoints, int variance, int type, int flags);
|
||||
int nearest_part(int ci, int t, int max_d);
|
||||
void update_particles_i(int start, int inc);
|
||||
@ -195,11 +195,11 @@ public:
|
||||
int GetParticleType(std::string type);
|
||||
|
||||
void *transform_save(void *odata, int *size, matrix2d transform, vector2d translate);
|
||||
TPT_NO_INLINE void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
|
||||
TPT_NO_INLINE void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
|
||||
TPT_NO_INLINE int get_wavelength_bin(int *wm);
|
||||
TPT_NO_INLINE int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny);
|
||||
TPT_NO_INLINE int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, float *ny);
|
||||
void orbitalparts_get(int block1, int block2, int resblock1[], int resblock2[]);
|
||||
void orbitalparts_set(int *block1, int *block2, int resblock1[], int resblock2[]);
|
||||
int get_wavelength_bin(int *wm);
|
||||
int get_normal(int pt, int x, int y, float dx, float dy, float *nx, float *ny);
|
||||
int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx, float *ny);
|
||||
void clear_sim();
|
||||
void UpdateParticles();
|
||||
Simulation();
|
||||
|
@ -12,8 +12,8 @@ struct Particle;
|
||||
class Element
|
||||
{
|
||||
public:
|
||||
char *Identifier;
|
||||
char *Name;
|
||||
const char *Identifier;
|
||||
const char *Name;
|
||||
pixel Colour;
|
||||
float Advection;
|
||||
float AirDrag;
|
||||
@ -34,7 +34,7 @@ public:
|
||||
int MenuSection;
|
||||
float Temperature;
|
||||
unsigned char HeatConduct;
|
||||
char *Description;
|
||||
const char *Description;
|
||||
char State;
|
||||
unsigned int Properties;
|
||||
int (*Update) (UPDATE_FUNC_ARGS);
|
||||
|
@ -10,10 +10,10 @@ struct Particle;
|
||||
class SimTool
|
||||
{
|
||||
public:
|
||||
char *Identifier;
|
||||
char *Name;
|
||||
const char *Identifier;
|
||||
const char *Name;
|
||||
pixel Colour;
|
||||
char *Description;
|
||||
const char *Description;
|
||||
|
||||
SimTool();
|
||||
virtual ~SimTool() {}
|
||||
|
Reference in New Issue
Block a user