index : lingo-ap-tracker

this commit

main

Autotracker for the Lingo Archipelago integration |

about summary refs log tree commit diff stats

log msg

author

committer

range

path: root/tracker_config.h

diff options

context:

1

2

3

4

5

6

7

8

9

10

15

20

25

30

35

40

space:

include

ignore

mode:

unified

ssdiff

stat only

|

author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 15:13:14 -0400
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-05-03 15:13:14 -0400
commit | f2a4553fa9d64cc39d138531d0a8d662af733ef8 (patch)
tree | b2c7a0fe753fe2ea132b0582e8f1b7521303f3e1 /tracker_config.h
parent | dc4a14397ae226d91041389c2a47993f9c22f83d (diff)

download

lingo-ap-tracker-f2a4553fa9d64cc39d138531d0a8d662af733ef8.tar.gz
lingo-ap-tracker-f2a4553fa9d64cc39d138531d0a8d662af733ef8.tar.bz2
lingo-ap-tracker-f2a4553fa9d64cc39d138531d0a8d662af733ef8.zip

Connection details are saved locally

Diffstat (limited to 'tracker_config.h')

-rw-r--r--

tracker_config.h

19

| |

1 files changed, 19 insertions, 0 deletions

diff --git a/tracker_config.h b/tracker_config.h new file mode 100644 index 0000000..e2e6cd7 --- /dev/null +++ b/tracker_config.h
@@ -0,0 +1,19 @@
| | 1 | #ifndef TRACKER_CONFIG_H_36CDD648
| | 2 | #define TRACKER_CONFIG_H_36CDD648
| | 3 |
| | 4 | #include <string>
| | 5 |
| | 6 | class TrackerConfig {
| | 7 | public:
| | 8 | void Load();
| | 9 |
| | 10 | void Save();
| | 11 |
| | 12 | std::string ap_server;
| | 13 | std::string ap_player;
| | 14 | std::string ap_password;
| | 15 | };
| | 16 |
| | 17 | TrackerConfig& GetTrackerConfig();
| | 18 |
| | 19 | #endif /* end of include guard: TRACKER_CONFIG_H_36CDD648 */

generated by cgit-pink 1.4.1 (git 2.36.1) at 2025-04-13 09:15:42 +0000

256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290

