source: cpp/frams/param/paramtabobj.cpp @ 875

Last change on this file since 875 was 792, checked in by Maciej Komosinski, 7 years ago

Code formatting

  • Property svn:eol-style set to native
File size: 953 bytes
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
[109]4
5#include "paramtabobj.h"
6
7int ParamTab::measureTab(const ParamEntry *pe)
8{
[792]9        int i = 0;
10        while (pe->id) { i++; pe++; }
11        return i;
[109]12}
13
14void ParamTab::resize(int s)
15{
[792]16        if (s == siz) return;
17        tab = (ParamEntry*)realloc(tab, sizeof(ParamEntry)*(s + 1));
18        siz = s;
[109]19}
20
[792]21int ParamTab::add(const ParamEntry* p, int count)
[109]22{
[792]23        if (count < 0) count = measureTab(p);
24        resize(siz + count);
25        memmove(tab + siz - count, p, sizeof(ParamEntry)*count);
26        memset(tab + siz, 0, sizeof(ParamEntry));
27        if (siz > 0) tab[0].flags = (paInt)(siz - tab[0].group);
28        return siz - 1;
[109]29}
30
[792]31void ParamTab::remove(int i, int count)
[109]32{
[792]33        memmove(tab + i, tab + i + count, sizeof(ParamEntry)*count);
34        resize(siz - count);
35        memset(tab + siz, 0, sizeof(ParamEntry));
36        if (siz > 0) tab[0].flags = (paInt)(siz - tab[0].group);
[109]37}
Note: See TracBrowser for help on using the repository browser.