summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/tyler/file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'noatun-plugins/tyler/file.cpp')
-rw-r--r--noatun-plugins/tyler/file.cpp65
1 files changed, 42 insertions, 23 deletions
diff --git a/noatun-plugins/tyler/file.cpp b/noatun-plugins/tyler/file.cpp
index 432a7be..79fb663 100644
--- a/noatun-plugins/tyler/file.cpp
+++ b/noatun-plugins/tyler/file.cpp
@@ -39,43 +39,62 @@ static TQString getSavePath(void)
return dirs.saveLocation("data", "noatun/") + "tylerstates";
}
-extern "C" void save_effect(t_effect *effect)
+extern "C"
{
- TQFile file(getSavePath());
- if(!file.open(IO_WriteOnly))
- return;
+ KDE_EXPORT void save_effect(t_effect *effect)
+ {
+ TQFile file(getSavePath());
+ if(!file.open(IO_WriteOnly))
+ {
+ return;
+ }
- for(unsigned i = 0; i < sizeof(t_effect); i++)
- file.putch( *((byte *)effect + i) );
+ for(unsigned i = 0; i < sizeof(t_effect); i++)
+ {
+ file.putch( *((byte *)effect + i) );
+ }
+ }
}
t_effect effects[100];
int nb_effects=0;
-extern "C" void load_effects()
+extern "C"
{
- TQFile file(getDataPath());
- if(!file.open(IO_ReadOnly))
- exit(1);
-
- unsigned int i;
- nb_effects = 0;
- while(!file.atEnd())
+ KDE_EXPORT void load_effects()
{
- byte* ptr_effect = (byte *)&effects[nb_effects++];
- for(i = 0; i < sizeof(t_effect); i++)
- ptr_effect[i] = file.getch();
+ TQFile file(getDataPath());
+ if(!file.open(IO_ReadOnly))
+ {
+ exit(1);
+ }
+
+ unsigned int i;
+ nb_effects = 0;
+ while(!file.atEnd())
+ {
+ byte* ptr_effect = (byte *)&effects[nb_effects++];
+ for(i = 0; i < sizeof(t_effect); i++)
+ {
+ ptr_effect[i] = file.getch();
+ }
+ }
}
}
-extern "C" void load_random_effect(t_effect *effect)
+extern "C"
{
- if(nb_effects > 0)
+ KDE_EXPORT void load_random_effect(t_effect *effect)
{
- int num_effect = rand() % nb_effects;
- unsigned int i;
+ if(nb_effects > 0)
+ {
+ int num_effect = rand() % nb_effects;
+ unsigned int i;
- for(i = 0; i < sizeof(t_effect) ; i++)
- *((byte*)effect+i)=*((byte*)(&effects[num_effect])+i);
+ for(i = 0; i < sizeof(t_effect) ; i++)
+ {
+ *((byte*)effect+i) = *((byte*)(&effects[num_effect])+i);
+ }
+ }
}
}