summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/array.cpp18
-rw-r--r--core/array.h6
-rw-r--r--core/object.cpp4
-rw-r--r--core/os/os.h2
-rw-r--r--core/variant_call.cpp6
-rw-r--r--core/variant_op.cpp2
-rw-r--r--core/variant_parser.cpp13
7 files changed, 48 insertions, 3 deletions
diff --git a/core/array.cpp b/core/array.cpp
index ab9f19d6a0..41af460d83 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -222,6 +222,24 @@ void Array::invert(){
}
+void Array::push_front(const Variant& p_value) {
+
+ _p->array.insert(0,p_value);
+}
+
+void Array::pop_back(){
+
+ if (!_p->array.empty())
+ _p->array.resize( _p->array.size() -1 );
+
+}
+void Array::pop_front(){
+
+ if (!_p->array.empty())
+ _p->array.remove(0);
+
+}
+
Array::Array(const Array& p_from) {
diff --git a/core/array.h b/core/array.h
index 904309b257..c29b4355ca 100644
--- a/core/array.h
+++ b/core/array.h
@@ -53,7 +53,7 @@ public:
bool empty() const;
void clear();
- bool is_shared() const;
+ bool is_shared() const;
bool operator==(const Array& p_array) const;
@@ -75,6 +75,10 @@ public:
void erase(const Variant& p_value);
+ void push_front(const Variant& p_value);
+ void pop_back();
+ void pop_front();
+
Array(const Array& p_from);
Array(bool p_shared=false);
~Array();
diff --git a/core/object.cpp b/core/object.cpp
index 96f0c86832..f6ba76a0b5 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1405,6 +1405,10 @@ bool Object::is_connected(const StringName& p_signal, Object *p_to_object, const
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal);
if (signal_is_valid)
return false;
+
+ if (!script.is_null() && Ref<Script>(script)->has_script_signal(p_signal))
+ return false;
+
ERR_EXPLAIN("Nonexistent signal: "+p_signal);
ERR_FAIL_COND_V(!s,false);
}
diff --git a/core/os/os.h b/core/os/os.h
index e908177df7..ab1a07276c 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -75,7 +75,7 @@ public:
bool fullscreen;
bool resizable;
float get_aspect() const { return (float)width/(float)height; }
- VideoMode(int p_width=640,int p_height=480,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
+ VideoMode(int p_width=1280,int p_height=720,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
};
protected:
friend class Main;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 2d10cf4d44..2ac876c8f4 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -450,6 +450,9 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
VCALL_LOCALMEM0(Array,clear);
VCALL_LOCALMEM0R(Array,hash);
VCALL_LOCALMEM1(Array,push_back);
+ VCALL_LOCALMEM1(Array,push_front);
+ VCALL_LOCALMEM0(Array,pop_back);
+ VCALL_LOCALMEM0(Array,pop_front);
VCALL_LOCALMEM1(Array,append);
VCALL_LOCALMEM1(Array,resize);
VCALL_LOCALMEM2(Array,insert);
@@ -1426,12 +1429,15 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
ADDFUNC0(ARRAY,NIL,Array,clear,varray());
ADDFUNC0(ARRAY,INT,Array,hash,varray());
ADDFUNC1(ARRAY,NIL,Array,push_back,NIL,"value",varray());
+ ADDFUNC1(ARRAY,NIL,Array,push_front,NIL,"value",varray());
ADDFUNC1(ARRAY,NIL,Array,append,NIL,"value",varray());
ADDFUNC1(ARRAY,NIL,Array,resize,INT,"pos",varray());
ADDFUNC2(ARRAY,NIL,Array,insert,INT,"pos",NIL,"value",varray());
ADDFUNC1(ARRAY,NIL,Array,remove,INT,"pos",varray());
ADDFUNC1(ARRAY,NIL,Array,erase,NIL,"value",varray());
ADDFUNC1(ARRAY,INT,Array,find,NIL,"value",varray());
+ ADDFUNC0(ARRAY,NIL,Array,pop_back,varray());
+ ADDFUNC0(ARRAY,NIL,Array,pop_front,varray());
ADDFUNC0(ARRAY,NIL,Array,sort,varray());
ADDFUNC2(ARRAY,NIL,Array,sort_custom,OBJECT,"obj",STRING,"func",varray());
ADDFUNC0(ARRAY,NIL,Array,invert,varray());
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 1bcfa7d2ae..e33b79e63c 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -2635,7 +2635,7 @@ bool Variant::in(const Variant& p_index, bool *r_valid) const {
if (l) {
for(int i=0;i<l;i++) {
- if ((*arr)[i]==p_index)
+ if (evaluate(OP_EQUAL,(*arr)[i],p_index))
return true;
}
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index fed8c28740..239b129388 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -460,6 +460,19 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
value=Vector2(args[0],args[1]);
return OK;
+ } else if (id=="Rect2"){
+
+ Vector<float> args;
+ Error err = _parse_construct<float>(p_stream,args,line,r_err_str);
+ if (err)
+ return err;
+
+ if (args.size()!=4) {
+ r_err_str="Expected 4 arguments for constructor";
+ }
+
+ value=Rect2(args[0],args[1],args[2],args[3]);
+ return OK;
} else if (id=="Vector3"){
Vector<float> args;