X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Fispy.cpp;h=fa9e73ec2be0e1619803155273224db16542b79c;hb=a8057c3d1726484928a3091fdd5c7a3d810f5f63;hp=dbdce654152be1c907ad0403e4d2366279bf8bc1;hpb=df9768e9b68682b60942fa49fc044fbcbf4253e6;p=supertux.git diff --git a/src/object/ispy.cpp b/src/object/ispy.cpp index dbdce6541..fa9e73ec2 100644 --- a/src/object/ispy.cpp +++ b/src/object/ispy.cpp @@ -27,8 +27,8 @@ #include Ispy::Ispy(const Reader& reader) : - MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED), - state(ISPYSTATE_IDLE), + MovingSprite(reader, "images/objects/ispy/ispy.sprite", LAYER_TILES+5, COLGROUP_DISABLED), + state(ISPYSTATE_IDLE), script(), dir(AUTO) { @@ -43,7 +43,7 @@ Ispy::Ispy(const Reader& reader) : if( dir_str == "right" ) dir = RIGHT; reader.get("facing-down", facing_down); if (facing_down) dir = DOWN; - if (dir == AUTO) log_warning << "Setting an Ispy's direction to AUTO is no good idea" << std::endl; + if (dir == AUTO) { log_warning << "Setting an Ispy's direction to AUTO is no good idea" << std::endl; } // set initial sprite action sprite->set_action((dir == DOWN) ? "idle-down" : ((dir == LEFT) ? "idle-left" : "idle-right")); @@ -67,20 +67,20 @@ Ispy::line_intersects_line(Vector line1_start, Vector line1_end, Vector line2_st float den2 = (d2-b2)*(a1-a2) + (a2-c2)*(b1-b2); // normalize to positive numerator - if (num < 0) { - num =- num; - den1 =- den1; - den2 =- den2; + if (num < 0) { + num = -num; + den1 = -den1; + den2 = -den2; } // numerator is zero -> Check for parallel or coinciding lines if (num == 0) { if ((b1-b2)*(c1-a2) != (a1-a2)*(d1-b2)) return false; - if (a1 == a2) { - std::swap(a1, b1); - std::swap(a2, b2); - std::swap(c1, d1); - std::swap(c2, d2); + if (a1 == a2) { + std::swap(a1, b1); + std::swap(a2, b2); + std::swap(c1, d1); + std::swap(c2, d2); } if (a1 > a2) std::swap(a1, a2); if (c1 > c2) std::swap(c1, c2); @@ -146,7 +146,7 @@ Ispy::free_line_of_sight(Vector line_start, Vector line_end, const MovingObject* return true; } -void +void Ispy::update(float ) {