streflop updates
This commit is contained in:
parent
5a1c48d148
commit
7b9036345b
|
@ -269,7 +269,7 @@ int glestMain(int argc, char** argv){
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
|
|
||||||
streflop_init<streflop::Simple>();
|
streflop_init<streflop::Double>();
|
||||||
printf("%s, STREFLOP enabled.\n",getNetworkVersionString().c_str());
|
printf("%s, STREFLOP enabled.\n",getNetworkVersionString().c_str());
|
||||||
#else
|
#else
|
||||||
printf("%s, STREFLOP NOT enabled.\n",getNetworkVersionString().c_str());
|
printf("%s, STREFLOP NOT enabled.\n",getNetworkVersionString().c_str());
|
||||||
|
|
|
@ -393,8 +393,9 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree, const Fa
|
||||||
const CommandType *UnitType::getFirstCtOfClass(CommandClass commandClass) const{
|
const CommandType *UnitType::getFirstCtOfClass(CommandClass commandClass) const{
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
if(firstCommandTypeOfClass[commandClass] == NULL) {
|
if(firstCommandTypeOfClass[commandClass] == NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] commandClass = %d\n",__FILE__,__FUNCTION__,__LINE__,commandClass);
|
||||||
|
|
||||||
|
/*
|
||||||
for(int j=0; j<ccCount; ++j){
|
for(int j=0; j<ccCount; ++j){
|
||||||
for(int i=0; i<commandTypes.size(); ++i){
|
for(int i=0; i<commandTypes.size(); ++i){
|
||||||
if(commandTypes[i]->getClass()== CommandClass(j)){
|
if(commandTypes[i]->getClass()== CommandClass(j)){
|
||||||
|
@ -402,6 +403,7 @@ const CommandType *UnitType::getFirstCtOfClass(CommandClass commandClass) const{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
@ -410,8 +412,9 @@ const CommandType *UnitType::getFirstCtOfClass(CommandClass commandClass) const{
|
||||||
|
|
||||||
const SkillType *UnitType::getFirstStOfClass(SkillClass skillClass) const{
|
const SkillType *UnitType::getFirstStOfClass(SkillClass skillClass) const{
|
||||||
if(firstSkillTypeOfClass[skillClass] == NULL) {
|
if(firstSkillTypeOfClass[skillClass] == NULL) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] skillClass = %d\n",__FILE__,__FUNCTION__,__LINE__,skillClass);
|
||||||
|
|
||||||
|
/*
|
||||||
for(int j= 0; j<scCount; ++j){
|
for(int j= 0; j<scCount; ++j){
|
||||||
for(int i= 0; i<skillTypes.size(); ++i){
|
for(int i= 0; i<skillTypes.size(); ++i){
|
||||||
if(skillTypes[i]->getClass()== SkillClass(j)){
|
if(skillTypes[i]->getClass()== SkillClass(j)){
|
||||||
|
@ -419,6 +422,7 @@ const SkillType *UnitType::getFirstStOfClass(SkillClass skillClass) const{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
return firstSkillTypeOfClass[skillClass];
|
return firstSkillTypeOfClass[skillClass];
|
||||||
|
|
|
@ -51,7 +51,7 @@ void LuaScript::loadCode(const string &code, const string &name){
|
||||||
int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.size(), name.c_str());
|
int errorCode= luaL_loadbuffer(luaState, code.c_str(), code.size(), name.c_str());
|
||||||
if(errorCode!=0){
|
if(errorCode!=0){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throw runtime_error("Error loading lua code: " + errorToString(errorCode));
|
throw runtime_error("Error loading lua code: " + errorToString(errorCode));
|
||||||
}
|
}
|
||||||
|
@ -60,12 +60,12 @@ void LuaScript::loadCode(const string &code, const string &name){
|
||||||
errorCode= lua_pcall(luaState, 0, 0, 0)!=0;
|
errorCode= lua_pcall(luaState, 0, 0, 0)!=0;
|
||||||
if(errorCode!=0){
|
if(errorCode!=0){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throw runtime_error("Error initializing lua: " + errorToString(errorCode));
|
throw runtime_error("Error initializing lua: " + errorToString(errorCode));
|
||||||
}
|
}
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void LuaScript::beginCall(const string& functionName){
|
||||||
lua_getglobal(luaState, functionName.c_str());
|
lua_getglobal(luaState, functionName.c_str());
|
||||||
argumentCount= 0;
|
argumentCount= 0;
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void LuaScript::endCall(){
|
||||||
#endif
|
#endif
|
||||||
lua_pcall(luaState, argumentCount, 0, 0);
|
lua_pcall(luaState, argumentCount, 0, 0);
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ void LuaScript::registerFunction(LuaFunction luaFunction, const string &function
|
||||||
lua_pushcfunction(luaState, luaFunction);
|
lua_pushcfunction(luaState, luaFunction);
|
||||||
lua_setglobal(luaState, functionName.c_str());
|
lua_setglobal(luaState, functionName.c_str());
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ LuaArguments::LuaArguments(lua_State *luaState){
|
||||||
this->luaState= luaState;
|
this->luaState= luaState;
|
||||||
returnCount= 0;
|
returnCount= 0;
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,13 +148,13 @@ int LuaArguments::getInt(int argumentIndex) const{
|
||||||
#endif
|
#endif
|
||||||
if(!lua_isnumber(luaState, argumentIndex)){
|
if(!lua_isnumber(luaState, argumentIndex)){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throwLuaError("Can not get int from Lua state");
|
throwLuaError("Can not get int from Lua state");
|
||||||
}
|
}
|
||||||
int result = luaL_checkint(luaState, argumentIndex);
|
int result = luaL_checkint(luaState, argumentIndex);
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -174,14 +174,14 @@ Vec2i LuaArguments::getVec2i(int argumentIndex) const{
|
||||||
|
|
||||||
if(!lua_istable(luaState, argumentIndex)){
|
if(!lua_istable(luaState, argumentIndex)){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throwLuaError("Can not get vec2i from Lua state, value on the stack is not a table");
|
throwLuaError("Can not get vec2i from Lua state, value on the stack is not a table");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(luaL_getn(luaState, argumentIndex)!=2){
|
if(luaL_getn(luaState, argumentIndex)!=2){
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throwLuaError("Can not get vec2i from Lua state, array size not 2");
|
throwLuaError("Can not get vec2i from Lua state, array size not 2");
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ Vec2i LuaArguments::getVec2i(int argumentIndex) const{
|
||||||
lua_pop(luaState, 1);
|
lua_pop(luaState, 1);
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ void LuaArguments::returnInt(int value){
|
||||||
++returnCount;
|
++returnCount;
|
||||||
lua_pushinteger(luaState, value);
|
lua_pushinteger(luaState, value);
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void LuaArguments::returnVec2i(const Vec2i &value){
|
||||||
lua_pushnumber(luaState, value.y);
|
lua_pushnumber(luaState, value.y);
|
||||||
lua_rawseti(luaState, -2, 2);
|
lua_rawseti(luaState, -2, 2);
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ void LuaArguments::throwLuaError(const string &message) const{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
streflop_init<streflop::Simple>();
|
//streflop_init<streflop::Simple>();
|
||||||
#endif
|
#endif
|
||||||
throw runtime_error("Lua error: " + message + "\n\nLua Stack:\n" + stackString);
|
throw runtime_error("Lua error: " + message + "\n\nLua Stack:\n" + stackString);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue