mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +03:00
createentity command: Actually have p1/p2/p3/p4 defaults
Since createentity() started accepting p1/p2/p3/p4 arguments, it now unconditionally passes in whatever arguments were present there previously, when there weren't any before. This can lead to unexpected behavior when selectively using and then omitting p1/p2/p3/p4 arguments. Also, plenty of existing levels already only use the 5-argument version of createentity(). And createcrewman() can take up to 6 arguments at once. It's not far-fetched that an existing level could createentity() right after doing a 6-argument createcrewman(), which would lead to a different behavior than in 2.2 and previous. So instead, instead of checking if `words[index]` is an empty string (it only sets the string to be empty if there are enough argument separators on the line), ACTUALLY check if it's empty. I've added a static array (no need for it to be exported) that keeps track of this. createentity() now checks for that instead of `words`.
This commit is contained in:
@@ -15,6 +15,8 @@ struct Script
|
||||
std::vector<std::string> contents;
|
||||
};
|
||||
|
||||
#define NUM_SCRIPT_ARGS 40
|
||||
|
||||
class scriptclass
|
||||
{
|
||||
public:
|
||||
@@ -47,7 +49,7 @@ public:
|
||||
|
||||
//Script contents
|
||||
std::vector<std::string> commands;
|
||||
std::string words[40];
|
||||
std::string words[NUM_SCRIPT_ARGS];
|
||||
std::vector<std::string> txt;
|
||||
std::string scriptname;
|
||||
int position;
|
||||
|
||||
Reference in New Issue
Block a user