/*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2010 ForzeField Studios S.L. http://forzefield.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#import "CCArray.h"
#import "../ccMacros.h"

@implementation CCArray

+ (id) array
{
return [[[self alloc] init] autorelease];
}

+ (id) arrayWithCapacity:(NSUInteger)capacity
{
return [[[self alloc] initWithCapacity:capacity] autorelease];
}

+ (id) arrayWithArray:(CCArray*)otherArray
{
return [[(CCArray*)[self alloc] initWithArray:otherArray] autorelease];
}

+ (id) arrayWithNSArray:(NSArray*)otherArray
{
return [[(CCArray*)[self alloc] initWithNSArray:otherArray] autorelease];
}

- (id) init
{
self = [self initWithCapacity:2];
return self;
}

- (id) initWithCapacity:(NSUInteger)capacity
{
self = [super init];
if (self != nil) {
data = ccArrayNew(capacity);
}
return self;
}

- (id) initWithArray:(CCArray*)otherArray
{
self = [self initWithCapacity:otherArray->data->num];
if (self != nil) {
[self addObjectsFromArray:otherArray];
}
return self;
}

- (id) initWithNSArray:(NSArray*)otherArray
{
self = [self initWithCapacity:otherArray.count];
if (self != nil) {
[self addObjectsFromNSArray:otherArray];
}
return self;
}

- (id) initWithCoder:(NSCoder*)coder
{
self = [self initWithNSArray:[coder decodeObjectForKey:@"nsarray"]];
return self;
}

#pragma mark Querying an Array

- (NSUInteger) count
{
return data->num;
}

- (NSUInteger) capacity
{
return data->max;
}

- (NSUInteger) indexOfObject:(id)object
{
return ccArrayGetIndexOfObject(data, object);
}

- (id) objectAtIndex:(NSUInteger)index
{
NSAssert2( index < data->num, @"index out of range in objectAtIndex(%d), index %i", data->num, index );

return data->arr[index];
}

- (BOOL) containsObject:(id)object
{
return ccArrayContainsObject(data, object);
}

- (id) lastObject
{
if( data->num > 0 )
return data->arr[data->num-1];
return nil;
}

- (id) randomObject
{
if(data->num==0) return nil;
return data->arr[(int)(data->num*CCRANDOM_0_1())];
}

- (NSArray*) getNSArray
{
return [NSArray arrayWithObjects:data->arr count:data->num];
}

#pragma mark Adding Objects

- (void) addObject:(id)object
{
ccArrayAppendObjectWithResize(data, object);
}

- (void) addObjectsFromArray:(CCArray*)otherArray
{
ccArrayAppendArrayWithResize(data, otherArray->data);
}

- (void) addObjectsFromNSArray:(NSArray*)otherArray
{
ccArrayEnsureExtraCapacity(data, otherArray.count);
for(id object in otherArray)
ccArrayAppendObject(data, object);
}

- (void) insertObject:(id)object atIndex:(NSUInteger)index
{
ccArrayInsertObjectAtIndex(data, object, index);
}

#pragma mark Removing Objects

- (void) removeObject:(id)object
{
ccArrayRemoveObject(data, object);
}

- (void) removeObjectAtIndex:(NSUInteger)index
{
ccArrayRemoveObjectAtIndex(data, index);
}

- (void) fastRemoveObject:(id)object
{
ccArrayFastRemoveObject(data, object);
}

- (void) fastRemoveObjectAtIndex:(NSUInteger)index
{
ccArrayFastRemoveObjectAtIndex(data, index);
}

- (void) removeObjectsInArray:(CCArray*)otherArray
{
ccArrayRemoveArray(data, otherArray->data);
}

- (void) removeLastObject
{
NSAssert( data->num > 0, @"no objects added" );

ccArrayRemoveObjectAtIndex(data, data->num-1);
}

- (void) removeAllObjects
{
ccArrayRemoveAllObjects(data);
}

#pragma mark Rearranging Content

- (void) exchangeObject:(id)object1 withObject:(id)object2
{
NSUInteger index1 = ccArrayGetIndexOfObject(data, object1);
if(index1 == NSNotFound) return;
NSUInteger index2 = ccArrayGetIndexOfObject(data, object2);
if(index2 == NSNotFound) return;

ccArraySwapObjectsAtIndexes(data, index1, index2);
}

- (void) exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2
{
ccArraySwapObjectsAtIndexes(data, index1, index2);
}

- (void) reverseObjects
{
if (data->num > 1)
{
//floor it since in case of a oneven number the number of swaps stays the same
int count = (int) floorf(data->num/2.f);
NSUInteger maxIndex = data->num - 1;

for (int i = 0; i < count ; i++)
{
ccArraySwapObjectsAtIndexes(data, i, maxIndex);
maxIndex--;
}
}
}

- (void) reduceMemoryFootprint
{
ccArrayShrink(data);
}

#pragma mark Sending Messages to Elements

- (void) makeObjectsPerformSelector:(SEL)aSelector
{
ccArrayMakeObjectsPerformSelector(data, aSelector);
}

- (void) makeObjectsPerformSelector:(SEL)aSelector withObject:(id)object
{
ccArrayMakeObjectsPerformSelectorWithObject(data, aSelector, object);
}

#pragma mark CCArray - NSFastEnumeration protocol

- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len
{
if(state->state == 1) return 0;

state->mutationsPtr = (unsigned long *)self;
state->itemsPtr = &data->arr[0];
state->state = 1;
return data->num;
}

#pragma mark CCArray - NSCopying protocol

- (id)copyWithZone:(NSZone *)zone
{
NSArray *nsArray = [self getNSArray];
CCArray *newArray = [[[self class] allocWithZone:zone] initWithNSArray:nsArray];
return newArray;
}

- (void) encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:[self getNSArray] forKey:@"nsarray"];
}

#pragma mark

- (void) dealloc
{
ccArrayFree(data);
[super dealloc];
}

@end

generated by cgit-pink 1.4.1 (git 2.36.1) at 2025-04-13 09:15:43 +0000