project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/frontlib/Frontlib.java
author Wuzzy <Wuzzy2@mail.ru>
Sat, 21 Oct 2017 18:38:28 +0200
changeset 12734 4e0e59255856
parent 10017 de822cd3df3a
permissions -rw-r--r--
Sniper rifle mission: Faster dynamite blow-up, also skip with precise
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     1
/*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     2
 * Hedgewars for Android. An Android port of Hedgewars, a free turn based strategy game
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     4
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     5
 * This program is free software; you can redistribute it and/or
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     6
 * modify it under the terms of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     8
 * of the License, or (at your option) any later version.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
     9
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    13
 * GNU General Public License for more details.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    14
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    15
 * You should have received a copy of the GNU General Public License
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    16
 * along with this program; if not, write to the Free Software
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    18
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    19
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    20
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    21
package org.hedgewars.hedgeroid.frontlib;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    22
import java.io.UnsupportedEncodingException;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    23
import java.util.ArrayList;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    24
import java.util.Arrays;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    25
import java.util.HashMap;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    26
import java.util.List;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    27
import java.util.Map;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    28
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    29
import org.hedgewars.hedgeroid.Datastructures.Hog;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    30
import org.hedgewars.hedgeroid.Datastructures.MapRecipe;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    31
import org.hedgewars.hedgeroid.Datastructures.MetaScheme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    32
import org.hedgewars.hedgeroid.Datastructures.MetaScheme.Mod;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    33
import org.hedgewars.hedgeroid.Datastructures.MetaScheme.Setting;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    34
import org.hedgewars.hedgeroid.Datastructures.GameConfig;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    35
import org.hedgewars.hedgeroid.Datastructures.Room;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    36
import org.hedgewars.hedgeroid.Datastructures.Scheme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    37
import org.hedgewars.hedgeroid.Datastructures.Team;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    38
import org.hedgewars.hedgeroid.Datastructures.TeamInGame;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    39
import org.hedgewars.hedgeroid.Datastructures.TeamIngameAttributes;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    40
import org.hedgewars.hedgeroid.Datastructures.Weaponset;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    41
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    42
import com.sun.jna.Callback;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    43
import com.sun.jna.Library;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    44
import com.sun.jna.Memory;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    45
import com.sun.jna.Pointer;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    46
import com.sun.jna.PointerType;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    47
import com.sun.jna.Structure;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    48
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    49
/**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    50
 * Here is an introduction to the most important aspects of the JNA code.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    51
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    52
 * This interface permits access to the Hedgewars frontend library (frontlib)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    53
 * from Java. Each function directly contained in the Frontlib interface
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    54
 * represents a mapped C function. The Structure classes (ending in -Struct) are
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    55
 * mappings of C structs, and the PointerType classes (ending in -Ptr) represent
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    56
 * pointers to structs.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    57
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    58
 * Quick notes for USING these classes from outside this package:
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    59
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    60
 * Usage should be fairly straightforward, but there are a few surprising
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    61
 * gotchas. First, when you implement callbacks, YOU are responsible for
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    62
 * ensuring that the callback objects are not garbage-collected while they might
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    63
 * still be called! So make sure you keep them in member variables or similar,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    64
 * because Java will not know if there are still native references to them.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    65
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    66
 * When using Frontlib from outside its package, you only interact with structs
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    67
 * via the PointerType classes. They allow you to get at the data of the struct
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    68
 * with a function called deref(), which creates a plain normal Java object
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    69
 * representing the data (e.g. SchemePtr.deref() will give you a Scheme object).
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    70
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    71
 * Remember that you usually have to destroy structs that you receive from the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    72
 * library, because they are owned by the native code, not Java. The recommended
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    73
 * pattern for most cases is to call deref() on the pointer to get a Java object
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    74
 * (that you can keep as long as you like), and then immediately destroy the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    75
 * struct if it needs destroying. To find out whether and how the struct needs
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    76
 * to be destroyed, see the library's documentation of the function that you got
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    77
 * the struct from.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    78
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    79
 * To pass new structs to the library, you can use the static createJavaOwned()
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    80
 * function in each PointerType, which creates a new struct from the Java object
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    81
 * you provide, and returns a pointer to that struct that you can pass to
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    82
 * library functions. This new structure's memory is owned and managed by Java
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    83
 * code, so do not destroy it with frontlib functions!
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    84
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    85
 * There is a slight mismatch between the data model for the game setup. The
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    86
 * frontlib supports setting initial health and weaponset per-hog, because the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    87
 * engine allows for that, but currently neither the networking protocol nor the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    88
 * PC frontend support this feature, so the Android version does not take
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    89
 * advantage of it either and treats both as per-game settings. The initial
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    90
 * health is contained in the game scheme, the weaponset is explicitly part of
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    91
 * the GameConfig. When converting GameConfig to a native flib_gamesetup, both
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    92
 * are automatically copied to all hogs in the game, and for the reverse
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    93
 * conversion the weaponset of the first hog of the first team is used as the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    94
 * GameConfig weaponset. This means that GameConfig.weaponset will be null if
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    95
 * there are no teams in the game.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    96
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    97
 * When starting a network game, you only need to query the GameSetupPtr from
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    98
 * the netconn and use it to create the gameconn - this is preferable to using
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
    99
 * your own recreation of the game setup, because that way the same piece of
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   100
 * code is used to determine the game setup on all platforms.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   101
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   102
 * The "context" parameter of the callbacks is never needed here because JNA
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   103
 * generates function code for each callback object. Don't worry about it, just
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   104
 * pass null for context and ignore the context parameter in the callbacks.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   105
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   106
 * Finally, the library functions are documented in the actual library, not
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   107
 * here, so check the docs there to find out what exactly each function does!
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   108
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   109
 * Notes about the structure of this class (for the next one who has to touch
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   110
 * this...):
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   111
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   112
 * Java/C interop is quite fiddly and error-prone, so as long as things work,
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   113
 * try to stick to the established patterns.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   114
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   115
 * Structure types should always be hidden from the outside world, because they
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   116
 * can be misused too easily. For example, if you get a Structure from the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   117
 * library, change a String value in there and pass it back, JNA will re-write
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   118
 * that string using Java-owned memory without freeing the old native-owned
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   119
 * string, which causes a memory leak and possibly a double-free or other Bad
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   120
 * Things (tm). To avoid problems like this, Structure types are only used
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   121
 * internally, to map existing structures to Java types (without modifying them)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   122
 * or to create brand-new, Java-owned structures. Both operations are exposed to
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   123
 * the outside through the PointerType classes corresponding to the structures
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   124
 * in question.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   125
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   126
 * Since all of the struct mapping happens in Java, it is never checked against
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   127
 * the actual struct declarations in the library. That means strange things can
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   128
 * start happening at runtime if the frontlib structs are modified without
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   129
 * changing the mappings here to match. This also applies to the function
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   130
 * signatures: JNA checks whether the functions actually exist when loading the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   131
 * library, but it has no way of knowing whether the signatures are correct. If
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   132
 * the signatures here deviate from those in the frontlib, you might get stack
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   133
 * corruption.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   134
 *
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   135
 * In order to check at least the function signatures, take a look at the file
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   136
 * extra/jnacontrol.c in the frontlib sources. You can validate whether the
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   137
 * function signatures are still correct by copy-pasting them into jnaControl.c
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   138
 * and compiling it against the frontlib headers. The typedefs and #defines in
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   139
 * that file will make the compiler see the Java method signatures as C function
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   140
 * declarations. Since the same functions are already declared in the frontlib
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   141
 * headers, the compiler will give you errors if the signatures don't match.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   142
 */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   143
public interface Frontlib extends Library {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   144
    public static class NetconnPtr extends PointerType { }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   145
    public static class MapconnPtr extends PointerType { }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   146
    public static class GameconnPtr extends PointerType { }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   147
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   148
    public static class MetaschemePtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   149
        public MetaScheme deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   150
            return deref(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   151
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   152
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   153
        public static MetaScheme deref(Pointer p) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   154
            MetaschemeStruct struct = new MetaschemeStruct(p);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   155
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   156
            return struct.toMetaScheme();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   157
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   158
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   159
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   160
    public static class RoomArrayPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   161
        public Room[] getRooms(int count) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   162
            Pointer ptr = getPointer();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   163
            if(ptr == null) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   164
                return new Room[0];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   165
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   166
            Pointer[] untypedPtrs = ptr.getPointerArray(0, count);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   167
            Room[] result = new Room[count];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   168
            for(int i=0; i<count; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   169
                result[i] = RoomPtr.deref(untypedPtrs[i]);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   170
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   171
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   172
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   173
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   174
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   175
    public static class RoomPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   176
        public Room deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   177
            return deref(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   178
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   179
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   180
        public static Room deref(Pointer p) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   181
            RoomStruct struct = new RoomStruct(p);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   182
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   183
            return struct.toRoomlistRoom();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   184
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   185
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   186
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   187
    public static class TeamPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   188
        private TeamStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   189
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   190
        public TeamInGame deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   191
            TeamStruct struct = new TeamStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   192
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   193
            return struct.toTeamInGame();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   194
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   195
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   196
        public static TeamPtr createJavaOwned(Team t) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   197
            return createJavaOwned(new TeamInGame(t, null));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   198
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   199
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   200
        public static TeamPtr createJavaOwned(TeamInGame ingameTeam) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   201
            TeamPtr result = new TeamPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   202
            result.javaOwnedInstance = new TeamStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   203
            result.javaOwnedInstance.fillFrom(ingameTeam.team, ingameTeam.ingameAttribs);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   204
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   205
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   206
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   207
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   208
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   209
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   210
    public static class WeaponsetPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   211
        private WeaponsetStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   212
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   213
        public Weaponset deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   214
            WeaponsetStruct struct = new WeaponsetStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   215
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   216
            return struct.toWeaponset();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   217
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   218
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   219
        public static WeaponsetPtr createJavaOwned(Weaponset weaponset) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   220
            WeaponsetPtr result = new WeaponsetPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   221
            result.javaOwnedInstance = new WeaponsetStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   222
            result.javaOwnedInstance.fillFrom(weaponset);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   223
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   224
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   225
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   226
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   227
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   228
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   229
    public static class WeaponsetListPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   230
        private WeaponsetListStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   231
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   232
        public List<Weaponset> deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   233
            WeaponsetListStruct struct = new WeaponsetListStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   234
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   235
            return struct.toWeaponsetList();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   236
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   237
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   238
        public static WeaponsetListPtr createJavaOwned(List<Weaponset> list) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   239
            WeaponsetListPtr result = new WeaponsetListPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   240
            result.javaOwnedInstance = new WeaponsetListStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   241
            result.javaOwnedInstance.fillFrom(list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   242
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   243
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   244
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   245
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   246
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   247
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   248
    public static class MapRecipePtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   249
        private MapRecipeStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   250
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   251
        public MapRecipe deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   252
            MapRecipeStruct struct = new MapRecipeStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   253
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   254
            return struct.toMapRecipe();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   255
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   256
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   257
        public static MapRecipePtr createJavaOwned(MapRecipe recipe) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   258
            MapRecipePtr result = new MapRecipePtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   259
            result.javaOwnedInstance = new MapRecipeStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   260
            result.javaOwnedInstance.fillFrom(recipe);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   261
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   262
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   263
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   264
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   265
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   266
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   267
    public static class SchemePtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   268
        private SchemeStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   269
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   270
        public Scheme deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   271
            SchemeStruct struct = new SchemeStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   272
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   273
            return struct.toScheme();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   274
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   275
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   276
        public static SchemePtr createJavaOwned(Scheme scheme) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   277
            SchemePtr result = new SchemePtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   278
            result.javaOwnedInstance = new SchemeStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   279
            result.javaOwnedInstance.fillFrom(scheme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   280
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   281
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   282
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   283
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   284
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   285
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   286
    public static class SchemelistPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   287
        private SchemelistStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   288
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   289
        public List<Scheme> deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   290
            SchemelistStruct struct = new SchemelistStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   291
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   292
            return struct.toSchemeList();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   293
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   294
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   295
        public static SchemelistPtr createJavaOwned(List<Scheme> schemes) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   296
            SchemelistPtr result = new SchemelistPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   297
            result.javaOwnedInstance = new SchemelistStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   298
            result.javaOwnedInstance.fillFrom(schemes);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   299
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   300
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   301
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   302
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   303
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   304
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   305
    public static class GameSetupPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   306
        private GameSetupStruct javaOwnedInstance;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   307
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   308
        public GameConfig deref() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   309
            GameSetupStruct struct = new GameSetupStruct(getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   310
            struct.read();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   311
            return struct.toGameConfig();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   312
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   313
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   314
        public static GameSetupPtr createJavaOwned(GameConfig conf) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   315
            GameSetupPtr result = new GameSetupPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   316
            result.javaOwnedInstance = new GameSetupStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   317
            result.javaOwnedInstance.fillFrom(conf);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   318
            result.javaOwnedInstance.autoWrite();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   319
            result.setPointer(result.javaOwnedInstance.getPointer());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   320
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   321
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   322
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   323
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   324
    public static class ByteArrayPtr extends PointerType {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   325
        public byte[] deref(int size) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   326
            return getPointer().getByteArray(0, size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   327
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   328
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   329
        public static byte[] deref(ByteArrayPtr ptr, int size) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   330
            if(ptr==null && size==0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   331
                return null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   332
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   333
                return ptr.deref(size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   334
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   335
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   336
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   337
        public static ByteArrayPtr createJavaOwned(byte[] buffer) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   338
            if(buffer == null || buffer.length == 0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   339
                return null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   340
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   341
            // no need for javaOwnedInstance here because PointerType
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   342
            // remembers the memory as its Pointer
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   343
            Pointer ptr = new Memory(buffer.length);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   344
            ptr.write(0, buffer, 0, buffer.length);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   345
            ByteArrayPtr result = new ByteArrayPtr();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   346
            result.setPointer(ptr);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   347
            return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   348
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   349
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   350
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   351
    static class HogStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   352
        public static class ByVal extends HogStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   353
        public static class ByRef extends HogStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   354
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   355
        public HogStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   356
        public HogStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   357
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   358
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   359
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   360
            return Arrays.asList("name", "hat", "rounds", "kills", "deaths", "suicides", "difficulty", "initialHealth", "weaponset");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   361
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   362
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   363
        public void fillFrom(Hog hog) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   364
            difficulty = hog.level;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   365
            hat = hog.hat;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   366
            name = hog.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   367
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   368
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   369
        public Hog toHog() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   370
            return new Hog(name, hat, difficulty);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   371
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   372
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   373
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   374
        public String hat;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   375
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   376
        public int rounds;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   377
        public int kills;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   378
        public int deaths;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   379
        public int suicides;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   380
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   381
        public int difficulty;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   382
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   383
        public int initialHealth;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   384
        public WeaponsetStruct.ByRef weaponset;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   385
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   386
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   387
    static class TeamStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   388
        public static class ByVal extends TeamStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   389
        public static class ByRef extends TeamStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   390
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   391
        public TeamStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   392
        public TeamStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   393
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   394
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   395
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   396
            return Arrays.asList("hogs", "name", "grave", "fort", "voicepack", "flag", "bindings", "bindingCount", "rounds", "wins", "campaignProgress", "colorIndex", "hogsInGame", "remoteDriven", "ownerName");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   397
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   398
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   399
        public void fillFrom(Team team, TeamIngameAttributes attrs) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   400
            if(team != null) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   401
                name = team.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   402
                grave = team.grave;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   403
                flag = team.flag;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   404
                voicepack = team.voice;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   405
                fort = team.fort;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   406
                if(team.hogs.size() != Team.HEDGEHOGS_PER_TEAM) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   407
                    throw new IllegalArgumentException();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   408
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   409
                for(int i=0; i<hogs.length; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   410
                    hogs[i] = new HogStruct();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   411
                    hogs[i].fillFrom(team.hogs.get(i));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   412
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   413
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   414
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   415
            if(attrs != null) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   416
                hogsInGame = attrs.hogCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   417
                ownerName = attrs.ownerName;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   418
                colorIndex = attrs.colorIndex;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   419
                remoteDriven = attrs.remoteDriven;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   420
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   421
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   422
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   423
        public void fillFrom(TeamInGame team, WeaponsetStruct.ByRef weaponset, int initialHealth) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   424
            fillFrom(team.team, team.ingameAttribs);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   425
            for(int i=0; i<hogs.length; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   426
                hogs[i].initialHealth = initialHealth;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   427
                hogs[i].weaponset = weaponset;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   428
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   429
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   430
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   431
        public Team toTeam() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   432
            List<Hog> hogList = new ArrayList<Hog>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   433
            for(int i=0; i<hogs.length; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   434
                hogList.add(hogs[i].toHog());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   435
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   436
            return new Team(name, grave, flag, voicepack, fort, hogList);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   437
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   438
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   439
        public TeamIngameAttributes toTeamIngameAttributes() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   440
            return new TeamIngameAttributes(ownerName, colorIndex, hogsInGame, remoteDriven);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   441
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   442
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   443
        public TeamInGame toTeamInGame() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   444
            return new TeamInGame(toTeam(), toTeamIngameAttributes());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   445
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   446
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   447
        public HogStruct[] hogs = new HogStruct[Team.HEDGEHOGS_PER_TEAM];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   448
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   449
        public String grave;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   450
        public String fort;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   451
        public String voicepack;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   452
        public String flag;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   453
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   454
        public Pointer bindings;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   455
        public int bindingCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   456
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   457
        public int rounds;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   458
        public int wins;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   459
        public int campaignProgress;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   460
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   461
        public int colorIndex;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   462
        public int hogsInGame;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   463
        public boolean remoteDriven;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   464
        public String ownerName;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   465
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   466
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   467
    static class WeaponsetStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   468
        public static class ByVal extends WeaponsetStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   469
        public static class ByRef extends WeaponsetStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   470
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   471
        public WeaponsetStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   472
        public WeaponsetStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   473
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   474
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   475
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   476
            return Arrays.asList("loadout", "crateprob", "crateammo", "delay", "name");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   477
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   478
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   479
        public void fillFrom(Weaponset weaponset) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   480
            fillWeaponInfo(loadout, weaponset.loadout);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   481
            fillWeaponInfo(crateprob, weaponset.crateProb);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   482
            fillWeaponInfo(crateammo, weaponset.crateAmmo);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   483
            fillWeaponInfo(delay, weaponset.delay);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   484
            name = weaponset.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   485
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   486
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   487
        private static void fillWeaponInfo(byte[] array, String str) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   488
            for(int i=0; i<array.length-1; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   489
                array[i] = (byte) (i<str.length() ? str.charAt(i) : '0');
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   490
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   491
            array[array.length-1] = (byte)0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   492
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   493
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   494
        public Weaponset toWeaponset() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   495
            return new Weaponset(name, weaponInfoToString(loadout), weaponInfoToString(crateprob), weaponInfoToString(crateammo), weaponInfoToString(delay));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   496
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   497
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   498
        private static String weaponInfoToString(byte[] array) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   499
            try {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   500
                return new String(array, 0, array.length-1, "ASCII");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   501
            } catch (UnsupportedEncodingException e) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   502
                throw new AssertionError();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   503
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   504
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   505
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   506
        public byte[] loadout = new byte[Weaponset.WEAPONS_COUNT+1];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   507
        public byte[] crateprob = new byte[Weaponset.WEAPONS_COUNT+1];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   508
        public byte[] crateammo = new byte[Weaponset.WEAPONS_COUNT+1];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   509
        public byte[] delay = new byte[Weaponset.WEAPONS_COUNT+1];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   510
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   511
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   512
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   513
    /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   514
     * Represents a flib_weaponset*, for use as part of a flib_weaponset**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   515
     */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   516
    static class WeaponsetPointerByReference extends Structure implements Structure.ByReference {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   517
        public WeaponsetPointerByReference() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   518
        public WeaponsetPointerByReference(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   519
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   520
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   521
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   522
            return Arrays.asList("weaponset");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   523
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   524
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   525
        public WeaponsetStruct.ByRef weaponset;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   526
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   527
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   528
    static class WeaponsetListStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   529
        public static class ByVal extends WeaponsetListStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   530
        public static class ByRef extends WeaponsetListStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   531
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   532
        public WeaponsetListStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   533
        public WeaponsetListStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   534
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   535
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   536
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   537
            return Arrays.asList("weaponsetCount", "weaponsets");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   538
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   539
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   540
        public void fillFrom(List<Weaponset> list) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   541
            weaponsetCount = list.size();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   542
            if(weaponsetCount<=0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   543
                weaponsets = null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   544
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   545
                weaponsets = new WeaponsetPointerByReference();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   546
                Structure[] structs = weaponsets.toArray(weaponsetCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   547
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   548
                for(int i=0; i<weaponsetCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   549
                    WeaponsetPointerByReference pstruct = (WeaponsetPointerByReference)structs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   550
                    pstruct.weaponset = new WeaponsetStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   551
                    pstruct.weaponset.fillFrom(list.get(i));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   552
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   553
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   554
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   555
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   556
        /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   557
         * Only use on native-owned structs!
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   558
         * Calling this method on a Java-owned struct could cause garbage collection of referenced
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   559
         * structures.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   560
         */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   561
        public List<Weaponset> toWeaponsetList() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   562
            if(weaponsetCount<=0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   563
                return new ArrayList<Weaponset>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   564
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   565
                List<Weaponset> list = new ArrayList<Weaponset>(weaponsetCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   566
                Structure[] structs = weaponsets.toArray(weaponsetCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   567
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   568
                for(int i=0; i<weaponsetCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   569
                    WeaponsetPointerByReference pstruct = (WeaponsetPointerByReference)structs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   570
                    list.add(pstruct.weaponset.toWeaponset());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   571
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   572
                return list;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   573
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   574
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   575
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   576
        public int weaponsetCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   577
        public WeaponsetPointerByReference weaponsets;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   578
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   579
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   580
    static class RoomStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   581
        public static class ByVal extends RoomStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   582
        public static class ByRef extends RoomStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   583
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   584
        public RoomStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   585
        public RoomStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   586
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   587
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   588
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   589
            return Arrays.asList("inProgress", "name", "playerCount", "teamCount", "owner", "map", "scheme", "weapons");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   590
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   591
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   592
        public Room toRoomlistRoom() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   593
            return new Room(name, map, scheme, weapons, owner, playerCount, teamCount, inProgress);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   594
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   595
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   596
        public boolean inProgress;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   597
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   598
        public int playerCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   599
        public int teamCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   600
        public String owner;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   601
        public String map;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   602
        public String scheme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   603
        public String weapons;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   604
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   605
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   606
    static class MapRecipeStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   607
        public static class ByVal extends MapRecipeStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   608
        public static class ByRef extends MapRecipeStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   609
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   610
        public MapRecipeStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   611
        public MapRecipeStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   612
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   613
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   614
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   615
            return Arrays.asList("mapgen", "name", "seed", "theme", "drawData", "drawDataSize", "templateFilter", "mazeSize");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   616
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   617
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   618
        public void fillFrom(MapRecipe map) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   619
            mapgen = map.mapgen;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   620
            name = map.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   621
            seed = map.seed;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   622
            theme = map.theme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   623
            byte[] buf = map.getDrawData();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   624
            drawData = ByteArrayPtr.createJavaOwned(buf);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   625
            drawDataSize = NativeSizeT.valueOf(buf==null ? 0 : buf.length);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   626
            templateFilter = map.templateFilter;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   627
            mazeSize = map.mazeSize;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   628
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   629
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   630
        public MapRecipe toMapRecipe() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   631
            byte[] buf = ByteArrayPtr.deref(drawData, drawDataSize.intValue());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   632
            return new MapRecipe(mapgen, templateFilter, mazeSize, name, seed, theme, buf);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   633
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   634
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   635
        public int mapgen;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   636
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   637
        public String seed;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   638
        public String theme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   639
        public ByteArrayPtr drawData;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   640
        public NativeSizeT drawDataSize;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   641
        public int templateFilter;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   642
        public int mazeSize;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   643
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   644
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   645
    static class MetaschemeSettingStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   646
        public static class ByVal extends MetaschemeSettingStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   647
        public static class ByRef extends MetaschemeSettingStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   648
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   649
        public MetaschemeSettingStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   650
        public MetaschemeSettingStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   651
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   652
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   653
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   654
            return Arrays.asList("name", "engineCommand", "maxMeansInfinity", "times1000", "min", "max", "def");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   655
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   656
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   657
        public void fillFrom(Setting setting) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   658
            name = setting.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   659
            engineCommand = setting.engineCommand;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   660
            maxMeansInfinity = setting.maxMeansInfinity;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   661
            times1000 = setting.times1000;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   662
            min = setting.min;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   663
            max = setting.max;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   664
            def = setting.def;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   665
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   666
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   667
        public MetaScheme.Setting toMetaSchemeSetting() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   668
            return new MetaScheme.Setting(name, engineCommand, maxMeansInfinity, times1000, min, max, def);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   669
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   670
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   671
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   672
        public String engineCommand;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   673
        public boolean maxMeansInfinity;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   674
        public boolean times1000;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   675
        public int min;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   676
        public int max;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   677
        public int def;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   678
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   679
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   680
    static class MetaschemeModStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   681
        public static class ByVal extends MetaschemeModStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   682
        public static class ByRef extends MetaschemeModStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   683
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   684
        public MetaschemeModStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   685
        public MetaschemeModStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   686
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   687
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   688
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   689
            return Arrays.asList("name", "bitmaskIndex");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   690
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   691
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   692
        public void fillFrom(Mod mod) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   693
            name = mod.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   694
            bitmaskIndex = mod.bitmaskIndex;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   695
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   696
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   697
        public MetaScheme.Mod toMetaSchemeMod() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   698
            return new MetaScheme.Mod(name, bitmaskIndex);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   699
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   700
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   701
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   702
        public int bitmaskIndex;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   703
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   704
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   705
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   706
    static class MetaschemeStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   707
        public static class ByVal extends MetaschemeStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   708
        public static class ByRef extends MetaschemeStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   709
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   710
        public MetaschemeStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   711
        public MetaschemeStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   712
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   713
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   714
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   715
            return Arrays.asList("settingCount", "modCount", "settings", "mods");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   716
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   717
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   718
        /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   719
         * Only use on native-owned structs!
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   720
         * Calling this method on a Java-owned struct could cause garbage collection of referenced
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   721
         * structures.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   722
         */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   723
        public MetaScheme toMetaScheme() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   724
            List<MetaScheme.Setting> settingList = new ArrayList<MetaScheme.Setting>(settingCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   725
            List<MetaScheme.Mod> modList = new ArrayList<MetaScheme.Mod>(modCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   726
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   727
            Structure[] settingStructs = settings.toArray(settingCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   728
            Structure[] modStructs = mods.toArray(modCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   729
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   730
            for(int i=0; i<settingCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   731
                MetaschemeSettingStruct mss = (MetaschemeSettingStruct)settingStructs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   732
                settingList.add(mss.toMetaSchemeSetting());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   733
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   734
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   735
            for(int i=0; i<modCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   736
                MetaschemeModStruct mms = (MetaschemeModStruct)modStructs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   737
                modList.add(mms.toMetaSchemeMod());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   738
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   739
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   740
            return new MetaScheme(modList, settingList);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   741
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   742
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   743
        public int settingCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   744
        public int modCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   745
        public MetaschemeSettingStruct.ByRef settings;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   746
        public MetaschemeModStruct.ByRef mods;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   747
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   748
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   749
    static class SchemeStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   750
        public static class ByVal extends SchemeStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   751
        public static class ByRef extends SchemeStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   752
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   753
        public SchemeStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   754
        public SchemeStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   755
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   756
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   757
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   758
            return Arrays.asList("name", "settings", "mods");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   759
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   760
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   761
        public void fillFrom(Scheme scheme) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   762
            MetaScheme meta = MetaScheme.INSTANCE;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   763
            name = scheme.name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   764
            settings = new Memory(AndroidTypeMapper.NATIVE_INT_SIZE * meta.settings.size());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   765
            for(int i=0; i<meta.settings.size(); i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   766
                Integer value = scheme.settings.get(meta.settings.get(i).name);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   767
                settings.setInt(AndroidTypeMapper.NATIVE_INT_SIZE*i, value);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   768
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   769
            mods = new Memory(AndroidTypeMapper.NATIVE_BOOL_SIZE * meta.mods.size());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   770
            for(int i=0; i<meta.mods.size(); i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   771
                Boolean value = scheme.mods.get(meta.mods.get(i).name);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   772
                mods.setByte(AndroidTypeMapper.NATIVE_BOOL_SIZE*i, (byte)(value ? 1 : 0));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   773
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   774
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   775
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   776
        public Scheme toScheme() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   777
            Map<String, Integer> settingsMap = new HashMap<String, Integer>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   778
            MetaScheme meta = MetaScheme.INSTANCE;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   779
            for(int i=0; i<meta.settings.size(); i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   780
                settingsMap.put(meta.settings.get(i).name, settings.getInt(AndroidTypeMapper.NATIVE_INT_SIZE*i));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   781
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   782
            Map<String, Boolean> modsMap = new HashMap<String, Boolean>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   783
            for(int i=0; i<meta.mods.size(); i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   784
                modsMap.put(meta.mods.get(i).name, mods.getByte(i) != 0 ? Boolean.TRUE : Boolean.FALSE);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   785
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   786
            return new Scheme(name, settingsMap, modsMap);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   787
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   788
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   789
        public String name;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   790
        public Pointer settings;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   791
        public Pointer mods;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   792
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   793
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   794
    /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   795
     * Represents a flib_scheme*, for use as part of a flib_scheme**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   796
     */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   797
    static class SchemePointerByReference extends Structure implements Structure.ByReference {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   798
        public SchemePointerByReference() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   799
        public SchemePointerByReference(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   800
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   801
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   802
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   803
            return Arrays.asList("scheme");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   804
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   805
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   806
        public SchemeStruct.ByRef scheme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   807
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   808
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   809
    static class SchemelistStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   810
        public static class ByVal extends SchemelistStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   811
        public static class ByRef extends SchemelistStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   812
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   813
        public SchemelistStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   814
        public SchemelistStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   815
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   816
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   817
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   818
            return Arrays.asList("schemeCount", "schemes");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   819
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   820
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   821
        public void fillFrom(List<Scheme> schemeList) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   822
            schemeCount = schemeList.size();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   823
            if(schemeCount<=0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   824
                schemes = null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   825
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   826
                schemes = new SchemePointerByReference();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   827
                Structure[] schemePtrStructs = schemes.toArray(schemeCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   828
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   829
                for(int i=0; i<this.schemeCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   830
                    SchemePointerByReference spbr = (SchemePointerByReference)schemePtrStructs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   831
                    spbr.scheme = new SchemeStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   832
                    spbr.scheme.fillFrom(schemeList.get(i));
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   833
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   834
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   835
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   836
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   837
        /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   838
         * Only use on native-owned structs!
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   839
         * Calling this method on a Java-owned struct could cause garbage collection of referenced
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   840
         * structures.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   841
         */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   842
        public List<Scheme> toSchemeList() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   843
            if(schemeCount<=0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   844
                return new ArrayList<Scheme>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   845
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   846
                List<Scheme> schemeList = new ArrayList<Scheme>(schemeCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   847
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   848
                Structure[] schemePtrStructs = schemes.toArray(schemeCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   849
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   850
                for(int i=0; i<schemeCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   851
                    SchemePointerByReference spbr2 = (SchemePointerByReference)schemePtrStructs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   852
                    schemeList.add(spbr2.scheme.toScheme());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   853
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   854
                return schemeList;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   855
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   856
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   857
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   858
        public int schemeCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   859
        public SchemePointerByReference schemes;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   860
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   861
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   862
    /**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   863
     * Represents a flib_team*, for use as part of a flib_team**
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   864
     */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   865
    static class TeamPointerByReference extends Structure implements Structure.ByReference {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   866
        public TeamPointerByReference() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   867
        public TeamPointerByReference(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   868
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   869
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   870
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   871
            return Arrays.asList("team");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   872
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   873
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   874
        public TeamStruct.ByRef team;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   875
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   876
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   877
    static class TeamlistStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   878
        public static class ByVal extends TeamlistStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   879
        public static class ByRef extends TeamlistStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   880
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   881
        public TeamlistStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   882
        public TeamlistStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   883
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   884
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   885
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   886
            return Arrays.asList("teamCount", "teams");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   887
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   888
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   889
        public void fillFrom(List<TeamInGame> teamList, WeaponsetStruct.ByRef weaponset, int initialHealth) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   890
            teamCount = teamList.size();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   891
            if(teamCount <= 0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   892
                teams = null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   893
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   894
                teams = new TeamPointerByReference();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   895
                Structure[] teamPtrStructs = teams.toArray(teamCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   896
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   897
                for(int i=0; i<this.teamCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   898
                    TeamPointerByReference tpbr = (TeamPointerByReference)teamPtrStructs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   899
                    tpbr.team = new TeamStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   900
                    tpbr.team.fillFrom(teamList.get(i), weaponset, initialHealth);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   901
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   902
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   903
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   904
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   905
        public List<TeamInGame> toTeamInGameList() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   906
            if(teamCount<=0) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   907
                return new ArrayList<TeamInGame>();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   908
            } else {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   909
                List<TeamInGame> result = new ArrayList<TeamInGame>(teamCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   910
                Structure[] structs = teams.toArray(teamCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   911
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   912
                for(int i=0; i<teamCount; i++) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   913
                    TeamPointerByReference struct = (TeamPointerByReference)structs[i];
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   914
                    result.add(struct.team.toTeamInGame());
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   915
                }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   916
                return result;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   917
            }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   918
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   919
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   920
        public int teamCount;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   921
        public TeamPointerByReference teams;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   922
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   923
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   924
    static class GameSetupStruct extends Structure {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   925
        public static class ByVal extends GameSetupStruct implements Structure.ByValue {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   926
        public static class ByRef extends GameSetupStruct implements Structure.ByReference {}
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   927
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   928
        public GameSetupStruct() { super(); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   929
        public GameSetupStruct(Pointer ptr) { super(ptr); }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   930
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   931
        @Override
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   932
        protected List<String> getFieldOrder() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   933
            return Arrays.asList("script", "gamescheme", "map", "teamlist");
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   934
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   935
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   936
        public void fillFrom(GameConfig conf) {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   937
            script = conf.style;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   938
            gamescheme = new SchemeStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   939
            gamescheme.fillFrom(conf.scheme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   940
            map = new MapRecipeStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   941
            map.fillFrom(conf.map);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   942
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   943
            /*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   944
             * At this point we deviate from the usual copying pattern because the frontlib
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   945
             * expects per-hog weapons and initial health, but the UI models them as per-
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   946
             * game, so we extract them from the config here and pass them on to be included
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   947
             * in each hog.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   948
             */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   949
            WeaponsetStruct.ByRef wss = new WeaponsetStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   950
            wss.fillFrom(conf.weaponset);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   951
            int initialHealth = conf.scheme.getHealth();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   952
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   953
            teamlist = new TeamlistStruct.ByRef();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   954
            teamlist.fillFrom(conf.teams, wss, initialHealth);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   955
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   956
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   957
        public GameConfig toGameConfig() {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   958
            Scheme scheme = gamescheme != null ? gamescheme.toScheme() : null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   959
            MapRecipe mapRecipe = map != null ? map.toMapRecipe() : null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   960
            List<TeamInGame> teams = teamlist != null ? teamlist.toTeamInGameList() : null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   961
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   962
            WeaponsetStruct weaponsetStruct = teamlist != null && teamlist.teamCount>0 ? teamlist.teams.team.hogs[0].weaponset : null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   963
            Weaponset weaponset = weaponsetStruct != null ? weaponsetStruct.toWeaponset() : null;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   964
            return new GameConfig(script, scheme, mapRecipe, teams, weaponset);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   965
        }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   966
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   967
        public String script;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   968
        public SchemeStruct.ByRef gamescheme;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   969
        public MapRecipeStruct.ByRef map;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   970
        public TeamlistStruct.ByRef teamlist;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   971
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   972
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   973
    /*
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   974
     * Callback interfaces. The context parameter is never needed here and
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   975
     * should always be ignored. Be sure to keep a reference to each callback
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   976
     * for as long as they might be called by native code, to avoid premature
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   977
     * garbage collection.
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   978
     */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   979
    public static interface VoidCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   980
        void callback(Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   981
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   982
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   983
    public static interface StrCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   984
        void callback(Pointer context, String arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   985
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   986
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   987
    public static interface IntCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   988
        void callback(Pointer context, int arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   989
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   990
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   991
    public static interface IntStrCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   992
        void callback(Pointer context, int arg1, String arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   993
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   994
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   995
    public static interface StrIntCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   996
        void callback(Pointer context, String arg1, int arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   997
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   998
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
   999
    public static interface StrStrCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1000
        void callback(Pointer context, String arg1, String arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1001
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1002
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1003
    public static interface StrStrBoolCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1004
        void callback(Pointer context, String arg1, String arg2, boolean arg3);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1005
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1006
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1007
    public static interface RoomCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1008
        void callback(Pointer context, RoomPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1009
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1010
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1011
    public static interface RoomListCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1012
        void callback(Pointer context, RoomArrayPtr arg1, int count);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1013
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1014
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1015
    public static interface StrRoomCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1016
        void callback(Pointer context, String arg1, RoomPtr arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1017
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1018
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1019
    public static interface BoolCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1020
        void callback(Pointer context, boolean arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1021
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1022
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1023
    public static interface StrBoolCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1024
        void callback(Pointer context, String arg1, boolean arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1025
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1026
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1027
    public static interface TeamCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1028
        void callback(Pointer context, TeamPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1029
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1030
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1031
    public static interface BytesCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1032
        void callback(Pointer context, ByteArrayPtr buffer, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1033
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1034
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1035
    public static interface BytesBoolCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1036
        void callback(Pointer context, ByteArrayPtr buffer, NativeSizeT size, boolean arg3);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1037
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1038
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1039
    public static interface SchemeCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1040
        void callback(Pointer context, SchemePtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1041
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1042
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1043
    public static interface MapIntCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1044
        void callback(Pointer context, MapRecipePtr arg1, int arg2);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1045
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1046
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1047
    public static interface WeaponsetCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1048
        void callback(Pointer context, WeaponsetPtr arg1);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1049
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1050
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1051
    public static interface MapimageCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1052
        void callback(Pointer context, ByteArrayPtr buffer, int hedgehogCount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1053
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1054
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1055
    public static interface LogCallback extends Callback {
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1056
        void callback(int level, String logMessage);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1057
    }
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1058
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1059
    // frontlib.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1060
    int flib_init();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1061
    void flib_quit();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1062
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1063
    // hwconsts.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1064
    int flib_get_teamcolor(int colorIndex);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1065
    int flib_get_teamcolor_count();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1066
    int flib_get_hedgehogs_per_team();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1067
    int flib_get_weapons_count();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1068
    MetaschemePtr flib_get_metascheme();
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1069
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1070
    // net/netconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1071
    static final int NETCONN_STATE_CONNECTING = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1072
    static final int NETCONN_STATE_LOBBY = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1073
    static final int NETCONN_STATE_ROOM = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1074
    static final int NETCONN_STATE_DISCONNECTED = 10;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1075
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1076
    static final int NETCONN_DISCONNECT_NORMAL = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1077
    static final int NETCONN_DISCONNECT_SERVER_TOO_OLD = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1078
    static final int NETCONN_DISCONNECT_AUTH_FAILED = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1079
    static final int NETCONN_DISCONNECT_CONNLOST = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1080
    static final int NETCONN_DISCONNECT_INTERNAL_ERROR = 100;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1081
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1082
    static final int NETCONN_ROOMLEAVE_ABANDONED = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1083
    static final int NETCONN_ROOMLEAVE_KICKED = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1084
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1085
    static final int NETCONN_MSG_TYPE_PLAYERINFO = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1086
    static final int NETCONN_MSG_TYPE_SERVERMESSAGE = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1087
    static final int NETCONN_MSG_TYPE_WARNING = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1088
    static final int NETCONN_MSG_TYPE_ERROR = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1089
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1090
    static final int NETCONN_MAPCHANGE_FULL = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1091
    static final int NETCONN_MAPCHANGE_MAP = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1092
    static final int NETCONN_MAPCHANGE_MAPGEN = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1093
    static final int NETCONN_MAPCHANGE_DRAWNMAP = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1094
    static final int NETCONN_MAPCHANGE_MAZE_SIZE = 4;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1095
    static final int NETCONN_MAPCHANGE_TEMPLATE = 5;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1096
    static final int NETCONN_MAPCHANGE_THEME = 6;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1097
    static final int NETCONN_MAPCHANGE_SEED = 7;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1098
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1099
    NetconnPtr flib_netconn_create(String playerName, String dataDirPath, String host, int port);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1100
    void flib_netconn_destroy(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1101
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1102
    void flib_netconn_tick(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1103
    boolean flib_netconn_is_chief(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1104
    String flib_netconn_get_playername(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1105
    GameSetupPtr flib_netconn_create_gamesetup(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1106
    int flib_netconn_send_quit(NetconnPtr conn, String quitmsg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1107
    int flib_netconn_send_chat(NetconnPtr conn, String chat);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1108
    int flib_netconn_send_teamchat(NetconnPtr conn, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1109
    int flib_netconn_send_password(NetconnPtr conn, String passwd);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1110
    int flib_netconn_send_nick(NetconnPtr conn, String nick);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1111
    int flib_netconn_send_request_roomlist(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1112
    int flib_netconn_send_joinRoom(NetconnPtr conn, String room);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1113
    int flib_netconn_send_createRoom(NetconnPtr conn, String room);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1114
    int flib_netconn_send_renameRoom(NetconnPtr conn, String roomName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1115
    int flib_netconn_send_leaveRoom(NetconnPtr conn, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1116
    int flib_netconn_send_toggleReady(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1117
    int flib_netconn_send_addTeam(NetconnPtr conn, TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1118
    int flib_netconn_send_removeTeam(NetconnPtr conn, String teamname);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1119
    int flib_netconn_send_engineMessage(NetconnPtr conn, ByteArrayPtr message, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1120
    int flib_netconn_send_teamHogCount(NetconnPtr conn, String teamname, int hogcount);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1121
    int flib_netconn_send_teamColor(NetconnPtr conn, String teamname, int colorIndex);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1122
    int flib_netconn_send_weaponset(NetconnPtr conn, WeaponsetPtr weaponset);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1123
    int flib_netconn_send_map(NetconnPtr conn, MapRecipePtr map);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1124
    int flib_netconn_send_mapName(NetconnPtr conn, String mapName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1125
    int flib_netconn_send_mapGen(NetconnPtr conn, int mapGen);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1126
    int flib_netconn_send_mapTemplate(NetconnPtr conn, int templateFilter);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1127
    int flib_netconn_send_mapMazeSize(NetconnPtr conn, int mazeSize);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1128
    int flib_netconn_send_mapSeed(NetconnPtr conn, String seed);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1129
    int flib_netconn_send_mapTheme(NetconnPtr conn, String theme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1130
    int flib_netconn_send_mapDrawdata(NetconnPtr conn, ByteArrayPtr drawData, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1131
    int flib_netconn_send_script(NetconnPtr conn, String scriptName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1132
    int flib_netconn_send_scheme(NetconnPtr conn, SchemePtr scheme);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1133
    int flib_netconn_send_roundfinished(NetconnPtr conn, boolean withoutError);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1134
    int flib_netconn_send_ban(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1135
    int flib_netconn_send_kick(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1136
    int flib_netconn_send_playerInfo(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1137
    int flib_netconn_send_playerFollow(NetconnPtr conn, String playerName);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1138
    int flib_netconn_send_startGame(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1139
    int flib_netconn_send_toggleRestrictJoins(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1140
    int flib_netconn_send_toggleRestrictTeams(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1141
    int flib_netconn_send_clearAccountsCache(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1142
    int flib_netconn_send_setServerVar(NetconnPtr conn, String name, String value);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1143
    int flib_netconn_send_getServerVars(NetconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1144
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1145
    void flib_netconn_onMessage(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1146
    void flib_netconn_onClientFlags(NetconnPtr conn, StrStrBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1147
    void flib_netconn_onChat(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1148
    void flib_netconn_onConnected(NetconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1149
    void flib_netconn_onDisconnected(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1150
    void flib_netconn_onRoomlist(NetconnPtr conn, RoomListCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1151
    void flib_netconn_onRoomAdd(NetconnPtr conn, RoomCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1152
    void flib_netconn_onRoomDelete(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1153
    void flib_netconn_onRoomUpdate(NetconnPtr conn, StrRoomCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1154
    void flib_netconn_onLobbyJoin(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1155
    void flib_netconn_onLobbyLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1156
    void flib_netconn_onNickTaken(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1157
    void flib_netconn_onPasswordRequest(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1158
    void flib_netconn_onEnterRoom(NetconnPtr conn, BoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1159
    void flib_netconn_onLeaveRoom(NetconnPtr conn, IntStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1160
    void flib_netconn_onTeamAdd(NetconnPtr conn, TeamCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1161
    void flib_netconn_onTeamDelete(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1162
    void flib_netconn_onRoomJoin(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1163
    void flib_netconn_onRoomLeave(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1164
    void flib_netconn_onRunGame(NetconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1165
    void flib_netconn_onTeamAccepted(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1166
    void flib_netconn_onHogCountChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1167
    void flib_netconn_onTeamColorChanged(NetconnPtr conn, StrIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1168
    void flib_netconn_onEngineMessage(NetconnPtr conn, BytesCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1169
    void flib_netconn_onSchemeChanged(NetconnPtr conn, SchemeCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1170
    void flib_netconn_onMapChanged(NetconnPtr conn, MapIntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1171
    void flib_netconn_onScriptChanged(NetconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1172
    void flib_netconn_onWeaponsetChanged(NetconnPtr conn, WeaponsetCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1173
    void flib_netconn_onServerVar(NetconnPtr conn, StrStrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1174
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1175
    // ipc/gameconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1176
    static final int GAME_END_FINISHED = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1177
    static final int GAME_END_INTERRUPTED = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1178
    static final int GAME_END_HALTED = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1179
    static final int GAME_END_ERROR = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1180
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1181
    GameconnPtr flib_gameconn_create(String playerName, GameSetupPtr setup, boolean netgame);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1182
    GameconnPtr flib_gameconn_create_playdemo(ByteArrayPtr demo, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1183
    GameconnPtr flib_gameconn_create_loadgame(String playerName, ByteArrayPtr save, NativeSizeT size);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1184
    GameconnPtr flib_gameconn_create_campaign(String playerName, String seed, String script);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1185
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1186
    void flib_gameconn_destroy(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1187
    int flib_gameconn_getport(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1188
    void flib_gameconn_tick(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1189
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1190
    int flib_gameconn_send_enginemsg(GameconnPtr conn, ByteArrayPtr data, NativeSizeT len);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1191
    int flib_gameconn_send_textmsg(GameconnPtr conn, int msgtype, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1192
    int flib_gameconn_send_chatmsg(GameconnPtr conn, String playername, String msg);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1193
    int flib_gameconn_send_quit(GameconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1194
    int flib_gameconn_send_cmd(GameconnPtr conn, String cmdString);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1195
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1196
    void flib_gameconn_onConnect(GameconnPtr conn, VoidCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1197
    void flib_gameconn_onDisconnect(GameconnPtr conn, IntCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1198
    void flib_gameconn_onErrorMessage(GameconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1199
    void flib_gameconn_onChat(GameconnPtr conn, StrBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1200
    void flib_gameconn_onGameRecorded(GameconnPtr conn, BytesBoolCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1201
    void flib_gameconn_onEngineMessage(GameconnPtr conn, BytesCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1202
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1203
    // ipc/mapconn.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1204
    public static final int MAPIMAGE_WIDTH = 256;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1205
    public static final int MAPIMAGE_HEIGHT = 128;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1206
    public static final int MAPIMAGE_BYTES = (MAPIMAGE_WIDTH/8*MAPIMAGE_HEIGHT);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1207
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1208
    MapconnPtr flib_mapconn_create(MapRecipePtr mapdesc);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1209
    void flib_mapconn_destroy(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1210
    int flib_mapconn_getport(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1211
    void flib_mapconn_onSuccess(MapconnPtr conn, MapimageCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1212
    void flib_mapconn_onFailure(MapconnPtr conn, StrCallback callback, Pointer context);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1213
    void flib_mapconn_tick(MapconnPtr conn);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1214
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1215
    // model/map.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1216
    public static final int MAPGEN_REGULAR = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1217
    public static final int MAPGEN_MAZE = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1218
    public static final int MAPGEN_DRAWN = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1219
    public static final int MAPGEN_NAMED = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1220
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1221
    public static final int TEMPLATEFILTER_ALL = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1222
    public static final int TEMPLATEFILTER_SMALL = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1223
    public static final int TEMPLATEFILTER_MEDIUM = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1224
    public static final int TEMPLATEFILTER_LARGE = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1225
    public static final int TEMPLATEFILTER_CAVERN = 4;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1226
    public static final int TEMPLATEFILTER_WACKY = 5;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1227
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1228
    public static final int MAZE_SIZE_SMALL_TUNNELS = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1229
    public static final int MAZE_SIZE_MEDIUM_TUNNELS = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1230
    public static final int MAZE_SIZE_LARGE_TUNNELS = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1231
    public static final int MAZE_SIZE_SMALL_ISLANDS = 3;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1232
    public static final int MAZE_SIZE_MEDIUM_ISLANDS = 4;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1233
    public static final int MAZE_SIZE_LARGE_ISLANDS = 5;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1234
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1235
    // model/schemelist.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1236
    SchemelistPtr flib_schemelist_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1237
    int flib_schemelist_to_ini(String filename, SchemelistPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1238
    void flib_schemelist_destroy(SchemelistPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1239
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1240
    // model/team.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1241
    TeamPtr flib_team_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1242
    int flib_team_to_ini(String filename, TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1243
    void flib_team_destroy(TeamPtr team);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1244
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1245
    // model/weapon.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1246
    WeaponsetListPtr flib_weaponsetlist_from_ini(String filename);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1247
    int flib_weaponsetlist_to_ini(String filename, WeaponsetListPtr weaponsets);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1248
    void flib_weaponsetlist_destroy(WeaponsetListPtr list);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1249
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1250
    // model/gamesetup.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1251
    void flib_gamesetup_destroy(GameSetupPtr gamesetup);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1252
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1253
    // util/logging.h
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1254
    public static final int FLIB_LOGLEVEL_ALL = -100;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1255
    public static final int FLIB_LOGLEVEL_DEBUG = -1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1256
    public static final int FLIB_LOGLEVEL_INFO = 0;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1257
    public static final int FLIB_LOGLEVEL_WARNING = 1;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1258
    public static final int FLIB_LOGLEVEL_ERROR = 2;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1259
    public static final int FLIB_LOGLEVEL_NONE = 100;
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1260
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1261
    void flib_log_setLevel(int level);
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 8512
diff changeset
  1262
    void flib_log_setCallback(LogCallback callback);
7476
2fb781bbdd51 Hedgeroid: Start using the frontlib for more operations
Medo <smaxein@googlemail.com>
parents:
diff changeset
  1263
}