Raised This Month: $ Target: $400
 0% 

Comparing Origin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-06-2012 , 21:49   Re: Comparing Origin
Reply With Quote #8

I don't see why you float origin.
Either you use get_user_origin, either you use engine or fakemeta so you retrieve a float vector.

Anyway, xs stock is :
PHP Code:
    // Are vectors equal?
    // untested, but should work
    
XS_LIBFUNC_ATTRIB bool:xs_vec_equal(const Float:vec1[], const Float:vec2[])
    {
        return (
vec1[0] == vec2[0]) && (vec1[1] == vec2[1]) && (vec1[2] == vec2[2]);
    } 
So if you want the same with integer you can use :
PHP Code:
bool:int_vec_equal(const vec1[3], const vec2[3])
{
    return (
vec1[0] == vec2[0]) && (vec1[1] == vec2[1]) && (vec1[2] == vec2[2]);


You could use this for both integer OR floats (not both at the same time) but i don't know how to check if tags match so better not to use :
PHP Code:
bool:vec_equal(const {_,Float}:vec1[3], const {_,Float}:vec2[3])
{
    return (
vec1[0] == vec2[0]) && (vec1[1] == vec2[1]) && (vec1[2] == vec2[2]);

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode