mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Remove trailing whitespace
This commit is contained in:
+26
-26
@@ -4,13 +4,13 @@
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
@@ -37,9 +37,9 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s,
|
||||
fprintf(stderr, "Unable to open opcodes file '%s'. Thats bad.\n", filename);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
map<string, uint16> eq;
|
||||
|
||||
|
||||
//load the opcode file into eq, could swap in a nice XML parser here
|
||||
char line[2048];
|
||||
int lineno = 0;
|
||||
@@ -49,11 +49,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s,
|
||||
line[0] = '\0'; //for blank line at end of file
|
||||
if(fgets(line, sizeof(line), opf) == nullptr)
|
||||
break;
|
||||
|
||||
|
||||
//ignore any line that dosent start with OP_
|
||||
if(line[0] != 'O' || line[1] != 'P' || line[2] != '_')
|
||||
continue;
|
||||
|
||||
|
||||
char *num = line+3; //skip OP_
|
||||
//look for the = sign
|
||||
while(*num != '=' && *num != '\0') {
|
||||
@@ -66,19 +66,19 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s,
|
||||
}
|
||||
*num = '\0'; //null terminate the name
|
||||
num++; //num should point to the opcode
|
||||
|
||||
|
||||
//read the opcode
|
||||
if(sscanf(num, "0x%hx", &curop) != 1) {
|
||||
if(report_errors) fprintf(stderr, "Malformed opcode at %s:%d\n", filename, lineno);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//we have a name and our opcode... stick it in the map
|
||||
eq[line] = curop;
|
||||
}
|
||||
fclose(opf);
|
||||
|
||||
|
||||
|
||||
|
||||
//do the mapping and store them in the shared memory array
|
||||
bool ret = true;
|
||||
EmuOpcode emu_op;
|
||||
@@ -92,7 +92,7 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s,
|
||||
if(report_errors) printf("I will let you continue, since you may have gotten all the opcodes you need.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//find the opcode in the file
|
||||
res = eq.find(op_name);
|
||||
if(res == eq.end()) {
|
||||
@@ -100,11 +100,11 @@ bool OpcodeManager::LoadOpcodesFile(const char *filename, OpcodeSetStrategy *s,
|
||||
//ret = false;
|
||||
continue; //continue to give them a list of all missing opcodes
|
||||
}
|
||||
|
||||
|
||||
//ship the mapping off to shared mem.
|
||||
s->Set(emu_op, res->second);
|
||||
}
|
||||
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -148,17 +148,17 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors)
|
||||
NormalMemStrategy s;
|
||||
s.it = this;
|
||||
MOpcodes.lock();
|
||||
|
||||
|
||||
loaded = true;
|
||||
eq_to_emu = new EmuOpcode[MAX_EQ_OPCODE];
|
||||
emu_to_eq = new uint16[_maxEmuOpcode];
|
||||
EQOpcodeCount = MAX_EQ_OPCODE;
|
||||
EmuOpcodeCount = _maxEmuOpcode;
|
||||
|
||||
|
||||
//dont need to set eq_to_emu cause every element should get a value
|
||||
memset(eq_to_emu, 0, sizeof(EmuOpcode)*MAX_EQ_OPCODE);
|
||||
memset(emu_to_eq, 0, sizeof(uint16)*_maxEmuOpcode);
|
||||
|
||||
|
||||
bool ret = LoadOpcodesFile(filename, &s, report_errors);
|
||||
MOpcodes.unlock();
|
||||
return ret;
|
||||
@@ -167,15 +167,15 @@ bool RegularOpcodeManager::LoadOpcodes(const char *filename, bool report_errors)
|
||||
bool RegularOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) {
|
||||
if(!loaded)
|
||||
return(LoadOpcodes(filename));
|
||||
|
||||
|
||||
NormalMemStrategy s;
|
||||
s.it = this;
|
||||
MOpcodes.lock();
|
||||
|
||||
|
||||
memset(eq_to_emu, 0, sizeof(uint16)*MAX_EQ_OPCODE);
|
||||
|
||||
|
||||
bool ret = LoadOpcodesFile(filename, &s, report_errors);
|
||||
|
||||
|
||||
MOpcodes.unlock();
|
||||
return(ret);
|
||||
}
|
||||
@@ -209,12 +209,12 @@ EmuOpcode RegularOpcodeManager::EQToEmu(const uint16 eq_op) {
|
||||
}
|
||||
|
||||
void RegularOpcodeManager::SetOpcode(EmuOpcode emu_op, uint16 eq_op) {
|
||||
|
||||
|
||||
//clear out old mapping
|
||||
uint16 oldop = emu_to_eq[emu_op];
|
||||
if(oldop != 0)
|
||||
eq_to_emu[oldop] = OP_Unknown;
|
||||
|
||||
|
||||
//use our strategy, since we have it
|
||||
NormalMemStrategy s;
|
||||
s.it = this;
|
||||
@@ -233,7 +233,7 @@ NullOpcodeManager::NullOpcodeManager()
|
||||
: MutableOpcodeManager() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) {
|
||||
return(true);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ bool NullOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) {
|
||||
bool NullOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
uint16 NullOpcodeManager::EmuToEQ(const EmuOpcode emu_op) {
|
||||
return(0);
|
||||
}
|
||||
@@ -254,7 +254,7 @@ EmptyOpcodeManager::EmptyOpcodeManager()
|
||||
: MutableOpcodeManager() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) {
|
||||
return(true);
|
||||
}
|
||||
@@ -262,7 +262,7 @@ bool EmptyOpcodeManager::LoadOpcodes(const char *filename, bool report_errors) {
|
||||
bool EmptyOpcodeManager::ReloadOpcodes(const char *filename, bool report_errors) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
uint16 EmptyOpcodeManager::EmuToEQ(const EmuOpcode emu_op) {
|
||||
map<EmuOpcode, uint16>::iterator f;
|
||||
f = emu_to_eq.find(emu_op);
|
||||
|
||||
Reference in New Issue
Block a user