Feature #41

Location structure add and subtract operator overviews

Added by Vagabond over 4 years ago. Updated over 4 years ago.

Status:New% Done:

0%

Priority:Normal
Assignee:-
Category:-
Target version:v2.2

Description

Plan to add the following code to OP2Helper.h to make working with LOCATION structures easier.

For Example: LOCATION(10, 5) + LOCATION(8, 0)

See forum thread: http://forum.outpost2.net/index.php/topic,5786.msg82786/topicseen.html#new

OP2Helper.h

/* Global Operator Functions for structure LOCATION.
 * Allows LOCATION(10, 10) + LOCATION(5, 0) or LOCATION(10, 10) - LOCATION(5, 0)
 */
LOCATION operator+ (const LOCATION &loc1, const LOCATION &loc2);
LOCATION operator- (const LOCATION &loc1, const LOCATION &loc2);

OP2Helper.cpp

LOCATION operator+ (const LOCATION &loc1, const LOCATION &loc2)
{
    return LOCATION(loc1.x + loc2.x, loc1.y + loc2.y);
}

LOCATION operator- (const LOCATION &loc1, const LOCATION &loc2)
{
    return LOCATION(loc1.x - loc2.x, loc1.y - loc2.y);
}

History

#1 Updated by Vagabond over 4 years ago

Added to source code on SVN. Cannot figure out how to close out the feature though.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux