mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-25 22:18:30 +02:00
Apparently in C, if you have `void test();`, it's completely okay to do `test(2);`. The function will take in the argument, but just discard it and throw it away. It's like a trash can, and a rude one at that. If you declare it like `void test(void);`, this is prevented. This is not a problem in C++ - doing `void test();` and `test(2);` is guaranteed to result in a compile error (this also means that right now, at least in all `.cpp` files, nobody is ever calling a void parameter function with arguments and having their arguments be thrown away). However, we may not be using C++ in the future, so I just want to lay down the precedent that if a function takes in no arguments, you must explicitly declare it as such. I would've added `-Wstrict-prototypes`, but it produces an annoying warning message saying it doesn't work in C++ mode if you're compiling in C++ mode. So it can be added later.
76 lines
1.2 KiB
C++
76 lines
1.2 KiB
C++
#ifndef SCRIPT_H
|
|
#define SCRIPT_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <SDL.h>
|
|
|
|
#define filllines(lines) commands.insert(commands.end(), lines, lines + SDL_arraysize(lines))
|
|
|
|
|
|
struct Script
|
|
{
|
|
std::string name;
|
|
std::vector<std::string> contents;
|
|
};
|
|
|
|
class scriptclass
|
|
{
|
|
public:
|
|
|
|
|
|
scriptclass(void);
|
|
|
|
void load(const std::string& name);
|
|
void loadother(const char* t);
|
|
void loadcustom(const std::string& t);
|
|
|
|
void inline add(const std::string& t)
|
|
{
|
|
commands.push_back(t);
|
|
}
|
|
|
|
void clearcustom(void);
|
|
|
|
void tokenize(const std::string& t);
|
|
|
|
void run(void);
|
|
|
|
void resetgametomenu(void);
|
|
|
|
void startgamemode(int t);
|
|
|
|
void teleport(void);
|
|
|
|
void hardreset(void);
|
|
|
|
//Script contents
|
|
std::vector<std::string> commands;
|
|
std::string words[40];
|
|
std::vector<std::string> txt;
|
|
std::string scriptname;
|
|
int position;
|
|
int looppoint, loopcount;
|
|
|
|
int scriptdelay;
|
|
bool running, dontrunnextframe;
|
|
|
|
//Textbox stuff
|
|
int textx;
|
|
int texty;
|
|
int r,g,b;
|
|
|
|
//Misc
|
|
int i, j, k;
|
|
|
|
//Custom level stuff
|
|
std::vector<Script> customscripts;
|
|
};
|
|
|
|
#ifndef SCRIPT_DEFINITION
|
|
extern scriptclass script;
|
|
#endif
|
|
|
|
#endif /* SCRIPT_H */
|