misc/libphyslayer/physfslualoader.c
author Wuzzy <Wuzzy2@mail.ru>
Tue, 04 Sep 2018 14:20:15 +0200
changeset 13758 a0d6404a80a2
parent 13537 ecdf6ce2301e
permissions -rw-r--r--
Rework rankings of losing clans: Rank them in the reverse order they died New ranking rule: - The clan that survived is ranked 1st. - The clan that died last is ranked 2nd. - The clan that died second last is ranked 3rd. - The clan that died third last is ranked 4th. - And so on ... Old ranking rule: - The clan that survived is ranked 1st. - The losing teams are ranked in the order they started with, which isn't fair. Draws are not handled properly in rankings yet.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8074
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
     1
#include "lua.h"
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
     2
#include "physfs.h"
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     3
9991
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
     4
#include "physfscompat.h"
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
     5
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     6
#define BUFSIZE 1024
13537
ecdf6ce2301e Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents: 9991
diff changeset
     7
#define UNUSED(x) (void)(x)
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
     8
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
     9
void *physfsReaderBuffer;
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    10
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    11
PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size)
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    12
{
13537
ecdf6ce2301e Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents: 9991
diff changeset
    13
    UNUSED(L);
8034
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    14
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    15
    if(PHYSFS_eof(f))
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    16
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    17
        return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    18
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    19
    else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    20
    {
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    21
        *size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE);
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    22
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    23
        if(*size == 0)
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    24
            return NULL;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    25
        else
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    26
            return physfsReaderBuffer;
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    27
    }
fc032c0f7b23 Implement reader in C ffs
unc0rr
parents:
diff changeset
    28
}
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    29
8119
257ffa847aa2 physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents: 8074
diff changeset
    30
PHYSFS_DECL void physfsReaderSetBuffer(void *buffer)
8073
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    31
{
5a289ef40fdb physfs compilation on windows
koda
parents: 8040
diff changeset
    32
    physfsReaderBuffer = buffer;
8074
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    33
}
768427321cab thou shall not use system headers for crossplatformness
koda
parents: 8073
diff changeset
    34