Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
This commit is contained in:
commit
8d312ecdfa
@ -1 +1,2 @@
|
|||||||
SConscript('SConscript', variant_dir='build', duplicate=0)
|
AddOption('--builddir',dest="builddir",default="build",help="Directory to build to.")
|
||||||
|
SConscript('SConscript', variant_dir=GetOption('builddir'), duplicate=0)
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MINOR_VERSION
|
#ifndef MINOR_VERSION
|
||||||
#define MINOR_VERSION 1
|
#define MINOR_VERSION 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BUILD_NUM
|
#ifndef BUILD_NUM
|
||||||
#define BUILD_NUM 262
|
#define BUILD_NUM 263
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SNAPSHOT_ID
|
#ifndef SNAPSHOT_ID
|
||||||
|
@ -85,10 +85,22 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
{
|
{
|
||||||
if(rawWord[i] == ',' && rawWord[i+1] >= '0' && rawWord[i+1] <= '9')
|
if(rawWord[i] == ',' && rawWord[i+1] >= '0' && rawWord[i+1] <= '9')
|
||||||
goto parsePoint;
|
goto parsePoint;
|
||||||
|
else if((rawWord[i] == '#' || rawWord[i] == 'x') &&
|
||||||
|
((rawWord[i+1] >= '0' && rawWord[i+1] <= '9')
|
||||||
|
|| (rawWord[i+1] >= 'a' && rawWord[i+1] <= 'f')
|
||||||
|
|| (rawWord[i+1] >= 'A' && rawWord[i+1] <= 'F')))
|
||||||
|
goto parseNumberHex;
|
||||||
else
|
else
|
||||||
goto parseString;
|
goto parseString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
parseNumberHex:
|
||||||
|
i++;
|
||||||
|
for(; i < word.length(); i++)
|
||||||
|
if(!((rawWord[i] >= '0' && rawWord[i] <= '9') || (rawWord[i] >= 'a' && rawWord[i] <= 'f') || (rawWord[i] >= 'A' && rawWord[i] <= 'F')))
|
||||||
|
{
|
||||||
|
goto parseString;
|
||||||
|
}
|
||||||
return TypeNumber;
|
return TypeNumber;
|
||||||
parsePoint:
|
parsePoint:
|
||||||
i++;
|
i++;
|
||||||
@ -102,6 +114,50 @@ ValueType TPTScriptInterface::testType(std::string word)
|
|||||||
return TypeString;
|
return TypeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TPTScriptInterface::parseNumber(char * stringData)
|
||||||
|
{
|
||||||
|
char cc;
|
||||||
|
int base = 10;
|
||||||
|
int currentNumber = 0;
|
||||||
|
if(stringData[0] == '#')
|
||||||
|
{
|
||||||
|
stringData++;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
else if(stringData[0] == '0' && stringData[1] == 'x')
|
||||||
|
{
|
||||||
|
stringData+=2;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
if(base == 16)
|
||||||
|
{
|
||||||
|
while(cc = *(stringData++))
|
||||||
|
{
|
||||||
|
currentNumber *= base;
|
||||||
|
if(cc >= '0' && cc <= '9')
|
||||||
|
currentNumber += cc - '0';
|
||||||
|
else if(cc >= 'a' && cc <= 'f')
|
||||||
|
currentNumber += (cc - 'A') + 10;
|
||||||
|
else if(cc >= 'A' && cc <= 'F')
|
||||||
|
currentNumber += (cc - 'A') + 10;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while(cc = *(stringData++))
|
||||||
|
{
|
||||||
|
currentNumber *= base;
|
||||||
|
if(cc >= '0' && cc <= '9')
|
||||||
|
currentNumber += cc - '0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentNumber;
|
||||||
|
}
|
||||||
|
|
||||||
AnyType TPTScriptInterface::eval(std::deque<std::string> * words)
|
AnyType TPTScriptInterface::eval(std::deque<std::string> * words)
|
||||||
{
|
{
|
||||||
if(words->size() < 1)
|
if(words->size() < 1)
|
||||||
@ -128,7 +184,7 @@ AnyType TPTScriptInterface::eval(std::deque<std::string> * words)
|
|||||||
return tptS_quit(words);
|
return tptS_quit(words);
|
||||||
break;
|
break;
|
||||||
case TypeNumber:
|
case TypeNumber:
|
||||||
return NumberType(atoi(rawWord));
|
return NumberType(parseNumber(rawWord));
|
||||||
case TypePoint:
|
case TypePoint:
|
||||||
{
|
{
|
||||||
int pointX, pointY;
|
int pointX, pointY;
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
class TPTScriptInterface: public CommandInterface {
|
class TPTScriptInterface: public CommandInterface {
|
||||||
protected:
|
protected:
|
||||||
AnyType eval(std::deque<std::string> * words);
|
AnyType eval(std::deque<std::string> * words);
|
||||||
|
int parseNumber(char * stringData);
|
||||||
AnyType tptS_set(std::deque<std::string> * words);
|
AnyType tptS_set(std::deque<std::string> * words);
|
||||||
AnyType tptS_create(std::deque<std::string> * words);
|
AnyType tptS_create(std::deque<std::string> * words);
|
||||||
AnyType tptS_delete(std::deque<std::string> * words);
|
AnyType tptS_delete(std::deque<std::string> * words);
|
||||||
|
@ -2116,6 +2116,7 @@ void Simulation::init_can_move()
|
|||||||
can_move[PT_ELEC][PT_BIZRG] = 2;
|
can_move[PT_ELEC][PT_BIZRG] = 2;
|
||||||
can_move[PT_PHOT][PT_BIZRS] = 2;
|
can_move[PT_PHOT][PT_BIZRS] = 2;
|
||||||
can_move[PT_ELEC][PT_BIZRS] = 2;
|
can_move[PT_ELEC][PT_BIZRS] = 2;
|
||||||
|
can_move[PT_NEUT][PT_INVIS] = 2;
|
||||||
|
|
||||||
//whol eats anar
|
//whol eats anar
|
||||||
can_move[PT_ANAR][PT_WHOL] = 1;
|
can_move[PT_ANAR][PT_WHOL] = 1;
|
||||||
|
@ -105,7 +105,7 @@ int Element_CRAY::update(UPDATE_FUNC_ARGS)
|
|||||||
colored = wavelengthToDecoColour(parts[r>>8].ctype);
|
colored = wavelengthToDecoColour(parts[r>>8].ctype);
|
||||||
} else if ((r&0xFF) == PT_CRAY || nostop) {
|
} else if ((r&0xFF) == PT_CRAY || nostop) {
|
||||||
docontinue = 1;
|
docontinue = 1;
|
||||||
} else if(destroy && ((r&0xFF) != PT_DMND)) {
|
} else if(destroy && r && ((r&0xFF) != PT_DMND)) {
|
||||||
sim->kill_part(r>>8);
|
sim->kill_part(r>>8);
|
||||||
if(!--partsRemaining)
|
if(!--partsRemaining)
|
||||||
docontinue = 0;
|
docontinue = 0;
|
||||||
@ -147,4 +147,4 @@ unsigned int Element_CRAY::wavelengthToDecoColour(int wavelength)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Element_CRAY::~Element_CRAY() {}
|
Element_CRAY::~Element_CRAY() {}
|
||||||
|
@ -254,7 +254,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
|
|||||||
case PT_SWCH:
|
case PT_SWCH:
|
||||||
if (receiver==PT_PSCN||receiver==PT_NSCN||receiver==PT_WATR||receiver==PT_SLTW||receiver==PT_NTCT||receiver==PT_PTCT||receiver==PT_INWR)
|
if (receiver==PT_PSCN||receiver==PT_NSCN||receiver==PT_WATR||receiver==PT_SLTW||receiver==PT_NTCT||receiver==PT_PTCT||receiver==PT_INWR)
|
||||||
continue;
|
continue;
|
||||||
goto conduct;
|
break;
|
||||||
case PT_ETRD:
|
case PT_ETRD:
|
||||||
if (receiver==PT_METL||receiver==PT_BMTL||receiver==PT_BRMT||receiver==PT_LRBD||receiver==PT_RBDM||receiver==PT_PSCN||receiver==PT_NSCN)
|
if (receiver==PT_METL||receiver==PT_BMTL||receiver==PT_BRMT||receiver==PT_LRBD||receiver==PT_RBDM||receiver==PT_PSCN||receiver==PT_NSCN)
|
||||||
goto conduct;
|
goto conduct;
|
||||||
|
Reference in New Issue
Block a user